當前位置: 首頁>>代碼示例>>Java>>正文


Java Preference.setOnPreferenceClickListener方法代碼示例

本文整理匯總了Java中android.preference.Preference.setOnPreferenceClickListener方法的典型用法代碼示例。如果您正苦於以下問題:Java Preference.setOnPreferenceClickListener方法的具體用法?Java Preference.setOnPreferenceClickListener怎麽用?Java Preference.setOnPreferenceClickListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.preference.Preference的用法示例。


在下文中一共展示了Preference.setOnPreferenceClickListener方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initPreference

import android.preference.Preference; //導入方法依賴的package包/類
/**
 * Initializes the Preference based on the state of any policies that may affect it,
 * e.g. by showing a managed icon or disabling clicks on the preference.
 *
 * This should be called once, before the preference is displayed.
 */
public void initPreference(Preference preference) {
    if (isPreferenceControlledByPolicy(preference)) {
        preference.setIcon(ManagedPreferencesUtils.getManagedByEnterpriseIconId());

        if (isPreferenceClickDisabledByPolicy(preference)) {
            // Disable the views and prevent the Preference from mucking with the enabled state.
            preference.setShouldDisableView(false);

            // Prevent default click behavior.
            preference.setFragment(null);
            preference.setIntent(null);
            preference.setOnPreferenceClickListener(null);
        }
    }
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:22,代碼來源:ManagedPreferenceDelegate.java

示例2: onCreate

import android.preference.Preference; //導入方法依賴的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;
		}
	});


}
 
開發者ID:sfilmak,項目名稱:MakiLite,代碼行數:27,代碼來源:Credits.java

示例3: onCreate

import android.preference.Preference; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	addPreferencesFromResource(R.xml.pref_theme);
	
	Preference preferencePrimaryColor = findPreference(KEY_PRIMARY_COLOR);
	preferencePrimaryColor.setOnPreferenceChangeListener(this);
	preferencePrimaryColor.setOnPreferenceClickListener(this);

	findPreference(KEY_ACCENT_COLOR).setOnPreferenceClickListener(this);

	Preference preferenceThemeStyle = findPreference(KEY_THEME_STYLE);
	preferenceThemeStyle.setOnPreferenceChangeListener(this);
	preferenceThemeStyle.setOnPreferenceClickListener(this);

}
 
開發者ID:medalionk,項目名稱:simple-share-android,代碼行數:17,代碼來源:ThemePreferenceFragment.java

示例4: onCreate

import android.preference.Preference; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	// Load the preferences from an XML resource
	addPreferencesFromResource(R.xml.preferences);

	final Preference button = (Preference) findPreference(getString(R.string.pref_rtlSdrPpmInvalidate));
	button.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
		@Override
		public boolean onPreferenceClick(Preference preference) {
			useOtherRtlSdrDeviceAreYouSure();
			return true;
		}
	});
}
 
開發者ID:videgro,項目名稱:Ships,代碼行數:17,代碼來源:SettingsFragment.java

示例5: setupClearSearchPreference

import android.preference.Preference; //導入方法依賴的package包/類
private void setupClearSearchPreference() {
    Preference clearSearchPreference = findPreference(Constants.PREFERENCES_KEY_CLEAR_SEARCH_HISTORY);

    if (clearSearchPreference != null) {
        clearSearchPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
            @Override
            public boolean onPreferenceClick(Preference preference) {
                SearchRecentSuggestions suggestions =
                        new SearchRecentSuggestions(getActivity(),
                                SearchSuggestionProvider.AUTHORITY,
                                SearchSuggestionProvider.MODE);
                suggestions.clearHistory();
                Util.toast(getActivity(), R.string.settings_search_history_cleared);
                return false;
            }
        });
    }
}
 
開發者ID:ultrasonic,項目名稱:ultrasonic,代碼行數:19,代碼來源:SettingsFragment.java

示例6: initializeIdentitySelection

