diff options
author | Martin Fietz <Martin.Fietz@gmail.com> | 2016-04-06 11:11:51 +0200 |
---|---|---|
committer | Martin Fietz <Martin.Fietz@gmail.com> | 2016-04-06 11:11:51 +0200 |
commit | 09d22b8ede9e81f5cf3bd549b1a9d8f01ffbb38e (patch) | |
tree | 1bd31bad9e86014738bb65151fee9147617ce78c /app/src/main/java | |
parent | ab88df91bac8e58343933aba50fcad545a60d096 (diff) | |
download | AntennaPod-09d22b8ede9e81f5cf3bd549b1a9d8f01ffbb38e.zip |
Add subscription counter
Diffstat (limited to 'app/src/main/java')
3 files changed, 34 insertions, 1 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 5a667cdd7..4733c2558 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/AudioplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/AudioplayerActivity.java @@ -537,6 +537,18 @@ public class AudioplayerActivity extends MediaplayerActivity implements NavDrawe public int getFeedCounter(long feedId) { return navDrawerData != null ? navDrawerData.feedCounters.get(feedId) : 0; } + + @Override + public int getFeedCounterSum() { + if(navDrawerData == null) { + return 0; + } + int sum = 0; + for(int counter : navDrawerData.feedCounters.values()) { + sum += counter; + } + return sum; + } }; public interface AudioplayerContentFragment { 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 76565e400..d713ef80c 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java @@ -654,6 +654,18 @@ public class MainActivity extends AppCompatActivity implements NavDrawerActivity return navDrawerData != null ? navDrawerData.feedCounters.get(feedId) : 0; } + @Override + public int getFeedCounterSum() { + if(navDrawerData == null) { + return 0; + } + int sum = 0; + for(int counter : navDrawerData.feedCounters.values()) { + sum += counter; + } + return sum; + } + }; private void loadData() { 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 b0b962dc8..75c858ec6 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java @@ -19,7 +19,6 @@ import com.bumptech.glide.Glide; import com.joanzapata.iconify.Iconify; import com.joanzapata.iconify.widget.IconTextView; -import de.danoeh.antennapod.fragment.SubscriptionFragment; import org.apache.commons.lang3.ArrayUtils; import java.util.ArrayList; @@ -39,6 +38,7 @@ import de.danoeh.antennapod.fragment.EpisodesFragment; import de.danoeh.antennapod.fragment.NewEpisodesFragment; import de.danoeh.antennapod.fragment.PlaybackHistoryFragment; import de.danoeh.antennapod.fragment.QueueFragment; +import de.danoeh.antennapod.fragment.SubscriptionFragment; /** * BaseAdapter for the navigation drawer @@ -253,6 +253,14 @@ public class NavListAdapter extends BaseAdapter } else { holder.count.setVisibility(View.GONE); } + } else if (tag.equals(SubscriptionFragment.TAG)) { + int sum = itemAccess.getFeedCounterSum(); + if (sum > 0) { + holder.count.setVisibility(View.VISIBLE); + holder.count.setText(String.valueOf(sum)); + } else { + holder.count.setVisibility(View.GONE); + } } else if(tag.equals(DownloadsFragment.TAG) && UserPreferences.isEnableAutodownload()) { int epCacheSize = UserPreferences.getEpisodeCacheSize(); // don't count episodes that can be reclaimed @@ -372,6 +380,7 @@ public class NavListAdapter extends BaseAdapter int getNumberOfDownloadedItems(); int getReclaimableItems(); int getFeedCounter(long feedId); + int getFeedCounterSum(); } } |