Search in sources :

Example 41 with Ringtone

use of android.media.Ringtone in project Douya by DreaminginCodeZH.

the class RingtonePreference method getSummary.

@Override
public CharSequence getSummary() {
    CharSequence summary = super.getSummary();
    if (!TextUtils.isEmpty(summary)) {
        Uri ringtoneUri = getRingtoneUri();
        String ringtoneTitle = "";
        if (ringtoneUri != null) {
            Context context = getContext();
            Ringtone ringtone = RingtoneManager.getRingtone(context, ringtoneUri);
            if (ringtone != null) {
                ringtoneTitle = ringtone.getTitle(context);
            }
        }
        return String.format(summary.toString(), ringtoneTitle);
    } else {
        return summary;
    }
}
Also used : Context(android.content.Context) Ringtone(android.media.Ringtone) Uri(android.net.Uri)

Example 42 with Ringtone

use of android.media.Ringtone in project barcodescanner by dm77.

the class FullScannerFragment method handleResult.

@Override
public void handleResult(Result rawResult) {
    try {
        Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
        Ringtone r = RingtoneManager.getRingtone(getActivity().getApplicationContext(), notification);
        r.play();
    } catch (Exception e) {
    }
    showMessageDialog("Contents = " + rawResult.getText() + ", Format = " + rawResult.getBarcodeFormat().toString());
}
Also used : Ringtone(android.media.Ringtone) Uri(android.net.Uri)

Example 43 with Ringtone

use of android.media.Ringtone in project barcodescanner by dm77.

the class FullScannerFragment method handleResult.

@Override
public void handleResult(Result rawResult) {
    try {
        Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
        Ringtone r = RingtoneManager.getRingtone(getActivity().getApplicationContext(), notification);
        r.play();
    } catch (Exception e) {
    }
    showMessageDialog("Contents = " + rawResult.getContents() + ", Format = " + rawResult.getBarcodeFormat().getName());
}
Also used : Ringtone(android.media.Ringtone) Uri(android.net.Uri)

Example 44 with Ringtone

use of android.media.Ringtone in project barcodescanner by dm77.

the class FullScannerActivity method handleResult.

@Override
public void handleResult(Result rawResult) {
    try {
        Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
        Ringtone r = RingtoneManager.getRingtone(getApplicationContext(), notification);
        r.play();
    } catch (Exception e) {
    }
    showMessageDialog("Contents = " + rawResult.getContents() + ", Format = " + rawResult.getBarcodeFormat().getName());
}
Also used : Ringtone(android.media.Ringtone) Uri(android.net.Uri)

Example 45 with Ringtone

use of android.media.Ringtone in project HoloEverywhere by Prototik.

the class _RingtonePickerDialog method run.

@Override
public void run() {
    if (sampleRingtonePos == silentPos) {
        ringtoneManager.stopPreviousRingtone();
        return;
    }
    if (defaultRingtone != null && defaultRingtone.isPlaying()) {
        defaultRingtone.stop();
        defaultRingtone = null;
    }
    Ringtone ringtone;
    if (sampleRingtonePos == defaultRingtonePos) {
        if (defaultRingtone == null) {
            defaultRingtone = RingtoneManager.getRingtone(context, uriForDefaultItem);
        }
        ringtone = defaultRingtone;
        ringtoneManager.stopPreviousRingtone();
    } else {
        ringtone = ringtoneManager.getRingtone(getRingtoneManagerPosition(sampleRingtonePos));
    }
    if (ringtone != null) {
        ringtone.play();
    }
}
Also used : Ringtone(android.media.Ringtone)

Aggregations

Ringtone (android.media.Ringtone)49 Uri (android.net.Uri)33 ContentResolver (android.content.ContentResolver)8 Intent (android.content.Intent)6 AudioManager (android.media.AudioManager)4 SuppressLint (android.annotation.SuppressLint)2 Context (android.content.Context)2 Cursor (android.database.Cursor)2 SQLiteException (android.database.sqlite.SQLiteException)2 RingtoneManager (android.media.RingtoneManager)2 RingtonePreference (android.preference.RingtonePreference)2 View (android.view.View)2 AdapterView (android.widget.AdapterView)2 ListView (android.widget.ListView)2 ArrayList (java.util.ArrayList)2 CallNotificationBuilder (org.thoughtcrime.securesms.webrtc.CallNotificationBuilder)2 SharedPreferences (android.content.SharedPreferences)1 Handler (android.os.Handler)1 Vibrator (android.os.Vibrator)1 Preference (android.support.v7.preference.Preference)1