本文整理汇总了Java中android.preference.Preference.OnPreferenceClickListener类的典型用法代码示例。如果您正苦于以下问题:Java OnPreferenceClickListener类的具体用法?Java OnPreferenceClickListener怎么用?Java OnPreferenceClickListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OnPreferenceClickListener类属于android.preference.Preference包,在下文中一共展示了OnPreferenceClickListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initSettings
import android.preference.Preference.OnPreferenceClickListener; //导入依赖的package包/类
private void initSettings() {
initTunnelSettings();
initAudioSettings();
initVideoSettings();
initCallSettings();
initChatSettings();
initNetworkSettings();
initAdvancedSettings();
findPreference(getString(R.string.pref_add_account_key)).setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
int nbAccounts = mPrefs.getAccountCount();
LinphoneActivity.instance().displayAccountSettings(nbAccounts);
return true;
}
});
}
示例2: onCreate
import android.preference.Preference.OnPreferenceClickListener; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.about_preferences);
Context context = MakiApplication.getContextOfApplication();
PreferenceManager.getDefaultSharedPreferences(context);
//open about dialog
Preference preferenceabout = findPreference("about");
preferenceabout.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
AlertDialog.Builder builder =
new AlertDialog.Builder(getActivity(), R.style.AppCompatAlertDialogStyle);
builder.setTitle(getResources().getString(R.string.about_header));
builder.setMessage(Html.fromHtml(getResources().getString(R.string.about_text)));
builder.setPositiveButton(getResources().getString(R.string.ok), null);
builder.setNegativeButton(null, null);
builder.show();
return true;
}
});
}
示例3: onCreate
import android.preference.Preference.OnPreferenceClickListener; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_security);
findPreference(KEY_PIN_ENABLED).setOnPreferenceClickListener(this);
pin_set_preference = findPreference(KEY_PIN_SET);
pin_set_preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
SettingsActivity.logSettingEvent(preference.getKey());
checkPin();
return false;
}
});
pin_set_preference.setSummary(SettingsActivity.isPinProtected(getActivity()) ? R.string.pin_set : R.string.pin_disabled);
}
示例4: configureSyncSettings
import android.preference.Preference.OnPreferenceClickListener; //导入依赖的package包/类
private void configureSyncSettings() {
final Preferences preferences = (Preferences) getActivity();
final Account account = ChromeSigninController.get(getActivity()).getSignedInUser();
findPreference(PREF_SYNC_SETTINGS)
.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
if (!isVisible() || !isResumed()) return false;
if (ProfileSyncService.get() == null) return true;
Bundle args = new Bundle();
args.putString(SyncCustomizationFragment.ARGUMENT_ACCOUNT, account.name);
preferences.startFragment(SyncCustomizationFragment.class.getName(), args);
return true;
}
});
}
示例5: onCreate
import android.preference.Preference.OnPreferenceClickListener; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
Preference search = findPreference(SEARCH_KEY);
Preference help = findPreference(HELP_KEY);
initializeLists();
getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
search.setOnPreferenceClickListener(new OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
DuckDuckGoSettings.this.onSearchRequested();
return true;
}
});
help.setIntent(new Intent(this, Help.class));
}
示例6: onCreate
import android.preference.Preference.OnPreferenceClickListener; //导入依赖的package包/类
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getPreferenceManager().setSharedPreferencesName(MainActivity.PREF_NAME);
addPreferencesFromResource(R.xml.preferences);
final ListPreference listPreference = null;
//listPreference = (ListPreference) findPreference(getResources().getString(R.string.const_pref_encoding));
if (listPreference != null) {
setListPreferenceData(listPreference);
listPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
setListPreferenceData(listPreference);
return false;
}
});
}
}
示例7: onCreate
import android.preference.Preference.OnPreferenceClickListener; //导入依赖的package包/类
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Load the preferences from an XML resource
addPreferencesFromResource(R.xml.preferences);
// click on clear button
Preference clear = findPreference("clear_card");
clear.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(final Preference preference) {
HomeActivity activity = (HomeActivity) getActivity();
if (activity != null) {
activity.clear();
CroutonUtils.display(activity, getString(R.string.card_deleted), CoutonColor.GREEN);
activity.backToHomeScreen();
}
return true;
}
});
}
示例8: createAddAccountPreference
import android.preference.Preference.OnPreferenceClickListener; //导入依赖的package包/类
/**
* Create the preference for allow adding new accounts
*/
private void createAddAccountPreference() {
Preference addAccountPref = new Preference(this);
addAccountPref.setKey("add_account");
addAccountPref.setTitle(getString(R.string.prefs_add_account));
mAccountsPrefCategory.addPreference(addAccountPref);
addAccountPref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
AccountManager am = AccountManager.get(getApplicationContext());
am.addAccount(MainApp.getAccountType(), null, null, null, Preferences.this,
null, null);
return true;
}
});
}
示例9: initDependencies
import android.preference.Preference.OnPreferenceClickListener; //导入依赖的package包/类
private void initDependencies(){
final Preference buildDepend = findPreference(BUILD_DEPENDS);
buildDepend.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(final Preference preference) {
final WebView webView = new WebView(mContext);
webView.loadUrl("file:///android_asset/licenses.html");
new AlertDialog.Builder(mContext)
.setTitle(R.string.dependencies_title)
.setView(webView)
.setPositiveButton(android.R.string.ok, null)
.create()
.show();
return true;
}
});
}
示例10: onCreate
import android.preference.Preference.OnPreferenceClickListener; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
addPreferencesFromResource(R.xml.sensor_settings);
boolean hasAntSupport = AntInterface.hasAntSupport(this);
configSensorType(hasAntSupport);
findPreference(getString(R.string.settings_sensor_bluetooth_pairing_key))
.setOnPreferenceClickListener(new OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
Intent settingsIntent = new Intent(Settings.ACTION_BLUETOOTH_SETTINGS);
startActivity(settingsIntent);
return true;
}
});
if (!hasAntSupport) {
PreferenceScreen rootPreferenceScreen = (PreferenceScreen) findPreference(
getString(R.string.settings_sensor_root_key));
rootPreferenceScreen.removePreference(
findPreference(getString(R.string.settings_sensor_ant_key)));
}
}
示例11: updateAntSensor
import android.preference.Preference.OnPreferenceClickListener; //导入依赖的package包/类
/**
* Updates an ant sensor.
*
* @param preferenceKey the preference key
* @param valueKey the value key
* @param enabled true if enabled
*/
@SuppressWarnings("deprecation")
private void updateAntSensor(int preferenceKey, final int valueKey, boolean enabled) {
Preference preference = findPreference(getString(preferenceKey));
if (preference != null) {
preference.setEnabled(enabled);
int deviceId = PreferencesUtils.getInt(this, valueKey, AntSensorManager.WILDCARD);
if (deviceId == AntSensorManager.WILDCARD) {
preference.setSummary(R.string.settings_sensor_ant_not_connected);
} else {
preference.setSummary(getString(R.string.settings_sensor_ant_paired, deviceId));
}
preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference pref) {
PreferencesUtils.setInt(SensorSettingsActivity.this, valueKey, AntSensorManager.WILDCARD);
pref.setSummary(R.string.settings_sensor_ant_not_connected);
return true;
}
});
}
}
示例12: initializeShowCustomBottomSheetPreference
import android.preference.Preference.OnPreferenceClickListener; //导入依赖的package包/类
/**
* Initializes the preference, which allows to show a bottom sheet with custom content.
*/
private void initializeShowCustomBottomSheetPreference() {
Preference showCustomBottomSheetPreference =
findPreference(getString(R.string.show_custom_bottom_sheet_preference_key));
showCustomBottomSheetPreference
.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(final Preference preference) {
initializeCustomBottomSheet();
customBottomSheet.show();
return true;
}
});
}
示例13: initializeShowIntentBottmSheetPreference
import android.preference.Preference.OnPreferenceClickListener; //导入依赖的package包/类
/**
* Initializes the preference, which allows to display the applications, which are suited for
* handling an intent.
*/
private void initializeShowIntentBottmSheetPreference() {
Preference showIntentBottomSheetPreference =
findPreference(getString(R.string.show_intent_bottom_sheet_preference_key));
showIntentBottomSheetPreference
.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
initializeIntentBottomSheet();
intentBottomSheet.show();
return true;
}
});
}
示例14: updateMapSettingsPreference
import android.preference.Preference.OnPreferenceClickListener; //导入依赖的package包/类
private boolean updateMapSettingsPreference(final String mapProviderName) {
final DPMapProvider mapProvider = DPMapProvider.getMapProvider(mapProviderName);
if (mapProvider == null)
return false;
final Preference providerPrefs = findPreference(getText(R.string.pref_map_provider_settings_key));
if (providerPrefs != null) {
providerPrefs.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
startActivity(new Intent(getActivity(), MapPreferencesActivity.class).putExtra(
MapPreferencesActivity.EXTRA_MAP_PROVIDER_NAME, mapProviderName));
return true;
}
});
}
return true;
}
示例15: onActivityResult
import android.preference.Preference.OnPreferenceClickListener; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == TEXT_TO_SPEECH_CHECK_CODE) {
Preference ttsWarningPreference = findPreference("tts_warning");
if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) {
ttsWarningPreference.setEnabled(false);
} else {
ttsWarningPreference.setEnabled(true);
ttsWarningPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
Intent installIntent = new Intent();
installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
startActivity(installIntent);
return true;
}
});
}
}
super.onActivityResult(requestCode, resultCode, data);
}