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,242 @@
package androidx.customview;
/* loaded from: classes.dex */
public final class R {
public static final class attr {
public static final int alpha = 0x7f03002e;
public static final int font = 0x7f0301fb;
public static final int fontProviderAuthority = 0x7f0301fd;
public static final int fontProviderCerts = 0x7f0301fe;
public static final int fontProviderFetchStrategy = 0x7f0301ff;
public static final int fontProviderFetchTimeout = 0x7f030200;
public static final int fontProviderPackage = 0x7f030201;
public static final int fontProviderQuery = 0x7f030202;
public static final int fontStyle = 0x7f030204;
public static final int fontVariationSettings = 0x7f030205;
public static final int fontWeight = 0x7f030206;
public static final int ttcIndex = 0x7f0304b6;
private attr() {
}
}
public static final class color {
public static final int androidx_core_ripple_material_light = 0x7f05001b;
public static final int androidx_core_secondary_text_default_material_light = 0x7f05001c;
public static final int notification_action_color_filter = 0x7f0502e9;
public static final int notification_icon_bg_color = 0x7f0502ea;
private color() {
}
}
public static final class dimen {
public static final int compat_button_inset_horizontal_material = 0x7f060058;
public static final int compat_button_inset_vertical_material = 0x7f060059;
public static final int compat_button_padding_horizontal_material = 0x7f06005a;
public static final int compat_button_padding_vertical_material = 0x7f06005b;
public static final int compat_control_corner_material = 0x7f06005c;
public static final int compat_notification_large_icon_max_height = 0x7f06005d;
public static final int compat_notification_large_icon_max_width = 0x7f06005e;
public static final int notification_action_icon_size = 0x7f060307;
public static final int notification_action_text_size = 0x7f060308;
public static final int notification_big_circle_margin = 0x7f060309;
public static final int notification_content_margin_start = 0x7f06030a;
public static final int notification_large_icon_height = 0x7f06030b;
public static final int notification_large_icon_width = 0x7f06030c;
public static final int notification_main_column_padding_top = 0x7f06030d;
public static final int notification_media_narrow_margin = 0x7f06030e;
public static final int notification_right_icon_size = 0x7f06030f;
public static final int notification_right_side_padding_top = 0x7f060310;
public static final int notification_small_icon_background_padding = 0x7f060311;
public static final int notification_small_icon_size_as_large = 0x7f060312;
public static final int notification_subtext_size = 0x7f060313;
public static final int notification_top_pad = 0x7f060314;
public static final int notification_top_pad_large_text = 0x7f060315;
private dimen() {
}
}
public static final class drawable {
public static final int notification_action_background = 0x7f0700d0;
public static final int notification_bg = 0x7f0700d1;
public static final int notification_bg_low = 0x7f0700d2;
public static final int notification_bg_low_normal = 0x7f0700d3;
public static final int notification_bg_low_pressed = 0x7f0700d4;
public static final int notification_bg_normal = 0x7f0700d5;
public static final int notification_bg_normal_pressed = 0x7f0700d6;
public static final int notification_icon_background = 0x7f0700d7;
public static final int notification_template_icon_bg = 0x7f0700d8;
public static final int notification_template_icon_low_bg = 0x7f0700d9;
public static final int notification_tile_bg = 0x7f0700da;
public static final int notify_panel_notification_icon_bg = 0x7f0700db;
private drawable() {
}
}
public static final class id {
public static final int accessibility_action_clickable_span = 0x7f08000f;
public static final int accessibility_custom_action_0 = 0x7f080010;
public static final int accessibility_custom_action_1 = 0x7f080011;
public static final int accessibility_custom_action_10 = 0x7f080012;
public static final int accessibility_custom_action_11 = 0x7f080013;
public static final int accessibility_custom_action_12 = 0x7f080014;
public static final int accessibility_custom_action_13 = 0x7f080015;
public static final int accessibility_custom_action_14 = 0x7f080016;
public static final int accessibility_custom_action_15 = 0x7f080017;
public static final int accessibility_custom_action_16 = 0x7f080018;
public static final int accessibility_custom_action_17 = 0x7f080019;
public static final int accessibility_custom_action_18 = 0x7f08001a;
public static final int accessibility_custom_action_19 = 0x7f08001b;
public static final int accessibility_custom_action_2 = 0x7f08001c;
public static final int accessibility_custom_action_20 = 0x7f08001d;
public static final int accessibility_custom_action_21 = 0x7f08001e;
public static final int accessibility_custom_action_22 = 0x7f08001f;
public static final int accessibility_custom_action_23 = 0x7f080020;
public static final int accessibility_custom_action_24 = 0x7f080021;
public static final int accessibility_custom_action_25 = 0x7f080022;
public static final int accessibility_custom_action_26 = 0x7f080023;
public static final int accessibility_custom_action_27 = 0x7f080024;
public static final int accessibility_custom_action_28 = 0x7f080025;
public static final int accessibility_custom_action_29 = 0x7f080026;
public static final int accessibility_custom_action_3 = 0x7f080027;
public static final int accessibility_custom_action_30 = 0x7f080028;
public static final int accessibility_custom_action_31 = 0x7f080029;
public static final int accessibility_custom_action_4 = 0x7f08002a;
public static final int accessibility_custom_action_5 = 0x7f08002b;
public static final int accessibility_custom_action_6 = 0x7f08002c;
public static final int accessibility_custom_action_7 = 0x7f08002d;
public static final int accessibility_custom_action_8 = 0x7f08002e;
public static final int accessibility_custom_action_9 = 0x7f08002f;
public static final int action_container = 0x7f08003a;
public static final int action_divider = 0x7f08003c;
public static final int action_image = 0x7f08003d;
public static final int action_text = 0x7f080043;
public static final int actions = 0x7f080044;
public static final int async = 0x7f080052;
public static final int blocking = 0x7f08005c;
public static final int chronometer = 0x7f080071;
public static final int dialog_button = 0x7f080095;
public static final int forever = 0x7f0800c2;
public static final int icon = 0x7f0800d4;
public static final int icon_group = 0x7f0800d5;
public static final int info = 0x7f0800dd;
public static final int italic = 0x7f0800e0;
public static final int line1 = 0x7f0800e9;
public static final int line3 = 0x7f0800ea;
public static final int normal = 0x7f080139;
public static final int notification_background = 0x7f08013b;
public static final int notification_main_column = 0x7f08013c;
public static final int notification_main_column_container = 0x7f08013d;
public static final int right_icon = 0x7f08016b;
public static final int right_side = 0x7f08016c;
public static final int tag_accessibility_actions = 0x7f0801ad;
public static final int tag_accessibility_clickable_spans = 0x7f0801ae;
public static final int tag_accessibility_heading = 0x7f0801af;
public static final int tag_accessibility_pane_title = 0x7f0801b0;
public static final int tag_screen_reader_focusable = 0x7f0801b4;
public static final int tag_transition_group = 0x7f0801b6;
public static final int tag_unhandled_key_event_manager = 0x7f0801b7;
public static final int tag_unhandled_key_listeners = 0x7f0801b8;
public static final int text = 0x7f0801ba;
public static final int text2 = 0x7f0801bb;
public static final int time = 0x7f0801ca;
public static final int title = 0x7f0801cb;
private id() {
}
}
public static final class integer {
public static final int status_bar_notification_info_maxnum = 0x7f090043;
private integer() {
}
}
public static final class layout {
public static final int custom_dialog = 0x7f0b001d;
public static final int notification_action = 0x7f0b0060;
public static final int notification_action_tombstone = 0x7f0b0061;
public static final int notification_template_custom_big = 0x7f0b0062;
public static final int notification_template_icon_group = 0x7f0b0063;
public static final int notification_template_part_chronometer = 0x7f0b0064;
public static final int notification_template_part_time = 0x7f0b0065;
private layout() {
}
}
public static final class string {
public static final int status_bar_notification_info_overflow = 0x7f0f00a8;
private string() {
}
}
public static final class style {
public static final int TextAppearance_Compat_Notification = 0x7f1001c3;
public static final int TextAppearance_Compat_Notification_Info = 0x7f1001c4;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f1001c5;
public static final int TextAppearance_Compat_Notification_Time = 0x7f1001c6;
public static final int TextAppearance_Compat_Notification_Title = 0x7f1001c7;
public static final int Widget_Compat_NotificationActionContainer = 0x7f10032d;
public static final int Widget_Compat_NotificationActionText = 0x7f10032e;
private style() {
}
}
public static final class styleable {
public static final int ColorStateListItem_alpha = 0x00000003;
public static final int ColorStateListItem_android_alpha = 0x00000001;
public static final int ColorStateListItem_android_color = 0x00000000;
public static final int ColorStateListItem_android_lStar = 0x00000002;
public static final int ColorStateListItem_lStar = 0x00000004;
public static final int FontFamilyFont_android_font = 0x00000000;
public static final int FontFamilyFont_android_fontStyle = 0x00000002;
public static final int FontFamilyFont_android_fontVariationSettings = 0x00000004;
public static final int FontFamilyFont_android_fontWeight = 0x00000001;
public static final int FontFamilyFont_android_ttcIndex = 0x00000003;
public static final int FontFamilyFont_font = 0x00000005;
public static final int FontFamilyFont_fontStyle = 0x00000006;
public static final int FontFamilyFont_fontVariationSettings = 0x00000007;
public static final int FontFamilyFont_fontWeight = 0x00000008;
public static final int FontFamilyFont_ttcIndex = 0x00000009;
public static final int FontFamily_fontProviderAuthority = 0x00000000;
public static final int FontFamily_fontProviderCerts = 0x00000001;
public static final int FontFamily_fontProviderFetchStrategy = 0x00000002;
public static final int FontFamily_fontProviderFetchTimeout = 0x00000003;
public static final int FontFamily_fontProviderPackage = 0x00000004;
public static final int FontFamily_fontProviderQuery = 0x00000005;
public static final int FontFamily_fontProviderSystemFontFamily = 0x00000006;
public static final int GradientColorItem_android_color = 0x00000000;
public static final int GradientColorItem_android_offset = 0x00000001;
public static final int GradientColor_android_centerColor = 0x00000007;
public static final int GradientColor_android_centerX = 0x00000003;
public static final int GradientColor_android_centerY = 0x00000004;
public static final int GradientColor_android_endColor = 0x00000001;
public static final int GradientColor_android_endX = 0x0000000a;
public static final int GradientColor_android_endY = 0x0000000b;
public static final int GradientColor_android_gradientRadius = 0x00000005;
public static final int GradientColor_android_startColor = 0x00000000;
public static final int GradientColor_android_startX = 0x00000008;
public static final int GradientColor_android_startY = 0x00000009;
public static final int GradientColor_android_tileMode = 0x00000006;
public static final int GradientColor_android_type = 0x00000002;
public static final int[] ColorStateListItem = {android.R.attr.color, android.R.attr.alpha, android.R.attr.lStar, ch.mod_p.sre24.e5.R.attr.alpha, ch.mod_p.sre24.e5.R.attr.lStar};
public static final int[] FontFamily = {ch.mod_p.sre24.e5.R.attr.fontProviderAuthority, ch.mod_p.sre24.e5.R.attr.fontProviderCerts, ch.mod_p.sre24.e5.R.attr.fontProviderFetchStrategy, ch.mod_p.sre24.e5.R.attr.fontProviderFetchTimeout, ch.mod_p.sre24.e5.R.attr.fontProviderPackage, ch.mod_p.sre24.e5.R.attr.fontProviderQuery, ch.mod_p.sre24.e5.R.attr.fontProviderSystemFontFamily};
public static final int[] FontFamilyFont = {android.R.attr.font, android.R.attr.fontWeight, android.R.attr.fontStyle, android.R.attr.ttcIndex, android.R.attr.fontVariationSettings, ch.mod_p.sre24.e5.R.attr.font, ch.mod_p.sre24.e5.R.attr.fontStyle, ch.mod_p.sre24.e5.R.attr.fontVariationSettings, ch.mod_p.sre24.e5.R.attr.fontWeight, ch.mod_p.sre24.e5.R.attr.ttcIndex};
public static final int[] GradientColor = {android.R.attr.startColor, android.R.attr.endColor, android.R.attr.type, android.R.attr.centerX, android.R.attr.centerY, android.R.attr.gradientRadius, android.R.attr.tileMode, android.R.attr.centerColor, android.R.attr.startX, android.R.attr.startY, android.R.attr.endX, android.R.attr.endY};
public static final int[] GradientColorItem = {android.R.attr.color, android.R.attr.offset};
private styleable() {
}
}
private R() {
}
}

View File

@ -0,0 +1,65 @@
package androidx.customview.view;
import android.os.Parcel;
import android.os.Parcelable;
/* loaded from: classes.dex */
public abstract class AbsSavedState implements Parcelable {
private final Parcelable mSuperState;
public static final AbsSavedState EMPTY_STATE = new AbsSavedState() { // from class: androidx.customview.view.AbsSavedState.1
};
public static final Parcelable.Creator<AbsSavedState> CREATOR = new Parcelable.ClassLoaderCreator<AbsSavedState>() { // from class: androidx.customview.view.AbsSavedState.2
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.ClassLoaderCreator
public AbsSavedState createFromParcel(Parcel parcel, ClassLoader classLoader) {
if (parcel.readParcelable(classLoader) != null) {
throw new IllegalStateException("superState must be null");
}
return AbsSavedState.EMPTY_STATE;
}
@Override // android.os.Parcelable.Creator
public AbsSavedState createFromParcel(Parcel parcel) {
return createFromParcel(parcel, (ClassLoader) null);
}
@Override // android.os.Parcelable.Creator
public AbsSavedState[] newArray(int i) {
return new AbsSavedState[i];
}
};
@Override // android.os.Parcelable
public int describeContents() {
return 0;
}
public final Parcelable getSuperState() {
return this.mSuperState;
}
private AbsSavedState() {
this.mSuperState = null;
}
protected AbsSavedState(Parcelable parcelable) {
if (parcelable == null) {
throw new IllegalArgumentException("superState must not be null");
}
this.mSuperState = parcelable == EMPTY_STATE ? null : parcelable;
}
protected AbsSavedState(Parcel parcel) {
this(parcel, null);
}
protected AbsSavedState(Parcel parcel, ClassLoader classLoader) {
Parcelable readParcelable = parcel.readParcelable(classLoader);
this.mSuperState = readParcelable == null ? EMPTY_STATE : readParcelable;
}
@Override // android.os.Parcelable
public void writeToParcel(Parcel parcel, int i) {
parcel.writeParcelable(this.mSuperState, i);
}
}

View File

