Android Open Source - kure-music-player Single Toast






From Project

Back to project page kure-music-player.

License

The source code is released under:

GNU General Public License

If you think the Android project kure-music-player listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.kure.musicplayer.helpers;
//from   w w w .  jav a  2 s.  c o m
import android.content.Context;
import android.widget.Toast;

/**
 * Makes sure that a single Toast (text message) is displayed
 * on the application.
 *
 * Normally when you call several Toasts, they wait for the
 * others to finish.
 * We don't want that!
 *
 * With this class, you get an immediate Toast right away.
 *
 * Thanks to the awesome guys at StackOverflow:
 * http://stackoverflow.com/a/18676736
 *
 * Created by kure on 9/24/2014.
 */
public class SingleToast {

  private static Toast singleToast = null;

  /**
   * Immediately shows a text message.
   * Use this the same way you would call `Toast`.
   *
   * @note It calls "show()" immediately.
   */
  public static void show(Context c, String text, int duration) {

    if (singleToast != null)
      singleToast.cancel(); // override current Toast, mate!

    singleToast = Toast.makeText(c, text, duration);
    singleToast.show();
  }
}




Java Source Code List

com.kure.musicplayer.MusicController.java
com.kure.musicplayer.NotificationMusic.java
com.kure.musicplayer.NotificationSimple.java
com.kure.musicplayer.Settings.java
com.kure.musicplayer.activities.ActivityListAlbums.java
com.kure.musicplayer.activities.ActivityListSongs.java
com.kure.musicplayer.activities.ActivityMaster.java
com.kure.musicplayer.activities.ActivityMenuAlbum.java
com.kure.musicplayer.activities.ActivityMenuArtist.java
com.kure.musicplayer.activities.ActivityMenuGenre.java
com.kure.musicplayer.activities.ActivityMenuMain.java
com.kure.musicplayer.activities.ActivityMenuMusic.java
com.kure.musicplayer.activities.ActivityMenuPlaylist.java
com.kure.musicplayer.activities.ActivityMenuSettings.java
com.kure.musicplayer.activities.ActivityMenuYear.java
com.kure.musicplayer.activities.ActivityNowPlaying.java
com.kure.musicplayer.activities.ActivityQuit.java
com.kure.musicplayer.activities.XXX.java
com.kure.musicplayer.adapters.AdapterSong.java
com.kure.musicplayer.external.RemoteControlClientCompat.java
com.kure.musicplayer.external.RemoteControlHelper.java
com.kure.musicplayer.helpers.SingleToast.java
com.kure.musicplayer.model.Playlist.java
com.kure.musicplayer.model.SongList.java
com.kure.musicplayer.model.Song.java
com.kure.musicplayer.services.ServicePlayMusic.java
com.kure.musicplayer.services.ServiceScrobbleMusic.java
com.kure.musicplayer.kMP.java