[Android] Do not use xml 'onClick' shortcuts

Geoffrey Métais git at videolan.org
Fri Apr 1 12:04:09 CEST 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Apr  1 09:18:30 2016 +0200| [8f21593f6f185dec652282c2796aa6bf32937504] | committer: Geoffrey Métais

Do not use xml 'onClick' shortcuts

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

 vlc-android/res/layout/player_hud.xml                         |  2 --
 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java   | 11 +++++++++--
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/vlc-android/res/layout/player_hud.xml b/vlc-android/res/layout/player_hud.xml
index 179802a..a86a8e8 100644
--- a/vlc-android/res/layout/player_hud.xml
+++ b/vlc-android/res/layout/player_hud.xml
@@ -79,7 +79,6 @@
             android:layout_height="match_parent"
             android:layout_weight="1"
             android:clickable="true"
-            android:onClick="onAudioSubClick"
             android:src="@drawable/ic_audiosub_circle"
             android:scaleType="center"
             android:focusable="true"/>
@@ -124,7 +123,6 @@
             android:layout_height="match_parent"
             android:layout_weight="1"
             android:clickable="true"
-            android:onClick="showAdvancedOptions"
             android:src="@drawable/ic_more_circle"
             android:scaleType="center"
             android:focusable="true"/>
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index fce45ad..690556f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -407,7 +407,9 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         mPlayPause = (ImageView) findViewById(R.id.player_overlay_play);
 
         mTracks = (ImageView) findViewById(R.id.player_overlay_tracks);
+        mTracks.setOnClickListener(this);
         mAdvOptions = (ImageView) findViewById(R.id.player_overlay_adv_function);
+        mAdvOptions.setOnClickListener(this);
         mLock = (ImageView) findViewById(R.id.lock_overlay_button);
 
         mSize = (ImageView) findViewById(R.id.player_overlay_size);
@@ -1132,7 +1134,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         case KeyEvent.KEYCODE_O:
         case KeyEvent.KEYCODE_BUTTON_Y:
         case KeyEvent.KEYCODE_MENU:
-            showAdvancedOptions(mAdvOptions);
+            showAdvancedOptions();
             return true;
         case KeyEvent.KEYCODE_V:
         case KeyEvent.KEYCODE_MEDIA_AUDIO_TRACK:
@@ -2202,6 +2204,11 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
                 else if (mPlaybackSetting == DelayState.SPEED)
                     changeSpeed(0.05f);
                 break;
+            case R.id.player_overlay_adv_function:
+                showAdvancedOptions();
+                break;
+            case R.id.player_overlay_tracks:
+                onAudioSubClick(v);
         }
     }
 
@@ -2995,7 +3002,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         mAlertDialog.show();
     }
 
-    public void showAdvancedOptions(View v) {
+    public void showAdvancedOptions() {
         FragmentManager fm = getSupportFragmentManager();
         AdvOptionsDialog advOptionsDialog = new AdvOptionsDialog();
         advOptionsDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {



More information about the Android mailing list