mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-25 12:32:31 +01:00
add an intuitive prefix for the duration of lists on UI, and avoid using the new prefix for single videos
This commit is contained in:
parent
f704721b59
commit
13baaa31cd
@ -506,7 +506,7 @@ public class PlaylistFragment extends BaseListInfoFragment<StreamInfoItem, Playl
|
|||||||
Localization.concatenateStrings(
|
Localization.concatenateStrings(
|
||||||
Localization.localizeStreamCount(activity, streamCount),
|
Localization.localizeStreamCount(activity, streamCount),
|
||||||
Localization.getDurationString(playlistOverallDurationSeconds,
|
Localization.getDurationString(playlistOverallDurationSeconds,
|
||||||
isDurationComplete))
|
isDurationComplete, true))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -837,7 +837,8 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
|
|||||||
headerBinding.playlistStreamCount.setText(
|
headerBinding.playlistStreamCount.setText(
|
||||||
Localization.concatenateStrings(
|
Localization.concatenateStrings(
|
||||||
Localization.localizeStreamCount(activity, streamCount),
|
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.
|
* @return a formatted duration String or {@code 0:00} if the duration is zero.
|
||||||
*/
|
*/
|
||||||
public static String getDurationString(final long duration) {
|
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.
|
* duration string.
|
||||||
* @param duration the duration in seconds
|
* @param duration the duration in seconds
|
||||||
* @param isDurationComplete whether the given duration is complete or whether info is missing
|
* @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.
|
* @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 String output;
|
||||||
|
|
||||||
final long days = duration / (24 * 60 * 60L); /* greater than a day */
|
final long days = duration / (24 * 60 * 60L); /* greater than a day */
|
||||||
@ -274,8 +276,9 @@ public final class Localization {
|
|||||||
} else {
|
} else {
|
||||||
output = String.format(Locale.US, "%d:%02d", minutes, seconds);
|
output = String.format(Locale.US, "%d:%02d", minutes, seconds);
|
||||||
}
|
}
|
||||||
|
final String durationPrefix = showDurationPrefix ? "⏱ " : "";
|
||||||
final String durationPostfix = isDurationComplete ? "" : "+";
|
final String durationPostfix = isDurationComplete ? "" : "+";
|
||||||
return output + durationPostfix;
|
return durationPrefix + output + durationPostfix;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user