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


Java Preference.setSummary方法代码示例

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


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

示例1: onCreate

import android.preference.Preference; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getActivity().setTitle(R.string.prefs_about_chrome);
    addPreferencesFromResource(R.xml.about_chrome_preferences);

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        ChromeBasePreference deprecationWarning = new ChromeBasePreference(
                new ContextThemeWrapper(getActivity(),
                        R.style.DeprecationWarningPreferenceTheme));
        deprecationWarning.setOrder(-1);
        deprecationWarning.setTitle(R.string.deprecation_warning);
        deprecationWarning.setIcon(R.drawable.exclamation_triangle);
        getPreferenceScreen().addPreference(deprecationWarning);
    }

    PrefServiceBridge prefServiceBridge = PrefServiceBridge.getInstance();
    AboutVersionStrings versionStrings = prefServiceBridge.getAboutVersionStrings();
    Preference p = findPreference(PREF_APPLICATION_VERSION);
    p.setSummary(getApplicationVersion(getActivity(), versionStrings.getApplicationVersion()));
    p = findPreference(PREF_OS_VERSION);
    p.setSummary(versionStrings.getOSVersion());
    p = findPreference(PREF_LEGAL_INFORMATION);
    int currentYear = Calendar.getInstance().get(Calendar.YEAR);
    p.setSummary(getString(R.string.legal_information_summary, currentYear));
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:27,代码来源:AboutChromePreferences.java

示例2: refreshPreferences

import android.preference.Preference; //导入方法依赖的package包/类
private void refreshPreferences() {
    mProfiles.removeAll();

    mSingleSettings = SambaConfiguration.getSingleSettingList();
    int length = mSingleSettings.size();
    Activity activity = getActivity();
    for (int index = 0; index < length; index++) {
        String section = mSingleSettings.get(index);
        SambaSingleSetting sss = SambaConfiguration.getSingleSetting(section);
        Preference pref = new Preference(activity);
        pref.setTitle(section);
        pref.setSummary(sss.getUsername());
        pref.setOrder(index);
        mProfiles.addPreference(pref);
    }
}
 
开发者ID:archos-sa,项目名称:aos-FileCoreLibrary,代码行数:17,代码来源:SambaPreferencesFragment.java

示例3: onPreferenceChange

import android.preference.Preference; //导入方法依赖的package包/类
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
	String value = newValue.toString();
	if (isNewAccount) {
		builder.setProxy(newValue.toString());
		preference.setSummary(newValue.toString());
	} else {
		mPrefs.setAccountProxy(n, value);
		preference.setSummary(mPrefs.getAccountProxy(n));

		if (mTransportPreference != null) {
			mTransportPreference.setSummary(mPrefs.getAccountTransportString(n));
			mTransportPreference.setValue(mPrefs.getAccountTransportKey(n));
		}
	}
	return true;
}
 
开发者ID:treasure-lau,项目名称:Linphone4Android,代码行数:18,代码来源:AccountPreferencesFragment.java

示例4: onPreferenceChange

import android.preference.Preference; //导入方法依赖的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 {
        // For all other preferences, set the summary to the value's
        // simple string representation.
        preference.setSummary(stringValue);
    }
    return true;
}
 
开发者ID:mmlevin,项目名称:C500Companion,代码行数:24,代码来源:SettingsActivity.java

示例5: onPreferenceChange

import android.preference.Preference; //导入方法依赖的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,项目名称:javaide,代码行数:25,代码来源:PreferencesUtil.java

示例6: onPreferenceChange

import android.preference.Preference; //导入方法依赖的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 {
        // For all other preferences, set the summary to the value's
        // simple string representation.
        preference.setSummary(stringValue);
    }
    return true;
}
 
开发者ID:SenorSid,项目名称:SensorDataVisualizer,代码行数:23,代码来源:SettingSensorDataActivity.java

示例7: onPreferenceChange

import android.preference.Preference; //导入方法依赖的package包/类
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
    String stringValue = newValue.toString();

    //only used the first "load". Subsequent changes not because in SeekbarPreferences don't call
    //to update listeners
    if (preference instanceof SeekBarPreference) {
        preference.setSummary(("" + stringValue + " Km"));


    } else if (preference instanceof Preference) {
        String key = preference.getKey();
        //we take the versionName and assign it to the pref var.
        if (key == getString(R.string.pref_version_key)) {
            String versionName;
            try {
                versionName = getActivity().getPackageManager().getPackageInfo(
                        getActivity().getPackageName(), 0).versionName;

            } catch (PackageManager.NameNotFoundException e) {
                versionName = null;
            }
            preference.setSummary(versionName);

        }
    }
    return true;
}
 
开发者ID:cahergil,项目名称:Farmacias,代码行数:29,代码来源:SettingsFragment.java

