From 1f24c186146c17f6fe5e140539cc7e56b2266062 Mon Sep 17 00:00:00 2001 From: Harshal Lele Date: Tue, 28 Jan 2020 20:14:35 +0530 Subject: [PATCH] reformatted and commented code --- .../newpipe/settings/VideoAudioSettingsFragment.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/src/main/java/org/schabi/newpipe/settings/VideoAudioSettingsFragment.java b/app/src/main/java/org/schabi/newpipe/settings/VideoAudioSettingsFragment.java index 64ff23140..86b04c4a7 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/VideoAudioSettingsFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/VideoAudioSettingsFragment.java @@ -24,11 +24,18 @@ public class VideoAudioSettingsFragment extends BasePreferenceFragment { listener = new SharedPreferences.OnSharedPreferenceChangeListener() { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String s) { + + //on M and above, if user chooses to minimise to popup player on exit and the app doesn't have + //display over other apps permission, show a snackbar to let the user give permission if(s.equals(getString(R.string.minimize_on_exit_key))){ + String newSetting = sharedPreferences.getString(s,null); if(newSetting != null){ + if(newSetting.equals(getString(R.string.minimize_on_exit_popup_key))){ + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !Settings.canDrawOverlays(getContext())){ + Snackbar.make(getListView(),R.string.permission_display_over_apps,Snackbar.LENGTH_INDEFINITE) .setAction(R.string.settings, new View.OnClickListener() { @Override