[Android] Display volume/brightness levels in %

Geoffrey Métais git at videolan.org
Tue Apr 7 16:05:23 CEST 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Apr  7 15:33:55 2015 +0200| [1c0a2d3ae645c39947f8e4d18e3379548a759e6b] | committer: Geoffrey Métais

Display volume/brightness levels in %

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

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

diff --git a/vlc-android/res/layout/player.xml b/vlc-android/res/layout/player.xml
index fccd979..6e469c5 100644
--- a/vlc-android/res/layout/player.xml
+++ b/vlc-android/res/layout/player.xml
@@ -93,7 +93,7 @@
                 android:layout_margin="7dp"
                 android:background="@drawable/verticalbar_border"
                 android:orientation="vertical"
-                android:weightSum="15"
+                android:weightSum="100"
                 android:gravity="bottom">
 
                 <View android:id="@+id/verticalbar_progress"
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 f49ebb8..fba6b29 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -1867,7 +1867,8 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
             mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, vol, AudioManager.FLAG_SHOW_UI);
 
         mTouchAction = TOUCH_VOLUME;
-        showInfoWithVerticalBar(getString(R.string.volume) + '\u00A0' + Integer.toString(vol), 1000, vol);
+        vol = vol * 100 /15;
+        showInfoWithVerticalBar(getString(R.string.volume) + '\u00A0' + Integer.toString(vol) + '%', 1000, vol);
     }
 
     private void mute(boolean mute) {
@@ -1925,8 +1926,8 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
         lp.screenBrightness =  Math.min(Math.max(lp.screenBrightness + delta, 0.01f), 1);
         // Set Brightness
         getWindow().setAttributes(lp);
-        int brightness = Math.round(lp.screenBrightness * 15);
-        showInfoWithVerticalBar(getString(R.string.brightness) + '\u00A0' + brightness, 1000, brightness);
+        int brightness = Math.round(lp.screenBrightness * 100);
+        showInfoWithVerticalBar(getString(R.string.brightness) + '\u00A0' + brightness + '%', 1000, brightness);
     }
 
     /**



More information about the Android mailing list