Browse Source

Merge pull request #4923 from nextcloud/theming_sharing_box

fix wrong text color on edit text input on dark mode
Andy Scherzinger 5 years ago
parent
commit
d006ac257e
1 changed files with 8 additions and 1 deletions
  1. 8 1
      src/main/java/com/owncloud/android/utils/ThemeUtils.java

+ 8 - 1
src/main/java/com/owncloud/android/utils/ThemeUtils.java

@@ -61,6 +61,7 @@ import androidx.annotation.ColorInt;
 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 final class ThemeUtils {
      * 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) {
@@ -499,7 +504,9 @@ public final class ThemeUtils {
         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 {