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


Java EditTextPreference.setTitle方法代码示例

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


在下文中一共展示了EditTextPreference.setTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: onCreate

import android.preference.EditTextPreference; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.application_preference);
    getPreferenceScreen().getSharedPreferences().
            registerOnSharedPreferenceChangeListener(this);

    EditTextPreference versionPref = (EditTextPreference) findPreference("app_version");
    versionPref.setTitle(getString(R.string.version, Utils.getAppVersionName(this)));
}
 
开发者ID:googlecast,项目名称:CastVideos-android,代码行数:12,代码来源:CastPreference.java

示例7: onCreate

import android.preference.EditTextPreference; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.preferences);

    final EditTextPreference username = (EditTextPreference) getPreferenceManager().findPreference("username_preference");

    // Set the title to include the username if there is one
    if( username.getText().length() > 0 )
        username.setTitle("Username (" + username.getText() + ")");

    // This big block of code is equivalent to s/[^A-Za-z0-9_]//g
    InputFilter usernameFilter = new InputFilter() {
        public CharSequence filter(CharSequence source, int start, int end,
                                   Spanned dest, int dstart, int dend) {
            for (int i = start; i < end; i++) {
                if (!Character.isLetterOrDigit(source.charAt(i)) && source.charAt(i) != '_' ) {
                    return "";
                }
            }
            return null;
        }
    };
    username.getEditText().setFilters(new InputFilter[] { usernameFilter });

    // Set a callback so we can update the username text when user changes it
    username.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, Object newValue) {
            if( newValue.toString().length() > 0 )
                preference.setTitle("Username (" + newValue.toString() + ")");
            else
                preference.setTitle("Username");
            Log.d("PREFERENCES", "Updated username to: " + newValue.toString());
            return true; // Returning true commits the change
        }
    });

    Log.d("Settings", "Starting settings.");
}
 
开发者ID:DaylightingSociety,项目名称:WhereAreTheEyes,代码行数:41,代码来源:SettingsActivity.java

示例8: onCreate

import android.preference.EditTextPreference; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.application_preference);
    getPreferenceScreen().getSharedPreferences().
            registerOnSharedPreferenceChangeListener(this);
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);

    EditTextPreference versionPref = (EditTextPreference) findPreference("app_version");
    versionPref.setTitle(getString(R.string.version, Utils.getAppVersionName(this)));
}
 
开发者ID:googlecodelabs,项目名称:cast-videos-android,代码行数:13,代码来源:CastPreference.java

示例9: onCreate

import android.preference.EditTextPreference; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.application_preference);
    mCastManager = VideoApplication.getCastManager(this);

    EditTextPreference versionPref = (EditTextPreference) findPreference("app_version");
    versionPref.setTitle(getString(R.string.version, Utils.getAppVersionName(this),
            getString(R.string.ccl_version)));
}
 
开发者ID:BruGTUG,项目名称:codelab-chromecast,代码行数:12,代码来源:CastPreference.java

示例10: onCreate

import android.preference.EditTextPreference; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.application_preference);
    mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
    mPrefs.registerOnSharedPreferenceChangeListener(this);

    EditTextPreference versionPref = (EditTextPreference) findPreference("app_version");
    versionPref.setTitle(getString(R.string.version, Utils.getAppVersionName(this)));
}
 
开发者ID:BruGTUG,项目名称:codelab-chromecast,代码行数:12,代码来源:CastPreference.java

示例11: onCreate

import android.preference.EditTextPreference; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.application_preference);
    EditTextPreference versionPref = (EditTextPreference) findPreference("app_version");
    versionPref.setTitle(getString(R.string.version, Utils.getAppVersionName(this)));
}
 
开发者ID:BruGTUG,项目名称:codelab-chromecast,代码行数:9,代码来源:CastPreference.java

示例12: onCreate

import android.preference.EditTextPreference; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.application_preference);
    mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
    mPrefs.registerOnSharedPreferenceChangeListener(this);
    mCastManager = CastApplication.getCastManager(this);

    // -- Termination Policy -------------------//
    mTerminationListPreference = (ListPreference) getPreferenceScreen().findPreference(
            TERMINATION_POLICY_KEY);
    mTerminationListPreference.setSummary(getTerminationSummary(mPrefs));
    mCastManager.setStopOnDisconnect(mStopOnExit);

    // -- Volume settings ----------------------//
    mVolumeListPreference = (ListPreference) getPreferenceScreen()
            .findPreference(VOLUME_SELCTION_KEY);
    String volValue = mPrefs.getString(
            VOLUME_SELCTION_KEY, getString(R.string.prefs_volume_default));
    String volSummary = getResources().getString(R.string.prefs_volume_title_summary, volValue);
    mVolumeListPreference.setSummary(volSummary);

    EditTextPreference versionPref = (EditTextPreference) findPreference("app_version");
    versionPref.setTitle(getString(R.string.version, Utils.getAppVersionName(this),
            getString(R.string.ccl_version)));
}
 
开发者ID:BruGTUG,项目名称:codelab-chromecast,代码行数:28,代码来源:CastPreference.java

示例13: onCreate

import android.preference.EditTextPreference; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.application_preference);

    EditTextPreference versionPref = (EditTextPreference) findPreference("app_version");
    versionPref.setTitle(getString(R.string.version, Utils.getAppVersionName(this)));
}
 
开发者ID:BruGTUG,项目名称:codelab-chromecast,代码行数:10,代码来源:CastPreference.java

示例14: 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

示例15: 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


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