refactoring

This commit is contained in:
David Development 2015-07-19 15:19:38 +02:00
parent 1a640c03d3
commit b35df1006c
3 changed files with 6 additions and 30 deletions

View file

@ -317,20 +317,7 @@ public class DatabaseConnectionOrm {
return daoSession.getRssItemDao().queryBuilder().where(RssItemDao.Properties.Starred.eq(true), RssItemDao.Properties.Starred_temp.eq(false)).list(); return daoSession.getRssItemDao().queryBuilder().where(RssItemDao.Properties.Starred.eq(true), RssItemDao.Properties.Starred_temp.eq(false)).list();
} }
public LazyList<RssItem> getAllItemsWithIdHigher(long id) {
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<RssItem> getAllItemsWithIdHigher(long id) {//TODO needs testing!
return daoSession.getRssItemDao().queryBuilder().where(RssItemDao.Properties.Id.ge(id)).listLazyUncached(); return daoSession.getRssItemDao().queryBuilder().where(RssItemDao.Properties.Id.ge(id)).listLazyUncached();
} }

View file

@ -63,13 +63,13 @@ public class AsyncTask_GetOldItems extends AsyncTask_Reader {
if(feed_id != null) if(feed_id != null)
{ {
RssItem rssItem = dbConn.getLowestRssItemIdByFeed(feed_id); RssItem rssItem = dbConn.getLowestRssItemIdByFeed(feed_id);
offset = rssItem.getId();//TODO needs testing! offset = rssItem.getId();
id = feed_id; id = feed_id;
type = "0"; type = "0";
} }
else if(folder_id != null) 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); offset = dbConn.getLowestItemId(true);
id = 0L; id = 0L;

View file

@ -28,21 +28,17 @@ import de.luhmer.owncloudnewsreader.model.PodcastItem;
* An {@link IntentService} subclass for handling asynchronous task requests in * An {@link IntentService} subclass for handling asynchronous task requests in
* a service on a separate handler thread. * a service on a separate handler thread.
* <p> * <p>
* TODO: Customize class - update intent actions, extra parameters and static
* helper methods. * helper methods.
*/ */
public class PodcastDownloadService extends IntentService { 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 // IntentService can perform, e.g. ACTION_FETCH_NEW_ITEMS
private static final String ACTION_DOWNLOAD = "de.luhmer.owncloudnewsreader.services.action.DOWNLOAD"; 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_RECEIVER = "de.luhmer.owncloudnewsreader.services.extra.RECEIVER";
private static final String EXTRA_URL = "de.luhmer.owncloudnewsreader.services.extra.URL"; 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.class.getCanonicalName();
private static final String TAG = "PodcastDownloadService";
private EventBus eventBus; private EventBus eventBus;
@ -57,7 +53,6 @@ public class PodcastDownloadService extends IntentService {
intent.setAction(ACTION_DOWNLOAD); intent.setAction(ACTION_DOWNLOAD);
intent.putExtra(EXTRA_URL, podcastItem); intent.putExtra(EXTRA_URL, podcastItem);
//intent.putExtra(EXTRA_RECEIVER, receiver); //intent.putExtra(EXTRA_RECEIVER, receiver);
//intent.putExtra(EXTRA_PARAM2, param2);
context.startService(intent); context.startService(intent);
} }
@ -82,11 +77,7 @@ public class PodcastDownloadService extends IntentService {
downloadPodcast(podcast, this); 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 class DownloadProgressUpdate {
public DownloadProgressUpdate(PodcastItem podcast) { public DownloadProgressUpdate(PodcastItem podcast) {
this.podcast = podcast; this.podcast = podcast;
} }
public PodcastItem podcast; public PodcastItem podcast;
} }
} }