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


Java RingtonePreference.setOnPreferenceChangeListener方法代碼示例

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


}
 
開發者ID:yeloapp,項目名稱:yelo-android,代碼行數:25,代碼來源:SettingsFragment.java

示例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));
}
 
開發者ID:mehmetakiftutuncu,項目名稱:Muezzin,代碼行數:26,代碼來源:ReminderPreferencesFragment.java

示例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));
}
 
開發者ID:eldarerathis,項目名稱:Wireless-Charging-Xposed,代碼行數:15,代碼來源:Settings.java

示例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));
}
 
開發者ID:barterli,項目名稱:barterli_android,代碼行數:12,代碼來源:SettingsFragment.java


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