|
@@ -188,8 +188,11 @@ public final class ThemeUtils {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * returns the font color based on the server side theming and uses black/white as a fallback based on replaceWhite.
|
|
|
+ *
|
|
|
+ * @param context the context
|
|
|
+ * @param replaceWhite FLAG to return white/black if server side color isn't available
|
|
|
* @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, boolean replaceWhite) {
|
|
|
if (AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_YES) {
|
|
@@ -200,6 +203,10 @@ public final class ThemeUtils {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ return toolbarTextColor(context);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static int toolbarTextColor(Context context) {
|
|
|
try {
|
|
|
return Color.parseColor(getCapability(context).getServerTextColor());
|
|
|
} catch (Exception e) {
|
|
@@ -249,7 +256,7 @@ public final class ThemeUtils {
|
|
|
actionBar.setTitle(title);
|
|
|
} else {
|
|
|
Spannable text = new SpannableString(title);
|
|
|
- text.setSpan(new ForegroundColorSpan(fontColor(context, !darkTheme(context))),
|
|
|
+ text.setSpan(new ForegroundColorSpan(toolbarTextColor(context)),
|
|
|
0,
|
|
|
text.length(),
|
|
|
Spannable.SPAN_INCLUSIVE_INCLUSIVE);
|
|
@@ -612,7 +619,7 @@ public final class ThemeUtils {
|
|
|
drawable, Context context) {
|
|
|
button.setBackgroundTintList(ColorStateList.valueOf(ThemeUtils.primaryColor(context)));
|
|
|
button.setRippleColor(ThemeUtils.primaryDarkColor(context));
|
|
|
- button.setImageDrawable(ThemeUtils.tintDrawable(drawable, ThemeUtils.fontColor(context)));
|
|
|
+ button.setImageDrawable(ThemeUtils.tintDrawable(drawable, ThemeUtils.toolbarTextColor(context)));
|
|
|
}
|
|
|
|
|
|
private static OCCapability getCapability(Context context) {
|