Sync fixed - SSL should work now - Roboto font
This commit is contained in:
parent
79dad65593
commit
56143ec8f0
17 changed files with 173 additions and 427 deletions
Binary file not shown.
|
@ -1,8 +1,13 @@
|
|||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: "Roboto";
|
||||
src: url('file:///android_asset/fonts/Roboto-Light.ttf');
|
||||
}
|
||||
|
||||
body#darkTheme {
|
||||
|
||||
/* font-family: 'Segoe UI', 'Segoe UI Light', 'Droid Sans', sans-serif ; */
|
||||
font-family: 'Roboto', 'Segoe UI', 'Segoe UI Light';
|
||||
font-size: 18px;
|
||||
|
|
|
@ -1,125 +1,67 @@
|
|||
<!--
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context=".LoginActivity" >
|
||||
-->
|
||||
<!-- Login progress --> <!--
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/login_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone" >
|
||||
|
||||
<ProgressBar
|
||||
style="?android:attr/progressBarStyleLarge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/login_status_message"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:text="@string/login_progress_signing_in"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
</LinearLayout>
|
||||
-->
|
||||
<!-- Login form -->
|
||||
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/com.devspark.robototextview"
|
||||
tools:context=".LoginActivity"
|
||||
android:id="@+id/login_form"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
<!--
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="64dp"
|
||||
android:scaleType="center"
|
||||
android:background="#FFFFBB33"
|
||||
android:contentDescription="@string/app_name" />
|
||||
-->
|
||||
|
||||
|
||||
<com.devspark.robototextview.widget.RobotoEditText
|
||||
android:id="@+id/username"
|
||||
android:inputType="textEmailAddress"
|
||||
style="@style/LoginDialogEditTextStyle"
|
||||
android:hint="@string/pref_title_username"
|
||||
app:typeface="@style/RobotoFontStyle" />
|
||||
|
||||
<com.devspark.robototextview.widget.RobotoEditText
|
||||
android:id="@+id/password"
|
||||
android:inputType="textPassword"
|
||||
style="@style/LoginDialogEditTextStyle"
|
||||
android:fontFamily="sans-serif"
|
||||
android:hint="@string/pref_title_password"
|
||||
app:typeface="@style/RobotoFontStyle" />
|
||||
|
||||
<com.devspark.robototextview.widget.RobotoEditText
|
||||
android:id="@+id/edt_owncloudRootPath"
|
||||
android:fontFamily="sans-serif"
|
||||
android:hint="@string/pref_default_owncloudRootPath"
|
||||
android:inputType="textUri"
|
||||
android:maxLines="1"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:title="@string/pref_default_owncloudRootPath"
|
||||
style="@style/LoginDialogEditTextStyle"
|
||||
app:typeface="@style/RobotoFontStyle" />
|
||||
|
||||
<com.devspark.robototextview.widget.RobotoCheckBox
|
||||
android:id="@+id/cb_AllowAllSSLCertificates"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/pref_title_AllowAllSSLCertificates"
|
||||
app:typeface="@style/RobotoFontStyle" />
|
||||
|
||||
<!--
|
||||
<Button
|
||||
android:id="@+id/btn_signin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:text="Button" />
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_cancel"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.0"
|
||||
android:text="@android:string/cancel" />
|
||||
|
||||
<Button
|
||||
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" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
<!--
|
||||
</merge>
|
||||
|
||||
-->
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context=".LoginActivity"
|
||||
android:id="@+id/login_form"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<com.devspark.robototextview.widget.RobotoEditText
|
||||
android:id="@+id/username"
|
||||
android:inputType="textEmailAddress"
|
||||
style="@style/LoginDialogEditTextStyle"
|
||||
android:hint="@string/pref_title_username" />
|
||||
|
||||
<com.devspark.robototextview.widget.RobotoEditText
|
||||
android:id="@+id/password"
|
||||
android:inputType="textPassword"
|
||||
style="@style/LoginDialogEditTextStyle"
|
||||
android:fontFamily="sans-serif"
|
||||
android:hint="@string/pref_title_password" />
|
||||
|
||||
<com.devspark.robototextview.widget.RobotoEditText
|
||||
android:id="@+id/edt_owncloudRootPath"
|
||||
android:fontFamily="sans-serif"
|
||||
android:hint="@string/pref_default_owncloudRootPath"
|
||||
android:inputType="textUri"
|
||||
android:maxLines="1"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:title="@string/pref_default_owncloudRootPath"
|
||||
style="@style/LoginDialogEditTextStyle" />
|
||||
|
||||
<com.devspark.robototextview.widget.RobotoCheckBox
|
||||
android:id="@+id/cb_AllowAllSSLCertificates"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/pref_title_AllowAllSSLCertificates"
|
||||
style="@style/RobotoFontStyle" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<com.devspark.robototextview.widget.RobotoButton
|
||||
android:id="@+id/btn_cancel"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.0"
|
||||
android:text="@android:string/cancel"
|
||||
style="@style/RobotoFontStyle" />
|
||||
|
||||
<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" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/com.devspark.robototextview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
@ -28,8 +27,8 @@
|
|||
android:singleLine="true"
|
||||
android:text="Hi"
|
||||
android:layout_weight="1"
|
||||
android:textSize="13sp"
|
||||
app:typeface="@style/RobotoFontStyle" />
|
||||
android:textSize="14sp"
|
||||
style="@style/RobotoFontStyle" />
|
||||
|
||||
<com.devspark.robototextview.widget.RobotoTextView
|
||||
android:id="@+id/tv_item_date"
|
||||
|
@ -40,8 +39,8 @@
|
|||
android:layout_gravity="right"
|
||||
android:text="Hi"
|
||||
android:singleLine="true"
|
||||
android:textSize="13sp"
|
||||
app:typeface="@style/RobotoFontStyle" />
|
||||
android:textSize="14sp"
|
||||
style="@style/RobotoFontStyle" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -65,10 +64,10 @@
|
|||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:lines="2"
|
||||
android:textSize="16sp"
|
||||
android:textSize="17sp"
|
||||
android:text="Hi"
|
||||
android:textStyle="bold"
|
||||
app:typeface="@style/RobotoFontStyle" />
|
||||
style="@style/RobotoFontStyle" />
|
||||
|
||||
<com.devspark.robototextview.widget.RobotoTextView
|
||||
android:id="@+id/body"
|
||||
|
@ -81,7 +80,7 @@
|
|||
android:textColor="#858585"
|
||||
android:textSize="14sp"
|
||||
android:autoLink="none"
|
||||
app:typeface="@style/RobotoFontStyle" />
|
||||
style="@style/RobotoFontStyle" />
|
||||
<!-- android:gravity="center_vertical" -->
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -101,7 +100,7 @@
|
|||
android:focusable="false"
|
||||
android:button="@drawable/checkbox_background_empty"
|
||||
android:background="@drawable/checkbox_background"
|
||||
app:typeface="@style/RobotoFontStyle" />
|
||||
style="@style/RobotoFontStyle" />
|
||||
<!-- android:layout_width="40dp"
|
||||
android:layout_height="40dp" -->
|
||||
|
||||
|
@ -113,7 +112,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
app:typeface="@style/RobotoFontStyle" />
|
||||
style="@style/RobotoFontStyle" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/com.devspark.robototextview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
@ -32,9 +31,9 @@
|
|||
android:textSize="15sp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/tv_clickHereToOpenItem"
|
||||
app:typeface="@style/RobotoFontStyle" />
|
||||
style="@style/RobotoFontStyle" />
|
||||
|
||||
<com.devspark.robototextview.widget.RobotoTextView
|
||||
<com.devspark.robototextview.widget.RobotoCheckBox
|
||||
android:id="@+id/cb_lv_item_starred"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -43,7 +42,7 @@
|
|||
android:button="@drawable/checkbox_background_empty"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
app:typeface="@style/RobotoFontStyle" />
|
||||
style="@style/RobotoFontStyle" />
|
||||
|
||||
<com.devspark.robototextview.widget.RobotoCheckBox
|
||||
android:id="@+id/cb_lv_item_read"
|
||||
|
@ -53,7 +52,7 @@
|
|||
android:layout_gravity="center_vertical"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
app:typeface="@style/RobotoFontStyle" />
|
||||
style="@style/RobotoFontStyle" />
|
||||
</LinearLayout>
|
||||
|
||||
<WebView
|
||||
|
@ -62,4 +61,5 @@
|
|||
android:layout_height="500dp"
|
||||
android:focusable="false"
|
||||
android:clickable="false" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1,11 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/com.devspark.robototextview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal" >
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<com.devspark.robototextview.widget.RobotoCheckBox
|
||||
android:id="@+id/cb_lv_item_starred"
|
||||
|
@ -47,8 +46,8 @@
|
|||
android:singleLine="true"
|
||||
android:text="Hi"
|
||||
android:layout_weight="1"
|
||||
android:textSize="13sp"
|
||||
app:typeface="@style/RobotoFontStyle" />
|
||||
android:textSize="14sp"
|
||||
style="@style/RobotoFontStyle" />
|
||||
|
||||
<com.devspark.robototextview.widget.RobotoTextView
|
||||
android:id="@+id/tv_item_date"
|
||||
|
@ -59,8 +58,8 @@
|
|||
android:layout_gravity="right"
|
||||
android:text="Hi"
|
||||
android:singleLine="true"
|
||||
android:textSize="13sp"
|
||||
app:typeface="@style/RobotoFontStyle" />
|
||||
android:textSize="14sp"
|
||||
style="@style/RobotoFontStyle" />
|
||||
</LinearLayout>
|
||||
|
||||
<com.devspark.robototextview.widget.RobotoTextView
|
||||
|
@ -70,21 +69,22 @@
|
|||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:lines="2"
|
||||
android:textSize="16sp"
|
||||
android:textSize="17sp"
|
||||
android:text="hidsaf afdal fjdkas f fsadfdas fds asöjkdafdssö fjkök"
|
||||
android:layout_weight="1"
|
||||
android:textStyle="bold"
|
||||
app:typeface="@style/RobotoFontStyle" />
|
||||
style="@style/RobotoFontStyle" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
<com.devspark.robototextview.widget.RobotoCheckBox
|
||||
android:id="@+id/cb_lv_item_read"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginRight="@dimen/listview_row_margin_right"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:gravity="center_vertical|center_horizontal" />
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
style="@style/RobotoFontStyle" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/com.devspark.robototextview"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="@dimen/exp_listview_row_height"
|
||||
android:orientation="horizontal" >
|
||||
|
@ -23,7 +22,7 @@
|
|||
android:textStyle="bold"
|
||||
android:layout_weight="1"
|
||||
android:textIsSelectable="false"
|
||||
app:typeface="@style/RobotoFontStyle" />
|
||||
style="@style/RobotoFontStyle" />/
|
||||
<!--app:typeface="roboto_thin" -->
|
||||
|
||||
|
||||
|
@ -35,6 +34,6 @@
|
|||
android:singleLine="true"
|
||||
android:textIsSelectable="false"
|
||||
android:layout_marginRight="20dp"
|
||||
app:typeface="@style/RobotoFontStyle" />
|
||||
style="@style/RobotoFontStyle" />
|
||||
|
||||
</LinearLayout>
|
|
@ -21,14 +21,15 @@
|
|||
android:singleLine="true"
|
||||
android:layout_weight="1"
|
||||
android:textSize="20sp"
|
||||
app:typeface="@style/RobotoFontStyle" />
|
||||
style="@style/RobotoFontStyle" />
|
||||
|
||||
<TextView
|
||||
<com.devspark.robototextview.widget.RobotoTextView
|
||||
android:id="@+id/tv_unreadCount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical|right"
|
||||
android:singleLine="true"
|
||||
android:layout_marginRight="20dp" />
|
||||
android:layout_marginRight="20dp"
|
||||
style="@style/RobotoFontStyle" />
|
||||
|
||||
</LinearLayout>
|
|
@ -35,7 +35,7 @@
|
|||
<item name="typeface">roboto_light</item>
|
||||
</style>
|
||||
|
||||
<style name="LoginDialogEditTextStyle">
|
||||
<style name="LoginDialogEditTextStyle" parent="@style/RobotoFontStyle" >
|
||||
<item name="android:layout_marginTop">4dp</item>
|
||||
<item name="android:layout_marginLeft">4dp</item>
|
||||
<item name="android:layout_marginRight">4dp</item>
|
||||
|
@ -43,5 +43,7 @@
|
|||
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
|
||||
RobotoFontStyle
|
||||
</style>
|
||||
</resources>
|
|
@ -402,8 +402,13 @@ public class LoginDialogFragment extends SherlockDialogFragment {
|
|||
|
||||
mDialogLogin.dismiss();
|
||||
|
||||
if (versionCode >= 1101) {
|
||||
|
||||
if(versionCode == -1 && exception_message.equals("Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject")) {
|
||||
ShowAlertDialog(getString(R.string.login_dialog_title_error), getString(R.string.login_dialog_text_not_compatible), getActivity());
|
||||
} else if(versionCode == -1) {
|
||||
ShowAlertDialog(getString(R.string.login_dialog_title_error), exception_message, getActivity());
|
||||
} else if(versionCode == 0){
|
||||
ShowAlertDialog(getString(R.string.login_dialog_title_error), getString(R.string.login_dialog_text_something_went_wrong), getActivity());
|
||||
} else {
|
||||
//Reset Database
|
||||
DatabaseConnection dbConn = new DatabaseConnection(getActivity());
|
||||
dbConn.resetDatabase();
|
||||
|
@ -418,15 +423,7 @@ public class LoginDialogFragment extends SherlockDialogFragment {
|
|||
editor.commit();
|
||||
|
||||
LoginDialogFragment.this.getDialog().cancel();
|
||||
} else if((versionCode > 0) || (versionCode == -1 && exception_message.equals("Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject"))) {
|
||||
ShowAlertDialog(getString(R.string.login_dialog_title_error), getString(R.string.login_dialog_text_not_compatible), getActivity());
|
||||
} else if(versionCode == -1) {
|
||||
ShowAlertDialog(getString(R.string.login_dialog_title_error), exception_message, getActivity());
|
||||
//mPasswordView.setError(getString(R.string.error_incorrect_password));
|
||||
//mPasswordView.requestFocus();
|
||||
} else if(versionCode == 0){
|
||||
ShowAlertDialog(getString(R.string.login_dialog_title_error), getString(R.string.login_dialog_text_something_went_wrong), getActivity());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,16 +10,15 @@ import android.content.SharedPreferences;
|
|||
import android.database.Cursor;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
import com.actionbarsherlock.app.SherlockListFragment;
|
||||
import com.devspark.robototextview.widget.RobotoCheckBox;
|
||||
|
||||
import de.luhmer.owncloudnewsreader.ListView.SubscriptionExpandableListAdapter;
|
||||
import de.luhmer.owncloudnewsreader.cursor.NewsListCursorAdapter;
|
||||
|
@ -84,17 +83,6 @@ public class NewsReaderDetailFragment extends SherlockListFragment {
|
|||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
/*
|
||||
if (getArguments().containsKey(ARG_ITEM_ID)) {
|
||||
// Load the dummy content specified by the fragment
|
||||
// arguments. In a real-world scenario, use a Loader
|
||||
// to load content from a content provider.
|
||||
|
||||
mItem = DummyContent.ITEM_MAP.get(getArguments().getString(
|
||||
ARG_ITEM_ID));
|
||||
|
||||
}*/
|
||||
|
||||
if (getArguments().containsKey(NewsReaderDetailActivity.SUBSCRIPTION_ID)) {
|
||||
idFeed = getArguments().getString(NewsReaderDetailActivity.SUBSCRIPTION_ID);
|
||||
|
@ -113,8 +101,7 @@ public class NewsReaderDetailFragment extends SherlockListFragment {
|
|||
UpdateMenuItemsState();//Is called on Tablets and Smartphones but on Smartphones the menuItemDownloadMoreItems is null. So it will be ignored
|
||||
|
||||
//getListView().setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||
|
||||
//lvAdapter = new Subscription_ListViewAdapter(this);
|
||||
|
||||
UpdateCursor();
|
||||
}
|
||||
|
||||
|
@ -156,7 +143,7 @@ public class NewsReaderDetailFragment extends SherlockListFragment {
|
|||
|
||||
|
||||
public void onScroll(final AbsListView view, final int firstVisibleItem, final int visibleItemCount, int totalItemCount) {
|
||||
CheckBox cb = getCheckBoxAtPosition(0, view);
|
||||
RobotoCheckBox cb = getCheckBoxAtPosition(0, view);
|
||||
NewsListCursorAdapter.ChangeCheckBoxState(cb, true, getActivity());
|
||||
|
||||
if(((firstVisibleItem + visibleItemCount) == totalItemCount) && !DialogShowedToMarkLastItemsAsRead ){
|
||||
|
@ -181,7 +168,7 @@ public class NewsReaderDetailFragment extends SherlockListFragment {
|
|||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
for (int i = firstVisibleItem + 1; i < firstVisibleItem + visibleItemCount; i++) {
|
||||
CheckBox cb = getCheckBoxAtPosition(i - firstVisibleItem, view);
|
||||
RobotoCheckBox cb = getCheckBoxAtPosition(i - firstVisibleItem, view);
|
||||
NewsListCursorAdapter.ChangeCheckBoxState(cb, true, getActivity());
|
||||
}
|
||||
}
|
||||
|
@ -235,20 +222,16 @@ public class NewsReaderDetailFragment extends SherlockListFragment {
|
|||
|
||||
|
||||
|
||||
private CheckBox getCheckBoxAtPosition(int pos, AbsListView viewLV)
|
||||
private RobotoCheckBox getCheckBoxAtPosition(int pos, AbsListView viewLV)
|
||||
{
|
||||
ListView lv = (ListView) viewLV;
|
||||
View view = (View) lv.getChildAt(pos);
|
||||
if(view != null)
|
||||
return (CheckBox) view.findViewById(R.id.cb_lv_item_read);
|
||||
return (RobotoCheckBox) view.findViewById(R.id.cb_lv_item_read);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.support.v4.app.Fragment#onResume()
|
||||
*/
|
||||
@Override
|
||||
public void onResume() {
|
||||
lastItemPosition = -1;
|
||||
|
@ -322,14 +305,7 @@ public class NewsReaderDetailFragment extends SherlockListFragment {
|
|||
@Override
|
||||
public void onListItemClick(ListView l, View v, int position, long id) {
|
||||
|
||||
Intent intentNewsDetailAct = new Intent(getActivity(), NewsDetailActivity.class);
|
||||
//if(idSubscription != null)
|
||||
// intentNewsDetailAct.putExtra(NewsReaderDetailActivity.SUBSCRIPTION_ID, Long.valueOf(idSubscription));
|
||||
//else if(idFolder != null)
|
||||
// intentNewsDetailAct.putExtra(NewsReaderDetailActivity.FOLDER_ID, Long.valueOf(idFolder));
|
||||
|
||||
//intentNewsDetailAct.putIntegerArrayListExtra(NewsDetailActivity.DATABASE_IDS_OF_ITEMS, databaseIdsOfItems);
|
||||
//Integer[] databaseIdsOfItemsArray = databaseIdsOfItems.toArray(new Integer[databaseIdsOfItems.size()]);
|
||||
Intent intentNewsDetailAct = new Intent(getActivity(), NewsDetailActivity.class);
|
||||
intentNewsDetailAct.putIntegerArrayListExtra(NewsDetailActivity.DATABASE_IDS_OF_ITEMS, databaseIdsOfItems);
|
||||
|
||||
intentNewsDetailAct.putExtra(NewsReaderDetailActivity.ITEM_ID, position);
|
||||
|
@ -342,5 +318,4 @@ public class NewsReaderDetailFragment extends SherlockListFragment {
|
|||
public ArrayList<Integer> getDatabaseIdsOfItems() {
|
||||
return databaseIdsOfItems;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,13 +19,13 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
import com.devspark.robototextview.widget.RobotoCheckBox;
|
||||
|
||||
import de.luhmer.owncloudnewsreader.NewsDetailFragment;
|
||||
import de.luhmer.owncloudnewsreader.NewsReaderListActivity;
|
||||
|
@ -67,7 +67,6 @@ public class NewsListCursorAdapter extends CursorAdapter {
|
|||
@Override
|
||||
public void bindView(View view, final Context context, Cursor cursor) {
|
||||
final String idItemDb = cursor.getString(0);
|
||||
//final String idItem = cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_RSSITEM_ID));
|
||||
|
||||
switch (selectedDesign) {
|
||||
case 0:
|
||||
|
@ -86,51 +85,28 @@ public class NewsListCursorAdapter extends CursorAdapter {
|
|||
break;
|
||||
}
|
||||
|
||||
CheckBox cb = (CheckBox) view.findViewById(R.id.cb_lv_item_starred);
|
||||
RobotoCheckBox cb = (RobotoCheckBox) view.findViewById(R.id.cb_lv_item_starred);
|
||||
cb.setOnCheckedChangeListener(null);
|
||||
|
||||
Boolean isStarred = dbConn.isFeedUnreadStarred(cursor.getString(0), false);//false => starred will be checked
|
||||
//Log.d("ISSTARRED", "" + isStarred + " - Cursor: " + cursor.getString(0));
|
||||
cb.setChecked(isStarred);/*
|
||||
if(isStarred)
|
||||
cb.setButtonDrawable(R.drawable.btn_rating_star_on_normal_holo_light);
|
||||
else
|
||||
cb.setButtonDrawable(R.drawable.btn_rating_star_off_normal_holo_light);
|
||||
*/
|
||||
|
||||
cb.setChecked(isStarred);
|
||||
cb.setClickable(true);
|
||||
cb.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
/*
|
||||
if(isChecked)
|
||||
buttonView.setButtonDrawable(R.drawable.btn_rating_star_on_normal_holo_light);
|
||||
else
|
||||
buttonView.setButtonDrawable(R.drawable.btn_rating_star_off_normal_holo_light);
|
||||
*/
|
||||
|
||||
dbConn.updateIsStarredOfItem(idItemDb, isChecked);
|
||||
|
||||
if(isChecked)
|
||||
UpdateIsReadCheckBox(buttonView, idItemDb);
|
||||
|
||||
pDelayHandler.DelayTimer();
|
||||
|
||||
/*
|
||||
List<String> idItems = new ArrayList<String>();
|
||||
idItems.add(idItem);
|
||||
if(isChecked)
|
||||
_Reader.Start_AsyncTask_PerformTagAction(0, context, asyncTaskCompletedPerformTagRead, idItems, FeedItemTags.TAGS.MARK_ITEM_AS_STARRED);
|
||||
else
|
||||
_Reader.Start_AsyncTask_PerformTagAction(0, context, asyncTaskCompletedPerformTagRead, idItems, FeedItemTags.TAGS.MARK_ITEM_AS_UNSTARRED);
|
||||
*/
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
CheckBox cbRead = (CheckBox) view.findViewById(R.id.cb_lv_item_read);
|
||||
RobotoCheckBox cbRead = (RobotoCheckBox) view.findViewById(R.id.cb_lv_item_read);
|
||||
cbRead.setOnCheckedChangeListener(null);
|
||||
Boolean isChecked = dbConn.isFeedUnreadStarred(cursor.getString(0), true);
|
||||
//Log.d("ISREAD", "" + isChecked + " - Cursor: " + cursor.getString(0));
|
||||
|
@ -139,28 +115,13 @@ public class NewsListCursorAdapter extends CursorAdapter {
|
|||
cbRead.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
//GoogleReaderMethods.MarkItemAsRead(isChecked, getCursorForCurrentRow(buttonView), dbConn, context, asyncTaskCompletedPerformTagStarred);
|
||||
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
dbConn.updateIsReadOfItem(idItemDb, isChecked);
|
||||
UpdateListCursor(mContext);
|
||||
|
||||
pDelayHandler.DelayTimer();
|
||||
|
||||
/*
|
||||
//TODO THIS IS IMPORTANT CODE !
|
||||
List<String> idItems = new ArrayList<String>();
|
||||
idItems.add(idItem);
|
||||
if(isChecked)
|
||||
_Reader.Start_AsyncTask_PerformTagActionForSingleItem(0, context, asyncTaskCompletedPerformTagRead, idItems, FeedItemTags.TAGS.MARK_ITEM_AS_READ);
|
||||
else
|
||||
_Reader.Start_AsyncTask_PerformTagActionForSingleItem(0, context, asyncTaskCompletedPerformTagRead, idItems, FeedItemTags.TAGS.MARK_ITEM_AS_UNREAD);
|
||||
*/
|
||||
}
|
||||
});
|
||||
|
||||
//Log.d("NewsListCursor", "BIND VIEW..");
|
||||
//((CheckBox) view.findViewById(R.id.cb_lv_item_starred)).setButtonDrawable(R.drawable.btn_rating_star_off_normal_holo_light);
|
||||
});
|
||||
}
|
||||
|
||||
public void setSimpleLayout(View view, Cursor cursor)
|
||||
|
@ -197,17 +158,7 @@ public class NewsListCursorAdapter extends CursorAdapter {
|
|||
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
public void setExtendedLayoutWebView(View view, Cursor cursor)
|
||||
{
|
||||
|
||||
/*
|
||||
TextView textViewSummary = (TextView) view.findViewById(R.id.summary);
|
||||
textViewSummary.setText(Html.fromHtml(cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_TITLE))).toString());
|
||||
|
||||
TextView textViewItemDate = (TextView) view.findViewById(R.id.tv_item_date);
|
||||
long pubDate = cursor.getLong(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_PUBDATE));
|
||||
textViewItemDate.setText(simpleDateFormat.format(new Date(pubDate)));
|
||||
*/
|
||||
|
||||
{
|
||||
WebView webViewContent = (WebView) view.findViewById(R.id.webView_body);
|
||||
webViewContent.setClickable(false);
|
||||
webViewContent.setFocusable(false);
|
||||
|
@ -215,25 +166,8 @@ public class NewsListCursorAdapter extends CursorAdapter {
|
|||
// webViewContent.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||
|
||||
webViewContent.loadDataWithBaseURL("", NewsDetailFragment.getHtmlPage(mContext, dbConn , cursor.getInt(0)), "text/html", "UTF-8", "");
|
||||
|
||||
/*
|
||||
TextView textViewTitle = (TextView) view.findViewById(R.id.tv_subscription);
|
||||
textViewTitle.setText(dbConn.getTitleOfSubscriptionByRowID(cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_SUBSCRIPTION_ID))));
|
||||
textViewSummary.setTag(cursor.getString(0));
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
class ItemHolder {
|
||||
TextView txt_feed;
|
||||
TextView txt_item_date;
|
||||
TextView txt_summary;
|
||||
TextView txt_body;
|
||||
CheckBox cb_starred;
|
||||
CheckBox cb_read;
|
||||
}*/
|
||||
|
||||
|
||||
public void CloseDatabaseConnection()
|
||||
{
|
||||
if(dbConn != null)
|
||||
|
@ -244,12 +178,11 @@ public class NewsListCursorAdapter extends CursorAdapter {
|
|||
{
|
||||
LinearLayout lLayout = (LinearLayout) view.getParent();
|
||||
Boolean isChecked = dbConn.isFeedUnreadStarred(idItemDb, true);
|
||||
CheckBox cbRead = (CheckBox) lLayout.findViewById(R.id.cb_lv_item_read);
|
||||
//ChangeCheckBoxState(cbRead, isChecked, mContext);
|
||||
RobotoCheckBox cbRead = (RobotoCheckBox) lLayout.findViewById(R.id.cb_lv_item_read);
|
||||
cbRead.setChecked(isChecked);
|
||||
}
|
||||
|
||||
public static void ChangeCheckBoxState(CheckBox cb, boolean state, Context context)
|
||||
public static void ChangeCheckBoxState(RobotoCheckBox cb, boolean state, Context context)
|
||||
{
|
||||
if(cb != null)
|
||||
{
|
||||
|
@ -291,18 +224,6 @@ public class NewsListCursorAdapter extends CursorAdapter {
|
|||
return bodyString;
|
||||
}
|
||||
|
||||
/*
|
||||
private Cursor getCursorForCurrentRow(CompoundButton buttonView)
|
||||
{
|
||||
TextView tv = (TextView) ((ViewGroup)((ViewGroup) buttonView.getParent()).getChildAt(1)).getChildAt(1);
|
||||
String id_DB_Feed = (String) tv.getTag();
|
||||
//String id_DB_Feed = (String) ((View)buttonView.getParent()).getTag();
|
||||
|
||||
Cursor cur = dbConn.getFeedByID(id_DB_Feed);
|
||||
cur.moveToFirst();
|
||||
return cur;
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public View newView(Context arg0, Cursor cursor, ViewGroup parent) {
|
||||
// when the view will be created for first time,
|
||||
|
@ -329,29 +250,6 @@ public class NewsListCursorAdapter extends CursorAdapter {
|
|||
if(retView != null)
|
||||
retView.setTag(cursor.getString(0));
|
||||
|
||||
|
||||
|
||||
|
||||
//retView.getLocationOnScreen(location);
|
||||
//Log.d("NewsListCursor", "NEW VIEW..");
|
||||
|
||||
return retView;
|
||||
}
|
||||
|
||||
/*
|
||||
OnAsyncTaskCompletedListener asyncTaskCompletedPerformTagRead = new OnAsyncTaskCompletedListener() {
|
||||
|
||||
@Override
|
||||
public void onAsyncTaskCompleted(int task_id, Object task_result) {
|
||||
Log.d("FINISHED PERFORM TAG READ ", "" + task_result);
|
||||
}
|
||||
};
|
||||
|
||||
OnAsyncTaskCompletedListener asyncTaskCompletedPerformTagStarred = new OnAsyncTaskCompletedListener() {
|
||||
|
||||
@Override
|
||||
public void onAsyncTaskCompleted(int task_id, Object task_result) {
|
||||
Log.d("FINISHED PERFORM TAG STARRED ", "" + task_result);
|
||||
}
|
||||
};*/
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ public class DatabaseConnection {
|
|||
public static final String RSS_ITEM_STARRED_TEMP = "starred_temp";
|
||||
|
||||
|
||||
public static final boolean DATABASE_DEBUG_MODE = true; //(false && Constants.DEBUG_MODE) ? true: false;
|
||||
public static final boolean DATABASE_DEBUG_MODE = false; //(false && Constants.DEBUG_MODE) ? true: false;
|
||||
|
||||
|
||||
public DatabaseConnection(Context aContext) {
|
||||
|
|
|
@ -17,7 +17,7 @@ import org.apache.http.auth.AuthenticationException;
|
|||
import org.apache.http.auth.UsernamePasswordCredentials;
|
||||
import org.apache.http.client.methods.HttpPut;
|
||||
import org.apache.http.client.utils.URLEncodedUtils;
|
||||
import org.apache.http.conn.ssl.StrictHostnameVerifier;
|
||||
import org.apache.http.conn.ssl.AllowAllHostnameVerifier;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
|
||||
|
@ -58,7 +58,9 @@ public class HttpJsonRequest {
|
|||
|
||||
// Install the all-trusting host verifier
|
||||
//HttpsURLConnection.setDefaultHostnameVerifier(new CustomHostnameVerifier());
|
||||
HttpsURLConnection.setDefaultHostnameVerifier(new StrictHostnameVerifier());
|
||||
|
||||
//HttpsURLConnection.setDefaultHostnameVerifier(new StrictHostnameVerifier());
|
||||
HttpsURLConnection.setDefaultHostnameVerifier(new AllowAllHostnameVerifier());
|
||||
}
|
||||
HttpsURLConnection sslConnection = (HttpsURLConnection) url.openConnection();
|
||||
urlConnection = sslConnection;
|
||||
|
@ -108,93 +110,11 @@ public class HttpJsonRequest {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@SuppressLint("DefaultLocale")
|
||||
public static JSONObject PerformJsonRequest_old(String urlString, List<NameValuePair> nameValuePairs, String username, String password, Context context) throws Exception
|
||||
{
|
||||
if(nameValuePairs != null)
|
||||
urlString += "&" + URLEncodedUtils.format(nameValuePairs, "utf-8");
|
||||
|
||||
URL url = new URL(urlString);
|
||||
|
||||
// Instantiate an HttpClient
|
||||
//HttpClient httpclient = new DefaultHttpClient(p);
|
||||
DefaultHttpClient httpClient = null;
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
if(sp.getBoolean(SettingsActivity.CB_ALLOWALLSSLCERTIFICATES_STRING, false) && url.getProtocol().toLowerCase().equals("https"))
|
||||
httpClient = new SSLHttpClient(context);
|
||||
else
|
||||
httpClient = new DefaultHttpClient();
|
||||
|
||||
if(username != null && password != null)
|
||||
httpClient.getCredentialsProvider().setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT), new UsernamePasswordCredentials(username,password));
|
||||
|
||||
//HttpGet request = new HttpGet(url);
|
||||
//HttpPost request = new HttpPost(url);
|
||||
//httpClient.setParams(params)
|
||||
|
||||
|
||||
// Instantiate a GET HTTP method
|
||||
HttpGet request = new HttpGet(url.toString());
|
||||
|
||||
ResponseHandler<String> responseHandler = new BasicResponseHandler();
|
||||
String responseBody = httpClient.execute(request, responseHandler);
|
||||
JSONObject json = new JSONObject(responseBody);
|
||||
return json;
|
||||
//HttpResponse response = httpClient.execute(request);
|
||||
//return null;
|
||||
|
||||
// Log.i(getClass().getSimpleName(), "send task - end");
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
public static int performTagChangeRequest(String urlString, String username, String password, Context context, String content) throws Exception
|
||||
{
|
||||
//url = "http://192.168.10.126/owncloud/ocs/v1.php/apps/news/items/3787/read";
|
||||
/*
|
||||
String authString = username + ":" + password;
|
||||
String authStringEnc = Base64.encode(authString.getBytes());
|
||||
|
||||
URL urlConn = new URL(url);
|
||||
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
||||
HttpURLConnection httpConnection = null;
|
||||
if (urlConn.getProtocol().toLowerCase().equals("https") && sp.getBoolean(SettingsActivity.CB_ALLOWALLSSLCERTIFICATES_STRING, false)) {
|
||||
trustAllHosts();
|
||||
HttpsURLConnection https = (HttpsURLConnection) urlConn.openConnection();
|
||||
https.setHostnameVerifier(DO_NOT_VERIFY);
|
||||
httpConnection = https;
|
||||
} else {
|
||||
httpConnection = (HttpURLConnection) urlConn.openConnection();
|
||||
}
|
||||
|
||||
httpConnection.setRequestProperty("Authorization", "Basic " + authStringEnc);
|
||||
httpConnection.setRequestMethod("PUT");
|
||||
|
||||
if(nameValuePairs != null)
|
||||
{
|
||||
httpConnection.setEntity(new UrlEncodedFormEntity(nameValuePairs));
|
||||
}
|
||||
|
||||
InputStreamReader in = new InputStreamReader((InputStream) httpConnection.getContent());
|
||||
BufferedReader buff = new BufferedReader(in);
|
||||
String text = "";
|
||||
String line;
|
||||
do {
|
||||
line = buff.readLine();
|
||||
if(line != null)
|
||||
text += line + "\n";
|
||||
} while (line != null);
|
||||
Log.d(TAG, text);
|
||||
|
||||
|
||||
return httpConnection.getResponseCode();
|
||||
*/
|
||||
|
||||
|
||||
URL url = new URL(urlString);
|
||||
DefaultHttpClient httpClient;
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
@ -206,34 +126,16 @@ public class HttpJsonRequest {
|
|||
if(username != null && password != null)
|
||||
httpClient.getCredentialsProvider().setCredentials(new AuthScope(null, -1), new UsernamePasswordCredentials(username,password));
|
||||
|
||||
/*
|
||||
HttpParams params = new BasicHttpParams();
|
||||
if(nameValuePairs != null)
|
||||
for (NameValuePair nameValuePair : nameValuePairs)
|
||||
params.setParameter(nameValuePair.getName(), nameValuePair.getValue());
|
||||
httpClient.setParams(params);
|
||||
*/
|
||||
|
||||
HttpPut request = new HttpPut(url.toString());
|
||||
//if(nameValuePairs != null)
|
||||
// request.setEntity(new UrlEncodedFormEntity(nameValuePairs, HTTP.UTF_8));
|
||||
HttpPut request = new HttpPut(url.toString());
|
||||
request.setEntity(new StringEntity(content));
|
||||
request.addHeader("Accept", "application/json");
|
||||
|
||||
|
||||
HttpResponse response = httpClient.execute(request);
|
||||
//ResponseHandler<String> responseHandler = new BasicResponseHandler();
|
||||
//String responseBody = httpClient.execute(request, responseHandler);
|
||||
|
||||
//Thread.sleep(5000);
|
||||
|
||||
return response.getStatusLine().getStatusCode();
|
||||
//return 200;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Trust every server - dont check for any certificate
|
||||
*/
|
||||
|
|
|
@ -174,7 +174,7 @@ public class InsertIntoDatabase {
|
|||
rssFile.getGuidHash(),
|
||||
rssFile.getLastModified());
|
||||
|
||||
dbConn.clearDatabaseOverSize();
|
||||
//dbConn.clearDatabaseOverSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,15 +46,17 @@ public class AsyncTask_GetItems extends AsyncTask_Reader {
|
|||
|
||||
if(lastModified == 0)
|
||||
{
|
||||
|
||||
do {
|
||||
requestCount = api.GetItems(TAGS.ALL, context, String.valueOf(offset), false, "0", "3", api);
|
||||
if(requestCount > 0)
|
||||
offset = dbConn.getLowestItemId(false);
|
||||
totalCount += requestCount;
|
||||
} while(requestCount == maxSyncSize /* && totalCount < maxItemsInDatabase */);
|
||||
} while(requestCount == maxSyncSize);
|
||||
|
||||
|
||||
do {
|
||||
offset = dbConn.getLowestItemId(true);
|
||||
offset = dbConn.getLowestItemId(true);
|
||||
requestCount = api.GetItems(TAGS.ALL_STARRED, context, String.valueOf(offset), true, "0", "2", api);
|
||||
if(requestCount > 0)
|
||||
offset = dbConn.getLowestItemId(true);
|
||||
|
@ -67,6 +69,9 @@ public class AsyncTask_GetItems extends AsyncTask_Reader {
|
|||
//OwnCloudReaderMethods.GetUpdatedItems(TAGS.ALL, context, lastModified, api);
|
||||
|
||||
}
|
||||
|
||||
dbConn.clearDatabaseOverSize();
|
||||
|
||||
} catch (Exception ex) {
|
||||
return ex;
|
||||
} finally {
|
||||
|
|
|
@ -19,6 +19,7 @@ import android.content.Context;
|
|||
import android.database.Cursor;
|
||||
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonToken;
|
||||
|
||||
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
|
||||
import de.luhmer.owncloudnewsreader.reader.FeedItemTags;
|
||||
|
@ -26,6 +27,7 @@ import de.luhmer.owncloudnewsreader.reader.FeedItemTags.TAGS;
|
|||
import de.luhmer.owncloudnewsreader.reader.HttpJsonRequest;
|
||||
|
||||
public class OwnCloudReaderMethods {
|
||||
private static final String TAG = "OwnCloudReaderMethods";
|
||||
public static String maxSizePerSync = "200";
|
||||
|
||||
public static int GetUpdatedItems(TAGS tag, Context cont, long lastSync, API api) throws Exception
|
||||
|
@ -181,13 +183,32 @@ public class OwnCloudReaderMethods {
|
|||
}
|
||||
|
||||
private static JSONObject getJSONObjectFromReader(JsonReader jsonReader) {
|
||||
JSONObject jObj = new JSONObject();
|
||||
JSONObject jObj = new JSONObject();
|
||||
try {
|
||||
while(jsonReader.hasNext()) {
|
||||
try {
|
||||
jObj.put(jsonReader.nextName(), jsonReader.nextString());
|
||||
JsonToken token;
|
||||
String name;
|
||||
try {
|
||||
name = jsonReader.nextName();
|
||||
token = jsonReader.peek();
|
||||
|
||||
//Log.d(TAG, token.toString());
|
||||
|
||||
switch(token) {
|
||||
case NUMBER:
|
||||
jObj.put(name, jsonReader.nextLong());
|
||||
break;
|
||||
case NULL:
|
||||
jsonReader.skipValue();
|
||||
break;
|
||||
case BOOLEAN:
|
||||
jObj.put(name, jsonReader.nextBoolean());
|
||||
break;
|
||||
default:
|
||||
jObj.put(name, jsonReader.nextString());
|
||||
}
|
||||
} catch(Exception ex) {
|
||||
//ex.printStackTrace();
|
||||
ex.printStackTrace();
|
||||
jsonReader.skipValue();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue