mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 01:53:31 +00:00
Added play/pause toggle button and seekbar text
This commit is contained in:
parent
54bc709317
commit
898f23b9a1
4 changed files with 90 additions and 14 deletions
|
|
@ -8,6 +8,8 @@ import com.cappielloantonio.play.model.Song;
|
|||
|
||||
import org.jellyfin.apiclient.interaction.ApiClient;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class MusicUtil {
|
||||
public static String getSongFileUri(Song song) {
|
||||
ApiClient apiClient = App.getApiClientInstance(App.getInstance());
|
||||
|
|
@ -51,4 +53,17 @@ public class MusicUtil {
|
|||
Log.i(MusicUtil.class.getName(), "playing audio: " + builder);
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue