List of usage examples for android.media Ringtone isPlaying
public boolean isPlaying()
From source file:org.getlantern.firetweet.preference.RingtonePreference.java
@Override protected void onPrepareDialogBuilder(final Builder builder) { loadRingtones(getContext());//from w w w . jav a 2s . co m setSelectedItem(ArrayUtils.indexOf(mValues, getPersistedString(null))); builder.setSingleChoiceItems(getEntries(), getSelectedItem(), new OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { setSelectedItem(which); final Ringtone ringtone = getSelectedRingtone(); if (ringtone.isPlaying()) { ringtone.stop(); } ringtone.play(); } }); }
From source file:org.getlantern.firetweet.preference.RingtonePreference.java
@Override protected void onDialogClosed(final boolean positiveResult) { final Ringtone ringtone = getSelectedRingtone(); if (ringtone != null && ringtone.isPlaying()) { ringtone.stop();// ww w. j av a2 s . c om } if (positiveResult && mSelectedItem >= 0 && mSelectedItem < mValues.length) { if (callChangeListener(mValues[mSelectedItem])) { persistString(mValues[mSelectedItem]); } } }
From source file:com.ariesmcrae.mymemories.ui.story.StoryViewFragment.java
public void setUiToStoryData(long getUniqueKey) throws RemoteException { Log.d(LOG_TAG, "setUiToStoryData"); storyData = resolver.getStoryDataViaRowID(getUniqueKey); if (storyData == null) { getView().setVisibility(View.GONE); } else { // else it just displays empty screen Log.d(LOG_TAG, "setUiToStoryData + storyData:" + storyData.toString()); titleTV.setText(String.valueOf(storyData.title).toString()); bodyTV.setText(String.valueOf(storyData.body).toString()); audioButton.setOnClickListener(new OnClickListener() { @Override/*w ww. java 2 s.c o m*/ public void onClick(View v) { String audioLinkPath = String.valueOf(storyData.audioLink).toString(); if (audioLinkPath != null && audioLinkPath.length() > 0) { Ringtone ringtone = RingtoneManager.getRingtone(getActivity(), Uri.parse(audioLinkPath)); if (!ringtone.isPlaying()) { ringtone.play(); } } } }); // Display the video String videoLinkPath = String.valueOf(storyData.videoLink).toString(); if (videoLinkPath != null && videoLinkPath.length() > 0) { MediaController mediaController = new MediaController(getActivity()); mediaController.setAnchorView(videoLinkView); videoLinkView.setMediaController(mediaController); videoLinkView.setVideoURI(Uri.parse(videoLinkPath)); if (!videoLinkView.isPlaying()) { videoLinkView.start(); } } // Display the image data imageNameTV.setText(String.valueOf(storyData.imageName).toString()); String imageMetaDataPath = String.valueOf(storyData.imageLink).toString(); imageMetaDataView.setImageURI(Uri.parse(imageMetaDataPath)); Long time = Long.valueOf(storyData.storyTime); storyTimeTV.setText(StoryData.FORMAT.format(time)); latitudeTV.setText(Double.valueOf(storyData.latitude).toString()); longitudeTV.setText(Double.valueOf(storyData.longitude).toString()); } }
From source file:com.phonegap.Notification.java
/** * Beep plays the default notification ringtone. * //from w ww .j a v a 2 s. c om * @param count Number of times to play notification */ public void beep(long count) { Uri ringtone = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); Ringtone notification = RingtoneManager.getRingtone(this.ctx, ringtone); // If phone is not set to silent mode if (notification != null) { for (long i = 0; i < count; ++i) { notification.play(); long timeout = 5000; while (notification.isPlaying() && (timeout > 0)) { timeout = timeout - 100; try { Thread.sleep(100); } catch (InterruptedException e) { } } } } }
From source file:org.skt.runtime.original.Notification.java
/** * Beep plays the default notification ringtone. * // www. j ava2s . c o m * @param count Number of times to play notification */ public void beep(long count) { Uri ringtone = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); Ringtone notification = RingtoneManager.getRingtone(this.ctx.getContext(), ringtone); // If phone is not set to silent mode if (notification != null) { for (long i = 0; i < count; ++i) { notification.play(); long timeout = 5000; while (notification.isPlaying() && (timeout > 0)) { timeout = timeout - 100; try { Thread.sleep(100); } catch (InterruptedException e) { } } } } }
From source file:com.getkickbak.plugin.NotificationPlugin.java
/** * Beep plays the default notification ringtone. * //from ww w . ja v a2 s .c o m * @param count * Number of times to play notification */ public void beep(long count) { Uri ringtone = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); Ringtone notification = RingtoneManager.getRingtone(this.cordova.getActivity().getBaseContext(), ringtone); // If phone is not set to silent mode if (notification != null) { for (long i = 0; i < count; ++i) { notification.play(); long timeout = 5000; while (notification.isPlaying() && (timeout > 0)) { timeout = timeout - 100; try { Thread.sleep(100); } catch (InterruptedException e) { } } } } }
From source file:org.apache.cordova.dialogs.Notification.java
/** * Beep plays the default notification ringtone. * * @param count Number of times to play notification *//*from w w w . ja v a2 s. c om*/ public void beep(final long count) { cordova.getThreadPool().execute(new Runnable() { public void run() { Uri ringtone = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); Ringtone notification = RingtoneManager.getRingtone(cordova.getActivity().getBaseContext(), ringtone); // If phone is not set to silent mode if (notification != null) { for (long i = 0; i < count; ++i) { notification.play(); long timeout = 5000; while (notification.isPlaying() && (timeout > 0)) { timeout = timeout - 100; try { Thread.sleep(100); } catch (InterruptedException e) { } } } } } }); }
From source file:com.remobile.dialogs.Notification.java
/** * Beep plays the default notification ringtone. * * @param count Number of times to play notification *///from www . java 2 s . co m public void beep(final long count) { final Activity activity = this.cordova.getActivity(); this.cordova.getThreadPool().execute(new Runnable() { public void run() { Uri ringtone = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); Ringtone notification = RingtoneManager.getRingtone(activity.getBaseContext(), ringtone); // If phone is not set to silent mode if (notification != null) { for (long i = 0; i < count; ++i) { notification.play(); long timeout = 5000; while (notification.isPlaying() && (timeout > 0)) { timeout = timeout - 100; try { Thread.sleep(100); } catch (InterruptedException e) { } } } } } }); }