Merge pull request #110 from owncloud/dev

Dev
This commit is contained in:
David-Development 2013-08-11 05:23:08 -07:00
commit 232a3ab763
34 changed files with 721 additions and 402 deletions

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.luhmer.owncloudnewsreader"
android:versionCode="22"
android:versionName="0.3.9" >
android:versionCode="26"
android:versionName="0.4.3" >
<uses-sdk
android:minSdkVersion="7"

Binary file not shown.

View file

@ -2,14 +2,69 @@
<head>
<style type="text/css">
@font-face {
font-family: "Roboto";
font-family: "ROBOTO_BLACK";
src: url('file:///android_asset/fonts/Roboto-Black.ttf');
}
@font-face {
font-family: "ROBOTO_BOLD";
src: url('file:///android_asset/fonts/Roboto-Bold.ttf');
}
@font-face {
font-family: "ROBOTO_CONDENSED_BOLD";
src: url('file:///android_asset/fonts/Roboto-BoldCondensed.ttf');
}
@font-face {
font-family: "ROBOTO_CONDENSED";
src: url('file:///android_asset/fonts/Roboto-Condensed.ttf');
}
@font-face {
font-family: "ROBOTO_LIGHT";
src: url('file:///android_asset/fonts/Roboto-Light.ttf');
}
@font-face {
font-family: "ROBOTO_MEDIUM";
src: url('file:///android_asset/fonts/Roboto-Medium.ttf');
}
@font-face {
font-family: "ROBOTO_REGULAR";
src: url('file:///android_asset/fonts/Roboto-Regular.ttf');
}
@font-face {
font-family: "ROBOTO_THIN";
src: url('file:///android_asset/fonts/Roboto-Thin.ttf');
}
@font-face {
font-family: "ROBOTOSLAB_BOLD";
src: url('file:///android_asset/fonts/RobotoSlab-Bold.ttf');
}
@font-face {
font-family: "ROBOTOSLAB_LIGHT";
src: url('file:///android_asset/fonts/RobotoSlab-Light.ttf');
}
@font-face {
font-family: "ROBOTOSLAB_REGULAR";
src: url('file:///android_asset/fonts/RobotoSlab-Regular.ttf');
}
@font-face {
font-family: "ROBOTOSLAB_THIN";
src: url('file:///android_asset/fonts/RobotoSlab-Thin.ttf');
}
body#darkTheme {
/* font-family: 'Segoe UI', 'Segoe UI Light', 'Droid Sans', sans-serif ; */
font-family: 'Roboto', 'Segoe UI', 'Segoe UI Light';
font-family: 'ROBOTO_FONT_STYLE', 'Segoe UI', 'Segoe UI Light';
font-size: 18px;
font-weight: normal;
background-color: #222;
@ -19,7 +74,7 @@
}
body#lightTheme {
font-family: 'Roboto', 'Segoe UI', 'Segoe UI Light';
font-family: 'ROBOTO_FONT_STYLE', 'Segoe UI', 'Segoe UI Light';
font-size: 18px;
font-weight: normal;
background-color: #E1E1E1;

View file

@ -39,8 +39,7 @@
android:id="@+id/cb_AllowAllSSLCertificates"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pref_title_AllowAllSSLCertificates"
style="@style/RobotoFontStyle" />
android:text="@string/pref_title_AllowAllSSLCertificates" />
<LinearLayout
android:layout_width="match_parent"
@ -51,16 +50,14 @@
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:text="@android:string/cancel"
style="@style/RobotoFontStyle" />
android:text="@android:string/cancel" />
<com.devspark.robototextview.widget.RobotoButton
android:id="@+id/btn_signin"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:text="@string/action_sign_in_short"
style="@style/RobotoFontStyle" />
android:text="@string/action_sign_in_short" />
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:baselineAligned="false"
android:orientation="vertical"
android:paddingTop="10dp" >
<!--
android:background="@drawable/checkbox_background"
android:button="@drawable/checkbox"
-->
<com.devspark.robototextview.widget.RobotoTextView
android:id="@+id/tv_subscription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:gravity="center_vertical"
android:singleLine="true"
android:text="@string/empty_view_header"
android:textSize="15sp" />
<com.devspark.robototextview.widget.RobotoTextView
android:id="@+id/summary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:gravity="center_vertical"
android:lines="1"
android:text="@string/empty_view_content"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>

View file

@ -27,8 +27,7 @@
android:singleLine="true"
android:text="Hi"
android:layout_weight="1"
android:textSize="14sp"
style="@style/RobotoFontStyle" />
android:textSize="14sp" />
<com.devspark.robototextview.widget.RobotoTextView
android:id="@+id/tv_item_date"
@ -39,8 +38,7 @@
android:layout_gravity="right"
android:text="Hi"
android:singleLine="true"
android:textSize="14sp"
style="@style/RobotoFontStyle" />
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
@ -66,8 +64,7 @@
android:lines="2"
android:textSize="17sp"
android:text="Hi"
android:textStyle="bold"
style="@style/RobotoFontStyle" />
android:textStyle="bold" />
<com.devspark.robototextview.widget.RobotoTextView
android:id="@+id/body"
@ -79,8 +76,7 @@
android:text="Hi"
android:textColor="#858585"
android:textSize="14sp"
android:autoLink="none"
style="@style/RobotoFontStyle" />
android:autoLink="none" />
<!-- android:gravity="center_vertical" -->
</LinearLayout>
@ -99,8 +95,7 @@
android:clickable="false"
android:focusable="false"
android:button="@drawable/checkbox_background_empty"
android:background="@drawable/checkbox_background"
style="@style/RobotoFontStyle" />
android:background="@drawable/checkbox_background" />
<!-- android:layout_width="40dp"
android:layout_height="40dp" -->
@ -111,8 +106,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"
android:focusable="false"
style="@style/RobotoFontStyle" />
android:focusable="false" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View file

@ -30,8 +30,7 @@
android:layout_gravity="center_vertical|left"
android:textSize="15sp"
android:layout_weight="1"
android:text="@string/tv_clickHereToOpenItem"
style="@style/RobotoFontStyle" />
android:text="@string/tv_clickHereToOpenItem" />
<com.devspark.robototextview.widget.RobotoCheckBox
android:id="@+id/cb_lv_item_starred"
@ -41,8 +40,7 @@
android:background="@drawable/checkbox_background"
android:button="@drawable/checkbox_background_empty"
android:clickable="false"
android:focusable="false"
style="@style/RobotoFontStyle" />
android:focusable="false" />
<com.devspark.robototextview.widget.RobotoCheckBox
android:id="@+id/cb_lv_item_read"
@ -51,8 +49,7 @@
android:layout_marginLeft="5dp"
android:layout_gravity="center_vertical"
android:clickable="false"
android:focusable="false"
style="@style/RobotoFontStyle" />
android:focusable="false" />
</LinearLayout>
<WebView

View file

@ -46,8 +46,7 @@
android:singleLine="true"
android:text="Hi"
android:layout_weight="1"
android:textSize="14sp"
style="@style/RobotoFontStyle" />
android:textSize="14sp" />
<com.devspark.robototextview.widget.RobotoTextView
android:id="@+id/tv_item_date"
@ -58,8 +57,7 @@
android:layout_gravity="right"
android:text="Hi"
android:singleLine="true"
android:textSize="14sp"
style="@style/RobotoFontStyle" />
android:textSize="14sp" />
</LinearLayout>
<com.devspark.robototextview.widget.RobotoTextView
@ -72,8 +70,7 @@
android:textSize="17sp"
android:text="hidsaf afdal fjdkas f fsadfdas fds asöjkdafdssö fjkök"
android:layout_weight="1"
android:textStyle="bold"
style="@style/RobotoFontStyle" />
android:textStyle="bold" />
</LinearLayout>
@ -84,7 +81,6 @@
android:layout_marginRight="@dimen/listview_row_margin_right"
android:clickable="false"
android:focusable="false"
android:gravity="center_vertical|center_horizontal"
style="@style/RobotoFontStyle" />
android:gravity="center_vertical|center_horizontal" />
</LinearLayout>

View file

@ -21,8 +21,7 @@
android:textSize="20sp"
android:textStyle="bold"
android:layout_weight="1"
android:textIsSelectable="false"
style="@style/RobotoFontStyle" />/
android:textIsSelectable="false" />
<!--app:typeface="roboto_thin" -->
@ -33,7 +32,6 @@
android:gravity="center_vertical|right"
android:singleLine="true"
android:textIsSelectable="false"
android:layout_marginRight="20dp"
style="@style/RobotoFontStyle" />
android:layout_marginRight="20dp" />
</LinearLayout>

View file

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:paddingTop="10dp"
android:orientation="horizontal"
android:baselineAligned="false" >
<!--
android:background="@drawable/checkbox_background"
android:button="@drawable/checkbox"
-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:id="@+id/tv_subscription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center_vertical"
android:singleLine="true"
android:textSize="15sp"
android:text="@string/empty_view_header" />
<TextView
android:id="@+id/summary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center_vertical"
android:lines="1"
android:textSize="18sp"
android:textStyle="bold"
android:text="@string/empty_view_content" />
</LinearLayout>
</LinearLayout>

