本文整理汇总了Java中android.preference.RingtonePreference.setOnPreferenceChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java RingtonePreference.setOnPreferenceChangeListener方法的具体用法?Java RingtonePreference.setOnPreferenceChangeListener怎么用?Java RingtonePreference.setOnPreferenceChangeListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.preference.RingtonePreference
的用法示例。
在下文中一共展示了RingtonePreference.setOnPreferenceChangeListener方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.preference.RingtonePreference; //导入方法依赖的package包/类
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.settings);
mChatRingtoneKey = getString(R.string.pref_chat_ringtone);
mChatRingtonePreference = (RingtonePreference) findPreference(mChatRingtoneKey);
// mLocationCityChangePreference = (ListPreference) findPreference(getActivity().getResources().getString(R.string.pref_location_settings));
//mLocationCityChangePreference.setEntries();
mChatRingtonePreference.setOnPreferenceChangeListener(this);
//mLocationCityChangePreference.setOnPreferenceChangeListener(this);
updateRingtonePreferenceSummary(mChatRingtonePreference, SharedPreferenceHelper
.getString(R.string.pref_chat_ringtone));
//updateLocationPreference(mLocationCityChangePreference,SharedPreferenceHelper.getString(R.string.pref_location_settings));
mOtherRingtoneKey = getString(R.string.pref_other_ringtone);
mOtherRingtonePreference = (RingtonePreference) findPreference(mOtherRingtoneKey);
mOtherRingtonePreference.setOnPreferenceChangeListener(this);
updateRingtonePreferenceSummary(mOtherRingtonePreference, SharedPreferenceHelper
.getString(R.string.pref_other_ringtone));
}
示例2: initializeForPrayerTime
import android.preference.RingtonePreference; //导入方法依赖的package包/类
private void initializeForPrayerTime(final PrayerTimeType prayerTimeType) {
String soundKey = Pref.Reminders.SOUND_BASE + prayerTimeType.name;
RingtonePreference sound = (RingtonePreference) findPreference(soundKey);
sound.setOnPreferenceChangeListener((preference, newValue) -> {
updateSoundSummary(preference, (String) newValue);
return true;
});
String currentSound = Pref.Reminders.sound(getActivity(), prayerTimeType);
updateSoundSummary(sound, currentSound);
String timeToRemindKey = Pref.Reminders.TIME_TO_REMIND_BASE + prayerTimeType.name;
ListPreference timeToRemind = (ListPreference) findPreference(timeToRemindKey);
timeToRemind.setOnPreferenceChangeListener((preference, newValue) -> {
preference.setSummary(getString(R.string.preferences_reminders_timeToRemindSummary, Integer.parseInt((String) newValue)));
return true;
});
int currentTimeToRemind = Pref.Reminders.timeToRemind(getActivity(), prayerTimeType);
timeToRemind.setSummary(getString(R.string.preferences_reminders_timeToRemindSummary, currentTimeToRemind));
}
示例3: onCreate
import android.preference.RingtonePreference; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
getPreferenceManager().setSharedPreferencesMode(Context.MODE_WORLD_READABLE);
addPreferencesFromResource(R.xml.settings);
RingtonePreference p = (RingtonePreference)findPreference("pref_key_custom_ringtone");
p.setOnPreferenceChangeListener(this);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mActivity);
updateRingtoneSummary(p, prefs.getString(p.getKey(), null));
}
示例4: onCreate
import android.preference.RingtonePreference; //导入方法依赖的package包/类
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.settings);
mChatRingtoneKey = getString(R.string.pref_chat_ringtone);
mChatRingtonePreference = (RingtonePreference) findPreference(mChatRingtoneKey);
mChatRingtonePreference.setOnPreferenceChangeListener(this);
updateRingtonePreferenceSummary(SharedPreferenceHelper
.getString(R.string.pref_chat_ringtone));
}