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


Java EditTextPreference.setKey方法代码示例

本文整理汇总了Java中android.preference.EditTextPreference.setKey方法的典型用法代码示例。如果您正苦于以下问题:Java EditTextPreference.setKey方法的具体用法?Java EditTextPreference.setKey怎么用?Java EditTextPreference.setKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.preference.EditTextPreference的用法示例。


在下文中一共展示了EditTextPreference.setKey方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createEditTextPreference

import android.preference.EditTextPreference; //导入方法依赖的package包/类
/**
 * Create an EditTextPreference for the specified preference
 * @param titleResId resource ID to use for the title
 * @param key preference key
 * @return newly created preference
 */
private EditTextPreference createEditTextPreference(@StringRes int titleResId, Settings.Key key) {
    final EditTextPreference editTextPreference = new EditTextPreference(getActivity());
    editTextPreference.setDefaultValue(mSettings.getDefault(key));
    editTextPreference.setKey(key.name());
    editTextPreference.setSummary(mSettings.getString(key));
    editTextPreference.setTitle(titleResId);
    editTextPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, Object newValue) {
            editTextPreference.setSummary((String) newValue);
            return true;
        }
    });
    return editTextPreference;
}
 
开发者ID:nitroshare,项目名称:nitroshare-android,代码行数:22,代码来源:SettingsActivity.java

示例2: addPasswordPreference

import android.preference.EditTextPreference; //导入方法依赖的package包/类
/**
 * Добавить в группу параметров (на экран/в категорию) параметр задания пароля для удаления постов/файлов
 * @param group группа, на которую добавляется параметр
 */
protected void addPasswordPreference(PreferenceGroup group) {
    final Context context = group.getContext();
    EditTextPreference passwordPref = new EditTextPreference(context) {
        @Override
        protected void showDialog(Bundle state) {
            if (createPassword()) {
                setText(getDefaultPassword());
            }
            super.showDialog(state);
        }
    };
    passwordPref.setTitle(R.string.pref_password_title);
    passwordPref.setDialogTitle(R.string.pref_password_title);
    passwordPref.setSummary(R.string.pref_password_summary);
    passwordPref.setKey(getSharedKey(PREF_KEY_PASSWORD));
    passwordPref.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
    passwordPref.getEditText().setSingleLine();
    passwordPref.getEditText().setFilters(new InputFilter[] { new InputFilter.LengthFilter(255) });
    group.addPreference(passwordPref);
}
 
开发者ID:miku-nyan,项目名称:Overchan-Android,代码行数:25,代码来源:AbstractChanModule.java

示例3: addDomainPreferences

import android.preference.EditTextPreference; //导入方法依赖的package包/类
private void addDomainPreferences(PreferenceGroup group) {
    Context context = group.getContext();
    Preference.OnPreferenceChangeListener updateDomainListener = new Preference.OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, Object newValue) {
            if (preference.getKey().equals(getSharedKey(PREF_KEY_DOMAIN))) {
                domain = (String) newValue;
                if (domain.length() == 0) domain = DEFAULT_DOMAIN;
                loadHanabiraCookie();
                return true;
            }
            return false;
        }
    };
    EditTextPreference domainPref = new EditTextPreference(context);
    domainPref.setTitle(R.string.pref_domain);
    domainPref.setDialogTitle(R.string.pref_domain);
    domainPref.setSummary(resources.getString(R.string.pref_domain_summary, DOMAINS_HINT));
    domainPref.setKey(getSharedKey(PREF_KEY_DOMAIN));
    domainPref.getEditText().setHint(DEFAULT_DOMAIN);
    domainPref.getEditText().setSingleLine();
    domainPref.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI);
    domainPref.setOnPreferenceChangeListener(updateDomainListener);
    group.addPreference(domainPref);
}
 
开发者ID:miku-nyan,项目名称:Overchan-Android,代码行数:26,代码来源:DobroModule.java

示例4: addKompturcodePreference

import android.preference.EditTextPreference; //导入方法依赖的package包/类
public void addKompturcodePreference(PreferenceGroup preferenceGroup) {
    Context context = preferenceGroup.getContext();
    EditTextPreference kompturcodePreference = new EditTextPreference(context);
    kompturcodePreference.setTitle(R.string.kraut_prefs_kompturcode);
    kompturcodePreference.setDialogTitle(R.string.kraut_prefs_kompturcode);
    kompturcodePreference.setSummary(R.string.kraut_prefs_kompturcode_summary);
    kompturcodePreference.setKey(getSharedKey(PREF_KEY_KOMPTURCODE_COOKIE));
    kompturcodePreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, Object newValue) {
            setKompturcodeCookie((String) newValue);
            return true;
        }
    });
    preferenceGroup.addPreference(kompturcodePreference);
}
 
