當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。