From 3e487b928d7969dbb1adac68771d8e8959dfad45 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Mon, 23 Apr 2018 21:43:39 +0200 Subject: fixed some dark theme issues in message view --- src/main/java/de/pixart/messenger/ui/XmppActivity.java | 2 +- src/main/java/de/pixart/messenger/utils/ThemeHelper.java | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java index 5c104cada..613d18792 100644 --- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java +++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java @@ -434,7 +434,7 @@ public abstract class XmppActivity extends AppCompatActivity { } public boolean isDarkTheme() { - return this.mTheme == R.style.ConversationsTheme_Dark; + return ThemeHelper.isDark(mTheme); } public int getThemeResource(int r_attr_name, int r_drawable_def) { diff --git a/src/main/java/de/pixart/messenger/utils/ThemeHelper.java b/src/main/java/de/pixart/messenger/utils/ThemeHelper.java index 199e12d5e..c14e1e25d 100644 --- a/src/main/java/de/pixart/messenger/utils/ThemeHelper.java +++ b/src/main/java/de/pixart/messenger/utils/ThemeHelper.java @@ -33,6 +33,7 @@ import android.content.Context; import android.content.SharedPreferences; import android.content.res.Resources; import android.preference.PreferenceManager; +import android.support.annotation.StyleRes; import de.pixart.messenger.R; import de.pixart.messenger.ui.SettingsActivity; @@ -53,4 +54,15 @@ public class ThemeHelper { return dark ? R.style.ConversationsTheme_Dark : R.style.ConversationsTheme; } } + + public static boolean isDark(@StyleRes int id) { + switch (id) { + case R.style.ConversationsTheme_Dark: + case R.style.ConversationsTheme_Dark_Large: + case R.style.ConversationsTheme_Dark_Medium: + return true; + default: + return false; + } + } } \ No newline at end of file -- cgit v1.2.3