diff options
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java | 9 | ||||
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/util/Util.java | 4 |
2 files changed, 11 insertions, 2 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java index 94c9b7fc..f7031146 100644 --- a/app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java +++ b/app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java @@ -24,6 +24,7 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.preference.CheckBoxPreference; import android.preference.EditTextPreference; @@ -109,6 +110,14 @@ public class SettingsFragment extends PreferenceCompatFragment implements Shared public void onCreate(Bundle bundle) { super.onCreate(bundle); + if(Build.VERSION.SDK_INT >= 21) { + CheckBoxPreference mediaButtons = (CheckBoxPreference) findPreference("mediaButtons"); + if (mediaButtons != null) { + PreferenceCategory otherCategory = (PreferenceCategory) findPreference("otherSettings"); + otherCategory.removePreference(mediaButtons); + } + } + int instance = this.getArguments().getInt(Constants.PREFERENCES_KEY_SERVER_INSTANCE, -1); if (instance != -1) { PreferenceScreen preferenceScreen = expandServer(instance); diff --git a/app/src/main/java/github/daneren2005/dsub/util/Util.java b/app/src/main/java/github/daneren2005/dsub/util/Util.java index 5699cdf9..a02e7ded 100644 --- a/app/src/main/java/github/daneren2005/dsub/util/Util.java +++ b/app/src/main/java/github/daneren2005/dsub/util/Util.java @@ -1294,11 +1294,11 @@ public final class Util { public static void registerMediaButtonEventReceiver(Context context) { - // Only do it if enabled in the settings. + // Only do it if enabled in the settings and api < 21 SharedPreferences prefs = getPreferences(context); boolean enabled = prefs.getBoolean(Constants.PREFERENCES_KEY_MEDIA_BUTTONS, true); - if (enabled) { + if (enabled && Build.VERSION.SDK_INT < 21) { // AudioManager.registerMediaButtonEventReceiver() was introduced in Android 2.2. // Use reflection to maintain compatibility with 1.5. |