当前位置: 首页>>代码示例>>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;未经允许,请勿转载。