Merge pull request #1107 from mfietz/issue/1106

Read feed counter setting correctly
This commit is contained in:
Tom Hennen 2015-08-18 16:48:40 -04:00
commit 003d3f92a3
3 changed files with 9 additions and 9 deletions

View File

@ -44,7 +44,7 @@ public class UserPreferences {
public static final String PREF_THEME = "prefTheme"; public static final String PREF_THEME = "prefTheme";
public static final String PREF_HIDDEN_DRAWER_ITEMS = "prefHiddenDrawerItems"; public static final String PREF_HIDDEN_DRAWER_ITEMS = "prefHiddenDrawerItems";
public static final String PREF_DRAWER_FEED_ORDER = "prefDrawerFeedOrder"; public static final String PREF_DRAWER_FEED_ORDER = "prefDrawerFeedOrder";
public static final String PREF_DRAWER_FEED_COUNTER = "prefDrawerFeedCounter"; public static final String PREF_DRAWER_FEED_COUNTER = "prefDrawerFeedIndicator";
public static final String PREF_EXPANDED_NOTIFICATION = "prefExpandNotify"; public static final String PREF_EXPANDED_NOTIFICATION = "prefExpandNotify";
public static final String PREF_PERSISTENT_NOTIFICATION = "prefPersistNotify"; public static final String PREF_PERSISTENT_NOTIFICATION = "prefPersistNotify";
public static final String PREF_SHOW_DOWNLOAD_REPORT = "prefShowDownloadReport"; public static final String PREF_SHOW_DOWNLOAD_REPORT = "prefShowDownloadReport";
@ -90,7 +90,7 @@ public class UserPreferences {
// Constants // Constants
private static int EPISODE_CACHE_SIZE_UNLIMITED = -1; private static int EPISODE_CACHE_SIZE_UNLIMITED = -1;
public static int FEED_ORDER_UNPLAYED_EPISODES = 0; public static int FEED_ORDER_COUNTER = 0;
public static int FEED_ORDER_ALPHABETICAL = 1; public static int FEED_ORDER_ALPHABETICAL = 1;
public static int FEED_COUNTER_SHOW_NEW_UNPLAYED_SUM = 0; public static int FEED_COUNTER_SHOW_NEW_UNPLAYED_SUM = 0;
public static int FEED_COUNTER_SHOW_NEW = 1; public static int FEED_COUNTER_SHOW_NEW = 1;
@ -144,7 +144,7 @@ public class UserPreferences {
return Integer.valueOf(value); return Integer.valueOf(value);
} }
public static int getFeedCounter() { public static int getFeedCounterSetting() {
String value = prefs.getString(PREF_DRAWER_FEED_COUNTER, "0"); String value = prefs.getString(PREF_DRAWER_FEED_COUNTER, "0");
return Integer.valueOf(value); return Integer.valueOf(value);
} }

View File

@ -1141,7 +1141,7 @@ public final class DBReader {
Comparator<Feed> comparator; Comparator<Feed> comparator;
int feedOrder = UserPreferences.getFeedOrder(); int feedOrder = UserPreferences.getFeedOrder();
if(feedOrder == UserPreferences.FEED_ORDER_UNPLAYED_EPISODES) { if(feedOrder == UserPreferences.FEED_ORDER_COUNTER) {
comparator = new Comparator<Feed>() { comparator = new Comparator<Feed>() {
@Override @Override
public int compare(Feed lhs, Feed rhs) { public int compare(Feed lhs, Feed rhs) {

View File

@ -1301,16 +1301,16 @@ public class PodDBAdapter {
} }
public final LongIntMap getFeedCounters(long... feedIds) { public final LongIntMap getFeedCounters(long... feedIds) {
int counter = UserPreferences.getFeedCounter(); int setting = UserPreferences.getFeedCounterSetting();
String whereRead; String whereRead;
if(counter == UserPreferences.FEED_COUNTER_SHOW_NEW_UNPLAYED_SUM) { if(setting == UserPreferences.FEED_COUNTER_SHOW_NEW_UNPLAYED_SUM) {
whereRead = "(" + KEY_READ + "=" + FeedItem.NEW whereRead = "(" + KEY_READ + "=" + FeedItem.NEW
+ " OR " + KEY_READ + "=" + FeedItem.UNPLAYED + ")"; + " OR " + KEY_READ + "=" + FeedItem.UNPLAYED + ")";
} else if(counter == UserPreferences.FEED_COUNTER_SHOW_NEW) { } else if(setting == UserPreferences.FEED_COUNTER_SHOW_NEW) {
whereRead = KEY_READ + "=" + FeedItem.NEW; whereRead = KEY_READ + "=" + FeedItem.NEW;
} else if(counter == UserPreferences.FEED_COUNTER_SHOW_UNPLAYED) { } else if(setting == UserPreferences.FEED_COUNTER_SHOW_UNPLAYED) {
whereRead = KEY_READ + "=" + FeedItem.UNPLAYED; whereRead = KEY_READ + "=" + FeedItem.UNPLAYED;
} else { } else { // NONE
return new LongIntMap(0); return new LongIntMap(0);
} }