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


Java RingtonePreference類代碼示例

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


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

示例1: onCreate

import android.preference.RingtonePreference; //導入依賴的package包/類
@Override
public void onCreate(Bundle paramBundle) {
  super.onCreate(paramBundle);
  masterSecret = getArguments().getParcelable("master_secret");
  addPreferencesFromResource(R.xml.preferences_notifications);

  this.findPreference(TextSecurePreferences.LED_COLOR_PREF)
      .setOnPreferenceChangeListener(new ListSummaryListener());
  this.findPreference(TextSecurePreferences.LED_BLINK_PREF)
      .setOnPreferenceChangeListener(new ListSummaryListener());
  this.findPreference(TextSecurePreferences.RINGTONE_PREF)
      .setOnPreferenceChangeListener(new RingtoneSummaryListener());
  this.findPreference(TextSecurePreferences.REPEAT_ALERTS_PREF)
      .setOnPreferenceChangeListener(new ListSummaryListener());
  this.findPreference(TextSecurePreferences.NOTIFICATION_PRIVACY_PREF)
      .setOnPreferenceChangeListener(new NotificationPrivacyListener());

  initializeListSummary((ListPreference) findPreference(TextSecurePreferences.LED_COLOR_PREF));
  initializeListSummary((ListPreference) findPreference(TextSecurePreferences.LED_BLINK_PREF));
  initializeListSummary((ListPreference) findPreference(TextSecurePreferences.REPEAT_ALERTS_PREF));
  initializeListSummary((ListPreference) findPreference(TextSecurePreferences.NOTIFICATION_PRIVACY_PREF));
  initializeRingtoneSummary((RingtonePreference) findPreference(TextSecurePreferences.RINGTONE_PREF));
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:24,代碼來源:NotificationsPreferenceFragment.java

示例2: onPreferenceChange

import android.preference.RingtonePreference; //導入依賴的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

示例3: onCreateView

import android.preference.RingtonePreference; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    DebugLog.logMethod();
    EventBus.getDefault().register(this);

    buildGoogleApiClient();
    findPreference(KEY_EXPORT_TO_DRIVE).setOnPreferenceClickListener(this);
    findPreference(KEY_IMPORT_FROM_DRIVE).setOnPreferenceClickListener(this);

    timePreference = findPreference(KEY_NOTIFICATION_TIME);
    timePreference.setSummary(getNotificationTimeSummary());
    timePreference.setOnPreferenceClickListener(this);

    ringtonePreference = (RingtonePreference) findPreference(KEY_NOTIFICATION_RINGTONE);
    ringtonePreference.setSummary(getRingtoneTitle());

    getPreferenceManager().getSharedPreferences()
            .registerOnSharedPreferenceChangeListener(this);

    showProgressDialog();

    return super.onCreateView(inflater, container, savedInstanceState);
}
 
開發者ID:darsh2,項目名稱:CouponsTracker,代碼行數:24,代碼來源:SettingsFragment.java

示例4: onCreate

import android.preference.RingtonePreference; //導入依賴的package包/類
@Override
public void onCreate(Bundle paramBundle) {
  super.onCreate(paramBundle);
  addPreferencesFromResource(R.xml.preferences_notifications);

  this.findPreference(TextSecurePreferences.LED_COLOR_PREF)
      .setOnPreferenceChangeListener(new ListSummaryListener());
  this.findPreference(TextSecurePreferences.LED_BLINK_PREF)
      .setOnPreferenceChangeListener(new ListSummaryListener());
  this.findPreference(TextSecurePreferences.RINGTONE_PREF)
      .setOnPreferenceChangeListener(new RingtoneSummaryListener());
  this.findPreference(TextSecurePreferences.REPEAT_ALERTS_PREF)
      .setOnPreferenceChangeListener(new ListSummaryListener());

  initializeListSummary((ListPreference) findPreference(TextSecurePreferences.LED_COLOR_PREF));
  initializeListSummary((ListPreference) findPreference(TextSecurePreferences.LED_BLINK_PREF));
  initializeListSummary((ListPreference) findPreference(TextSecurePreferences.REPEAT_ALERTS_PREF));
  initializeRingtoneSummary((RingtonePreference) findPreference(TextSecurePreferences.RINGTONE_PREF));
}
 
開發者ID:redcracker,項目名稱:TextSecure,代碼行數:20,代碼來源:NotificationsPreferenceFragment.java

