@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.document_mode_preferences);
getActivity().setTitle(R.string.tabs_and_apps_title);
mDocumentModeManager = DocumentModeManager.getInstance(getActivity());
mDocumentModeSwitch = (SwitchPreference) findPreference(PREF_DOCUMENT_MODE_SWITCH);
boolean isdocumentModeEnabled = !mDocumentModeManager.isOptedOutOfDocumentMode();
mDocumentModeSwitch.setChecked(isdocumentModeEnabled);
mDocumentModeSwitch.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if ((boolean) newValue == !mDocumentModeManager.isOptedOutOfDocumentMode()) {
return true;
}
createOptOutAlertDialog((boolean) newValue).show();
return true;
}
});
}
java类android.preference.Preference.OnPreferenceChangeListener的实例源码
DocumentModePreference.java 文件源码
项目:Vafrinn
阅读 25
收藏 0
点赞 0
评论 0
SoundSettings.java 文件源码
项目:lineagex86
阅读 29
收藏 0
点赞 0
评论 0
private void initVibrateWhenRinging(PreferenceCategory root) {
mVibrateWhenRinging = (TwoStatePreference) root.findPreference(KEY_VIBRATE_WHEN_RINGING);
if (mVibrateWhenRinging == null) {
Log.i(TAG, "Preference not found: " + KEY_VIBRATE_WHEN_RINGING);
return;
}
if (!mVoiceCapable || !Utils.isUserOwner()) {
root.removePreference(mVibrateWhenRinging);
mVibrateWhenRinging = null;
return;
}
mVibrateWhenRinging.setPersistent(false);
updateVibrateWhenRinging();
mVibrateWhenRinging.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final boolean val = (Boolean) newValue;
return Settings.System.putInt(getContentResolver(),
Settings.System.VIBRATE_WHEN_RINGING,
val ? 1 : 0);
}
});
}
HomepagePreferences.java 文件源码
项目:chromium-for-android-56-debug-video
阅读 21
收藏 0
点赞 0
评论 0
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mHomepageManager = HomepageManager.getInstance(getActivity());
getActivity().setTitle(R.string.options_homepage_title);
addPreferencesFromResource(R.xml.homepage_preferences);
mHomepageSwitch = (ChromeSwitchPreference) findPreference(PREF_HOMEPAGE_SWITCH);
boolean isHomepageEnabled = mHomepageManager.getPrefHomepageEnabled();
mHomepageSwitch.setChecked(isHomepageEnabled);
mHomepageSwitch.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
mHomepageManager.setPrefHomepageEnabled((boolean) newValue);
return true;
}
});
mHomepageEdit = findPreference(PREF_HOMEPAGE_EDIT);
updateCurrentHomepageUrl();
}
DoNotTrackPreference.java 文件源码
项目:chromium-for-android-56-debug-video
阅读 22
收藏 0
点赞 0
评论 0
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.do_not_track_preferences);
getActivity().setTitle(R.string.do_not_track_title);
ChromeSwitchPreference doNotTrackSwitch =
(ChromeSwitchPreference) findPreference(PREF_DO_NOT_TRACK_SWITCH);
boolean isDoNotTrackEnabled = PrefServiceBridge.getInstance().isDoNotTrackEnabled();
doNotTrackSwitch.setChecked(isDoNotTrackEnabled);
doNotTrackSwitch.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
PrefServiceBridge.getInstance().setDoNotTrackEnabled((boolean) newValue);
return true;
}
});
}
PhysicalWebPreferenceFragment.java 文件源码
项目:chromium-for-android-56-debug-video
阅读 20
收藏 0
点赞 0
评论 0
private void initPhysicalWebSwitch() {
ChromeSwitchPreference physicalWebSwitch =
(ChromeSwitchPreference) findPreference(PREF_PHYSICAL_WEB_SWITCH);
physicalWebSwitch.setChecked(
PrivacyPreferencesManager.getInstance().isPhysicalWebEnabled());
physicalWebSwitch.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
boolean enabled = (boolean) newValue;
if (enabled) {
PhysicalWebUma.onPrefsFeatureEnabled(getActivity());
ensureLocationPermission();
} else {
PhysicalWebUma.onPrefsFeatureDisabled(getActivity());
}
PrivacyPreferencesManager.getInstance().setPhysicalWebEnabled(enabled);
return true;
}
});
}
AutofillPreferences.java 文件源码
项目:chromium-for-android-56-debug-video
阅读 26
收藏 0
点赞 0
评论 0
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.autofill_preferences);
getActivity().setTitle(R.string.prefs_autofill);
ChromeSwitchPreference autofillSwitch =
(ChromeSwitchPreference) findPreference(PREF_AUTOFILL_SWITCH);
autofillSwitch.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
PersonalDataManager.setAutofillEnabled((boolean) newValue);
return true;
}
});
setPreferenceCategoryIcons();
}
HomepagePreferences.java 文件源码
项目:AndroidChromium
阅读 22
收藏 0
点赞 0
评论 0
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mHomepageManager = HomepageManager.getInstance(getActivity());
getActivity().setTitle(R.string.options_homepage_title);
addPreferencesFromResource(R.xml.homepage_preferences);
mHomepageSwitch = (ChromeSwitchPreference) findPreference(PREF_HOMEPAGE_SWITCH);
boolean isHomepageEnabled = mHomepageManager.getPrefHomepageEnabled();
mHomepageSwitch.setChecked(isHomepageEnabled);
mHomepageSwitch.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
mHomepageManager.setPrefHomepageEnabled((boolean) newValue);
return true;
}
});
mHomepageEdit = findPreference(PREF_HOMEPAGE_EDIT);
updateCurrentHomepageUrl();
}
DoNotTrackPreference.java 文件源码
项目:AndroidChromium
阅读 21
收藏 0
点赞 0
评论 0
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.do_not_track_preferences);
getActivity().setTitle(R.string.do_not_track_title);
ChromeSwitchPreference doNotTrackSwitch =
(ChromeSwitchPreference) findPreference(PREF_DO_NOT_TRACK_SWITCH);
boolean isDoNotTrackEnabled = PrefServiceBridge.getInstance().isDoNotTrackEnabled();
doNotTrackSwitch.setChecked(isDoNotTrackEnabled);
doNotTrackSwitch.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
PrefServiceBridge.getInstance().setDoNotTrackEnabled((boolean) newValue);
return true;
}
});
}
PhysicalWebPreferenceFragment.java 文件源码
项目:AndroidChromium
阅读 22
收藏 0
点赞 0
评论 0
private void initPhysicalWebSwitch() {
ChromeSwitchPreference physicalWebSwitch =
(ChromeSwitchPreference) findPreference(PREF_PHYSICAL_WEB_SWITCH);
physicalWebSwitch.setChecked(
PrivacyPreferencesManager.getInstance().isPhysicalWebEnabled());
physicalWebSwitch.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
boolean enabled = (boolean) newValue;
if (enabled) {
PhysicalWebUma.onPrefsFeatureEnabled(getActivity());
ensureLocationPermission();
} else {
PhysicalWebUma.onPrefsFeatureDisabled(getActivity());
}
PrivacyPreferencesManager.getInstance().setPhysicalWebEnabled(enabled);
return true;
}
});
}
AutofillPreferences.java 文件源码
项目:AndroidChromium
阅读 23
收藏 0
点赞 0
评论 0
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.autofill_preferences);
getActivity().setTitle(R.string.prefs_autofill);
ChromeSwitchPreference autofillSwitch =
(ChromeSwitchPreference) findPreference(PREF_AUTOFILL_SWITCH);
autofillSwitch.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
PersonalDataManager.setAutofillEnabled((boolean) newValue);
return true;
}
});
setPreferenceCategoryIcons();
}
PreferenceActivity.java 文件源码
项目:foursquared
阅读 29
收藏 0
点赞 0
评论 0
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
registerReceiver(mLoggedOutReceiver, new IntentFilter(Foursquared.INTENT_ACTION_LOGGED_OUT));
addPreferencesFromResource(R.xml.preferences);
mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
Preference advanceSettingsPreference = getPreferenceScreen().findPreference(
Preferences.PREFERENCE_ADVANCED_SETTINGS);
advanceSettingsPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
((Foursquared) getApplication()).requestUpdateUser();
return false;
}
});
}
AtmosphereIMESettings.java 文件源码
项目:atmosphere-ime
阅读 25
收藏 0
点赞 0
评论 0
private void initPreferences() {
addPreferencesFromResource(R.xml.prefs);
hardwareKeyboardNotice = findPreference(getString(R.string.hardware_keyboard_notice_key));
imeNotSetNotice = findPreference(getString(R.string.ime_not_set_notice_key));
displayImePreference = (CheckBoxPreference) findPreference(getString(R.string.display_ime_key));
displayAnimationPreference = (CheckBoxPreference) findPreference(getString(R.string.display_animation_key));
displayImePreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
Boolean shouldDisplayIme = (Boolean) newValue;
if (!shouldDisplayIme) {
displayAnimationPreference.setChecked(false);
}
return true;
}
});
refreshPreferences();
}
StatsSettingsActivity.java 文件源码
项目:mytracks
阅读 23
收藏 0
点赞 0
评论 0
/**
* Configures the preferred units list preference.
*/
private void configUnitsListPreference() {
@SuppressWarnings("deprecation")
ListPreference listPreference = (ListPreference) findPreference(
getString(R.string.stats_units_key));
OnPreferenceChangeListener listener = new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference pref, Object newValue) {
boolean metricUnits = PreferencesUtils.STATS_UNITS_DEFAULT.equals((String) newValue);
configRateListPreference(metricUnits);
return true;
}
};
String value = PreferencesUtils.getString(
this, R.string.stats_units_key, PreferencesUtils.STATS_UNITS_DEFAULT);
String[] values = getResources().getStringArray(R.array.stats_units_values);
String[] options = getResources().getStringArray(R.array.stats_units_options);
configureListPreference(listPreference, options, options, values, value, listener);
}
SensorSettingsActivity.java 文件源码
项目:mytracks
阅读 28
收藏 0
点赞 0
评论 0
@SuppressWarnings("deprecation")
private void configSensorType(boolean hasAntSupport) {
ListPreference preference = (ListPreference) findPreference(
getString(R.string.sensor_type_key));
String value = PreferencesUtils.getString(
this, R.string.sensor_type_key, PreferencesUtils.SENSOR_TYPE_DEFAULT);
String[] options = getResources().getStringArray(
hasAntSupport ? R.array.sensor_type_all_options : R.array.sensor_type_bluetooth_options);
String[] values = getResources().getStringArray(
hasAntSupport ? R.array.sensor_type_all_values : R.array.sensor_type_bluetooth_values);
if (!hasAntSupport && value.equals(R.string.sensor_type_value_ant)) {
value = PreferencesUtils.SENSOR_TYPE_DEFAULT;
PreferencesUtils.setString(this, R.string.sensor_type_key, value);
}
OnPreferenceChangeListener listener = new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference pref, Object newValue) {
updateUiBySensorType((String) newValue);
return true;
}
};
configureListPreference(preference, options, options, values, value, listener);
}
MapSettingsActivity.java 文件源码
项目:mytracks
阅读 23
收藏 0
点赞 0
评论 0
/**
* Configures the track color mode preference.
*/
@SuppressWarnings("deprecation")
private void configTrackColorModePerference() {
ListPreference preference = (ListPreference) findPreference(
getString(R.string.track_color_mode_key));
OnPreferenceChangeListener listener = new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference pref, Object newValue) {
updateUiByTrackColorMode((String) newValue);
return true;
}
};
String value = PreferencesUtils.getString(
this, R.string.track_color_mode_key, PreferencesUtils.TRACK_COLOR_MODE_DEFAULT);
String[] values = getResources().getStringArray(R.array.track_color_mode_values);
String[] options = getResources().getStringArray(R.array.track_color_mode_options);
String[] summary = getResources().getStringArray(R.array.track_color_mode_summary);
configureListPreference(preference, summary, options, values, value, listener);
}
AbstractSettingsActivity.java 文件源码
项目:mytracks
阅读 24
收藏 0
点赞 0
评论 0
/**
* Configures a list preference.
*
* @param listPreference the list preference
* @param summary the summary array
* @param options the options array
* @param values the values array
* @param value the value
* @param listener optional listener
*/
protected void configureListPreference(ListPreference listPreference, final String[] summary,
final String[] options, final String[] values, String value,
final OnPreferenceChangeListener listener) {
listPreference.setEntryValues(values);
listPreference.setEntries(options);
listPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference pref, Object newValue) {
updatePreferenceSummary(pref, summary, values, (String) newValue);
if (listener != null) {
listener.onPreferenceChange(pref, newValue);
}
return true;
}
});
updatePreferenceSummary(listPreference, summary, values, value);
if (listener != null) {
listener.onPreferenceChange(listPreference, value);
}
}
HomepagePreferences.java 文件源码
项目:Vafrinn
阅读 23
收藏 0
点赞 0
评论 0
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mHomepageManager = HomepageManager.getInstance(getActivity());
getActivity().setTitle(R.string.options_homepage_title);
addPreferencesFromResource(R.xml.homepage_preferences);
mHomepageSwitch = (ChromeSwitchPreference) findPreference(PREF_HOMEPAGE_SWITCH);
boolean isHomepageEnabled = mHomepageManager.getPrefHomepageEnabled();
mHomepageSwitch.setChecked(isHomepageEnabled);
mHomepageSwitch.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
mHomepageManager.setPrefHomepageEnabled((boolean) newValue);
return true;
}
});
mHomepageEdit = findPreference(PREF_HOMEPAGE_EDIT);
updateCurrentHomepageUrl();
}
DoNotTrackPreference.java 文件源码
项目:Vafrinn
阅读 29
收藏 0
点赞 0
评论 0
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.do_not_track_preferences);
getActivity().setTitle(R.string.do_not_track_title);
ChromeSwitchPreference doNotTrackSwitch =
(ChromeSwitchPreference) findPreference(PREF_DO_NOT_TRACK_SWITCH);
boolean isDoNotTrackEnabled = PrefServiceBridge.getInstance().isDoNotTrackEnabled();
doNotTrackSwitch.setChecked(isDoNotTrackEnabled);
doNotTrackSwitch.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
PrefServiceBridge.getInstance().setDoNotTrackEnabled((boolean) newValue);
return true;
}
});
}
SettingsActivity.java 文件源码
项目:openbmap
阅读 28
收藏 0
点赞 0
评论 0
/**
* Initializes gps logging interval.
*/
private void initGpsLogIntervalControl() {
// Update GPS logging interval summary to the current value
final Preference pref = findPreference(org.openbmap.Preferences.KEY_GPS_LOGGING_INTERVAL);
pref.setSummary(
PreferenceManager.getDefaultSharedPreferences(this).getString(org.openbmap.Preferences.KEY_GPS_LOGGING_INTERVAL, org.openbmap.Preferences.VAL_GPS_LOGGING_INTERVAL)
+ " " + getResources().getString(R.string.prefs_gps_logging_interval_seconds)
+ ". " + getResources().getString(R.string.prefs_gps_logging_interval_summary));
pref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(final Preference preference, final Object newValue) {
// Set summary with the interval and "seconds"
preference.setSummary(newValue
+ " " + getResources().getString(R.string.prefs_gps_logging_interval_seconds)
+ ". " + getResources().getString(R.string.prefs_gps_logging_interval_summary));
return true;
}
});
}
SettingsActivity.java 文件源码
项目:meshchat
阅读 28
收藏 0
点赞 0
评论 0
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
sPref = this.getSharedPreferences(Globals.SHARED_PREF, Context.MODE_PRIVATE);
p = (EditTextPreference) findPreference(Globals.NICKNAME_DATA);
nicklistener = new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
SharedPreferences.Editor editor = sPref.edit();
editor.putString(Globals.NICKNAME_DATA, (String) newValue);
Log.d(Globals.TAG, ""+newValue.toString());
editor.commit();
return true;
}
};
}
BehaviorPreferenceFragment.java 文件源码
项目:AndroidPreferenceActivity
阅读 20
收藏 0
点赞 0
评论 0
/**
* Creates a listener, which allows to adapt the behavior of the {@link PreferenceActivity} when
* the value, which determines, whether the action bar's back button should be overwritten, has
* been changed.
*
* @return The listener, which has been created, as an instance of the type {@link
* OnPreferenceChangeListener}
*/
private OnPreferenceChangeListener createOverrideBackButtonChangeListener() {
return new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(final Preference preference, final Object newValue) {
if (newValue != null) {
boolean overrideNavigationIcon = (boolean) newValue;
((PreferenceActivity) getActivity()).overrideNavigationIcon(overrideNavigationIcon);
}
return true;
}
};
}
BehaviorPreferenceFragment.java 文件源码
项目:AndroidPreferenceActivity
阅读 16
收藏 0
点赞 0
评论 0
/**
* Creates a listener, which allows to adapt the behavior of the {@link PreferenceActivity} when
* the value, which determines, whether the navigation should be hidden, has been changed.
*
* @return The listener, which has been created, as an instance of the type {@link
* OnPreferenceChangeListener}
*/
private OnPreferenceChangeListener createHideNavigationChangeListener() {
return new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(final Preference preference, final Object newValue) {
if (newValue != null) {
boolean hideNavigation = (boolean) newValue;
((PreferenceActivity) getActivity()).hideNavigation(hideNavigation);
}
return true;
}
};
}
SettingsActivity.java 文件源码
项目:nxt-remote-control
阅读 26
收藏 0
点赞 0
评论 0
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.settings);
CheckBoxPreference cb_speed = (CheckBoxPreference) findPreference("PREF_REG_SPEED");
cb_sync = (CheckBoxPreference) findPreference("PREF_REG_SYNC");
cb_speed.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (!((Boolean) newValue).booleanValue()) {
cb_sync.setChecked(false);
}
return true;
}
});
}
SampleSettings.java 文件源码
项目:accengage-android-sdk-samples
阅读 26
收藏 0
点赞 0
评论 0
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
addPreferencesFromResource(R.xml.samplesettings);
setTitle("View : CoffeeSettings");
mInappDisplayLock = (CheckBoxPreference) findPreference("displayLocked");
mInappDisplayLock.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if(newValue.toString().equals("true")) {
mInappDisplayLock.setChecked(true);
A4S.get(SampleSettings.this).setInAppDisplayLocked(true);
}
else {
mInappDisplayLock.setChecked(false);
A4S.get(SampleSettings.this).setInAppDisplayLocked(false);
}
return false;
}
});
}
PreferenceFragment.java 文件源码
项目:AndroidMaterialPreferences
阅读 36
收藏 0
点赞 0
评论 0
/**
* Creates and returns a listener, which allows to adapt, whether the preference's values should
* be shown as summaries, or not, when the corresponding setting has been changed.
*
* @return The listener, which has been created, as an instance of the type {@link
* OnPreferenceChangeListener}
*/
private OnPreferenceChangeListener createShowValueAsSummaryListener() {
return new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(final Preference preference, final Object newValue) {
boolean showValueAsSummary = (Boolean) newValue;
editTextPreference.showValueAsSummary(showValueAsSummary);
listPreference.showValueAsSummary(showValueAsSummary);
multiChoiceListPreference.showValueAsSummary(showValueAsSummary);
seekBarPreference.showValueAsSummary(showValueAsSummary);
numberPickerPreference.showValueAsSummary(showValueAsSummary);
digitPickerPreference.showValueAsSummary(showValueAsSummary);
resolutionPreference.showValueAsSummary(showValueAsSummary);
colorPalettePreference.showValueAsSummary(showValueAsSummary);
adaptSwitchPreferenceSummary(showValueAsSummary);
return true;
}
};
}
PreferenceFragment.java 文件源码
项目:AndroidMaterialPreferences
阅读 35
收藏 0
点赞 0
评论 0
/**
* Creates and returns a listener, which allows to adapt, whether the headers of the
* preference's dialogs should be shown, or not, when the corresponding setting has been
* changed.
*
* @return The listener, which has been created, as an instance of the type {@link
* OnPreferenceChangeListener}
*/
private OnPreferenceChangeListener createShowDialogHeaderListener() {
return new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(final Preference preference, final Object newValue) {
boolean showDialogHeader = (Boolean) newValue;
dialogPreference.showDialogHeader(showDialogHeader);
editTextPreference.showDialogHeader(showDialogHeader);
listPreference.showDialogHeader(showDialogHeader);
multiChoiceListPreference.showDialogHeader(showDialogHeader);
seekBarPreference.showDialogHeader(showDialogHeader);
numberPickerPreference.showDialogHeader(showDialogHeader);
digitPickerPreference.showDialogHeader(showDialogHeader);
resolutionPreference.showDialogHeader(showDialogHeader);
colorPalettePreference.showDialogHeader(showDialogHeader);
return true;
}
};
}
PreferenceFragment.java 文件源码
项目:AndroidMaterialPreferences
阅读 32
收藏 0
点赞 0
评论 0
/**
* Creates and returns a listener, which allows to adapt, whether the button bar dividers of the
* preference's dialogs should be shown, or not, when the corresponding setting has been
* changed.
*
* @return The listener, which has been created, as an instance of the type {@link
* OnPreferenceChangeListener}
*/
private OnPreferenceChangeListener createShowDialogButtonBarDividerListener() {
return new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(final Preference preference, final Object newValue) {
boolean showDialogButtonBarDivider = (Boolean) newValue;
dialogPreference.showDialogButtonBarDivider(showDialogButtonBarDivider);
editTextPreference.showDialogButtonBarDivider(showDialogButtonBarDivider);
listPreference.showDialogButtonBarDivider(showDialogButtonBarDivider);
multiChoiceListPreference.showDialogButtonBarDivider(showDialogButtonBarDivider);
seekBarPreference.showDialogButtonBarDivider(showDialogButtonBarDivider);
numberPickerPreference.showDialogButtonBarDivider(showDialogButtonBarDivider);
digitPickerPreference.showDialogButtonBarDivider(showDialogButtonBarDivider);
resolutionPreference.showDialogButtonBarDivider(showDialogButtonBarDivider);
colorPalettePreference.showDialogButtonBarDivider(showDialogButtonBarDivider);
return true;
}
};
}
PreferencesDecorator.java 文件源码
项目:appcan-plugin-pdfreader-android
阅读 20
收藏 0
点赞 0
评论 0
public void decorateBrowserSettings() {
final boolean isTablet = IUIManager.instance.isTabletUi(parent.getActivity()) && !AndroidVersion.lessThan3x;
enableSettings(isTablet, SHOW_REMOVABLE_MEDIA.key, SHOW_SCANNING_MEDIA.key);
addListener(CACHE_LOCATION.key, new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(final Preference preference, final Object newValue) {
final CacheLocation newLocation = EnumUtils.getByResValue(CacheLocation.class,
LengthUtils.toString(newValue), null);
if (newLocation != null) {
CacheManager.moveCacheLocation(preference.getContext(), newLocation);
}
return true;
}
});
}
PreferencesDecorator.java 文件源码
项目:appcan-plugin-pdfreader-android
阅读 20
收藏 0
点赞 0
评论 0
protected void decorateEditPreference(final EditTextPreference textPrefs) {
final CharSequence summary = textPrefs.getSummary();
summaries.put(textPrefs.getKey(), summary);
final String value = textPrefs.getText();
setPreferenceSummary(textPrefs, value);
addListener(textPrefs, new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(final Preference preference, final Object newValue) {
setPreferenceSummary(textPrefs, (String) newValue);
return true;
}
});
}
PreferencesDecorator.java 文件源码
项目:appcan-plugin-pdfreader-android
阅读 26
收藏 0
点赞 0
评论 0
protected void decorateSeekPreference(final SeekBarPreference textPrefs) {
final CharSequence summary = textPrefs.getSummary();
summaries.put(textPrefs.getKey(), summary);
final int value = textPrefs.getValue();
setPreferenceSummary(textPrefs, "" + value);
addListener(textPrefs, new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(final Preference preference, final Object newValue) {
setPreferenceSummary(textPrefs, (String) newValue);
return true;
}
});
}