From 9c9034693db7f764d47973f431ba36e70cb9822d Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Thu, 9 Mar 2017 14:47:58 -0600 Subject: [PATCH] Add locale to debug info --- src/main/java/org/tasks/locale/Locale.java | 4 ++++ src/main/java/org/tasks/preferences/Device.java | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/tasks/locale/Locale.java b/src/main/java/org/tasks/locale/Locale.java index 861d4ba31..a1b26e0b7 100644 --- a/src/main/java/org/tasks/locale/Locale.java +++ b/src/main/java/org/tasks/locale/Locale.java @@ -94,6 +94,10 @@ public class Locale { return appLocale; } + public java.util.Locale getDeviceLocale() { + return deviceLocale; + } + public char getDirectionalityMark() { return appDirectionalityMark; } diff --git a/src/main/java/org/tasks/preferences/Device.java b/src/main/java/org/tasks/preferences/Device.java index 7faecce89..faf06b012 100644 --- a/src/main/java/org/tasks/preferences/Device.java +++ b/src/main/java/org/tasks/preferences/Device.java @@ -10,6 +10,7 @@ import com.google.common.base.Joiner; import org.tasks.BuildConfig; import org.tasks.R; import org.tasks.injection.ForApplication; +import org.tasks.locale.Locale; import javax.inject.Inject; @@ -20,10 +21,12 @@ import static java.util.Arrays.asList; public class Device { private final Context context; + private final Locale locale; @Inject - public Device(@ForApplication Context context) { + public Device(@ForApplication Context context, Locale locale) { this.context = context; + this.locale = locale; } public boolean isBaneOfMyExistence() { @@ -46,11 +49,14 @@ public class Device { public String getDebugInfo() { try { + java.util.Locale appLocale = locale.getLocale(); + java.util.Locale deviceLocale = locale.getDeviceLocale(); return Joiner.on("\n").join(asList( "", "----------", "Tasks: " + BuildConfig.VERSION_NAME + " (" + BuildConfig.FLAVOR + " build " + BuildConfig.VERSION_CODE + ")", "Android: " + Build.VERSION.RELEASE + " (" + Build.DISPLAY + ")", + "Locale: " + deviceLocale + (!deviceLocale.equals(appLocale) ? " (" + appLocale + ")" : ""), "Model: " + Build.MANUFACTURER + " " + Build.MODEL, "Product: " + Build.PRODUCT + " (" + Build.DEVICE + ")", "Kernel: " + System.getProperty("os.version") + " (" + Build.VERSION.INCREMENTAL + ")",