View file

@ -20,8 +20,7 @@
android:gravity="center_vertical"
android:singleLine="true"
android:layout_weight="1"
android:textSize="20sp"
style="@style/RobotoFontStyle" />
android:textSize="20sp" />
<com.devspark.robototextview.widget.RobotoTextView
android:id="@+id/tv_unreadCount"
@ -29,7 +28,6 @@
android:layout_height="match_parent"
android:gravity="center_vertical|right"
android:singleLine="true"
android:layout_marginRight="20dp"
style="@style/RobotoFontStyle" />
android:layout_marginRight="20dp" />
</LinearLayout>

View file

@ -1,42 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<resources>
<!--<string name="non_sorted_articles">Nicht zugeordnete Artikel</string>-->
<!--EMAIL-->
<!--Action Bar Items-->
<!--Strings related to login-->
<!--<string name="pref_title_owncloudRootPath">ownCloud root address</string>-->
<!--<string name="pref_default_username">admin</string>-->
<!--Toast Messages-->
<!--Strings related to Settings-->
<!--General settings-->
<!--<string name="pref_title_social_recommendations">Enable social recommendations</string>
<string name="pref_description_social_recommendations">Recommendations for people to contact based on your message history</string>-->
<!--Settings for Display-->
<!--Login Dialog-->
<!--Data & Sync-->
<!--<string name="pref_title_sync_frequency">Sync frequency</string>
<string-array name="pref_sync_frequency_titles">
<item>15 minutes</item>
<item>30 minutes</item>
<item>1 hour</item>
<item>3 hours</item>
<item>6 hours</item>
<item>Never</item>
</string-array>
<string-array name="pref_sync_frequency_values">
<item>15</item>
<item>30</item>
<item>60</item>
<item>180</item>
<item>360</item>
<item>-1</item>
</string-array>-->
<!--<string name="pref_title_system_sync_settings">System sync settings</string>-->
<!--Example settings for Notifications-->
<!--<string name="pref_header_notifications">Notifications</string>
<string name="pref_title_new_message_notifications">New message notifications</string>
<string name="pref_title_ringtone">Ringtone</string>
<string name="pref_ringtone_silent">Silent</string>
<string name="pref_title_vibrate">Vibrate</string>-->
</resources>

View file

@ -85,6 +85,18 @@
<!-- General settings -->
<string name="pref_header_general">General</string>
<string name="pref_title_general_sort_order">Sort Order</string>
<string-array name="pref_general_sort_order">
<item>New -> Old</item>
<item>Old -> New</item>
</string-array>
<string-array name="pref_general_sort_order_values">
<item>desc</item>
<item>asc</item>
</string-array>
<!--
<string name="pref_title_social_recommendations">Enable social recommendations</string>
<string name="pref_description_social_recommendations">Recommendations for people to contact based on your message history</string>
@ -92,7 +104,8 @@
<string name="calculating_cache_size">Calculating cache size.. Please wait.</string>
<string name="reset_cache_unsaved_changes">There are unsynchronized changes. Would you like to reset the cache anyway?</string>
<string name="warning">Warning</string>
<string name="pref_title_AutoSyncOnStart">Sync on startup</string>
@ -107,6 +120,8 @@
<string name="pref_header_display">Display</string>
<string name="pref_title_app_theme">App theme (requires restart to apply)</string>
<string name="pref_title_feed_list_layout">Feed list layout</string>
<string name="pref_display_font_layout">Font (requires restart to apply)</string>
<string-array name="pref_display_apptheme">
<item>Dark</item>
@ -128,6 +143,36 @@
<item>2</item>
</string-array>
<string-array name="pref_display_font">
<item>Roboto Thin</item>
<item>Roboto Light</item>
<item>Roboto Regular</item>
<item>Roboto Medium</item>
<item>Roboto Bold</item>
<item>Roboto Black</item>
<item>Roboto Condensed</item>
<item>Roboto Condensed Bold</item>
<item>Roboto Slab Thin</item>
<item>Roboto Slab Light</item>
<item>Roboto Slab Regular</item>
<item>Roboto Slab Bold</item>
</string-array>
<string-array name="pref_display_font_values">
<item>0</item>
<item>2</item>
<item>4</item>
<item>6</item>
<item>8</item>
<item>10</item>
<item>12</item>
<item>14</item>
<item>16</item>
<item>17</item>
<item>18</item>
<item>19</item>
</string-array>
<!-- Login Dialog -->
<string name="login_dialog_title_error">Error</string>
@ -164,9 +209,11 @@
<item>2000</item>
<item>5000</item>
<item>10000</item>
</string-array>
<!--
<string name="pref_title_sync_frequency">Sync frequency</string>

View file

@ -31,11 +31,18 @@
</style>
-->
<!--
<style name="RobotoFontStyle">
<item name="typeface">roboto_light</item>
<item name="typeface">robotoslab_regular</item> -->
<!-- https://github.com/johnkil/Android-RobotoTextView#usage --> <!--
</style>
<style name="RobotoFontStyleBold">
<item name="typeface">robotoslab_bold</item>
</style>
-->
<style name="LoginDialogEditTextStyle" parent="@style/RobotoFontStyle" >
<style name="LoginDialogEditTextStyle" >
<item name="android:layout_marginTop">4dp</item>
<item name="android:layout_marginLeft">4dp</item>
<item name="android:layout_marginRight">4dp</item>

View file

@ -11,8 +11,6 @@
android:entries="@array/pref_display_apptheme"
android:entryValues="@array/pref_display_apptheme_values"
android:key="sp_app_theme"
android:negativeButtonText="@null"
android:positiveButtonText="@null"
android:title="@string/pref_title_app_theme" />
@ -21,10 +19,16 @@
android:entries="@array/pref_display_feed_list_layout"
android:entryValues="@array/pref_display_feed_list_layout_values"
android:key="sp_feed_list_layout"
android:negativeButtonText="@null"
android:positiveButtonText="@null"
android:title="@string/pref_title_feed_list_layout" />
<ListPreference
android:defaultValue="2"
android:entries="@array/pref_display_font"
android:entryValues="@array/pref_display_font_values"
android:key="sp_font"
android:title="@string/pref_display_font_layout" />
<!--
This preference simply launches an intent when selected. Use this UI sparingly, per
design guidelines.

View file

@ -70,6 +70,13 @@
android:key="cb_MarkAsReadWhileScrolling"
android:title="@string/pref_title_MarkAsReadWhileScrolling" />
<ListPreference
android:defaultValue="desc"
android:entries="@array/pref_general_sort_order"
android:entryValues="@array/pref_general_sort_order_values"
android:key="sp_sort_order"
android:title="@string/pref_title_general_sort_order" />
<!--
NOTE: Hide buttons to simplify the UI. Users can touch outside the dialog to
dismiss it.

View file

