mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-30 12:00:32 +00:00
Merge pull request #10952 from bg172/release-0.27.0
Add an intuitive prefix for the duration of lists in the UI
This commit is contained in:
commit
5bf77160f7
@ -506,7 +506,7 @@ public class PlaylistFragment extends BaseListInfoFragment<StreamInfoItem, Playl
|
||||
Localization.concatenateStrings(
|
||||
Localization.localizeStreamCount(activity, streamCount),
|
||||
Localization.getDurationString(playlistOverallDurationSeconds,
|
||||
isDurationComplete))
|
||||
isDurationComplete, true))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -837,7 +837,8 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
|
||||
headerBinding.playlistStreamCount.setText(
|
||||
Localization.concatenateStrings(
|
||||
Localization.localizeStreamCount(activity, streamCount),
|
||||
Localization.getDurationString(playlistOverallDurationSeconds))
|
||||
Localization.getDurationString(playlistOverallDurationSeconds,
|
||||
true, true))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ public final class Localization {
|
||||
* @return a formatted duration String or {@code 0:00} if the duration is zero.
|
||||
*/
|
||||
public static String getDurationString(final long duration) {
|
||||
return getDurationString(duration, true);
|
||||
return getDurationString(duration, true, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -254,9 +254,11 @@ public final class Localization {
|
||||
* duration string.
|
||||
* @param duration the duration in seconds
|
||||
* @param isDurationComplete whether the given duration is complete or whether info is missing
|
||||
* @param showDurationPrefix whether the duration-prefix shall be shown
|
||||
* @return a formatted duration String or {@code 0:00} if the duration is zero.
|
||||
*/
|
||||
public static String getDurationString(final long duration, final boolean isDurationComplete) {
|
||||
public static String getDurationString(final long duration, final boolean isDurationComplete,
|
||||
final boolean showDurationPrefix) {
|
||||
final String output;
|
||||
|
||||
final long days = duration / (24 * 60 * 60L); /* greater than a day */
|
||||
@ -274,8 +276,9 @@ public final class Localization {
|
||||
} else {
|
||||
output = String.format(Locale.US, "%d:%02d", minutes, seconds);
|
||||
}
|
||||
final String durationPrefix = showDurationPrefix ? "⏱ " : "";
|
||||
final String durationPostfix = isDurationComplete ? "" : "+";
|
||||
return output + durationPostfix;
|
||||
return durationPrefix + output + durationPostfix;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user