本文整理汇总了Java中android.support.v7.preference.Preference.setOnPreferenceClickListener方法的典型用法代码示例。如果您正苦于以下问题:Java Preference.setOnPreferenceClickListener方法的具体用法?Java Preference.setOnPreferenceClickListener怎么用?Java Preference.setOnPreferenceClickListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.preference.Preference
的用法示例。
在下文中一共展示了Preference.setOnPreferenceClickListener方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreatePreferences
import android.support.v7.preference.Preference; //导入方法依赖的package包/类
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
settingsPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
// Load the Preferences from the XML file
addPreferencesFromResource(R.xml.settings_preferences);
Preference backgroundPreference = (Preference) findPreference(SettingsPreferencesKeys.
BACKGROUND_PREFERENCE_KEY);
backgroundPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Picture"),
PICK_IMAGE_REQUEST);
return true;
}
});
}
示例2: invalidateSettings
import android.support.v7.preference.Preference; //导入方法依赖的package包/类
public void invalidateSettings() {
SwitchPreference dark = (SwitchPreference) findPreference("dark_theme");
ExcludeFolderPreference exclude = (ExcludeFolderPreference) findPreference("excluded_folders_listener_key");
ColorPickerPreference primary = (ColorPickerPreference) findPreference("primary");
ColorPickerPreference accent = (ColorPickerPreference) findPreference("accent");
Preference security = findPreference("security_placeholder");
Preference animations = findPreference("animations");
Preference staggered = findPreference("staggered");
Preference cache = findPreference("clear_cache_placeholder");
Preference sdcard = findPreference("externalsd_placeholder");
Preference removesd = findPreference("removesd_placeholder");
sdcard.setSummary(ExtSdHelper.getSdPath()==null ? getContext().getResources().getString(R.string.no_sd) : ExtSdHelper.getSdPath().substring(ExtSdHelper.getSdPath().lastIndexOf("/")+1));
if (Build.VERSION.SDK_INT < 21) {
sdcard.setEnabled(false);
}
removesd.setOnPreferenceClickListener(this);
sdcard.setOnPreferenceClickListener(this);
security.setOnPreferenceClickListener(this);
exclude.setOnPreferenceClickListener(this);
cache.setOnPreferenceClickListener(this);
staggered.setOnPreferenceChangeListener(this);
animations.setOnPreferenceChangeListener(this);
dark.setOnPreferenceChangeListener(this);
primary.setOnPreferenceChangeListener(this);
accent.setOnPreferenceChangeListener(this);
}
示例3: onCreatePreferences
import android.support.v7.preference.Preference; //导入方法依赖的package包/类
@Override
public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) {
addPreferencesFromResource(R.xml.preferences);
Preference button = findPreference(getString(R.string.preference_key_clear_history_button));
button.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(final Preference preference) {
translateManager.clearTranslateHistory();
return true;
}
});
}
示例4: setupContact
import android.support.v7.preference.Preference; //导入方法依赖的package包/类
private void setupContact() {
Preference preference = findPreference(getString(R.string.settings_contact));
preference.setOnPreferenceClickListener(pref -> {
navigate().toNestedSystemSetting(NestedSettingsActivity.CONTACT);
return true;
});
}
示例5: setupLicense
import android.support.v7.preference.Preference; //导入方法依赖的package包/类
private void setupLicense() {
Preference preference = findPreference(getString(R.string.settings_license_and_thanks));
preference.setOnPreferenceClickListener(pref -> {
navigate().toNestedSystemSetting(NestedSettingsActivity.LICENSE);
return true;
});
}
示例6: onCreatePreferencesFix
import android.support.v7.preference.Preference; //导入方法依赖的package包/类
@Override
public void onCreatePreferencesFix(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.widget_preference, rootKey);
ListPreference dotSize = (ListPreference) findPreference("dot_size");
dotSize.setSummary(dotSize.getEntry());
Preference about = findPreference("about");
about.setOnPreferenceClickListener(extrasPreferenceClickListener);
Preference help = findPreference("help");
help.setOnPreferenceClickListener(extrasPreferenceClickListener);
}
示例7: initExcludedPathsPref
import android.support.v7.preference.Preference; //导入方法依赖的package包/类
private void initExcludedPathsPref() {
Preference pref = findPreference(getString(R.string.pref_key_excluded_paths));
pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
if (callback != null) {
callback.onSettingChanged();
}
Intent intent = new Intent(getContext(), ExcludePathsActivity.class);
getContext().startActivity(intent);
return false;
}
});
}
示例8: initVirtualDirectoriesPref
import android.support.v7.preference.Preference; //导入方法依赖的package包/类
private void initVirtualDirectoriesPref() {
Preference pref = findPreference(getString(R.string.pref_key_virtual_directories));
pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
if (callback != null) {
callback.onSettingChanged();
}
Intent intent = new Intent(getContext(), VirtualAlbumsActivity.class);
getContext().startActivity(intent);
return false;
}
});
}
示例9: onViewCreated
import android.support.v7.preference.Preference; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState)
{
super.onViewCreated(view, savedInstanceState);
app = (App) getContext().getApplicationContext();
setYearAdapters();
view.setBackgroundColor(Color.parseColor("#FFFFFF"));
Preference preference = findPreference("preference_logout");
preference.setOnPreferenceClickListener(onLogout);
Preference year = findPreference("preference_staticyear");
year.setOnPreferenceClickListener(onStaticYear);
Preference test = findPreference("preference_notification");
test.setOnPreferenceClickListener(onNotificationsOpen);
Preference about = findPreference("preference_about");
about.setOnPreferenceClickListener(onAbout);
Preference shortcut = findPreference("preference_shortcut");
shortcut.setOnPreferenceClickListener(onTheme);
Preference shortcut1 = findPreference("preference_webmail");
shortcut1.setOnPreferenceClickListener(onTheme1);
Preference tys = findPreference("preference_tys");
tys.setOnPreferenceClickListener(onTySRequest);
String type = "release";
if (AppManager.isDebug())
type = "debug";
Preference version = findPreference("preference_version");
version.setTitle("ConnectU App version " + AppManager.getAppVersion(getContext()));
version.setSummary("You are on " + type + " mode");
}