diff --git a/.gitignore b/.gitignore
index c77a34a4..ce14694b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,6 +22,7 @@ local.properties
# Eclipse project files
.classpath
.project
+.settings
# Android Studio
.idea/
diff --git a/.project b/.project
deleted file mode 100644
index 3f4b2d10..00000000
--- a/.project
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
- OwncloudNewsReader
-
-
- ActionBarSherlock
- Android-PullToRefresh
-
-
-
- com.android.ide.eclipse.adt.ResourceManagerBuilder
-
-
-
-
- com.android.ide.eclipse.adt.PreCompilerBuilder
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- com.android.ide.eclipse.adt.ApkBuilder
-
-
-
-
-
- com.android.ide.eclipse.adt.AndroidNature
- org.eclipse.jdt.core.javanature
-
-
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index b080d2dd..00000000
--- a/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.source=1.6
diff --git a/.settings/org.eclipse.ltk.core.refactoring.prefs b/.settings/org.eclipse.ltk.core.refactoring.prefs
deleted file mode 100644
index b196c64a..00000000
--- a/.settings/org.eclipse.ltk.core.refactoring.prefs
+++ /dev/null
@@ -1,2 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
diff --git a/News-Android-App.iml b/News-Android-App.iml
deleted file mode 100644
index 55503402..00000000
--- a/News-Android-App.iml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/News-Android-App/News-Android-App-News-Android-App.iml b/News-Android-App/News-Android-App-News-Android-App.iml
deleted file mode 100644
index 437ab4cf..00000000
--- a/News-Android-App/News-Android-App-News-Android-App.iml
+++ /dev/null
@@ -1,189 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/News-Android-App/src/androidTest/java/de/luhmer/owncloudnewsreader/junit_tests/TestDbTest.java b/News-Android-App/src/androidTest/java/de/luhmer/owncloudnewsreader/junit_tests/TestDbTest.java
index 44a0e6fc..5aa68f0b 100644
--- a/News-Android-App/src/androidTest/java/de/luhmer/owncloudnewsreader/junit_tests/TestDbTest.java
+++ b/News-Android-App/src/androidTest/java/de/luhmer/owncloudnewsreader/junit_tests/TestDbTest.java
@@ -13,7 +13,6 @@ import org.robolectric.annotation.Config;
import java.util.List;
import de.luhmer.owncloudnewsreader.NewsReaderListActivity;
-import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm;
import de.luhmer.owncloudnewsreader.database.DatabaseHelperOrm;
import de.luhmer.owncloudnewsreader.database.model.DaoSession;
diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/ListView/SubscriptionExpandableListAdapter.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/ListView/SubscriptionExpandableListAdapter.java
index bb6d286f..77289c12 100644
--- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/ListView/SubscriptionExpandableListAdapter.java
+++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/ListView/SubscriptionExpandableListAdapter.java
@@ -127,11 +127,6 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
mTextColorLightTheme = mContext.getResources().getColor(R.color.slider_listview_text_color_light_theme);
- //int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);
- //Use 1/8 of the available memory for this memory cache
- //int cachSize = maxMemory / 8;
- //favIconCache = new BitmapDrawableLruCache(cachSize);
-
fHelper = new FontHelper(mContext);
unreadCountFeeds = new SparseArray();
@@ -462,26 +457,6 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
}
-
- /*
- @TargetApi(Build.VERSION_CODES.HONEYCOMB)
- private void SetUnreadCountForFeed(TextView textView, String idDatabase, boolean execludeStarredItems)
- {
- IGetTextForTextViewAsyncTask iGetter = new UnreadFeedCount(mContext, idDatabase, execludeStarredItems);
- FillTextForTextViewHelper.FillTextForTextView(textView, iGetter, !mIsTwoPane);
- }
-
- @TargetApi(Build.VERSION_CODES.HONEYCOMB)
- private void SetUnreadCountForFolder(TextView textView, String idDatabase)
- {
- IGetTextForTextViewAsyncTask iGetter = new UnreadFolderCount(mContext, idDatabase);
- FillTextForTextViewHelper.FillTextForTextView(textView, iGetter, !mIsTwoPane);
- }
- */
-
-
-
-
static class GroupHolder
{
@InjectView(R.id.summary) TextView txt_Summary;
diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/ListView/UnreadFeedCount.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/ListView/UnreadFeedCount.java
deleted file mode 100644
index 0f16ec7d..00000000
--- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/ListView/UnreadFeedCount.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
-* Android ownCloud News
-*
-* @author David Luhmer
-* @copyright 2013 David Luhmer david-dev@live.de
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-* License as published by the Free Software Foundation; either
-* version 3 of the License, or any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
-*
-* You should have received a copy of the GNU Affero General Public
-* License along with this library. If not, see .
-*
-*/
-
-package de.luhmer.owncloudnewsreader.ListView;
-
-import android.content.Context;
-
-import de.luhmer.owncloudnewsreader.async_tasks.IGetTextForTextViewAsyncTask;
-import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
-
-@Deprecated
-public class UnreadFeedCount implements IGetTextForTextViewAsyncTask {
-
- Context context;
- String idDatabase;
- boolean execludeStarredItems;
-
- public UnreadFeedCount(Context context, String idDatabase, boolean execludeStarredItems) {
- this.context = context;
- this.idDatabase = idDatabase;
- this.execludeStarredItems = execludeStarredItems;
- }
-
- @Override
- public String getText() {
- DatabaseConnection dbConn = new DatabaseConnection(context);
- int unread = 0;
- try
- {
- unread = dbConn.getCountItemsForSubscription(idDatabase, true, execludeStarredItems);
- } finally {
- dbConn.closeDatabase();
- }
-
- return String.valueOf(unread);
- }
-}
diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/ListView/UnreadFolderCount.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/ListView/UnreadFolderCount.java
deleted file mode 100644
index f972bac2..00000000
--- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/ListView/UnreadFolderCount.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
-* Android ownCloud News
-*
-* @author David Luhmer
-* @copyright 2013 David Luhmer david-dev@live.de
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-* License as published by the Free Software Foundation; either
-* version 3 of the License, or any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
-*
-* You should have received a copy of the GNU Affero General Public
-* License along with this library. If not, see .
-*
-*/
-
-package de.luhmer.owncloudnewsreader.ListView;
-
-import android.content.Context;
-
-import de.luhmer.owncloudnewsreader.async_tasks.IGetTextForTextViewAsyncTask;
-import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
-
-@Deprecated
-public class UnreadFolderCount implements IGetTextForTextViewAsyncTask {
-
- Context context;
- String idDatabase;
-
- public UnreadFolderCount(Context context, String idDatabase) {
- this.context = context;
- this.idDatabase = idDatabase;
- }
-
- @Override
- public String getText() {
- DatabaseConnection dbConn = new DatabaseConnection(context);
- int unread = 0;
- try
- {
- unread = dbConn.getCountFeedsForFolder(idDatabase, true);
- } finally {
- dbConn.closeDatabase();
- }
-
- return String.valueOf(unread);
- }
-}
diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsDetailActivity.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsDetailActivity.java
index d9982efb..400d4b4e 100644
--- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsDetailActivity.java
+++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsDetailActivity.java
@@ -21,7 +21,6 @@
package de.luhmer.owncloudnewsreader;
-import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@@ -38,7 +37,6 @@ import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.support.v7.widget.Toolbar;
import android.text.Html;
-import android.util.DisplayMetrics;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
@@ -48,8 +46,8 @@ import android.widget.ProgressBar;
import butterknife.ButterKnife;
import butterknife.InjectView;
import de.greenrobot.dao.query.LazyList;
-import de.luhmer.owncloudnewsreader.database.DatabaseConnection.SORT_DIRECTION;
import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm;
+import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm.SORT_DIRECTION;
import de.luhmer.owncloudnewsreader.database.model.RssItem;
import de.luhmer.owncloudnewsreader.helper.PostDelayHandler;
import de.luhmer.owncloudnewsreader.helper.ThemeChooser;
diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderDetailFragment.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderDetailFragment.java
index 2faca81b..b92e90df 100644
--- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderDetailFragment.java
+++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderDetailFragment.java
@@ -29,10 +29,8 @@ import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceManager;
-import android.support.v4.app.FragmentActivity;
import android.support.v4.app.ListFragment;
import android.support.v7.app.ActionBarActivity;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -53,8 +51,8 @@ import de.luhmer.owncloudnewsreader.ListView.SubscriptionExpandableListAdapter;
import de.luhmer.owncloudnewsreader.adapter.NewsListArrayAdapter;
import de.luhmer.owncloudnewsreader.cursor.IOnStayUnread;
import de.luhmer.owncloudnewsreader.cursor.NewsListCursorAdapter;
-import de.luhmer.owncloudnewsreader.database.DatabaseConnection.SORT_DIRECTION;
import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm;
+import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm.SORT_DIRECTION;
import de.luhmer.owncloudnewsreader.database.model.RssItem;
import de.luhmer.owncloudnewsreader.services.PodcastDownloadService;
@@ -75,13 +73,6 @@ public class NewsReaderDetailFragment extends ListFragment implements IOnStayUnr
//private boolean DialogShowedToMarkLastItemsAsRead = false;
- /*
- private NewsListCursorAdapter lvAdapter;
-
- public NewsListCursorAdapter getLvAdapter() {
- return lvAdapter;
- }*/
-
Long idFeed;
/**
* @return the idFeed
@@ -293,10 +284,6 @@ public class NewsReaderDetailFragment extends ListFragment implements IOnStayUnr
NewsListArrayAdapter nca = (NewsListArrayAdapter) getListAdapter();
if(nca != null)
nca.notifyDataSetChanged();
-
- //NewsListCursorAdapter nca = (NewsListCursorAdapter) getListAdapter();
- //if(nca != null)
- //((NewsListCursorAdapter) getListAdapter()).notifyDataSetChanged();
}
/**
diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderListActivity.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderListActivity.java
index 1a5ea145..a2d0acc6 100644
--- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderListActivity.java
+++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderListActivity.java
@@ -27,12 +27,10 @@ import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.content.Intent;
import android.content.SharedPreferences;
-import android.database.Cursor;
import android.os.Build;
import android.os.Bundle;
import android.os.RemoteException;
import android.preference.PreferenceManager;
-import android.provider.Settings;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.widget.SlidingPaneLayout;
@@ -57,7 +55,6 @@ import de.luhmer.owncloudnewsreader.ListView.SubscriptionExpandableListAdapter;
import de.luhmer.owncloudnewsreader.LoginDialogFragment.LoginSuccessfullListener;
import de.luhmer.owncloudnewsreader.adapter.NewsListArrayAdapter;
import de.luhmer.owncloudnewsreader.authentication.AccountGeneral;
-import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm;
import de.luhmer.owncloudnewsreader.database.DatabaseHelperOrm;
import de.luhmer.owncloudnewsreader.database.model.DaoSession;
@@ -249,7 +246,7 @@ public class NewsReaderListActivity extends MenuUtilsFragmentActivity implements
/* Test 2 */
for (Folder folder : folderList) {
- String query = dbConn.getAllItemsIdsForFolderSQL(folder.getId(), true, DatabaseConnection.SORT_DIRECTION.asc);
+ String query = dbConn.getAllItemsIdsForFolderSQL(folder.getId(), true, DatabaseConnectionOrm.SORT_DIRECTION.asc);
dbConn.insertIntoRssCurrentViewTable(query);
//Log.d(TAG, "Inserting time needed: " + (System.currentTimeMillis() - start) + " ms");
diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/async_tasks/GetImageThreaded.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/async_tasks/GetImageThreaded.java
index 67c65180..d5b5e781 100644
--- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/async_tasks/GetImageThreaded.java
+++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/async_tasks/GetImageThreaded.java
@@ -21,12 +21,9 @@
package de.luhmer.owncloudnewsreader.async_tasks;
-import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
-import android.graphics.drawable.BitmapDrawable;
-import android.os.AsyncTask;
import android.util.Log;
import org.apache.http.util.ByteArrayBuffer;
@@ -41,7 +38,6 @@ import java.net.URLConnection;
import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm;
import de.luhmer.owncloudnewsreader.database.model.Feed;
-import de.luhmer.owncloudnewsreader.helper.BitmapDrawableLruCache;
import de.luhmer.owncloudnewsreader.helper.ImageDownloadFinished;
import de.luhmer.owncloudnewsreader.helper.ImageHandler;
@@ -70,8 +66,7 @@ public class GetImageThreaded extends Thread
}
catch(Exception ex)
{
- Log.d(TAG, ex.getLocalizedMessage() + " - URL: " + WEB_URL_TO_FILE);
- //ex.printStackTrace();
+ Log.d(TAG, "Invalid URL: " + WEB_URL_TO_FILE, ex);
}
this.cont = cont;
diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/cursor/NewsListCursorAdapter.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/cursor/NewsListCursorAdapter.java
index cf8b9717..63da53bc 100644
--- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/cursor/NewsListCursorAdapter.java
+++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/cursor/NewsListCursorAdapter.java
@@ -21,422 +21,23 @@
package de.luhmer.owncloudnewsreader.cursor;
-import android.annotation.SuppressLint;
-import android.annotation.TargetApi;
import android.content.Context;
-import android.content.SharedPreferences;
-import android.database.Cursor;
-import android.os.Build;
-import android.preference.PreferenceManager;
-import android.support.v4.app.FragmentActivity;
-import android.support.v4.widget.CursorAdapter;
-import android.text.Html;
-import android.text.Spannable;
-import android.text.SpannableString;
-import android.text.format.DateUtils;
-import android.text.style.ForegroundColorSpan;
-import android.view.LayoutInflater;
import android.view.View;
-import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
-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 butterknife.ButterKnife;
-import butterknife.InjectView;
-import de.luhmer.owncloudnewsreader.NewsReaderListActivity;
-import de.luhmer.owncloudnewsreader.R;
-import de.luhmer.owncloudnewsreader.SettingsActivity;
-import de.luhmer.owncloudnewsreader.async_tasks.IGetTextForTextViewAsyncTask;
-import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
-import de.luhmer.owncloudnewsreader.helper.FillTextForTextViewHelper;
-import de.luhmer.owncloudnewsreader.helper.FontHelper;
-import de.luhmer.owncloudnewsreader.helper.PostDelayHandler;
-import de.luhmer.owncloudnewsreader.helper.ThemeChooser;
-import de.luhmer.owncloudnewsreader.reader.IReader;
-import de.luhmer.owncloudnewsreader.reader.owncloud.OwnCloud_Reader;
-
@Deprecated
-public class NewsListCursorAdapter extends CursorAdapter {
- //private static final String TAG = "NewsListCursorAdapter";
- DatabaseConnection dbConn;
- IReader _Reader;
- //SimpleDateFormat simpleDateFormat;
- final int LengthBody = 400;
- ForegroundColorSpan bodyForegroundColor;
- IOnStayUnread onStayUnread;
-
- PostDelayHandler pDelayHandler;
-
- int selectedDesign = 0;
-
- @SuppressLint("SimpleDateFormat")
- @SuppressWarnings("deprecation")
- public NewsListCursorAdapter(Context context, Cursor c, IOnStayUnread onStayUnread) {
- super(context, c);
-
- this.onStayUnread = onStayUnread;
-
- pDelayHandler = new PostDelayHandler(context);
-
- //simpleDateFormat = new SimpleDateFormat("EEE, d. MMM HH:mm:ss");
- bodyForegroundColor = new ForegroundColorSpan(context.getResources().getColor(android.R.color.secondary_text_dark));
-
- _Reader = new OwnCloud_Reader();
- dbConn = new DatabaseConnection(context);
-
- SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
- selectedDesign = Integer.valueOf(mPrefs.getString(SettingsActivity.SP_FEED_LIST_LAYOUT, "0"));
- }
-
- @Override
- public void bindView(final View view, final Context context, Cursor cursor) {
- final String idItemDb = cursor.getString(0);
-
- switch (selectedDesign) {
- case 0:
- setSimpleLayout(view, cursor);
- break;
-
- case 1:
- setExtendedLayout(view, cursor);
- break;
-
- case 2:
- setExtendedLayoutWebView(view, cursor);
- break;
-
- default:
- break;
- }
-
- FontHelper fHelper = new FontHelper(context);
- fHelper.setFontForAllChildren(view, fHelper.getFont());
-
- CheckBox cbStarred = (CheckBox) view.findViewById(R.id.cb_lv_item_starred);
- if(ThemeChooser.isDarkTheme(mContext))
- cbStarred.setBackgroundResource(R.drawable.checkbox_background_holo_dark);
- /*
- //The default is white so we don't need to set it here again..
- else
- cbStarred.setBackgroundResource(R.drawable.checkbox_background_holo_light);*/
-
- cbStarred.setOnCheckedChangeListener(null);
-
- Boolean isStarred = dbConn.isFeedUnreadStarred(cursor.getString(0), false);//false => starred will be checked
- //Log.d("ISSTARRED", "" + isStarred + " - Cursor: " + cursor.getString(0));
- cbStarred.setChecked(isStarred);
- cbStarred.setClickable(true);
- cbStarred.setOnCheckedChangeListener(new OnCheckedChangeListener() {
-
- @Override
- public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- dbConn.updateIsStarredOfItem(idItemDb, isChecked);
-
- if(isChecked)
- UpdateIsReadCheckBox(buttonView, idItemDb);
-
- pDelayHandler.DelayTimer();
- }
- });
-
- LinearLayout ll_cb_starred_wrapper = (LinearLayout) view.findViewById(R.id.ll_cb_starred_wrapper);
- if(ll_cb_starred_wrapper != null) {
- ll_cb_starred_wrapper.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- CheckBox cbStarred = (CheckBox) view.findViewById(R.id.cb_lv_item_starred);
- cbStarred.setChecked(!cbStarred.isChecked());
- }
- });
- }
-
- CheckBox cbRead = (CheckBox) view.findViewById(R.id.cb_lv_item_read);
- cbRead.setTag(idItemDb);
- cbRead.setOnCheckedChangeListener(null);
- Boolean isChecked = dbConn.isFeedUnreadStarred(cursor.getString(0), true);
- //Log.d("ISREAD", "" + isChecked + " - Cursor: " + cursor.getString(0));
- cbRead.setChecked(isChecked);
- if(!isChecked) {
- TextView textView = (TextView) view.findViewById(R.id.summary);
- fHelper.setFontStyleForSingleView(textView, fHelper.getFontUnreadStyle());
- }
-
-
- cbRead.setClickable(true);
- cbRead.setOnCheckedChangeListener(new OnCheckedChangeListener() {
-
- @Override
- public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- ChangeReadStateOfItem((CheckBox) buttonView, view, isChecked, context);
- }
- });
-
-
- String colorString = dbConn.getAvgColourOfFeedByDbId(cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_SUBSCRIPTION_ID)));
- View viewColor = view.findViewById(R.id.color_line_feed);
- if(colorString != null)
- viewColor.setBackgroundColor(Integer.parseInt(colorString));
- }
-
- public void ChangeReadStateOfItem(CheckBox checkBox, View parentView, boolean isChecked, Context context) {
-
- dbConn.updateIsReadOfItem(checkBox.getTag().toString(), isChecked);
-
- UpdateListCursor(mContext);
-
- pDelayHandler.DelayTimer();
-
- TextView textView = (TextView) parentView.findViewById(R.id.summary);
- if(textView != null && parentView.getTop() >= 0)
- {
- FontHelper fHelper = new FontHelper(context);
- if(isChecked)
- fHelper.setFontStyleForSingleView(textView, fHelper.getFont());
- //textView.setTextAppearance(mContext, R.style.RobotoFontStyle);
- else {
- fHelper.setFontStyleForSingleView(textView, fHelper.getFontUnreadStyle());
- onStayUnread.stayUnread(checkBox);
- }
- //textView.setTextAppearance(mContext, R.style.RobotoFontStyleBold);
-
- textView.invalidate();
- }
- }
-
- public void setSimpleLayout(View view, Cursor cursor)
- {
- SimpleLayout simpleLayout = new SimpleLayout(view);
-
- simpleLayout.textViewSummary.setText(Html.fromHtml(cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_TITLE))).toString());
-
- long pubDate = cursor.getLong(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_PUBDATE));
- String dateString = (String) DateUtils.getRelativeTimeSpanString(pubDate);
- simpleLayout.textViewItemDate.setText(dateString);
-
- simpleLayout.textViewTitle.setText(dbConn.getTitleOfSubscriptionByRowID(cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_SUBSCRIPTION_ID))));
- simpleLayout.textViewSummary.setTag(cursor.getString(0));
-
- if(!ThemeChooser.isDarkTheme(mContext)) {
- simpleLayout.viewDivider.setBackgroundColor(mContext.getResources().getColor(R.color.divider_row_color_light_theme));
- }
- }
-
- static class SimpleLayout {
- @InjectView(R.id.divider) View viewDivider;
- @InjectView(R.id.summary) TextView textViewSummary;
- @InjectView(R.id.tv_item_date) TextView textViewItemDate;
- @InjectView(R.id.tv_subscription) TextView textViewTitle;
-
- SimpleLayout(View view) {
- ButterKnife.inject(this, view);
- }
- }
-
- public void setExtendedLayout(View view, Cursor cursor)
- {
- ExtendedLayout extendedLayout = new ExtendedLayout(view);
-
- extendedLayout.textViewSummary.setText(Html.fromHtml(cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_TITLE))).toString());
-
- long pubDate = cursor.getLong(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_PUBDATE));
- //textViewItemDate.setText(simpleDateFormat.format(new Date(pubDate)));
- String dateString = (String) DateUtils.getRelativeTimeSpanString(pubDate);
- extendedLayout.textViewItemDate.setText(dateString);
-
- extendedLayout.textViewItemBody.setVisibility(View.INVISIBLE);
- String idItemDb = cursor.getString(0);
- IGetTextForTextViewAsyncTask iGetter = new DescriptionTextGetter(idItemDb);
- FillTextForTextViewHelper.FillTextForTextView(extendedLayout.textViewItemBody, iGetter, true);
-
- extendedLayout.textViewTitle.setText(dbConn.getTitleOfSubscriptionByRowID(cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_SUBSCRIPTION_ID))));
- extendedLayout.textViewSummary.setTag(cursor.getString(0));
-
- if(!ThemeChooser.isDarkTheme(mContext)) {
- extendedLayout.textViewItemBody.setTextColor(mContext.getResources().getColor(R.color.extended_listview_item_body_text_color_light_theme));
- extendedLayout.viewDivider.setBackgroundColor(mContext.getResources().getColor(R.color.divider_row_color_light_theme));
- }
- }
-
- static class ExtendedLayout {
- @InjectView(R.id.divider) View viewDivider;
- @InjectView(R.id.summary) TextView textViewSummary;
- @InjectView(R.id.tv_item_date) TextView textViewItemDate;
- @InjectView(R.id.body) TextView textViewItemBody;
- @InjectView(R.id.tv_subscription) TextView textViewTitle;
-
- ExtendedLayout(View view) {
- ButterKnife.inject(this, view);
- }
- }
-
- @TargetApi(Build.VERSION_CODES.HONEYCOMB)
- public void setExtendedLayoutWebView(View view, Cursor cursor)
- {
- WebView webViewContent = (WebView) view.findViewById(R.id.webView_body);
- webViewContent.setClickable(false);
- webViewContent.setFocusable(false);
- //if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
- // webViewContent.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
-
- //webViewContent.loadDataWithBaseURL("", NewsDetailFragment.getHtmlPage(mContext, dbConn , cursor.getInt(0)), "text/html", "UTF-8", ""); //This line is needed to run the adapter
- }
-
-
- public void CloseDatabaseConnection()
- {
- if(dbConn != null)
- dbConn.closeDatabase();
- }
-
- private void UpdateIsReadCheckBox(View view, String idItemDb)
- {
- LinearLayout lLayout = (LinearLayout) view.getParent();
- Boolean isChecked = dbConn.isFeedUnreadStarred(idItemDb, true);
- CheckBox cbRead = (CheckBox) lLayout.findViewById(R.id.cb_lv_item_read);
- if(cbRead == null) {//In the default layout the star checkbox is nested two times.
- lLayout = (LinearLayout) lLayout.getParent();
- cbRead = (CheckBox) lLayout.findViewById(R.id.cb_lv_item_read);
- }
- cbRead.setChecked(isChecked);
- }
-
+public class NewsListCursorAdapter
+{
public static void ChangeCheckBoxState(CheckBox cb, boolean state, Context context)
{
if(cb != null && cb.isChecked() != state)
cb.setChecked(state);
}
- public static void UpdateListCursor(Context context)
- {
- FragmentActivity sfa = (FragmentActivity) context;
-
- if(sfa instanceof NewsReaderListActivity && ((NewsReaderListActivity) sfa).isSlidingPaneOpen())
- ((NewsReaderListActivity) sfa).updateAdapter();
- }
-
-
- private String getBodyText(String body)
- {
- body = body.replaceAll("]*>", "");
- body = body.replaceAll("