diff --git a/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java b/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java index b2fe13cff156..d838b29084ba 100644 --- a/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java @@ -254,7 +254,7 @@ protected void setupDrawer() { setupDrawerToggle(); - if(getSupportActionBar() != null) { + if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); } } @@ -294,7 +294,7 @@ public void onDrawerOpened(View drawerView) { // Set the drawer toggle as the DrawerListener mDrawerLayout.addDrawerListener(mDrawerToggle); mDrawerToggle.setDrawerIndicatorEnabled(true); - mDrawerToggle.getDrawerArrowDrawable().setColor(ThemeUtils.fontColor(this)); + mDrawerToggle.getDrawerArrowDrawable().setColor(ThemeUtils.fontColor(this, true)); } /** @@ -305,7 +305,7 @@ private void setupDrawerHeader() { mAccountEndAccountAvatar = (ImageView) findNavigationViewChildById(R.id.drawer_account_end); mAccountChooserToggle = (ImageView) findNavigationViewChildById(R.id.drawer_account_chooser_toggle); - mAccountChooserToggle.setColorFilter(ThemeUtils.fontColor(this)); + mAccountChooserToggle.setColorFilter(ThemeUtils.fontColor(this, true)); if (getResources().getBoolean(R.bool.allow_profile_click)) { mAccountChooserToggle.setImageResource(R.drawable.ic_down); diff --git a/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java b/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java index bdd4ee49b3a0..edc791d057e6 100644 --- a/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java @@ -751,7 +751,7 @@ private void setupActionBar() { actionBar.setBackgroundDrawable(new ColorDrawable(ThemeUtils.primaryColor(this))); Drawable backArrow = getResources().getDrawable(R.drawable.ic_arrow_back); - actionBar.setHomeAsUpIndicator(ThemeUtils.tintDrawable(backArrow, ThemeUtils.fontColor(this))); + actionBar.setHomeAsUpIndicator(ThemeUtils.tintDrawable(backArrow, ThemeUtils.fontColor(this, true))); } Window window = getWindow(); diff --git a/src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java b/src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java index f44ce3784c7d..e551d0f69830 100644 --- a/src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java @@ -63,7 +63,7 @@ protected void onCreate(Bundle savedInstanceState) { */ protected void setupToolbar(boolean useBackgroundImage) { int primaryColor = ThemeUtils.primaryColor(this, false); - int fontColor = ThemeUtils.fontColor(this); + int fontColor = ThemeUtils.fontColor(this, true); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); diff --git a/src/main/java/com/owncloud/android/utils/ThemeUtils.java b/src/main/java/com/owncloud/android/utils/ThemeUtils.java index 7ea5eff19702..3ee1df68cb76 100644 --- a/src/main/java/com/owncloud/android/utils/ThemeUtils.java +++ b/src/main/java/com/owncloud/android/utils/ThemeUtils.java @@ -180,9 +180,13 @@ public static boolean themingEnabled(Context context) { * @return int font color to use * adapted from https://github.com/nextcloud/server/blob/master/apps/theming/lib/Util.php#L90-L102 */ - public static int fontColor(Context context) { + public static int fontColor(Context context, boolean replaceWhite) { if (AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_YES) { - return Color.WHITE; + if (replaceWhite) { + return Color.BLACK; + } else { + return Color.WHITE; + } } try { @@ -196,6 +200,10 @@ public static int fontColor(Context context) { } } + public static int fontColor(Context context) { + return fontColor(context, false); + } + /** * Tests if light color is set * @return true if primaryColor is lighter than MAX_LIGHTNESS @@ -230,7 +238,7 @@ public static void setColoredTitle(@Nullable ActionBar actionBar, String title, actionBar.setTitle(title); } else { Spannable text = new SpannableString(title); - text.setSpan(new ForegroundColorSpan(fontColor(context)), + text.setSpan(new ForegroundColorSpan(fontColor(context, true)), 0, text.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE); @@ -298,7 +306,7 @@ public static void setColoredTitle(@Nullable ActionBar actionBar, int titleId, C } else { String title = context.getString(titleId); Spannable text = new SpannableString(title); - text.setSpan(new ForegroundColorSpan(fontColor(context)), + text.setSpan(new ForegroundColorSpan(fontColor(context, true)), 0, text.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE); @@ -529,7 +537,7 @@ public static void themeEditText(Context context, EditText editText, boolean the */ public static void themeSearchView(SearchView searchView, boolean themedBackground, Context context) { // hacky as no default way is provided - int fontColor = ThemeUtils.fontColor(context); + int fontColor = ThemeUtils.fontColor(context, true); SearchView.SearchAutoComplete editText = searchView.findViewById(R.id.search_src_text); themeEditText(context, editText, themedBackground);