Print duration as number of days only on Echo (#6842)
Reverts an accidental change to the queue time display
This commit is contained in:
parent
f476086114
commit
bf67218422
|
@ -523,7 +523,7 @@ public class QueueFragment extends Fragment implements MaterialToolbar.OnMenuIte
|
|||
}
|
||||
info += " • ";
|
||||
info += getString(R.string.time_left_label);
|
||||
info += Converter.getDurationStringLocalized(getActivity(), timeLeft);
|
||||
info += Converter.getDurationStringLocalized(getResources(), timeLeft, false);
|
||||
}
|
||||
infoBar.setText(info);
|
||||
}
|
||||
|
|
|
@ -83,14 +83,16 @@ public final class Converter {
|
|||
* Converts milliseconds to a localized string containing hours and minutes.
|
||||
*/
|
||||
public static String getDurationStringLocalized(Context context, long duration) {
|
||||
return getDurationStringLocalized(context.getResources(), duration);
|
||||
return getDurationStringLocalized(context.getResources(), duration, false);
|
||||
}
|
||||
|
||||
public static String getDurationStringLocalized(Resources resources, long duration) {
|
||||
public static String getDurationStringLocalized(Resources resources, long duration, boolean includeDays) {
|
||||
String result = "";
|
||||
int h = (int) (duration / HOURS_MIL);
|
||||
int d = h / 24;
|
||||
if (d > 0) {
|
||||
if (!includeDays) {
|
||||
d = 0;
|
||||
} else if (d > 0) {
|
||||
String days = resources.getQuantityString(R.plurals.time_days_quantified, d, d);
|
||||
result += days.replace(" ", "\u00A0") + " ";
|
||||
h -= d * 24;
|
||||
|
|
|
@ -210,7 +210,7 @@ public class EchoActivity extends AppCompatActivity {
|
|||
int daysUntil2024 = Math.max(356 - Calendar.getInstance().get(Calendar.DAY_OF_YEAR) + 1, 1);
|
||||
long secondsPerDay = queueSecondsLeft / daysUntil2024;
|
||||
String timePerDay = Converter.getDurationStringLocalized(
|
||||
getLocalizedResources(this, getEchoLanguage()), secondsPerDay * 1000);
|
||||
getLocalizedResources(this, getEchoLanguage()), secondsPerDay * 1000, true);
|
||||
double hoursPerDay = (double) (secondsPerDay / 3600);
|
||||
if (hoursPerDay < 1.5) {
|
||||
viewBinding.aboveLabel.setText(R.string.echo_queue_title_clean);
|
||||
|
@ -235,7 +235,7 @@ public class EchoActivity extends AppCompatActivity {
|
|||
}
|
||||
viewBinding.smallLabel.setText(getString(R.string.echo_listened_after_time,
|
||||
Converter.getDurationStringLocalized(
|
||||
getLocalizedResources(this, getEchoLanguage()), timeBetweenReleaseAndPlay)));
|
||||
getLocalizedResources(this, getEchoLanguage()), timeBetweenReleaseAndPlay, true)));
|
||||
currentDrawable = new RotatingSquaresScreen(this);
|
||||
break;
|
||||
case 4:
|
||||
|
|
Loading…
Reference in New Issue