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/2] 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/2] 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;