use of com.kabouzeid.gramophone.model.lyrics.Lyrics in project Phonograph by kabouzeid.
the class FlatPlayerFragment method updateLyrics.
private void updateLyrics() {
if (updateLyricsAsyncTask != null)
updateLyricsAsyncTask.cancel(false);
final Song song = MusicPlayerRemote.getCurrentSong();
updateLyricsAsyncTask = new AsyncTask<Void, Void, Lyrics>() {
@Override
protected void onPreExecute() {
super.onPreExecute();
lyrics = null;
playerAlbumCoverFragment.setLyrics(null);
toolbar.getMenu().removeItem(R.id.action_show_lyrics);
}
@Override
protected Lyrics doInBackground(Void... params) {
String data = MusicUtil.getLyrics(song);
if (TextUtils.isEmpty(data)) {
return null;
}
return Lyrics.parse(song, data);
}
@Override
protected void onPostExecute(Lyrics l) {
lyrics = l;
playerAlbumCoverFragment.setLyrics(lyrics);
if (lyrics == null) {
if (toolbar != null) {
toolbar.getMenu().removeItem(R.id.action_show_lyrics);
}
} else {
Activity activity = getActivity();
if (toolbar != null && activity != null)
if (toolbar.getMenu().findItem(R.id.action_show_lyrics) == null) {
int color = ToolbarContentTintHelper.toolbarContentColor(activity, Color.TRANSPARENT);
Drawable drawable = ImageUtil.getTintedVectorDrawable(activity, R.drawable.ic_comment_text_outline_white_24dp, color);
toolbar.getMenu().add(Menu.NONE, R.id.action_show_lyrics, Menu.NONE, R.string.action_show_lyrics).setIcon(drawable).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
}
}
}
@Override
protected void onCancelled(Lyrics s) {
onPostExecute(null);
}
}.execute();
}
use of com.kabouzeid.gramophone.model.lyrics.Lyrics in project Phonograph by kabouzeid.
the class CardPlayerFragment method updateLyrics.
private void updateLyrics() {
if (updateLyricsAsyncTask != null)
updateLyricsAsyncTask.cancel(false);
final Song song = MusicPlayerRemote.getCurrentSong();
updateLyricsAsyncTask = new AsyncTask<Void, Void, Lyrics>() {
@Override
protected void onPreExecute() {
super.onPreExecute();
lyrics = null;
playerAlbumCoverFragment.setLyrics(null);
toolbar.getMenu().removeItem(R.id.action_show_lyrics);
}
@Override
protected Lyrics doInBackground(Void... params) {
String data = MusicUtil.getLyrics(song);
if (TextUtils.isEmpty(data)) {
return null;
}
return Lyrics.parse(song, data);
}
@Override
protected void onPostExecute(Lyrics l) {
lyrics = l;
playerAlbumCoverFragment.setLyrics(lyrics);
if (lyrics == null) {
if (toolbar != null) {
toolbar.getMenu().removeItem(R.id.action_show_lyrics);
}
} else {
Activity activity = getActivity();
if (toolbar != null && activity != null)
if (toolbar.getMenu().findItem(R.id.action_show_lyrics) == null) {
int color = ToolbarContentTintHelper.toolbarContentColor(activity, Color.TRANSPARENT);
Drawable drawable = ImageUtil.getTintedVectorDrawable(activity, R.drawable.ic_comment_text_outline_white_24dp, color);
toolbar.getMenu().add(Menu.NONE, R.id.action_show_lyrics, Menu.NONE, R.string.action_show_lyrics).setIcon(drawable).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
}
}
}
@Override
protected void onCancelled(Lyrics s) {
onPostExecute(null);
}
}.execute();
}
Aggregations