cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject android commit: CB-6153 Add a preference for controlling hardware button audio stream (DefaultVolumeStream)
Date Thu, 27 Nov 2014 15:55:43 GMT
Repository: cordova-android
Updated Branches:
  refs/heads/master 7fbb2b195 -> 81a77949f


CB-6153 Add a preference for controlling hardware button audio stream (DefaultVolumeStream)

This, along with the commit to the audio plugin, makes it so that by
default apps control the ringer volume, but when any audio players are
active, the media volume is controlled.


Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/81a77949
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/81a77949
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/81a77949

Branch: refs/heads/master
Commit: 81a77949fcdc58617423e69f70d74384356873cc
Parents: 7fbb2b1
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Thu Nov 27 10:52:19 2014 -0500
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Thu Nov 27 10:52:19 2014 -0500

----------------------------------------------------------------------
 framework/src/org/apache/cordova/CordovaActivity.java | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/81a77949/framework/src/org/apache/cordova/CordovaActivity.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaActivity.java b/framework/src/org/apache/cordova/CordovaActivity.java
index 3c12a97..816b12b 100755
--- a/framework/src/org/apache/cordova/CordovaActivity.java
+++ b/framework/src/org/apache/cordova/CordovaActivity.java
@@ -20,6 +20,7 @@ package org.apache.cordova;
 
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.Locale;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -346,9 +347,11 @@ public class CordovaActivity extends Activity implements CordovaInterface
{
         }
         createViews();
 
-        // TODO: Make this a preference (CB-6153)
-        // Setup the hardware volume controls to handle volume control
-        setVolumeControlStream(AudioManager.STREAM_MUSIC);
+        // Wire the hardware volume controls to control media if desired.
+        String volumePref = preferences.getString("DefaultVolumeStream", "");
+        if ("media".equals(volumePref.toLowerCase(Locale.ENGLISH))) {
+            setVolumeControlStream(AudioManager.STREAM_MUSIC);
+        }
     }
 
     /**


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message