From efc7049dfdda5a2ebb4566cbc2225428cd98eb1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?w=C3=B3jcik=2Eonline?= <35582382+wojcik-online@users.noreply.github.com> Date: Wed, 7 Feb 2018 19:24:25 +0100 Subject: [PATCH 1/3] Control media volume with the hardware buttons. Control media volume with the hardware buttons in the MainActivity. This is how the YouTube app works. Closes #1072. --- app/src/main/java/org/schabi/newpipe/MainActivity.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/java/org/schabi/newpipe/MainActivity.java b/app/src/main/java/org/schabi/newpipe/MainActivity.java index 9e8f3fa76..85bb04d6d 100644 --- a/app/src/main/java/org/schabi/newpipe/MainActivity.java +++ b/app/src/main/java/org/schabi/newpipe/MainActivity.java @@ -95,6 +95,8 @@ public class MainActivity extends AppCompatActivity implements HistoryListener { if (getSupportFragmentManager() != null && getSupportFragmentManager().getBackStackEntryCount() == 0) { initFragments(); } + + setVolumeControlStream(AudioManager.STREAM_MUSIC); setSupportActionBar(findViewById(R.id.toolbar)); setupDrawer(); From 7ea0862f9518e92957bf4dd940897e2661f8e344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?w=C3=B3jcik=2Eonline?= <35582382+wojcik-online@users.noreply.github.com> Date: Wed, 7 Feb 2018 19:35:04 +0100 Subject: [PATCH 2/3] import AudioManager --- app/src/main/java/org/schabi/newpipe/MainActivity.java | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/org/schabi/newpipe/MainActivity.java b/app/src/main/java/org/schabi/newpipe/MainActivity.java index 85bb04d6d..c698f7fa9 100644 --- a/app/src/main/java/org/schabi/newpipe/MainActivity.java +++ b/app/src/main/java/org/schabi/newpipe/MainActivity.java @@ -22,6 +22,7 @@ package org.schabi.newpipe; import android.content.Intent; import android.content.SharedPreferences; +import android.media.AudioManager; import android.os.Bundle; import android.os.Handler; import android.os.Looper; From e7b4b8805586c9f6497dac9a2952c03f43f944cb Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Wed, 7 Feb 2018 19:38:57 +0100 Subject: [PATCH 3/3] Revert "Control media volume with the hardware buttons." --- app/src/main/java/org/schabi/newpipe/MainActivity.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/MainActivity.java b/app/src/main/java/org/schabi/newpipe/MainActivity.java index c698f7fa9..9e8f3fa76 100644 --- a/app/src/main/java/org/schabi/newpipe/MainActivity.java +++ b/app/src/main/java/org/schabi/newpipe/MainActivity.java @@ -22,7 +22,6 @@ package org.schabi.newpipe; import android.content.Intent; import android.content.SharedPreferences; -import android.media.AudioManager; import android.os.Bundle; import android.os.Handler; import android.os.Looper; @@ -96,8 +95,6 @@ public class MainActivity extends AppCompatActivity implements HistoryListener { if (getSupportFragmentManager() != null && getSupportFragmentManager().getBackStackEntryCount() == 0) { initFragments(); } - - setVolumeControlStream(AudioManager.STREAM_MUSIC); setSupportActionBar(findViewById(R.id.toolbar)); setupDrawer();