From ea9b73c1fe761d2b0279c5b87a7324d293469550 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 29 Sep 2021 10:42:26 +0200 Subject: [PATCH] Quicksy: fix drawables not being styled in enter phone number screen --- .../ui/EnterPhoneNumberActivity.java | 4 +++- .../conversations/ui/drawable/TextDrawable.java | 15 +++++++++------ src/quicksy/res/layout/activity_enter_number.xml | 5 +++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/quicksy/java/eu/siacs/conversations/ui/EnterPhoneNumberActivity.java b/src/quicksy/java/eu/siacs/conversations/ui/EnterPhoneNumberActivity.java index e146ab3be..52f61a96b 100644 --- a/src/quicksy/java/eu/siacs/conversations/ui/EnterPhoneNumberActivity.java +++ b/src/quicksy/java/eu/siacs/conversations/ui/EnterPhoneNumberActivity.java @@ -14,6 +14,8 @@ import android.view.KeyEvent; import android.view.View; import android.widget.EditText; +import org.jetbrains.annotations.NotNull; + import java.util.concurrent.atomic.AtomicBoolean; import eu.siacs.conversations.Config; @@ -126,7 +128,7 @@ public class EnterPhoneNumberActivity extends XmppActivity implements QuickConve } @Override - public void onSaveInstanceState(Bundle savedInstanceState) { + public void onSaveInstanceState(@NotNull Bundle savedInstanceState) { if (this.region != null) { savedInstanceState.putString("region", this.region); } diff --git a/src/quicksy/java/eu/siacs/conversations/ui/drawable/TextDrawable.java b/src/quicksy/java/eu/siacs/conversations/ui/drawable/TextDrawable.java index 3b49962a6..39ec59235 100644 --- a/src/quicksy/java/eu/siacs/conversations/ui/drawable/TextDrawable.java +++ b/src/quicksy/java/eu/siacs/conversations/ui/drawable/TextDrawable.java @@ -26,6 +26,8 @@ import android.widget.TextView; import java.lang.ref.WeakReference; +import eu.siacs.conversations.ui.util.StyledAttributes; + public class TextDrawable extends Drawable implements TextWatcher { private WeakReference ref; private String mText; @@ -62,6 +64,7 @@ public class TextDrawable extends Drawable implements TextWatcher { */ public TextDrawable(TextView tv, String initialText, boolean bindToViewsText, boolean bindToViewsPaint) { this(tv.getPaint(), initialText); + mPaint.setColor(StyledAttributes.getColor(tv.getContext(), android.R.attr.textColorPrimary)); ref = new WeakReference<>(tv); if (bindToViewsText || bindToViewsPaint) { if (bindToViewsText) { @@ -157,6 +160,10 @@ public class TextDrawable extends Drawable implements TextWatcher { setBounds(bounds); } + public Paint getPaint() { + return mPaint; + } + public void setPaint(Paint paint) { mPaint = new Paint(paint); //Since this can change the font used, we need to recalculate bounds. @@ -168,8 +175,8 @@ public class TextDrawable extends Drawable implements TextWatcher { invalidateSelf(); } - public Paint getPaint() { - return mPaint; + public String getText() { + return mText; } public void setText(String text) { @@ -183,10 +190,6 @@ public class TextDrawable extends Drawable implements TextWatcher { invalidateSelf(); } - public String getText() { - return mText; - } - @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { diff --git a/src/quicksy/res/layout/activity_enter_number.xml b/src/quicksy/res/layout/activity_enter_number.xml index d54ead3bf..b6898d875 100644 --- a/src/quicksy/res/layout/activity_enter_number.xml +++ b/src/quicksy/res/layout/activity_enter_number.xml @@ -1,5 +1,6 @@ - +