当前位置: 首页>>代码示例>>Java>>正文


Java Preference.setOnPreferenceClickListener方法代码示例

本文整理汇总了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;
        }
    });
}
 
开发者ID:varunon9,项目名称:FakeLock,代码行数:23,代码来源:SettingsFragment.java

示例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);
}
 
开发者ID:garretyoder,项目名称:Cluttr,代码行数:30,代码来源:SettingsActivity.java

示例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;
        }
    });
}
 
开发者ID:VDenis,项目名称:YandexTranslator,代码行数:14,代码来源:SettingsFragment.java

示例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;
  });
}
 
开发者ID:philipphager,项目名称:disclosure-android-app,代码行数:8,代码来源:SettingsFragment.java

示例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;
  });
}
 
开发者ID:philipphager,项目名称:disclosure-android-app,代码行数:8,代码来源:SettingsFragment.java

示例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);
}
 
开发者ID:ashutoshgngwr,项目名称:10-bitClockWidget,代码行数:14,代码来源:ClockWidgetPreferenceFragment.java

示例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;
        }
    });
}
 
开发者ID:kollerlukas,项目名称:Camera-Roll-Android-App,代码行数:15,代码来源:SettingsActivity.java

示例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;
        }
    });
}
 
开发者ID:kollerlukas,项目名称:Camera-Roll-Android-App,代码行数:15,代码来源:SettingsActivity.java

示例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");
}
 
开发者ID:Onelio,项目名称:ConnectU,代码行数:31,代码来源:PreferenceMenuFragment.java


注:本文中的android.support.v7.preference.Preference.setOnPreferenceClickListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。