Fix reply-to colors in dark mode to increase contrast.

Fixes #7705
This commit is contained in:
Greyson Parrelli
2018-04-20 15:50:03 -07:00
parent 29af1669e1
commit cbe394025d
4 changed files with 41 additions and 19 deletions

View File

@@ -0,0 +1,25 @@
package org.thoughtcrime.securesms.util;
import android.content.Context;
import android.support.annotation.NonNull;
import android.util.TypedValue;
import org.thoughtcrime.securesms.R;
public class ThemeUtil {
public static boolean isDarkTheme(@NonNull Context context) {
return getAttribute(context, R.attr.theme_type, "light").equals("dark");
}
private static String getAttribute(Context context, int attribute, String defaultValue) {
TypedValue outValue = new TypedValue();
if (context.getTheme().resolveAttribute(attribute, outValue, true)) {
return outValue.coerceToString().toString();
} else {
return defaultValue;
}
}
}