示例5: onCreate

import android.preference.RingtonePreference; //導入依賴的package包/類
@Override
public void onCreate(Bundle paramBundle) {
  super.onCreate(paramBundle);
  masterSecret = getArguments().getParcelable("master_secret");
  addPreferencesFromResource(R.xml.preferences_notifications);

  this.findPreference(SilencePreferences.LED_COLOR_PREF)
      .setOnPreferenceChangeListener(new ListSummaryListener());
  this.findPreference(SilencePreferences.LED_BLINK_PREF)
      .setOnPreferenceChangeListener(new ListSummaryListener());
  this.findPreference(SilencePreferences.RINGTONE_PREF)
      .setOnPreferenceChangeListener(new RingtoneSummaryListener());
  this.findPreference(SilencePreferences.REPEAT_ALERTS_PREF)
      .setOnPreferenceChangeListener(new ListSummaryListener());
  this.findPreference(SilencePreferences.NOTIFICATION_PRIVACY_PREF)
      .setOnPreferenceChangeListener(new NotificationPrivacyListener());

  initializeListSummary((ListPreference) findPreference(SilencePreferences.LED_COLOR_PREF));
  initializeListSummary((ListPreference) findPreference(SilencePreferences.LED_BLINK_PREF));
  initializeListSummary((ListPreference) findPreference(SilencePreferences.REPEAT_ALERTS_PREF));
  initializeListSummary((ListPreference) findPreference(SilencePreferences.NOTIFICATION_PRIVACY_PREF));
  initializeRingtoneSummary((RingtonePreference) findPreference(SilencePreferences.RINGTONE_PREF));
}
 
開發者ID:SilenceIM,項目名稱:Silence,代碼行數:24,代碼來源:NotificationsPreferenceFragment.java

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

示例7: updateRingtonePreferenceSummary

import android.preference.RingtonePreference; //導入依賴的package包/類
/**
 * Sets the summary of the Ringtone Preference to the human readable name of the selected
 * ringtone
 *
 * @param ringtonePreference The preference to update
 * @param selectedRingtoneUriString The String version of the selected ringtone Uri
 */
private void updateRingtonePreferenceSummary(final RingtonePreference ringtonePreference, final String selectedRingtoneUriString) {

    if (!TextUtils.isEmpty(selectedRingtoneUriString)) {
        final Ringtone selectedRingtone = RingtoneManager
                .getRingtone(getActivity(), Uri.parse(selectedRingtoneUriString));

        if (selectedRingtone == null) {
            ringtonePreference.setSummary(null);
        } else {
            ringtonePreference.setSummary(selectedRingtone.getTitle(getActivity()));
        }
    } else {
        ringtonePreference.setSummary(null);
    }

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

示例8: getRequestCodeViaReflection

import android.preference.RingtonePreference; //導入依賴的package包/類
private int getRequestCodeViaReflection() {
    try {
        // Get request code field by reflection
        Field field = android.preference.RingtonePreference.class.getDeclaredField("mRequestCode");

        // Make it accessible
        field.setAccessible(true);

        // Return it
        return (Integer) field.get(this);
    }
    catch (Exception exc) {
        // Log it
        Log.e(Logging.TAG, "Request code reflection failed", exc);

        // Return error
        return REQUEST_CODE_FAILED;
    }
}
 
開發者ID:eladnava,項目名稱:redalert-android,代碼行數:20,代碼來源:RingtoneSelectionPreference.java

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

示例10: onCreate

import android.preference.RingtonePreference; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getActivityComponent().inject(this);
    addPreferencesFromResource(R.xml.preferences);

    reminderListPreference = (ListPreference) findPreference(getString(R.string.pref_key_alarm_reminder));
    bindOnPreferenceChange(reminderListPreference);

    alarmRingtonePreference = (RingtonePreference) findPreference(getString(R.string.pref_key_alarm_ringtone));
    bindOnPreferenceChange(alarmRingtonePreference);

    notificationRingtonePreference = (RingtonePreference) findPreference(getString(R.string.pref_key_notification_ringtone));
    bindOnPreferenceChange(notificationRingtonePreference);

    setCachePreference();
    setSharePreference();
}
 
開發者ID:tjyu1040,項目名稱:GallyShuttle,代碼行數:19,代碼來源:SettingsActivity.java

