From 028db440ee274f007f238b2edf1db1fcd14910cb Mon Sep 17 00:00:00 2001 From: Conny Duck Date: Fri, 8 Mar 2019 21:10:48 +0100 Subject: [PATCH] cleanup code --- .../com/keylesspalace/tusky/TuskyApplication.java | 3 --- .../tusky/adapter/StatusDetailedViewHolder.java | 1 - .../com/keylesspalace/tusky/util/LocaleManager.kt | 12 ++++-------- app/src/main/res/values/donottranslate.xml | 1 - app/src/main/res/xml/preferences.xml | 1 - 5 files changed, 4 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/TuskyApplication.java b/app/src/main/java/com/keylesspalace/tusky/TuskyApplication.java index 80778aa0a..04e67a674 100644 --- a/app/src/main/java/com/keylesspalace/tusky/TuskyApplication.java +++ b/app/src/main/java/com/keylesspalace/tusky/TuskyApplication.java @@ -23,7 +23,6 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.res.Configuration; import android.preference.PreferenceManager; -import android.util.Log; import androidx.emoji.text.EmojiCompat; import com.evernote.android.job.JobManager; @@ -68,8 +67,6 @@ public class TuskyApplication extends Application implements HasActivityInjector public static LocaleManager localeManager; - private final String TAG = "TuskyApplication"; - @Override public void onCreate() { super.onCreate(); diff --git a/app/src/main/java/com/keylesspalace/tusky/adapter/StatusDetailedViewHolder.java b/app/src/main/java/com/keylesspalace/tusky/adapter/StatusDetailedViewHolder.java index 5d31aae6b..55c8c117b 100644 --- a/app/src/main/java/com/keylesspalace/tusky/adapter/StatusDetailedViewHolder.java +++ b/app/src/main/java/com/keylesspalace/tusky/adapter/StatusDetailedViewHolder.java @@ -26,7 +26,6 @@ import com.keylesspalace.tusky.viewdata.StatusViewData; import com.squareup.picasso.Picasso; import java.text.DateFormat; -import java.text.NumberFormat; import java.util.Date; import androidx.annotation.Nullable; diff --git a/app/src/main/java/com/keylesspalace/tusky/util/LocaleManager.kt b/app/src/main/java/com/keylesspalace/tusky/util/LocaleManager.kt index 19f42f50d..3cb34e856 100644 --- a/app/src/main/java/com/keylesspalace/tusky/util/LocaleManager.kt +++ b/app/src/main/java/com/keylesspalace/tusky/util/LocaleManager.kt @@ -18,28 +18,24 @@ package com.keylesspalace.tusky.util import android.content.Context import android.content.SharedPreferences import android.content.res.Configuration -import android.content.res.Resources import android.preference.PreferenceManager import java.util.Locale -import com.keylesspalace.tusky.util.getNonNullString - - class LocaleManager(context: Context) { private var prefs: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context) fun setLocale(context: Context): Context { val language = prefs.getNonNullString("language", "default") - if (language.equals("default")) { - return context; + if (language == "default") { + return context } val locale = Locale.forLanguageTag(language) Locale.setDefault(locale) - val res = context.getResources() - val config = Configuration(res.getConfiguration()); + val res = context.resources + val config = Configuration(res.configuration) config.setLocale(locale) return context.createConfigurationContext(config) } diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml index bb327f292..e05d242ae 100644 --- a/app/src/main/res/values/donottranslate.xml +++ b/app/src/main/res/values/donottranslate.xml @@ -91,5 +91,4 @@ ja - Language diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 8e4a92ad1..a055b25d5 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -1,6 +1,5 @@