From b35df1006c7d564c5e089116ce5d87d034ec793c Mon Sep 17 00:00:00 2001 From: David Development Date: Sun, 19 Jul 2015 15:19:38 +0200 Subject: [PATCH] refactoring --- .../database/DatabaseConnectionOrm.java | 15 +-------------- .../reader/owncloud/AsyncTask_GetOldItems.java | 4 ++-- .../services/PodcastDownloadService.java | 17 +++-------------- 3 files changed, 6 insertions(+), 30 deletions(-) diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/DatabaseConnectionOrm.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/DatabaseConnectionOrm.java index 30c3be68..04e12a24 100644 --- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/DatabaseConnectionOrm.java +++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/DatabaseConnectionOrm.java @@ -317,20 +317,7 @@ public class DatabaseConnectionOrm { return daoSession.getRssItemDao().queryBuilder().where(RssItemDao.Properties.Starred.eq(true), RssItemDao.Properties.Starred_temp.eq(false)).list(); } - - - - - public int getCountOfAllItems(boolean execludeStarred) {//TODO needs testing! - long count; - if(execludeStarred) - count = daoSession.getRssItemDao().queryBuilder().where(RssItemDao.Properties.Starred_temp.notEq(true)).count(); - else - count = daoSession.getRssItemDao().count(); - return (int) count; - } - - public LazyList getAllItemsWithIdHigher(long id) {//TODO needs testing! + public LazyList getAllItemsWithIdHigher(long id) { return daoSession.getRssItemDao().queryBuilder().where(RssItemDao.Properties.Id.ge(id)).listLazyUncached(); } diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/reader/owncloud/AsyncTask_GetOldItems.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/reader/owncloud/AsyncTask_GetOldItems.java index ee3c20fa..d07d35dc 100644 --- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/reader/owncloud/AsyncTask_GetOldItems.java +++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/reader/owncloud/AsyncTask_GetOldItems.java @@ -63,13 +63,13 @@ public class AsyncTask_GetOldItems extends AsyncTask_Reader { if(feed_id != null) { RssItem rssItem = dbConn.getLowestRssItemIdByFeed(feed_id); - offset = rssItem.getId();//TODO needs testing! + offset = rssItem.getId(); id = feed_id; type = "0"; } else if(folder_id != null) { - if(folder_id == SubscriptionExpandableListAdapter.SPECIAL_FOLDERS.ALL_STARRED_ITEMS.getValue())//TODO needs testing! + if(folder_id == SubscriptionExpandableListAdapter.SPECIAL_FOLDERS.ALL_STARRED_ITEMS.getValue()) { offset = dbConn.getLowestItemId(true); id = 0L; diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/services/PodcastDownloadService.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/services/PodcastDownloadService.java index e82c0033..e53cdcb6 100644 --- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/services/PodcastDownloadService.java +++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/services/PodcastDownloadService.java @@ -28,21 +28,17 @@ import de.luhmer.owncloudnewsreader.model.PodcastItem; * An {@link IntentService} subclass for handling asynchronous task requests in * a service on a separate handler thread. *

- * TODO: Customize class - update intent actions, extra parameters and static * helper methods. */ public class PodcastDownloadService extends IntentService { - // TODO: Rename actions, choose action names that describe tasks that this // IntentService can perform, e.g. ACTION_FETCH_NEW_ITEMS private static final String ACTION_DOWNLOAD = "de.luhmer.owncloudnewsreader.services.action.DOWNLOAD"; - // TODO: Rename parameters private static final String EXTRA_RECEIVER = "de.luhmer.owncloudnewsreader.services.extra.RECEIVER"; private static final String EXTRA_URL = "de.luhmer.owncloudnewsreader.services.extra.URL"; - private static final String EXTRA_PARAM2 = "de.luhmer.owncloudnewsreader.services.extra.PARAM2"; - private static final String TAG = "PodcastDownloadService"; + private static final String TAG = PodcastDownloadService.class.getCanonicalName(); private EventBus eventBus; @@ -57,7 +53,6 @@ public class PodcastDownloadService extends IntentService { intent.setAction(ACTION_DOWNLOAD); intent.putExtra(EXTRA_URL, podcastItem); //intent.putExtra(EXTRA_RECEIVER, receiver); - //intent.putExtra(EXTRA_PARAM2, param2); context.startService(intent); } @@ -82,11 +77,7 @@ public class PodcastDownloadService extends IntentService { downloadPodcast(podcast, this); - }/* else if (ACTION_BAZ.equals(action)) { - final String param1 = intent.getStringExtra(EXTRA_PARAM1); - final String param2 = intent.getStringExtra(EXTRA_PARAM2); - handleActionBaz(param1, param2); - }*/ + } } } @@ -221,15 +212,13 @@ public class PodcastDownloadService extends IntentService { */ } - public static final int UPDATE_PROGRESS = 5555; + //public static final int UPDATE_PROGRESS = 5555; public class DownloadProgressUpdate { - public DownloadProgressUpdate(PodcastItem podcast) { this.podcast = podcast; } - public PodcastItem podcast; } }