diff --git a/src/main/java/com/owncloud/android/utils/ThemeUtils.java b/src/main/java/com/owncloud/android/utils/ThemeUtils.java index da1021b78442..29fd0f8190c5 100644 --- a/src/main/java/com/owncloud/android/utils/ThemeUtils.java +++ b/src/main/java/com/owncloud/android/utils/ThemeUtils.java @@ -61,6 +61,7 @@ import androidx.annotation.DrawableRes; import androidx.annotation.Nullable; import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatDelegate; import androidx.appcompat.widget.AppCompatCheckBox; import androidx.appcompat.widget.SearchView; import androidx.appcompat.widget.SwitchCompat; @@ -180,6 +181,10 @@ public static boolean themingEnabled(Context context) { * adapted from https://github.com/nextcloud/server/blob/master/apps/theming/lib/Util.php#L90-L102 */ public static int fontColor(Context context) { + if (AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_YES) { + return Color.WHITE; + } + try { return Color.parseColor(getCapability(context).getServerTextColor()); } catch (Exception e) { @@ -501,14 +506,16 @@ public static void themeEditText(Context context, EditText editText, boolean the int color = ContextCompat.getColor(context, R.color.fg_default); // Theme the view when it is already on a theme'd background according to dark / light theme - if (themedBackground) { + if (AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_YES) { + color = Color.WHITE; + } else if (themedBackground) { if (darkTheme(context)) { color = ContextCompat.getColor(context, R.color.themed_fg); } else { color = ContextCompat.getColor(context, R.color.themed_fg_inverse); } } - + editText.setTextColor(color); editText.setHighlightColor(context.getResources().getColor(R.color.fg_contrast)); setEditTextCursorColor(editText, color);