summaryrefslogtreecommitdiff
path: root/ui/statistics
diff options
context:
space:
mode:
authorByteHamster <ByteHamster@users.noreply.github.com>2024-01-02 19:21:07 +0100
committerGitHub <noreply@github.com>2024-01-02 19:21:07 +0100
commitb2ea588b5479c7e1aa0b40932c9734f5389258db (patch)
tree7f745e05d104de74dd003e562a38830877c685d3 /ui/statistics
parentde8bc4ad30910d4b2429a95eb7358afa679728dd (diff)
downloadAntennaPod-b2ea588b5479c7e1aa0b40932c9734f5389258db.zip
Use localized date format (#6843)
Diffstat (limited to 'ui/statistics')
-rw-r--r--ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/subscriptions/PlaybackStatisticsListAdapter.java4
-rw-r--r--ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/subscriptions/StatisticsFilterDialog.java4
2 files changed, 6 insertions, 2 deletions
diff --git a/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/subscriptions/PlaybackStatisticsListAdapter.java b/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/subscriptions/PlaybackStatisticsListAdapter.java
index 3936118ca..9b1f234c8 100644
--- a/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/subscriptions/PlaybackStatisticsListAdapter.java
+++ b/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/subscriptions/PlaybackStatisticsListAdapter.java
@@ -1,5 +1,6 @@
package de.danoeh.antennapod.ui.statistics.subscriptions;
+import android.text.format.DateFormat;
import androidx.fragment.app.Fragment;
import de.danoeh.antennapod.core.storage.StatisticsItem;
import de.danoeh.antennapod.core.util.Converter;
@@ -39,7 +40,8 @@ public class PlaybackStatisticsListAdapter extends StatisticsListAdapter {
if (includeMarkedAsPlayed) {
return context.getString(R.string.statistics_counting_total);
}
- SimpleDateFormat dateFormat = new SimpleDateFormat("MMM yyyy", Locale.getDefault());
+ String skeleton = DateFormat.getBestDateTimePattern(Locale.getDefault(), "MMM yyyy");
+ SimpleDateFormat dateFormat = new SimpleDateFormat(skeleton, Locale.getDefault());
String dateFrom = dateFormat.format(new Date(timeFilterFrom));
// FilterTo is first day of next month => Subtract one day
String dateTo = dateFormat.format(new Date(timeFilterTo - 24L * 3600000L));
diff --git a/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/subscriptions/StatisticsFilterDialog.java b/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/subscriptions/StatisticsFilterDialog.java
index 077883321..e46e48240 100644
--- a/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/subscriptions/StatisticsFilterDialog.java
+++ b/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/subscriptions/StatisticsFilterDialog.java
@@ -2,6 +2,7 @@ package de.danoeh.antennapod.ui.statistics.subscriptions;
import android.content.Context;
import android.content.SharedPreferences;
+import android.text.format.DateFormat;
import android.view.LayoutInflater;
import android.widget.ArrayAdapter;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
@@ -114,7 +115,8 @@ public class StatisticsFilterDialog {
date.set(Calendar.DAY_OF_MONTH, 1);
ArrayList<String> names = new ArrayList<>();
ArrayList<Long> timestamps = new ArrayList<>();
- SimpleDateFormat dateFormat = new SimpleDateFormat("MMM yyyy", Locale.getDefault());
+ String skeleton = DateFormat.getBestDateTimePattern(Locale.getDefault(), "MMM yyyy");
+ SimpleDateFormat dateFormat = new SimpleDateFormat(skeleton, Locale.getDefault());
while (date.getTimeInMillis() < System.currentTimeMillis()) {
names.add(dateFormat.format(new Date(date.getTimeInMillis())));
if (!inclusive) {