@ -14,26 +14,26 @@ public class RobotoTypefaceManager {
/*
* Available values for the "typeface" attribute.
*/
private final static int ROBOTO_THIN = 0;
private final static int ROBOTO_THIN_ITALIC = 1;
private final static int ROBOTO_LIGHT = 2;
private final static int ROBOTO_LIGHT_ITALIC = 3;
private final static int ROBOTO_REGULAR = 4;
private final static int ROBOTO_ITALIC = 5;
private final static int ROBOTO_MEDIUM = 6;
private final static int ROBOTO_MEDIUM_ITALIC = 7;
private final static int ROBOTO_BOLD = 8;
private final static int ROBOTO_BOLD_ITALIC = 9;
private final static int ROBOTO_BLACK = 10;
private final static int ROBOTO_BLACK_ITALIC = 11;
private final static int ROBOTO_CONDENSED = 12;
private final static int ROBOTO_CONDENSED_ITALIC = 13;
private final static int ROBOTO_CONDENSED_BOLD = 14;
private final static int ROBOTO_CONDENSED_BOLD_ITALIC = 15;
private final static int ROBOTOSLAB_THIN = 16;
private final static int ROBOTOSLAB_LIGHT = 17;
private final static int ROBOTOSLAB_REGULAR = 18;
private final static int ROBOTOSLAB_BOLD = 19;
public final static int ROBOTO_THIN = 0;
public final static int ROBOTO_THIN_ITALIC = 1;
public final static int ROBOTO_LIGHT = 2;
public final static int ROBOTO_LIGHT_ITALIC = 3;
public final static int ROBOTO_REGULAR = 4;
public final static int ROBOTO_ITALIC = 5;
public final static int ROBOTO_MEDIUM = 6;
public final static int ROBOTO_MEDIUM_ITALIC = 7;
public final static int ROBOTO_BOLD = 8;
public final static int ROBOTO_BOLD_ITALIC = 9;
public final static int ROBOTO_BLACK = 10;
public final static int ROBOTO_BLACK_ITALIC = 11;
public final static int ROBOTO_CONDENSED = 12;
public final static int ROBOTO_CONDENSED_ITALIC = 13;
public final static int ROBOTO_CONDENSED_BOLD = 14;
public final static int ROBOTO_CONDENSED_BOLD_ITALIC = 15;
public final static int ROBOTOSLAB_THIN = 16;
public final static int ROBOTOSLAB_LIGHT = 17;
public final static int ROBOTOSLAB_REGULAR = 18;
public final static int ROBOTOSLAB_BOLD = 19;
/**
* Array of created typefaces for later reused.

View file

@ -25,6 +25,7 @@ import de.luhmer.owncloudnewsreader.data.ConcreteFeedItem;
import de.luhmer.owncloudnewsreader.data.FolderSubscribtionItem;
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
import de.luhmer.owncloudnewsreader.helper.FavIconHandler;
import de.luhmer.owncloudnewsreader.helper.FontHelper;
import de.luhmer.owncloudnewsreader.helper.ThemeChooser;
import de.luhmer.owncloudnewsreader.interfaces.ExpListTextClicked;
@ -38,9 +39,10 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
private ArrayList<FolderSubscribtionItem> mCategoriesArrayList;
private SparseArray<SparseArray<ConcreteFeedItem>> mItemsArrayList;
private boolean showOnlyUnread = false;
public static final String ALL_UNREAD_ITEMS = "-10";
public static final String ALL_STARRED_ITEMS = "-11";
public static final String ALL_ITEMS = "-12";
public static final String ITEMS_WITHOUT_FOLDER = "-22";
@ -143,6 +145,9 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
vi.inflate(R.layout.subscription_list_sub_item, view, true);
if(item != null)
view.setTag(item.id_database);
FontHelper fHelper = new FontHelper(mContext);
fHelper.setFontForAllChildren(view, fHelper.getFont());
} else {
view = (LinearLayout) convertView;
}
@ -166,7 +171,7 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
else
{
TextView textTV = (TextView) view.findViewById(R.id.summary);
textTV.setText("Sorry, something went wrong here :(");
textTV.setText(mContext.getString(R.string.login_dialog_text_something_went_wrong));
TextView tV_UnreadCount = (TextView) view.findViewById(R.id.tv_unreadCount);
tV_UnreadCount.setText("0");
@ -222,6 +227,9 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
LayoutInflater vi = (LayoutInflater) mContext.getSystemService(inflater);
vi.inflate(R.layout.subscription_list_item, view, true);
FontHelper fHelper = new FontHelper(mContext);
fHelper.setFontForAllChildren(view, fHelper.getFont());
ImageView indicatorImage = (ImageView) view.findViewById(R.id.img_View_expandable_indicator);
TextView txt_Summary = (TextView) view.findViewById(R.id.summary);
TextView textFeedCount = (TextView) view.findViewById(R.id.tV_feedsCount);

View file

@ -21,8 +21,8 @@ import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
import de.luhmer.owncloudnewsreader.helper.FontHelper;
import de.luhmer.owncloudnewsreader.reader.owncloud.OwnCloudReaderMethods;
/**
@ -76,6 +76,9 @@ public class LoginDialogFragment extends SherlockDialogFragment {
})*/
.setTitle(getString(R.string.action_sign_in_short));
FontHelper fHelper = new FontHelper(getActivity());
fHelper.setFontForAllChildren(view, fHelper.getFont());
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
mUsername = mPrefs.getString(SettingsActivity.EDT_USERNAME_STRING, null);
mPassword = mPrefs.getString(SettingsActivity.EDT_PASSWORD_STRING, null);
@ -385,12 +388,13 @@ public class LoginDialogFragment extends SherlockDialogFragment {
}
} catch (Exception e) {
exception_message = e.getLocalizedMessage();
if(e.getLocalizedMessage() != null)
exception_message = e.getLocalizedMessage();
else if(e instanceof NullPointerException)
exception_message = getString(R.string.login_dialog_text_something_went_wrong);
return -1;
}
//if(version_info > 1101)
// Sho
return 0;
}

View file

@ -9,10 +9,13 @@ import java.util.List;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -25,6 +28,7 @@ import android.widget.ProgressBar;
import com.actionbarsherlock.app.SherlockFragment;
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
import de.luhmer.owncloudnewsreader.helper.FontHelper;
import de.luhmer.owncloudnewsreader.helper.ImageHandler;
import de.luhmer.owncloudnewsreader.helper.ThemeChooser;
@ -389,6 +393,11 @@ public class NewsDetailFragment extends SherlockFragment {
if(ThemeChooser.isDarkTheme(context))
web_template = web_template.replace("<body id=\"lightTheme\">", "<body id=\"darkTheme\">");
FontHelper fHelper = new FontHelper(context);
web_template = web_template.replace("ROBOTO_FONT_STYLE", fHelper.getFontName());
/*
DisplayMetrics displaymetrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);

View file

@ -23,6 +23,7 @@ import com.devspark.robototextview.widget.RobotoCheckBox;
import de.luhmer.owncloudnewsreader.ListView.SubscriptionExpandableListAdapter;
import de.luhmer.owncloudnewsreader.cursor.NewsListCursorAdapter;
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
import de.luhmer.owncloudnewsreader.database.DatabaseConnection.SORT_DIRECTION;
import de.luhmer.owncloudnewsreader.helper.MenuUtilsSherlockFragmentActivity;
/**
@ -182,9 +183,6 @@ public class NewsReaderDetailFragment extends SherlockListFragment {
})
.create()
.show();
}
}
@ -234,6 +232,8 @@ public class NewsReaderDetailFragment extends SherlockListFragment {
@Override
public void onResume() {
//setEmptyListView();
lastItemPosition = -1;
super.onResume();
}
@ -262,6 +262,7 @@ public class NewsReaderDetailFragment extends SherlockListFragment {
if(lvAdapter == null)
{
lvAdapter = new NewsListCursorAdapter(getActivity(), cursor);
//setEmptyListView();
setListAdapter(lvAdapter);
}
else
@ -282,14 +283,20 @@ public class NewsReaderDetailFragment extends SherlockListFragment {
if(ID_FOLDER != null)
if(ID_FOLDER.equals(SubscriptionExpandableListAdapter.ALL_STARRED_ITEMS))
onlyStarredItems = true;
SORT_DIRECTION sDirection = SORT_DIRECTION.asc;
String sortDirection = mPrefs.getString(SettingsActivity.SP_SORT_ORDER, "desc");
if(sortDirection.equals(SORT_DIRECTION.desc.toString()))
sDirection = SORT_DIRECTION.desc;
if(idFeed != null)
return dbConn.getAllItemsForFeed(idFeed, onlyUnreadItems, onlyStarredItems);
return dbConn.getAllItemsForFeed(idFeed, onlyUnreadItems, onlyStarredItems, sDirection);
else if(idFolder != null)
{
if(idFolder.equals(SubscriptionExpandableListAdapter.ALL_STARRED_ITEMS))
onlyUnreadItems = false;
return dbConn.getAllItemsForFolder(idFolder, onlyUnreadItems);
return dbConn.getAllItemsForFolder(idFolder, onlyUnreadItems, sDirection);
}
return null;
}
@ -298,9 +305,23 @@ public class NewsReaderDetailFragment extends SherlockListFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_newsreader_detail, container, false);
View rootView = inflater.inflate(R.layout.fragment_newsreader_detail, container, false);
return rootView;
}
/*
private void setEmptyListView() {
LayoutInflater inflator=getActivity().getLayoutInflater();
View emptyView = inflator.inflate(R.layout.subscription_detail_list_item_empty, (ViewGroup)getView());
FontHelper fHelper = new FontHelper(getActivity());
fHelper.setFontForAllChildren(emptyView, fHelper.getFont());
ListView lv = getListView();
if(lv != null)
lv.setEmptyView(emptyView);
}
*/
@Override
public void onListItemClick(ListView l, View v, int position, long id) {

View file

@ -4,6 +4,7 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.View;
import com.actionbarsherlock.app.SherlockDialogFragment;
import com.actionbarsherlock.view.Menu;
@ -41,6 +42,13 @@ public class NewsReaderListActivity extends MenuUtilsSherlockFragmentActivity im
* device.
*/
private boolean mTwoPane;
/**
* @return the mTwoPane
*/
public boolean ismTwoPane() {
return mTwoPane;
}
//IabHelper mHelper;
static final String TAG = "NewsReaderListActivity";
@ -113,9 +121,20 @@ public class NewsReaderListActivity extends MenuUtilsSherlockFragmentActivity im
// Block children layout for now
PullToRefreshExpandableListView ptrel = ((PullToRefreshExpandableListView)nlf.eListView);
BlockingExpandableListView bView = ((BlockingExpandableListView) ptrel.getRefreshableView());
int firstVisPos = bView.getFirstVisiblePosition();
View firstVisView = bView.getChildAt(0);
int top = firstVisView != null ? firstVisView.getTop() : 0;
// Number of items added before the first visible item
int itemsAddedBeforeFirstVisible = 0;
bView.setBlockLayoutChildren(true);
nlf.lvAdapter.notifyDataSetChanged();
bView.setBlockLayoutChildren(false);
// Call setSelectionFromTop to change the ListView position
bView.setSelectionFromTop(firstVisPos + itemsAddedBeforeFirstVisible, top);
}
}