开发者ID:miku-nyan,项目名称:Overchan-Android,代码行数:17,代码来源:KrautModule.java

示例5: addPreferencesOnScreen

import android.preference.EditTextPreference; //导入方法依赖的package包/类
@Override
public void addPreferencesOnScreen(PreferenceGroup preferenceGroup) {
    Context context = preferenceGroup.getContext();
    addPasswordPreference(preferenceGroup);
    CheckBoxPreference onionPref = new LazyPreferences.CheckBoxPreference(context);
    onionPref.setTitle(R.string.pref_use_onion);
    onionPref.setSummary(R.string.pref_use_onion_summary);
    onionPref.setKey(getSharedKey(PREF_KEY_USE_ONION));
    onionPref.setDefaultValue(false);
    onionPref.setDisableDependentsState(true);
    preferenceGroup.addPreference(onionPref);
    EditTextPreference domainPref = new EditTextPreference(context);
    domainPref.setTitle(R.string.pref_domain);
    domainPref.setDialogTitle(R.string.pref_domain);
    domainPref.setSummary(resources.getString(R.string.pref_domain_summary, DOMAINS_HINT));
    domainPref.setKey(getSharedKey(PREF_KEY_DOMAIN));
    domainPref.getEditText().setHint(DEFAULT_DOMAIN);
    domainPref.getEditText().setSingleLine();
    domainPref.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI);
    preferenceGroup.addPreference(domainPref);
    domainPref.setDependency(getSharedKey(PREF_KEY_USE_ONION));
    addProxyPreferences(preferenceGroup);
}
 
开发者ID:miku-nyan,项目名称:Overchan-Android,代码行数:24,代码来源:DvachModule.java

示例6: createUsernamePref

import android.preference.EditTextPreference; //导入方法依赖的package包/类
private void createUsernamePref() {
    EditTextPreference userPref = new EditTextPreference(mSettAct);
    userPref.setTitle(mSettAct.getString(R.string.sett_username));
    userPref.setSummary(mSettAct.getString(R.string.sett_usernameSumm));
    userPref.setKey(mSettAct.getString(R.string.sett_key_username));
    userPref.setDefaultValue("");
    userPref.getEditText().setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
    userPref.getEditText().setInputType(EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS | EditorInfo.TYPE_TEXT_VARIATION_PERSON_NAME);
    allPrefs.add(userPref);
}
 
开发者ID:PicFrame,项目名称:picframe,代码行数:11,代码来源:OwnCloudPrefs.java

示例7: createPasswordPref

import android.preference.EditTextPreference; //导入方法依赖的package包/类
private void createPasswordPref() {
    EditTextPreference passordPref = new EditTextPreference(mSettAct);
    passordPref.setTitle(mSettAct.getString(R.string.sett_password));
    passordPref.setSummary(mSettAct.getString(R.string.sett_passwordSumm));
    passordPref.setKey(mSettAct.getString(R.string.sett_key_password));
    passordPref.setDefaultValue("");
    passordPref.getEditText().setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
    passordPref.getEditText().setInputType(EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS | EditorInfo.TYPE_TEXT_VARIATION_PASSWORD);
    allPrefs.add(passordPref);
}
 
开发者ID:PicFrame,项目名称:picframe,代码行数:11,代码来源:OwnCloudPrefs.java

示例8: addProxyPreferences

import android.preference.EditTextPreference; //导入方法依赖的package包/类
/**
 * Добавить в группу параметров (на экран/в категорию) новую категорию настроек прокси-сервера
 * @param group группа, на которую добавляются параметры
 */
