1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-23 08:30:44 +00:00

Fix more NPEs after OnSharedPreferenceChangeListener changes

This commit is contained in:
TobiGr 2023-01-16 23:05:29 +01:00
parent b9378a7c1f
commit 640d4b0280
2 changed files with 5 additions and 5 deletions

View File

@ -122,7 +122,7 @@ class FeedFragment : BaseStateFragment<FeedState>() {
groupName = arguments?.getString(KEY_GROUP_NAME) ?: "" groupName = arguments?.getString(KEY_GROUP_NAME) ?: ""
onSettingsChangeListener = SharedPreferences.OnSharedPreferenceChangeListener { _, key -> onSettingsChangeListener = SharedPreferences.OnSharedPreferenceChangeListener { _, key ->
if (key.equals(getString(R.string.list_view_mode_key))) { if (getString(R.string.list_view_mode_key).equals(key)) {
updateListViewModeOnResume = true updateListViewModeOnResume = true
} }
} }

View File

@ -27,14 +27,14 @@ public class VideoAudioSettingsFragment extends BasePreferenceFragment {
updateSeekOptions(); updateSeekOptions();
listener = (sharedPreferences, s) -> { listener = (sharedPreferences, key) -> {
// on M and above, if user chooses to minimise to popup player on exit // 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, // and the app doesn't have display over other apps permission,
// show a snackbar to let the user give permission // show a snackbar to let the user give permission
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
&& s.equals(getString(R.string.minimize_on_exit_key))) { && getString(R.string.minimize_on_exit_key).equals(key)) {
final String newSetting = sharedPreferences.getString(s, null); final String newSetting = sharedPreferences.getString(key, null);
if (newSetting != null if (newSetting != null
&& newSetting.equals(getString(R.string.minimize_on_exit_popup_key)) && newSetting.equals(getString(R.string.minimize_on_exit_popup_key))
&& !Settings.canDrawOverlays(getContext())) { && !Settings.canDrawOverlays(getContext())) {
@ -46,7 +46,7 @@ public class VideoAudioSettingsFragment extends BasePreferenceFragment {
.show(); .show();
} }
} else if (s.equals(getString(R.string.use_inexact_seek_key))) { } else if (getString(R.string.use_inexact_seek_key).equals(key)) {
updateSeekOptions(); updateSeekOptions();
} }
}; };