View file

@ -35,8 +35,6 @@ import de.luhmer.owncloudnewsreader.reader.IReader;
import de.luhmer.owncloudnewsreader.reader.OnAsyncTaskCompletedListener;
import de.luhmer.owncloudnewsreader.reader.owncloud.API;
import de.luhmer.owncloudnewsreader.reader.owncloud.OwnCloud_Reader;
import de.luhmer.owncloudnewsreader.reader.owncloud.apiv1.APIv1;
import de.luhmer.owncloudnewsreader.reader.owncloud.apiv2.APIv2;
/**
* A list fragment representing a list of NewsReader. This fragment also
@ -149,7 +147,11 @@ public class NewsReaderListFragment extends SherlockFragment implements OnCreate
}
}
private boolean isTwoPaneMode() {
if(getActivity() != null)
return ((NewsReaderListActivity) getActivity()).ismTwoPane();
return false;
}
public void StartSync()
{
@ -174,35 +176,47 @@ public class NewsReaderListFragment extends SherlockFragment implements OnCreate
UpdateSyncButtonLayout();
}
private void HandleExceptionMessages(Exception ex) {
if(ex instanceof HttpHostConnectException)
ShowToastLong("Cannot connect to the Host !");
else if(ex instanceof HttpResponseException)
{
HttpResponseException responseException = (HttpResponseException) ex;
//if(responseException.getStatusCode() == 401)
// ShowToastLong("Authentication failed");
//else
ShowToastLong(responseException.getLocalizedMessage());
}
else
ShowToastLong(ex.getLocalizedMessage());
UpdateSyncButtonLayout();
}
OnAsyncTaskCompletedListener onAsyncTask_GetVersionFinished = new OnAsyncTaskCompletedListener() {
@Override
public void onAsyncTaskCompleted(int task_id, Object task_result) {
if(!(task_result instanceof Exception))
{
API api = null;
String appVersion = task_result.toString();
int versionCode = 0;
if(appVersion != null)
{
appVersion = appVersion.replace(".", "");
versionCode = Integer.parseInt(appVersion);
if(isTwoPaneMode() || isAdded()) {
if(!(task_result instanceof Exception))
{
String appVersion = task_result.toString();
API api = API.GetRightApiForVersion(appVersion, getActivity());
((OwnCloud_Reader) _Reader).setApi(api);
_Reader.Start_AsyncTask_PerformItemStateChange(Constants.TaskID_PerformStateChange, getActivity(), onAsyncTask_PerformTagExecute);
if(eListView != null)
eListView.getLoadingLayoutProxy().setLastUpdatedLabel(getString(R.string.pull_to_refresh_updateTags));
}
if (versionCode >= 1101) {
api = new APIv2(getActivity());
} else {
api = new APIv1(getActivity());
}
else
HandleExceptionMessages((Exception) task_result);
((OwnCloud_Reader) _Reader).setApi(api);
_Reader.Start_AsyncTask_PerformItemStateChange(Constants.TaskID_PerformStateChange, getActivity(), onAsyncTask_PerformTagExecute);
if(eListView != null)
eListView.getLoadingLayoutProxy().setLastUpdatedLabel(getString(R.string.pull_to_refresh_updateTags));
UpdateSyncButtonLayout();
}
UpdateSyncButtonLayout();
}
};
@ -210,63 +224,46 @@ public class NewsReaderListFragment extends SherlockFragment implements OnCreate
OnAsyncTaskCompletedListener onAsyncTask_PerformTagExecute = new OnAsyncTaskCompletedListener() {
@Override
public void onAsyncTaskCompleted(int task_id, Object task_result) {
if(task_result != null)//task result is null if there was an error
{
if((Boolean) task_result)
{
//dbConn.resetDatabase();
if(task_id == Constants.TaskID_PerformStateChange)
{
_Reader.Start_AsyncTask_GetFolder(Constants.TaskID_GetFolder, getActivity(), onAsyncTask_GetFolder);
if(eListView != null)
eListView.getLoadingLayoutProxy().setLastUpdatedLabel(getString(R.string.pull_to_refresh_updateFolder));
}
else
_Reader.setSyncRunning(true);
}
else
UpdateSyncButtonLayout();
}
else
UpdateSyncButtonLayout();
if(isTwoPaneMode() || isAdded()) {
if(task_result != null)//task result is null if there was an error
{
if((Boolean) task_result)
{
if(task_id == Constants.TaskID_PerformStateChange)
{
_Reader.Start_AsyncTask_GetFolder(Constants.TaskID_GetFolder, getActivity(), onAsyncTask_GetFolder);
if(eListView != null)
eListView.getLoadingLayoutProxy().setLastUpdatedLabel(getString(R.string.pull_to_refresh_updateFolder));
}
else
_Reader.setSyncRunning(true);
}
else
UpdateSyncButtonLayout();
}
else
UpdateSyncButtonLayout();
}
}
};
OnAsyncTaskCompletedListener onAsyncTask_GetFolder = new OnAsyncTaskCompletedListener() {
@Override
public void onAsyncTaskCompleted(int task_id, Object task_result) {
if(task_result != null)
{
if(task_result instanceof HttpHostConnectException)
ShowToastLong("Cannot connect to the Host !");
else if(task_result instanceof HttpResponseException)
{
HttpResponseException responseException = (HttpResponseException) task_result;
//if(responseException.getStatusCode() == 401)
// ShowToastLong("Authentication failed");
//else
ShowToastLong(responseException.getLocalizedMessage());
}
else
ShowToastLong(((Exception)task_result).getLocalizedMessage());
UpdateSyncButtonLayout();
}
else
{
_Reader.Start_AsyncTask_GetFeeds(Constants.TaskID_GetFeeds, getActivity(), onAsyncTask_GetFeed);
if(eListView != null)
eListView.getLoadingLayoutProxy().setLastUpdatedLabel(getString(R.string.pull_to_refresh_updateFeeds));
}
lvAdapter.notifyDataSetChanged();
Log.d(TAG, "onAsyncTask_GetFolder Finished");
if(isTwoPaneMode() || isAdded()) {
if(task_result != null)
HandleExceptionMessages((Exception) task_result);
else {
_Reader.Start_AsyncTask_GetFeeds(Constants.TaskID_GetFeeds, getActivity(), onAsyncTask_GetFeed);
if(eListView != null)
eListView.getLoadingLayoutProxy().setLastUpdatedLabel(getString(R.string.pull_to_refresh_updateFeeds));
}
lvAdapter.notifyDataSetChanged();
Log.d(TAG, "onAsyncTask_GetFolder Finished");
}
}
};
@ -279,58 +276,58 @@ public class NewsReaderListFragment extends SherlockFragment implements OnCreate
@Override
public void onAsyncTaskCompleted(int task_id, Object task_result) {
if(task_result != null)
{
ShowToastLong(((Exception)task_result).getLocalizedMessage());
UpdateSyncButtonLayout();
}
else
{
//dbConn.resetRssItemsDatabase();
_Reader.Start_AsyncTask_GetItems(Constants.TaskID_GetItems, getActivity(), onAsyncTask_GetItems, TAGS.ALL);//Recieve all unread Items
//_Reader.Start_AsyncTask_GetFeeds(3, getActivity(), onAsyncTask_GetFeeds, TAGS.ALL_STARRED);//Recieve all starred Items
if(eListView != null)
eListView.getLoadingLayoutProxy().setLastUpdatedLabel(getString(R.string.pull_to_refresh_updateItems));
}
lvAdapter.ReloadAdapter();
Log.d(TAG, "onAsyncTask_GetFeed Finished");
//lvAdapter.notifyDataSetChanged();
//eListView.setAdapter(new SubscriptionExpandableListAdapter(getActivity(), dbConn));
//new AsyncTask_GetFeeds(0, getActivity(), onAsyncTask_GetFeeds).execute(username, password, Constants._TAG_LABEL_UNREAD);
//new AsyncTask_GetFeeds(0, getActivity(), onAsyncTask_GetFeeds).execute(username, password, Constants._TAG_LABEL_STARRED);
if(isTwoPaneMode() || isAdded()) {
if(task_result != null)
HandleExceptionMessages((Exception) task_result);
else {
//dbConn.resetRssItemsDatabase();
_Reader.Start_AsyncTask_GetItems(Constants.TaskID_GetItems, getActivity(), onAsyncTask_GetItems, TAGS.ALL);//Recieve all unread Items
//_Reader.Start_AsyncTask_GetFeeds(3, getActivity(), onAsyncTask_GetFeeds, TAGS.ALL_STARRED);//Recieve all starred Items
if(eListView != null)
eListView.getLoadingLayoutProxy().setLastUpdatedLabel(getString(R.string.pull_to_refresh_updateItems));
}
lvAdapter.ReloadAdapter();
Log.d(TAG, "onAsyncTask_GetFeed Finished");
//lvAdapter.notifyDataSetChanged();
//eListView.setAdapter(new SubscriptionExpandableListAdapter(getActivity(), dbConn));
//new AsyncTask_GetFeeds(0, getActivity(), onAsyncTask_GetFeeds).execute(username, password, Constants._TAG_LABEL_UNREAD);
//new AsyncTask_GetFeeds(0, getActivity(), onAsyncTask_GetFeeds).execute(username, password, Constants._TAG_LABEL_STARRED);
}
}
};
OnAsyncTaskCompletedListener onAsyncTask_GetItems = new OnAsyncTaskCompletedListener() {
@Override
public void onAsyncTaskCompleted(int task_id, Object task_result) {
if(task_result != null)
ShowToastLong(((Exception)task_result).getLocalizedMessage());
lvAdapter.notifyDataSetChanged();
if(eListView != null)
eListView.getLoadingLayoutProxy().setLastUpdatedLabel(null);
UpdateSyncButtonLayout();
lvAdapter.ReloadAdapter();
NewsReaderListActivity nlActivity = (NewsReaderListActivity) getActivity();
nlActivity.UpdateItemList();
Log.d(TAG, "onAsyncTask_GetItems Finished");
//fireUpdateFinishedClicked();
public void onAsyncTaskCompleted(int task_id, Object task_result) {
if(isTwoPaneMode() || isAdded()) {
if(task_result != null)
HandleExceptionMessages((Exception) task_result);
lvAdapter.notifyDataSetChanged();
if(eListView != null)
eListView.getLoadingLayoutProxy().setLastUpdatedLabel(null);
UpdateSyncButtonLayout();
lvAdapter.ReloadAdapter();
NewsReaderListActivity nlActivity = (NewsReaderListActivity) getActivity();
if(nlActivity != null)
nlActivity.UpdateItemList();
Log.d(TAG, "onAsyncTask_GetItems Finished");
//fireUpdateFinishedClicked();
}
}
};
@ -339,8 +336,7 @@ public class NewsReaderListFragment extends SherlockFragment implements OnCreate
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View V = null;
try
{
if(isTwoPaneMode() || isAdded()) {
V = inflater.inflate(R.layout.expandable_list_layout, container, false);
//eListView = (ExpandableListView) V.findViewById(R.id.expandableListView);
eListView = (PullToRefreshExpandableListView) V.findViewById(R.id.expandableListView);
@ -362,7 +358,7 @@ public class NewsReaderListFragment extends SherlockFragment implements OnCreate
eListView.setOnChildClickListener(onChildClickListener);
//eListView.setSmoothScrollbarEnabled(true);
View empty = inflater.inflate(R.layout.subscription_list_item_empty, null, false);
View empty = inflater.inflate(R.layout.subscription_detail_list_item_empty, null, false);
getActivity().addContentView(empty, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
eListView.setEmptyView(empty);
/*
@ -384,11 +380,6 @@ public class NewsReaderListFragment extends SherlockFragment implements OnCreate
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
if(mPrefs.getBoolean(SettingsActivity.CB_SYNCONSTARTUP_STRING, false))
StartSync();
}
catch(Exception ex)
{
ex.printStackTrace();
}
return V;
@ -525,45 +516,4 @@ public class NewsReaderListFragment extends SherlockFragment implements OnCreate
if(asyncUpdateFinished != null)
asyncUpdateFinished.FinishedUpdate();
}*/
}
/*
dbConn.insertNewSubscription("Ungelesene Artikel");
dbConn.insertNewSubscription("Markierte Artikel");
dbConn.insertNewSubscription("Android");
dbConn.insertNewSubscription("Apple");
dbConn.insertNewSubscription("Bugtracker");
dbConn.insertNewSubscription("Development");
dbConn.insertNewSubscription("Linux");
dbConn.insertNewSubscription("Software");
dbConn.insertNewSubscription("Owncloud");
dbConn.insertNewSubscription("Other");
dbConn.insertNewSub_Subscription("4droid", dbConn.getIdOfSubscription("Android"));
dbConn.insertNewSub_Subscription("GIGA Rss Feed", dbConn.getIdOfSubscription("Android"));
dbConn.insertNewSub_Subscription("macnews.de", dbConn.getIdOfSubscription("Apple"));
dbConn.insertNewSub_Subscription("MACNOTES.DE", dbConn.getIdOfSubscription("Apple"));
dbConn.insertNewSub_Subscription("FS Bugtracker", dbConn.getIdOfSubscription("Bugtracker"));
dbConn.insertNewSub_Subscription("Code 2 Learn", dbConn.getIdOfSubscription("Development"));
dbConn.insertNewSub_Subscription("Coding Horror", dbConn.getIdOfSubscription("Development"));
dbConn.insertNewSub_Subscription("Canoncial", dbConn.getIdOfSubscription("Linux"));
dbConn.insertNewSub_Subscription("iTek Zone", dbConn.getIdOfSubscription("Software"));
dbConn.insertNewSub_Subscription("CNET", dbConn.getIdOfSubscription("Other"));
dbConn.insertNewSub_Subscription("ownCloud.org", dbConn.getIdOfSubscription("Owncloud"));
dbConn.insertNewFeed("Samsung Game Pad pops up on Galaxy S4 site, outs Note 3?",
"http://news.cnet.com/8301-17938_105-57574766-1/samsung-game-pad-pops-up-on-galaxy-s4-site-outs-note-3/?part\u003drss\u0026subj\u003dnews\u0026tag\u003d2547-1_3-0-20",
"The gaming controller works with devices up to 6.3 inches, perhaps suggesting Samsung is planning a bigger phablet, or should we be calling it a \"tabone?\"",
"0",
dbConn.getIdOfSubscription("CNET"));
*/
}

