[Android] [PATCH] focus on item in main video screen
Geoffrey Métais
geoffrey.metais at gmail.com
Wed Apr 27 16:44:47 CEST 2016
No, but now it's done :)
I'm sorry I missed your mail.
I edited your patch, you forgot the itemView.setOnFocusChangeListener(this);
But now it's on master.
On Tue, Apr 26, 2016 at 3:47 PM Chegou Junior KEITA <chegoujk at gmail.com>
wrote:
> ---
> vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java | 4 ++++
> .../src/org/videolan/vlc/gui/video/VideoListAdapter.java | 11
> ++++++++++-
> 2 files changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java
> b/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java
> index 6c59146..52e2aa2 100644
> --- a/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java
> +++ b/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java
> @@ -34,6 +34,7 @@ import android.preference.PreferenceManager;
> import android.support.annotation.NonNull;
> import android.support.annotation.Nullable;
> import android.support.design.widget.Snackbar;
> +import android.support.v4.content.ContextCompat;
> import android.text.Html;
> import android.text.TextUtils;
> import android.util.DisplayMetrics;
> @@ -55,6 +56,9 @@ import java.util.concurrent.atomic.AtomicInteger;
>
> public class UiTools {
>
> + public static final int ITEM_FOCUS_ON =
> ContextCompat.getColor(VLCApplication.getAppContext(), R.color.orange800);
> + public static final int ITEM_FOCUS_OFF =
> ContextCompat.getColor(VLCApplication.getAppContext(), R.color.transparent);
> +
> private static final AtomicInteger sNextGeneratedId = new
> AtomicInteger(1);
>
> private static final Handler sHandler = new
> Handler(Looper.getMainLooper());
> diff --git
> a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
> b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
> index 4fe2880..029f098 100644
> --- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
> +++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
> @@ -42,6 +42,7 @@ import org.videolan.vlc.gui.SecondaryActivity;
> import org.videolan.vlc.gui.helpers.AsyncImageLoader;
> import org.videolan.vlc.gui.helpers.BitmapCache;
> import org.videolan.vlc.gui.helpers.BitmapUtil;
> +import org.videolan.vlc.gui.helpers.UiTools;
> import org.videolan.vlc.media.MediaGroup;
> import org.videolan.vlc.media.MediaWrapper;
> import org.videolan.vlc.util.Strings;
> @@ -340,7 +341,7 @@ public class VideoListAdapter extends
> RecyclerView.Adapter<VideoListAdapter.View
> return super.getItemViewType(position);
> }
>
> - public class ViewHolder extends RecyclerView.ViewHolder implements
> View.OnLongClickListener {
> + public class ViewHolder extends RecyclerView.ViewHolder implements
> View.OnLongClickListener, View.OnFocusChangeListener {
> boolean listmode;
> ViewDataBinding binding;
>
> @@ -376,5 +377,13 @@ public class VideoListAdapter extends
> RecyclerView.Adapter<VideoListAdapter.View
> mFragment.mGridView.openContextMenu(getLayoutPosition());
> return true;
> }
> +
> + @Override
> + public void onFocusChange(View v, boolean hasFocus) {
> + if (hasFocus)
> + itemView.setBackgroundColor(UiTools.ITEM_FOCUS_ON);
> + else
> + itemView.setBackgroundColor(UiTools.ITEM_FOCUS_OFF);
> + }
> }
> }
> --
> 1.9.1
>
> _______________________________________________
> Android mailing list
> Android at videolan.org
> https://mailman.videolan.org/listinfo/android
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/android/attachments/20160427/31cb34e0/attachment-0001.html>
More information about the Android
mailing list