本文整理匯總了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));
}