Skip to content

Commit

Permalink
fix progressbar font
Browse files Browse the repository at this point in the history
  • Loading branch information
pichsy committed Jan 4, 2021
1 parent 54df0b6 commit 3d751dc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.RectF;
import android.graphics.Typeface;
import android.util.AttributeSet;

import androidx.annotation.IntDef;
import androidx.annotation.Nullable;
import androidx.core.view.ViewCompat;

import com.pichs.common.widget.R;
import com.pichs.common.widget.utils.XDisplayHelper;
import com.pichs.common.widget.utils.XTypefaceHelper;
import com.pichs.common.widget.view.XView;

import java.lang.annotation.Retention;
Expand Down Expand Up @@ -115,6 +118,7 @@ public XProgressBar(Context context, AttributeSet attrs, int defStyleAttr) {
}

public void setup(Context context, AttributeSet attrs) {
XTypefaceHelper.observer(this, typeface -> mTextPaint.setTypeface(typeface));
TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.XProgressBar);
mType = array.getInt(R.styleable.XProgressBar_xp_progressType, TYPE_RECT);
mProgressColor = array.getColor(R.styleable.XProgressBar_xp_progressColor, DEFAULT_PROGRESS_COLOR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public XCheckedTextView(Context context) {
public XCheckedTextView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
init(context, attrs, 0);
XTypefaceHelper.observer(this, this::setTypeface);
}

public XCheckedTextView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
Expand All @@ -41,6 +40,8 @@ public XCheckedTextView(Context context, @Nullable AttributeSet attrs, int defSt
private void init(Context context, AttributeSet attrs, int defStyleAttr) {
backgroundHelper = new XBackgroundHelper(context, attrs, defStyleAttr, this);
textViewHelper = new XTextViewHelper(context, attrs, defStyleAttr, this);
init(context, attrs, defStyleAttr);
XTypefaceHelper.observer(this, this::setTypeface);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public XEditText(@NonNull Context context, @Nullable AttributeSet attrs) {
public XEditText(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context, attrs, defStyleAttr);
XTypefaceHelper.observer(this, this::setTypeface);
}


Expand All @@ -55,6 +54,7 @@ private void init(Context context, AttributeSet attrs, int defStyleAttr) {
if (disableCopyAndPaste) {
XEditTextHelper.disableCopyAndPaste(this);
}
XTypefaceHelper.observer(this, this::setTypeface);
}

public boolean isDisableCopyAndPaste() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ public XTextView(Context context, @Nullable AttributeSet attrs) {
public XTextView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context, attrs, defStyleAttr);
XTypefaceHelper.observer(this, this::setTypeface);
}

private void init(Context context, AttributeSet attrs, int defStyleAttr) {
backgroundHelper = new XBackgroundHelper(context, attrs, defStyleAttr, this);
textViewHelper = new XTextViewHelper(context, attrs, defStyleAttr, this);
XTypefaceHelper.observer(this, this::setTypeface);
}

@Override
Expand Down

0 comments on commit 3d751dc

Please sign in to comment.