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 80778aa0..04e67a67 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 5d31aae6..55c8c117 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 19f42f50..3cb34e85 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 bb327f29..e05d242a 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 8e4a92ad..a055b25d 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -1,6 +1,5 @@