Fix formatting and use lamda functions
This commit is contained in:
parent
a78762756a
commit
f7203d4ac9
|
@ -21,38 +21,29 @@ public class VideoAudioSettingsFragment extends BasePreferenceFragment {
|
|||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
listener = new SharedPreferences.OnSharedPreferenceChangeListener() {
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String s) {
|
||||
listener = (sharedPreferences, 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(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
|
||||
s.equals(getString(R.string.minimize_on_exit_key))){
|
||||
// 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 (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
|
||||
s.equals(getString(R.string.minimize_on_exit_key))) {
|
||||
|
||||
String newSetting = sharedPreferences.getString(s,null);
|
||||
if(newSetting != null
|
||||
String newSetting = sharedPreferences.getString(s, null);
|
||||
if (newSetting != null
|
||||
&& newSetting.equals(getString(R.string.minimize_on_exit_popup_key))
|
||||
&& !Settings.canDrawOverlays(getContext())){
|
||||
&& !Settings.canDrawOverlays(getContext())) {
|
||||
|
||||
Snackbar.make(getListView(),R.string.permission_display_over_apps,Snackbar.LENGTH_INDEFINITE)
|
||||
.setAction(R.string.settings, new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
PermissionHelper.checkSystemAlertWindowPermission(getContext());
|
||||
}
|
||||
})
|
||||
Snackbar.make(getListView(), R.string.permission_display_over_apps, Snackbar.LENGTH_INDEFINITE)
|
||||
.setAction(R.string.settings,
|
||||
view -> PermissionHelper.checkSystemAlertWindowPermission(getContext()))
|
||||
.show();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
addPreferencesFromResource(R.xml.video_audio_settings);
|
||||
|
|
Loading…
Reference in New Issue