示例8: startEchoTester

import android.preference.Preference; //导入方法依赖的package包/类
public void startEchoTester() {
	Preference preference = findPreference(getString(R.string.pref_echo_tester_key));
	try {
		if (LinphoneManager.getInstance().startEchoTester() > 0) {
			preference.setSummary("Is running");
		}
	} catch (LinphoneCoreException e) {
		e.printStackTrace();
	}
}
 
开发者ID:treasure-lau,项目名称:Linphone4Android,代码行数:11,代码来源:SettingsFragment.java

示例9: onCreate

import android.preference.Preference; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Load the preferences from an XML resource
    addPreferencesFromResource(R.xml.preference_about);

    Preference version = findPreference(SETTINGS_VERSION);
    version.setSummary(getVersion());
}
 
开发者ID:XndroidDev,项目名称:Xndroid,代码行数:10,代码来源:AboutSettingsFragment.java

示例10: setDescriptions

import android.preference.Preference; //导入方法依赖的package包/类
private void setDescriptions(PreferenceScreen screen)
{
	for(int i = 0; i < screen.getPreferenceCount(); i++)
	{
		Preference preference = screen.getPreference(i);
		if(preference instanceof EditTextPreference)
			preference.setSummary(((EditTextPreference)preference).getText());
		if(preference instanceof PreferenceScreen)
			setDescriptions((PreferenceScreen)preference);
	}
}
 
开发者ID:mniip,项目名称:bananapeel,代码行数:12,代码来源:PreferencesScreen.java

示例11: onResume

import android.preference.Preference; //导入方法依赖的package包/类
@Override
public void onResume() {
    super.onResume();

    // update version
    Preference preference = findPreference(getString(R.string.preference_key_version));
    preference.setSummary(BuildConfig.VERSION_NAME);
}
 
开发者ID:mthli,项目名称:Mount,代码行数:9,代码来源:SettingsActivity.java

示例12: onPreferenceChange

import android.preference.Preference; //导入方法依赖的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) {
    // For ringtone preferences, look up the correct display value
    // using RingtoneManager.
    if (TextUtils.isEmpty(stringValue)) {
      // Empty values correspond to 'silent' (no ringtone).
      preference.setSummary(R.string.pref_ringtone_silent);

    } else {
      Ringtone ringtone = RingtoneManager.getRingtone(
          preference.getContext(), Uri.parse(stringValue));

      if (ringtone == null) {
        // Clear the summary if there was a lookup error.
        preference.setSummary(null);
      } else {
        // Set the summary to reflect the new ringtone display
        // name.
        String name = ringtone.getTitle(preference.getContext());
        preference.setSummary(name);
      }
    }

  } else {
    // For all other preferences, set the summary to the value's
    // simple string representation.
    preference.setSummary(stringValue);
  }
  return true;
}
 
开发者ID:charlesng,项目名称:SampleAppArch,代码行数:46,代码来源:SettingsActivity.java

示例13: onPreferenceChange

import android.preference.Preference; //导入方法依赖的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) {
    // For ringtone preferences, look up the correct display value
    // using RingtoneManager.
    if (TextUtils.isEmpty(stringValue)) {
      // Empty values correspond to 'silent' (no ringtone).
      preference.setSummary(R.string.pref_ringtone_silent);

    } else {
      Ringtone ringtone = RingtoneManager.getRingtone(
        preference.getContext(), Uri.parse(stringValue));

      if (ringtone == null) {
        // Clear the summary if there was a lookup error.
        preference.setSummary(null);
      } else {
        // Set the summary to reflect the new ringtone display
        // name.
        String name = ringtone.getTitle(preference.getContext());
        preference.setSummary(name);
      }
    }

  } else {
    // For all other preferences, set the summary to the value's
    // simple string representation.
    preference.setSummary(stringValue);
  }
  return true;
}
 
开发者ID:BITPlan,项目名称:can4eve,代码行数:46,代码来源:SettingsActivity.java

示例14: updateSummary

import android.preference.Preference; //导入方法依赖的package包/类
private void updateSummary(SharedPreferences sharedPreferences, String key) {
    Preference updatedPref = settingsFragment.findPreference(key);
    // Set summary to be the user-description for the selected value
    updatedPref.setSummary(sharedPreferences.getString(key, ""));
}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:6,代码来源:SettingsActivity.java

示例15: onNameUpdate

import android.preference.Preference; //导入方法依赖的package包/类
@OnPrefChange({ R.string.pref_edit_key, R.string.pref_checkbox_key, R.string.pref_switch_key })
void onNameUpdate(Preference preference, Object newValue) {
  preference.setSummary(newValue.toString());
}
 
开发者ID:quangctkm9207,项目名称:prefpin,代码行数:5,代码来源:SettingsFragment.java


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