protected void addProxyPreferences(PreferenceGroup group) {
    final Context context = group.getContext();
    PreferenceCategory proxyCat = new PreferenceCategory(context); //категория настроек прокси
    proxyCat.setTitle(R.string.pref_cat_proxy);
    group.addPreference(proxyCat);
    CheckBoxPreference useProxyPref = new LazyPreferences.CheckBoxPreference(context); //чекбокс "использовать ли прокси вообще"
    useProxyPref.setTitle(R.string.pref_use_proxy);
    useProxyPref.setSummary(R.string.pref_use_proxy_summary);
    useProxyPref.setKey(getSharedKey(PREF_KEY_USE_PROXY));
    useProxyPref.setDefaultValue(false);
    useProxyPref.setOnPreferenceChangeListener(updateHttpListener);
    proxyCat.addPreference(useProxyPref);
    EditTextPreference proxyHostPref = new LazyPreferences.EditTextPreference(context); //поле ввода адреса прокси-сервера
    proxyHostPref.setTitle(R.string.pref_proxy_host);
    proxyHostPref.setDialogTitle(R.string.pref_proxy_host);
    proxyHostPref.setSummary(R.string.pref_proxy_host_summary);
    proxyHostPref.setKey(getSharedKey(PREF_KEY_PROXY_HOST));
    proxyHostPref.setDefaultValue(DEFAULT_PROXY_HOST);
    proxyHostPref.getEditText().setSingleLine();
    proxyHostPref.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI);
    proxyHostPref.setOnPreferenceChangeListener(updateHttpListener);
    proxyCat.addPreference(proxyHostPref);
    proxyHostPref.setDependency(getSharedKey(PREF_KEY_USE_PROXY));
    EditTextPreference proxyHostPort = new LazyPreferences.EditTextPreference(context); //поле ввода порта прокси-сервера
    proxyHostPort.setTitle(R.string.pref_proxy_port);
    proxyHostPort.setDialogTitle(R.string.pref_proxy_port);
    proxyHostPort.setSummary(R.string.pref_proxy_port_summary);
    proxyHostPort.setKey(getSharedKey(PREF_KEY_PROXY_PORT));
    proxyHostPort.setDefaultValue(DEFAULT_PROXY_PORT);
    proxyHostPort.getEditText().setSingleLine();
    proxyHostPort.getEditText().setInputType(InputType.TYPE_CLASS_NUMBER);
    proxyHostPort.setOnPreferenceChangeListener(updateHttpListener);
    proxyCat.addPreference(proxyHostPort);
    proxyHostPort.setDependency(getSharedKey(PREF_KEY_USE_PROXY));
}
 
开发者ID:miku-nyan,项目名称:Overchan-Android,代码行数:40,代码来源:AbstractChanModule.java

示例9: addPreferencesOnScreen

import android.preference.EditTextPreference; //导入方法依赖的package包/类
@Override
public void addPreferencesOnScreen(PreferenceGroup preferenceGroup) {
    final Context context = preferenceGroup.getContext();
    EditTextPreference passwordPref = new EditTextPreference(context);
    passwordPref.setTitle(R.string.iichan_prefs_report_thread);
    passwordPref.setDialogTitle(R.string.iichan_prefs_report_thread);
    passwordPref.setSummary(R.string.iichan_prefs_report_thread_summary);
    passwordPref.setKey(getSharedKey(PREF_KEY_REPORT_THREAD));
    passwordPref.getEditText().setInputType(InputType.TYPE_CLASS_NUMBER);
    passwordPref.getEditText().setSingleLine();
    passwordPref.getEditText().setFilters(new InputFilter[] { new InputFilter.LengthFilter(255) });
    preferenceGroup.addPreference(passwordPref);
    
    super.addPreferencesOnScreen(preferenceGroup);
}
 
开发者ID:miku-nyan,项目名称:Overchan-Android,代码行数:16,代码来源:CirnoModule.java

示例10: addDomainPreference

import android.preference.EditTextPreference; //导入方法依赖的package包/类
private void addDomainPreference(PreferenceGroup group) {
    Context context = group.getContext();
    EditTextPreference domainPref = new EditTextPreference(context);
    domainPref.setTitle(R.string.pref_domain);
    domainPref.setSummary(resources.getString(R.string.pref_domain_summary, DOMAINS_HINT));
    domainPref.setDialogTitle(R.string.pref_domain);
    domainPref.setKey(getSharedKey(PREF_KEY_DOMAIN));
    domainPref.getEditText().setHint(DEFAULT_DOMAIN);
    domainPref.getEditText().setSingleLine();
    domainPref.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI);
    group.addPreference(domainPref);
}
 
开发者ID:miku-nyan,项目名称:Overchan-Android,代码行数:13,代码来源:NullchanccModule.java

示例11: addDomainPreferences

