cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@apache.org
Subject [3/3] cordova-amazon-fireos git commit: CB-6153 Add a preference for controlling hardware button audio stream (DefaultVolumeStream)
Date Sat, 06 Dec 2014 15:55:48 GMT
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-amazon-fireos/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/commit/b84610a6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/tree/b84610a6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/diff/b84610a6

Branch: refs/heads/master
Commit: b84610a6cfdd02d466ce1d7de8be9fff380f3bd6
Parents: 6003b94
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Thu Nov 27 10:52:19 2014 -0500
Committer: Ajitha <ajithas@amazon.com>
Committed: Mon Dec 1 13:00:00 2014 +0530

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


http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/b84610a6/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 57e2e46..9d5e1c8 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;
 
@@ -437,9 +438,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