Indicate that episode cache is exhausted

This commit is contained in:
Martin Fietz 2016-01-06 20:15:07 +01:00
parent 95bb95fc89
commit e5b7f12732
6 changed files with 30 additions and 6 deletions

View File

@ -31,8 +31,8 @@ dependencies {
compile "io.reactivex:rxjava:$rxJavaVersion" compile "io.reactivex:rxjava:$rxJavaVersion"
// And ProGuard rules for RxJava! // And ProGuard rules for RxJava!
compile "com.artemzin.rxjava:proguard-rules:$rxJavaRulesVersion" compile "com.artemzin.rxjava:proguard-rules:$rxJavaRulesVersion"
compile "com.joanzapata.iconify:android-iconify-fontawesome:$iconifyFontawesomeVersion" compile "com.joanzapata.iconify:android-iconify-fontawesome:$iconifyVersion"
compile "com.joanzapata.iconify:android-iconify-material:$iconifyFontawesomeVersion" compile "com.joanzapata.iconify:android-iconify-material:$iconifyVersion"
compile("com.github.afollestad.material-dialogs:commons:$materialDialogsVersion") { compile("com.github.afollestad.material-dialogs:commons:$materialDialogsVersion") {
transitive = true transitive = true
} }

View File

@ -841,6 +841,11 @@ public class AudioplayerActivity extends MediaplayerActivity implements ItemDesc
return (navDrawerData != null) ? navDrawerData.numNewItems : 0; return (navDrawerData != null) ? navDrawerData.numNewItems : 0;
} }
@Override
public int getNumberOfDownloadedItems() {
return (navDrawerData != null) ? navDrawerData.numDownloadedItems : 0;
}
@Override @Override
public int getFeedCounter(long feedId) { public int getFeedCounter(long feedId) {
return navDrawerData != null ? navDrawerData.feedCounters.get(feedId) : 0; return navDrawerData != null ? navDrawerData.feedCounters.get(feedId) : 0;

View File

@ -635,6 +635,11 @@ public class MainActivity extends AppCompatActivity implements NavDrawerActivity
return (navDrawerData != null) ? navDrawerData.numNewItems : 0; return (navDrawerData != null) ? navDrawerData.numNewItems : 0;
} }
@Override
public int getNumberOfDownloadedItems() {
return (navDrawerData != null) ? navDrawerData.numDownloadedItems : 0;
}
@Override @Override
public int getFeedCounter(long feedId) { public int getFeedCounter(long feedId) {
return navDrawerData != null ? navDrawerData.feedCounters.get(feedId) : 0; return navDrawerData != null ? navDrawerData.feedCounters.get(feedId) : 0;

View File

@ -15,7 +15,7 @@ import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.joanzapata.iconify.Iconify;
import com.joanzapata.iconify.widget.IconTextView; import com.joanzapata.iconify.widget.IconTextView;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
@ -208,7 +208,8 @@ public class NavListAdapter extends BaseAdapter
holder.title.setText(title); 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(); int queueSize = itemAccess.getQueueSize();
if (queueSize > 0) { if (queueSize > 0) {
holder.count.setVisibility(View.VISIBLE); holder.count.setVisibility(View.VISIBLE);
@ -216,7 +217,7 @@ public class NavListAdapter extends BaseAdapter
} else { } else {
holder.count.setVisibility(View.GONE); holder.count.setVisibility(View.GONE);
} }
} else if (tags.get(position).equals(EpisodesFragment.TAG)) { } else if (tag.equals(EpisodesFragment.TAG)) {
int unreadItems = itemAccess.getNumberOfNewItems(); int unreadItems = itemAccess.getNumberOfNewItems();
if (unreadItems > 0) { if (unreadItems > 0) {
holder.count.setVisibility(View.VISIBLE); holder.count.setVisibility(View.VISIBLE);
@ -224,6 +225,15 @@ public class NavListAdapter extends BaseAdapter
} else { } else {
holder.count.setVisibility(View.GONE); 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);
} else {
holder.count.setVisibility(View.GONE);
}
} else { } else {
holder.count.setVisibility(View.GONE); holder.count.setVisibility(View.GONE);
} }
@ -316,6 +326,7 @@ public class NavListAdapter extends BaseAdapter
int getSelectedItemIndex(); int getSelectedItemIndex();
int getQueueSize(); int getQueueSize();
int getNumberOfNewItems(); int getNumberOfNewItems();
int getNumberOfDownloadedItems();
int getFeedCounter(long feedId); int getFeedCounter(long feedId);
} }

View File

@ -47,8 +47,8 @@ project.ext {
eventbusVersion = "2.4.0" eventbusVersion = "2.4.0"
flattr4jVersion = "2.12" flattr4jVersion = "2.12"
glideVersion = "3.6.1" glideVersion = "3.6.1"
iconifyVersion = "2.1.1"
jsoupVersion = "1.7.3" jsoupVersion = "1.7.3"
iconifyFontawesomeVersion = "2.1.1"
materialDialogsVersion = "0.8.5.3@aar" materialDialogsVersion = "0.8.5.3@aar"
recyclerviewFlexibledividerVersion = "1.2.6" recyclerviewFlexibledividerVersion = "1.2.6"
rxAndroidVersion = "1.1.0" rxAndroidVersion = "1.1.0"

View File

@ -1015,6 +1015,8 @@ public final class DBReader {
Collections.sort(feeds, comparator); Collections.sort(feeds, comparator);
int queueSize = adapter.getQueueSize(); int queueSize = adapter.getQueueSize();
int numNewItems = adapter.getNumberOfNewItems(); int numNewItems = adapter.getNumberOfNewItems();
int numDownloadedItems = adapter.getNumberOfDownloadedEpisodes();
NavDrawerData result = new NavDrawerData(feeds, queueSize, numNewItems, feedCounters); NavDrawerData result = new NavDrawerData(feeds, queueSize, numNewItems, feedCounters);
adapter.close(); adapter.close();
return result; return result;
@ -1024,6 +1026,7 @@ public final class DBReader {
public List<Feed> feeds; public List<Feed> feeds;
public int queueSize; public int queueSize;
public int numNewItems; public int numNewItems;
public int numDownloadedItems;
public LongIntMap feedCounters; public LongIntMap feedCounters;
public NavDrawerData(List<Feed> feeds, public NavDrawerData(List<Feed> feeds,