jimu-decompiled/sources/com/kyleduo/switchbutton/SwitchButton.java
2025-05-13 19:24:51 +02:00

956 lines
31 KiB
Java

package com.kyleduo.switchbutton;
import android.R;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Paint;
import android.graphics.PointF;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.Layout;
import android.text.StaticLayout;
import android.text.TextPaint;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewParent;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.CompoundButton;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.ItemTouchHelper;
/* loaded from: classes.dex */
public class SwitchButton extends CompoundButton {
private static int[] g0 = {R.attr.state_checked, R.attr.state_enabled, R.attr.state_pressed};
private static int[] h0 = {-16842912, R.attr.state_enabled, R.attr.state_pressed};
private RectF A;
private RectF B;
private Paint C;
private boolean D;
private boolean E;
private boolean F;
private ObjectAnimator G;
private float H;
private RectF I;
private float J;
private float K;
private float L;
private int M;
private int N;
private Paint O;
private CharSequence P;
private CharSequence Q;
private TextPaint R;
private Layout S;
private Layout T;
private float U;
private float V;
private int W;
private Drawable a;
private int a0;
private Drawable b;
private int b0;
private ColorStateList c;
private boolean c0;
private ColorStateList d;
private boolean d0;
private float e;
private boolean e0;
private float f;
private CompoundButton.OnCheckedChangeListener f0;
private RectF g;
private float h;
private long i;
private boolean j;
private int k;
private int l;
private int m;
private int n;
private int o;
private int p;
private int q;
private int r;
private int s;
private int t;
private Drawable u;
private Drawable v;
private RectF x;
private RectF y;
private RectF z;
static class SavedState extends View.BaseSavedState {
public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.Creator<SavedState>() { // from class: com.kyleduo.switchbutton.SwitchButton.SavedState.1
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.Creator
public SavedState createFromParcel(Parcel parcel) {
return new SavedState(parcel);
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.Creator
public SavedState[] newArray(int i) {
return new SavedState[i];
}
};
CharSequence offText;
CharSequence onText;
@Override // android.view.View.BaseSavedState, android.view.AbsSavedState, android.os.Parcelable
public void writeToParcel(Parcel parcel, int i) {
super.writeToParcel(parcel, i);
TextUtils.writeToParcel(this.onText, parcel, i);
TextUtils.writeToParcel(this.offText, parcel, i);
}
SavedState(Parcelable parcelable) {
super(parcelable);
}
private SavedState(Parcel parcel) {
super(parcel);
this.onText = (CharSequence) TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
this.offText = (CharSequence) TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
}
}
public SwitchButton(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.F = false;
this.c0 = false;
this.d0 = false;
this.e0 = false;
a(attributeSet);
}
private void a(AttributeSet attributeSet) {
String str;
String str2;
int i;
int i2;
int i3;
int i4;
float f;
float f2;
Drawable drawable;
ColorStateList colorStateList;
Drawable drawable2;
ColorStateList colorStateList2;
float f3;
float f4;
float f5;
float f6;
float f7;
float f8;
float f9;
int i5;
boolean z;
float f10;
TypedArray obtainStyledAttributes;
ColorStateList colorStateList3;
boolean z2;
this.M = ViewConfiguration.get(getContext()).getScaledTouchSlop();
this.N = ViewConfiguration.getPressedStateDuration() + ViewConfiguration.getTapTimeout();
this.C = new Paint(1);
this.O = new Paint(1);
this.O.setStyle(Paint.Style.STROKE);
this.O.setStrokeWidth(getResources().getDisplayMetrics().density);
this.R = getPaint();
this.x = new RectF();
this.y = new RectF();
this.z = new RectF();
this.g = new RectF();
this.A = new RectF();
this.B = new RectF();
this.G = ObjectAnimator.ofFloat(this, "progress", 0.0f, 0.0f).setDuration(250L);
this.G.setInterpolator(new AccelerateDecelerateInterpolator());
this.I = new RectF();
float f11 = getResources().getDisplayMetrics().density * 2.0f;
TypedArray obtainStyledAttributes2 = attributeSet == null ? null : getContext().obtainStyledAttributes(attributeSet, R$styleable.SwitchButton);
if (obtainStyledAttributes2 != null) {
drawable2 = obtainStyledAttributes2.getDrawable(R$styleable.SwitchButton_kswThumbDrawable);
colorStateList2 = obtainStyledAttributes2.getColorStateList(R$styleable.SwitchButton_kswThumbColor);
float dimension = obtainStyledAttributes2.getDimension(R$styleable.SwitchButton_kswThumbMargin, f11);
float dimension2 = obtainStyledAttributes2.getDimension(R$styleable.SwitchButton_kswThumbMarginLeft, dimension);
f4 = obtainStyledAttributes2.getDimension(R$styleable.SwitchButton_kswThumbMarginRight, dimension);
float dimension3 = obtainStyledAttributes2.getDimension(R$styleable.SwitchButton_kswThumbMarginTop, dimension);
float dimension4 = obtainStyledAttributes2.getDimension(R$styleable.SwitchButton_kswThumbMarginBottom, dimension);
float dimension5 = obtainStyledAttributes2.getDimension(R$styleable.SwitchButton_kswThumbWidth, 0.0f);
f2 = obtainStyledAttributes2.getDimension(R$styleable.SwitchButton_kswThumbHeight, 0.0f);
float dimension6 = obtainStyledAttributes2.getDimension(R$styleable.SwitchButton_kswThumbRadius, -1.0f);
float dimension7 = obtainStyledAttributes2.getDimension(R$styleable.SwitchButton_kswBackRadius, -1.0f);
Drawable drawable3 = obtainStyledAttributes2.getDrawable(R$styleable.SwitchButton_kswBackDrawable);
colorStateList = obtainStyledAttributes2.getColorStateList(R$styleable.SwitchButton_kswBackColor);
float f12 = obtainStyledAttributes2.getFloat(R$styleable.SwitchButton_kswThumbRangeRatio, 1.8f);
int integer = obtainStyledAttributes2.getInteger(R$styleable.SwitchButton_kswAnimationDuration, ItemTouchHelper.Callback.DEFAULT_SWIPE_ANIMATION_DURATION);
boolean z3 = obtainStyledAttributes2.getBoolean(R$styleable.SwitchButton_kswFadeBack, true);
int color = obtainStyledAttributes2.getColor(R$styleable.SwitchButton_kswTintColor, 0);
String string = obtainStyledAttributes2.getString(R$styleable.SwitchButton_kswTextOn);
String string2 = obtainStyledAttributes2.getString(R$styleable.SwitchButton_kswTextOff);
int dimensionPixelSize = obtainStyledAttributes2.getDimensionPixelSize(R$styleable.SwitchButton_kswTextThumbInset, 0);
int dimensionPixelSize2 = obtainStyledAttributes2.getDimensionPixelSize(R$styleable.SwitchButton_kswTextExtra, 0);
int dimensionPixelSize3 = obtainStyledAttributes2.getDimensionPixelSize(R$styleable.SwitchButton_kswTextAdjust, 0);
obtainStyledAttributes2.recycle();
i3 = dimensionPixelSize3;
f9 = dimension7;
f8 = dimension6;
f7 = f12;
i5 = integer;
drawable = drawable3;
z = z3;
i4 = color;
str2 = string2;
str = string;
f = dimension5;
f5 = dimension2;
f3 = dimension4;
i = dimensionPixelSize;
f6 = dimension3;
i2 = dimensionPixelSize2;
} else {
str = null;
str2 = null;
i = 0;
i2 = 0;
i3 = 0;
i4 = 0;
f = 0.0f;
f2 = 0.0f;
drawable = null;
colorStateList = null;
drawable2 = null;
colorStateList2 = null;
f3 = 0.0f;
f4 = 0.0f;
f5 = 0.0f;
f6 = 0.0f;
f7 = 1.8f;
f8 = -1.0f;
f9 = -1.0f;
i5 = ItemTouchHelper.Callback.DEFAULT_SWIPE_ANIMATION_DURATION;
z = true;
}
float f13 = f3;
if (attributeSet == null) {
f10 = f4;
obtainStyledAttributes = null;
} else {
f10 = f4;
obtainStyledAttributes = getContext().obtainStyledAttributes(attributeSet, new int[]{R.attr.focusable, R.attr.clickable});
}
if (obtainStyledAttributes != null) {
colorStateList3 = colorStateList;
boolean z4 = obtainStyledAttributes.getBoolean(0, true);
boolean z5 = obtainStyledAttributes.getBoolean(1, z4);
setFocusable(z4);
setClickable(z5);
obtainStyledAttributes.recycle();
} else {
colorStateList3 = colorStateList;
setFocusable(true);
setClickable(true);
}
this.P = str;
this.Q = str2;
this.W = i;
this.a0 = i2;
this.b0 = i3;
this.a = drawable2;
this.d = colorStateList2;
this.D = this.a != null;
this.k = i4;
if (this.k == 0) {
TypedValue typedValue = new TypedValue();
z2 = true;
if (getContext().getTheme().resolveAttribute(R$attr.colorAccent, typedValue, true)) {
this.k = typedValue.data;
} else {
this.k = 3309506;
}
} else {
z2 = true;
}
if (!this.D && this.d == null) {
this.d = ColorUtils.b(this.k);
this.p = this.d.getDefaultColor();
}
this.l = a(f);
this.m = a(f2);
this.b = drawable;
this.c = colorStateList3;
if (this.b == null) {
z2 = false;
}
this.E = z2;
if (!this.E && this.c == null) {
this.c = ColorUtils.a(this.k);
this.q = this.c.getDefaultColor();
this.r = this.c.getColorForState(g0, this.q);
}
this.g.set(f5, f6, f10, f13);
float f14 = f7;
if (this.g.width() >= 0.0f) {
f14 = Math.max(f14, 1.0f);
}
this.h = f14;
this.e = f8;
this.f = f9;
this.i = i5;
this.j = z;
this.G.setDuration(this.i);
if (isChecked()) {
setProgress(1.0f);
}
}
private int b(int i) {
int size = View.MeasureSpec.getSize(i);
int mode = View.MeasureSpec.getMode(i);
if (this.l == 0 && this.D) {
this.l = this.a.getIntrinsicWidth();
}
int a = a(this.U);
if (this.h == 0.0f) {
this.h = 1.8f;
}
if (mode != 1073741824) {
if (this.l == 0) {
this.l = a(getResources().getDisplayMetrics().density * 20.0f);
}
if (this.h == 0.0f) {
this.h = 1.8f;
}
int a2 = a(this.l * this.h);
float f = a + this.a0;
float f2 = a2 - this.l;
RectF rectF = this.g;
int a3 = a(f - ((f2 + Math.max(rectF.left, rectF.right)) + this.W));
float f3 = a2;
RectF rectF2 = this.g;
this.n = a(rectF2.left + f3 + rectF2.right + Math.max(0, a3));
if (this.n >= 0) {
int a4 = a(f3 + Math.max(0.0f, this.g.left) + Math.max(0.0f, this.g.right) + Math.max(0, a3));
return Math.max(a4, getPaddingLeft() + a4 + getPaddingRight());
}
this.l = 0;
this.n = 0;
return size;
}
int paddingLeft = (size - getPaddingLeft()) - getPaddingRight();
if (this.l != 0) {
int a5 = a(r2 * this.h);
int i2 = this.a0 + a;
int i3 = a5 - this.l;
RectF rectF3 = this.g;
int a6 = i2 - (i3 + a(Math.max(rectF3.left, rectF3.right)));
float f4 = a5;
RectF rectF4 = this.g;
this.n = a(rectF4.left + f4 + rectF4.right + Math.max(a6, 0));
if (this.n < 0) {
this.l = 0;
}
if (f4 + Math.max(this.g.left, 0.0f) + Math.max(this.g.right, 0.0f) + Math.max(a6, 0) > paddingLeft) {
this.l = 0;
}
}
if (this.l != 0) {
return size;
}
int a7 = a((((size - getPaddingLeft()) - getPaddingRight()) - Math.max(this.g.left, 0.0f)) - Math.max(this.g.right, 0.0f));
if (a7 < 0) {
this.l = 0;
this.n = 0;
return size;
}
float f5 = a7;
this.l = a(f5 / this.h);
RectF rectF5 = this.g;
this.n = a(f5 + rectF5.left + rectF5.right);
if (this.n < 0) {
this.l = 0;
this.n = 0;
return size;
}
int i4 = a + this.a0;
int i5 = a7 - this.l;
RectF rectF6 = this.g;
int a8 = i4 - (i5 + a(Math.max(rectF6.left, rectF6.right)));
if (a8 > 0) {
this.l -= a8;
}
if (this.l >= 0) {
return size;
}
this.l = 0;
this.n = 0;
return size;
}
private float getProgress() {
return this.H;
}
private boolean getStatusBasedOnPos() {
return getProgress() > 0.5f;
}
private void setDrawableState(Drawable drawable) {
if (drawable != null) {
drawable.setState(getDrawableState());
invalidate();
}
}
private void setProgress(float f) {
if (f > 1.0f) {
f = 1.0f;
} else if (f < 0.0f) {
f = 0.0f;
}
this.H = f;
invalidate();
}
@Override // android.widget.CompoundButton, android.widget.TextView, android.view.View
protected void drawableStateChanged() {
ColorStateList colorStateList;
ColorStateList colorStateList2;
super.drawableStateChanged();
if (this.D || (colorStateList2 = this.d) == null) {
setDrawableState(this.a);
} else {
this.p = colorStateList2.getColorForState(getDrawableState(), this.p);
}
int[] iArr = isChecked() ? h0 : g0;
ColorStateList textColors = getTextColors();
if (textColors != null) {
int defaultColor = textColors.getDefaultColor();
this.s = textColors.getColorForState(g0, defaultColor);
this.t = textColors.getColorForState(h0, defaultColor);
}
if (!this.E && (colorStateList = this.c) != null) {
this.q = colorStateList.getColorForState(getDrawableState(), this.q);
this.r = this.c.getColorForState(iArr, this.q);
return;
}
Drawable drawable = this.b;
if ((drawable instanceof StateListDrawable) && this.j) {
drawable.setState(iArr);
this.v = this.b.getCurrent().mutate();
} else {
this.v = null;
}
setDrawableState(this.b);
Drawable drawable2 = this.b;
if (drawable2 != null) {
this.u = drawable2.getCurrent().mutate();
}
}
public long getAnimationDuration() {
return this.i;
}
public ColorStateList getBackColor() {
return this.c;
}
public Drawable getBackDrawable() {
return this.b;
}
public float getBackRadius() {
return this.f;
}
public PointF getBackSizeF() {
return new PointF(this.y.width(), this.y.height());
}
public CharSequence getTextOff() {
return this.Q;
}
public CharSequence getTextOn() {
return this.P;
}
public ColorStateList getThumbColor() {
return this.d;
}
public Drawable getThumbDrawable() {
return this.a;
}
public float getThumbHeight() {
return this.m;
}
public RectF getThumbMargin() {
return this.g;
}
public float getThumbRadius() {
return this.e;
}
public float getThumbRangeRatio() {
return this.h;
}
public float getThumbWidth() {
return this.l;
}
public int getTintColor() {
return this.k;
}
/* JADX WARN: Removed duplicated region for block: B:38:0x012e */
/* JADX WARN: Removed duplicated region for block: B:40:0x0131 */
@Override // android.widget.CompoundButton, android.widget.TextView, android.view.View
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
protected void onDraw(android.graphics.Canvas r14) {
/*
Method dump skipped, instructions count: 525
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.kyleduo.switchbutton.SwitchButton.onDraw(android.graphics.Canvas):void");
}
@Override // android.widget.TextView, android.view.View
protected void onMeasure(int i, int i2) {
if (this.S == null && !TextUtils.isEmpty(this.P)) {
this.S = a(this.P);
}
if (this.T == null && !TextUtils.isEmpty(this.Q)) {
this.T = a(this.Q);
}
float width = this.S != null ? r0.getWidth() : 0.0f;
float width2 = this.T != null ? r2.getWidth() : 0.0f;
if (width == 0.0f && width2 == 0.0f) {
this.U = 0.0f;
} else {
this.U = Math.max(width, width2);
}
float height = this.S != null ? r0.getHeight() : 0.0f;
float height2 = this.T != null ? r2.getHeight() : 0.0f;
if (height == 0.0f && height2 == 0.0f) {
this.V = 0.0f;
} else {
this.V = Math.max(height, height2);
}
setMeasuredDimension(b(i), a(i2));
}
@Override // android.widget.CompoundButton, android.widget.TextView, android.view.View
public void onRestoreInstanceState(Parcelable parcelable) {
SavedState savedState = (SavedState) parcelable;
a(savedState.onText, savedState.offText);
this.c0 = true;
super.onRestoreInstanceState(savedState.getSuperState());
this.c0 = false;
}
@Override // android.widget.CompoundButton, android.widget.TextView, android.view.View
public Parcelable onSaveInstanceState() {
SavedState savedState = new SavedState(super.onSaveInstanceState());
savedState.onText = this.P;
savedState.offText = this.Q;
return savedState;
}
@Override // android.view.View
protected void onSizeChanged(int i, int i2, int i3, int i4) {
super.onSizeChanged(i, i2, i3, i4);
if (i == i3 && i2 == i4) {
return;
}
b();
}
/* JADX WARN: Code restructure failed: missing block: B:15:0x0034, code lost:
if (r0 != 3) goto L47;
*/
@Override // android.widget.TextView, android.view.View
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public boolean onTouchEvent(android.view.MotionEvent r10) {
/*
Method dump skipped, instructions count: 234
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.kyleduo.switchbutton.SwitchButton.onTouchEvent(android.view.MotionEvent):boolean");
}
@Override // android.widget.CompoundButton, android.view.View
public boolean performClick() {
return super.performClick();
}
public void setAnimationDuration(long j) {
this.i = j;
}
public void setBackColor(ColorStateList colorStateList) {
this.c = colorStateList;
if (this.c != null) {
setBackDrawable(null);
}
invalidate();
}
public void setBackColorRes(int i) {
setBackColor(ContextCompat.b(getContext(), i));
}
public void setBackDrawable(Drawable drawable) {
this.b = drawable;
this.E = this.b != null;
refreshDrawableState();
this.d0 = false;
requestLayout();
invalidate();
}
public void setBackDrawableRes(int i) {
setBackDrawable(ContextCompat.c(getContext(), i));
}
public void setBackRadius(float f) {
this.f = f;
if (this.E) {
return;
}
invalidate();
}
@Override // android.widget.CompoundButton, android.widget.Checkable
public void setChecked(boolean z) {
if (isChecked() != z) {
a(z);
}
if (this.c0) {
setCheckedImmediatelyNoEvent(z);
} else {
super.setChecked(z);
}
}
public void setCheckedImmediately(boolean z) {
super.setChecked(z);
ObjectAnimator objectAnimator = this.G;
if (objectAnimator != null && objectAnimator.isRunning()) {
this.G.cancel();
}
setProgress(z ? 1.0f : 0.0f);
invalidate();
}
public void setCheckedImmediatelyNoEvent(boolean z) {
if (this.f0 == null) {
setCheckedImmediately(z);
return;
}
super.setOnCheckedChangeListener(null);
setCheckedImmediately(z);
super.setOnCheckedChangeListener(this.f0);
}
public void setCheckedNoEvent(boolean z) {
if (this.f0 == null) {
setChecked(z);
return;
}
super.setOnCheckedChangeListener(null);
setChecked(z);
super.setOnCheckedChangeListener(this.f0);
}
public void setDrawDebugRect(boolean z) {
this.F = z;
invalidate();
}
public void setFadeBack(boolean z) {
this.j = z;
}
@Override // android.widget.CompoundButton
public void setOnCheckedChangeListener(CompoundButton.OnCheckedChangeListener onCheckedChangeListener) {
super.setOnCheckedChangeListener(onCheckedChangeListener);
this.f0 = onCheckedChangeListener;
}
public void setTextAdjust(int i) {
this.b0 = i;
this.d0 = false;
requestLayout();
invalidate();
}
public void setTextExtra(int i) {
this.a0 = i;
this.d0 = false;
requestLayout();
invalidate();
}
public void setTextThumbInset(int i) {
this.W = i;
this.d0 = false;
requestLayout();
invalidate();
}
public void setThumbColor(ColorStateList colorStateList) {
this.d = colorStateList;
if (this.d != null) {
setThumbDrawable(null);
}
invalidate();
}
public void setThumbColorRes(int i) {
setThumbColor(ContextCompat.b(getContext(), i));
}
public void setThumbDrawable(Drawable drawable) {
this.a = drawable;
this.D = this.a != null;
refreshDrawableState();
this.d0 = false;
requestLayout();
invalidate();
}
public void setThumbDrawableRes(int i) {
setThumbDrawable(ContextCompat.c(getContext(), i));
}
public void setThumbMargin(RectF rectF) {
if (rectF == null) {
a(0.0f, 0.0f, 0.0f, 0.0f);
} else {
a(rectF.left, rectF.top, rectF.right, rectF.bottom);
}
}
public void setThumbRadius(float f) {
this.e = f;
if (this.D) {
return;
}
invalidate();
}
public void setThumbRangeRatio(float f) {
this.h = f;
this.d0 = false;
requestLayout();
}
public void setTintColor(int i) {
this.k = i;
this.d = ColorUtils.b(this.k);
this.c = ColorUtils.a(this.k);
this.E = false;
this.D = false;
refreshDrawableState();
invalidate();
}
public SwitchButton(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.F = false;
this.c0 = false;
this.d0 = false;
this.e0 = false;
a(attributeSet);
}
public SwitchButton(Context context) {
super(context);
this.F = false;
this.c0 = false;
this.d0 = false;
this.e0 = false;
a((AttributeSet) null);
}
private void b() {
int i;
float paddingTop;
float paddingLeft;
if (this.l == 0 || (i = this.m) == 0 || this.n == 0 || this.o == 0) {
return;
}
if (this.e == -1.0f) {
this.e = Math.min(r0, i) / 2;
}
if (this.f == -1.0f) {
this.f = Math.min(this.n, this.o) / 2;
}
int measuredWidth = (getMeasuredWidth() - getPaddingLeft()) - getPaddingRight();
int measuredHeight = (getMeasuredHeight() - getPaddingTop()) - getPaddingBottom();
int a = a((this.n - Math.min(0.0f, this.g.left)) - Math.min(0.0f, this.g.right));
if (measuredHeight <= a((this.o - Math.min(0.0f, this.g.top)) - Math.min(0.0f, this.g.bottom))) {
paddingTop = getPaddingTop() + Math.max(0.0f, this.g.top);
} else {
paddingTop = (((measuredHeight - r3) + 1) / 2) + getPaddingTop() + Math.max(0.0f, this.g.top);
}
if (measuredWidth <= this.n) {
paddingLeft = getPaddingLeft() + Math.max(0.0f, this.g.left);
} else {
paddingLeft = (((measuredWidth - a) + 1) / 2) + getPaddingLeft() + Math.max(0.0f, this.g.left);
}
this.x.set(paddingLeft, paddingTop, this.l + paddingLeft, this.m + paddingTop);
RectF rectF = this.x;
float f = rectF.left;
RectF rectF2 = this.g;
float f2 = f - rectF2.left;
RectF rectF3 = this.y;
float f3 = rectF.top;
float f4 = rectF2.top;
rectF3.set(f2, f3 - f4, this.n + f2, (f3 - f4) + this.o);
RectF rectF4 = this.z;
RectF rectF5 = this.x;
rectF4.set(rectF5.left, 0.0f, (this.y.right - this.g.right) - rectF5.width(), 0.0f);
this.f = Math.min(Math.min(this.y.width(), this.y.height()) / 2.0f, this.f);
Drawable drawable = this.b;
if (drawable != null) {
RectF rectF6 = this.y;
drawable.setBounds((int) rectF6.left, (int) rectF6.top, a(rectF6.right), a(this.y.bottom));
}
if (this.S != null) {
RectF rectF7 = this.y;
float width = (rectF7.left + (((((rectF7.width() + this.W) - this.l) - this.g.right) - this.S.getWidth()) / 2.0f)) - this.b0;
RectF rectF8 = this.y;
float height = rectF8.top + ((rectF8.height() - this.S.getHeight()) / 2.0f);
this.A.set(width, height, this.S.getWidth() + width, this.S.getHeight() + height);
}
if (this.T != null) {
RectF rectF9 = this.y;
float width2 = ((rectF9.right - (((((rectF9.width() + this.W) - this.l) - this.g.left) - this.T.getWidth()) / 2.0f)) - this.T.getWidth()) + this.b0;
RectF rectF10 = this.y;
float height2 = rectF10.top + ((rectF10.height() - this.T.getHeight()) / 2.0f);
this.B.set(width2, height2, this.T.getWidth() + width2, this.T.getHeight() + height2);
}
this.d0 = true;
}
private Layout a(CharSequence charSequence) {
return new StaticLayout(charSequence, this.R, (int) Math.ceil(Layout.getDesiredWidth(charSequence, r2)), Layout.Alignment.ALIGN_CENTER, 1.0f, 0.0f, false);
}
private int a(int i) {
int size = View.MeasureSpec.getSize(i);
int mode = View.MeasureSpec.getMode(i);
if (this.m == 0 && this.D) {
this.m = this.a.getIntrinsicHeight();
}
if (mode == 1073741824) {
if (this.m != 0) {
RectF rectF = this.g;
this.o = a(r6 + rectF.top + rectF.bottom);
this.o = a(Math.max(this.o, this.V));
if ((((this.o + getPaddingTop()) + getPaddingBottom()) - Math.min(0.0f, this.g.top)) - Math.min(0.0f, this.g.bottom) > size) {
this.m = 0;
}
}
if (this.m == 0) {
this.o = a(((size - getPaddingTop()) - getPaddingBottom()) + Math.min(0.0f, this.g.top) + Math.min(0.0f, this.g.bottom));
if (this.o < 0) {
this.o = 0;
this.m = 0;
return size;
}
RectF rectF2 = this.g;
this.m = a((r6 - rectF2.top) - rectF2.bottom);
}
if (this.m >= 0) {
return size;
}
this.o = 0;
this.m = 0;
return size;
}
if (this.m == 0) {
this.m = a(getResources().getDisplayMetrics().density * 20.0f);
}
float f = this.m;
RectF rectF3 = this.g;
this.o = a(f + rectF3.top + rectF3.bottom);
if (this.o < 0) {
this.o = 0;
this.m = 0;
return size;
}
int a = a(this.V - r6);
if (a > 0) {
this.o += a;
this.m += a;
}
int max = Math.max(this.m, this.o);
return Math.max(Math.max(max, getPaddingTop() + max + getPaddingBottom()), getSuggestedMinimumHeight());
}
private int a(double d) {
return (int) Math.ceil(d);
}
protected void a(boolean z) {
ObjectAnimator objectAnimator = this.G;
if (objectAnimator == null) {
return;
}
if (objectAnimator.isRunning()) {
this.G.cancel();
}
this.G.setDuration(this.i);
if (z) {
this.G.setFloatValues(this.H, 1.0f);
} else {
this.G.setFloatValues(this.H, 0.0f);
}
this.G.start();
}
private void a() {
ViewParent parent = getParent();
if (parent != null) {
parent.requestDisallowInterceptTouchEvent(true);
}
this.e0 = true;
}
public void a(float f, float f2, float f3, float f4) {
this.g.set(f, f2, f3, f4);
this.d0 = false;
requestLayout();
}
public void a(CharSequence charSequence, CharSequence charSequence2) {
this.P = charSequence;
this.Q = charSequence2;
this.S = null;
this.T = null;
this.d0 = false;
requestLayout();
invalidate();
}
}