當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。