Search in sources :

Example 11 with Song

use of me.echeung.listenmoeapi.models.Song in project android-app by LISTEN-moe.

the class SongsFragment method loadSongs.

@Override
public void loadSongs(SongAdapter adapter) {
    songList.showLoading(true);
    App.getApiClient().search(null, new SearchCallback() {

        @Override
        public void onSuccess(final List<Song> results) {
            if (getActivity() != null) {
                getActivity().runOnUiThread(() -> {
                    songList.showLoading(false);
                    adapter.setSongs(results);
                });
            }
        }

        @Override
        public void onFailure(final String message) {
            if (getActivity() != null) {
                getActivity().runOnUiThread(() -> {
                    songList.showLoading(false);
                    Toast.makeText(getContext(), message, Toast.LENGTH_SHORT).show();
                });
            }
        }
    });
}
Also used : Song(me.echeung.listenmoeapi.models.Song) SearchCallback(me.echeung.listenmoeapi.callbacks.SearchCallback)

Aggregations

Song (me.echeung.listenmoeapi.models.Song)11 Intent (android.content.Intent)4 Activity (android.app.Activity)2 Bitmap (android.graphics.Bitmap)2 FavoriteSongCallback (me.echeung.listenmoeapi.callbacks.FavoriteSongCallback)2 SongItemBinding (me.echeung.moemoekyun.databinding.SongItemBinding)2 Notification (android.app.Notification)1 PendingIntent (android.app.PendingIntent)1 ClipData (android.content.ClipData)1 ClipboardManager (android.content.ClipboardManager)1 Context (android.content.Context)1 DataBindingUtil (android.databinding.DataBindingUtil)1 NonNull (android.support.annotation.NonNull)1 Snackbar (android.support.design.widget.Snackbar)1 NotificationCompat (android.support.v4.app.NotificationCompat)1 MediaMetadataCompat (android.support.v4.media.MediaMetadataCompat)1 MediaStyle (android.support.v4.media.app.NotificationCompat.MediaStyle)1 PlaybackStateCompat (android.support.v4.media.session.PlaybackStateCompat)1 AlertDialog (android.support.v7.app.AlertDialog)1 RecyclerView (android.support.v7.widget.RecyclerView)1