Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/main/java/com/owncloud/android/utils/ThemeUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down