示例11: onPreferenceChange

import android.preference.RingtonePreference; //導入依賴的package包/類
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
    String value = newValue.toString();
    if (preference instanceof ListPreference) {
        ListPreference listPreference = (ListPreference) preference;
        int index = listPreference.findIndexOfValue(value);
        preference.setSummary(index >= 0 ? listPreference.getEntries()[index] : null);
    } else if (preference instanceof RingtonePreference) {
        if (TextUtils.isEmpty(value)) {
            preference.setSummary(R.string.pref_summary_silent);
        } else {
            Ringtone ringtone = RingtoneManager.getRingtone(preference.getContext(), Uri.parse(value));
            if (ringtone != null) {
                preference.setSummary(ringtone.getTitle(preference.getContext()));
            } else {
                preference.setSummary(null);
            }
        }
    } else {
        preference.setSummary(value);
    }
    return true;
}
 
開發者ID:tjyu1040,項目名稱:GallyShuttle,代碼行數:24,代碼來源:BasePreferenceFragment.java

示例12: assertThatScreenMatchesExpected

import android.preference.RingtonePreference; //導入依賴的package包/類
protected void assertThatScreenMatchesExpected(PreferenceScreen screen) {
  assertThat(screen.getPreferenceCount()).isEqualTo(8);

  assertThat(screen.getPreference(0)).isInstanceOf(PreferenceCategory.class);
  assertThat(((PreferenceCategory) screen.getPreference(0)).getPreference(0)).isInstanceOf(Preference.class);

  PreferenceScreen innerScreen = (PreferenceScreen) screen.getPreference(1);
  assertThat(innerScreen).isInstanceOf(PreferenceScreen.class);
  assertThat(innerScreen.getKey()).isEqualTo("screen");
  assertThat(innerScreen.getTitle().toString()).isEqualTo("Screen Test");
  assertThat(innerScreen.getSummary()).isEqualTo("Screen summary");
  assertThat(innerScreen.getPreference(0)).isInstanceOf(Preference.class);

  assertThat(screen.getPreference(2)).isInstanceOf(CheckBoxPreference.class);
  assertThat(screen.getPreference(3)).isInstanceOf(EditTextPreference.class);
  assertThat(screen.getPreference(4)).isInstanceOf(ListPreference.class);
  assertThat(screen.getPreference(5)).isInstanceOf(Preference.class);
  assertThat(screen.getPreference(6)).isInstanceOf(RingtonePreference.class);
  assertThat(screen.getPreference(7)).isInstanceOf(Preference.class);
}
 
開發者ID:qx,項目名稱:FullRobolectricTestSample,代碼行數:21,代碼來源:PreferenceLoaderTest.java

示例13: onPreferenceChange

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

    if (preference instanceof ListPreference) {


    } else if (preference instanceof RingtonePreference) {

    } else {
        // For all other preferences, set the summary to the value's
        // simple string representation.
        preference.setSummary(stringValue);
    }
    return true;
}
 
開發者ID:znupy,項目名稱:ChattyOwl,代碼行數:17,代碼來源:SettingsActivity.java

示例14: onPreferenceChange

import android.preference.RingtonePreference; //導入依賴的package包/類
@Override
public boolean onPreferenceChange(Preference preference, Object value) {
	String stringValue = value.toString();
	if (preference instanceof ListPreference) {
		ListPreference listPreference = (ListPreference) preference;
		int index = listPreference.findIndexOfValue(stringValue);
		preference	.setSummary(index >= 0 ? listPreference.getEntries()[index]: null);

	} else if (preference instanceof RingtonePreference) {
		if (TextUtils.isEmpty(stringValue)) {
			preference.setSummary(R.string.pref_ringtone_silent);
		} else {
			Ringtone ringtone = RingtoneManager.getRingtone(preference.getContext(), Uri.parse(stringValue));
			if (ringtone == null) {
				preference.setSummary(null);
			} else {
				String name = ringtone
						.getTitle(preference.getContext());
				preference.setSummary(name);
			}
		}
	} else {
		preference.setSummary(stringValue);
	}
	return true;
}
 
開發者ID:ghwoni13,項目名稱:BAGO_TS,代碼行數:27,代碼來源:TS_Settings.java

示例15: onPreferenceChange

import android.preference.RingtonePreference; //導入依賴的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


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