use of android.preference.ListPreference in project Xposed-Tinted-Status-Bar by MohammadAG.
the class SettingsActivity method onPostCreate.
@SuppressWarnings({ "deprecation" })
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
getPreferenceManager().setSharedPreferencesMode(MODE_WORLD_READABLE);
addPreferencesFromResource(R.xml.pref_general);
Preference copyrightPreference = findPreference("copyright_key");
copyrightPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
AlertDialog.Builder builder = new AlertDialog.Builder(SettingsActivity.this);
builder.setTitle("").setItems(R.array.my_apps, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Uri uri = null;
Intent intent = new Intent(Intent.ACTION_VIEW);
switch(which) {
case 0:
uri = Uri.parse(URL_MY_APPS);
intent.setPackage("com.android.vending");
break;
case 1:
uri = Uri.parse(URL_MY_MODULES);
break;
case 2:
uri = Uri.parse("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KGGZ5C3AVC8ZU");
break;
}
startActivity(intent.setData(uri));
}
});
builder.create().show();
return false;
}
});
Preference donatePreference = findPreference("donate_key");
donatePreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference arg0) {
Intent intent = new Intent(Intent.ACTION_VIEW).setData(Uri.parse(URL_DONATION_PACKAGE));
intent.setPackage("com.android.vending");
startActivity(intent);
return false;
}
});
if (Utils.isDonateVersionInstalled(getApplicationContext())) {
copyrightPreference.setTitle(R.string.app_name_donate_version);
donatePreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Toast.makeText(SettingsActivity.this, R.string.thank_you, Toast.LENGTH_SHORT).show();
return false;
}
});
donatePreference.setTitle(R.string.thank_you);
donatePreference.setSummary(R.string.thank_you_summary);
}
String[] colorKeys = { SettingsKeys.DEFAULT_STATUS_BAR_TINT, SettingsKeys.DEFAULT_STATUS_BAR_ICON_TINT, SettingsKeys.DEFAULT_STATUS_BAR_INVERTED_ICON_TINT, SettingsKeys.DEFAULT_NAV_BAR_TINT, SettingsKeys.DEFAULT_NAV_BAR_ICON_TINT, SettingsKeys.DEFAULT_NAV_BAR_IM_TINT, SettingsKeys.DEFAULT_NAV_BAR_ICON_IM_TINT };
intializeColorPreferences(colorKeys);
findPreference(SettingsKeys.LINK_PANEL_VIEW_COLORS).setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
sendBroadcast(new Intent(Common.INTENT_SETTINGS_UPDATED));
return true;
}
});
ListPreference overlayTypePreference = (ListPreference) findPreference("pref_overlay_type");
final Preference overlayTransparencyPreference = findPreference("pref_semi_transparent_overlay_opacity");
if (overlayTypePreference.getValue().equals("semi_transparent"))
overlayTransparencyPreference.setEnabled(true);
overlayTypePreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (newValue.equals("semi_transparent"))
overlayTransparencyPreference.setEnabled(true);
else
overlayTransparencyPreference.setEnabled(false);
return true;
}
});
}
use of android.preference.ListPreference in project android_packages_inputmethods_LatinIME by CyanogenMod.
the class AdvancedSettingsFragment method onCreate.
@Override
public void onCreate(final Bundle icicle) {
super.onCreate(icicle);
addPreferencesFromResource(R.xml.prefs_screen_advanced);
final Resources res = getResources();
final Context context = getActivity();
// When we are called from the Settings application but we are not already running, some
// singleton and utility classes may not have been initialized. We have to call
// initialization method of these classes here. See {@link LatinIME#onCreate()}.
AudioAndHapticFeedbackManager.init(context);
final SharedPreferences prefs = getPreferenceManager().getSharedPreferences();
if (!Settings.isInternal(prefs)) {
removePreference(Settings.SCREEN_DEBUG);
}
if (!AudioAndHapticFeedbackManager.getInstance().hasVibrator()) {
removePreference(Settings.PREF_VIBRATION_DURATION_SETTINGS);
}
// TODO: consolidate key preview dismiss delay with the key preview animation parameters.
if (!Settings.readFromBuildConfigIfToShowKeyPreviewPopupOption(res)) {
removePreference(Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY);
} else {
// TODO: Cleanup this setup.
final ListPreference keyPreviewPopupDismissDelay = (ListPreference) findPreference(Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY);
final String popupDismissDelayDefaultValue = Integer.toString(res.getInteger(R.integer.config_key_preview_linger_timeout));
keyPreviewPopupDismissDelay.setEntries(new String[] { res.getString(R.string.key_preview_popup_dismiss_no_delay), res.getString(R.string.key_preview_popup_dismiss_default_delay) });
keyPreviewPopupDismissDelay.setEntryValues(new String[] { "0", popupDismissDelayDefaultValue });
if (null == keyPreviewPopupDismissDelay.getValue()) {
keyPreviewPopupDismissDelay.setValue(popupDismissDelayDefaultValue);
}
keyPreviewPopupDismissDelay.setEnabled(Settings.readKeyPreviewPopupEnabled(prefs, res));
}
setupKeypressVibrationDurationSettings();
setupKeypressSoundVolumeSettings();
setupKeyLongpressTimeoutSettings();
refreshEnablingsOfKeypressSoundAndVibrationSettings();
}
use of android.preference.ListPreference in project MyJapanese by 54wall.
the class SettingFragment method initPreference.
private void initPreference() {
mUpdatePreference = getPreferenceManager().findPreference("setting_update");
mUpdatePreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Log.e(TAG, "mUpdatePreference");
// 检查自动更新,默认UI
return false;
}
});
mTTSListPreference = (ListPreference) getPreferenceManager().findPreference("setting_tts");
mTTSListPreference.setEntries(R.array.tts_entries);
mTTSListPreference.setEntryValues(R.array.tts_values);
mTTSListPreference.setValue(tts_type);
mTTSListPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
SharedPreferenceManager.getInstance().putString(Constants.TTS_TYPE, (String) newValue);
JpTTSUtils.getInstance().updateTtsType();
RxBus.getDefault().post(new EventContainer(EventContainer.TYPE_SETTING, new SettingEvent(R.string.setting_effect)));
return true;
}
});
mThemesListPreference = (ListPreference) getPreferenceManager().findPreference("setting_theme");
mThemesListPreference.setEntries(R.array.themes_entries);
mThemesListPreference.setEntryValues(R.array.themes_values);
mThemesListPreference.setValue(mode_theme);
mThemesListPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
SharedPreferenceManager.getInstance().putString(Constants.MODE_THEME, (String) newValue);
RxBus.getDefault().post(new EventContainer(EventContainer.TYPE_SETTING, new SettingEvent(R.string.reboot_to_take_effect)));
return true;
}
});
}
use of android.preference.ListPreference in project Klyph by jonathangerbaud.
the class PreferencesActivity method refreshInterval.
private void refreshInterval() {
ListPreference p = (ListPreference) findPreference(KlyphPreferences.PREFERENCE_NOTIFICATIONS_INTERVAL);
p.setSummary(p.getEntry());
}
use of android.preference.ListPreference in project Klyph by jonathangerbaud.
the class PreferencesActivity method refreshFbLanguage.
private void refreshFbLanguage() {
ListPreference p = (ListPreference) findPreference(KlyphPreferences.PREFERENCE_FB_LANGUAGE);
p.setSummary(p.getEntry());
}
Aggregations