Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,408 @@
package androidx.core.widget;
import android.content.res.Resources;
import android.os.SystemClock;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import androidx.core.view.ViewCompat;
import com.ubt.jimu.base.mvp.SingleClickListener;
/* loaded from: classes.dex */
public abstract class AutoScrollHelper implements View.OnTouchListener {
private static final int r = ViewConfiguration.getTapTimeout();
final View c;
private Runnable d;
private int g;
private int h;
private boolean l;
boolean m;
boolean n;
boolean o;
private boolean p;
private boolean q;
final ClampedScroller a = new ClampedScroller();
private final Interpolator b = new AccelerateInterpolator();
private float[] e = {0.0f, 0.0f};
private float[] f = {Float.MAX_VALUE, Float.MAX_VALUE};
private float[] i = {0.0f, 0.0f};
private float[] j = {0.0f, 0.0f};
private float[] k = {Float.MAX_VALUE, Float.MAX_VALUE};
private static class ClampedScroller {
private int a;
private int b;
private float c;
private float d;
private float j;
private int k;
private long e = Long.MIN_VALUE;
private long i = -1;
private long f = 0;
private int g = 0;
private int h = 0;
ClampedScroller() {
}
private float a(float f) {
return ((-4.0f) * f * f) + (f * 4.0f);
}
public void a(int i) {
this.b = i;
}
public void b(int i) {
this.a = i;
}
public int c() {
return this.h;
}
public int d() {
float f = this.c;
return (int) (f / Math.abs(f));
}
public int e() {
float f = this.d;
return (int) (f / Math.abs(f));
}
public boolean f() {
return this.i > 0 && AnimationUtils.currentAnimationTimeMillis() > this.i + ((long) this.k);
}
public void g() {
long currentAnimationTimeMillis = AnimationUtils.currentAnimationTimeMillis();
this.k = AutoScrollHelper.a((int) (currentAnimationTimeMillis - this.e), 0, this.b);
this.j = a(currentAnimationTimeMillis);
this.i = currentAnimationTimeMillis;
}
public void h() {
this.e = AnimationUtils.currentAnimationTimeMillis();
this.i = -1L;
this.f = this.e;
this.j = 0.5f;
this.g = 0;
this.h = 0;
}
private float a(long j) {
if (j < this.e) {
return 0.0f;
}
long j2 = this.i;
if (j2 < 0 || j < j2) {
return AutoScrollHelper.a((j - this.e) / this.a, 0.0f, 1.0f) * 0.5f;
}
long j3 = j - j2;
float f = this.j;
return (1.0f - f) + (f * AutoScrollHelper.a(j3 / this.k, 0.0f, 1.0f));
}
public int b() {
return this.g;
}
public void a() {
if (this.f != 0) {
long currentAnimationTimeMillis = AnimationUtils.currentAnimationTimeMillis();
float a = a(a(currentAnimationTimeMillis));
long j = currentAnimationTimeMillis - this.f;
this.f = currentAnimationTimeMillis;
float f = j * a;
this.g = (int) (this.c * f);
this.h = (int) (f * this.d);
return;
}
throw new RuntimeException("Cannot compute scroll delta before calling start()");
}
public void a(float f, float f2) {
this.c = f;
this.d = f2;
}
}
private class ScrollAnimationRunnable implements Runnable {
ScrollAnimationRunnable() {
}
@Override // java.lang.Runnable
public void run() {
AutoScrollHelper autoScrollHelper = AutoScrollHelper.this;
if (autoScrollHelper.o) {
if (autoScrollHelper.m) {
autoScrollHelper.m = false;
autoScrollHelper.a.h();
}
ClampedScroller clampedScroller = AutoScrollHelper.this.a;
if (clampedScroller.f() || !AutoScrollHelper.this.b()) {
AutoScrollHelper.this.o = false;
return;
}
AutoScrollHelper autoScrollHelper2 = AutoScrollHelper.this;
if (autoScrollHelper2.n) {
autoScrollHelper2.n = false;
autoScrollHelper2.a();
}
clampedScroller.a();
AutoScrollHelper.this.a(clampedScroller.b(), clampedScroller.c());
ViewCompat.a(AutoScrollHelper.this.c, this);
}
}
}
public AutoScrollHelper(View view) {
this.c = view;
float f = Resources.getSystem().getDisplayMetrics().density;
float f2 = (int) ((1575.0f * f) + 0.5f);
b(f2, f2);
float f3 = (int) ((f * 315.0f) + 0.5f);
c(f3, f3);
d(1);
a(Float.MAX_VALUE, Float.MAX_VALUE);
d(0.2f, 0.2f);
e(1.0f, 1.0f);
c(r);
f(SingleClickListener.FAST_CLICK_DELAY_TIME);
e(SingleClickListener.FAST_CLICK_DELAY_TIME);
}
static float a(float f, float f2, float f3) {
return f > f3 ? f3 : f < f2 ? f2 : f;
}
static int a(int i, int i2, int i3) {
return i > i3 ? i3 : i < i2 ? i2 : i;
}
public AutoScrollHelper a(boolean z) {
if (this.p && !z) {
c();
}
this.p = z;
return this;
}
public abstract void a(int i, int i2);
public abstract boolean a(int i);
public AutoScrollHelper b(float f, float f2) {
float[] fArr = this.k;
fArr[0] = f / 1000.0f;
fArr[1] = f2 / 1000.0f;
return this;
}
public abstract boolean b(int i);
public AutoScrollHelper c(float f, float f2) {
float[] fArr = this.j;
fArr[0] = f / 1000.0f;
fArr[1] = f2 / 1000.0f;
return this;
}
public AutoScrollHelper d(int i) {
this.g = i;
return this;
}
public AutoScrollHelper e(float f, float f2) {
float[] fArr = this.i;
fArr[0] = f / 1000.0f;
fArr[1] = f2 / 1000.0f;
return this;
}
public AutoScrollHelper f(int i) {
this.a.b(i);
return this;
}
/* JADX WARN: Code restructure failed: missing block: B:11:0x0013, code lost:
if (r0 != 3) goto L20;
*/
@Override // android.view.View.OnTouchListener
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public boolean onTouch(android.view.View r6, android.view.MotionEvent r7) {
/*
r5 = this;
boolean r0 = r5.p
r1 = 0
if (r0 != 0) goto L6
return r1
L6:
int r0 = r7.getActionMasked()
r2 = 1
if (r0 == 0) goto L1a
if (r0 == r2) goto L16
r3 = 2
if (r0 == r3) goto L1e
r6 = 3
if (r0 == r6) goto L16
goto L58
L16:
r5.c()
goto L58
L1a:
r5.n = r2
r5.l = r1
L1e:
float r0 = r7.getX()
int r3 = r6.getWidth()
float r3 = (float) r3
android.view.View r4 = r5.c
int r4 = r4.getWidth()
float r4 = (float) r4
float r0 = r5.a(r1, r0, r3, r4)
float r7 = r7.getY()
int r6 = r6.getHeight()
float r6 = (float) r6
android.view.View r3 = r5.c
int r3 = r3.getHeight()
float r3 = (float) r3
float r6 = r5.a(r2, r7, r6, r3)
androidx.core.widget.AutoScrollHelper$ClampedScroller r7 = r5.a
r7.a(r0, r6)
boolean r6 = r5.o
if (r6 != 0) goto L58
boolean r6 = r5.b()
if (r6 == 0) goto L58
r5.d()
L58:
boolean r6 = r5.q
if (r6 == 0) goto L61
boolean r6 = r5.o
if (r6 == 0) goto L61
r1 = 1
L61:
return r1
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.core.widget.AutoScrollHelper.onTouch(android.view.View, android.view.MotionEvent):boolean");
}
private float f(float f, float f2) {
if (f2 == 0.0f) {
return 0.0f;
}
int i = this.g;
if (i == 0 || i == 1) {
if (f < f2) {
if (f >= 0.0f) {
return 1.0f - (f / f2);
}
if (this.o && this.g == 1) {
return 1.0f;
}
}
} else if (i == 2 && f < 0.0f) {
return f / (-f2);
}
return 0.0f;
}
public AutoScrollHelper d(float f, float f2) {
float[] fArr = this.e;
fArr[0] = f;
fArr[1] = f2;
return this;
}
boolean b() {
ClampedScroller clampedScroller = this.a;
int e = clampedScroller.e();
int d = clampedScroller.d();
return (e != 0 && b(e)) || (d != 0 && a(d));
}
public AutoScrollHelper c(int i) {
this.h = i;
return this;
}
public AutoScrollHelper e(int i) {
this.a.a(i);
return this;
}
private void c() {
if (this.m) {
this.o = false;
} else {
this.a.g();
}
}
private void d() {
int i;
if (this.d == null) {
this.d = new ScrollAnimationRunnable();
}
this.o = true;
this.m = true;
if (!this.l && (i = this.h) > 0) {
ViewCompat.a(this.c, this.d, i);
} else {
this.d.run();
}
this.l = true;
}
public AutoScrollHelper a(float f, float f2) {
float[] fArr = this.f;
fArr[0] = f;
fArr[1] = f2;
return this;
}
private float a(int i, float f, float f2, float f3) {
float a = a(this.e[i], f2, this.f[i], f);
if (a == 0.0f) {
return 0.0f;
}
float f4 = this.i[i];
float f5 = this.j[i];
float f6 = this.k[i];
float f7 = f4 * f3;
if (a > 0.0f) {
return a(a * f7, f5, f6);
}
return -a((-a) * f7, f5, f6);
}
private float a(float f, float f2, float f3, float f4) {
float interpolation;
float a = a(f * f2, 0.0f, f3);
float f5 = f(f2 - f4, a) - f(f4, a);
if (f5 < 0.0f) {
interpolation = -this.b.getInterpolation(-f5);
} else {
if (f5 <= 0.0f) {
return 0.0f;
}
interpolation = this.b.getInterpolation(f5);
}
return a(interpolation, -1.0f, 1.0f);
}
void a() {
long uptimeMillis = SystemClock.uptimeMillis();
MotionEvent obtain = MotionEvent.obtain(uptimeMillis, uptimeMillis, 3, 0.0f, 0.0f, 0);
this.c.onTouchEvent(obtain);
obtain.recycle();
}
}

View File

@@ -0,0 +1,12 @@
package androidx.core.widget;
import android.os.Build;
/* loaded from: classes.dex */
public interface AutoSizeableTextView {
public static final boolean w;
static {
w = Build.VERSION.SDK_INT >= 27;
}
}

View File

@@ -0,0 +1,58 @@
package androidx.core.widget;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.Log;
import android.widget.CompoundButton;
import java.lang.reflect.Field;
/* loaded from: classes.dex */
public final class CompoundButtonCompat {
private static Field a;
private static boolean b;
/* JADX WARN: Multi-variable type inference failed */
public static void a(CompoundButton compoundButton, ColorStateList colorStateList) {
if (Build.VERSION.SDK_INT >= 21) {
compoundButton.setButtonTintList(colorStateList);
} else if (compoundButton instanceof TintableCompoundButton) {
((TintableCompoundButton) compoundButton).setSupportButtonTintList(colorStateList);
}
}
/* JADX WARN: Multi-variable type inference failed */
public static void a(CompoundButton compoundButton, PorterDuff.Mode mode) {
if (Build.VERSION.SDK_INT >= 21) {
compoundButton.setButtonTintMode(mode);
} else if (compoundButton instanceof TintableCompoundButton) {
((TintableCompoundButton) compoundButton).setSupportButtonTintMode(mode);
}
}
public static Drawable a(CompoundButton compoundButton) {
if (Build.VERSION.SDK_INT >= 23) {
return compoundButton.getButtonDrawable();
}
if (!b) {
try {
a = CompoundButton.class.getDeclaredField("mButtonDrawable");
a.setAccessible(true);
} catch (NoSuchFieldException e) {
Log.i("CompoundButtonCompat", "Failed to retrieve mButtonDrawable field", e);
}
b = true;
}
Field field = a;
if (field != null) {
try {
return (Drawable) field.get(compoundButton);
} catch (IllegalAccessException e2) {
Log.i("CompoundButtonCompat", "Failed to get button drawable via reflection", e2);
a = null;
}
}
return null;
}
}

View File

@@ -0,0 +1,15 @@
package androidx.core.widget;
import android.os.Build;
import android.widget.EdgeEffect;
/* loaded from: classes.dex */
public final class EdgeEffectCompat {
public static void a(EdgeEffect edgeEffect, float f, float f2) {
if (Build.VERSION.SDK_INT >= 21) {
edgeEffect.onPull(f, f2);
} else {
edgeEffect.onPull(f);
}
}
}

View File

@@ -0,0 +1,78 @@
package androidx.core.widget;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.widget.ImageView;
/* loaded from: classes.dex */
public class ImageViewCompat {
/* JADX WARN: Multi-variable type inference failed */
public static ColorStateList a(ImageView imageView) {
if (Build.VERSION.SDK_INT >= 21) {
return imageView.getImageTintList();
}
if (imageView instanceof TintableImageSourceView) {
return ((TintableImageSourceView) imageView).getSupportImageTintList();
}
return null;
}
/* JADX WARN: Multi-variable type inference failed */
public static PorterDuff.Mode b(ImageView imageView) {
if (Build.VERSION.SDK_INT >= 21) {
return imageView.getImageTintMode();
}
if (imageView instanceof TintableImageSourceView) {
return ((TintableImageSourceView) imageView).getSupportImageTintMode();
}
return null;
}
/* JADX WARN: Multi-variable type inference failed */
public static void a(ImageView imageView, ColorStateList colorStateList) {
if (Build.VERSION.SDK_INT >= 21) {
imageView.setImageTintList(colorStateList);
if (Build.VERSION.SDK_INT == 21) {
Drawable drawable = imageView.getDrawable();
boolean z = (imageView.getImageTintList() == null || imageView.getImageTintMode() == null) ? false : true;
if (drawable == null || !z) {
return;
}
if (drawable.isStateful()) {
drawable.setState(imageView.getDrawableState());
}
imageView.setImageDrawable(drawable);
return;
}
return;
}
if (imageView instanceof TintableImageSourceView) {
((TintableImageSourceView) imageView).setSupportImageTintList(colorStateList);
}
}
/* JADX WARN: Multi-variable type inference failed */
public static void a(ImageView imageView, PorterDuff.Mode mode) {
if (Build.VERSION.SDK_INT >= 21) {
imageView.setImageTintMode(mode);
if (Build.VERSION.SDK_INT == 21) {
Drawable drawable = imageView.getDrawable();
boolean z = (imageView.getImageTintList() == null || imageView.getImageTintMode() == null) ? false : true;
if (drawable == null || !z) {
return;
}
if (drawable.isStateful()) {
drawable.setState(imageView.getDrawableState());
}
imageView.setImageDrawable(drawable);
return;
}
return;
}
if (imageView instanceof TintableImageSourceView) {
((TintableImageSourceView) imageView).setSupportImageTintMode(mode);
}
}
}

View File

@@ -0,0 +1,48 @@
package androidx.core.widget;
import android.widget.ListView;
/* loaded from: classes.dex */
public class ListViewAutoScrollHelper extends AutoScrollHelper {
private final ListView s;
public ListViewAutoScrollHelper(ListView listView) {
super(listView);
this.s = listView;
}
@Override // androidx.core.widget.AutoScrollHelper
public void a(int i, int i2) {
ListViewCompat.a(this.s, i2);
}
@Override // androidx.core.widget.AutoScrollHelper
public boolean a(int i) {
return false;
}
@Override // androidx.core.widget.AutoScrollHelper
public boolean b(int i) {
ListView listView = this.s;
int count = listView.getCount();
if (count == 0) {
return false;
}
int childCount = listView.getChildCount();
int firstVisiblePosition = listView.getFirstVisiblePosition();
int i2 = firstVisiblePosition + childCount;
if (i > 0) {
if (i2 >= count && listView.getChildAt(childCount - 1).getBottom() <= listView.getHeight()) {
return false;
}
} else {
if (i >= 0) {
return false;
}
if (firstVisiblePosition <= 0 && listView.getChildAt(0).getTop() >= 0) {
return false;
}
}
return true;
}
}

View File

@@ -0,0 +1,21 @@
package androidx.core.widget;
import android.os.Build;
import android.view.View;
import android.widget.ListView;
/* loaded from: classes.dex */
public final class ListViewCompat {
public static void a(ListView listView, int i) {
View childAt;
if (Build.VERSION.SDK_INT >= 19) {
listView.scrollListBy(i);
return;
}
int firstVisiblePosition = listView.getFirstVisiblePosition();
if (firstVisiblePosition == -1 || (childAt = listView.getChildAt(0)) == null) {
return;
}
listView.setSelectionFromTop(firstVisiblePosition, childAt.getTop() - i);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,78 @@
package androidx.core.widget;
import android.os.Build;
import android.util.Log;
import android.view.View;
import android.widget.PopupWindow;
import androidx.core.view.GravityCompat;
import androidx.core.view.ViewCompat;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
/* loaded from: classes.dex */
public final class PopupWindowCompat {
private static Method a;
private static boolean b;
private static Field c;
private static boolean d;
public static void a(PopupWindow popupWindow, View view, int i, int i2, int i3) {
if (Build.VERSION.SDK_INT >= 19) {
popupWindow.showAsDropDown(view, i, i2, i3);
return;
}
if ((GravityCompat.a(i3, ViewCompat.k(view)) & 7) == 5) {
i -= popupWindow.getWidth() - view.getWidth();
}
popupWindow.showAsDropDown(view, i, i2);
}
public static void a(PopupWindow popupWindow, boolean z) {
int i = Build.VERSION.SDK_INT;
if (i >= 23) {
popupWindow.setOverlapAnchor(z);
return;
}
if (i >= 21) {
if (!d) {
try {
c = PopupWindow.class.getDeclaredField("mOverlapAnchor");
c.setAccessible(true);
} catch (NoSuchFieldException e) {
Log.i("PopupWindowCompatApi21", "Could not fetch mOverlapAnchor field from PopupWindow", e);
}
d = true;
}
Field field = c;
if (field != null) {
try {
field.set(popupWindow, Boolean.valueOf(z));
} catch (IllegalAccessException e2) {
Log.i("PopupWindowCompatApi21", "Could not set overlap anchor field in PopupWindow", e2);
}
}
}
}
public static void a(PopupWindow popupWindow, int i) {
if (Build.VERSION.SDK_INT >= 23) {
popupWindow.setWindowLayoutType(i);
return;
}
if (!b) {
try {
a = PopupWindow.class.getDeclaredMethod("setWindowLayoutType", Integer.TYPE);
a.setAccessible(true);
} catch (Exception unused) {
}
b = true;
}
Method method = a;
if (method != null) {
try {
method.invoke(popupWindow, Integer.valueOf(i));
} catch (Exception unused2) {
}
}
}
}

View File

@@ -0,0 +1,374 @@
package androidx.core.widget;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.icu.text.DecimalFormatSymbols;
import android.os.Build;
import android.text.Editable;
import android.text.TextDirectionHeuristic;
import android.text.TextDirectionHeuristics;
import android.text.TextPaint;
import android.text.method.PasswordTransformationMethod;
import android.util.Log;
import android.view.ActionMode;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
import androidx.core.text.PrecomputedTextCompat;
import androidx.core.util.Preconditions;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
/* loaded from: classes.dex */
public final class TextViewCompat {
private static Field a;
private static boolean b;
private static Field c;
private static boolean d;
private static Field a(String str) {
Field field = null;
try {
field = TextView.class.getDeclaredField(str);
field.setAccessible(true);
return field;
} catch (NoSuchFieldException unused) {
Log.e("TextViewCompat", "Could not retrieve " + str + " field.");
return field;
}
}
public static void b(TextView textView, int i) {
Preconditions.a(i);
Paint.FontMetricsInt fontMetricsInt = textView.getPaint().getFontMetricsInt();
int i2 = (Build.VERSION.SDK_INT < 16 || textView.getIncludeFontPadding()) ? fontMetricsInt.bottom : fontMetricsInt.descent;
if (i > Math.abs(i2)) {
textView.setPadding(textView.getPaddingLeft(), textView.getPaddingTop(), textView.getPaddingRight(), i - i2);
}
}
public static int c(TextView textView) {
return textView.getPaddingBottom() + textView.getPaint().getFontMetricsInt().bottom;
}
public static int d(TextView textView) {
if (Build.VERSION.SDK_INT >= 16) {
return textView.getMaxLines();
}
if (!d) {
c = a("mMaxMode");
d = true;
}
Field field = c;
if (field == null || a(field, textView) != 1) {
return -1;
}
if (!b) {
a = a("mMaximum");
b = true;
}
Field field2 = a;
if (field2 != null) {
return a(field2, textView);
}
return -1;
}
private static TextDirectionHeuristic e(TextView textView) {
if (textView.getTransformationMethod() instanceof PasswordTransformationMethod) {
return TextDirectionHeuristics.LTR;
}
if (Build.VERSION.SDK_INT >= 28 && (textView.getInputType() & 15) == 3) {
byte directionality = Character.getDirectionality(DecimalFormatSymbols.getInstance(textView.getTextLocale()).getDigitStrings()[0].codePointAt(0));
return (directionality == 1 || directionality == 2) ? TextDirectionHeuristics.RTL : TextDirectionHeuristics.LTR;
}
boolean z = textView.getLayoutDirection() == 1;
switch (textView.getTextDirection()) {
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
case 6:
break;
case 7:
break;
default:
if (!z) {
break;
} else {
break;
}
}
return TextDirectionHeuristics.LTR;
}
public static PrecomputedTextCompat.Params f(TextView textView) {
if (Build.VERSION.SDK_INT >= 28) {
return new PrecomputedTextCompat.Params(textView.getTextMetricsParams());
}
PrecomputedTextCompat.Params.Builder builder = new PrecomputedTextCompat.Params.Builder(new TextPaint(textView.getPaint()));
if (Build.VERSION.SDK_INT >= 23) {
builder.a(textView.getBreakStrategy());
builder.b(textView.getHyphenationFrequency());
}
if (Build.VERSION.SDK_INT >= 18) {
builder.a(e(textView));
}
return builder.a();
}
public static void c(TextView textView, int i) {
Preconditions.a(i);
if (i != textView.getPaint().getFontMetricsInt(null)) {
textView.setLineSpacing(i - r0, 1.0f);
}
}
private static int a(Field field, TextView textView) {
try {
return field.getInt(textView);
} catch (IllegalAccessException unused) {
Log.d("TextViewCompat", "Could not retrieve value of " + field.getName() + " field.");
return -1;
}
}
public static void a(TextView textView, Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
int i = Build.VERSION.SDK_INT;
if (i >= 18) {
textView.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
return;
}
if (i >= 17) {
boolean z = textView.getLayoutDirection() == 1;
Drawable drawable5 = z ? drawable3 : drawable;
if (!z) {
drawable = drawable3;
}
textView.setCompoundDrawables(drawable5, drawable2, drawable, drawable4);
return;
}
textView.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
}
public static Drawable[] a(TextView textView) {
int i = Build.VERSION.SDK_INT;
if (i >= 18) {
return textView.getCompoundDrawablesRelative();
}
if (i >= 17) {
boolean z = textView.getLayoutDirection() == 1;
Drawable[] compoundDrawables = textView.getCompoundDrawables();
if (z) {
Drawable drawable = compoundDrawables[2];
Drawable drawable2 = compoundDrawables[0];
compoundDrawables[0] = drawable;
compoundDrawables[2] = drawable2;
}
return compoundDrawables;
}
return textView.getCompoundDrawables();
}
public static int b(TextView textView) {
return textView.getPaddingTop() - textView.getPaint().getFontMetricsInt().top;
}
public static void d(TextView textView, int i) {
if (Build.VERSION.SDK_INT >= 23) {
textView.setTextAppearance(i);
} else {
textView.setTextAppearance(textView.getContext(), i);
}
}
public static ActionMode.Callback a(TextView textView, ActionMode.Callback callback) {
int i = Build.VERSION.SDK_INT;
return (i < 26 || i > 27 || (callback instanceof OreoCallback)) ? callback : new OreoCallback(callback, textView);
}
public static void a(TextView textView, int i) {
int i2;
Preconditions.a(i);
if (Build.VERSION.SDK_INT >= 28) {
textView.setFirstBaselineToTopHeight(i);
return;
}
Paint.FontMetricsInt fontMetricsInt = textView.getPaint().getFontMetricsInt();
if (Build.VERSION.SDK_INT >= 16 && !textView.getIncludeFontPadding()) {
i2 = fontMetricsInt.ascent;
} else {
i2 = fontMetricsInt.top;
}
if (i > Math.abs(i2)) {
textView.setPadding(textView.getPaddingLeft(), i - (-i2), textView.getPaddingRight(), textView.getPaddingBottom());
}
}
private static class OreoCallback implements ActionMode.Callback {
private final ActionMode.Callback a;
private final TextView b;
private Class c;
private Method d;
private boolean e;
private boolean f = false;
OreoCallback(ActionMode.Callback callback, TextView textView) {
this.a = callback;
this.b = textView;
}
private void a(Menu menu) {
Context context = this.b.getContext();
PackageManager packageManager = context.getPackageManager();
if (!this.f) {
this.f = true;
try {
this.c = Class.forName("com.android.internal.view.menu.MenuBuilder");
this.d = this.c.getDeclaredMethod("removeItemAt", Integer.TYPE);
this.e = true;
} catch (ClassNotFoundException | NoSuchMethodException unused) {
this.c = null;
this.d = null;
this.e = false;
}
}
try {
Method declaredMethod = (this.e && this.c.isInstance(menu)) ? this.d : menu.getClass().getDeclaredMethod("removeItemAt", Integer.TYPE);
for (int size = menu.size() - 1; size >= 0; size--) {
MenuItem item = menu.getItem(size);
if (item.getIntent() != null && "android.intent.action.PROCESS_TEXT".equals(item.getIntent().getAction())) {
declaredMethod.invoke(menu, Integer.valueOf(size));
}
}
List<ResolveInfo> a = a(context, packageManager);
for (int i = 0; i < a.size(); i++) {
ResolveInfo resolveInfo = a.get(i);
menu.add(0, 0, i + 100, resolveInfo.loadLabel(packageManager)).setIntent(a(resolveInfo, this.b)).setShowAsAction(1);
}
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException unused2) {
}
}
@Override // android.view.ActionMode.Callback
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
return this.a.onActionItemClicked(actionMode, menuItem);
}
@Override // android.view.ActionMode.Callback
public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
return this.a.onCreateActionMode(actionMode, menu);
}
@Override // android.view.ActionMode.Callback
public void onDestroyActionMode(ActionMode actionMode) {
this.a.onDestroyActionMode(actionMode);
}
@Override // android.view.ActionMode.Callback
public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) {
a(menu);
return this.a.onPrepareActionMode(actionMode, menu);
}
private List<ResolveInfo> a(Context context, PackageManager packageManager) {
ArrayList arrayList = new ArrayList();
if (!(context instanceof Activity)) {
return arrayList;
}
for (ResolveInfo resolveInfo : packageManager.queryIntentActivities(a(), 0)) {
if (a(resolveInfo, context)) {
arrayList.add(resolveInfo);
}
}
return arrayList;
}
private boolean a(ResolveInfo resolveInfo, Context context) {
if (context.getPackageName().equals(resolveInfo.activityInfo.packageName)) {
return true;
}
if (!resolveInfo.activityInfo.exported) {
return false;
}
String str = resolveInfo.activityInfo.permission;
return str == null || context.checkSelfPermission(str) == 0;
}
private Intent a(ResolveInfo resolveInfo, TextView textView) {
return a().putExtra("android.intent.extra.PROCESS_TEXT_READONLY", !a(textView)).setClassName(resolveInfo.activityInfo.packageName, resolveInfo.activityInfo.name);
}
private boolean a(TextView textView) {
return (textView instanceof Editable) && textView.onCheckIsTextEditor() && textView.isEnabled();
}
private Intent a() {
return new Intent().setAction("android.intent.action.PROCESS_TEXT").setType("text/plain");
}
}
public static void a(TextView textView, PrecomputedTextCompat.Params params) {
if (Build.VERSION.SDK_INT >= 18) {
textView.setTextDirection(a(params.c()));
}
if (Build.VERSION.SDK_INT < 23) {
float textScaleX = params.d().getTextScaleX();
textView.getPaint().set(params.d());
if (textScaleX == textView.getTextScaleX()) {
textView.setTextScaleX((textScaleX / 2.0f) + 1.0f);
}
textView.setTextScaleX(textScaleX);
return;
}
textView.getPaint().set(params.d());
textView.setBreakStrategy(params.a());
textView.setHyphenationFrequency(params.b());
}
public static void a(TextView textView, PrecomputedTextCompat precomputedTextCompat) {
if (Build.VERSION.SDK_INT >= 28) {
textView.setText(precomputedTextCompat.b());
} else {
if (f(textView).equals(precomputedTextCompat.a())) {
textView.setText(precomputedTextCompat);
return;
}
throw new IllegalArgumentException("Given text can not be applied to TextView.");
}
}
private static int a(TextDirectionHeuristic textDirectionHeuristic) {
if (textDirectionHeuristic == TextDirectionHeuristics.FIRSTSTRONG_RTL || textDirectionHeuristic == TextDirectionHeuristics.FIRSTSTRONG_LTR) {
return 1;
}
if (textDirectionHeuristic == TextDirectionHeuristics.ANYRTL_LTR) {
return 2;
}
if (textDirectionHeuristic == TextDirectionHeuristics.LTR) {
return 3;
}
if (textDirectionHeuristic == TextDirectionHeuristics.RTL) {
return 4;
}
if (textDirectionHeuristic == TextDirectionHeuristics.LOCALE) {
return 5;
}
if (textDirectionHeuristic == TextDirectionHeuristics.FIRSTSTRONG_LTR) {
return 6;
}
return textDirectionHeuristic == TextDirectionHeuristics.FIRSTSTRONG_RTL ? 7 : 1;
}
}

View File

@@ -0,0 +1,11 @@
package androidx.core.widget;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
/* loaded from: classes.dex */
public interface TintableCompoundButton {
void setSupportButtonTintList(ColorStateList colorStateList);
void setSupportButtonTintMode(PorterDuff.Mode mode);
}

View File

@@ -0,0 +1,15 @@
package androidx.core.widget;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
/* loaded from: classes.dex */
public interface TintableImageSourceView {
ColorStateList getSupportImageTintList();
PorterDuff.Mode getSupportImageTintMode();
void setSupportImageTintList(ColorStateList colorStateList);
void setSupportImageTintMode(PorterDuff.Mode mode);
}