diff --git a/app/src/main/java/com/hippo/ehviewer/Settings.java b/app/src/main/java/com/hippo/ehviewer/Settings.java index 13d00e7d5..41f5dfcb1 100755 --- a/app/src/main/java/com/hippo/ehviewer/Settings.java +++ b/app/src/main/java/com/hippo/ehviewer/Settings.java @@ -21,6 +21,7 @@ import android.content.SharedPreferences; import android.net.Uri; import android.preference.PreferenceManager; import android.util.Log; +import android.view.WindowManager; import androidx.annotation.DimenRes; import androidx.annotation.NonNull; @@ -277,12 +278,26 @@ public class Settings { } private static void fixDefaultValue(Context context) { - // Enable builtin hosts if the country is CN + // Enable DoH if the country is CN if (!sSettingsPre.contains(KEY_DOH)) { if ("CN".equals(Locale.getDefault().getCountry())) { putDoH(true); } } + // Enable show tag translations if the country is CN + if (!sSettingsPre.contains(KEY_SHOW_TAG_TRANSLATIONS)) { + if ("CN".equals(Locale.getDefault().getCountry())) { + putShowTagTranslations(true); + } + } + if (!sSettingsPre.contains(KEY_E_INK_MODE)) { + WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); + // Probably an E-Ink device? + if (wm.getDefaultDisplay().getRefreshRate() < 5.0) { + putReadTheme(1); + putEInkMode(true); + } + } } private static EhConfig loadEhConfig() { @@ -532,6 +547,10 @@ public class Settings { return getBoolean(KEY_SHOW_TAG_TRANSLATIONS, DEFAULT_SHOW_TAG_TRANSLATIONS); } + public static void putShowTagTranslations(boolean value) { + putBoolean(KEY_SHOW_TAG_TRANSLATIONS, value); + } + public static int getDefaultCategories() { return getInt(KEY_DEFAULT_CATEGORIES, DEFAULT_DEFAULT_CATEGORIES); }