diff options
author | Tom Hennen <tom.hennen@gmail.com> | 2016-04-02 10:11:36 -0400 |
---|---|---|
committer | Tom Hennen <tom.hennen@gmail.com> | 2016-04-02 10:11:36 -0400 |
commit | 133ef4c4a84d1dc3eea7360725fbe83672dff5c7 (patch) | |
tree | ecae0e84767ad5d706f1010b22a2e9103b9a5aaf /app/src/main/java | |
parent | c50f66322293b7a2f7cb4a4cbe8293c10d4a486f (diff) | |
download | AntennaPod-133ef4c4a84d1dc3eea7360725fbe83672dff5c7.zip |
treat showing the subscriptions list like other drawer items.
Diffstat (limited to 'app/src/main/java')
3 files changed, 24 insertions, 3 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/AudioplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/AudioplayerActivity.java index 3d2b3709c..5a667cdd7 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/AudioplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/AudioplayerActivity.java @@ -83,7 +83,8 @@ public class AudioplayerActivity extends MediaplayerActivity implements NavDrawe SubscriptionFragment.TAG, DownloadsFragment.TAG, PlaybackHistoryFragment.TAG, - AddFeedFragment.TAG + AddFeedFragment.TAG, + NavListAdapter.SUBSCRIPTION_LIST_TAG }; private AtomicBoolean isSetup = new AtomicBoolean(false); diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java index fbbc87508..76565e400 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java @@ -96,7 +96,8 @@ public class MainActivity extends AppCompatActivity implements NavDrawerActivity SubscriptionFragment.TAG, DownloadsFragment.TAG, PlaybackHistoryFragment.TAG, - AddFeedFragment.TAG + AddFeedFragment.TAG, + NavListAdapter.SUBSCRIPTION_LIST_TAG }; private Toolbar toolbar; diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java index 0227aeee4..b0b962dc8 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java @@ -50,11 +50,18 @@ public class NavListAdapter extends BaseAdapter public static final int VIEW_TYPE_SECTION_DIVIDER = 1; public static final int VIEW_TYPE_SUBSCRIPTION = 2; + /** + * a tag used as a placeholder to indicate if the subscription list should be displayed or not + * This tag doesn't correspond to any specific activity. + */ + public static final String SUBSCRIPTION_LIST_TAG = "SubscriptionList"; + private static List<String> tags; private static String[] titles; private ItemAccess itemAccess; private Context context; + private boolean showSubscriptionList = true; public NavListAdapter(ItemAccess itemAccess, Context context) { this.itemAccess = itemAccess; @@ -79,6 +86,18 @@ public class NavListAdapter extends BaseAdapter for(String hidden : hiddenFragments) { newTags.remove(hidden); } + + if (newTags.contains(SUBSCRIPTION_LIST_TAG)) { + // we never want SUBSCRIPTION_LIST_TAG to be in 'tags' + // since it doesn't actually correspond to a position in the list, but is + // a placeholder that indicates if we should show the subscription list in the + // nav drawer at all. + showSubscriptionList = true; + newTags.remove(SUBSCRIPTION_LIST_TAG); + } else { + showSubscriptionList = false; + } + tags = newTags; notifyDataSetChanged(); } @@ -132,7 +151,7 @@ public class NavListAdapter extends BaseAdapter @Override public int getCount() { int baseCount = getSubscriptionOffset(); - if (UserPreferences.showSubscriptionsInDrawer()) { + if (showSubscriptionList) { baseCount += itemAccess.getCount(); } return baseCount; |