View file

@ -7,7 +7,10 @@ import java.util.List;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.res.Configuration;
import android.os.AsyncTask;
import android.os.Build;
@ -27,6 +30,7 @@ import com.actionbarsherlock.view.MenuItem;
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
import de.luhmer.owncloudnewsreader.helper.ImageHandler;
import de.luhmer.owncloudnewsreader.helper.PostDelayHandler;
import de.luhmer.owncloudnewsreader.helper.ThemeChooser;
/**
@ -65,7 +69,8 @@ public class SettingsActivity extends SherlockPreferenceActivity {
public static final String SP_APP_THEME = "sp_app_theme";
public static final String SP_FEED_LIST_LAYOUT = "sp_feed_list_layout";
public static final String SP_MAX_CACHE_SIZE = "sp_max_cache_size";
public static final String SP_FONT = "sp_font";
public static final String SP_SORT_ORDER = "sp_sort_order";
static //public static final String PREF_SIGN_IN_DIALOG = "sPref_signInDialog";
@ -78,8 +83,7 @@ public class SettingsActivity extends SherlockPreferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
protected void onCreate(Bundle savedInstanceState) {
ThemeChooser.chooseTheme(this);
super.onCreate(savedInstanceState);
@ -95,7 +99,7 @@ public class SettingsActivity extends SherlockPreferenceActivity {
setupSimplePreferencesScreen();
}
/**
* Shows the simplified settings UI if the device configuration if the
* device configuration dictates that a simplified, single-pane UI should be
@ -224,7 +228,6 @@ public class SettingsActivity extends SherlockPreferenceActivity {
preference
.setSummary(index >= 0 ? listPreference.getEntries()[index]
: null);
} /*else if (preference instanceof RingtonePreference) {
// For ringtone preferences, look up the correct display value
// using RingtoneManager.
@ -409,11 +412,13 @@ public class SettingsActivity extends SherlockPreferenceActivity {
{
bindPreferenceSummaryToValue(prefFrag.findPreference(SP_APP_THEME));
bindPreferenceSummaryToValue(prefFrag.findPreference(SP_FEED_LIST_LAYOUT));
bindPreferenceSummaryToValue(prefFrag.findPreference(SP_FONT));
}
else
{
bindPreferenceSummaryToValue(prefAct.findPreference(SP_APP_THEME));
bindPreferenceSummaryToValue(prefAct.findPreference(SP_FEED_LIST_LAYOUT));
bindPreferenceSummaryToValue(prefAct.findPreference(SP_FONT));
}
}
@ -433,6 +438,7 @@ public class SettingsActivity extends SherlockPreferenceActivity {
bindPreferenceBooleanToValue(prefFrag.findPreference(CB_SHOWONLYUNREAD_STRING));
bindPreferenceBooleanToValue(prefFrag.findPreference(CB_NAVIGATE_WITH_VOLUME_BUTTONS_STRING));
bindPreferenceBooleanToValue(prefFrag.findPreference(CB_MARK_AS_READ_WHILE_SCROLLING_STRING));
bindPreferenceSummaryToValue(prefFrag.findPreference(SP_SORT_ORDER));
}
else
{
@ -446,6 +452,7 @@ public class SettingsActivity extends SherlockPreferenceActivity {
bindPreferenceBooleanToValue(prefAct.findPreference(CB_SHOWONLYUNREAD_STRING));
bindPreferenceBooleanToValue(prefAct.findPreference(CB_NAVIGATE_WITH_VOLUME_BUTTONS_STRING));
bindPreferenceBooleanToValue(prefAct.findPreference(CB_MARK_AS_READ_WHILE_SCROLLING_STRING));
bindPreferenceSummaryToValue(prefAct.findPreference(SP_SORT_ORDER));
}
}
@ -481,17 +488,54 @@ public class SettingsActivity extends SherlockPreferenceActivity {
((EditTextPreference) preference).getDialog().dismiss();
DatabaseConnection dbConn = new DatabaseConnection(_mActivity);
dbConn.resetDatabase();
dbConn.closeDatabase();
boolean resetDatabase = true;
if(dbConn.getAllNewReadItems().size() > 0)
resetDatabase = false;
else if(dbConn.getAllNewUnreadItems().size() > 0)
resetDatabase = false;
else if(dbConn.getAllNewStarredItems().size() > 0)
resetDatabase = false;
else if(dbConn.getAllNewUnstarredItems().size() > 0)
resetDatabase = false;
ImageHandler.clearCache(_mActivity);
LoginDialogFragment.ShowAlertDialog("Information" , "Cache is cleared!", _mActivity);
new GetCacheSizeAsync().execute((Void)null);
if(resetDatabase) {
ResetDatabase();
} else {
new AlertDialog.Builder(_mActivity)
.setTitle(_mActivity.getString(R.string.warning))
.setMessage(_mActivity.getString(R.string.reset_cache_unsaved_changes))
.setPositiveButton(_mActivity.getString(android.R.string.ok), new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
PostDelayHandler pDelayHandler = new PostDelayHandler(_mActivity);
pDelayHandler.stopRunningPostDelayHandler();
ResetDatabase();
}
})
.setNegativeButton(_mActivity.getString(android.R.string.no), null)
.create()
.show();
}
dbConn.closeDatabase();
return false;
}
});
}
private static void ResetDatabase() {
DatabaseConnection dbConn = new DatabaseConnection(_mActivity);
try {
dbConn.resetDatabase();
ImageHandler.clearCache(_mActivity);
LoginDialogFragment.ShowAlertDialog("Information" , "Cache is cleared!", _mActivity);
new GetCacheSizeAsync().execute((Void)null);
} finally {
dbConn.closeDatabase();
}
}
public static class GetCacheSizeAsync extends AsyncTask<Void, Void, Void> {

View file

@ -26,12 +26,14 @@ import android.widget.TextView;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.devspark.robototextview.widget.RobotoCheckBox;
import com.devspark.robototextview.widget.RobotoTextView;
import de.luhmer.owncloudnewsreader.NewsDetailFragment;
import de.luhmer.owncloudnewsreader.NewsReaderListActivity;
import de.luhmer.owncloudnewsreader.R;
import de.luhmer.owncloudnewsreader.SettingsActivity;
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
import de.luhmer.owncloudnewsreader.helper.FontHelper;
import de.luhmer.owncloudnewsreader.helper.PostDelayHandler;
import de.luhmer.owncloudnewsreader.reader.IReader;
import de.luhmer.owncloudnewsreader.reader.owncloud.OwnCloud_Reader;
@ -65,7 +67,7 @@ public class NewsListCursorAdapter extends CursorAdapter {
}
@Override
public void bindView(View view, final Context context, Cursor cursor) {
public void bindView(final View view, final Context context, Cursor cursor) {
final String idItemDb = cursor.getString(0);
switch (selectedDesign) {
@ -85,6 +87,9 @@ public class NewsListCursorAdapter extends CursorAdapter {
break;
}
FontHelper fHelper = new FontHelper(context);
fHelper.setFontForAllChildren(view, fHelper.getFont());
RobotoCheckBox cb = (RobotoCheckBox) view.findViewById(R.id.cb_lv_item_starred);
cb.setOnCheckedChangeListener(null);
@ -111,6 +116,12 @@ public class NewsListCursorAdapter extends CursorAdapter {
Boolean isChecked = dbConn.isFeedUnreadStarred(cursor.getString(0), true);
//Log.d("ISREAD", "" + isChecked + " - Cursor: " + cursor.getString(0));
cbRead.setChecked(isChecked);
if(!isChecked) {
RobotoTextView textView = (RobotoTextView) view.findViewById(R.id.summary);
fHelper.setFontStyleForSingleView(textView, fHelper.getFontUnreadStyle());
}
cbRead.setClickable(true);
cbRead.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@ -120,6 +131,20 @@ public class NewsListCursorAdapter extends CursorAdapter {
UpdateListCursor(mContext);
pDelayHandler.DelayTimer();
RobotoTextView textView = (RobotoTextView) view.findViewById(R.id.summary);
if(textView != null)
{
FontHelper fHelper = new FontHelper(context);
if(isChecked)
fHelper.setFontStyleForSingleView(textView, fHelper.getFont());
//textView.setTextAppearance(mContext, R.style.RobotoFontStyle);
else
fHelper.setFontStyleForSingleView(textView, fHelper.getFontUnreadStyle());
//textView.setTextAppearance(mContext, R.style.RobotoFontStyleBold);
textView.invalidate();
}
}
});
}

View file

@ -45,6 +45,8 @@ public class DatabaseConnection {
public static final String RSS_ITEM_READ_TEMP = "read_temp";
public static final String RSS_ITEM_STARRED_TEMP = "starred_temp";
public enum SORT_DIRECTION { asc, desc };
public static final boolean DATABASE_DEBUG_MODE = false; //(false && Constants.DEBUG_MODE) ? true: false;
@ -476,7 +478,7 @@ public class DatabaseConnection {
+ RSS_ITEM_PUBDATE + ", " + RSS_ITEM_STARRED + ", " + RSS_ITEM_GUIDHASH + ", " + RSS_ITEM_GUID + ", " + RSS_ITEM_STARRED_TEMP + ", " + RSS_ITEM_READ_TEMP;
}
public Cursor getAllItemsForFeed(String ID_SUBSCRIPTION, boolean onlyUnread, boolean onlyStarredItems) {
public Cursor getAllItemsForFeed(String ID_SUBSCRIPTION, boolean onlyUnread, boolean onlyStarredItems, SORT_DIRECTION sortDirection) {
String buildSQL = getAllFeedsSelectStatement() +
" FROM " + RSS_ITEM_TABLE +
@ -490,7 +492,7 @@ public class DatabaseConnection {
else if(onlyStarredItems)
buildSQL += " AND " + RSS_ITEM_STARRED_TEMP + " = 1";
buildSQL += " ORDER BY " + RSS_ITEM_PUBDATE + " desc";
buildSQL += " ORDER BY " + RSS_ITEM_PUBDATE + " " + sortDirection.toString();
if(DATABASE_DEBUG_MODE)
Log.d("DB_HELPER", "getAllItemsForFeed SQL: " + buildSQL);
@ -544,7 +546,7 @@ public class DatabaseConnection {
public int getCountFeedsForFolder(String ID_FOLDER, boolean onlyUnread) {
Cursor cursor = getAllItemsForFolder(ID_FOLDER, onlyUnread);
Cursor cursor = getAllItemsForFolder(ID_FOLDER, onlyUnread, SORT_DIRECTION.desc);
int count = cursor.getCount();
cursor.close();
@ -588,11 +590,11 @@ public class DatabaseConnection {
return result;
}*/
public Cursor getAllItemsForFolder(String ID_FOLDER, boolean onlyUnread) {
public Cursor getAllItemsForFolder(String ID_FOLDER, boolean onlyUnread, SORT_DIRECTION sortDirection) {
String buildSQL = getAllFeedsSelectStatement() +
" FROM " + RSS_ITEM_TABLE;
if(!(ID_FOLDER.equals(SubscriptionExpandableListAdapter.ALL_UNREAD_ITEMS) || ID_FOLDER.equals(SubscriptionExpandableListAdapter.ALL_STARRED_ITEMS)))//Wenn nicht Alle Artikel ausgewaehlt wurde (-10) oder (-11) fuer Starred Feeds
if(!(ID_FOLDER.equals(SubscriptionExpandableListAdapter.ALL_UNREAD_ITEMS) || ID_FOLDER.equals(SubscriptionExpandableListAdapter.ALL_STARRED_ITEMS) || ID_FOLDER.equals(SubscriptionExpandableListAdapter.ALL_ITEMS)))//Wenn nicht Alle Artikel ausgewaehlt wurde (-10) oder (-11) fuer Starred Feeds
{
buildSQL += " WHERE subscription_id_subscription IN " +
"(SELECT sc.rowid " +
@ -614,7 +616,7 @@ public class DatabaseConnection {
buildSQL += " WHERE " + RSS_ITEM_STARRED_TEMP + " = 1";
buildSQL += " ORDER BY " + RSS_ITEM_PUBDATE + " desc";
buildSQL += " ORDER BY " + RSS_ITEM_PUBDATE + " " + sortDirection.toString();
// buildSQL += " WHERE starred = 1";

View file

@ -0,0 +1,130 @@
package de.luhmer.owncloudnewsreader.helper;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Typeface;
import android.preference.PreferenceManager;
import android.util.SparseIntArray;
import android.view.View;
import android.view.ViewGroup;
import com.devspark.robototextview.RobotoTypefaceManager;
import com.devspark.robototextview.widget.RobotoButton;
import com.devspark.robototextview.widget.RobotoCheckBox;
import com.devspark.robototextview.widget.RobotoEditText;
import com.devspark.robototextview.widget.RobotoTextView;
import de.luhmer.owncloudnewsreader.SettingsActivity;
public class FontHelper {
Context context;
public FontHelper(Context context) {
this.context = context;
}
public void setFontForAllChildren(View view, Typeface typeface) {
ViewGroup viewGroup = (ViewGroup) view;
setForAllChildrenRekursiv(viewGroup, typeface);
}
public void setFontStyleForSingleView(View view, Typeface typeface) {
setFontForView(view, typeface);
}
private void setForAllChildrenRekursiv(ViewGroup viewGroup, Typeface typeface) {
for(int i = 0; i < viewGroup.getChildCount(); i++) {
View view = viewGroup.getChildAt(i);
setFontForView(view, typeface);
}
}
private void setFontForView(View view, Typeface typeface) {
if(view instanceof ViewGroup)
setFontForAllChildren(view, typeface);
else if(view instanceof RobotoTextView)
((RobotoTextView)view).setTypeface(typeface);
else if(view instanceof RobotoButton)
((RobotoButton)view).setTypeface(typeface);
else if(view instanceof RobotoCheckBox)
((RobotoCheckBox)view).setTypeface(typeface);
else if(view instanceof RobotoEditText)
((RobotoEditText)view).setTypeface(typeface);
}
public Typeface getFont() {
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(context);
int font = Integer.parseInt(mPrefs.getString(SettingsActivity.SP_FONT, "2"));
return RobotoTypefaceManager.obtaintTypeface(context, font);
}
public Typeface getFontUnreadStyle() {
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(context);
int font = Integer.parseInt(mPrefs.getString(SettingsActivity.SP_FONT, "2"));
font = unreadFonts.get(font, font);
return RobotoTypefaceManager.obtaintTypeface(context, font);
}
private final SparseIntArray unreadFonts = new SparseIntArray() {
{
put(RobotoTypefaceManager.ROBOTO_THIN, RobotoTypefaceManager.ROBOTO_LIGHT);
put(RobotoTypefaceManager.ROBOTO_LIGHT, RobotoTypefaceManager.ROBOTO_REGULAR);
put(RobotoTypefaceManager.ROBOTO_REGULAR, RobotoTypefaceManager.ROBOTO_MEDIUM);
put(RobotoTypefaceManager.ROBOTO_MEDIUM, RobotoTypefaceManager.ROBOTO_BOLD);
put(RobotoTypefaceManager.ROBOTO_BOLD, RobotoTypefaceManager.ROBOTO_BLACK);
put(RobotoTypefaceManager.ROBOTO_BLACK, RobotoTypefaceManager.ROBOTO_BLACK_ITALIC);
put(RobotoTypefaceManager.ROBOTO_CONDENSED, RobotoTypefaceManager.ROBOTO_CONDENSED_BOLD);
put(RobotoTypefaceManager.ROBOTO_CONDENSED_BOLD, RobotoTypefaceManager.ROBOTO_CONDENSED_BOLD_ITALIC);
put(RobotoTypefaceManager.ROBOTOSLAB_THIN, RobotoTypefaceManager.ROBOTOSLAB_LIGHT);
put(RobotoTypefaceManager.ROBOTOSLAB_LIGHT, RobotoTypefaceManager.ROBOTOSLAB_REGULAR);
put(RobotoTypefaceManager.ROBOTOSLAB_REGULAR, RobotoTypefaceManager.ROBOTOSLAB_BOLD);
put(RobotoTypefaceManager.ROBOTOSLAB_BOLD, RobotoTypefaceManager.ROBOTOSLAB_BOLD);
}
};
public String getFontName() {
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(context);
int typefaceValue = Integer.parseInt(mPrefs.getString(SettingsActivity.SP_FONT, "2"));
String typeFaceName = "";
switch (typefaceValue) {
case RobotoTypefaceManager.ROBOTO_THIN:
typeFaceName = "ROBOTO_THIN";
break;
case RobotoTypefaceManager.ROBOTO_LIGHT:
typeFaceName = "ROBOTO_LIGHT";
break;
case RobotoTypefaceManager.ROBOTO_REGULAR:
typeFaceName = "ROBOTO_REGULAR";
break;
case RobotoTypefaceManager.ROBOTO_MEDIUM:
typeFaceName = "ROBOTO_MEDIUM";
break;
case RobotoTypefaceManager.ROBOTO_BOLD:
typeFaceName = "ROBOTO_BOLD";
break;
case RobotoTypefaceManager.ROBOTO_BLACK:
typeFaceName = "ROBOTO_BLACK";
break;
case RobotoTypefaceManager.ROBOTO_CONDENSED:
typeFaceName = "ROBOTO_CONDENSED";
break;
case RobotoTypefaceManager.ROBOTO_CONDENSED_BOLD:
typeFaceName = "ROBOTO_CONDENSED_BOLD";
break;
case RobotoTypefaceManager.ROBOTOSLAB_THIN:
typeFaceName = "ROBOTOSLAB_THIN";
break;
case RobotoTypefaceManager.ROBOTOSLAB_LIGHT:
typeFaceName = "ROBOTOSLAB_LIGHT";
break;
case RobotoTypefaceManager.ROBOTOSLAB_REGULAR:
typeFaceName = "ROBOTOSLAB_REGULAR";
break;
case RobotoTypefaceManager.ROBOTOSLAB_BOLD:
typeFaceName = "ROBOTOSLAB_BOLD";
break;
}
return typeFaceName;
}
}

View file

@ -4,6 +4,7 @@ import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Build;
import android.preference.PreferenceManager;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.widget.Toast;
@ -24,6 +25,7 @@ import de.luhmer.owncloudnewsreader.ListView.SubscriptionExpandableListAdapter;
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
import de.luhmer.owncloudnewsreader.reader.IReader;
import de.luhmer.owncloudnewsreader.reader.OnAsyncTaskCompletedListener;
import de.luhmer.owncloudnewsreader.reader.owncloud.API;
import de.luhmer.owncloudnewsreader.reader.owncloud.OwnCloud_Reader;
public class MenuUtilsSherlockFragmentActivity extends SherlockFragmentActivity {
@ -41,6 +43,8 @@ public class MenuUtilsSherlockFragmentActivity extends SherlockFragmentActivity
private static MenuItem menuItemMarkAllAsRead;
private static MenuItem menuItemDownloadMoreItems;
static IReader _Reader;
/**
* @return the menuItemUpdater
*/
@ -156,12 +160,10 @@ public class MenuUtilsSherlockFragmentActivity extends SherlockFragmentActivity
}
private static void DownloadMoreItems()
{
NewsReaderDetailFragment ndf = ((NewsReaderDetailFragment) activity.getSupportFragmentManager().findFragmentById(R.id.newsreader_detail_container));
{
DatabaseConnection dbConn = new DatabaseConnection(activity);
int count = dbConn.getCountFeedsForFolder(SubscriptionExpandableListAdapter.ALL_UNREAD_ITEMS, true);
if(count > Constants.maxItemsCount)
int count = dbConn.getCountFeedsForFolder(SubscriptionExpandableListAdapter.ALL_ITEMS, false);
if(count >= Constants.maxItemsCount)
{
String text = activity.getString(R.string.max_items_count_reached);
text = text.replace("XX", "" + Constants.maxItemsCount);
@ -179,13 +181,31 @@ public class MenuUtilsSherlockFragmentActivity extends SherlockFragmentActivity
}
else
{
IReader _Reader = new OwnCloud_Reader();
_Reader.Start_AsyncTask_GetOldItems(0, activity, onAsyncTaskComplete, ndf.getIdFeed(), ndf.getIdFolder());
String username = PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext()).getString("edt_username", "");
String password = PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext()).getString("edt_password", "");
_Reader = new OwnCloud_Reader();
((OwnCloud_Reader)_Reader).Start_AsyncTask_GetVersion(Constants.TaskID_GetVersion, activity, onAsyncTaskGetVersionFinished, username, password);
Toast.makeText(activity, activity.getString(R.string.toast_GettingMoreItems), Toast.LENGTH_SHORT).show();
}
}
static OnAsyncTaskCompletedListener onAsyncTaskGetVersionFinished = new OnAsyncTaskCompletedListener() {
@Override
public void onAsyncTaskCompleted(int task_id, Object task_result) {
if(_Reader != null) {
String appVersion = task_result.toString();
API api = API.GetRightApiForVersion(appVersion, activity);
((OwnCloud_Reader) _Reader).setApi(api);
NewsReaderDetailFragment ndf = ((NewsReaderDetailFragment) activity.getSupportFragmentManager().findFragmentById(R.id.newsreader_detail_container));
_Reader.Start_AsyncTask_GetOldItems(Constants.TaskID_GetItems, activity, onAsyncTaskComplete, ndf.getIdFeed(), ndf.getIdFolder());
}
}
};
static OnAsyncTaskCompletedListener onAsyncTaskComplete = new OnAsyncTaskCompletedListener() {
@Override
public void onAsyncTaskCompleted(int task_id, Object task_result) {

View file

@ -25,18 +25,20 @@ import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import de.luhmer.owncloudnewsreader.SettingsActivity;
import de.luhmer.owncloudnewsreader.helper.CustomTrustManager;
import de.luhmer.owncloudnewsreader.reader.owncloud.API;
import de.luhmer.owncloudnewsreader.util.Base64;
public class HttpJsonRequest {
//private static final String TAG = "HttpJsonRequest";
//@TargetApi(Build.VERSION_CODES.GINGERBREAD)
@SuppressLint("DefaultLocale")
public static InputStream PerformJsonRequest(String urlString, List<NameValuePair> nameValuePairs, final String username, final String password, Context context) throws AuthenticationException, Exception
{
if(nameValuePairs != null)
urlString += "&" + URLEncodedUtils.format(nameValuePairs, "utf-8");
URL url = new URL(urlString);
URL url = new URL(API.validateURL(urlString));
HttpURLConnection urlConnection = getUrlConnection(url, context, username, password);
//HttpsURLConnection urlConnection = null;
@ -69,6 +71,12 @@ public class HttpJsonRequest {
urlConnection.setReadTimeout(120000);//2min
urlConnection.setRequestProperty("Content-Type","application/json");
//if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD)
// CookieHandler.setDefault(new CookieManager());
//urlConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 (.NET CLR 3.5.30729)");
//urlConnection.setRequestProperty("Host", "de.luhmer.ownCloudNewsReader");
urlConnection.connect();
@ -117,7 +125,7 @@ public class HttpJsonRequest {
@SuppressLint("DefaultLocale")
public static int performTagChangeRequest(String urlString, String username, String password, Context context, String content) throws Exception
{
URL url = new URL(urlString);
URL url = new URL(API.validateURL(urlString));
HttpURLConnection urlConnection = getUrlConnection(url, context, username, password);
urlConnection.setDoOutput(true);
urlConnection.setRequestMethod("PUT");

View file

@ -1,28 +1,68 @@
package de.luhmer.owncloudnewsreader.reader.owncloud;
import java.util.List;
import java.util.regex.Pattern;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import de.luhmer.owncloudnewsreader.SettingsActivity;
import de.luhmer.owncloudnewsreader.reader.FeedItemTags;
import de.luhmer.owncloudnewsreader.reader.FeedItemTags.TAGS;
import de.luhmer.owncloudnewsreader.reader.owncloud.apiv1.APIv1;
import de.luhmer.owncloudnewsreader.reader.owncloud.apiv2.APIv2;
public abstract class API {
protected SharedPreferences mPrefs;
//static final Pattern RemoveAllDoubleSlashes = Pattern.compile("[^:](\\/\\/)");
static final Pattern RemoveAllDoubleSlashes = Pattern.compile("(?<!:)\\/\\/");
public API(Context cont) {
mPrefs = PreferenceManager.getDefaultSharedPreferences(cont);
}
public static API GetRightApiForVersion(String appVersion, Activity activity) {
API api = null;
int versionCode = 0;
if(appVersion != null)
{
appVersion = appVersion.replace(".", "");
versionCode = Integer.parseInt(appVersion);
}
if (versionCode >= 1101) {
api = new APIv2(activity);
} else {
api = new APIv1(activity);
}
return api;
}
protected abstract String getItemUrl();
protected abstract String getItemUpdatedUrl();
protected abstract String getFeedUrl();
protected abstract String getFolderUrl();
protected abstract String getFolderUrl();
protected abstract String getTagBaseUrl();
/**
*
* @return http(s)://url_to_server
*/
protected String getOcRootPath() {
String oc_root_path = mPrefs.getString(SettingsActivity.EDT_OWNCLOUDROOTPATH_STRING, "");
oc_root_path = RemoveAllDoubleSlashes.matcher(oc_root_path).replaceAll("/");
//if(!oc_root_path.endsWith("/"))
// oc_root_path += "/";
//while(oc_root_path.endsWith("/"))
// oc_root_path += oc_root_path.substring(0, oc_root_path.length() - 2);
return oc_root_path;
}
public String getUsername() {
return mPrefs.getString(SettingsActivity.EDT_USERNAME_STRING, null);
}
@ -47,5 +87,9 @@ public abstract class API {
return OwnCloudReaderMethods.GetUpdatedItems(tag, cont, lastSync, api);
}
public static String validateURL(String url) {
return RemoveAllDoubleSlashes.matcher(url).replaceAll("/");
}
public abstract boolean PerformTagExecution(List<String> itemIds, FeedItemTags.TAGS tag, Context context, API api);
}

View file

@ -2,6 +2,7 @@ package de.luhmer.owncloudnewsreader.reader.owncloud;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
@ -93,14 +94,14 @@ public class AsyncTask_GetItems extends AsyncTask_Reader {
if(!NetworkConnection.isWLANConnected(context) && NetworkConnection.isNetworkAvailable(context))
ShowDownloadImageWithoutWifiQuestion();
else if(NetworkConnection.isNetworkAvailable(context))
StartDownloadingImages();
StartDownloadingImages(context);
}
detach();
}
private void StartDownloadingImages()
private void StartDownloadingImages(Context context)
{
DatabaseConnection dbConn = new DatabaseConnection(context);
try {
@ -115,18 +116,24 @@ public class AsyncTask_GetItems extends AsyncTask_Reader {
private void ShowDownloadImageWithoutWifiQuestion()
{
final Context contextDownloadImage = this.context;
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
// set title
alertDialogBuilder.setTitle(context.getString(R.string.no_wifi_available));
alertDialogBuilder.setTitle(contextDownloadImage.getString(R.string.no_wifi_available));
// set dialog message
alertDialogBuilder
.setMessage(context.getString(R.string.do_you_want_to_download_without_wifi))
.setMessage(contextDownloadImage.getString(R.string.do_you_want_to_download_without_wifi))
.setCancelable(true)
.setPositiveButton("Yes",new DialogInterface.OnClickListener() {
.setPositiveButton(contextDownloadImage.getString(android.R.string.yes) ,new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
StartDownloadingImages();
StartDownloadingImages(contextDownloadImage);
}
})
.setNegativeButton(contextDownloadImage.getString(android.R.string.no) ,new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
}
});

View file

@ -425,10 +425,7 @@ public class OwnCloudReaderMethods {
public static String GetVersionNumber(Context cont, String username, String password, String oc_root_path) throws Exception
{
if(oc_root_path.endsWith("/"))
oc_root_path = oc_root_path.substring(0, oc_root_path.length() - 1);
{
//Try APIv2
try {
String requestUrl = oc_root_path + OwnCloudConstants.ROOT_PATH_APIv2 + OwnCloudConstants.VERSION_PATH;

View file

@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.List;
import android.content.Context;
import de.luhmer.owncloudnewsreader.SettingsActivity;
import de.luhmer.owncloudnewsreader.reader.FeedItemTags.TAGS;
import de.luhmer.owncloudnewsreader.reader.owncloud.API;
import de.luhmer.owncloudnewsreader.reader.owncloud.OwnCloudConstants;
@ -41,15 +40,6 @@ public class APIv1 extends API {
return getOcRootPath() + OwnCloudConstants.ROOT_PATH_APIv1 + OwnCloudConstants.FEED_PATH + "/";
}
private String getOcRootPath() {
String oc_root_path = super.mPrefs.getString(SettingsActivity.EDT_OWNCLOUDROOTPATH_STRING, "");
if(oc_root_path.endsWith("/"))
oc_root_path = oc_root_path.substring(0, oc_root_path.length() - 1);
return oc_root_path;
}
@Override
public boolean PerformTagExecution(List<String> itemIds, TAGS tag,
Context context, API api) {

View file

@ -3,7 +3,6 @@ package de.luhmer.owncloudnewsreader.reader.owncloud.apiv2;
import java.util.List;
import android.content.Context;
import de.luhmer.owncloudnewsreader.SettingsActivity;
import de.luhmer.owncloudnewsreader.reader.FeedItemTags.TAGS;
import de.luhmer.owncloudnewsreader.reader.owncloud.API;
import de.luhmer.owncloudnewsreader.reader.owncloud.OwnCloudConstants;
@ -40,15 +39,6 @@ public class APIv2 extends API {
return getOcRootPath() + OwnCloudConstants.ROOT_PATH_APIv2 + OwnCloudConstants.FEED_PATH + "/";
}
private String getOcRootPath() {
String oc_root_path = super.mPrefs.getString(SettingsActivity.EDT_OWNCLOUDROOTPATH_STRING, "");
if(oc_root_path.endsWith("/"))
oc_root_path = oc_root_path.substring(0, oc_root_path.length() - 1);
return oc_root_path;
}
@Override
public boolean PerformTagExecution(List<String> itemIds, TAGS tag,
Context context, API api) {