diff options
Diffstat (limited to 'src/main/java/de/pixart/messenger/utils')
-rw-r--r-- | src/main/java/de/pixart/messenger/utils/ThemeHelper.java | 18 |
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 |