mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 18:03:33 +00:00
WIP Added possibility to switch default image when absent the original one
This commit is contained in:
parent
a21a0132bd
commit
2b5a686fe4
23 changed files with 125 additions and 124 deletions
|
|
@ -3,6 +3,8 @@ package com.cappielloantonio.play.util;
|
|||
import android.util.Log;
|
||||
|
||||
import com.cappielloantonio.play.App;
|
||||
import com.cappielloantonio.play.R;
|
||||
import com.cappielloantonio.play.glide.CustomGlideRequest;
|
||||
import com.cappielloantonio.play.model.DirectPlayCodec;
|
||||
import com.cappielloantonio.play.model.Song;
|
||||
|
||||
|
|
@ -66,4 +68,22 @@ public class MusicUtil {
|
|||
return String.format(Locale.getDefault(), "%d:%02d:%02d", hours, minutes, seconds);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getDefaultPicPerCategory(String category) {
|
||||
if(category.equals(CustomGlideRequest.SONG_PIC)) {
|
||||
return R.drawable.default_album_art;
|
||||
}
|
||||
else if(category.equals(CustomGlideRequest.ALBUM_PIC)) {
|
||||
return R.drawable.default_album_art;
|
||||
}
|
||||
else if(category.equals(CustomGlideRequest.ARTIST_PIC)) {
|
||||
return R.drawable.default_album_art;
|
||||
}
|
||||
else if(category.equals(CustomGlideRequest.PLAYLIST_PIC)) {
|
||||
return R.drawable.default_album_art;
|
||||
}
|
||||
else {
|
||||
return R.drawable.default_album_art;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +0,0 @@
|
|||
package com.cappielloantonio.play.util;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class Util {
|
||||
public static String getReadableDurationString(long songDurationMillis) {
|
||||
long minutes = (songDurationMillis / 1000) / 60;
|
||||
long seconds = (songDurationMillis / 1000) % 60;
|
||||
|
||||
if (minutes < 60) {
|
||||
return String.format(Locale.getDefault(), "%01d:%02d", minutes, seconds);
|
||||
} else {
|
||||
long hours = minutes / 60;
|
||||
minutes = minutes % 60;
|
||||
return String.format(Locale.getDefault(), "%d:%02d:%02d", hours, minutes, seconds);
|
||||
}
|
||||
}
|
||||
|
||||
public static float dpFromPx(final Context context, final float px) {
|
||||
return px / context.getResources().getDisplayMetrics().density;
|
||||
}
|
||||
|
||||
public static float pxFromDp(final Context context, final float dp) {
|
||||
return dp * context.getResources().getDisplayMetrics().density;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue