summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorByteHamster <ByteHamster@users.noreply.github.com>2024-01-03 20:32:56 +0100
committerGitHub <noreply@github.com>2024-01-03 20:32:56 +0100
commitbf6721842220d7e89a0c3a451f5965e57feb9ca0 (patch)
treed7bda765b86567da47cb6e48900c2cab8d999427
parentf476086114a56d214558f37b066849150a141390 (diff)
downloadAntennaPod-bf6721842220d7e89a0c3a451f5965e57feb9ca0.zip
Print duration as number of days only on Echo (#6842)
Reverts an accidental change to the queue time display
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java2
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/util/Converter.java8
-rw-r--r--ui/echo/src/main/java/de/danoeh/antennapod/ui/echo/EchoActivity.java4
3 files changed, 8 insertions, 6 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java
index a1aa7226d..80933023e 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java
@@ -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);
}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/Converter.java b/core/src/main/java/de/danoeh/antennapod/core/util/Converter.java
index d9c4a5098..30464969b 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/util/Converter.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/util/Converter.java
@@ -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;
diff --git a/ui/echo/src/main/java/de/danoeh/antennapod/ui/echo/EchoActivity.java b/ui/echo/src/main/java/de/danoeh/antennapod/ui/echo/EchoActivity.java
index 92adaed2e..50b34b6e3 100644
--- a/ui/echo/src/main/java/de/danoeh/antennapod/ui/echo/EchoActivity.java
+++ b/ui/echo/src/main/java/de/danoeh/antennapod/ui/echo/EchoActivity.java
@@ -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: