[Android] DPAD navigation : Show Advanced Option help when focus

Alexandre Perraud git at videolan.org
Thu Jun 9 23:50:58 CEST 2016


vlc-android | branch: 2.0.x | Alexandre Perraud <4leyx4ndre at gmail.com> | Thu Jun  2 18:42:22 2016 +0200| [d7152d1f446dac8c7ca2a99e4f726fc733894c61] | committer: Jean-Baptiste Kempf

DPAD navigation : Show Advanced Option help when focus

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

 .../src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java    | 11 +++++++++++
 1 file changed, 11 insertions(+)

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 66b509b..a719d17 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
@@ -117,6 +117,8 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
 
     private IPlaybackSettingsController mPlaybackController;
 
+    private Toast mToast;
+
     public AdvOptionsDialog() {}
 
     @Override
@@ -170,6 +172,9 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
         mAdapter = new AdvOptionsAdapter();
         mRecyclerView.setAdapter(mAdapter);
 
+        mToast = Toast.makeText(VLCApplication.getAppContext(), "", Toast.LENGTH_SHORT);
+        mToast.setGravity(Gravity.TOP,0,100);
+
         //Get default color
         int[] attrs = new int[] { android.R.attr.textColorSecondary };
         TypedArray a = getActivity().getTheme().obtainStyledAttributes(R.style.Theme_VLC, attrs);
@@ -504,6 +509,8 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
         if (v instanceof TextView)
             ((TextView) v).setTextColor(v.hasFocus() ?
                     FOCUSED_TEXT_COLOR : mTextColor);
+        mToast.setText(mAdapter.getSelectedAdvOptionHelp());
+        mToast.show();
     }
 
 
@@ -666,6 +673,10 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
             notifyItemInserted(mList.size()-1);
         }
 
+        public String getSelectedAdvOptionHelp () {
+            return mList.get(getSelection()).text;
+        }
+
         public void setSelection(int position) {
             if (mSelection == position || position < 0 || position >= mList.size())
                 return;



More information about the Android mailing list