aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/utils
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-04-29 22:35:39 +0200
committerChristian Schneppe <christian@pix-art.de>2018-04-29 22:35:39 +0200
commit52436756a938327da0dcc0a4d800fb9fd763bac5 (patch)
treec029ba8b3c9eaf21ead6c55f303f4f06f027a59e /src/main/java/de/pixart/messenger/utils
parent82657e7bf6287759bc037b7de68f8901702473e7 (diff)
fix text size in snackbars
Diffstat (limited to 'src/main/java/de/pixart/messenger/utils')
-rw-r--r--src/main/java/de/pixart/messenger/utils/ThemeHelper.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/utils/ThemeHelper.java b/src/main/java/de/pixart/messenger/utils/ThemeHelper.java
index c14e1e25d..3568a488a 100644
--- a/src/main/java/de/pixart/messenger/utils/ThemeHelper.java
+++ b/src/main/java/de/pixart/messenger/utils/ThemeHelper.java
@@ -32,8 +32,12 @@ package de.pixart.messenger.utils;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;
+import android.content.res.TypedArray;
import android.preference.PreferenceManager;
import android.support.annotation.StyleRes;
+import android.support.design.widget.Snackbar;
+import android.util.TypedValue;
+import android.widget.TextView;
import de.pixart.messenger.R;
import de.pixart.messenger.ui.SettingsActivity;
@@ -65,4 +69,18 @@ public class ThemeHelper {
return false;
}
}
+
+ public static void fixTextSize(Snackbar snackbar) {
+ TypedArray typedArray = snackbar.getContext().obtainStyledAttributes(new int[]{R.attr.TextSizeBody1});
+ final float size = typedArray.getDimension(0, 0f);
+ typedArray.recycle();
+ if (size != 0f) {
+ final TextView text = snackbar.getView().findViewById(android.support.design.R.id.snackbar_text);
+ final TextView action = snackbar.getView().findViewById(android.support.design.R.id.snackbar_action);
+ if (text != null && action != null) {
+ text.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
+ action.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
+ }
+ }
+ }
} \ No newline at end of file