當前位置: 首頁>>代碼示例>>Java>>正文


Java EditTextPreference.setSummary方法代碼示例

本文整理匯總了Java中android.preference.EditTextPreference.setSummary方法的典型用法代碼示例。如果您正苦於以下問題:Java EditTextPreference.setSummary方法的具體用法?Java EditTextPreference.setSummary怎麽用?Java EditTextPreference.setSummary使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.preference.EditTextPreference的用法示例。


在下文中一共展示了EditTextPreference.setSummary方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onPreferenceChange

import android.preference.EditTextPreference; //導入方法依賴的package包/類
@Override
public boolean onPreferenceChange(Preference preference, Object value) {
    String stringValue = value.toString();

    if (preference instanceof ListPreference) {
        // For list preferences, look up the correct display value in
        // the preference's 'entries' list.
        ListPreference listPreference = (ListPreference) preference;
        int index = listPreference.findIndexOfValue(stringValue);

        // Set the summary to reflect the new value.
        preference.setSummary(index >= 0 ? listPreference.getEntries()[index] : null);

    } else if (preference instanceof RingtonePreference) {
    } else if (preference instanceof EditTextPreference) {
        EditTextPreference editTextPreference = (EditTextPreference) preference;
        editTextPreference.setSummary(editTextPreference.getText());
    } else {
        // For all other preferences, set the summary to the value's
        // simple string representation.
        preference.setSummary(stringValue);
    }
    return true;
}
 
開發者ID:tranleduy2000,項目名稱:text_converter,代碼行數:25,代碼來源:PreferencesUtil.java

示例2: onSharedPreferenceChanged

import android.preference.EditTextPreference; //導入方法依賴的package包/類
@Override
public void onSharedPreferenceChanged(SharedPreferences preferences,
                                      String key)
{
    if (key.equals(Diary.PREF_FOLDER))
    {
        // Get folder summary
        EditTextPreference folder =
            (EditTextPreference) findPreference(key);

        // Set folder in text view
        folder.setSummary(preferences.getString(key, Diary.DIARY));
    }

    if (key.equals(Diary.PREF_DARK_THEME))
    {
        if (Build.VERSION.SDK_INT != VERSION_M)
            getActivity().recreate();
    }
}
 
開發者ID:billthefarmer,項目名稱:diary,代碼行數:21,代碼來源:SettingsFragment.java

示例3: updatePreference

import android.preference.EditTextPreference; //導入方法依賴的package包/類
private void updatePreference(String key, String newValue){
    if (key.equals(API_KEY)){
        Preference preference = findPreference(key);
        if (preference instanceof EditTextPreference){
            EditTextPreference editTextPreference = (EditTextPreference) preference;
            PreferencesHelper preferencesHelper = new PreferencesHelper(getApplicationContext());
            preferencesHelper.save(API_KEY, newValue);
            if (newValue != null ){
                editTextPreference.setText(newValue);
                editTextPreference.setSummary(newValue);
            }else{
                editTextPreference.setText("");
                editTextPreference.setSummary("");
            }
        }
    }
}
 
開發者ID:throwrocks,項目名稱:android-udacity-reviews,代碼行數:18,代碼來源:SettingsActivity.java

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

示例5: updateSummaries

import android.preference.EditTextPreference; //導入方法依賴的package包/類
private void updateSummaries() {
    EditTextPreference portPref = (EditTextPreference) findPreference("port");
    portPref.setSummary(portPref.getText() + " (on " + getIp() + ")");

    ListPreference camPref = (ListPreference) findPreference("cam");
    camPref.setSummary("Cam " + (Integer.parseInt(camPref.getValue()) + 1));

    ListPreference resPref = (ListPreference) findPreference("resolution");
    resPref.setSummary(resPref.getValue().replace("x", " x "));

    ListPreference rotPref = (ListPreference) findPreference("rotation");
    rotPref.setSummary(rotPref.getEntry());

    EditTextPreference idPref = (EditTextPreference) findPreference("ssdp_id");
    idPref.setSummary(idPref.getText());

    EditTextPreference versionPref = (EditTextPreference) findPreference("app_version");
    versionPref.setSummary(BuildConfig.VERSION_NAME);
}
 
開發者ID:arktronic,項目名稱:cameraserve,代碼行數:20,代碼來源:SettingsActivity.java

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

示例7: setSummaries

