Fix onPreferenceChange

This commit is contained in:
Chumva 2019-08-09 11:13:18 +03:00
parent 8b3f8724cd
commit e3059e3aa2
3 changed files with 1 additions and 28 deletions

View file

@ -203,16 +203,6 @@ public class OsmandSettings {
return settingsAPI.getPreferenceObject(getSharedPreferencesName(mode));
}
public void updateCachedPreference(String key) {
OsmandSettings.OsmandPreference pref = registeredPreferences.get(key);
if (pref instanceof OsmandSettings.CommonPreference) {
OsmandSettings.CommonPreference commonPreference = (OsmandSettings.CommonPreference) pref;
if (commonPreference.cache && commonPreference.cachedValue != null) {
commonPreference.cachedValue = null;
}
}
}
public boolean setPreference(String key, Object value) {
OsmandPreference<?> preference = registeredPreferences.get(key);
if (preference != null) {

View file

@ -23,7 +23,6 @@ import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.ImageView;
import android.widget.TextView;
@ -448,12 +447,8 @@ public abstract class BaseProfileSettingsFragment extends PreferenceFragmentComp
@SuppressWarnings("unchecked")
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
// handle boolean preferences
String key = preference.getKey();
if (preference.isPersistent()) {
settings.updateCachedPreference(key);
}
return true;
return settings.setPreference(key, newValue);
}
@Override

View file

@ -63,18 +63,6 @@ public class NavigationFragment extends BaseProfileSettingsFragment {
reset_to_default.setIcon(getContentIcon(R.drawable.ic_action_undo_dark));
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
Toast.makeText(getActivity(), "Change " + preference.getKey(), Toast.LENGTH_LONG).show();
return super.onPreferenceChange(preference, newValue);
}
@Override
public boolean onPreferenceClick(Preference preference) {
Toast.makeText(getActivity(), "Click " + preference.getKey(), Toast.LENGTH_LONG).show();
return super.onPreferenceClick(preference);
}
public static boolean showInstance(FragmentManager fragmentManager, ApplicationMode mode) {
try {
Bundle args = new Bundle();