[Android] TV: Fix selection display in adv playback options

Geoffrey Métais git at videolan.org
Thu Jan 28 11:33:38 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jan 28 11:32:27 2016 +0100| [a9c13bbfeecbf58b7f65001007f08a1b818ae64a] | committer: Geoffrey Métais

TV: Fix selection display in adv playback options

> https://code.videolan.org/videolan/vlc-android/commit/a9c13bbfeecbf58b7f65001007f08a1b818ae64a
---

 .../org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java   | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java b/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
index ef363fb..6b73db1 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
@@ -502,7 +502,7 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
     @Override
     public boolean onKey(DialogInterface dialogInterface, int keyCode, KeyEvent keyEvent) {
         if (keyEvent.getAction() != KeyEvent.ACTION_DOWN)
-            return true;
+            return false;
         if (mAdapter.getSelection() == -1)
             mAdapter.setSelection(0);
         switch (keyCode) {
@@ -512,18 +512,18 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
             case KeyEvent.KEYCODE_DPAD_UP:
             case KeyEvent.KEYCODE_DPAD_LEFT:
                 mAdapter.setSelection(mAdapter.getSelection() - 1);
-                break;
+                return true;
             case KeyEvent.KEYCODE_DPAD_DOWN:
             case KeyEvent.KEYCODE_DPAD_RIGHT:
                 mAdapter.setSelection(mAdapter.getSelection() + 1);
-                break;
+                return true;
             case KeyEvent.KEYCODE_ENTER:
             case KeyEvent.KEYCODE_DPAD_CENTER:
             case KeyEvent.KEYCODE_BUTTON_A:
                 onClick(mRecyclerView.getChildAt(mAdapter.getSelection()));
-                break;
+                return true;
         }
-        return true;
+        return false;
     }
 
     private class AdvOptionsAdapter extends RecyclerView.Adapter<AdvOptionsAdapter.ViewHolder> {
@@ -551,6 +551,8 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
         public void onBindViewHolder(ViewHolder holder, int position) {
             Option option = mList.get(position);
             TextView tv = (TextView) holder.itemView;
+            if (mSelection == position)
+                tv.requestFocus();
             tv.setId(option.id);
             int icon = UiTools.getResourceFromAttribute(mActivity, option.icon);
             if (option.id == ID_CHAPTER_TITLE)
@@ -559,7 +561,6 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
                 tv.setCompoundDrawablesWithIntrinsicBounds(0, icon, 0, 0);
             tv.setText(option.text);
             setViewReference(option.id, tv);
-            //TODO tv.setSelected(mSelection == position);
         }
 
         @Override
@@ -582,8 +583,7 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
                 return;
             int formerSelection = mSelection;
             mSelection = position;
-            notifyItemChanged(formerSelection);
-            notifyItemChanged(mSelection);
+            notifyDataSetChanged();
         }
 
         public int getSelection() {



More information about the Android mailing list