mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2025-01-31 10:54:50 +01:00
Merge pull request #1543 from mfietz/issue/1528-indicator-full-cache
Indicate that episode cache is exhausted
This commit is contained in:
commit
dfc421a5a6
@ -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
|
||||
}
|
||||
|
@ -841,6 +841,11 @@ public class AudioplayerActivity extends MediaplayerActivity implements ItemDesc
|
||||
return (navDrawerData != null) ? navDrawerData.numNewItems : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNumberOfDownloadedItems() {
|
||||
return (navDrawerData != null) ? navDrawerData.numDownloadedItems : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFeedCounter(long feedId) {
|
||||
return navDrawerData != null ? navDrawerData.feedCounters.get(feedId) : 0;
|
||||
|
@ -635,6 +635,11 @@ public class MainActivity extends AppCompatActivity implements NavDrawerActivity
|
||||
return (navDrawerData != null) ? navDrawerData.numNewItems : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNumberOfDownloadedItems() {
|
||||
return (navDrawerData != null) ? navDrawerData.numDownloadedItems : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFeedCounter(long feedId) {
|
||||
return navDrawerData != null ? navDrawerData.feedCounters.get(feedId) : 0;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user