List of usage examples for android.media RingtoneManager EXTRA_RINGTONE_PICKED_URI
String EXTRA_RINGTONE_PICKED_URI
To view the source code for android.media RingtoneManager EXTRA_RINGTONE_PICKED_URI.
Click Source Link
From source file:org.apache.cordova.ringtonepicker.RingtonePicker.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { Log.d("customPlugin", "Calling onActivityResult"); if (resultCode == Activity.RESULT_OK && requestCode == 5) { Uri uri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI); Ringtone ringtone = RingtoneManager.getRingtone(this.cordova.getActivity(), uri); String title = ringtone.getTitle(this.cordova.getActivity()); Log.d("customPlugin", "I picked this ringtone " + uri); Log.d("customPlugin", "I picked this ringtone title" + title); if (uri != null) { Log.d("customPlugin", "Setting ringtone to " + notification_uri); String returnText = "{\"ringtone\": {\"title\": \"" + title + "\",\"uri\": \"" + uri + "\"}}"; PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, returnText); pluginResult.setKeepCallback(true); this.callbackContext.sendPluginResult(pluginResult); }//from ww w. j a v a 2 s . co m } }
From source file:com.microsoft.mimickeralarm.settings.RingtonePreference.java
public void handleRingtonePickerResult(Intent data) { if (data != null) { Uri ringtone = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI); if (ringtone == null) { if (getRingtone() != null) { setRingtone(null);// w ww . ja va 2s.co m setChanged(true); } } else if (getRingtone() == null || getRingtone().toString().compareToIgnoreCase(ringtone.toString()) != 0) { setRingtone(ringtone); setChanged(true); } } }
From source file:org.isoron.uhabits.helpers.ReminderHelper.java
public static void parseRingtoneData(Context context, @Nullable Intent data) { if (data == null) return;// w ww . j a v a2 s . com Uri ringtoneUri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI); if (ringtoneUri != null) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); prefs.edit().putString("pref_ringtone_uri", ringtoneUri.toString()).apply(); } else { String off = context.getResources().getString(R.string.none); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); prefs.edit().putString("pref_ringtone_uri", "").apply(); } }
From source file:edu.stanford.mobisocial.dungbeetle.SettingsActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); //TODO handle here. if (resultCode == RESULT_OK) { Uri uri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI); SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); SharedPreferences.Editor editor = settings.edit(); if (uri == null) { editor.putString("ringtone", "none"); } else {/* w w w.j av a 2 s . c o m*/ editor.putString("ringtone", uri.toString()); } editor.commit(); Log.w("settings", uri.toString()); } }
From source file:mobisocial.musubi.ui.fragments.SettingsFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQUEST_RINGTONE) { if (resultCode == Activity.RESULT_OK) { Uri uri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI); if (uri != null) { String ringTonePath = uri.toString(); Log.w(TAG, ringTonePath); SharedPreferences settings = mActivity.getSharedPreferences(SettingsActivity.PREFS_NAME, 0); SharedPreferences.Editor editor = settings.edit(); editor.putString(PREF_RINGTONE, ringTonePath); editor.commit();// ww w . j a va2 s . com } } } }
From source file:org.kontalk.ui.prefs.NotificationFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_PICK_RINGTONE) { if (resultCode == Activity.RESULT_OK) { Context ctx = getActivity(); if (ctx != null) { Uri uri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI); Preferences.setRingtone(uri != null ? uri.toString() : ""); }/*from w w w.ja v a 2 s . c om*/ } } else { super.onActivityResult(requestCode, resultCode, data); } }
From source file:com.kaliturin.blacklist.fragments.SettingsFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { // default sms app dialog result case DEFAULT_SMS_APP: if (resultCode == Activity.RESULT_OK) { Permissions.invalidateCache(); }/*w w w.j a v a2 s . c o m*/ // reload list reloadListViewItems(); break; // ringtone picker dialog results default: // get ringtone url Uri uri = null; if (resultCode == Activity.RESULT_OK && data != null) { uri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI); } // save url as settings property value setRingtoneUri(requestCode, uri); break; } }
From source file:org.proninyaroslav.libretorrent.settings.AppearanceSettingsFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_CODE_ALERT_RINGTONE && data != null) { Uri ringtone = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI); if (ringtone != null) { SettingsManager pref = new SettingsManager(getActivity().getApplicationContext()); String keyNotifySound = getString(R.string.pref_key_notify_sound); Preference notifySound = findPreference(keyNotifySound); notifySound.setSummary(RingtoneManager.getRingtone(getActivity().getApplicationContext(), ringtone) .getTitle(getActivity().getApplicationContext())); pref.put(keyNotifySound, ringtone.toString()); }//from www. ja v a 2s . co m } else { super.onActivityResult(requestCode, resultCode, data); } }
From source file:id.satusatudua.sigap.ui.fragment.SettingFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK && requestCode == 5) { Uri uri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI); if (uri != null) { CacheManager.pluck().setRingtone(uri.toString()); }//from w ww .ja va 2s. co m } }
From source file:com.geoffreybuttercrumbs.arewethereyet.ZonePicker.java
protected void onActivityResult(int requestCode, int resultCode, Intent data) { int received_Set_Ringtone = 131072; int set_Pinned = 1; if (requestCode == received_Set_Ringtone && resultCode == RESULT_OK) { uri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI); if (uri != null) { Toast.makeText(this, "Setting ringtone", Toast.LENGTH_LONG).show(); } else/*from www. j a v a 2 s . com*/ Toast.makeText(this, "Ringtone: Silent", Toast.LENGTH_LONG).show(); } else if (requestCode == 10001) { TextView donateView = (TextView) mFrag.getView().findViewById(R.id.row_title_donate); if (donateView != null) { donateView.setText("Thanks!"); donateView.setBackgroundColor(0xFF11FF11); } } else if (requestCode == set_Pinned && resultCode == RESULT_OK) { if (data.getExtras() != null) { setNewAlarmZone(data.getExtras()); } } }