import android.preference.Preference; //導入方法依賴的package包/類
private void initializeIdentitySelection() {
  ContactIdentityManager identity = ContactIdentityManager.getInstance(getActivity());

  Preference preference = this.findPreference(TextSecurePreferences.IDENTITY_PREF);

  if (identity.isSelfIdentityAutoDetected()) {
    this.getPreferenceScreen().removePreference(preference);
  } else {
    Uri contactUri = identity.getSelfIdentityUri();

    if (contactUri != null) {
      String contactName = ContactAccessor.getInstance().getNameFromContact(getActivity(), contactUri);
      preference.setSummary(String.format(getString(R.string.ApplicationPreferencesActivity_currently_s),
                                          contactName));
    }

    preference.setOnPreferenceClickListener(new IdentityPreferenceClickListener());
  }
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:20,代碼來源:AdvancedPreferenceFragment.java

示例7: onCreate

import android.preference.Preference; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    addPreferencesFromResource(R.xml.settings_main);
    // About Version Preference
    Preference aboutVersion = findPreference(KEY_ABOUT_VERSION);
    aboutVersion.setSummary(AppUtils.getAppVersionName(getActivity()));
    aboutVersion.setOnPreferenceClickListener(this);
}
 
開發者ID:TaRGroup,項目名稱:IFWManager,代碼行數:10,代碼來源:SettingsMainFragment.java

示例8: addSettings_appListener

import android.preference.Preference; //導入方法依賴的package包/類
private void addSettings_appListener() {
    Preference reset = findPreference("settings_app");
    reset.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        public boolean onPreferenceClick(Preference pref) {
            helper_main.switchToActivity(getActivity(), Activity_settings_app.class);
            return true;
        }
    });
}
 
開發者ID:JaeNuguid,項目名稱:Kids-Portal-Android,代碼行數:10,代碼來源:Activity_settings.java

示例9: onCreate

import android.preference.Preference; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    //Make sure to call this since we're using a different
    PreferenceManager prefMgr = getPreferenceManager();
    prefMgr.setSharedPreferencesName(SyncToDriveService.PREFERENCES_NAME);
    addPreferencesFromResource(R.xml.pref_sync);
    setHasOptionsMenu(true);
    SetDriveStringDetails();

    Preference disconButton = findPreference("clear_drive_data");
    if(disconButton != null){
        disconButton.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener(){
            @Override
            public boolean onPreferenceClick(Preference p){
                Log.v("SETTING", "Clear Google Login");

                ClearDriveID();

                // Need to call service
                Intent i = new Intent(getActivity(), SyncToDriveService.class).putExtra("clear_drive_data", true);
                getActivity().startService(i);

                return true;
            }
        });
    }

}
 
開發者ID:etsy,項目名稱:divertsy-client,代碼行數:31,代碼來源:SettingsActivity.java

示例10: init_clearreport

import android.preference.Preference; //導入方法依賴的package包/類
private void init_clearreport() {
    Preference reset = findPreference("Clear_Report");
    reset.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.DialogStyle);
            builder.setTitle("Delete all reports?")
                    .setMessage("Are you sure?")
                    .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {

                            dbHelper.clearReport();
                            Toast.makeText(context, "Reports removed", Toast.LENGTH_SHORT).show();


                            Intent intent = new Intent(context, MainActivity.class);
                            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                            startActivity(intent);


                        }
                    })
                    .setNegativeButton("No", null)
                    .show();
            return true;
        }
    });
}
 
開發者ID:alewin,項目名稱:moneytracking,代碼行數:29,代碼來源:SettingsActivity.java

示例11: addThemeListener

import android.preference.Preference; //導入方法依賴的package包/類
private void addThemeListener() {
    Preference reset = findPreference("theme");
    reset.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        public boolean onPreferenceClick(Preference pref) {
            recreate();
            return true;
        }
    });
}
 
開發者ID:JaeNuguid,項目名稱:Kids-Portal-Android,代碼行數:10,代碼來源:Activity_settings_app.java

示例12: onCreate

