[Android] Add "mark video as seen" feature for TV
Alexandre Perraud
git at videolan.org
Wed Jul 12 11:54:55 CEST 2017
vlc-android | branch: master | Alexandre Perraud <4leyx4ndre at gmail.com> | Tue Jul 11 18:35:18 2017 +0200| [cfabd1c9e02eedf8134fe7e2da02f2a8de5c662f] | committer: Alexandre Perraud
Add "mark video as seen" feature for TV
> https://code.videolan.org/videolan/vlc-android/commit/cfabd1c9e02eedf8134fe7e2da02f2a8de5c662f
---
vlc-android/src/org/videolan/vlc/gui/tv/CardPresenter.java | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/CardPresenter.java b/vlc-android/src/org/videolan/vlc/gui/tv/CardPresenter.java
index 7eea24108..cb470521e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/CardPresenter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/CardPresenter.java
@@ -31,6 +31,7 @@ import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
+import android.preference.PreferenceManager;
import android.support.v17.leanback.widget.ImageCardView;
import android.support.v17.leanback.widget.Presenter;
import android.support.v4.content.ContextCompat;
@@ -59,10 +60,13 @@ public class CardPresenter extends Presenter {
private static Drawable sDefaultCardImage;
private static Handler sHandler = new Handler(Looper.getMainLooper());
+ private boolean mIsSeenMediaMarkerVisible = true;
+
public CardPresenter(Activity context){
mContext = context;
mRes = mContext.getResources();
sDefaultCardImage = ContextCompat.getDrawable(mContext, R.drawable.ic_default_cone);
+ mIsSeenMediaMarkerVisible = PreferenceManager.getDefaultSharedPreferences(VLCApplication.getAppContext()).getBoolean("media_seen", true);
}
@@ -108,8 +112,13 @@ public class CardPresenter extends Presenter {
holder.mCardView.setContentText(mediaWrapper.getDescription());
if (mediaWrapper.getType() == MediaWrapper.TYPE_GROUP)
holder.updateCardViewImage(ContextCompat.getDrawable(mContext, R.drawable.ic_video_collection_big));
- else
+ else {
holder.updateCardViewImage(mediaWrapper);
+ if (mIsSeenMediaMarkerVisible
+ && mediaWrapper.getType() == MediaWrapper.TYPE_VIDEO
+ && mediaWrapper.getSeen() > 0L)
+ holder.mCardView.setBadgeImage(ContextCompat.getDrawable(mContext, R.drawable.ic_seen_tv_normal));
+ }
holder.view.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
More information about the Android
mailing list