Fix onPreferenceChange
This commit is contained in:
parent
8b3f8724cd
commit
e3059e3aa2
3 changed files with 1 additions and 28 deletions
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue