ADD week 5

This commit is contained in:
2025-03-31 16:33:42 +02:00
parent 86f265f22d
commit bf645048e6
4927 changed files with 544053 additions and 0 deletions

View File

@ -0,0 +1,436 @@
package androidx.core.widget;
import android.content.res.Resources;
import android.os.SystemClock;
import android.util.DisplayMetrics;
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;
/* loaded from: classes.dex */
public abstract class AutoScrollHelper implements View.OnTouchListener {
private static final int DEFAULT_ACTIVATION_DELAY = ViewConfiguration.getTapTimeout();
private static final int DEFAULT_EDGE_TYPE = 1;
private static final float DEFAULT_MAXIMUM_EDGE = Float.MAX_VALUE;
private static final int DEFAULT_MAXIMUM_VELOCITY_DIPS = 1575;
private static final int DEFAULT_MINIMUM_VELOCITY_DIPS = 315;
private static final int DEFAULT_RAMP_DOWN_DURATION = 500;
private static final int DEFAULT_RAMP_UP_DURATION = 500;
private static final float DEFAULT_RELATIVE_EDGE = 0.2f;
private static final float DEFAULT_RELATIVE_VELOCITY = 1.0f;
public static final int EDGE_TYPE_INSIDE = 0;
public static final int EDGE_TYPE_INSIDE_EXTEND = 1;
public static final int EDGE_TYPE_OUTSIDE = 2;
private static final int HORIZONTAL = 0;
public static final float NO_MAX = Float.MAX_VALUE;
public static final float NO_MIN = 0.0f;
public static final float RELATIVE_UNSPECIFIED = 0.0f;
private static final int VERTICAL = 1;
private int mActivationDelay;
private boolean mAlreadyDelayed;
boolean mAnimating;
private int mEdgeType;
private boolean mEnabled;
private boolean mExclusive;
boolean mNeedsCancel;
boolean mNeedsReset;
private Runnable mRunnable;
final View mTarget;
final ClampedScroller mScroller = new ClampedScroller();
private final Interpolator mEdgeInterpolator = new AccelerateInterpolator();
private float[] mRelativeEdges = {0.0f, 0.0f};
private float[] mMaximumEdges = {Float.MAX_VALUE, Float.MAX_VALUE};
private float[] mRelativeVelocity = {0.0f, 0.0f};
private float[] mMinimumVelocity = {0.0f, 0.0f};
private float[] mMaximumVelocity = {Float.MAX_VALUE, Float.MAX_VALUE};
static float constrain(float f, float f2, float f3) {
return f > f3 ? f3 : f < f2 ? f2 : f;
}
static int constrain(int i, int i2, int i3) {
return i > i3 ? i3 : i < i2 ? i2 : i;
}
private float constrainEdgeValue(float f, float f2) {
if (f2 == 0.0f) {
return 0.0f;
}
int i = this.mEdgeType;
if (i == 0 || i == 1) {
if (f < f2) {
if (f >= 0.0f) {
return 1.0f - (f / f2);
}
if (this.mAnimating && i == 1) {
return 1.0f;
}
}
} else if (i == 2 && f < 0.0f) {
return f / (-f2);
}
return 0.0f;
}
public abstract boolean canTargetScrollHorizontally(int i);
public abstract boolean canTargetScrollVertically(int i);
public boolean isEnabled() {
return this.mEnabled;
}
public boolean isExclusive() {
return this.mExclusive;
}
public abstract void scrollTargetBy(int i, int i2);
public AutoScrollHelper setActivationDelay(int i) {
this.mActivationDelay = i;
return this;
}
public AutoScrollHelper setEdgeType(int i) {
this.mEdgeType = i;
return this;
}
public AutoScrollHelper setExclusive(boolean z) {
this.mExclusive = z;
return this;
}
public AutoScrollHelper(View view) {
this.mTarget = view;
DisplayMetrics displayMetrics = Resources.getSystem().getDisplayMetrics();
int i = (int) ((displayMetrics.density * 1575.0f) + 0.5f);
int i2 = (int) ((displayMetrics.density * 315.0f) + 0.5f);
float f = i;
setMaximumVelocity(f, f);
float f2 = i2;
setMinimumVelocity(f2, f2);
setEdgeType(1);
setMaximumEdges(Float.MAX_VALUE, Float.MAX_VALUE);
setRelativeEdges(0.2f, 0.2f);
setRelativeVelocity(1.0f, 1.0f);
setActivationDelay(DEFAULT_ACTIVATION_DELAY);
setRampUpDuration(500);
setRampDownDuration(500);
}
public AutoScrollHelper setEnabled(boolean z) {
if (this.mEnabled && !z) {
requestStop();
}
this.mEnabled = z;
return this;
}
public AutoScrollHelper setMaximumVelocity(float f, float f2) {
float[] fArr = this.mMaximumVelocity;
fArr[0] = f / 1000.0f;
fArr[1] = f2 / 1000.0f;
return this;
}
public AutoScrollHelper setMinimumVelocity(float f, float f2) {
float[] fArr = this.mMinimumVelocity;
fArr[0] = f / 1000.0f;
fArr[1] = f2 / 1000.0f;
return this;
}
public AutoScrollHelper setRelativeVelocity(float f, float f2) {
float[] fArr = this.mRelativeVelocity;
fArr[0] = f / 1000.0f;
fArr[1] = f2 / 1000.0f;
return this;
}
public AutoScrollHelper setRelativeEdges(float f, float f2) {
float[] fArr = this.mRelativeEdges;
fArr[0] = f;
fArr[1] = f2;
return this;
}
public AutoScrollHelper setMaximumEdges(float f, float f2) {
float[] fArr = this.mMaximumEdges;
fArr[0] = f;
fArr[1] = f2;
return this;
}
public AutoScrollHelper setRampUpDuration(int i) {
this.mScroller.setRampUpDuration(i);
return this;
}
public AutoScrollHelper setRampDownDuration(int i) {
this.mScroller.setRampDownDuration(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 add '--show-bad-code' argument
*/
public boolean onTouch(android.view.View r6, android.view.MotionEvent r7) {
/*
r5 = this;
boolean r0 = r5.mEnabled
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.requestStop()
goto L58
L1a:
r5.mNeedsCancel = r2
r5.mAlreadyDelayed = r1
L1e:
float r0 = r7.getX()
int r3 = r6.getWidth()
float r3 = (float) r3
android.view.View r4 = r5.mTarget
int r4 = r4.getWidth()
float r4 = (float) r4
float r0 = r5.computeTargetVelocity(r1, r0, r3, r4)
float r7 = r7.getY()
int r6 = r6.getHeight()
float r6 = (float) r6
android.view.View r3 = r5.mTarget
int r3 = r3.getHeight()
float r3 = (float) r3
float r6 = r5.computeTargetVelocity(r2, r7, r6, r3)
androidx.core.widget.AutoScrollHelper$ClampedScroller r7 = r5.mScroller
r7.setTargetVelocity(r0, r6)
boolean r6 = r5.mAnimating
if (r6 != 0) goto L58
boolean r6 = r5.shouldAnimate()
if (r6 == 0) goto L58
r5.startAnimating()
L58:
boolean r6 = r5.mExclusive
if (r6 == 0) goto L61
boolean r6 = r5.mAnimating
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");
}
boolean shouldAnimate() {
ClampedScroller clampedScroller = this.mScroller;
int verticalDirection = clampedScroller.getVerticalDirection();
int horizontalDirection = clampedScroller.getHorizontalDirection();
return (verticalDirection != 0 && canTargetScrollVertically(verticalDirection)) || (horizontalDirection != 0 && canTargetScrollHorizontally(horizontalDirection));
}
private void startAnimating() {
int i;
if (this.mRunnable == null) {
this.mRunnable = new ScrollAnimationRunnable();
}
this.mAnimating = true;
this.mNeedsReset = true;
if (!this.mAlreadyDelayed && (i = this.mActivationDelay) > 0) {
ViewCompat.postOnAnimationDelayed(this.mTarget, this.mRunnable, i);
} else {
this.mRunnable.run();
}
this.mAlreadyDelayed = true;
}
private void requestStop() {
if (this.mNeedsReset) {
this.mAnimating = false;
} else {
this.mScroller.requestStop();
}
}
private float computeTargetVelocity(int i, float f, float f2, float f3) {
float edgeValue = getEdgeValue(this.mRelativeEdges[i], f2, this.mMaximumEdges[i], f);
if (edgeValue == 0.0f) {
return 0.0f;
}
float f4 = this.mRelativeVelocity[i];
float f5 = this.mMinimumVelocity[i];
float f6 = this.mMaximumVelocity[i];
float f7 = f4 * f3;
if (edgeValue > 0.0f) {
return constrain(edgeValue * f7, f5, f6);
}
return -constrain((-edgeValue) * f7, f5, f6);
}
private float getEdgeValue(float f, float f2, float f3, float f4) {
float interpolation;
float constrain = constrain(f * f2, 0.0f, f3);
float constrainEdgeValue = constrainEdgeValue(f2 - f4, constrain) - constrainEdgeValue(f4, constrain);
if (constrainEdgeValue < 0.0f) {
interpolation = -this.mEdgeInterpolator.getInterpolation(-constrainEdgeValue);
} else {
if (constrainEdgeValue <= 0.0f) {
return 0.0f;
}
interpolation = this.mEdgeInterpolator.getInterpolation(constrainEdgeValue);
}
return constrain(interpolation, -1.0f, 1.0f);
}
void cancelTargetTouch() {
long uptimeMillis = SystemClock.uptimeMillis();
MotionEvent obtain = MotionEvent.obtain(uptimeMillis, uptimeMillis, 3, 0.0f, 0.0f, 0);
this.mTarget.onTouchEvent(obtain);
obtain.recycle();
}
private class ScrollAnimationRunnable implements Runnable {
ScrollAnimationRunnable() {
}
@Override // java.lang.Runnable
public void run() {
if (AutoScrollHelper.this.mAnimating) {
if (AutoScrollHelper.this.mNeedsReset) {
AutoScrollHelper.this.mNeedsReset = false;
AutoScrollHelper.this.mScroller.start();
}
ClampedScroller clampedScroller = AutoScrollHelper.this.mScroller;
if (clampedScroller.isFinished() || !AutoScrollHelper.this.shouldAnimate()) {
AutoScrollHelper.this.mAnimating = false;
return;
}
if (AutoScrollHelper.this.mNeedsCancel) {
AutoScrollHelper.this.mNeedsCancel = false;
AutoScrollHelper.this.cancelTargetTouch();
}
clampedScroller.computeScrollDelta();
AutoScrollHelper.this.scrollTargetBy(clampedScroller.getDeltaX(), clampedScroller.getDeltaY());
ViewCompat.postOnAnimation(AutoScrollHelper.this.mTarget, this);
}
}
}
private static class ClampedScroller {
private int mEffectiveRampDown;
private int mRampDownDuration;
private int mRampUpDuration;
private float mStopValue;
private float mTargetVelocityX;
private float mTargetVelocityY;
private long mStartTime = Long.MIN_VALUE;
private long mStopTime = -1;
private long mDeltaTime = 0;
private int mDeltaX = 0;
private int mDeltaY = 0;
private float interpolateValue(float f) {
return ((-4.0f) * f * f) + (f * 4.0f);
}
public int getDeltaX() {
return this.mDeltaX;
}
public int getDeltaY() {
return this.mDeltaY;
}
public void setRampDownDuration(int i) {
this.mRampDownDuration = i;
}
public void setRampUpDuration(int i) {
this.mRampUpDuration = i;
}
public void setTargetVelocity(float f, float f2) {
this.mTargetVelocityX = f;
this.mTargetVelocityY = f2;
}
ClampedScroller() {
}
public void start() {
long currentAnimationTimeMillis = AnimationUtils.currentAnimationTimeMillis();
this.mStartTime = currentAnimationTimeMillis;
this.mStopTime = -1L;
this.mDeltaTime = currentAnimationTimeMillis;
this.mStopValue = 0.5f;
this.mDeltaX = 0;
this.mDeltaY = 0;
}
public void requestStop() {
long currentAnimationTimeMillis = AnimationUtils.currentAnimationTimeMillis();
this.mEffectiveRampDown = AutoScrollHelper.constrain((int) (currentAnimationTimeMillis - this.mStartTime), 0, this.mRampDownDuration);
this.mStopValue = getValueAt(currentAnimationTimeMillis);
this.mStopTime = currentAnimationTimeMillis;
}
public boolean isFinished() {
return this.mStopTime > 0 && AnimationUtils.currentAnimationTimeMillis() > this.mStopTime + ((long) this.mEffectiveRampDown);
}
private float getValueAt(long j) {
if (j < this.mStartTime) {
return 0.0f;
}
long j2 = this.mStopTime;
if (j2 < 0 || j < j2) {
return AutoScrollHelper.constrain((j - r0) / this.mRampUpDuration, 0.0f, 1.0f) * 0.5f;
}
float f = this.mStopValue;
return (1.0f - f) + (f * AutoScrollHelper.constrain((j - j2) / this.mEffectiveRampDown, 0.0f, 1.0f));
}
public void computeScrollDelta() {
if (this.mDeltaTime == 0) {
throw new RuntimeException("Cannot compute scroll delta before calling start()");
}
long currentAnimationTimeMillis = AnimationUtils.currentAnimationTimeMillis();
float interpolateValue = interpolateValue(getValueAt(currentAnimationTimeMillis));
long j = currentAnimationTimeMillis - this.mDeltaTime;
this.mDeltaTime = currentAnimationTimeMillis;
float f = j * interpolateValue;
this.mDeltaX = (int) (this.mTargetVelocityX * f);
this.mDeltaY = (int) (f * this.mTargetVelocityY);
}
public int getHorizontalDirection() {
float f = this.mTargetVelocityX;
return (int) (f / Math.abs(f));
}
public int getVerticalDirection() {
float f = this.mTargetVelocityY;
return (int) (f / Math.abs(f));
}
}
}

View File

@ -0,0 +1,30 @@
package androidx.core.widget;
import android.os.Build;
/* loaded from: classes.dex */
public interface AutoSizeableTextView {
@Deprecated
public static final boolean PLATFORM_SUPPORTS_AUTOSIZE;
static {
PLATFORM_SUPPORTS_AUTOSIZE = Build.VERSION.SDK_INT >= 27;
}
int getAutoSizeMaxTextSize();
int getAutoSizeMinTextSize();
int getAutoSizeStepGranularity();
int[] getAutoSizeTextAvailableSizes();
int getAutoSizeTextType();
void setAutoSizeTextTypeUniformWithConfiguration(int i, int i2, int i3, int i4) throws IllegalArgumentException;
void setAutoSizeTextTypeUniformWithPresetSizes(int[] iArr, int i) throws IllegalArgumentException;
void setAutoSizeTextTypeWithDefaults(int i);
}

View File

@ -0,0 +1,97 @@
package androidx.core.widget;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.widget.CheckedTextView;
import java.lang.reflect.Field;
/* loaded from: classes.dex */
public final class CheckedTextViewCompat {
private static final String TAG = "CheckedTextViewCompat";
private CheckedTextViewCompat() {
}
public static void setCheckMarkTintList(CheckedTextView checkedTextView, ColorStateList colorStateList) {
Api21Impl.setCheckMarkTintList(checkedTextView, colorStateList);
}
public static ColorStateList getCheckMarkTintList(CheckedTextView checkedTextView) {
return Api21Impl.getCheckMarkTintList(checkedTextView);
}
public static void setCheckMarkTintMode(CheckedTextView checkedTextView, PorterDuff.Mode mode) {
Api21Impl.setCheckMarkTintMode(checkedTextView, mode);
}
public static PorterDuff.Mode getCheckMarkTintMode(CheckedTextView checkedTextView) {
return Api21Impl.getCheckMarkTintMode(checkedTextView);
}
public static Drawable getCheckMarkDrawable(CheckedTextView checkedTextView) {
return Api16Impl.getCheckMarkDrawable(checkedTextView);
}
private static class Api21Impl {
private Api21Impl() {
}
static void setCheckMarkTintList(CheckedTextView checkedTextView, ColorStateList colorStateList) {
checkedTextView.setCheckMarkTintList(colorStateList);
}
static ColorStateList getCheckMarkTintList(CheckedTextView checkedTextView) {
return checkedTextView.getCheckMarkTintList();
}
static void setCheckMarkTintMode(CheckedTextView checkedTextView, PorterDuff.Mode mode) {
checkedTextView.setCheckMarkTintMode(mode);
}
static PorterDuff.Mode getCheckMarkTintMode(CheckedTextView checkedTextView) {
return checkedTextView.getCheckMarkTintMode();
}
}
private static class Api16Impl {
private Api16Impl() {
}
static Drawable getCheckMarkDrawable(CheckedTextView checkedTextView) {
return checkedTextView.getCheckMarkDrawable();
}
}
private static class Api14Impl {
private static Field sCheckMarkDrawableField;
private static boolean sResolved;
private Api14Impl() {
}
static Drawable getCheckMarkDrawable(CheckedTextView checkedTextView) {
if (!sResolved) {
try {
Field declaredField = CheckedTextView.class.getDeclaredField("mCheckMarkDrawable");
sCheckMarkDrawableField = declaredField;
declaredField.setAccessible(true);
} catch (NoSuchFieldException e) {
Log.i(CheckedTextViewCompat.TAG, "Failed to retrieve mCheckMarkDrawable field", e);
}
sResolved = true;
}
Field field = sCheckMarkDrawableField;
if (field != null) {
try {
return (Drawable) field.get(checkedTextView);
} catch (IllegalAccessException e2) {
Log.i(CheckedTextViewCompat.TAG, "Failed to get check mark drawable via reflection", e2);
sCheckMarkDrawableField = null;
}
}
return null;
}
}
}

View File

@ -0,0 +1,91 @@
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 final String TAG = "CompoundButtonCompat";
private static Field sButtonDrawableField;
private static boolean sButtonDrawableFieldFetched;
private CompoundButtonCompat() {
}
public static void setButtonTintList(CompoundButton compoundButton, ColorStateList colorStateList) {
Api21Impl.setButtonTintList(compoundButton, colorStateList);
}
public static ColorStateList getButtonTintList(CompoundButton compoundButton) {
return Api21Impl.getButtonTintList(compoundButton);
}
public static void setButtonTintMode(CompoundButton compoundButton, PorterDuff.Mode mode) {
Api21Impl.setButtonTintMode(compoundButton, mode);
}
public static PorterDuff.Mode getButtonTintMode(CompoundButton compoundButton) {
return Api21Impl.getButtonTintMode(compoundButton);
}
public static Drawable getButtonDrawable(CompoundButton compoundButton) {
if (Build.VERSION.SDK_INT >= 23) {
return Api23Impl.getButtonDrawable(compoundButton);
}
if (!sButtonDrawableFieldFetched) {
try {
Field declaredField = CompoundButton.class.getDeclaredField("mButtonDrawable");
sButtonDrawableField = declaredField;
declaredField.setAccessible(true);
} catch (NoSuchFieldException e) {
Log.i(TAG, "Failed to retrieve mButtonDrawable field", e);
}
sButtonDrawableFieldFetched = true;
}
Field field = sButtonDrawableField;
if (field != null) {
try {
return (Drawable) field.get(compoundButton);
} catch (IllegalAccessException e2) {
Log.i(TAG, "Failed to get button drawable via reflection", e2);
sButtonDrawableField = null;
}
}
return null;
}
static class Api21Impl {
private Api21Impl() {
}
static void setButtonTintList(CompoundButton compoundButton, ColorStateList colorStateList) {
compoundButton.setButtonTintList(colorStateList);
}
static ColorStateList getButtonTintList(CompoundButton compoundButton) {
return compoundButton.getButtonTintList();
}
static void setButtonTintMode(CompoundButton compoundButton, PorterDuff.Mode mode) {
compoundButton.setButtonTintMode(mode);
}
static PorterDuff.Mode getButtonTintMode(CompoundButton compoundButton) {
return compoundButton.getButtonTintMode();
}
}
static class Api23Impl {
private Api23Impl() {
}
static Drawable getButtonDrawable(CompoundButton compoundButton) {
return compoundButton.getButtonDrawable();
}
}
}

View File

@ -0,0 +1,125 @@
package androidx.core.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ProgressBar;
/* loaded from: classes.dex */
public class ContentLoadingProgressBar extends ProgressBar {
private static final int MIN_DELAY_MS = 500;
private static final int MIN_SHOW_TIME_MS = 500;
private final Runnable mDelayedHide;
private final Runnable mDelayedShow;
boolean mDismissed;
boolean mPostedHide;
boolean mPostedShow;
long mStartTime;
/* renamed from: lambda$new$0$androidx-core-widget-ContentLoadingProgressBar, reason: not valid java name */
/* synthetic */ void m164lambda$new$0$androidxcorewidgetContentLoadingProgressBar() {
this.mPostedHide = false;
this.mStartTime = -1L;
setVisibility(8);
}
/* renamed from: lambda$new$1$androidx-core-widget-ContentLoadingProgressBar, reason: not valid java name */
/* synthetic */ void m165lambda$new$1$androidxcorewidgetContentLoadingProgressBar() {
this.mPostedShow = false;
if (this.mDismissed) {
return;
}
this.mStartTime = System.currentTimeMillis();
setVisibility(0);
}
public ContentLoadingProgressBar(Context context) {
this(context, null);
}
public ContentLoadingProgressBar(Context context, AttributeSet attributeSet) {
super(context, attributeSet, 0);
this.mStartTime = -1L;
this.mPostedHide = false;
this.mPostedShow = false;
this.mDismissed = false;
this.mDelayedHide = new Runnable() { // from class: androidx.core.widget.ContentLoadingProgressBar$$ExternalSyntheticLambda2
@Override // java.lang.Runnable
public final void run() {
ContentLoadingProgressBar.this.m164lambda$new$0$androidxcorewidgetContentLoadingProgressBar();
}
};
this.mDelayedShow = new Runnable() { // from class: androidx.core.widget.ContentLoadingProgressBar$$ExternalSyntheticLambda3
@Override // java.lang.Runnable
public final void run() {
ContentLoadingProgressBar.this.m165lambda$new$1$androidxcorewidgetContentLoadingProgressBar();
}
};
}
@Override // android.widget.ProgressBar, android.view.View
public void onAttachedToWindow() {
super.onAttachedToWindow();
removeCallbacks();
}
@Override // android.widget.ProgressBar, android.view.View
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
removeCallbacks();
}
private void removeCallbacks() {
removeCallbacks(this.mDelayedHide);
removeCallbacks(this.mDelayedShow);
}
public void hide() {
post(new Runnable() { // from class: androidx.core.widget.ContentLoadingProgressBar$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
ContentLoadingProgressBar.this.hideOnUiThread();
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public void hideOnUiThread() {
this.mDismissed = true;
removeCallbacks(this.mDelayedShow);
this.mPostedShow = false;
long currentTimeMillis = System.currentTimeMillis();
long j = this.mStartTime;
long j2 = currentTimeMillis - j;
if (j2 >= 500 || j == -1) {
setVisibility(8);
} else {
if (this.mPostedHide) {
return;
}
postDelayed(this.mDelayedHide, 500 - j2);
this.mPostedHide = true;
}
}
public void show() {
post(new Runnable() { // from class: androidx.core.widget.ContentLoadingProgressBar$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
ContentLoadingProgressBar.this.showOnUiThread();
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public void showOnUiThread() {
this.mStartTime = -1L;
this.mDismissed = false;
removeCallbacks(this.mDelayedHide);
this.mPostedHide = false;
if (this.mPostedShow) {
return;
}
postDelayed(this.mDelayedShow, 500L);
this.mPostedShow = true;
}
}

View File

@ -0,0 +1,126 @@
package androidx.core.widget;
import android.content.Context;
import android.graphics.Canvas;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.EdgeEffect;
/* loaded from: classes.dex */
public final class EdgeEffectCompat {
private final EdgeEffect mEdgeEffect;
@Deprecated
public EdgeEffectCompat(Context context) {
this.mEdgeEffect = new EdgeEffect(context);
}
public static EdgeEffect create(Context context, AttributeSet attributeSet) {
if (Build.VERSION.SDK_INT >= 31) {
return Api31Impl.create(context, attributeSet);
}
return new EdgeEffect(context);
}
public static float getDistance(EdgeEffect edgeEffect) {
if (Build.VERSION.SDK_INT >= 31) {
return Api31Impl.getDistance(edgeEffect);
}
return 0.0f;
}
@Deprecated
public void setSize(int i, int i2) {
this.mEdgeEffect.setSize(i, i2);
}
@Deprecated
public boolean isFinished() {
return this.mEdgeEffect.isFinished();
}
@Deprecated
public void finish() {
this.mEdgeEffect.finish();
}
@Deprecated
public boolean onPull(float f) {
this.mEdgeEffect.onPull(f);
return true;
}
@Deprecated
public boolean onPull(float f, float f2) {
onPull(this.mEdgeEffect, f, f2);
return true;
}
public static void onPull(EdgeEffect edgeEffect, float f, float f2) {
Api21Impl.onPull(edgeEffect, f, f2);
}
public static float onPullDistance(EdgeEffect edgeEffect, float f, float f2) {
if (Build.VERSION.SDK_INT >= 31) {
return Api31Impl.onPullDistance(edgeEffect, f, f2);
}
onPull(edgeEffect, f, f2);
return f;
}
@Deprecated
public boolean onRelease() {
this.mEdgeEffect.onRelease();
return this.mEdgeEffect.isFinished();
}
@Deprecated
public boolean onAbsorb(int i) {
this.mEdgeEffect.onAbsorb(i);
return true;
}
@Deprecated
public boolean draw(Canvas canvas) {
return this.mEdgeEffect.draw(canvas);
}
private static class Api31Impl {
private Api31Impl() {
}
public static EdgeEffect create(Context context, AttributeSet attributeSet) {
try {
return new EdgeEffect(context, attributeSet);
} catch (Throwable unused) {
return new EdgeEffect(context);
}
}
public static float onPullDistance(EdgeEffect edgeEffect, float f, float f2) {
try {
return edgeEffect.onPullDistance(f, f2);
} catch (Throwable unused) {
edgeEffect.onPull(f, f2);
return 0.0f;
}
}
public static float getDistance(EdgeEffect edgeEffect) {
try {
return edgeEffect.getDistance();
} catch (Throwable unused) {
return 0.0f;
}
}
}
static class Api21Impl {
private Api21Impl() {
}
static void onPull(EdgeEffect edgeEffect, float f, float f2) {
edgeEffect.onPull(f, f2);
}
}
}

View File

@ -0,0 +1,66 @@
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 {
public static ColorStateList getImageTintList(ImageView imageView) {
return Api21Impl.getImageTintList(imageView);
}
public static void setImageTintList(ImageView imageView, ColorStateList colorStateList) {
Drawable drawable;
Api21Impl.setImageTintList(imageView, colorStateList);
if (Build.VERSION.SDK_INT != 21 || (drawable = imageView.getDrawable()) == null || Api21Impl.getImageTintList(imageView) == null) {
return;
}
if (drawable.isStateful()) {
drawable.setState(imageView.getDrawableState());
}
imageView.setImageDrawable(drawable);
}
public static PorterDuff.Mode getImageTintMode(ImageView imageView) {
return Api21Impl.getImageTintMode(imageView);
}
public static void setImageTintMode(ImageView imageView, PorterDuff.Mode mode) {
Drawable drawable;
Api21Impl.setImageTintMode(imageView, mode);
if (Build.VERSION.SDK_INT != 21 || (drawable = imageView.getDrawable()) == null || Api21Impl.getImageTintList(imageView) == null) {
return;
}
if (drawable.isStateful()) {
drawable.setState(imageView.getDrawableState());
}
imageView.setImageDrawable(drawable);
}
private ImageViewCompat() {
}
static class Api21Impl {
private Api21Impl() {
}
static ColorStateList getImageTintList(ImageView imageView) {
return imageView.getImageTintList();
}
static void setImageTintList(ImageView imageView, ColorStateList colorStateList) {
imageView.setImageTintList(colorStateList);
}
static PorterDuff.Mode getImageTintMode(ImageView imageView) {
return imageView.getImageTintMode();
}
static void setImageTintMode(ImageView imageView, PorterDuff.Mode mode) {
imageView.setImageTintMode(mode);
}
}
}

View File

@ -0,0 +1,28 @@
package androidx.core.widget;
import android.view.View;
import android.widget.ListPopupWindow;
/* loaded from: classes.dex */
public final class ListPopupWindowCompat {
private ListPopupWindowCompat() {
}
@Deprecated
public static View.OnTouchListener createDragToOpenListener(Object obj, View view) {
return createDragToOpenListener((ListPopupWindow) obj, view);
}
public static View.OnTouchListener createDragToOpenListener(ListPopupWindow listPopupWindow, View view) {
return Api19Impl.createDragToOpenListener(listPopupWindow, view);
}
static class Api19Impl {
private Api19Impl() {
}
static View.OnTouchListener createDragToOpenListener(ListPopupWindow listPopupWindow, View view) {
return listPopupWindow.createDragToOpenListener(view);
}
}
}

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 mTarget;
@Override // androidx.core.widget.AutoScrollHelper
public boolean canTargetScrollHorizontally(int i) {
return false;
}
public ListViewAutoScrollHelper(ListView listView) {
super(listView);
this.mTarget = listView;
}
@Override // androidx.core.widget.AutoScrollHelper
public void scrollTargetBy(int i, int i2) {
ListViewCompat.scrollListBy(this.mTarget, i2);
}
@Override // androidx.core.widget.AutoScrollHelper
public boolean canTargetScrollVertically(int i) {
ListView listView = this.mTarget;
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,30 @@
package androidx.core.widget;
import android.widget.ListView;
/* loaded from: classes.dex */
public final class ListViewCompat {
public static void scrollListBy(ListView listView, int i) {
Api19Impl.scrollListBy(listView, i);
}
public static boolean canScrollList(ListView listView, int i) {
return Api19Impl.canScrollList(listView, i);
}
private ListViewCompat() {
}
static class Api19Impl {
private Api19Impl() {
}
static void scrollListBy(ListView listView, int i) {
listView.scrollListBy(i);
}
static boolean canScrollList(ListView listView, int i) {
return listView.canScrollList(i);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,23 @@
package androidx.core.widget;
import android.view.View;
import android.widget.PopupMenu;
/* loaded from: classes.dex */
public final class PopupMenuCompat {
private PopupMenuCompat() {
}
public static View.OnTouchListener getDragToOpenListener(Object obj) {
return Api19Impl.getDragToOpenListener((PopupMenu) obj);
}
static class Api19Impl {
private Api19Impl() {
}
static View.OnTouchListener getDragToOpenListener(PopupMenu popupMenu) {
return popupMenu.getDragToOpenListener();
}
}
}

View File

@ -0,0 +1,153 @@
package androidx.core.widget;
import android.os.Build;
import android.util.Log;
import android.view.View;
import android.widget.PopupWindow;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
/* loaded from: classes.dex */
public final class PopupWindowCompat {
private static final String TAG = "PopupWindowCompatApi21";
private static Method sGetWindowLayoutTypeMethod;
private static boolean sGetWindowLayoutTypeMethodAttempted;
private static Field sOverlapAnchorField;
private static boolean sOverlapAnchorFieldAttempted;
private static Method sSetWindowLayoutTypeMethod;
private static boolean sSetWindowLayoutTypeMethodAttempted;
private PopupWindowCompat() {
}
public static void showAsDropDown(PopupWindow popupWindow, View view, int i, int i2, int i3) {
Api19Impl.showAsDropDown(popupWindow, view, i, i2, i3);
}
public static void setOverlapAnchor(PopupWindow popupWindow, boolean z) {
if (Build.VERSION.SDK_INT >= 23) {
Api23Impl.setOverlapAnchor(popupWindow, z);
return;
}
if (!sOverlapAnchorFieldAttempted) {
try {
Field declaredField = PopupWindow.class.getDeclaredField("mOverlapAnchor");
sOverlapAnchorField = declaredField;
declaredField.setAccessible(true);
} catch (NoSuchFieldException e) {
Log.i(TAG, "Could not fetch mOverlapAnchor field from PopupWindow", e);
}
sOverlapAnchorFieldAttempted = true;
}
Field field = sOverlapAnchorField;
if (field != null) {
try {
field.set(popupWindow, Boolean.valueOf(z));
} catch (IllegalAccessException e2) {
Log.i(TAG, "Could not set overlap anchor field in PopupWindow", e2);
}
}
}
public static boolean getOverlapAnchor(PopupWindow popupWindow) {
if (Build.VERSION.SDK_INT >= 23) {
return Api23Impl.getOverlapAnchor(popupWindow);
}
if (!sOverlapAnchorFieldAttempted) {
try {
Field declaredField = PopupWindow.class.getDeclaredField("mOverlapAnchor");
sOverlapAnchorField = declaredField;
declaredField.setAccessible(true);
} catch (NoSuchFieldException e) {
Log.i(TAG, "Could not fetch mOverlapAnchor field from PopupWindow", e);
}
sOverlapAnchorFieldAttempted = true;
}
Field field = sOverlapAnchorField;
if (field == null) {
return false;
}
try {
return ((Boolean) field.get(popupWindow)).booleanValue();
} catch (IllegalAccessException e2) {
Log.i(TAG, "Could not get overlap anchor field in PopupWindow", e2);
return false;
}
}
public static void setWindowLayoutType(PopupWindow popupWindow, int i) {
if (Build.VERSION.SDK_INT >= 23) {
Api23Impl.setWindowLayoutType(popupWindow, i);
return;
}
if (!sSetWindowLayoutTypeMethodAttempted) {
try {
Method declaredMethod = PopupWindow.class.getDeclaredMethod("setWindowLayoutType", Integer.TYPE);
sSetWindowLayoutTypeMethod = declaredMethod;
declaredMethod.setAccessible(true);
} catch (Exception unused) {
}
sSetWindowLayoutTypeMethodAttempted = true;
}
Method method = sSetWindowLayoutTypeMethod;
if (method != null) {
try {
method.invoke(popupWindow, Integer.valueOf(i));
} catch (Exception unused2) {
}
}
}
public static int getWindowLayoutType(PopupWindow popupWindow) {
if (Build.VERSION.SDK_INT >= 23) {
return Api23Impl.getWindowLayoutType(popupWindow);
}
if (!sGetWindowLayoutTypeMethodAttempted) {
try {
Method declaredMethod = PopupWindow.class.getDeclaredMethod("getWindowLayoutType", new Class[0]);
sGetWindowLayoutTypeMethod = declaredMethod;
declaredMethod.setAccessible(true);
} catch (Exception unused) {
}
sGetWindowLayoutTypeMethodAttempted = true;
}
Method method = sGetWindowLayoutTypeMethod;
if (method != null) {
try {
return ((Integer) method.invoke(popupWindow, new Object[0])).intValue();
} catch (Exception unused2) {
}
}
return 0;
}
static class Api23Impl {
private Api23Impl() {
}
static void setOverlapAnchor(PopupWindow popupWindow, boolean z) {
popupWindow.setOverlapAnchor(z);
}
static boolean getOverlapAnchor(PopupWindow popupWindow) {
return popupWindow.getOverlapAnchor();
}
static void setWindowLayoutType(PopupWindow popupWindow, int i) {
popupWindow.setWindowLayoutType(i);
}
static int getWindowLayoutType(PopupWindow popupWindow) {
return popupWindow.getWindowLayoutType();
}
}
static class Api19Impl {
private Api19Impl() {
}
static void showAsDropDown(PopupWindow popupWindow, View view, int i, int i2, int i3) {
popupWindow.showAsDropDown(view, i, i2, i3);
}
}
}

View File

@ -0,0 +1,105 @@
package androidx.core.widget;
import android.content.Context;
import android.view.animation.Interpolator;
import android.widget.OverScroller;
@Deprecated
/* loaded from: classes.dex */
public final class ScrollerCompat {
OverScroller mScroller;
@Deprecated
public static ScrollerCompat create(Context context) {
return create(context, null);
}
@Deprecated
public static ScrollerCompat create(Context context, Interpolator interpolator) {
return new ScrollerCompat(context, interpolator);
}
ScrollerCompat(Context context, Interpolator interpolator) {
this.mScroller = interpolator != null ? new OverScroller(context, interpolator) : new OverScroller(context);
}
@Deprecated
public boolean isFinished() {
return this.mScroller.isFinished();
}
@Deprecated
public int getCurrX() {
return this.mScroller.getCurrX();
}
@Deprecated
public int getCurrY() {
return this.mScroller.getCurrY();
}
@Deprecated
public int getFinalX() {
return this.mScroller.getFinalX();
}
@Deprecated
public int getFinalY() {
return this.mScroller.getFinalY();
}
@Deprecated
public float getCurrVelocity() {
return this.mScroller.getCurrVelocity();
}
@Deprecated
public boolean computeScrollOffset() {
return this.mScroller.computeScrollOffset();
}
@Deprecated
public void startScroll(int i, int i2, int i3, int i4) {
this.mScroller.startScroll(i, i2, i3, i4);
}
@Deprecated
public void startScroll(int i, int i2, int i3, int i4, int i5) {
this.mScroller.startScroll(i, i2, i3, i4, i5);
}
@Deprecated
public void fling(int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8) {
this.mScroller.fling(i, i2, i3, i4, i5, i6, i7, i8);
}
@Deprecated
public void fling(int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10) {
this.mScroller.fling(i, i2, i3, i4, i5, i6, i7, i8, i9, i10);
}
@Deprecated
public boolean springBack(int i, int i2, int i3, int i4, int i5, int i6) {
return this.mScroller.springBack(i, i2, i3, i4, i5, i6);
}
@Deprecated
public void abortAnimation() {
this.mScroller.abortAnimation();
}
@Deprecated
public void notifyHorizontalEdgeReached(int i, int i2, int i3) {
this.mScroller.notifyHorizontalEdgeReached(i, i2, i3);
}
@Deprecated
public void notifyVerticalEdgeReached(int i, int i2, int i3) {
this.mScroller.notifyVerticalEdgeReached(i, i2, i3);
}
@Deprecated
public boolean isOverScrolled() {
return this.mScroller.isOverScrolled();
}
}

View File

@ -0,0 +1,657 @@
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.content.res.ColorStateList;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.icu.text.DecimalFormatSymbols;
import android.os.Build;
import android.text.Editable;
import android.text.PrecomputedText;
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.view.View;
import android.widget.TextView;
import androidx.core.text.PrecomputedTextCompat;
import androidx.core.util.Preconditions;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
/* loaded from: classes.dex */
public final class TextViewCompat {
public static final int AUTO_SIZE_TEXT_TYPE_NONE = 0;
public static final int AUTO_SIZE_TEXT_TYPE_UNIFORM = 1;
private static final int LINES = 1;
private static final String LOG_TAG = "TextViewCompat";
private static Field sMaxModeField;
private static boolean sMaxModeFieldFetched;
private static Field sMaximumField;
private static boolean sMaximumFieldFetched;
private static Field sMinModeField;
private static boolean sMinModeFieldFetched;
private static Field sMinimumField;
private static boolean sMinimumFieldFetched;
@Retention(RetentionPolicy.SOURCE)
public @interface AutoSizeTextType {
}
private TextViewCompat() {
}
private static Field retrieveField(String str) {
Field field = null;
try {
field = TextView.class.getDeclaredField(str);
field.setAccessible(true);
return field;
} catch (NoSuchFieldException unused) {
Log.e(LOG_TAG, "Could not retrieve " + str + " field.");
return field;
}
}
private static int retrieveIntFromField(Field field, TextView textView) {
try {
return field.getInt(textView);
} catch (IllegalAccessException unused) {
Log.d(LOG_TAG, "Could not retrieve value of " + field.getName() + " field.");
return -1;
}
}
public static void setCompoundDrawablesRelative(TextView textView, Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
Api17Impl.setCompoundDrawablesRelative(textView, drawable, drawable2, drawable3, drawable4);
}
public static void setCompoundDrawablesRelativeWithIntrinsicBounds(TextView textView, Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
Api17Impl.setCompoundDrawablesRelativeWithIntrinsicBounds(textView, drawable, drawable2, drawable3, drawable4);
}
public static void setCompoundDrawablesRelativeWithIntrinsicBounds(TextView textView, int i, int i2, int i3, int i4) {
Api17Impl.setCompoundDrawablesRelativeWithIntrinsicBounds(textView, i, i2, i3, i4);
}
public static int getMaxLines(TextView textView) {
return Api16Impl.getMaxLines(textView);
}
public static int getMinLines(TextView textView) {
return Api16Impl.getMinLines(textView);
}
public static void setTextAppearance(TextView textView, int i) {
if (Build.VERSION.SDK_INT >= 23) {
textView.setTextAppearance(i);
} else {
textView.setTextAppearance(textView.getContext(), i);
}
}
public static Drawable[] getCompoundDrawablesRelative(TextView textView) {
return Api17Impl.getCompoundDrawablesRelative(textView);
}
/* JADX WARN: Multi-variable type inference failed */
public static void setAutoSizeTextTypeWithDefaults(TextView textView, int i) {
if (Build.VERSION.SDK_INT >= 27) {
Api26Impl.setAutoSizeTextTypeWithDefaults(textView, i);
} else if (textView instanceof AutoSizeableTextView) {
((AutoSizeableTextView) textView).setAutoSizeTextTypeWithDefaults(i);
}
}
/* JADX WARN: Multi-variable type inference failed */
public static void setAutoSizeTextTypeUniformWithConfiguration(TextView textView, int i, int i2, int i3, int i4) throws IllegalArgumentException {
if (Build.VERSION.SDK_INT >= 27) {
Api26Impl.setAutoSizeTextTypeUniformWithConfiguration(textView, i, i2, i3, i4);
} else if (textView instanceof AutoSizeableTextView) {
((AutoSizeableTextView) textView).setAutoSizeTextTypeUniformWithConfiguration(i, i2, i3, i4);
}
}
/* JADX WARN: Multi-variable type inference failed */
public static void setAutoSizeTextTypeUniformWithPresetSizes(TextView textView, int[] iArr, int i) throws IllegalArgumentException {
if (Build.VERSION.SDK_INT >= 27) {
Api26Impl.setAutoSizeTextTypeUniformWithPresetSizes(textView, iArr, i);
} else if (textView instanceof AutoSizeableTextView) {
((AutoSizeableTextView) textView).setAutoSizeTextTypeUniformWithPresetSizes(iArr, i);
}
}
/* JADX WARN: Multi-variable type inference failed */
public static int getAutoSizeTextType(TextView textView) {
if (Build.VERSION.SDK_INT >= 27) {
return Api26Impl.getAutoSizeTextType(textView);
}
if (textView instanceof AutoSizeableTextView) {
return ((AutoSizeableTextView) textView).getAutoSizeTextType();
}
return 0;
}
/* JADX WARN: Multi-variable type inference failed */
public static int getAutoSizeStepGranularity(TextView textView) {
if (Build.VERSION.SDK_INT >= 27) {
return Api26Impl.getAutoSizeStepGranularity(textView);
}
if (textView instanceof AutoSizeableTextView) {
return ((AutoSizeableTextView) textView).getAutoSizeStepGranularity();
}
return -1;
}
/* JADX WARN: Multi-variable type inference failed */
public static int getAutoSizeMinTextSize(TextView textView) {
if (Build.VERSION.SDK_INT >= 27) {
return Api26Impl.getAutoSizeMinTextSize(textView);
}
if (textView instanceof AutoSizeableTextView) {
return ((AutoSizeableTextView) textView).getAutoSizeMinTextSize();
}
return -1;
}
/* JADX WARN: Multi-variable type inference failed */
public static int getAutoSizeMaxTextSize(TextView textView) {
if (Build.VERSION.SDK_INT >= 27) {
return Api26Impl.getAutoSizeMaxTextSize(textView);
}
if (textView instanceof AutoSizeableTextView) {
return ((AutoSizeableTextView) textView).getAutoSizeMaxTextSize();
}
return -1;
}
/* JADX WARN: Multi-variable type inference failed */
public static int[] getAutoSizeTextAvailableSizes(TextView textView) {
if (Build.VERSION.SDK_INT >= 27) {
return Api26Impl.getAutoSizeTextAvailableSizes(textView);
}
return textView instanceof AutoSizeableTextView ? ((AutoSizeableTextView) textView).getAutoSizeTextAvailableSizes() : new int[0];
}
public static void setCustomSelectionActionModeCallback(TextView textView, ActionMode.Callback callback) {
textView.setCustomSelectionActionModeCallback(wrapCustomSelectionActionModeCallback(textView, callback));
}
public static ActionMode.Callback wrapCustomSelectionActionModeCallback(TextView textView, ActionMode.Callback callback) {
return (Build.VERSION.SDK_INT < 26 || Build.VERSION.SDK_INT > 27 || (callback instanceof OreoCallback) || callback == null) ? callback : new OreoCallback(callback, textView);
}
public static ActionMode.Callback unwrapCustomSelectionActionModeCallback(ActionMode.Callback callback) {
return (!(callback instanceof OreoCallback) || Build.VERSION.SDK_INT < 26) ? callback : ((OreoCallback) callback).getWrappedCallback();
}
private static class OreoCallback implements ActionMode.Callback {
private static final int MENU_ITEM_ORDER_PROCESS_TEXT_INTENT_ACTIONS_START = 100;
private final ActionMode.Callback mCallback;
private boolean mCanUseMenuBuilderReferences;
private boolean mInitializedMenuBuilderReferences = false;
private Class<?> mMenuBuilderClass;
private Method mMenuBuilderRemoveItemAtMethod;
private final TextView mTextView;
ActionMode.Callback getWrappedCallback() {
return this.mCallback;
}
OreoCallback(ActionMode.Callback callback, TextView textView) {
this.mCallback = callback;
this.mTextView = textView;
}
@Override // android.view.ActionMode.Callback
public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
return this.mCallback.onCreateActionMode(actionMode, menu);
}
@Override // android.view.ActionMode.Callback
public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) {
recomputeProcessTextMenuItems(menu);
return this.mCallback.onPrepareActionMode(actionMode, menu);
}
@Override // android.view.ActionMode.Callback
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
return this.mCallback.onActionItemClicked(actionMode, menuItem);
}
@Override // android.view.ActionMode.Callback
public void onDestroyActionMode(ActionMode actionMode) {
this.mCallback.onDestroyActionMode(actionMode);
}
private void recomputeProcessTextMenuItems(Menu menu) {
Context context = this.mTextView.getContext();
PackageManager packageManager = context.getPackageManager();
if (!this.mInitializedMenuBuilderReferences) {
this.mInitializedMenuBuilderReferences = true;
try {
Class<?> cls = Class.forName("com.android.internal.view.menu.MenuBuilder");
this.mMenuBuilderClass = cls;
this.mMenuBuilderRemoveItemAtMethod = cls.getDeclaredMethod("removeItemAt", Integer.TYPE);
this.mCanUseMenuBuilderReferences = true;
} catch (ClassNotFoundException | NoSuchMethodException unused) {
this.mMenuBuilderClass = null;
this.mMenuBuilderRemoveItemAtMethod = null;
this.mCanUseMenuBuilderReferences = false;
}
}
try {
Method declaredMethod = (this.mCanUseMenuBuilderReferences && this.mMenuBuilderClass.isInstance(menu)) ? this.mMenuBuilderRemoveItemAtMethod : 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> supportedActivities = getSupportedActivities(context, packageManager);
for (int i = 0; i < supportedActivities.size(); i++) {
ResolveInfo resolveInfo = supportedActivities.get(i);
menu.add(0, 0, i + 100, resolveInfo.loadLabel(packageManager)).setIntent(createProcessTextIntentForResolveInfo(resolveInfo, this.mTextView)).setShowAsAction(1);
}
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException unused2) {
}
}
private List<ResolveInfo> getSupportedActivities(Context context, PackageManager packageManager) {
ArrayList arrayList = new ArrayList();
if (!(context instanceof Activity)) {
return arrayList;
}
for (ResolveInfo resolveInfo : packageManager.queryIntentActivities(createProcessTextIntent(), 0)) {
if (isSupportedActivity(resolveInfo, context)) {
arrayList.add(resolveInfo);
}
}
return arrayList;
}
private boolean isSupportedActivity(ResolveInfo resolveInfo, Context context) {
int checkSelfPermission;
if (context.getPackageName().equals(resolveInfo.activityInfo.packageName)) {
return true;
}
if (!resolveInfo.activityInfo.exported) {
return false;
}
if (resolveInfo.activityInfo.permission == null) {
return true;
}
checkSelfPermission = context.checkSelfPermission(resolveInfo.activityInfo.permission);
return checkSelfPermission == 0;
}
private Intent createProcessTextIntentForResolveInfo(ResolveInfo resolveInfo, TextView textView) {
return createProcessTextIntent().putExtra("android.intent.extra.PROCESS_TEXT_READONLY", !isEditable(textView)).setClassName(resolveInfo.activityInfo.packageName, resolveInfo.activityInfo.name);
}
private boolean isEditable(TextView textView) {
return (textView instanceof Editable) && textView.onCheckIsTextEditor() && textView.isEnabled();
}
private Intent createProcessTextIntent() {
return new Intent().setAction("android.intent.action.PROCESS_TEXT").setType("text/plain");
}
}
public static void setFirstBaselineToTopHeight(TextView textView, int i) {
int i2;
Preconditions.checkArgumentNonnegative(i);
if (Build.VERSION.SDK_INT >= 28) {
Api28Impl.setFirstBaselineToTopHeight(textView, i);
return;
}
Paint.FontMetricsInt fontMetricsInt = textView.getPaint().getFontMetricsInt();
if (Api16Impl.getIncludeFontPadding(textView)) {
i2 = fontMetricsInt.top;
} else {
i2 = fontMetricsInt.ascent;
}
if (i > Math.abs(i2)) {
textView.setPadding(textView.getPaddingLeft(), i + i2, textView.getPaddingRight(), textView.getPaddingBottom());
}
}
public static void setLastBaselineToBottomHeight(TextView textView, int i) {
int i2;
Preconditions.checkArgumentNonnegative(i);
Paint.FontMetricsInt fontMetricsInt = textView.getPaint().getFontMetricsInt();
if (Api16Impl.getIncludeFontPadding(textView)) {
i2 = fontMetricsInt.bottom;
} else {
i2 = fontMetricsInt.descent;
}
if (i > Math.abs(i2)) {
textView.setPadding(textView.getPaddingLeft(), textView.getPaddingTop(), textView.getPaddingRight(), i - i2);
}
}
public static int getFirstBaselineToTopHeight(TextView textView) {
return textView.getPaddingTop() - textView.getPaint().getFontMetricsInt().top;
}
public static int getLastBaselineToBottomHeight(TextView textView) {
return textView.getPaddingBottom() + textView.getPaint().getFontMetricsInt().bottom;
}
public static void setLineHeight(TextView textView, int i) {
Preconditions.checkArgumentNonnegative(i);
if (i != textView.getPaint().getFontMetricsInt(null)) {
textView.setLineSpacing(i - r0, 1.0f);
}
}
public static PrecomputedTextCompat.Params getTextMetricsParams(TextView textView) {
if (Build.VERSION.SDK_INT >= 28) {
return new PrecomputedTextCompat.Params(Api28Impl.getTextMetricsParams(textView));
}
PrecomputedTextCompat.Params.Builder builder = new PrecomputedTextCompat.Params.Builder(new TextPaint(textView.getPaint()));
if (Build.VERSION.SDK_INT >= 23) {
builder.setBreakStrategy(Api23Impl.getBreakStrategy(textView));
builder.setHyphenationFrequency(Api23Impl.getHyphenationFrequency(textView));
}
builder.setTextDirection(getTextDirectionHeuristic(textView));
return builder.build();
}
public static void setTextMetricsParams(TextView textView, PrecomputedTextCompat.Params params) {
Api17Impl.setTextDirection(textView, getTextDirection(params.getTextDirection()));
if (Build.VERSION.SDK_INT < 23) {
float textScaleX = params.getTextPaint().getTextScaleX();
textView.getPaint().set(params.getTextPaint());
if (textScaleX == textView.getTextScaleX()) {
textView.setTextScaleX((textScaleX / 2.0f) + 1.0f);
}
textView.setTextScaleX(textScaleX);
return;
}
textView.getPaint().set(params.getTextPaint());
Api23Impl.setBreakStrategy(textView, params.getBreakStrategy());
Api23Impl.setHyphenationFrequency(textView, params.getHyphenationFrequency());
}
public static void setPrecomputedText(TextView textView, PrecomputedTextCompat precomputedTextCompat) {
if (Build.VERSION.SDK_INT >= 29) {
textView.setText(precomputedTextCompat.getPrecomputedText());
} else {
if (!getTextMetricsParams(textView).equalsWithoutTextDirection(precomputedTextCompat.getParams())) {
throw new IllegalArgumentException("Given text can not be applied to TextView.");
}
textView.setText(precomputedTextCompat);
}
}
private static TextDirectionHeuristic getTextDirectionHeuristic(TextView textView) {
if (textView.getTransformationMethod() instanceof PasswordTransformationMethod) {
return TextDirectionHeuristics.LTR;
}
if (Build.VERSION.SDK_INT >= 28 && (textView.getInputType() & 15) == 3) {
byte directionality = Character.getDirectionality(Api28Impl.getDigitStrings(Api24Impl.getInstance(Api17Impl.getTextLocale(textView)))[0].codePointAt(0));
if (directionality == 1 || directionality == 2) {
return TextDirectionHeuristics.RTL;
}
return TextDirectionHeuristics.LTR;
}
boolean z = Api17Impl.getLayoutDirection(textView) == 1;
switch (Api17Impl.getTextDirection(textView)) {
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;
}
private static int getTextDirection(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;
}
/* JADX WARN: Multi-variable type inference failed */
public static void setCompoundDrawableTintList(TextView textView, ColorStateList colorStateList) {
Preconditions.checkNotNull(textView);
if (Build.VERSION.SDK_INT >= 24) {
Api23Impl.setCompoundDrawableTintList(textView, colorStateList);
} else if (textView instanceof TintableCompoundDrawablesView) {
((TintableCompoundDrawablesView) textView).setSupportCompoundDrawablesTintList(colorStateList);
}
}
/* JADX WARN: Multi-variable type inference failed */
public static ColorStateList getCompoundDrawableTintList(TextView textView) {
Preconditions.checkNotNull(textView);
if (Build.VERSION.SDK_INT >= 24) {
return Api23Impl.getCompoundDrawableTintList(textView);
}
if (textView instanceof TintableCompoundDrawablesView) {
return ((TintableCompoundDrawablesView) textView).getSupportCompoundDrawablesTintList();
}
return null;
}
/* JADX WARN: Multi-variable type inference failed */
public static void setCompoundDrawableTintMode(TextView textView, PorterDuff.Mode mode) {
Preconditions.checkNotNull(textView);
if (Build.VERSION.SDK_INT >= 24) {
Api23Impl.setCompoundDrawableTintMode(textView, mode);
} else if (textView instanceof TintableCompoundDrawablesView) {
((TintableCompoundDrawablesView) textView).setSupportCompoundDrawablesTintMode(mode);
}
}
/* JADX WARN: Multi-variable type inference failed */
public static PorterDuff.Mode getCompoundDrawableTintMode(TextView textView) {
Preconditions.checkNotNull(textView);
if (Build.VERSION.SDK_INT >= 24) {
return Api23Impl.getCompoundDrawableTintMode(textView);
}
if (textView instanceof TintableCompoundDrawablesView) {
return ((TintableCompoundDrawablesView) textView).getSupportCompoundDrawablesTintMode();
}
return null;
}
static class Api17Impl {
private Api17Impl() {
}
static void setCompoundDrawablesRelative(TextView textView, Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
textView.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
}
static int getLayoutDirection(View view) {
return view.getLayoutDirection();
}
static void setCompoundDrawablesRelativeWithIntrinsicBounds(TextView textView, Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
textView.setCompoundDrawablesRelativeWithIntrinsicBounds(drawable, drawable2, drawable3, drawable4);
}
static void setCompoundDrawablesRelativeWithIntrinsicBounds(TextView textView, int i, int i2, int i3, int i4) {
textView.setCompoundDrawablesRelativeWithIntrinsicBounds(i, i2, i3, i4);
}
static Drawable[] getCompoundDrawablesRelative(TextView textView) {
return textView.getCompoundDrawablesRelative();
}
static void setTextDirection(View view, int i) {
view.setTextDirection(i);
}
static Locale getTextLocale(TextView textView) {
return textView.getTextLocale();
}
static int getTextDirection(View view) {
return view.getTextDirection();
}
}
static class Api16Impl {
private Api16Impl() {
}
static int getMaxLines(TextView textView) {
return textView.getMaxLines();
}
static int getMinLines(TextView textView) {
return textView.getMinLines();
}
static boolean getIncludeFontPadding(TextView textView) {
return textView.getIncludeFontPadding();
}
}
static class Api26Impl {
private Api26Impl() {
}
static void setAutoSizeTextTypeWithDefaults(TextView textView, int i) {
textView.setAutoSizeTextTypeWithDefaults(i);
}
static void setAutoSizeTextTypeUniformWithConfiguration(TextView textView, int i, int i2, int i3, int i4) {
textView.setAutoSizeTextTypeUniformWithConfiguration(i, i2, i3, i4);
}
static void setAutoSizeTextTypeUniformWithPresetSizes(TextView textView, int[] iArr, int i) {
textView.setAutoSizeTextTypeUniformWithPresetSizes(iArr, i);
}
static int getAutoSizeTextType(TextView textView) {
return textView.getAutoSizeTextType();
}
static int getAutoSizeStepGranularity(TextView textView) {
return textView.getAutoSizeStepGranularity();
}
static int getAutoSizeMinTextSize(TextView textView) {
return textView.getAutoSizeMinTextSize();
}
static int getAutoSizeMaxTextSize(TextView textView) {
return textView.getAutoSizeMaxTextSize();
}
static int[] getAutoSizeTextAvailableSizes(TextView textView) {
return textView.getAutoSizeTextAvailableSizes();
}
}
static class Api28Impl {
private Api28Impl() {
}
static void setFirstBaselineToTopHeight(TextView textView, int i) {
textView.setFirstBaselineToTopHeight(i);
}
static PrecomputedText.Params getTextMetricsParams(TextView textView) {
return textView.getTextMetricsParams();
}
static String[] getDigitStrings(DecimalFormatSymbols decimalFormatSymbols) {
return decimalFormatSymbols.getDigitStrings();
}
}
static class Api23Impl {
private Api23Impl() {
}
static int getBreakStrategy(TextView textView) {
return textView.getBreakStrategy();
}
static void setBreakStrategy(TextView textView, int i) {
textView.setBreakStrategy(i);
}
static int getHyphenationFrequency(TextView textView) {
return textView.getHyphenationFrequency();
}
static void setHyphenationFrequency(TextView textView, int i) {
textView.setHyphenationFrequency(i);
}
static PorterDuff.Mode getCompoundDrawableTintMode(TextView textView) {
return textView.getCompoundDrawableTintMode();
}
static ColorStateList getCompoundDrawableTintList(TextView textView) {
return textView.getCompoundDrawableTintList();
}
static void setCompoundDrawableTintList(TextView textView, ColorStateList colorStateList) {
textView.setCompoundDrawableTintList(colorStateList);
}
static void setCompoundDrawableTintMode(TextView textView, PorterDuff.Mode mode) {
textView.setCompoundDrawableTintMode(mode);
}
}
static class Api24Impl {
private Api24Impl() {
}
static DecimalFormatSymbols getInstance(Locale locale) {
return DecimalFormatSymbols.getInstance(locale);
}
}
}

View File

@ -0,0 +1,39 @@
package androidx.core.widget;
import android.text.Editable;
import android.text.TextWatcher;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function4;
/* compiled from: TextView.kt */
@Metadata(d1 = {"\u0000'\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\r\n\u0000\n\u0002\u0010\b\n\u0002\b\u0005*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\u0012\u0010\u0002\u001a\u00020\u00032\b\u0010\u0004\u001a\u0004\u0018\u00010\u0005H\u0016J*\u0010\u0006\u001a\u00020\u00032\b\u0010\u0007\u001a\u0004\u0018\u00010\b2\u0006\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\n2\u0006\u0010\f\u001a\u00020\nH\u0016J*\u0010\r\u001a\u00020\u00032\b\u0010\u0007\u001a\u0004\u0018\u00010\b2\u0006\u0010\t\u001a\u00020\n2\u0006\u0010\u000e\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\nH\u0016¨\u0006\u000f"}, d2 = {"androidx/core/widget/TextViewKt$addTextChangedListener$textWatcher$1", "Landroid/text/TextWatcher;", "afterTextChanged", "", "s", "Landroid/text/Editable;", "beforeTextChanged", "text", "", "start", "", "count", "after", "onTextChanged", "before", "core-ktx_release"}, k = 1, mv = {1, 7, 1}, xi = 176)
/* loaded from: classes.dex */
public final class TextViewKt$addTextChangedListener$textWatcher$1 implements TextWatcher {
final /* synthetic */ Function1<Editable, Unit> $afterTextChanged;
final /* synthetic */ Function4<CharSequence, Integer, Integer, Integer, Unit> $beforeTextChanged;
final /* synthetic */ Function4<CharSequence, Integer, Integer, Integer, Unit> $onTextChanged;
/* JADX WARN: Multi-variable type inference failed */
public TextViewKt$addTextChangedListener$textWatcher$1(Function1<? super Editable, Unit> function1, Function4<? super CharSequence, ? super Integer, ? super Integer, ? super Integer, Unit> function4, Function4<? super CharSequence, ? super Integer, ? super Integer, ? super Integer, Unit> function42) {
this.$afterTextChanged = function1;
this.$beforeTextChanged = function4;
this.$onTextChanged = function42;
}
@Override // android.text.TextWatcher
public void afterTextChanged(Editable s) {
this.$afterTextChanged.invoke(s);
}
@Override // android.text.TextWatcher
public void beforeTextChanged(CharSequence text, int start, int count, int after) {
this.$beforeTextChanged.invoke(text, Integer.valueOf(start), Integer.valueOf(count), Integer.valueOf(after));
}
@Override // android.text.TextWatcher
public void onTextChanged(CharSequence text, int start, int before, int count) {
this.$onTextChanged.invoke(text, Integer.valueOf(start), Integer.valueOf(before), Integer.valueOf(count));
}
}

View File

@ -0,0 +1,135 @@
package androidx.core.widget;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.TextView;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function4;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: TextView.kt */
@Metadata(d1 = {"\u00008\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\r\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\u001a\u0083\u0002\u0010\u0000\u001a\u00020\u0001*\u00020\u00022d\b\u0006\u0010\u0003\u001a^\u0012\u0015\u0012\u0013\u0018\u00010\u0005¢\u0006\f\b\u0006\u0012\b\b\u0007\u0012\u0004\b\b(\b\u0012\u0013\u0012\u00110\\u0006\f\b\u0006\u0012\b\b\u0007\u0012\u0004\b\b(\n\u0012\u0013\u0012\u00110\\u0006\f\b\u0006\u0012\b\b\u0007\u0012\u0004\b\b(\u000b\u0012\u0013\u0012\u00110\\u0006\f\b\u0006\u0012\b\b\u0007\u0012\u0004\b\b(\f\u0012\u0004\u0012\u00020\r0\u00042d\b\u0006\u0010\u000e\u001a^\u0012\u0015\u0012\u0013\u0018\u00010\u0005¢\u0006\f\b\u0006\u0012\b\b\u0007\u0012\u0004\b\b(\b\u0012\u0013\u0012\u00110\\u0006\f\b\u0006\u0012\b\b\u0007\u0012\u0004\b\b(\n\u0012\u0013\u0012\u00110\\u0006\f\b\u0006\u0012\b\b\u0007\u0012\u0004\b\b(\u000f\u0012\u0013\u0012\u00110\\u0006\f\b\u0006\u0012\b\b\u0007\u0012\u0004\b\b(\u000b\u0012\u0004\u0012\u00020\r0\u00042%\b\u0006\u0010\u0010\u001a\u001f\u0012\u0015\u0012\u0013\u0018\u00010\u0012¢\u0006\f\b\u0006\u0012\b\b\u0007\u0012\u0004\b\b(\b\u0012\u0004\u0012\u00020\r0\u0011H\u0086\\u0001\u0000\u001a7\u0010\u0013\u001a\u00020\u0001*\u00020\u00022%\b\u0004\u0010\u0014\u001a\u001f\u0012\u0015\u0012\u0013\u0018\u00010\u0012¢\u0006\f\b\u0006\u0012\b\b\u0007\u0012\u0004\b\b(\b\u0012\u0004\u0012\u00020\r0\u0011H\u0086\\u0001\u0000\u001av\u0010\u0015\u001a\u00020\u0001*\u00020\u00022d\b\u0004\u0010\u0014\u001a^\u0012\u0015\u0012\u0013\u0018\u00010\u0005¢\u0006\f\b\u0006\u0012\b\b\u0007\u0012\u0004\b\b(\b\u0012\u0013\u0012\u00110\\u0006\f\b\u0006\u0012\b\b\u0007\u0012\u0004\b\b(\n\u0012\u0013\u0012\u00110\\u0006\f\b\u0006\u0012\b\b\u0007\u0012\u0004\b\b(\u000b\u0012\u0013\u0012\u00110\\u0006\f\b\u0006\u0012\b\b\u0007\u0012\u0004\b\b(\f\u0012\u0004\u0012\u00020\r0\u0004H\u0086\\u0001\u0000\u001av\u0010\u0016\u001a\u00020\u0001*\u00020\u00022d\b\u0004\u0010\u0014\u001a^\u0012\u0015\u0012\u0013\u0018\u00010\u0005¢\u0006\f\b\u0006\u0012\b\b\u0007\u0012\u0004\b\b(\b\u0012\u0013\u0012\u00110\\u0006\f\b\u0006\u0012\b\b\u0007\u0012\u0004\b\b(\n\u0012\u0013\u0012\u00110\\u0006\f\b\u0006\u0012\b\b\u0007\u0012\u0004\b\b(\u000f\u0012\u0013\u0012\u00110\\u0006\f\b\u0006\u0012\b\b\u0007\u0012\u0004\b\b(\u000b\u0012\u0004\u0012\u00020\r0\u0004H\u0086\\u0001\u0000\u0082\u0002\u0007\n\u0005\b\u009920\u0001¨\u0006\u0017"}, d2 = {"addTextChangedListener", "Landroid/text/TextWatcher;", "Landroid/widget/TextView;", "beforeTextChanged", "Lkotlin/Function4;", "", "Lkotlin/ParameterName;", "name", "text", "", "start", "count", "after", "", "onTextChanged", "before", "afterTextChanged", "Lkotlin/Function1;", "Landroid/text/Editable;", "doAfterTextChanged", "action", "doBeforeTextChanged", "doOnTextChanged", "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48)
/* loaded from: classes.dex */
public final class TextViewKt {
public static /* synthetic */ TextWatcher addTextChangedListener$default(TextView textView, Function4 beforeTextChanged, Function4 onTextChanged, Function1 afterTextChanged, int i, Object obj) {
if ((i & 1) != 0) {
beforeTextChanged = new Function4<CharSequence, Integer, Integer, Integer, Unit>() { // from class: androidx.core.widget.TextViewKt$addTextChangedListener$1
public final void invoke(CharSequence charSequence, int i2, int i3, int i4) {
}
@Override // kotlin.jvm.functions.Function4
public /* bridge */ /* synthetic */ Unit invoke(CharSequence charSequence, Integer num, Integer num2, Integer num3) {
invoke(charSequence, num.intValue(), num2.intValue(), num3.intValue());
return Unit.INSTANCE;
}
};
}
if ((i & 2) != 0) {
onTextChanged = new Function4<CharSequence, Integer, Integer, Integer, Unit>() { // from class: androidx.core.widget.TextViewKt$addTextChangedListener$2
public final void invoke(CharSequence charSequence, int i2, int i3, int i4) {
}
@Override // kotlin.jvm.functions.Function4
public /* bridge */ /* synthetic */ Unit invoke(CharSequence charSequence, Integer num, Integer num2, Integer num3) {
invoke(charSequence, num.intValue(), num2.intValue(), num3.intValue());
return Unit.INSTANCE;
}
};
}
if ((i & 4) != 0) {
afterTextChanged = new Function1<Editable, Unit>() { // from class: androidx.core.widget.TextViewKt$addTextChangedListener$3
/* renamed from: invoke, reason: avoid collision after fix types in other method */
public final void invoke2(Editable editable) {
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(Editable editable) {
invoke2(editable);
return Unit.INSTANCE;
}
};
}
Intrinsics.checkNotNullParameter(textView, "<this>");
Intrinsics.checkNotNullParameter(beforeTextChanged, "beforeTextChanged");
Intrinsics.checkNotNullParameter(onTextChanged, "onTextChanged");
Intrinsics.checkNotNullParameter(afterTextChanged, "afterTextChanged");
TextViewKt$addTextChangedListener$textWatcher$1 textViewKt$addTextChangedListener$textWatcher$1 = new TextViewKt$addTextChangedListener$textWatcher$1(afterTextChanged, beforeTextChanged, onTextChanged);
textView.addTextChangedListener(textViewKt$addTextChangedListener$textWatcher$1);
return textViewKt$addTextChangedListener$textWatcher$1;
}
public static final TextWatcher addTextChangedListener(TextView textView, Function4<? super CharSequence, ? super Integer, ? super Integer, ? super Integer, Unit> beforeTextChanged, Function4<? super CharSequence, ? super Integer, ? super Integer, ? super Integer, Unit> onTextChanged, Function1<? super Editable, Unit> afterTextChanged) {
Intrinsics.checkNotNullParameter(textView, "<this>");
Intrinsics.checkNotNullParameter(beforeTextChanged, "beforeTextChanged");
Intrinsics.checkNotNullParameter(onTextChanged, "onTextChanged");
Intrinsics.checkNotNullParameter(afterTextChanged, "afterTextChanged");
TextViewKt$addTextChangedListener$textWatcher$1 textViewKt$addTextChangedListener$textWatcher$1 = new TextViewKt$addTextChangedListener$textWatcher$1(afterTextChanged, beforeTextChanged, onTextChanged);
textView.addTextChangedListener(textViewKt$addTextChangedListener$textWatcher$1);
return textViewKt$addTextChangedListener$textWatcher$1;
}
public static final TextWatcher doBeforeTextChanged(TextView textView, final Function4<? super CharSequence, ? super Integer, ? super Integer, ? super Integer, Unit> action) {
Intrinsics.checkNotNullParameter(textView, "<this>");
Intrinsics.checkNotNullParameter(action, "action");
TextWatcher textWatcher = new TextWatcher() { // from class: androidx.core.widget.TextViewKt$doBeforeTextChanged$$inlined$addTextChangedListener$default$1
@Override // android.text.TextWatcher
public void afterTextChanged(Editable s) {
}
@Override // android.text.TextWatcher
public void onTextChanged(CharSequence text, int start, int before, int count) {
}
@Override // android.text.TextWatcher
public void beforeTextChanged(CharSequence text, int start, int count, int after) {
Function4.this.invoke(text, Integer.valueOf(start), Integer.valueOf(count), Integer.valueOf(after));
}
};
textView.addTextChangedListener(textWatcher);
return textWatcher;
}
public static final TextWatcher doOnTextChanged(TextView textView, final Function4<? super CharSequence, ? super Integer, ? super Integer, ? super Integer, Unit> action) {
Intrinsics.checkNotNullParameter(textView, "<this>");
Intrinsics.checkNotNullParameter(action, "action");
TextWatcher textWatcher = new TextWatcher() { // from class: androidx.core.widget.TextViewKt$doOnTextChanged$$inlined$addTextChangedListener$default$1
@Override // android.text.TextWatcher
public void afterTextChanged(Editable s) {
}
@Override // android.text.TextWatcher
public void beforeTextChanged(CharSequence text, int start, int count, int after) {
}
@Override // android.text.TextWatcher
public void onTextChanged(CharSequence text, int start, int before, int count) {
Function4.this.invoke(text, Integer.valueOf(start), Integer.valueOf(before), Integer.valueOf(count));
}
};
textView.addTextChangedListener(textWatcher);
return textWatcher;
}
public static final TextWatcher doAfterTextChanged(TextView textView, final Function1<? super Editable, Unit> action) {
Intrinsics.checkNotNullParameter(textView, "<this>");
Intrinsics.checkNotNullParameter(action, "action");
TextWatcher textWatcher = new TextWatcher() { // from class: androidx.core.widget.TextViewKt$doAfterTextChanged$$inlined$addTextChangedListener$default$1
@Override // android.text.TextWatcher
public void beforeTextChanged(CharSequence text, int start, int count, int after) {
}
@Override // android.text.TextWatcher
public void onTextChanged(CharSequence text, int start, int before, int count) {
}
@Override // android.text.TextWatcher
public void afterTextChanged(Editable s) {
Function1.this.invoke(s);
}
};
textView.addTextChangedListener(textWatcher);
return textWatcher;
}
}

View File

@ -0,0 +1,82 @@
package androidx.core.widget;
import android.content.ClipData;
import android.content.Context;
import android.text.Editable;
import android.text.Selection;
import android.text.Spanned;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import androidx.core.view.ContentInfoCompat;
import androidx.core.view.OnReceiveContentListener;
/* loaded from: classes.dex */
public final class TextViewOnReceiveContentListener implements OnReceiveContentListener {
private static final String LOG_TAG = "ReceiveContent";
@Override // androidx.core.view.OnReceiveContentListener
public ContentInfoCompat onReceiveContent(View view, ContentInfoCompat contentInfoCompat) {
if (Log.isLoggable(LOG_TAG, 3)) {
Log.d(LOG_TAG, "onReceive: " + contentInfoCompat);
}
if (contentInfoCompat.getSource() == 2) {
return contentInfoCompat;
}
ClipData clip = contentInfoCompat.getClip();
int flags = contentInfoCompat.getFlags();
TextView textView = (TextView) view;
Editable editable = (Editable) textView.getText();
Context context = textView.getContext();
boolean z = false;
for (int i = 0; i < clip.getItemCount(); i++) {
CharSequence coerceToText = coerceToText(context, clip.getItemAt(i), flags);
if (coerceToText != null) {
if (!z) {
replaceSelection(editable, coerceToText);
z = true;
} else {
editable.insert(Selection.getSelectionEnd(editable), "\n");
editable.insert(Selection.getSelectionEnd(editable), coerceToText);
}
}
}
return null;
}
private static CharSequence coerceToText(Context context, ClipData.Item item, int i) {
return Api16Impl.coerce(context, item, i);
}
private static void replaceSelection(Editable editable, CharSequence charSequence) {
int selectionStart = Selection.getSelectionStart(editable);
int selectionEnd = Selection.getSelectionEnd(editable);
int max = Math.max(0, Math.min(selectionStart, selectionEnd));
int max2 = Math.max(0, Math.max(selectionStart, selectionEnd));
Selection.setSelection(editable, max2);
editable.replace(max, max2, charSequence);
}
private static final class Api16Impl {
private Api16Impl() {
}
static CharSequence coerce(Context context, ClipData.Item item, int i) {
if ((i & 1) != 0) {
CharSequence coerceToText = item.coerceToText(context);
return coerceToText instanceof Spanned ? coerceToText.toString() : coerceToText;
}
return item.coerceToStyledText(context);
}
}
private static final class ApiImpl {
private ApiImpl() {
}
static CharSequence coerce(Context context, ClipData.Item item, int i) {
CharSequence coerceToText = item.coerceToText(context);
return ((i & 1) == 0 || !(coerceToText instanceof Spanned)) ? coerceToText : coerceToText.toString();
}
}
}

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 TintableCheckedTextView {
ColorStateList getSupportCheckMarkTintList();
PorterDuff.Mode getSupportCheckMarkTintMode();
void setSupportCheckMarkTintList(ColorStateList colorStateList);
void setSupportCheckMarkTintMode(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 TintableCompoundButton {
ColorStateList getSupportButtonTintList();
PorterDuff.Mode getSupportButtonTintMode();
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 TintableCompoundDrawablesView {
ColorStateList getSupportCompoundDrawablesTintList();
PorterDuff.Mode getSupportCompoundDrawablesTintMode();
void setSupportCompoundDrawablesTintList(ColorStateList colorStateList);
void setSupportCompoundDrawablesTintMode(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);
}