import android.preference.Preference; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle _savedInstanceState) {
    super.onCreate(_savedInstanceState);
    addPreferencesFromResource(R.xml.pref_settings_help);

    mActionBar.setTitle(R.string.settings_information_help_title);

    Preference mainList = findPreference("settings_key_main_list");
    Preference mainMemoCreate = findPreference("settings_key_main_memocreate");
    Preference mainDelete = findPreference("settings_key_main_delete");
    Preference mainOpenFolder = findPreference("settings_key_main_openfolder");
    Preference folderList = findPreference("settings_key_folder_list");
    Preference folderDefault = findPreference("settings_key_folder_default");
    Preference folderCreate = findPreference("settings_key_folder_create");
    Preference folderDelete = findPreference("settings_key_folder_delete");
    Preference folderExternal = findPreference("settings_key_foler_external");
    Preference memoSaveLength = findPreference("settings_key_memo_savelengthlimited");
    Preference memoFontColor = findPreference("settings_key_memo_fontcolor");
    Preference memoEdit = findPreference("settings_key_memo_edit");
    Preference etcAboutHelp = findPreference("settings_key_etc_abouthelp");
    Preference etcBackup = findPreference("settings_key_etc_backup");
    Preference etcFileColor = findPreference("settings_key_etc_filecolor");
    Preference etcPermission = findPreference("settings_key_etc_permission");
    Preference etcAd = findPreference("settings_key_etc_ad");
    Preference etcFontBroken = findPreference("settings_key_etc_fontbroken");
    Preference etcWidget = findPreference("settings_key_etc_widget");

    Preference.OnPreferenceClickListener clickListener = new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference _preference) {
            Intent intent = new Intent();
            intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
            intent.setClass(getActivity(), HelpContentsActivity.class);
            intent.putExtra(Constant.INTENT_EXTRA_HELP_INDEX, _preference.getKey());
            startActivity(intent);
            getActivity().overridePendingTransition(0, 0);
            return false;
        }
    };

    mainList.setOnPreferenceClickListener(clickListener);
    mainMemoCreate.setOnPreferenceClickListener(clickListener);
    mainDelete.setOnPreferenceClickListener(clickListener);
    mainOpenFolder.setOnPreferenceClickListener(clickListener);
    folderExternal.setOnPreferenceClickListener(clickListener);
    folderDelete.setOnPreferenceClickListener(clickListener);
    folderCreate.setOnPreferenceClickListener(clickListener);
    folderDefault.setOnPreferenceClickListener(clickListener);
    folderList.setOnPreferenceClickListener(clickListener);
    memoFontColor.setOnPreferenceClickListener(clickListener);
    memoSaveLength.setOnPreferenceClickListener(clickListener);
    memoEdit.setOnPreferenceClickListener(clickListener);
    etcAboutHelp.setOnPreferenceClickListener(clickListener);
    etcBackup.setOnPreferenceClickListener(clickListener);
    etcFileColor.setOnPreferenceClickListener(clickListener);
    etcPermission.setOnPreferenceClickListener(clickListener);
    etcAd.setOnPreferenceClickListener(clickListener);
    etcFontBroken.setOnPreferenceClickListener(clickListener);
    etcWidget.setOnPreferenceClickListener(clickListener);
}
 
開發者ID:Eskeptor,項目名稱:OpenPad-for-Android,代碼行數:61,代碼來源:SettingsActivity.java

示例13: setConfirmRestore

import android.preference.Preference; //導入方法依賴的package包/類
private void setConfirmRestore() {

            Preference pref = getPreferenceScreen().findPreference("pref_restore_default");
            pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {

                @Override
                public boolean onPreferenceClick(Preference p) {
                    Commons.resetSettingsDefault(getActivity(), false);
                    return true;
                }
            });

        }
 
開發者ID:vaginessa,項目名稱:RepWifiApp,代碼行數:14,代碼來源:SettingsActivity.java

示例14: addSettings_searchMainListener

import android.preference.Preference; //導入方法依賴的package包/類
private void addSettings_searchMainListener() {
    Preference reset = findPreference("settings_searchMain");
    reset.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        public boolean onPreferenceClick(Preference pref) {
            helper_main.switchToActivity(getActivity(), Activity_settings_searchMain.class);
            return true;
        }
    });
}
 
開發者ID:JaeNuguid,項目名稱:Kids-Portal-Android,代碼行數:10,代碼來源:Activity_settings.java

示例15: addSettings_dataListener

import android.preference.Preference; //導入方法依賴的package包/類
private void addSettings_dataListener() {
    Preference reset = findPreference("settings_data");
    reset.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        public boolean onPreferenceClick(Preference pref) {
            helper_main.switchToActivity(getActivity(), Activity_settings_data.class);
            return true;
        }
    });
}
 
開發者ID:JaeNuguid,項目名稱:Kids-Portal-Android,代碼行數:10,代碼來源:Activity_settings.java


注:本文中的android.preference.Preference.setOnPreferenceClickListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。