Skip to content

Commit

Permalink
Commented out Preference.OnPreferenceClickListener as deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
vdbhb59 authored Sep 30, 2023
1 parent 4ea1fe6 commit d55aabd
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,16 @@ public boolean onPreferenceClick(Preference preference) {
}
});

findPreference("show_about").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
((ActivityMain) getActivity()).getToolbar().setTitle(R.string.settings_about);
FragmentAbout f = new FragmentAbout();
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.containerView, f).addToBackStack(String.valueOf(FRAGMENT_FROM_BACKSTACK)).commit();
return false;
}
});
// findPreference("show_about").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
// @Override
// public boolean onPreferenceClick(Preference preference) {
// ((ActivityMain) getActivity()).getToolbar().setTitle(R.string.settings_about);
// FragmentAbout f = new FragmentAbout();
// FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
// fragmentTransaction.replace(R.id.containerView, f).addToBackStack(String.valueOf(FRAGMENT_FROM_BACKSTACK)).commit();
// return false;
// }
// });
}

Preference batPref = getPreferenceScreen().findPreference(getString(R.string.key_ignore_battery_optimization));
Expand Down

3 comments on commit d55aabd

@vdbhb59
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be commented out, can be removed?

@segler-alex
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, I do not know anymore why this code is there. why do you believe it should be removed?

@vdbhb59
Copy link
Contributor Author

@vdbhb59 vdbhb59 commented on d55aabd Oct 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, I do not know anymore why this code is there. why do you believe it should be removed?

This code has been deprecated in API 29 and onward (https://developer.android.com/reference/android/preference/Preference.OnPreferenceClickListener). It is no longer used, but the AndroidX namespace is used under androidx.preference (https://developer.android.com/reference/androidx/preference/package-summary). This can be safely commented out until we can test this out over a build if required, but I believe this particular "preference" is "about" option (findPreference("show_about").setOnPreferenceClickListener), however is getting "overridden" by public boolean.

I do not have any android developer software to try this in sandbox or emulator, so unable to test it out directly.

Please sign in to comment.