diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2014-06-14 13:30:01 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2014-06-14 13:30:01 +0200 |
commit | 466dbbf1b036fbc2705d970d9c6a0c62283e73c8 (patch) | |
tree | 2f9aa50ca61be19d6f53c749e9ae74002a6a1e03 /src/de | |
parent | 25cc7dde50c1adfad29b0b2cd6daee2de88cc7b0 (diff) | |
download | AntennaPod-466dbbf1b036fbc2705d970d9c6a0c62283e73c8.zip |
Hide queue/unread count in navdrawer if it is 0
Diffstat (limited to 'src/de')
-rw-r--r-- | src/de/danoeh/antennapod/adapter/NavListAdapter.java | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/de/danoeh/antennapod/adapter/NavListAdapter.java b/src/de/danoeh/antennapod/adapter/NavListAdapter.java index 2e95a176b..536bf80e3 100644 --- a/src/de/danoeh/antennapod/adapter/NavListAdapter.java +++ b/src/de/danoeh/antennapod/adapter/NavListAdapter.java @@ -36,9 +36,9 @@ public class NavListAdapter extends BaseAdapter { this.itemAccess = itemAccess; this.context = context; - TypedArray ta = context.obtainStyledAttributes(new int[] {R.attr.ic_new, R.attr.stat_playlist, + TypedArray ta = context.obtainStyledAttributes(new int[]{R.attr.ic_new, R.attr.stat_playlist, R.attr.av_download, R.attr.device_access_time, R.attr.content_new}); - drawables = new Drawable[] {ta.getDrawable(0), ta.getDrawable(1), ta.getDrawable(2), + drawables = new Drawable[]{ta.getDrawable(0), ta.getDrawable(1), ta.getDrawable(2), ta.getDrawable(3), ta.getDrawable(4)}; ta.recycle(); } @@ -123,11 +123,21 @@ public class NavListAdapter extends BaseAdapter { holder.title.setText(title); if (NAV_TITLES[position] == R.string.queue_label) { - holder.count.setVisibility(View.VISIBLE); - holder.count.setText(String.valueOf(itemAccess.getQueueSize())); + int queueSize = itemAccess.getQueueSize(); + if (queueSize > 0) { + holder.count.setVisibility(View.VISIBLE); + holder.count.setText(String.valueOf(queueSize)); + } else { + holder.count.setVisibility(View.GONE); + } } else if (NAV_TITLES[position] == R.string.all_episodes_label) { - holder.count.setVisibility(View.VISIBLE); - holder.count.setText(String.valueOf(itemAccess.getNumberOfUnreadItems())); + int unreadItems = itemAccess.getNumberOfUnreadItems(); + if (unreadItems > 0) { + holder.count.setVisibility(View.VISIBLE); + holder.count.setText(String.valueOf(unreadItems)); + } else { + holder.count.setVisibility(View.GONE); + } } else { holder.count.setVisibility(View.GONE); } |