@ -0,0 +1,538 @@
package androidx.customview.widget;
import android.graphics.Rect;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewParent;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import androidx.collection.SparseArrayCompat;
import androidx.core.view.AccessibilityDelegateCompat;
import androidx.core.view.ViewCompat;
import androidx.core.view.accessibility.AccessibilityEventCompat;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
import androidx.core.view.accessibility.AccessibilityNodeProviderCompat;
import androidx.core.view.accessibility.AccessibilityRecordCompat;
import androidx.customview.widget.FocusStrategy;
import java.util.ArrayList;
import java.util.List;
/* loaded from: classes.dex */
public abstract class ExploreByTouchHelper extends AccessibilityDelegateCompat {
private static final String DEFAULT_CLASS_NAME = "android.view.View";
public static final int HOST_ID = -1;
public static final int INVALID_ID = Integer.MIN_VALUE;
private static final Rect INVALID_PARENT_BOUNDS = new Rect(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE);
private static final FocusStrategy.BoundsAdapter<AccessibilityNodeInfoCompat> NODE_ADAPTER = new FocusStrategy.BoundsAdapter<AccessibilityNodeInfoCompat>() { // from class: androidx.customview.widget.ExploreByTouchHelper.1
@Override // androidx.customview.widget.FocusStrategy.BoundsAdapter
public void obtainBounds(AccessibilityNodeInfoCompat accessibilityNodeInfoCompat, Rect rect) {
accessibilityNodeInfoCompat.getBoundsInParent(rect);
}
};
private static final FocusStrategy.CollectionAdapter<SparseArrayCompat<AccessibilityNodeInfoCompat>, AccessibilityNodeInfoCompat> SPARSE_VALUES_ADAPTER = new FocusStrategy.CollectionAdapter<SparseArrayCompat<AccessibilityNodeInfoCompat>, AccessibilityNodeInfoCompat>() { // from class: androidx.customview.widget.ExploreByTouchHelper.2
@Override // androidx.customview.widget.FocusStrategy.CollectionAdapter
public AccessibilityNodeInfoCompat get(SparseArrayCompat<AccessibilityNodeInfoCompat> sparseArrayCompat, int i) {
return sparseArrayCompat.valueAt(i);
}
@Override // androidx.customview.widget.FocusStrategy.CollectionAdapter
public int size(SparseArrayCompat<AccessibilityNodeInfoCompat> sparseArrayCompat) {
return sparseArrayCompat.size();
}
};
private final View mHost;
private final AccessibilityManager mManager;
private MyNodeProvider mNodeProvider;
private final Rect mTempScreenRect = new Rect();
private final Rect mTempParentRect = new Rect();
private final Rect mTempVisibleRect = new Rect();
private final int[] mTempGlobalRect = new int[2];
int mAccessibilityFocusedVirtualViewId = Integer.MIN_VALUE;
int mKeyboardFocusedVirtualViewId = Integer.MIN_VALUE;
private int mHoveredVirtualViewId = Integer.MIN_VALUE;
private static int keyToDirection(int i) {
if (i == 19) {
return 33;
}
if (i != 21) {
return i != 22 ? 130 : 66;
}
return 17;
}
public final int getAccessibilityFocusedVirtualViewId() {
return this.mAccessibilityFocusedVirtualViewId;
}
public final int getKeyboardFocusedVirtualViewId() {
return this.mKeyboardFocusedVirtualViewId;
}
protected abstract int getVirtualViewAt(float f, float f2);
protected abstract void getVisibleVirtualViews(List<Integer> list);
protected abstract boolean onPerformActionForVirtualView(int i, int i2, Bundle bundle);
protected void onPopulateEventForHost(AccessibilityEvent accessibilityEvent) {
}
protected void onPopulateEventForVirtualView(int i, AccessibilityEvent accessibilityEvent) {
}
protected void onPopulateNodeForHost(AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) {
}
protected abstract void onPopulateNodeForVirtualView(int i, AccessibilityNodeInfoCompat accessibilityNodeInfoCompat);
protected void onVirtualViewKeyboardFocusChanged(int i, boolean z) {
}
public ExploreByTouchHelper(View view) {
if (view == null) {
throw new IllegalArgumentException("View may not be null");
}
this.mHost = view;
this.mManager = (AccessibilityManager) view.getContext().getSystemService("accessibility");
view.setFocusable(true);
if (ViewCompat.getImportantForAccessibility(view) == 0) {
ViewCompat.setImportantForAccessibility(view, 1);
}
}
@Override // androidx.core.view.AccessibilityDelegateCompat
public AccessibilityNodeProviderCompat getAccessibilityNodeProvider(View view) {
if (this.mNodeProvider == null) {
this.mNodeProvider = new MyNodeProvider();
}
return this.mNodeProvider;
}
public final boolean dispatchHoverEvent(MotionEvent motionEvent) {
if (!this.mManager.isEnabled() || !this.mManager.isTouchExplorationEnabled()) {
return false;
}
int action = motionEvent.getAction();
if (action == 7 || action == 9) {
int virtualViewAt = getVirtualViewAt(motionEvent.getX(), motionEvent.getY());
updateHoveredVirtualView(virtualViewAt);
return virtualViewAt != Integer.MIN_VALUE;
}
if (action != 10 || this.mHoveredVirtualViewId == Integer.MIN_VALUE) {
return false;
}
updateHoveredVirtualView(Integer.MIN_VALUE);
return true;
}
public final boolean dispatchKeyEvent(KeyEvent keyEvent) {
int i = 0;
if (keyEvent.getAction() == 1) {
return false;
}
int keyCode = keyEvent.getKeyCode();
if (keyCode != 61) {
if (keyCode != 66) {
switch (keyCode) {
case 19:
case 20:
case 21:
case 22:
if (!keyEvent.hasNoModifiers()) {
return false;
}
int keyToDirection = keyToDirection(keyCode);
int repeatCount = keyEvent.getRepeatCount() + 1;
boolean z = false;
while (i < repeatCount && moveFocus(keyToDirection, null)) {
i++;
z = true;
}
return z;
case 23:
break;
default:
return false;
}
}
if (!keyEvent.hasNoModifiers() || keyEvent.getRepeatCount() != 0) {
return false;
}
clickKeyboardFocusedVirtualView();
return true;
}
if (keyEvent.hasNoModifiers()) {
return moveFocus(2, null);
}
if (keyEvent.hasModifiers(1)) {
return moveFocus(1, null);
}
return false;
}
public final void onFocusChanged(boolean z, int i, Rect rect) {
int i2 = this.mKeyboardFocusedVirtualViewId;
if (i2 != Integer.MIN_VALUE) {
clearKeyboardFocusForVirtualView(i2);
}
if (z) {
moveFocus(i, rect);
}
}
private void getBoundsInParent(int i, Rect rect) {
obtainAccessibilityNodeInfo(i).getBoundsInParent(rect);
}
private boolean moveFocus(int i, Rect rect) {
AccessibilityNodeInfoCompat accessibilityNodeInfoCompat;
SparseArrayCompat<AccessibilityNodeInfoCompat> allNodes = getAllNodes();
int i2 = this.mKeyboardFocusedVirtualViewId;
AccessibilityNodeInfoCompat accessibilityNodeInfoCompat2 = i2 == Integer.MIN_VALUE ? null : allNodes.get(i2);
if (i == 1 || i == 2) {
accessibilityNodeInfoCompat = (AccessibilityNodeInfoCompat) FocusStrategy.findNextFocusInRelativeDirection(allNodes, SPARSE_VALUES_ADAPTER, NODE_ADAPTER, accessibilityNodeInfoCompat2, i, ViewCompat.getLayoutDirection(this.mHost) == 1, false);
} else if (i == 17 || i == 33 || i == 66 || i == 130) {
Rect rect2 = new Rect();
int i3 = this.mKeyboardFocusedVirtualViewId;
if (i3 != Integer.MIN_VALUE) {
getBoundsInParent(i3, rect2);
} else if (rect != null) {
rect2.set(rect);
} else {
guessPreviouslyFocusedRect(this.mHost, i, rect2);
}
accessibilityNodeInfoCompat = (AccessibilityNodeInfoCompat) FocusStrategy.findNextFocusInAbsoluteDirection(allNodes, SPARSE_VALUES_ADAPTER, NODE_ADAPTER, accessibilityNodeInfoCompat2, rect2, i);
} else {
throw new IllegalArgumentException("direction must be one of {FOCUS_FORWARD, FOCUS_BACKWARD, FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
}
return requestKeyboardFocusForVirtualView(accessibilityNodeInfoCompat != null ? allNodes.keyAt(allNodes.indexOfValue(accessibilityNodeInfoCompat)) : Integer.MIN_VALUE);
}
private SparseArrayCompat<AccessibilityNodeInfoCompat> getAllNodes() {
ArrayList arrayList = new ArrayList();
getVisibleVirtualViews(arrayList);
SparseArrayCompat<AccessibilityNodeInfoCompat> sparseArrayCompat = new SparseArrayCompat<>();
for (int i = 0; i < arrayList.size(); i++) {
sparseArrayCompat.put(arrayList.get(i).intValue(), createNodeForChild(arrayList.get(i).intValue()));
}
return sparseArrayCompat;
}
private static Rect guessPreviouslyFocusedRect(View view, int i, Rect rect) {
int width = view.getWidth();
int height = view.getHeight();
if (i == 17) {
rect.set(width, 0, width, height);
} else if (i == 33) {
rect.set(0, height, width, height);
} else if (i == 66) {
rect.set(-1, 0, -1, height);
} else if (i == 130) {
rect.set(0, -1, width, -1);
} else {
throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
}
return rect;
}
private boolean clickKeyboardFocusedVirtualView() {
int i = this.mKeyboardFocusedVirtualViewId;
return i != Integer.MIN_VALUE && onPerformActionForVirtualView(i, 16, null);
}
public final boolean sendEventForVirtualView(int i, int i2) {
ViewParent parent;
if (i == Integer.MIN_VALUE || !this.mManager.isEnabled() || (parent = this.mHost.getParent()) == null) {
return false;
}
return parent.requestSendAccessibilityEvent(this.mHost, createEvent(i, i2));
}
public final void invalidateRoot() {
invalidateVirtualView(-1, 1);
}
public final void invalidateVirtualView(int i) {
invalidateVirtualView(i, 0);
}
public final void invalidateVirtualView(int i, int i2) {
ViewParent parent;
if (i == Integer.MIN_VALUE || !this.mManager.isEnabled() || (parent = this.mHost.getParent()) == null) {
return;
}
AccessibilityEvent createEvent = createEvent(i, 2048);
AccessibilityEventCompat.setContentChangeTypes(createEvent, i2);
parent.requestSendAccessibilityEvent(this.mHost, createEvent);
}
@Deprecated
public int getFocusedVirtualView() {
return getAccessibilityFocusedVirtualViewId();
}
private void updateHoveredVirtualView(int i) {
int i2 = this.mHoveredVirtualViewId;
if (i2 == i) {
return;
}
this.mHoveredVirtualViewId = i;
sendEventForVirtualView(i, 128);
sendEventForVirtualView(i2, 256);
}
private AccessibilityEvent createEvent(int i, int i2) {
if (i == -1) {
return createEventForHost(i2);
}
return createEventForChild(i, i2);
}
private AccessibilityEvent createEventForHost(int i) {
AccessibilityEvent obtain = AccessibilityEvent.obtain(i);
this.mHost.onInitializeAccessibilityEvent(obtain);
return obtain;
}
@Override // androidx.core.view.AccessibilityDelegateCompat
public void onInitializeAccessibilityEvent(View view, AccessibilityEvent accessibilityEvent) {
super.onInitializeAccessibilityEvent(view, accessibilityEvent);
onPopulateEventForHost(accessibilityEvent);
}
private AccessibilityEvent createEventForChild(int i, int i2) {
AccessibilityEvent obtain = AccessibilityEvent.obtain(i2);
AccessibilityNodeInfoCompat obtainAccessibilityNodeInfo = obtainAccessibilityNodeInfo(i);
obtain.getText().add(obtainAccessibilityNodeInfo.getText());
obtain.setContentDescription(obtainAccessibilityNodeInfo.getContentDescription());
obtain.setScrollable(obtainAccessibilityNodeInfo.isScrollable());
obtain.setPassword(obtainAccessibilityNodeInfo.isPassword());
obtain.setEnabled(obtainAccessibilityNodeInfo.isEnabled());
obtain.setChecked(obtainAccessibilityNodeInfo.isChecked());
onPopulateEventForVirtualView(i, obtain);
if (obtain.getText().isEmpty() && obtain.getContentDescription() == null) {
throw new RuntimeException("Callbacks must add text or a content description in populateEventForVirtualViewId()");
}
obtain.setClassName(obtainAccessibilityNodeInfo.getClassName());
AccessibilityRecordCompat.setSource(obtain, this.mHost, i);
obtain.setPackageName(this.mHost.getContext().getPackageName());
return obtain;
}
AccessibilityNodeInfoCompat obtainAccessibilityNodeInfo(int i) {
if (i == -1) {
return createNodeForHost();
}
return createNodeForChild(i);
}
private AccessibilityNodeInfoCompat createNodeForHost() {
AccessibilityNodeInfoCompat obtain = AccessibilityNodeInfoCompat.obtain(this.mHost);
ViewCompat.onInitializeAccessibilityNodeInfo(this.mHost, obtain);
ArrayList arrayList = new ArrayList();
getVisibleVirtualViews(arrayList);
if (obtain.getChildCount() > 0 && arrayList.size() > 0) {
throw new RuntimeException("Views cannot have both real and virtual children");
}
int size = arrayList.size();
for (int i = 0; i < size; i++) {
obtain.addChild(this.mHost, ((Integer) arrayList.get(i)).intValue());
}
return obtain;
}
@Override // androidx.core.view.AccessibilityDelegateCompat
public void onInitializeAccessibilityNodeInfo(View view, AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) {
super.onInitializeAccessibilityNodeInfo(view, accessibilityNodeInfoCompat);
onPopulateNodeForHost(accessibilityNodeInfoCompat);
}
private AccessibilityNodeInfoCompat createNodeForChild(int i) {
AccessibilityNodeInfoCompat obtain = AccessibilityNodeInfoCompat.obtain();
obtain.setEnabled(true);
obtain.setFocusable(true);
obtain.setClassName(DEFAULT_CLASS_NAME);
Rect rect = INVALID_PARENT_BOUNDS;
obtain.setBoundsInParent(rect);
obtain.setBoundsInScreen(rect);
obtain.setParent(this.mHost);
onPopulateNodeForVirtualView(i, obtain);
if (obtain.getText() == null && obtain.getContentDescription() == null) {
throw new RuntimeException("Callbacks must add text or a content description in populateNodeForVirtualViewId()");
}
obtain.getBoundsInParent(this.mTempParentRect);
if (this.mTempParentRect.equals(rect)) {
throw new RuntimeException("Callbacks must set parent bounds in populateNodeForVirtualViewId()");
}
int actions = obtain.getActions();
if ((actions & 64) != 0) {
throw new RuntimeException("Callbacks must not add ACTION_ACCESSIBILITY_FOCUS in populateNodeForVirtualViewId()");
}
if ((actions & 128) != 0) {
throw new RuntimeException("Callbacks must not add ACTION_CLEAR_ACCESSIBILITY_FOCUS in populateNodeForVirtualViewId()");
}
obtain.setPackageName(this.mHost.getContext().getPackageName());
obtain.setSource(this.mHost, i);
if (this.mAccessibilityFocusedVirtualViewId == i) {
obtain.setAccessibilityFocused(true);
obtain.addAction(128);
} else {
obtain.setAccessibilityFocused(false);
obtain.addAction(64);
}
boolean z = this.mKeyboardFocusedVirtualViewId == i;
if (z) {
obtain.addAction(2);
} else if (obtain.isFocusable()) {
obtain.addAction(1);
}
obtain.setFocused(z);
this.mHost.getLocationOnScreen(this.mTempGlobalRect);
obtain.getBoundsInScreen(this.mTempScreenRect);
if (this.mTempScreenRect.equals(rect)) {
obtain.getBoundsInParent(this.mTempScreenRect);
if (obtain.mParentVirtualDescendantId != -1) {
AccessibilityNodeInfoCompat obtain2 = AccessibilityNodeInfoCompat.obtain();
for (int i2 = obtain.mParentVirtualDescendantId; i2 != -1; i2 = obtain2.mParentVirtualDescendantId) {
obtain2.setParent(this.mHost, -1);
obtain2.setBoundsInParent(INVALID_PARENT_BOUNDS);
onPopulateNodeForVirtualView(i2, obtain2);
obtain2.getBoundsInParent(this.mTempParentRect);
this.mTempScreenRect.offset(this.mTempParentRect.left, this.mTempParentRect.top);
}
obtain2.recycle();
}
this.mTempScreenRect.offset(this.mTempGlobalRect[0] - this.mHost.getScrollX(), this.mTempGlobalRect[1] - this.mHost.getScrollY());
}
if (this.mHost.getLocalVisibleRect(this.mTempVisibleRect)) {
this.mTempVisibleRect.offset(this.mTempGlobalRect[0] - this.mHost.getScrollX(), this.mTempGlobalRect[1] - this.mHost.getScrollY());
if (this.mTempScreenRect.intersect(this.mTempVisibleRect)) {
obtain.setBoundsInScreen(this.mTempScreenRect);
if (isVisibleToUser(this.mTempScreenRect)) {
obtain.setVisibleToUser(true);
}
}
}
return obtain;
}
boolean performAction(int i, int i2, Bundle bundle) {
if (i == -1) {
return performActionForHost(i2, bundle);
}
return performActionForChild(i, i2, bundle);
}
private boolean performActionForHost(int i, Bundle bundle) {
return ViewCompat.performAccessibilityAction(this.mHost, i, bundle);
}
private boolean performActionForChild(int i, int i2, Bundle bundle) {
if (i2 == 1) {
return requestKeyboardFocusForVirtualView(i);
}
if (i2 == 2) {
return clearKeyboardFocusForVirtualView(i);
}
if (i2 == 64) {
return requestAccessibilityFocus(i);
}
if (i2 == 128) {
return clearAccessibilityFocus(i);
}
return onPerformActionForVirtualView(i, i2, bundle);
}
private boolean isVisibleToUser(Rect rect) {
if (rect == null || rect.isEmpty() || this.mHost.getWindowVisibility() != 0) {
return false;
}
Object parent = this.mHost.getParent();
while (parent instanceof View) {
View view = (View) parent;
if (view.getAlpha() <= 0.0f || view.getVisibility() != 0) {
return false;
}
parent = view.getParent();
}
return parent != null;
}
private boolean requestAccessibilityFocus(int i) {
int i2;
if (!this.mManager.isEnabled() || !this.mManager.isTouchExplorationEnabled() || (i2 = this.mAccessibilityFocusedVirtualViewId) == i) {
return false;
}
if (i2 != Integer.MIN_VALUE) {
clearAccessibilityFocus(i2);
}
this.mAccessibilityFocusedVirtualViewId = i;
this.mHost.invalidate();
sendEventForVirtualView(i, 32768);
return true;
}
private boolean clearAccessibilityFocus(int i) {
if (this.mAccessibilityFocusedVirtualViewId != i) {
return false;
}
this.mAccessibilityFocusedVirtualViewId = Integer.MIN_VALUE;
this.mHost.invalidate();
sendEventForVirtualView(i, 65536);
return true;
}
public final boolean requestKeyboardFocusForVirtualView(int i) {
int i2;
if ((!this.mHost.isFocused() && !this.mHost.requestFocus()) || (i2 = this.mKeyboardFocusedVirtualViewId) == i) {
return false;
}
if (i2 != Integer.MIN_VALUE) {
clearKeyboardFocusForVirtualView(i2);
}
if (i == Integer.MIN_VALUE) {
return false;
}
this.mKeyboardFocusedVirtualViewId = i;
onVirtualViewKeyboardFocusChanged(i, true);
sendEventForVirtualView(i, 8);
return true;
}
public final boolean clearKeyboardFocusForVirtualView(int i) {
if (this.mKeyboardFocusedVirtualViewId != i) {
return false;
}
this.mKeyboardFocusedVirtualViewId = Integer.MIN_VALUE;
onVirtualViewKeyboardFocusChanged(i, false);
sendEventForVirtualView(i, 8);
return true;
}
private class MyNodeProvider extends AccessibilityNodeProviderCompat {
MyNodeProvider() {
}
@Override // androidx.core.view.accessibility.AccessibilityNodeProviderCompat
public AccessibilityNodeInfoCompat createAccessibilityNodeInfo(int i) {
return AccessibilityNodeInfoCompat.obtain(ExploreByTouchHelper.this.obtainAccessibilityNodeInfo(i));
}
@Override // androidx.core.view.accessibility.AccessibilityNodeProviderCompat
public boolean performAction(int i, int i2, Bundle bundle) {
return ExploreByTouchHelper.this.performAction(i, i2, bundle);
}
@Override // androidx.core.view.accessibility.AccessibilityNodeProviderCompat
public AccessibilityNodeInfoCompat findFocus(int i) {
int i2 = i == 2 ? ExploreByTouchHelper.this.mAccessibilityFocusedVirtualViewId : ExploreByTouchHelper.this.mKeyboardFocusedVirtualViewId;
if (i2 == Integer.MIN_VALUE) {
return null;
}
return createAccessibilityNodeInfo(i2);
}
}
}

View File

@ -0,0 +1,269 @@
package androidx.customview.widget;
import android.graphics.Rect;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
/* loaded from: classes.dex */
class FocusStrategy {
public interface BoundsAdapter<T> {
void obtainBounds(T t, Rect rect);
}
public interface CollectionAdapter<T, V> {
V get(T t, int i);
int size(T t);
}
private static int getWeightedDistanceFor(int i, int i2) {
return (i * 13 * i) + (i2 * i2);
}
public static <L, T> T findNextFocusInRelativeDirection(L l, CollectionAdapter<L, T> collectionAdapter, BoundsAdapter<T> boundsAdapter, T t, int i, boolean z, boolean z2) {
int size = collectionAdapter.size(l);
ArrayList arrayList = new ArrayList(size);
for (int i2 = 0; i2 < size; i2++) {
arrayList.add(collectionAdapter.get(l, i2));
}
Collections.sort(arrayList, new SequentialComparator(z, boundsAdapter));
if (i == 1) {
return (T) getPreviousFocusable(t, arrayList, z2);
}
if (i == 2) {
return (T) getNextFocusable(t, arrayList, z2);
}
throw new IllegalArgumentException("direction must be one of {FOCUS_FORWARD, FOCUS_BACKWARD}.");
}
private static <T> T getNextFocusable(T t, ArrayList<T> arrayList, boolean z) {
int size = arrayList.size();
int lastIndexOf = (t == null ? -1 : arrayList.lastIndexOf(t)) + 1;
if (lastIndexOf < size) {
return arrayList.get(lastIndexOf);
}
if (!z || size <= 0) {
return null;
}
return arrayList.get(0);
}
private static <T> T getPreviousFocusable(T t, ArrayList<T> arrayList, boolean z) {
int size = arrayList.size();
int indexOf = (t == null ? size : arrayList.indexOf(t)) - 1;
if (indexOf >= 0) {
return arrayList.get(indexOf);
}
if (!z || size <= 0) {
return null;
}
return arrayList.get(size - 1);
}
private static class SequentialComparator<T> implements Comparator<T> {
private final BoundsAdapter<T> mAdapter;
private final boolean mIsLayoutRtl;
private final Rect mTemp1 = new Rect();
private final Rect mTemp2 = new Rect();
SequentialComparator(boolean z, BoundsAdapter<T> boundsAdapter) {
this.mIsLayoutRtl = z;
this.mAdapter = boundsAdapter;
}
@Override // java.util.Comparator
public int compare(T t, T t2) {
Rect rect = this.mTemp1;
Rect rect2 = this.mTemp2;
this.mAdapter.obtainBounds(t, rect);
this.mAdapter.obtainBounds(t2, rect2);
if (rect.top < rect2.top) {
return -1;
}
if (rect.top > rect2.top) {
return 1;
}
if (rect.left < rect2.left) {
return this.mIsLayoutRtl ? 1 : -1;
}
if (rect.left > rect2.left) {
return this.mIsLayoutRtl ? -1 : 1;
}
if (rect.bottom < rect2.bottom) {
return -1;
}
if (rect.bottom > rect2.bottom) {
return 1;
}
if (rect.right < rect2.right) {
return this.mIsLayoutRtl ? 1 : -1;
}
if (rect.right > rect2.right) {
return this.mIsLayoutRtl ? -1 : 1;
}
return 0;
}
}
public static <L, T> T findNextFocusInAbsoluteDirection(L l, CollectionAdapter<L, T> collectionAdapter, BoundsAdapter<T> boundsAdapter, T t, Rect rect, int i) {
Rect rect2 = new Rect(rect);
if (i == 17) {
rect2.offset(rect.width() + 1, 0);
} else if (i == 33) {
rect2.offset(0, rect.height() + 1);
} else if (i == 66) {
rect2.offset(-(rect.width() + 1), 0);
} else if (i == 130) {
rect2.offset(0, -(rect.height() + 1));
} else {
throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
}
int size = collectionAdapter.size(l);
Rect rect3 = new Rect();
T t2 = null;
for (int i2 = 0; i2 < size; i2++) {
T t3 = collectionAdapter.get(l, i2);
if (t3 != t) {
boundsAdapter.obtainBounds(t3, rect3);
if (isBetterCandidate(i, rect, rect3, rect2)) {
rect2.set(rect3);
t2 = t3;
}
}
}
return t2;
}
private static boolean isBetterCandidate(int i, Rect rect, Rect rect2, Rect rect3) {
if (!isCandidate(rect, rect2, i)) {
return false;
}
if (isCandidate(rect, rect3, i) && !beamBeats(i, rect, rect2, rect3)) {
return !beamBeats(i, rect, rect3, rect2) && getWeightedDistanceFor(majorAxisDistance(i, rect, rect2), minorAxisDistance(i, rect, rect2)) < getWeightedDistanceFor(majorAxisDistance(i, rect, rect3), minorAxisDistance(i, rect, rect3));
}
return true;
}
private static boolean beamBeats(int i, Rect rect, Rect rect2, Rect rect3) {
boolean beamsOverlap = beamsOverlap(i, rect, rect2);
if (beamsOverlap(i, rect, rect3) || !beamsOverlap) {
return false;
}
return !isToDirectionOf(i, rect, rect3) || i == 17 || i == 66 || majorAxisDistance(i, rect, rect2) < majorAxisDistanceToFarEdge(i, rect, rect3);
}
private static boolean isCandidate(Rect rect, Rect rect2, int i) {
if (i == 17) {
return (rect.right > rect2.right || rect.left >= rect2.right) && rect.left > rect2.left;
}
if (i == 33) {
return (rect.bottom > rect2.bottom || rect.top >= rect2.bottom) && rect.top > rect2.top;
}
if (i == 66) {
return (rect.left < rect2.left || rect.right <= rect2.left) && rect.right < rect2.right;
}
if (i == 130) {
return (rect.top < rect2.top || rect.bottom <= rect2.top) && rect.bottom < rect2.bottom;
}
throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
}
private static boolean beamsOverlap(int i, Rect rect, Rect rect2) {
if (i != 17) {
if (i != 33) {
if (i != 66) {
if (i != 130) {
throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
}
}
}
return rect2.right >= rect.left && rect2.left <= rect.right;
}
return rect2.bottom >= rect.top && rect2.top <= rect.bottom;
}
private static boolean isToDirectionOf(int i, Rect rect, Rect rect2) {
if (i == 17) {
return rect.left >= rect2.right;
}
if (i == 33) {
return rect.top >= rect2.bottom;
}
if (i == 66) {
return rect.right <= rect2.left;
}
if (i == 130) {
return rect.bottom <= rect2.top;
}
throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
}
private static int majorAxisDistance(int i, Rect rect, Rect rect2) {
return Math.max(0, majorAxisDistanceRaw(i, rect, rect2));
}
private static int majorAxisDistanceRaw(int i, Rect rect, Rect rect2) {
int i2;
int i3;
if (i == 17) {
i2 = rect.left;
i3 = rect2.right;
} else if (i == 33) {
i2 = rect.top;
i3 = rect2.bottom;
} else if (i == 66) {
i2 = rect2.left;
i3 = rect.right;
} else if (i == 130) {
i2 = rect2.top;
i3 = rect.bottom;
} else {
throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
}
return i2 - i3;
}
private static int majorAxisDistanceToFarEdge(int i, Rect rect, Rect rect2) {
return Math.max(1, majorAxisDistanceToFarEdgeRaw(i, rect, rect2));
}
private static int majorAxisDistanceToFarEdgeRaw(int i, Rect rect, Rect rect2) {
int i2;
int i3;
if (i == 17) {
i2 = rect.left;
i3 = rect2.left;
} else if (i == 33) {
i2 = rect.top;
i3 = rect2.top;
} else if (i == 66) {
i2 = rect2.right;
i3 = rect.right;
} else if (i == 130) {
i2 = rect2.bottom;
i3 = rect.bottom;
} else {
throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
}
return i2 - i3;
}
private static int minorAxisDistance(int i, Rect rect, Rect rect2) {
if (i != 17) {
if (i != 33) {
if (i != 66) {
if (i != 130) {
throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
}
}
}
return Math.abs((rect.left + (rect.width() / 2)) - (rect2.left + (rect2.width() / 2)));
}
return Math.abs((rect.top + (rect.height() / 2)) - (rect2.top + (rect2.height() / 2)));
}
private FocusStrategy() {
}
}

View File

@ -0,0 +1,10 @@
package androidx.customview.widget;
/* loaded from: classes.dex */
public interface Openable {
void close();
boolean isOpen();
void open();
}

View File

@ -0,0 +1,738 @@
package androidx.customview.widget;
import android.content.Context;
import android.util.Log;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.animation.Interpolator;
import android.widget.OverScroller;
import androidx.core.view.ViewCompat;
import java.util.Arrays;
/* loaded from: classes.dex */
public class ViewDragHelper {
private static final int BASE_SETTLE_DURATION = 256;
public static final int DIRECTION_ALL = 3;
public static final int DIRECTION_HORIZONTAL = 1;
public static final int DIRECTION_VERTICAL = 2;
public static final int EDGE_ALL = 15;
public static final int EDGE_BOTTOM = 8;
public static final int EDGE_LEFT = 1;
public static final int EDGE_RIGHT = 2;
private static final int EDGE_SIZE = 20;
public static final int EDGE_TOP = 4;
public static final int INVALID_POINTER = -1;
private static final int MAX_SETTLE_DURATION = 600;
public static final int STATE_DRAGGING = 1;
public static final int STATE_IDLE = 0;
public static final int STATE_SETTLING = 2;
private static final String TAG = "ViewDragHelper";
private static final Interpolator sInterpolator = new Interpolator() { // from class: androidx.customview.widget.ViewDragHelper.1
@Override // android.animation.TimeInterpolator
public float getInterpolation(float f) {
float f2 = f - 1.0f;
return (f2 * f2 * f2 * f2 * f2) + 1.0f;
}
};
private final Callback mCallback;
private View mCapturedView;
private final int mDefaultEdgeSize;
private int mDragState;
private int[] mEdgeDragsInProgress;
private int[] mEdgeDragsLocked;
private int mEdgeSize;
private int[] mInitialEdgesTouched;
private float[] mInitialMotionX;
private float[] mInitialMotionY;
private float[] mLastMotionX;
private float[] mLastMotionY;
private float mMaxVelocity;
private float mMinVelocity;
private final ViewGroup mParentView;
private int mPointersDown;
private boolean mReleaseInProgress;
private OverScroller mScroller;
private int mTouchSlop;
private int mTrackingEdges;
private VelocityTracker mVelocityTracker;
private int mActivePointerId = -1;
private final Runnable mSetIdleRunnable = new Runnable() { // from class: androidx.customview.widget.ViewDragHelper.2
@Override // java.lang.Runnable
public void run() {
ViewDragHelper.this.setDragState(0);
}
};
public static abstract class Callback {
public int clampViewPositionHorizontal(View view, int i, int i2) {
return 0;
}
public int clampViewPositionVertical(View view, int i, int i2) {
return 0;
}
public int getOrderedChildIndex(int i) {
return i;
}
public int getViewHorizontalDragRange(View view) {
return 0;
}
public int getViewVerticalDragRange(View view) {
return 0;
}
public void onEdgeDragStarted(int i, int i2) {
}
public boolean onEdgeLock(int i) {
return false;
}
public void onEdgeTouched(int i, int i2) {
}
public void onViewCaptured(View view, int i) {
}
public void onViewDragStateChanged(int i) {
}
public void onViewPositionChanged(View view, int i, int i2, int i3, int i4) {
}
public void onViewReleased(View view, float f, float f2) {
}
public abstract boolean tryCaptureView(View view, int i);
}
public int getActivePointerId() {
return this.mActivePointerId;
}
public View getCapturedView() {
return this.mCapturedView;
}
public int getDefaultEdgeSize() {
return this.mDefaultEdgeSize;
}
public int getEdgeSize() {
return this.mEdgeSize;
}
public float getMinVelocity() {
return this.mMinVelocity;
}
public int getTouchSlop() {
return this.mTouchSlop;
}
public int getViewDragState() {
return this.mDragState;
}
public boolean isPointerDown(int i) {
return ((1 << i) & this.mPointersDown) != 0;
}
public void setEdgeSize(int i) {
this.mEdgeSize = i;
}
public void setEdgeTrackingEnabled(int i) {
this.mTrackingEdges = i;
}
public void setMinVelocity(float f) {
this.mMinVelocity = f;
}
public static ViewDragHelper create(ViewGroup viewGroup, Callback callback) {
return new ViewDragHelper(viewGroup.getContext(), viewGroup, callback);
}
public static ViewDragHelper create(ViewGroup viewGroup, float f, Callback callback) {
ViewDragHelper create = create(viewGroup, callback);
create.mTouchSlop = (int) (create.mTouchSlop * (1.0f / f));
return create;
}
private ViewDragHelper(Context context, ViewGroup viewGroup, Callback callback) {
if (viewGroup == null) {
throw new IllegalArgumentException("Parent view may not be null");
}
if (callback == null) {
throw new IllegalArgumentException("Callback may not be null");
}
this.mParentView = viewGroup;
this.mCallback = callback;
ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
int i = (int) ((context.getResources().getDisplayMetrics().density * 20.0f) + 0.5f);
this.mDefaultEdgeSize = i;
this.mEdgeSize = i;
this.mTouchSlop = viewConfiguration.getScaledTouchSlop();
this.mMaxVelocity = viewConfiguration.getScaledMaximumFlingVelocity();
this.mMinVelocity = viewConfiguration.getScaledMinimumFlingVelocity();
this.mScroller = new OverScroller(context, sInterpolator);
}
public void captureChildView(View view, int i) {
if (view.getParent() != this.mParentView) {
throw new IllegalArgumentException("captureChildView: parameter must be a descendant of the ViewDragHelper's tracked parent view (" + this.mParentView + ")");
}
this.mCapturedView = view;
this.mActivePointerId = i;
this.mCallback.onViewCaptured(view, i);
setDragState(1);
}
public void cancel() {
this.mActivePointerId = -1;
clearMotionHistory();
VelocityTracker velocityTracker = this.mVelocityTracker;
if (velocityTracker != null) {
velocityTracker.recycle();
this.mVelocityTracker = null;
}
}
public void abort() {
cancel();
if (this.mDragState == 2) {
int currX = this.mScroller.getCurrX();
int currY = this.mScroller.getCurrY();
this.mScroller.abortAnimation();
int currX2 = this.mScroller.getCurrX();
int currY2 = this.mScroller.getCurrY();
this.mCallback.onViewPositionChanged(this.mCapturedView, currX2, currY2, currX2 - currX, currY2 - currY);
}
setDragState(0);
}
public boolean smoothSlideViewTo(View view, int i, int i2) {
this.mCapturedView = view;
this.mActivePointerId = -1;
boolean forceSettleCapturedViewAt = forceSettleCapturedViewAt(i, i2, 0, 0);
if (!forceSettleCapturedViewAt && this.mDragState == 0 && this.mCapturedView != null) {
this.mCapturedView = null;
}
return forceSettleCapturedViewAt;
}
public boolean settleCapturedViewAt(int i, int i2) {
if (!this.mReleaseInProgress) {
throw new IllegalStateException("Cannot settleCapturedViewAt outside of a call to Callback#onViewReleased");
}
return forceSettleCapturedViewAt(i, i2, (int) this.mVelocityTracker.getXVelocity(this.mActivePointerId), (int) this.mVelocityTracker.getYVelocity(this.mActivePointerId));
}
private boolean forceSettleCapturedViewAt(int i, int i2, int i3, int i4) {
int left = this.mCapturedView.getLeft();
int top = this.mCapturedView.getTop();
int i5 = i - left;
int i6 = i2 - top;
if (i5 == 0 && i6 == 0) {
this.mScroller.abortAnimation();
setDragState(0);
return false;
}
this.mScroller.startScroll(left, top, i5, i6, computeSettleDuration(this.mCapturedView, i5, i6, i3, i4));
setDragState(2);
return true;
}
private int computeSettleDuration(View view, int i, int i2, int i3, int i4) {
float f;
float f2;
float f3;
float f4;
int clampMag = clampMag(i3, (int) this.mMinVelocity, (int) this.mMaxVelocity);
int clampMag2 = clampMag(i4, (int) this.mMinVelocity, (int) this.mMaxVelocity);
int abs = Math.abs(i);
int abs2 = Math.abs(i2);
int abs3 = Math.abs(clampMag);
int abs4 = Math.abs(clampMag2);
int i5 = abs3 + abs4;
int i6 = abs + abs2;
if (clampMag != 0) {
f = abs3;
f2 = i5;
} else {
f = abs;
f2 = i6;
}
float f5 = f / f2;
if (clampMag2 != 0) {
f3 = abs4;
f4 = i5;
} else {
f3 = abs2;
f4 = i6;
}
return (int) ((computeAxisDuration(i, clampMag, this.mCallback.getViewHorizontalDragRange(view)) * f5) + (computeAxisDuration(i2, clampMag2, this.mCallback.getViewVerticalDragRange(view)) * (f3 / f4)));
}
private int computeAxisDuration(int i, int i2, int i3) {
int abs;
if (i == 0) {
return 0;
}
int width = this.mParentView.getWidth();
float f = width / 2;
float distanceInfluenceForSnapDuration = f + (distanceInfluenceForSnapDuration(Math.min(1.0f, Math.abs(i) / width)) * f);
int abs2 = Math.abs(i2);
if (abs2 > 0) {
abs = Math.round(Math.abs(distanceInfluenceForSnapDuration / abs2) * 1000.0f) * 4;
} else {
abs = (int) (((Math.abs(i) / i3) + 1.0f) * 256.0f);
}
return Math.min(abs, 600);
}
private int clampMag(int i, int i2, int i3) {
int abs = Math.abs(i);
if (abs < i2) {
return 0;
}
return abs > i3 ? i > 0 ? i3 : -i3 : i;
}
private float clampMag(float f, float f2, float f3) {
float abs = Math.abs(f);
if (abs < f2) {
return 0.0f;
}
return abs > f3 ? f > 0.0f ? f3 : -f3 : f;
}
private float distanceInfluenceForSnapDuration(float f) {
return (float) Math.sin((f - 0.5f) * 0.47123894f);
}
public void flingCapturedView(int i, int i2, int i3, int i4) {
if (!this.mReleaseInProgress) {
throw new IllegalStateException("Cannot flingCapturedView outside of a call to Callback#onViewReleased");
}
this.mScroller.fling(this.mCapturedView.getLeft(), this.mCapturedView.getTop(), (int) this.mVelocityTracker.getXVelocity(this.mActivePointerId), (int) this.mVelocityTracker.getYVelocity(this.mActivePointerId), i, i3, i2, i4);
setDragState(2);
}
/* JADX WARN: Code restructure failed: missing block: B:19:0x005b, code lost:
if (r0 == false) goto L19;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public boolean continueSettling(boolean r12) {
/*
r11 = this;
int r0 = r11.mDragState
r1 = 0
r2 = 2
if (r0 != r2) goto L6a
android.widget.OverScroller r0 = r11.mScroller
boolean r0 = r0.computeScrollOffset()
android.widget.OverScroller r3 = r11.mScroller
int r3 = r3.getCurrX()
android.widget.OverScroller r4 = r11.mScroller
int r10 = r4.getCurrY()
android.view.View r4 = r11.mCapturedView
int r4 = r4.getLeft()
int r8 = r3 - r4
android.view.View r4 = r11.mCapturedView
int r4 = r4.getTop()
int r9 = r10 - r4
if (r8 == 0) goto L2f
android.view.View r4 = r11.mCapturedView
androidx.core.view.ViewCompat.offsetLeftAndRight(r4, r8)
L2f:
if (r9 == 0) goto L36
android.view.View r4 = r11.mCapturedView
androidx.core.view.ViewCompat.offsetTopAndBottom(r4, r9)
L36:
if (r8 != 0) goto L3a
if (r9 == 0) goto L43
L3a:
androidx.customview.widget.ViewDragHelper$Callback r4 = r11.mCallback
android.view.View r5 = r11.mCapturedView
r6 = r3
r7 = r10
r4.onViewPositionChanged(r5, r6, r7, r8, r9)
L43:
if (r0 == 0) goto L5b
android.widget.OverScroller r4 = r11.mScroller
int r4 = r4.getFinalX()
if (r3 != r4) goto L5b
android.widget.OverScroller r3 = r11.mScroller
int r3 = r3.getFinalY()
if (r10 != r3) goto L5b
android.widget.OverScroller r0 = r11.mScroller
r0.abortAnimation()
goto L5d
L5b:
if (r0 != 0) goto L6a
L5d:
if (r12 == 0) goto L67
android.view.ViewGroup r12 = r11.mParentView
java.lang.Runnable r0 = r11.mSetIdleRunnable
r12.post(r0)
goto L6a
L67:
r11.setDragState(r1)
L6a:
int r12 = r11.mDragState
if (r12 != r2) goto L6f
r1 = 1
L6f:
return r1
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.customview.widget.ViewDragHelper.continueSettling(boolean):boolean");
}
private void dispatchViewReleased(float f, float f2) {
this.mReleaseInProgress = true;
this.mCallback.onViewReleased(this.mCapturedView, f, f2);
this.mReleaseInProgress = false;
if (this.mDragState == 1) {
setDragState(0);
}
}
private void clearMotionHistory() {
float[] fArr = this.mInitialMotionX;
if (fArr == null) {
return;
}
Arrays.fill(fArr, 0.0f);
Arrays.fill(this.mInitialMotionY, 0.0f);
Arrays.fill(this.mLastMotionX, 0.0f);
Arrays.fill(this.mLastMotionY, 0.0f);
Arrays.fill(this.mInitialEdgesTouched, 0);
Arrays.fill(this.mEdgeDragsInProgress, 0);
Arrays.fill(this.mEdgeDragsLocked, 0);
this.mPointersDown = 0;
}
private void clearMotionHistory(int i) {
if (this.mInitialMotionX == null || !isPointerDown(i)) {
return;
}
this.mInitialMotionX[i] = 0.0f;
this.mInitialMotionY[i] = 0.0f;
this.mLastMotionX[i] = 0.0f;
this.mLastMotionY[i] = 0.0f;
this.mInitialEdgesTouched[i] = 0;
this.mEdgeDragsInProgress[i] = 0;
this.mEdgeDragsLocked[i] = 0;
this.mPointersDown = (~(1 << i)) & this.mPointersDown;
}
private void ensureMotionHistorySizeForId(int i) {
float[] fArr = this.mInitialMotionX;
if (fArr == null || fArr.length <= i) {
int i2 = i + 1;
float[] fArr2 = new float[i2];
float[] fArr3 = new float[i2];
float[] fArr4 = new float[i2];
float[] fArr5 = new float[i2];
int[] iArr = new int[i2];
int[] iArr2 = new int[i2];
int[] iArr3 = new int[i2];
if (fArr != null) {
System.arraycopy(fArr, 0, fArr2, 0, fArr.length);
float[] fArr6 = this.mInitialMotionY;
System.arraycopy(fArr6, 0, fArr3, 0, fArr6.length);
float[] fArr7 = this.mLastMotionX;
System.arraycopy(fArr7, 0, fArr4, 0, fArr7.length);
float[] fArr8 = this.mLastMotionY;
System.arraycopy(fArr8, 0, fArr5, 0, fArr8.length);
int[] iArr4 = this.mInitialEdgesTouched;
System.arraycopy(iArr4, 0, iArr, 0, iArr4.length);
int[] iArr5 = this.mEdgeDragsInProgress;
System.arraycopy(iArr5, 0, iArr2, 0, iArr5.length);
int[] iArr6 = this.mEdgeDragsLocked;
System.arraycopy(iArr6, 0, iArr3, 0, iArr6.length);
}
this.mInitialMotionX = fArr2;
this.mInitialMotionY = fArr3;
this.mLastMotionX = fArr4;
this.mLastMotionY = fArr5;
this.mInitialEdgesTouched = iArr;
this.mEdgeDragsInProgress = iArr2;
this.mEdgeDragsLocked = iArr3;
}
}
private void saveInitialMotion(float f, float f2, int i) {
ensureMotionHistorySizeForId(i);
float[] fArr = this.mInitialMotionX;
this.mLastMotionX[i] = f;
fArr[i] = f;
float[] fArr2 = this.mInitialMotionY;
this.mLastMotionY[i] = f2;
fArr2[i] = f2;
this.mInitialEdgesTouched[i] = getEdgesTouched((int) f, (int) f2);
this.mPointersDown |= 1 << i;
}
private void saveLastMotion(MotionEvent motionEvent) {
int pointerCount = motionEvent.getPointerCount();
for (int i = 0; i < pointerCount; i++) {
int pointerId = motionEvent.getPointerId(i);
if (isValidPointerForActionMove(pointerId)) {
float x = motionEvent.getX(i);
float y = motionEvent.getY(i);
this.mLastMotionX[pointerId] = x;
this.mLastMotionY[pointerId] = y;
}
}
}
void setDragState(int i) {
this.mParentView.removeCallbacks(this.mSetIdleRunnable);
if (this.mDragState != i) {
this.mDragState = i;
this.mCallback.onViewDragStateChanged(i);
if (this.mDragState == 0) {
this.mCapturedView = null;
}
}
}
boolean tryCaptureViewForDrag(View view, int i) {
if (view == this.mCapturedView && this.mActivePointerId == i) {
return true;
}
if (view == null || !this.mCallback.tryCaptureView(view, i)) {
return false;
}
this.mActivePointerId = i;
captureChildView(view, i);
return true;
}
protected boolean canScroll(View view, boolean z, int i, int i2, int i3, int i4) {
int i5;
if (view instanceof ViewGroup) {
ViewGroup viewGroup = (ViewGroup) view;
int scrollX = view.getScrollX();
int scrollY = view.getScrollY();
for (int childCount = viewGroup.getChildCount() - 1; childCount >= 0; childCount--) {
View childAt = viewGroup.getChildAt(childCount);
int i6 = i3 + scrollX;
if (i6 >= childAt.getLeft() && i6 < childAt.getRight() && (i5 = i4 + scrollY) >= childAt.getTop() && i5 < childAt.getBottom() && canScroll(childAt, true, i, i2, i6 - childAt.getLeft(), i5 - childAt.getTop())) {
return true;
}
}
}
return z && (view.canScrollHorizontally(-i) || view.canScrollVertically(-i2));
}
/* JADX WARN: Code restructure failed: missing block: B:50:0x00dd, code lost:
if (r12 != r11) goto L54;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public boolean shouldInterceptTouchEvent(android.view.MotionEvent r17) {
/*
Method dump skipped, instructions count: 315
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.customview.widget.ViewDragHelper.shouldInterceptTouchEvent(android.view.MotionEvent):boolean");
}
/* JADX WARN: Code restructure failed: missing block: B:33:0x0066, code lost:
if (r9.mActivePointerId == (-1)) goto L38;
*/
/* JADX WARN: Code restructure failed: missing block: B:34:0x006c, code lost:
releaseViewForPointerUp();
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void processTouchEvent(android.view.MotionEvent r10) {
/*
Method dump skipped, instructions count: 377
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.customview.widget.ViewDragHelper.processTouchEvent(android.view.MotionEvent):void");
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r0v15 */
/* JADX WARN: Type inference failed for: r0v16 */
/* JADX WARN: Type inference failed for: r0v4, types: [int] */
/* JADX WARN: Type inference failed for: r0v6 */
/* JADX WARN: Type inference failed for: r0v7 */
/* JADX WARN: Type inference failed for: r3v3, types: [androidx.customview.widget.ViewDragHelper$Callback] */
private void reportNewEdgeDrags(float f, float f2, int i) {
boolean checkNewEdgeDrag = checkNewEdgeDrag(f, f2, i, 1);
boolean z = checkNewEdgeDrag;
if (checkNewEdgeDrag(f2, f, i, 4)) {
z = (checkNewEdgeDrag ? 1 : 0) | 4;
}
boolean z2 = z;
if (checkNewEdgeDrag(f, f2, i, 2)) {
z2 = (z ? 1 : 0) | 2;
}
?? r0 = z2;
if (checkNewEdgeDrag(f2, f, i, 8)) {
r0 = (z2 ? 1 : 0) | 8;
}
if (r0 != 0) {
int[] iArr = this.mEdgeDragsInProgress;
iArr[i] = iArr[i] | r0;
this.mCallback.onEdgeDragStarted(r0, i);
}
}
private boolean checkNewEdgeDrag(float f, float f2, int i, int i2) {
float abs = Math.abs(f);
float abs2 = Math.abs(f2);
if ((this.mInitialEdgesTouched[i] & i2) != i2 || (this.mTrackingEdges & i2) == 0 || (this.mEdgeDragsLocked[i] & i2) == i2 || (this.mEdgeDragsInProgress[i] & i2) == i2) {
return false;
}
int i3 = this.mTouchSlop;
if (abs <= i3 && abs2 <= i3) {
return false;
}
if (abs >= abs2 * 0.5f || !this.mCallback.onEdgeLock(i2)) {
return (this.mEdgeDragsInProgress[i] & i2) == 0 && abs > ((float) this.mTouchSlop);
}
int[] iArr = this.mEdgeDragsLocked;
iArr[i] = iArr[i] | i2;
return false;
}
private boolean checkTouchSlop(View view, float f, float f2) {
if (view == null) {
return false;
}
boolean z = this.mCallback.getViewHorizontalDragRange(view) > 0;
boolean z2 = this.mCallback.getViewVerticalDragRange(view) > 0;
if (!z || !z2) {
return z ? Math.abs(f) > ((float) this.mTouchSlop) : z2 && Math.abs(f2) > ((float) this.mTouchSlop);
}
float f3 = (f * f) + (f2 * f2);
int i = this.mTouchSlop;
return f3 > ((float) (i * i));
}
public boolean checkTouchSlop(int i) {
int length = this.mInitialMotionX.length;
for (int i2 = 0; i2 < length; i2++) {
if (checkTouchSlop(i, i2)) {
return true;
}
}
return false;
}
public boolean checkTouchSlop(int i, int i2) {
if (!isPointerDown(i2)) {
return false;
}
boolean z = (i & 1) == 1;
boolean z2 = (i & 2) == 2;
float f = this.mLastMotionX[i2] - this.mInitialMotionX[i2];
float f2 = this.mLastMotionY[i2] - this.mInitialMotionY[i2];
if (!z || !z2) {
return z ? Math.abs(f) > ((float) this.mTouchSlop) : z2 && Math.abs(f2) > ((float) this.mTouchSlop);
}
float f3 = (f * f) + (f2 * f2);
int i3 = this.mTouchSlop;
return f3 > ((float) (i3 * i3));
}
public boolean isEdgeTouched(int i) {
int length = this.mInitialEdgesTouched.length;
for (int i2 = 0; i2 < length; i2++) {
if (isEdgeTouched(i, i2)) {
return true;
}
}
return false;
}
public boolean isEdgeTouched(int i, int i2) {
return isPointerDown(i2) && (i & this.mInitialEdgesTouched[i2]) != 0;
}
private void releaseViewForPointerUp() {
this.mVelocityTracker.computeCurrentVelocity(1000, this.mMaxVelocity);
dispatchViewReleased(clampMag(this.mVelocityTracker.getXVelocity(this.mActivePointerId), this.mMinVelocity, this.mMaxVelocity), clampMag(this.mVelocityTracker.getYVelocity(this.mActivePointerId), this.mMinVelocity, this.mMaxVelocity));
}
private void dragTo(int i, int i2, int i3, int i4) {
int left = this.mCapturedView.getLeft();
int top = this.mCapturedView.getTop();
if (i3 != 0) {
i = this.mCallback.clampViewPositionHorizontal(this.mCapturedView, i, i3);
ViewCompat.offsetLeftAndRight(this.mCapturedView, i - left);
}
int i5 = i;
if (i4 != 0) {
i2 = this.mCallback.clampViewPositionVertical(this.mCapturedView, i2, i4);
ViewCompat.offsetTopAndBottom(this.mCapturedView, i2 - top);
}
int i6 = i2;
if (i3 == 0 && i4 == 0) {
return;
}
this.mCallback.onViewPositionChanged(this.mCapturedView, i5, i6, i5 - left, i6 - top);
}
public boolean isCapturedViewUnder(int i, int i2) {
return isViewUnder(this.mCapturedView, i, i2);
}
public boolean isViewUnder(View view, int i, int i2) {
return view != null && i >= view.getLeft() && i < view.getRight() && i2 >= view.getTop() && i2 < view.getBottom();
}
public View findTopChildUnder(int i, int i2) {
for (int childCount = this.mParentView.getChildCount() - 1; childCount >= 0; childCount--) {
View childAt = this.mParentView.getChildAt(this.mCallback.getOrderedChildIndex(childCount));
if (i >= childAt.getLeft() && i < childAt.getRight() && i2 >= childAt.getTop() && i2 < childAt.getBottom()) {
return childAt;
}
}
return null;
}
private int getEdgesTouched(int i, int i2) {
int i3 = i < this.mParentView.getLeft() + this.mEdgeSize ? 1 : 0;
if (i2 < this.mParentView.getTop() + this.mEdgeSize) {
i3 |= 4;
}
if (i > this.mParentView.getRight() - this.mEdgeSize) {
i3 |= 2;
}
return i2 > this.mParentView.getBottom() - this.mEdgeSize ? i3 | 8 : i3;
}
private boolean isValidPointerForActionMove(int i) {
if (isPointerDown(i)) {
return true;
}
Log.e(TAG, "Ignoring pointerId=" + i + " because ACTION_DOWN was not received for this pointer before ACTION_MOVE. It likely happened because ViewDragHelper did not receive all the events in the event stream.");
return false;
}
}