use of android.media.Ringtone in project Memento-Calendar by alexstyl.
the class DailyReminderFragment method updateRingtoneSummaryFor.
private void updateRingtoneSummaryFor(Uri ringtoneUri) {
String name = null;
if (ringtoneUri.toString().length() > 0) {
Ringtone ringtone = RingtoneManager.getRingtone(getActivity(), ringtoneUri);
if (ringtone != null) {
name = ringtone.getTitle(getActivity());
}
} else {
name = getString(R.string.no_sound);
}
ringtonePreference.setSummary(name);
}
use of android.media.Ringtone in project android_packages_apps_OmniClock by omnirom.
the class SettingsActivity method setTimerAlarmSummary.
private void setTimerAlarmSummary() {
Uri defaultAlarmNoise = RingtoneManager.getActualDefaultRingtoneUri(this, RingtoneManager.TYPE_ALARM);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
String soundValue = prefs.getString(KEY_TIMER_ALARM, null);
Uri soundUri = null;
if (!mCustomTimerAlarm.isChecked()) {
soundUri = TextUtils.isEmpty(soundValue) ? defaultAlarmNoise : Uri.parse(soundValue);
} else {
// we can have the None alarm tone which is empty
soundUri = TextUtils.isEmpty(soundValue) ? null : Uri.parse(soundValue);
}
final Ringtone tone = soundUri != null ? RingtoneManager.getRingtone(this, soundUri) : null;
mHandler.post(new Runnable() {
@Override
public void run() {
mTimerAlarmPref.setSummary(tone != null ? tone.getTitle(SettingsActivity.this) : getResources().getString(R.string.ringtone_disabled));
}
});
}
use of android.media.Ringtone in project xabber-android by redsolution.
the class CustomNotifSettingsFragment method getSoundTitle.
@RequiresApi(api = Build.VERSION_CODES.O)
private String getSoundTitle(NotificationChannel channel) {
if (channel == null)
return null;
Uri uri = channel.getSound();
Ringtone ringtone = RingtoneManager.getRingtone(getActivity(), uri);
if (ringtone != null)
return ringtone.getTitle(getActivity());
else
return "Unknown ringtone";
}
use of android.media.Ringtone in project coursera-android by aporter.
the class AudioVideoRingtoneManagerActivity method playRingtone.
// Shut off current Ringtone and play new one
private void playRingtone(int newRingtoneType) {
Ringtone newRingtone = RingtoneManager.getRingtone(getApplicationContext(), RingtoneManager.getDefaultUri(newRingtoneType));
if (null != mCurrentRingtone && mCurrentRingtone.isPlaying())
mCurrentRingtone.stop();
mCurrentRingtone = newRingtone;
if (null != newRingtone) {
mCurrentRingtone.play();
postStopRingtoneMessage();
}
}
use of android.media.Ringtone in project weiciyuan by qii.
the class NotificationFragment method buildSummary.
private void buildSummary() {
if (SettingUtility.getEnableFetchMSG()) {
String value = PreferenceManager.getDefaultSharedPreferences(getActivity()).getString(SettingActivity.FREQUENCY, "1");
frequency.setSummary(getActivity().getResources().getStringArray(R.array.frequency)[Integer.valueOf(value) - 1]);
} else {
frequency.setSummary(getString(R.string.stopped));
}
if (uri != null) {
Ringtone r = RingtoneManager.getRingtone(getActivity(), uri);
ringtone.setSummary(r.getTitle(getActivity()));
} else {
ringtone.setSummary(getString(R.string.silent));
}
}
Aggregations