[Android] Set correct images for disabled buttons

Alexandre Perraud git at videolan.org
Thu Oct 22 17:06:49 CEST 2015


vlc-ports/android | branch: master | Alexandre Perraud <4leyx4ndre at gmail.com> | Thu Oct 22 17:03:39 2015 +0200| [dc2f1b0913970e857fde465d1c52838fdb807c12] | committer: Alexandre Perraud

Set correct images for disabled buttons

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=dc2f1b0913970e857fde465d1c52838fdb807c12
---

 .../videolan/vlc/gui/dialogs/AdvOptionsDialog.java  |   10 ++++++++++
 .../videolan/vlc/gui/video/VideoPlayerActivity.java |   19 +++++++++++++++----
 2 files changed, 25 insertions(+), 4 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 033b6f5..be3f0d4 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
@@ -358,7 +358,17 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
         initSleep();
         initPlaybackSpeed();
         mPlaybackSpeed.setEnabled(mService.isSeekable());
+        mPlaybackSpeed.setCompoundDrawablesWithIntrinsicBounds(0,
+                mService.isSeekable()
+                        ? Util.getResourceFromAttribute(mActivity, R.attr.ic_speed_normal_style)
+                        : R.drawable.ic_speed_disable,
+                0, 0);
         mJumpTitle.setEnabled(mService.isSeekable());
+        mJumpTitle.setCompoundDrawablesWithIntrinsicBounds(0,
+                mService.isSeekable()
+                        ? Util.getResourceFromAttribute(mActivity, R.attr.ic_jumpto_normal_style)
+                        : R.drawable.ic_jumpto_disable,
+                0, 0);
 
         if (mMode == MODE_VIDEO) {
             // Init Chapter
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 9786c33..4256f46 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -2110,15 +2110,25 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
     };
 
     private void updateSeekable(boolean seekable) {
-        if (mRewind != null)
+        if (mRewind != null) {
             mRewind.setEnabled(seekable);
-        if (mForward != null)
+            mRewind.setImageResource(seekable
+                    ? R.drawable.ic_rewind_circle
+                    : R.drawable.ic_rewind_circle_disable_o);
+        }
+        if (mForward != null){
             mForward.setEnabled(seekable);
+            mForward.setImageResource(seekable
+                    ? R.drawable.ic_forward_circle
+                    : R.drawable.ic_forward_circle_disable_o);
+        }
         mSeekbar.setEnabled(seekable);
     }
 
     private void updatePausable(boolean pausable) {
         mPlayPause.setEnabled(pausable);
+        if (!pausable)
+            mPlayPause.setImageResource(R.drawable.ic_play_circle_disable_o);
         mDetector.setOnDoubleTapListener(pausable ? this : null);
     }
 
@@ -2426,8 +2436,9 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
     private void updateOverlayPausePlay() {
         if (mService == null)
             return;
-        mPlayPause.setImageResource(mService.isPlaying() ? R.drawable.ic_pause_circle
-                : R.drawable.ic_play_circle);
+        if (mService.isPausable())
+            mPlayPause.setImageResource(mService.isPlaying() ? R.drawable.ic_pause_circle
+                    : R.drawable.ic_play_circle);
     }
 
     /**



More information about the Android mailing list