summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hennen <TomHennen@users.noreply.github.com>2016-01-16 14:55:36 -0500
committerTom Hennen <TomHennen@users.noreply.github.com>2016-01-16 14:55:36 -0500
commitdfc421a5a6119cada45271e0fffeb513acb8a2ac (patch)
tree1b45eaf683997edcd1519f0c627ea62dea35424e
parenta0488ffe379c0ea43d4ea975563eddf3bd438ce3 (diff)
parentdc06b9c873a623a513e45a3e361eb607bb47354c (diff)
downloadAntennaPod-dfc421a5a6119cada45271e0fffeb513acb8a2ac.zip
Merge pull request #1543 from mfietz/issue/1528-indicator-full-cache
Indicate that episode cache is exhausted
-rw-r--r--app/build.gradle4
-rw-r--r--app/src/main/java/de/danoeh/antennapod/activity/AudioplayerActivity.java5
-rw-r--r--app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java5
-rw-r--r--app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java25
-rw-r--r--build.gradle2
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java7
-rw-r--r--core/src/main/res/values/strings.xml2
7 files changed, 43 insertions, 7 deletions
diff --git a/app/build.gradle b/app/build.gradle
index 2fe94d576..d957d9833 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -31,8 +31,8 @@ dependencies {
compile "io.reactivex:rxjava:$rxJavaVersion"
// And ProGuard rules for RxJava!
compile "com.artemzin.rxjava:proguard-rules:$rxJavaRulesVersion"
- compile "com.joanzapata.iconify:android-iconify-fontawesome:$iconifyFontawesomeVersion"
- compile "com.joanzapata.iconify:android-iconify-material:$iconifyFontawesomeVersion"
+ compile "com.joanzapata.iconify:android-iconify-fontawesome:$iconifyVersion"
+ compile "com.joanzapata.iconify:android-iconify-material:$iconifyVersion"
compile("com.github.afollestad.material-dialogs:commons:$materialDialogsVersion") {
transitive = true
}
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 442515010..835ac29cd 100644
--- a/app/src/main/java/de/danoeh/antennapod/activity/AudioplayerActivity.java
+++ b/app/src/main/java/de/danoeh/antennapod/activity/AudioplayerActivity.java
@@ -842,6 +842,11 @@ public class AudioplayerActivity extends MediaplayerActivity implements ItemDesc
}
@Override
+ public int getNumberOfDownloadedItems() {
+ return (navDrawerData != null) ? navDrawerData.numDownloadedItems : 0;
+ }
+
+ @Override
public int getFeedCounter(long feedId) {
return navDrawerData != null ? navDrawerData.feedCounters.get(feedId) : 0;
}
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 17cd5ace3..2181e7d2d 100644
--- a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java
+++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java
@@ -636,6 +636,11 @@ public class MainActivity extends AppCompatActivity implements NavDrawerActivity
}
@Override
+ public int getNumberOfDownloadedItems() {
+ return (navDrawerData != null) ? navDrawerData.numDownloadedItems : 0;
+ }
+
+ @Override
public int getFeedCounter(long feedId) {
return navDrawerData != null ? navDrawerData.feedCounters.get(feedId) : 0;
}
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 183c1a44e..d43e30d8f 100644
--- a/app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java
+++ b/app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java
@@ -6,6 +6,7 @@ import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.preference.PreferenceManager;
+import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -15,7 +16,7 @@ import android.widget.RelativeLayout;
import android.widget.TextView;
import com.bumptech.glide.Glide;
-import com.bumptech.glide.load.engine.DiskCacheStrategy;
+import com.joanzapata.iconify.Iconify;
import com.joanzapata.iconify.widget.IconTextView;
import org.apache.commons.lang3.ArrayUtils;
@@ -208,7 +209,8 @@ public class NavListAdapter extends BaseAdapter
holder.title.setText(title);
- if (tags.get(position).equals(QueueFragment.TAG)) {
+ String tag = tags.get(position);
+ if (tag.equals(QueueFragment.TAG)) {
int queueSize = itemAccess.getQueueSize();
if (queueSize > 0) {
holder.count.setVisibility(View.VISIBLE);
@@ -216,7 +218,7 @@ public class NavListAdapter extends BaseAdapter
} else {
holder.count.setVisibility(View.GONE);
}
- } else if (tags.get(position).equals(EpisodesFragment.TAG)) {
+ } else if (tag.equals(EpisodesFragment.TAG)) {
int unreadItems = itemAccess.getNumberOfNewItems();
if (unreadItems > 0) {
holder.count.setVisibility(View.VISIBLE);
@@ -224,6 +226,22 @@ public class NavListAdapter extends BaseAdapter
} else {
holder.count.setVisibility(View.GONE);
}
+ } else if(tag.equals(DownloadsFragment.TAG) && UserPreferences.isEnableAutodownload()) {
+ int epCacheSize = UserPreferences.getEpisodeCacheSize();
+ if(itemAccess.getNumberOfDownloadedItems() >= epCacheSize) {
+ holder.count.setText("{md-disc-full 150%}");
+ Iconify.addIcons(holder.count);
+ holder.count.setVisibility(View.VISIBLE);
+ holder.count.setOnClickListener(v -> {
+ new AlertDialog.Builder(context)
+ .setTitle(R.string.episode_cache_full_title)
+ .setMessage(R.string.episode_cache_full_message)
+ .setPositiveButton(android.R.string.ok, (dialog, which) -> {})
+ .show();
+ });
+ } else {
+ holder.count.setVisibility(View.GONE);
+ }
} else {
holder.count.setVisibility(View.GONE);
}
@@ -316,6 +334,7 @@ public class NavListAdapter extends BaseAdapter
int getSelectedItemIndex();
int getQueueSize();
int getNumberOfNewItems();
+ int getNumberOfDownloadedItems();
int getFeedCounter(long feedId);
}
diff --git a/build.gradle b/build.gradle
index 79cf2e3c5..aa2251121 100644
--- a/build.gradle
+++ b/build.gradle
@@ -47,8 +47,8 @@ project.ext {
eventbusVersion = "2.4.0"
flattr4jVersion = "2.12"
glideVersion = "3.6.1"
+ iconifyVersion = "2.1.1"
jsoupVersion = "1.7.3"
- iconifyFontawesomeVersion = "2.1.1"
materialDialogsVersion = "0.8.5.3@aar"
recyclerviewFlexibledividerVersion = "1.2.6"
rxAndroidVersion = "1.1.0"
diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java
index fe5b177ab..16e65f9f3 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java
@@ -1015,7 +1015,9 @@ public final class DBReader {
Collections.sort(feeds, comparator);
int queueSize = adapter.getQueueSize();
int numNewItems = adapter.getNumberOfNewItems();
- NavDrawerData result = new NavDrawerData(feeds, queueSize, numNewItems, feedCounters);
+ int numDownloadedItems = adapter.getNumberOfDownloadedEpisodes();
+
+ NavDrawerData result = new NavDrawerData(feeds, queueSize, numNewItems, numDownloadedItems, feedCounters);
adapter.close();
return result;
}
@@ -1024,15 +1026,18 @@ public final class DBReader {
public List<Feed> feeds;
public int queueSize;
public int numNewItems;
+ public int numDownloadedItems;
public LongIntMap feedCounters;
public NavDrawerData(List<Feed> feeds,
int queueSize,
int numNewItems,
+ int numDownloadedItems,
LongIntMap feedIndicatorValues) {
this.feeds = feeds;
this.queueSize = queueSize;
this.numNewItems = numNewItems;
+ this.numDownloadedItems = numDownloadedItems;
this.feedCounters = feedIndicatorValues;
}
}
diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml
index 0371d99bc..726697602 100644
--- a/core/src/main/res/values/strings.xml
+++ b/core/src/main/res/values/strings.xml
@@ -26,6 +26,8 @@
<string name="gpodnet_main_label">gpodder.net</string>
<string name="gpodnet_auth_label">gpodder.net Login</string>
<string name="free_space_label">%1$s free</string>
+ <string name="episode_cache_full_title">Episode cache full</string>
+ <string name="episode_cache_full_message">The episode cache limit has been reached. You can increase the cache size in the Settings.</string>
<!-- New episodes fragment -->
<string name="recently_published_episodes_label">Recently published</string>