本文整理汇总了Java中android.preference.Preference.setIntent方法的典型用法代码示例。如果您正苦于以下问题:Java Preference.setIntent方法的具体用法?Java Preference.setIntent怎么用?Java Preference.setIntent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.preference.Preference
的用法示例。
在下文中一共展示了Preference.setIntent方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.preference.Preference; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
Preference search = findPreference(SEARCH_KEY);
Preference help = findPreference(HELP_KEY);
initializeLists();
getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
search.setOnPreferenceClickListener(new OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
DuckDuckGoSettings.this.onSearchRequested();
return true;
}
});
help.setIntent(new Intent(this, Help.class));
}
示例2: 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);
}
}
}
示例3: initializeDefaultPreference
import android.preference.Preference; //导入方法依赖的package包/类
private void initializeDefaultPreference() {
if (VERSION.SDK_INT < VERSION_CODES.KITKAT) return;
Preference defaultPreference = findPreference(KITKAT_DEFAULT_PREF);
if (Util.isDefaultSmsProvider(getActivity())) {
defaultPreference.setIntent(new Intent(Settings.ACTION_WIRELESS_SETTINGS));
defaultPreference.setTitle(getString(R.string.ApplicationPreferencesActivity_sms_enabled));
defaultPreference.setSummary(getString(R.string.ApplicationPreferencesActivity_touch_to_change_your_default_sms_app));
} else {
Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT);
intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, getActivity().getPackageName());
defaultPreference.setIntent(intent);
defaultPreference.setTitle(getString(R.string.ApplicationPreferencesActivity_sms_disabled));
defaultPreference.setSummary(getString(R.string.ApplicationPreferencesActivity_touch_to_make_signal_your_default_sms_app));
}
}
示例4: createUserDictionaryPreference
import android.preference.Preference; //导入方法依赖的package包/类
/**
* Create a single User Dictionary Preference object, with its parameters set.
* @param localeString The locale for which this user dictionary is for.
* @return The corresponding preference.
*/
protected Preference createUserDictionaryPreference(@Nullable final String localeString) {
final Preference newPref = new Preference(getActivity());
final Intent intent = new Intent(USER_DICTIONARY_SETTINGS_INTENT_ACTION);
if (null == localeString) {
newPref.setTitle(Locale.getDefault().getDisplayName());
} else {
if (localeString.isEmpty()) {
newPref.setTitle(getString(R.string.user_dict_settings_all_languages));
} else {
newPref.setTitle(
LocaleUtils.constructLocaleFromString(localeString).getDisplayName());
}
intent.putExtra("locale", localeString);
newPref.getExtras().putString("locale", localeString);
}
newPref.setIntent(intent);
newPref.setFragment(UserDictionarySettings.class.getName());
return newPref;
}
示例5: init
import android.preference.Preference; //导入方法依赖的package包/类
/**
* Initialize internal states of this object.
*
* @param context the context for this application.
* @param prefScreen a PreferenceScreen of PreferenceActivity or PreferenceFragment.
* @return true if this application is an IME and has two or more subtypes, false otherwise.
*/
public boolean init(final Context context, final PreferenceScreen prefScreen) {
mImm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
mImi = getMyImi(context, mImm);
if (mImi == null || mImi.getSubtypeCount() <= 1) {
return false;
}
final Intent intent = new Intent(Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS);
intent.putExtra(Settings.EXTRA_INPUT_METHOD_ID, mImi.getId());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
| Intent.FLAG_ACTIVITY_CLEAR_TOP);
mSubtypeEnablerPreference = new Preference(context);
mSubtypeEnablerPreference.setIntent(intent);
prefScreen.addPreference(mSubtypeEnablerPreference);
updateSubtypeEnabler();
return true;
}
示例6: initializePlatformSpecificOptions
import android.preference.Preference; //导入方法依赖的package包/类
private void initializePlatformSpecificOptions() {
PreferenceScreen preferenceScreen = getPreferenceScreen();
Preference defaultPreference = findPreference(KITKAT_DEFAULT_PREF);
Preference allSmsPreference = findPreference(TextSecurePreferences.ALL_SMS_PREF);
Preference allMmsPreference = findPreference(TextSecurePreferences.ALL_MMS_PREF);
Preference manualMmsPreference = findPreference(MMS_PREF);
if (VERSION.SDK_INT >= VERSION_CODES.KITKAT) {
if (allSmsPreference != null) preferenceScreen.removePreference(allSmsPreference);
if (allMmsPreference != null) preferenceScreen.removePreference(allMmsPreference);
if (Util.isDefaultSmsProvider(getActivity())) {
defaultPreference.setIntent(new Intent(Settings.ACTION_WIRELESS_SETTINGS));
defaultPreference.setTitle(getString(R.string.ApplicationPreferencesActivity_sms_enabled));
defaultPreference.setSummary(getString(R.string.ApplicationPreferencesActivity_touch_to_change_your_default_sms_app));
} else {
Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT);
intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, getActivity().getPackageName());
defaultPreference.setIntent(intent);
defaultPreference.setTitle(getString(R.string.ApplicationPreferencesActivity_sms_disabled));
defaultPreference.setSummary(getString(R.string.ApplicationPreferencesActivity_touch_to_make_signal_your_default_sms_app));
}
} else if (defaultPreference != null) {
preferenceScreen.removePreference(defaultPreference);
}
if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP && manualMmsPreference != null) {
preferenceScreen.removePreference(manualMmsPreference);
}
}
示例7: updateServers
import android.preference.Preference; //导入方法依赖的package包/类
private void updateServers()
{
category.removeAll();
List<String> servers = preferences.listServers();
Collections.sort(servers);
for(final String server : servers)
{
Preference preference = new Preference(this);
preference.setTitle(server);
Intent intent = new Intent(this, ServerPreferencesScreen.class);
intent.putExtra("server", server);
preference.setIntent(intent);
category.addPreference(preference);
}
}
示例8: setPreferenceScreenType
import android.preference.Preference; //导入方法依赖的package包/类
private void setPreferenceScreenType(Class<?> classObj, String key, int type) {
Preference pf = findPreference(key);
Intent it = new Intent(this, classObj);
it.putExtra(PrefsLogic.EXTRA_PREFERENCE_TYPE, type);
pf.setIntent(it);
}