Quicksy: fix drawables not being styled in enter phone number screen

This commit is contained in:
Daniel Gultsch 2021-09-29 10:42:26 +02:00
parent e791e19265
commit ea9b73c1fe
3 changed files with 15 additions and 9 deletions

View file

@ -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);
}

View file

@ -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<TextView> 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) {

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:layout_width="match_parent"
@ -49,7 +50,7 @@
android:layout_height="wrap_content"
android:cursorVisible="false"
android:drawableEnd="@drawable/ic_arrow_drop_down_black_18dp"
android:drawableRight="@drawable/ic_arrow_drop_down_black_18dp"
app:drawableTint="?android:attr/textColorPrimary"
android:focusable="false"
android:gravity="bottom|center_horizontal"
android:imeOptions="flagNoExtractUi"