Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ protected void setupDrawer() {

setupDrawerToggle();

if(getSupportActionBar() != null) {
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
}
Expand Down Expand Up @@ -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));
}

/**
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
18 changes: 13 additions & 5 deletions src/main/java/com/owncloud/android/utils/ThemeUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down