import android.preference.EditTextPreference; //导入方法依赖的package包/类
/** Добавить категорию настроек домена (в т.ч. https) */
private void addDomainPreferences(PreferenceGroup group) {
    Context context = group.getContext();
    Preference.OnPreferenceChangeListener updateDomainListener = new Preference.OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, Object newValue) {
            if (preference.getKey().equals(getSharedKey(PREF_KEY_DOMAIN))) {
                updateDomain((String) newValue, preferences.getBoolean(getSharedKey(PREF_KEY_USE_HTTPS_MAKABA), true));
                return true;
            } else if (preference.getKey().equals(getSharedKey(PREF_KEY_USE_HTTPS_MAKABA))) {
                updateDomain(preferences.getString(getSharedKey(PREF_KEY_DOMAIN), DEFAULT_DOMAIN), (boolean)newValue);
                return true;
            }
            return false;
        }
    };
    PreferenceCategory domainCat = new PreferenceCategory(context);
    domainCat.setTitle(R.string.makaba_prefs_domain_category);
    group.addPreference(domainCat);
    EditTextPreference domainPref = new EditTextPreference(context); //поле ввода домена
    domainPref.setTitle(R.string.pref_domain);
    domainPref.setDialogTitle(R.string.pref_domain);
    domainPref.setSummary(resources.getString(R.string.pref_domain_summary, DOMAINS_HINT));
    domainPref.setKey(getSharedKey(PREF_KEY_DOMAIN));
    domainPref.getEditText().setHint(DEFAULT_DOMAIN);
    domainPref.getEditText().setSingleLine();
    domainPref.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI);
    domainPref.setOnPreferenceChangeListener(updateDomainListener);
    domainCat.addPreference(domainPref);
    CheckBoxPreference httpsPref = new LazyPreferences.CheckBoxPreference(context); //чекбокс "использовать https"
    httpsPref.setTitle(R.string.pref_use_https);
    httpsPref.setSummary(R.string.pref_use_https_summary);
    httpsPref.setKey(getSharedKey(PREF_KEY_USE_HTTPS_MAKABA));
    httpsPref.setDefaultValue(true);
    httpsPref.setOnPreferenceChangeListener(updateDomainListener);
    domainCat.addPreference(httpsPref);
}
 
开发者ID:miku-nyan,项目名称:Overchan-Android,代码行数:38,代码来源:MakabaModule.java

示例12: createUrlPref

import android.preference.EditTextPreference; //导入方法依赖的package包/类
private void createUrlPref() {
    EditTextPreference mySrcPathPref = new EditTextPreference(mSettAct);
    mySrcPathPref.setTitle(R.string.sett_srcPath_OwnCloud);
    mySrcPathPref.setSummary(R.string.sett_srcPath_OwnCloudSumm);
    String srcDefault = "https://";
    Object obj = SettingsDefaults.getDefaultValueForKey(R.string.sett_key_srcpath_owncloud);
    if (obj instanceof String) {
        srcDefault = (String) obj;
    }
    mySrcPathPref.setDefaultValue(srcDefault);
    mySrcPathPref.setKey(mSettAct.getString(R.string.sett_key_srcpath_owncloud));
    mySrcPathPref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, Object newValue) {
            if (newValue.toString().endsWith(File.separator)) {
                Toast
                        .makeText(
                                mSettAct,
                                R.string.sett_toast_wrongUrl,
                                Toast.LENGTH_SHORT)
                        .show();
                return false;
            }
            AlertDialog.Builder myDialQBuilder = new AlertDialog.Builder(mSettAct);
            myDialQBuilder.setMessage(R.string.sett_dialog_changedURL_message) //
                    .setNegativeButton(R.string.sett_deleteDataDialog_negBtn, null)
                    .setPositiveButton(R.string.sett_deleteDataDialog_posBtn,
                            new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    Toast
                                            .makeText(mSettAct, R.string.sett_toast_delFiles, Toast.LENGTH_SHORT)
                                            .show();
                                    GlobalPhoneFuncs.recursiveDeletionInBackgroundThread(
                                            new File(AppData.getExtFolderAppRoot()),
                                            false);
                                }
                            });
            myDialQBuilder.show();
            return true;
        }
    });
    mySrcPathPref.getEditText().setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
    allPrefs.add(mySrcPathPref);
}
 
开发者ID:PicFrame,项目名称:picframe,代码行数:46,代码来源:OwnCloudPrefs.java

示例13: edit

import android.preference.EditTextPreference; //导入方法依赖的package包/类
private EditTextPreference edit() {
    EditTextPreference pref = new EditTextPreference(a);
    pref.setKey(EDIT);
    return pref;
}
 
开发者ID:pushbit,项目名称:sprockets-android,代码行数:6,代码来源:SprocketsPreferenceFragmentTest.java


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