<div dir="ltr">Hi,<div><br></div><div>First, you can fix lua build:</div><div>git pull --rebase in vlc/directory then ./bootstrap</div><div><br></div><div>About your patch:</div><div>there is no need to handle key events, this is ok. The only thing we have to do is to change the color of the focused item.</div><div><br></div><div>Selected background color should be Orange800.</div><div>So I recommend you to use</div><div>ContextCompat.getColor(VLCApplication.getAppContext(), R.color.orange800);<br></div><div>and</div><div>ContextCompat.getColor(VLCApplication.getAppContext(), R.color.transparent);<br></div><div>to get them.</div><div><br></div><div>You can set a OnFocusChangelistener to the itemView to update its background color.</div><div><br><div class="gmail_quote"><div dir="ltr">On Fri, Apr 22, 2016 at 9:24 AM Chegou Junior KEITA <<a href="mailto:chegoujk@gmail.com">chegoujk@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: KEITA chegou junior <<a href="mailto:keita@informatique.univ-paris-diderot.fr" target="_blank">keita@informatique.univ-paris-diderot.fr</a>><br>
<br>
---<br>
 compile-libvlc.sh                                  |  4 +-<br>
 .../videolan/vlc/gui/video/VideoGridFragment.java  |  1 +<br>
 .../videolan/vlc/gui/video/VideoListAdapter.java   | 47 ++++++++++++++++++++++<br>
 3 files changed, 50 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/compile-libvlc.sh b/compile-libvlc.sh<br>
index c32e086..417b516 100755<br>
--- a/compile-libvlc.sh<br>
+++ b/compile-libvlc.sh<br>
@@ -70,7 +70,7 @@ VLC_BOOTSTRAP_ARGS="\<br>
     --disable-dca \<br>
     --disable-goom \<br>
     --disable-chromaprint \<br>
-    --enable-lua \<br>
+    --disable-lua \<br>
     --disable-schroedinger \<br>
     --disable-sdl \<br>
     --disable-SDL_image \<br>
@@ -119,7 +119,7 @@ VLC_CONFIGURE_ARGS="\<br>
     --disable-update-check \<br>
     --disable-vlm \<br>
     --disable-dbus \<br>
-    --enable-lua \<br>
+    --disable-lua \<br>
     --disable-vcd \<br>
     --disable-v4l2 \<br>
     --disable-gnomevfs \<br>
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java<br>
index 9cf6b83..5b66f0c 100644<br>
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java<br>
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java<br>
@@ -37,6 +37,7 @@ import android.support.v7.widget.RecyclerView;<br>
 import android.util.DisplayMetrics;<br>
 import android.util.Log;<br>
 import android.view.ContextMenu;<br>
+import android.view.KeyEvent;<br>
 import android.view.LayoutInflater;<br>
 import android.view.Menu;<br>
 import android.view.MenuInflater;<br>
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java<br>
index 4fe2880..bf534a7 100644<br>
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java<br>
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java<br>
@@ -24,11 +24,13 @@ import android.content.Context;<br>
 import android.databinding.DataBindingUtil;<br>
 import android.databinding.ViewDataBinding;<br>
 import android.graphics.Bitmap;<br>
+import android.graphics.Color;<br>
 import android.graphics.drawable.BitmapDrawable;<br>
 import android.support.annotation.MainThread;<br>
 import android.support.annotation.Nullable;<br>
 import android.support.v4.util.ArrayMap;<br>
 import android.support.v7.widget.RecyclerView;<br>
+import android.view.KeyEvent;<br>
 import android.view.LayoutInflater;<br>
 import android.view.View;<br>
 import android.view.ViewGroup;<br>
@@ -63,6 +65,8 @@ public class VideoListAdapter extends RecyclerView.Adapter<VideoListAdapter.View<br>
     public final static int TYPE_LIST = 0;<br>
     public final static int TYPE_GRID = 1;<br>
<br>
+    private int mCurrentItem = 0;<br>
+<br>
     public final static int SORT_BY_DATE = 2;<br>
     private int mSortDirection = 1;<br>
     private int mSortBy = SORT_BY_TITLE;<br>
@@ -90,6 +94,11 @@ public class VideoListAdapter extends RecyclerView.Adapter<VideoListAdapter.View<br>
         MediaWrapper media = mVideos.get(position);<br>
         boolean asyncLoad = true;<br>
<br>
+        if (mCurrentItem == position)<br>
+            holder.itemView.setBackgroundColor(Color.GRAY);<br>
+        else<br>
+            holder.itemView.setBackgroundColor(Color.TRANSPARENT);<br>
+<br>
         holder.binding.setVariable(BR.scaleType, ImageView.ScaleType.CENTER);<br>
         final Bitmap bitmap = BitmapUtil.getPictureFromCache(media);<br>
         if (bitmap != null) {<br>
@@ -111,6 +120,43 @@ public class VideoListAdapter extends RecyclerView.Adapter<VideoListAdapter.View<br>
             AsyncImageLoader.LoadImage(new VideoCoverFetcher(holder.binding, media), null);<br>
     }<br>
<br>
+    @Override<br>
+    public void onAttachedToRecyclerView(final RecyclerView recyclerView) {<br>
+        super.onAttachedToRecyclerView(recyclerView);<br>
+<br>
+        recyclerView.setOnKeyListener(new View.OnKeyListener() {<br>
+            @Override<br>
+            public boolean onKey(View v, int keyCode, KeyEvent event) {<br>
+                RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();<br>
+<br>
+                if (event.getAction() == KeyEvent.ACTION_DOWN) {<br>
+                    if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN || keyCode == KeyEvent.KEYCODE_DPAD_RIGHT)<br>
+                        return onItemSelection(layoutManager, 1);<br>
+                    else if (keyCode == KeyEvent.KEYCODE_DPAD_UP || keyCode == KeyEvent.KEYCODE_DPAD_LEFT)<br>
+                        return onItemSelection(layoutManager, -1);<br>
+                    else if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {<br>
+                        MediaWrapper media = mVideos.get(mCurrentItem);<br>
+                        VideoPlayerActivity.start(v.getContext(), media.getUri(), media.getTitle());<br>
+                        return true;<br>
+                    }<br>
+                }<br>
+                return false;<br>
+            }<br>
+        });<br>
+    }<br>
+<br>
+    private boolean onItemSelection(RecyclerView.LayoutManager layoutManager, int direction) {<br>
+        int nextItem = mCurrentItem + direction;<br>
+<br>
+        if (nextItem >= 0 && nextItem < getItemCount()) {<br>
+            notifyItemChanged(mCurrentItem);<br>
+            mCurrentItem = nextItem;<br>
+            notifyItemChanged(mCurrentItem);<br>
+            return true;<br>
+        }<br>
+        return false;<br>
+    }<br>
+<br>
     @MainThread<br>
     public void setTimes(ArrayMap<String, Long> times) {<br>
         boolean notify = false;<br>
@@ -353,6 +399,7 @@ public class VideoListAdapter extends RecyclerView.Adapter<VideoListAdapter.View<br>
         }<br>
<br>
         public void onClick(View v){<br>
+            mCurrentItem = getAdapterPosition();<br>
             MediaWrapper media = mVideos.get(getAdapterPosition());<br>
             if (media instanceof MediaGroup) {<br>
                 MainActivity activity = (MainActivity) mFragment.getActivity();<br>
--<br>
1.9.1<br>
<br>
_______________________________________________<br>
Android mailing list<br>
<a href="mailto:Android@videolan.org" target="_blank">Android@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/android" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/android</a><br>
</blockquote></div></div></div>