import android.preference.EditTextPreference; //導入方法依賴的package包/類
private void setSummaries() {
    final EditTextPreference urlPreference = (EditTextPreference) findPreference(PREF_SERVER_URL);
    urlPreference.setSummary(preferences.getString(PREF_SERVER_URL, this.getResources().getString(R.string.server_url_summary)));

    final String serverPassHash = preferences.getString(PREF_SERVER_PASS_HASH, "");
    final EditTextPreference serverPassTextPreference = (EditTextPreference) findPreference(PREF_SERVER_PASS);
    if (serverPassHash.isEmpty()) {
        serverPassTextPreference.setSummary(getResources().getString(R.string.server_password_summary));
    } else {
        serverPassTextPreference.setSummary(getResources().getString(R.string.server_password_summary_set));
    }

    final EditTextPreference httpLoginPreference = (EditTextPreference) findPreference(PREF_SERVER_HTTP_AUTH_LOGIN);
    httpLoginPreference.setSummary(preferences.getString(PREF_SERVER_HTTP_AUTH_LOGIN, ""));

    final String httpPass = preferences.getString(PREF_SERVER_HTTP_AUTH_PASS,"");
    if (!httpPass.isEmpty()) {
        final EditTextPreference httpPassPreference = (EditTextPreference) findPreference(PREF_SERVER_HTTP_AUTH_PASS);
        httpPassPreference.setSummary(getResources().getString(R.string.server_password_summary_set));
    }
}
 
開發者ID:PhotoBackup,項目名稱:client-android,代碼行數:22,代碼來源:PBServerPreferenceFragment.java

示例8: createPrefAPIURL

import android.preference.EditTextPreference; //導入方法依賴的package包/類
void createPrefAPIURL() {
    EditTextPreference editTextPreference = (EditTextPreference) findPreference("api_url");
    if (defaultConfig != null) {
        editTextPreference.setEnabled(false);
    } else {
        editTextPreference.setEnabled(true);
    }
    if (config.getUrl() == null || config.getUrl().length() == 0)
        editTextPreference.setSummary("(not assigned)");
    else {
        editTextPreference.setSummary(config.getUrl());
    }

    editTextPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, Object newValue) {
            String temp = (String) newValue;
            if (temp == null || temp.length() == 0) return false;
            config.setUrl(temp);
            preference.setSummary(temp);
            return false;
        }
    });
}
 
開發者ID:MD2Korg,項目名稱:mCerebrum-DataKit,代碼行數:25,代碼來源:PrefsFragmentCerebralCortexSettings.java

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

示例10: setPreferenceDefaultValueAndSummary

import android.preference.EditTextPreference; //導入方法依賴的package包/類
private void setPreferenceDefaultValueAndSummary(int pref, String value) {
	if (value != null) {
		EditTextPreference etPref = (EditTextPreference) findPreference(getString(pref));
		if (etPref != null) {
			etPref.setText(value);
			etPref.setSummary(value);
		}
	}
}
 
開發者ID:treasure-lau,項目名稱:Linphone4Android,代碼行數:10,代碼來源:SettingsFragment.java

示例11: initNetworkSettings

import android.preference.EditTextPreference; //導入方法依賴的package包/類
private void initNetworkSettings() {
	((CheckBoxPreference) findPreference(getString(R.string.pref_wifi_only_key))).setChecked(mPrefs.isWifiOnlyEnabled());

	// Disable UPnP if ICE si enabled, or disable ICE if UPnP is enabled
	CheckBoxPreference ice = (CheckBoxPreference) findPreference(getString(R.string.pref_ice_enable_key));
	CheckBoxPreference turn = (CheckBoxPreference) findPreference(getString(R.string.pref_turn_enable_key));
	ice.setChecked(mPrefs.isIceEnabled());
	turn.setEnabled(mPrefs.getStunServer() != null);
	turn.setChecked(mPrefs.isTurnEnabled());

	EditTextPreference turnUsername = (EditTextPreference) findPreference(getString(R.string.pref_turn_username_key));
	EditTextPreference turnPassword = (EditTextPreference) findPreference(getString(R.string.pref_turn_passwd_key));
	turnUsername.setEnabled(mPrefs.isTurnEnabled());
	turnUsername.setSummary(mPrefs.getTurnUsername());
	turnUsername.setText(mPrefs.getTurnUsername());
	turnPassword.setEnabled(mPrefs.isTurnEnabled());

	CheckBoxPreference randomPort = (CheckBoxPreference) findPreference(getString(R.string.pref_transport_use_random_ports_key));
	randomPort.setChecked(mPrefs.isUsingRandomPort());

	// Disable sip port choice if port is random
	EditTextPreference sipPort = (EditTextPreference) findPreference(getString(R.string.pref_sip_port_key));
	sipPort.setEnabled(!randomPort.isChecked());
	sipPort.setSummary(mPrefs.getSipPort());
	sipPort.setText(mPrefs.getSipPort());

	EditTextPreference stun = (EditTextPreference) findPreference(getString(R.string.pref_stun_server_key));
	stun.setSummary(mPrefs.getStunServer());
	stun.setText(mPrefs.getStunServer());

	((CheckBoxPreference) findPreference(getString(R.string.pref_push_notification_key))).setChecked(mPrefs.isPushNotificationEnabled());
	((CheckBoxPreference) findPreference(getString(R.string.pref_ipv6_key))).setChecked(mPrefs.isUsingIpv6());
}
 
開發者ID:treasure-lau,項目名稱:Linphone4Android,代碼行數:34,代碼來源:SettingsFragment.java

示例12: updatePreference

import android.preference.EditTextPreference; //導入方法依賴的package包/類
private void updatePreference(Preference preference) {
    //Mostra corretamente os objetos
    if (preference instanceof ListPreference) {
        ListPreference listPreference = (ListPreference) preference;
        listPreference.setSummary(listPreference.getEntry());
    }
    else if(preference instanceof EditTextPreference)
    {
        EditTextPreference editTextPreference = (EditTextPreference) preference;
        editTextPreference.setSummary(editTextPreference.getText());
    }
}
 
開發者ID:alessandrojean,項目名稱:order-by-android,代碼行數:13,代碼來源:SettingsActivity.java

示例13: onCreate

import android.preference.EditTextPreference; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Load the preferences from an XML resource
    addPreferencesFromResource(R.xml.preferences);

    final Preference infoButton = findPreference("info_button");
    final Preference timetablesButton = findPreference("manage_timetables_button");
    final EditTextPreference syncRangeFuture = (EditTextPreference) findPreference("sync_range_future");
    final EditTextPreference syncRangePast = (EditTextPreference) findPreference("sync_range_past");

    timetablesButton.setOnPreferenceClickListener(preference -> {
        Intent i = new Intent(getActivity(), ManageTimetablesActivity.class);
        startActivity(i);
        getActivity().overridePendingTransition(0, 0);
        return true;
    });

    infoButton.setOnPreferenceClickListener(preference -> {
        InfoDialog.newInstance("About DHBW Timetable", "This app is a project from students of the DHBW Stuttgart.\n\nIt's deployed with\n\nNO WARRANTY\n\nfor correctness or availability.\n\nHendrik Ulbrich, Malte Bartels (c) 2017\n\nhttp://ec.europa.eu/justice/data-protection/article-29/documentation/opinion-recommendation/files/2013/wp202_en.pdf").show(getFragmentManager(), "info");
        return true;
    });

    syncRangeFuture.setSummary(Integer.parseInt(syncRangeFuture.getText()) + " weeks");
    syncRangeFuture.setOnPreferenceChangeListener((preference, newValue) -> {
        syncRangeFuture.setSummary(newValue + " weeks");
        onSyncRangeChange();
        return true;
    });

    syncRangePast.setSummary(Integer.parseInt(syncRangePast.getText()) + " weeks");
    syncRangePast.setOnPreferenceChangeListener((preference, newValue) -> {
        syncRangePast.setSummary(newValue + " weeks");
        onSyncRangeChange();
        return true;
    });

    setHasOptionsMenu(true);
}
 
開發者ID:dhbw-timetable,項目名稱:dhbw-timetable-android,代碼行數:41,代碼來源:PreferencesActivity.java

示例14: updateSummary

import android.preference.EditTextPreference; //導入方法依賴的package包/類
private void updateSummary(String key) {
    switch (key) {
        case "httpProxyServer":
        case "httpProxyPort":
            EditTextPreference editTextPreference = (EditTextPreference) findPreference(key);
            if (editTextPreference != null) {
                editTextPreference.setSummary(editTextPreference.getText());
            }
            break;
        default:
    }
}
 
開發者ID:Vavassor,項目名稱:Tusky,代碼行數:13,代碼來源:PreferencesFragment.java

示例15: onCreate

import android.preference.EditTextPreference; //導入方法依賴的package包/類
@Override
public final void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    addPreferencesFromResource(R.xml.preferences);
    vlcIpAddressPref = (EditTextPreference) findPreference(
            Pref.VLC_IP_ADDRESS);
    vlcPortPref = (EditTextPreference) findPreference(Pref.VLC_PORT);

    // Initialize summaries
    SharedPreferences sharedPref = PreferenceManager
            .getDefaultSharedPreferences(getActivity());
    vlcIpAddressPref.setSummary(sharedPref.getString(
            Pref.VLC_IP_ADDRESS, ""));
    vlcPortPref.setSummary(sharedPref.getString(Pref.VLC_PORT, ""));

    // About
    Preference aboutPref = findPreference(Pref.ABOUT);
    aboutPref.setOnPreferenceClickListener(
            new Preference.OnPreferenceClickListener() {
                @Override
                public boolean onPreferenceClick(
                        final Preference preference) {
                    startActivity(new Intent(getActivity(),
                            AboutActivity.class));
                    return false;
                }
            });
}
 
開發者ID:Alkisum,項目名稱:SofaTime,代碼行數:30,代碼來源:SettingsActivity.java


注:本文中的android.preference.EditTextPreference.setSummary方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。