ADD week 5
This commit is contained in:
		| @@ -0,0 +1,722 @@ | ||||
| package com.google.android.material.search; | ||||
|  | ||||
| import android.animation.AnimatorListenerAdapter; | ||||
| import android.content.Context; | ||||
| import android.content.res.ColorStateList; | ||||
| import android.content.res.Resources; | ||||
| import android.graphics.drawable.Drawable; | ||||
| import android.graphics.drawable.RippleDrawable; | ||||
| import android.os.Build; | ||||
| import android.os.Parcel; | ||||
| import android.os.Parcelable; | ||||
| import android.text.TextUtils; | ||||
| import android.util.AttributeSet; | ||||
| import android.view.Menu; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import android.view.accessibility.AccessibilityManager; | ||||
| import android.view.accessibility.AccessibilityNodeInfo; | ||||
| import android.widget.EditText; | ||||
| import android.widget.ImageButton; | ||||
| import android.widget.TextView; | ||||
| import androidx.appcompat.view.menu.MenuBuilder; | ||||
| import androidx.appcompat.widget.ActionMenuView; | ||||
| import androidx.appcompat.widget.Toolbar; | ||||
| import androidx.coordinatorlayout.widget.CoordinatorLayout; | ||||
| import androidx.core.graphics.drawable.DrawableCompat; | ||||
| import androidx.core.view.MarginLayoutParamsCompat; | ||||
| import androidx.core.view.ViewCompat; | ||||
| import androidx.core.view.accessibility.AccessibilityManagerCompat; | ||||
| import androidx.core.widget.TextViewCompat; | ||||
| import androidx.customview.view.AbsSavedState; | ||||
| import com.google.android.material.R; | ||||
| import com.google.android.material.appbar.AppBarLayout; | ||||
| import com.google.android.material.color.MaterialColors; | ||||
| import com.google.android.material.internal.ToolbarUtils; | ||||
| import com.google.android.material.shape.MaterialShapeDrawable; | ||||
| import com.google.android.material.shape.MaterialShapeUtils; | ||||
| import com.google.android.material.shape.ShapeAppearanceModel; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class SearchBar extends Toolbar { | ||||
|     private static final int DEFAULT_SCROLL_FLAGS = 53; | ||||
|     private static final int DEF_STYLE_RES = R.style.Widget_Material3_SearchBar; | ||||
|     private static final String NAMESPACE_APP = "http://schemas.android.com/apk/res-auto"; | ||||
|     private final AccessibilityManager accessibilityManager; | ||||
|     private MaterialShapeDrawable backgroundShape; | ||||
|     private View centerView; | ||||
|     private final boolean defaultMarginsEnabled; | ||||
|     private final Drawable defaultNavigationIcon; | ||||
|     private boolean defaultScrollFlagsEnabled; | ||||
|     private final boolean forceDefaultNavigationOnClickListener; | ||||
|     private final boolean layoutInflated; | ||||
|     private int menuResId; | ||||
|     private Integer navigationIconTint; | ||||
|     private Drawable originalNavigationIconBackground; | ||||
|     private final SearchBarAnimationHelper searchBarAnimationHelper; | ||||
|     private final TextView textView; | ||||
|     private final boolean tintNavigationIcon; | ||||
|     private final AccessibilityManagerCompat.TouchExplorationStateChangeListener touchExplorationStateChangeListener; | ||||
|  | ||||
|     public static abstract class OnLoadAnimationCallback { | ||||
|         public void onAnimationEnd() { | ||||
|         } | ||||
|  | ||||
|         public void onAnimationStart() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private int defaultIfZero(int i, int i2) { | ||||
|         return i == 0 ? i2 : i; | ||||
|     } | ||||
|  | ||||
|     public View getCenterView() { | ||||
|         return this.centerView; | ||||
|     } | ||||
|  | ||||
|     int getMenuResId() { | ||||
|         return this.menuResId; | ||||
|     } | ||||
|  | ||||
|     public TextView getTextView() { | ||||
|         return this.textView; | ||||
|     } | ||||
|  | ||||
|     public boolean isDefaultScrollFlagsEnabled() { | ||||
|         return this.defaultScrollFlagsEnabled; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.widget.Toolbar | ||||
|     public void setSubtitle(CharSequence charSequence) { | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.widget.Toolbar | ||||
|     public void setTitle(CharSequence charSequence) { | ||||
|     } | ||||
|  | ||||
|     /* renamed from: lambda$new$0$com-google-android-material-search-SearchBar, reason: not valid java name */ | ||||
|     /* synthetic */ void m246lambda$new$0$comgoogleandroidmaterialsearchSearchBar(boolean z) { | ||||
|         setFocusableInTouchMode(z); | ||||
|     } | ||||
|  | ||||
|     public SearchBar(Context context) { | ||||
|         this(context, null); | ||||
|     } | ||||
|  | ||||
|     public SearchBar(Context context, AttributeSet attributeSet) { | ||||
|         this(context, attributeSet, R.attr.materialSearchBarStyle); | ||||
|     } | ||||
|  | ||||
|     /* JADX WARN: Illegal instructions before constructor call */ | ||||
|     /* | ||||
|         Code decompiled incorrectly, please refer to instructions dump. | ||||
|         To view partially-correct add '--show-bad-code' argument | ||||
|     */ | ||||
|     public SearchBar(android.content.Context r11, android.util.AttributeSet r12, int r13) { | ||||
|         /* | ||||
|             r10 = this; | ||||
|             int r6 = com.google.android.material.search.SearchBar.DEF_STYLE_RES | ||||
|             android.content.Context r11 = com.google.android.material.theme.overlay.MaterialThemeOverlay.wrap(r11, r12, r13, r6) | ||||
|             r10.<init>(r11, r12, r13) | ||||
|             r11 = -1 | ||||
|             r10.menuResId = r11 | ||||
|             com.google.android.material.search.SearchBar$$ExternalSyntheticLambda0 r0 = new com.google.android.material.search.SearchBar$$ExternalSyntheticLambda0 | ||||
|             r0.<init>() | ||||
|             r10.touchExplorationStateChangeListener = r0 | ||||
|             android.content.Context r7 = r10.getContext() | ||||
|             r10.validateAttributes(r12) | ||||
|             int r0 = r10.getDefaultNavigationIconResource() | ||||
|             android.graphics.drawable.Drawable r0 = androidx.appcompat.content.res.AppCompatResources.getDrawable(r7, r0) | ||||
|             r10.defaultNavigationIcon = r0 | ||||
|             com.google.android.material.search.SearchBarAnimationHelper r0 = new com.google.android.material.search.SearchBarAnimationHelper | ||||
|             r0.<init>() | ||||
|             r10.searchBarAnimationHelper = r0 | ||||
|             int[] r2 = com.google.android.material.R.styleable.SearchBar | ||||
|             r8 = 0 | ||||
|             int[] r5 = new int[r8] | ||||
|             r0 = r7 | ||||
|             r1 = r12 | ||||
|             r3 = r13 | ||||
|             r4 = r6 | ||||
|             android.content.res.TypedArray r0 = com.google.android.material.internal.ThemeEnforcement.obtainStyledAttributes(r0, r1, r2, r3, r4, r5) | ||||
|             com.google.android.material.shape.ShapeAppearanceModel$Builder r12 = com.google.android.material.shape.ShapeAppearanceModel.builder(r7, r12, r13, r6) | ||||
|             com.google.android.material.shape.ShapeAppearanceModel r2 = r12.build() | ||||
|             int r12 = com.google.android.material.R.styleable.SearchBar_backgroundTint | ||||
|             int r3 = r0.getColor(r12, r8) | ||||
|             int r12 = com.google.android.material.R.styleable.SearchBar_elevation | ||||
|             r13 = 0 | ||||
|             float r4 = r0.getDimension(r12, r13) | ||||
|             int r12 = com.google.android.material.R.styleable.SearchBar_defaultMarginsEnabled | ||||
|             r13 = 1 | ||||
|             boolean r12 = r0.getBoolean(r12, r13) | ||||
|             r10.defaultMarginsEnabled = r12 | ||||
|             int r12 = com.google.android.material.R.styleable.SearchBar_defaultScrollFlagsEnabled | ||||
|             boolean r12 = r0.getBoolean(r12, r13) | ||||
|             r10.defaultScrollFlagsEnabled = r12 | ||||
|             int r12 = com.google.android.material.R.styleable.SearchBar_hideNavigationIcon | ||||
|             boolean r12 = r0.getBoolean(r12, r8) | ||||
|             int r1 = com.google.android.material.R.styleable.SearchBar_forceDefaultNavigationOnClickListener | ||||
|             boolean r1 = r0.getBoolean(r1, r8) | ||||
|             r10.forceDefaultNavigationOnClickListener = r1 | ||||
|             int r1 = com.google.android.material.R.styleable.SearchBar_tintNavigationIcon | ||||
|             boolean r1 = r0.getBoolean(r1, r13) | ||||
|             r10.tintNavigationIcon = r1 | ||||
|             int r1 = com.google.android.material.R.styleable.SearchBar_navigationIconTint | ||||
|             boolean r1 = r0.hasValue(r1) | ||||
|             if (r1 == 0) goto L88 | ||||
|             int r1 = com.google.android.material.R.styleable.SearchBar_navigationIconTint | ||||
|             int r1 = r0.getColor(r1, r11) | ||||
|             java.lang.Integer r1 = java.lang.Integer.valueOf(r1) | ||||
|             r10.navigationIconTint = r1 | ||||
|         L88: | ||||
|             int r1 = com.google.android.material.R.styleable.SearchBar_android_textAppearance | ||||
|             int r11 = r0.getResourceId(r1, r11) | ||||
|             int r1 = com.google.android.material.R.styleable.SearchBar_android_text | ||||
|             java.lang.String r1 = r0.getString(r1) | ||||
|             int r5 = com.google.android.material.R.styleable.SearchBar_android_hint | ||||
|             java.lang.String r5 = r0.getString(r5) | ||||
|             int r6 = com.google.android.material.R.styleable.SearchBar_strokeWidth | ||||
|             r9 = -1082130432(0xffffffffbf800000, float:-1.0) | ||||
|             float r6 = r0.getDimension(r6, r9) | ||||
|             int r9 = com.google.android.material.R.styleable.SearchBar_strokeColor | ||||
|             int r8 = r0.getColor(r9, r8) | ||||
|             r0.recycle() | ||||
|             if (r12 != 0) goto Lb0 | ||||
|             r10.initNavigationIcon() | ||||
|         Lb0: | ||||
|             r10.setClickable(r13) | ||||
|             r10.setFocusable(r13) | ||||
|             android.view.LayoutInflater r12 = android.view.LayoutInflater.from(r7) | ||||
|             int r0 = com.google.android.material.R.layout.mtrl_search_bar | ||||
|             r12.inflate(r0, r10) | ||||
|             r10.layoutInflated = r13 | ||||
|             int r12 = com.google.android.material.R.id.open_search_bar_text_view | ||||
|             android.view.View r12 = r10.findViewById(r12) | ||||
|             android.widget.TextView r12 = (android.widget.TextView) r12 | ||||
|             r10.textView = r12 | ||||
|             androidx.core.view.ViewCompat.setElevation(r10, r4) | ||||
|             r10.initTextView(r11, r1, r5) | ||||
|             r1 = r10 | ||||
|             r5 = r6 | ||||
|             r6 = r8 | ||||
|             r1.initBackground(r2, r3, r4, r5, r6) | ||||
|             android.content.Context r11 = r10.getContext() | ||||
|             java.lang.String r12 = "accessibility" | ||||
|             java.lang.Object r11 = r11.getSystemService(r12) | ||||
|             android.view.accessibility.AccessibilityManager r11 = (android.view.accessibility.AccessibilityManager) r11 | ||||
|             r10.accessibilityManager = r11 | ||||
|             r10.setupTouchExplorationStateChangeListener() | ||||
|             return | ||||
|         */ | ||||
|         throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.search.SearchBar.<init>(android.content.Context, android.util.AttributeSet, int):void"); | ||||
|     } | ||||
|  | ||||
|     private void setupTouchExplorationStateChangeListener() { | ||||
|         AccessibilityManager accessibilityManager = this.accessibilityManager; | ||||
|         if (accessibilityManager != null) { | ||||
|             if (accessibilityManager.isEnabled() && this.accessibilityManager.isTouchExplorationEnabled()) { | ||||
|                 setFocusableInTouchMode(true); | ||||
|             } | ||||
|             addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() { // from class: com.google.android.material.search.SearchBar.1 | ||||
|                 @Override // android.view.View.OnAttachStateChangeListener | ||||
|                 public void onViewAttachedToWindow(View view) { | ||||
|                     AccessibilityManagerCompat.addTouchExplorationStateChangeListener(SearchBar.this.accessibilityManager, SearchBar.this.touchExplorationStateChangeListener); | ||||
|                 } | ||||
|  | ||||
|                 @Override // android.view.View.OnAttachStateChangeListener | ||||
|                 public void onViewDetachedFromWindow(View view) { | ||||
|                     AccessibilityManagerCompat.removeTouchExplorationStateChangeListener(SearchBar.this.accessibilityManager, SearchBar.this.touchExplorationStateChangeListener); | ||||
|                 } | ||||
|             }); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void validateAttributes(AttributeSet attributeSet) { | ||||
|         if (attributeSet == null) { | ||||
|             return; | ||||
|         } | ||||
|         if (attributeSet.getAttributeValue(NAMESPACE_APP, "title") != null) { | ||||
|             throw new UnsupportedOperationException("SearchBar does not support title. Use hint or text instead."); | ||||
|         } | ||||
|         if (attributeSet.getAttributeValue(NAMESPACE_APP, "subtitle") != null) { | ||||
|             throw new UnsupportedOperationException("SearchBar does not support subtitle. Use hint or text instead."); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void initNavigationIcon() { | ||||
|         setNavigationIcon(getNavigationIcon() == null ? this.defaultNavigationIcon : getNavigationIcon()); | ||||
|         setNavigationIconDecorative(true); | ||||
|     } | ||||
|  | ||||
|     private void initTextView(int i, String str, String str2) { | ||||
|         if (i != -1) { | ||||
|             TextViewCompat.setTextAppearance(this.textView, i); | ||||
|         } | ||||
|         setText(str); | ||||
|         setHint(str2); | ||||
|         if (getNavigationIcon() == null) { | ||||
|             MarginLayoutParamsCompat.setMarginStart((ViewGroup.MarginLayoutParams) this.textView.getLayoutParams(), getResources().getDimensionPixelSize(R.dimen.m3_searchbar_text_margin_start_no_navigation_icon)); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void initBackground(ShapeAppearanceModel shapeAppearanceModel, int i, float f, float f2, int i2) { | ||||
|         MaterialShapeDrawable materialShapeDrawable = new MaterialShapeDrawable(shapeAppearanceModel); | ||||
|         this.backgroundShape = materialShapeDrawable; | ||||
|         materialShapeDrawable.initializeElevationOverlay(getContext()); | ||||
|         this.backgroundShape.setElevation(f); | ||||
|         if (f2 >= 0.0f) { | ||||
|             this.backgroundShape.setStroke(f2, i2); | ||||
|         } | ||||
|         int color = MaterialColors.getColor(this, R.attr.colorControlHighlight); | ||||
|         this.backgroundShape.setFillColor(ColorStateList.valueOf(i)); | ||||
|         ColorStateList valueOf = ColorStateList.valueOf(color); | ||||
|         MaterialShapeDrawable materialShapeDrawable2 = this.backgroundShape; | ||||
|         ViewCompat.setBackground(this, new RippleDrawable(valueOf, materialShapeDrawable2, materialShapeDrawable2)); | ||||
|     } | ||||
|  | ||||
|     private ColorStateList getCompatBackgroundColorStateList(int i, int i2) { | ||||
|         int[][] iArr = {new int[]{android.R.attr.state_pressed}, new int[]{android.R.attr.state_focused}, new int[0]}; | ||||
|         int layer = MaterialColors.layer(i, i2); | ||||
|         return new ColorStateList(iArr, new int[]{layer, layer, i}); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.ViewGroup | ||||
|     public void addView(View view, int i, ViewGroup.LayoutParams layoutParams) { | ||||
|         if (this.layoutInflated && this.centerView == null && !(view instanceof ActionMenuView)) { | ||||
|             this.centerView = view; | ||||
|             view.setAlpha(0.0f); | ||||
|         } | ||||
|         super.addView(view, i, layoutParams); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public void setElevation(float f) { | ||||
|         super.setElevation(f); | ||||
|         MaterialShapeDrawable materialShapeDrawable = this.backgroundShape; | ||||
|         if (materialShapeDrawable != null) { | ||||
|             materialShapeDrawable.setElevation(f); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) { | ||||
|         super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo); | ||||
|         accessibilityNodeInfo.setClassName(EditText.class.getCanonicalName()); | ||||
|         accessibilityNodeInfo.setEditable(isEnabled()); | ||||
|         CharSequence text = getText(); | ||||
|         boolean isEmpty = TextUtils.isEmpty(text); | ||||
|         if (Build.VERSION.SDK_INT >= 26) { | ||||
|             accessibilityNodeInfo.setHintText(getHint()); | ||||
|             accessibilityNodeInfo.setShowingHintText(isEmpty); | ||||
|         } | ||||
|         if (isEmpty) { | ||||
|             text = getHint(); | ||||
|         } | ||||
|         accessibilityNodeInfo.setText(text); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.widget.Toolbar | ||||
|     public void setNavigationOnClickListener(View.OnClickListener onClickListener) { | ||||
|         if (this.forceDefaultNavigationOnClickListener) { | ||||
|             return; | ||||
|         } | ||||
|         super.setNavigationOnClickListener(onClickListener); | ||||
|         setNavigationIconDecorative(onClickListener == null); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.widget.Toolbar | ||||
|     public void setNavigationIcon(Drawable drawable) { | ||||
|         super.setNavigationIcon(maybeTintNavigationIcon(drawable)); | ||||
|     } | ||||
|  | ||||
|     private Drawable maybeTintNavigationIcon(Drawable drawable) { | ||||
|         int i; | ||||
|         int color; | ||||
|         if (!this.tintNavigationIcon || drawable == null) { | ||||
|             return drawable; | ||||
|         } | ||||
|         Integer num = this.navigationIconTint; | ||||
|         if (num != null) { | ||||
|             color = num.intValue(); | ||||
|         } else { | ||||
|             if (drawable == this.defaultNavigationIcon) { | ||||
|                 i = R.attr.colorOnSurfaceVariant; | ||||
|             } else { | ||||
|                 i = R.attr.colorOnSurface; | ||||
|             } | ||||
|             color = MaterialColors.getColor(this, i); | ||||
|         } | ||||
|         Drawable wrap = DrawableCompat.wrap(drawable.mutate()); | ||||
|         DrawableCompat.setTint(wrap, color); | ||||
|         return wrap; | ||||
|     } | ||||
|  | ||||
|     private void setNavigationIconDecorative(boolean z) { | ||||
|         ImageButton navigationIconButton = ToolbarUtils.getNavigationIconButton(this); | ||||
|         if (navigationIconButton == null) { | ||||
|             return; | ||||
|         } | ||||
|         navigationIconButton.setClickable(!z); | ||||
|         navigationIconButton.setFocusable(!z); | ||||
|         Drawable background = navigationIconButton.getBackground(); | ||||
|         if (background != null) { | ||||
|             this.originalNavigationIconBackground = background; | ||||
|         } | ||||
|         navigationIconButton.setBackgroundDrawable(z ? null : this.originalNavigationIconBackground); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.widget.Toolbar | ||||
|     public void inflateMenu(int i) { | ||||
|         Menu menu = getMenu(); | ||||
|         boolean z = menu instanceof MenuBuilder; | ||||
|         if (z) { | ||||
|             ((MenuBuilder) menu).stopDispatchingItemsChanged(); | ||||
|         } | ||||
|         super.inflateMenu(i); | ||||
|         this.menuResId = i; | ||||
|         if (z) { | ||||
|             ((MenuBuilder) menu).startDispatchingItemsChanged(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.widget.Toolbar, android.view.View | ||||
|     protected void onMeasure(int i, int i2) { | ||||
|         super.onMeasure(i, i2); | ||||
|         measureCenterView(i, i2); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.widget.Toolbar, android.view.ViewGroup, android.view.View | ||||
|     protected void onLayout(boolean z, int i, int i2, int i3, int i4) { | ||||
|         super.onLayout(z, i, i2, i3, i4); | ||||
|         layoutCenterView(); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.widget.Toolbar, android.view.ViewGroup, android.view.View | ||||
|     protected void onAttachedToWindow() { | ||||
|         super.onAttachedToWindow(); | ||||
|         MaterialShapeUtils.setParentAbsoluteElevation(this, this.backgroundShape); | ||||
|         setDefaultMargins(); | ||||
|         setOrClearDefaultScrollFlags(); | ||||
|     } | ||||
|  | ||||
|     private void setDefaultMargins() { | ||||
|         if (this.defaultMarginsEnabled && (getLayoutParams() instanceof ViewGroup.MarginLayoutParams)) { | ||||
|             Resources resources = getResources(); | ||||
|             int dimensionPixelSize = resources.getDimensionPixelSize(R.dimen.m3_searchbar_margin_horizontal); | ||||
|             int dimensionPixelSize2 = resources.getDimensionPixelSize(getDefaultMarginVerticalResource()); | ||||
|             ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) getLayoutParams(); | ||||
|             marginLayoutParams.leftMargin = defaultIfZero(marginLayoutParams.leftMargin, dimensionPixelSize); | ||||
|             marginLayoutParams.topMargin = defaultIfZero(marginLayoutParams.topMargin, dimensionPixelSize2); | ||||
|             marginLayoutParams.rightMargin = defaultIfZero(marginLayoutParams.rightMargin, dimensionPixelSize); | ||||
|             marginLayoutParams.bottomMargin = defaultIfZero(marginLayoutParams.bottomMargin, dimensionPixelSize2); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     protected int getDefaultMarginVerticalResource() { | ||||
|         return R.dimen.m3_searchbar_margin_vertical; | ||||
|     } | ||||
|  | ||||
|     protected int getDefaultNavigationIconResource() { | ||||
|         return R.drawable.ic_search_black_24; | ||||
|     } | ||||
|  | ||||
|     private void setOrClearDefaultScrollFlags() { | ||||
|         if (getLayoutParams() instanceof AppBarLayout.LayoutParams) { | ||||
|             AppBarLayout.LayoutParams layoutParams = (AppBarLayout.LayoutParams) getLayoutParams(); | ||||
|             if (this.defaultScrollFlagsEnabled) { | ||||
|                 if (layoutParams.getScrollFlags() == 0) { | ||||
|                     layoutParams.setScrollFlags(53); | ||||
|                 } | ||||
|             } else if (layoutParams.getScrollFlags() == 53) { | ||||
|                 layoutParams.setScrollFlags(0); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void measureCenterView(int i, int i2) { | ||||
|         View view = this.centerView; | ||||
|         if (view != null) { | ||||
|             view.measure(i, i2); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void layoutCenterView() { | ||||
|         View view = this.centerView; | ||||
|         if (view == null) { | ||||
|             return; | ||||
|         } | ||||
|         int measuredWidth = view.getMeasuredWidth(); | ||||
|         int measuredWidth2 = (getMeasuredWidth() / 2) - (measuredWidth / 2); | ||||
|         int i = measuredWidth2 + measuredWidth; | ||||
|         int measuredHeight = this.centerView.getMeasuredHeight(); | ||||
|         int measuredHeight2 = (getMeasuredHeight() / 2) - (measuredHeight / 2); | ||||
|         layoutChild(this.centerView, measuredWidth2, measuredHeight2, i, measuredHeight2 + measuredHeight); | ||||
|     } | ||||
|  | ||||
|     private void layoutChild(View view, int i, int i2, int i3, int i4) { | ||||
|         if (ViewCompat.getLayoutDirection(this) == 1) { | ||||
|             view.layout(getMeasuredWidth() - i3, i2, getMeasuredWidth() - i, i4); | ||||
|         } else { | ||||
|             view.layout(i, i2, i3, i4); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setCenterView(View view) { | ||||
|         View view2 = this.centerView; | ||||
|         if (view2 != null) { | ||||
|             removeView(view2); | ||||
|             this.centerView = null; | ||||
|         } | ||||
|         if (view != null) { | ||||
|             addView(view); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public CharSequence getText() { | ||||
|         return this.textView.getText(); | ||||
|     } | ||||
|  | ||||
|     public void setText(CharSequence charSequence) { | ||||
|         this.textView.setText(charSequence); | ||||
|     } | ||||
|  | ||||
|     public void setText(int i) { | ||||
|         this.textView.setText(i); | ||||
|     } | ||||
|  | ||||
|     public void clearText() { | ||||
|         this.textView.setText(""); | ||||
|     } | ||||
|  | ||||
|     public CharSequence getHint() { | ||||
|         return this.textView.getHint(); | ||||
|     } | ||||
|  | ||||
|     public void setHint(CharSequence charSequence) { | ||||
|         this.textView.setHint(charSequence); | ||||
|     } | ||||
|  | ||||
|     public void setHint(int i) { | ||||
|         this.textView.setHint(i); | ||||
|     } | ||||
|  | ||||
|     public int getStrokeColor() { | ||||
|         return this.backgroundShape.getStrokeColor().getDefaultColor(); | ||||
|     } | ||||
|  | ||||
|     public void setStrokeColor(int i) { | ||||
|         if (getStrokeColor() != i) { | ||||
|             this.backgroundShape.setStrokeColor(ColorStateList.valueOf(i)); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public float getStrokeWidth() { | ||||
|         return this.backgroundShape.getStrokeWidth(); | ||||
|     } | ||||
|  | ||||
|     public void setStrokeWidth(float f) { | ||||
|         if (getStrokeWidth() != f) { | ||||
|             this.backgroundShape.setStrokeWidth(f); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public float getCornerSize() { | ||||
|         return this.backgroundShape.getTopLeftCornerResolvedSize(); | ||||
|     } | ||||
|  | ||||
|     public void setDefaultScrollFlagsEnabled(boolean z) { | ||||
|         this.defaultScrollFlagsEnabled = z; | ||||
|         setOrClearDefaultScrollFlags(); | ||||
|     } | ||||
|  | ||||
|     /* renamed from: lambda$startOnLoadAnimation$1$com-google-android-material-search-SearchBar, reason: not valid java name */ | ||||
|     /* synthetic */ void m247x58362b63() { | ||||
|         this.searchBarAnimationHelper.startOnLoadAnimation(this); | ||||
|     } | ||||
|  | ||||
|     public void startOnLoadAnimation() { | ||||
|         post(new Runnable() { // from class: com.google.android.material.search.SearchBar$$ExternalSyntheticLambda1 | ||||
|             @Override // java.lang.Runnable | ||||
|             public final void run() { | ||||
|                 SearchBar.this.m247x58362b63(); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     public void stopOnLoadAnimation() { | ||||
|         this.searchBarAnimationHelper.stopOnLoadAnimation(this); | ||||
|     } | ||||
|  | ||||
|     public boolean isOnLoadAnimationFadeInEnabled() { | ||||
|         return this.searchBarAnimationHelper.isOnLoadAnimationFadeInEnabled(); | ||||
|     } | ||||
|  | ||||
|     public void setOnLoadAnimationFadeInEnabled(boolean z) { | ||||
|         this.searchBarAnimationHelper.setOnLoadAnimationFadeInEnabled(z); | ||||
|     } | ||||
|  | ||||
|     public void addOnLoadAnimationCallback(OnLoadAnimationCallback onLoadAnimationCallback) { | ||||
|         this.searchBarAnimationHelper.addOnLoadAnimationCallback(onLoadAnimationCallback); | ||||
|     } | ||||
|  | ||||
|     public boolean removeOnLoadAnimationCallback(OnLoadAnimationCallback onLoadAnimationCallback) { | ||||
|         return this.searchBarAnimationHelper.removeOnLoadAnimationCallback(onLoadAnimationCallback); | ||||
|     } | ||||
|  | ||||
|     public boolean isExpanding() { | ||||
|         return this.searchBarAnimationHelper.isExpanding(); | ||||
|     } | ||||
|  | ||||
|     public boolean expand(View view) { | ||||
|         return expand(view, null); | ||||
|     } | ||||
|  | ||||
|     public boolean expand(View view, AppBarLayout appBarLayout) { | ||||
|         return expand(view, appBarLayout, false); | ||||
|     } | ||||
|  | ||||
|     public boolean expand(View view, AppBarLayout appBarLayout, boolean z) { | ||||
|         if ((view.getVisibility() == 0 || isExpanding()) && !isCollapsing()) { | ||||
|             return false; | ||||
|         } | ||||
|         this.searchBarAnimationHelper.startExpandAnimation(this, view, appBarLayout, z); | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     public void addExpandAnimationListener(AnimatorListenerAdapter animatorListenerAdapter) { | ||||
|         this.searchBarAnimationHelper.addExpandAnimationListener(animatorListenerAdapter); | ||||
|     } | ||||
|  | ||||
|     public boolean removeExpandAnimationListener(AnimatorListenerAdapter animatorListenerAdapter) { | ||||
|         return this.searchBarAnimationHelper.removeExpandAnimationListener(animatorListenerAdapter); | ||||
|     } | ||||
|  | ||||
|     public boolean isCollapsing() { | ||||
|         return this.searchBarAnimationHelper.isCollapsing(); | ||||
|     } | ||||
|  | ||||
|     public boolean collapse(View view) { | ||||
|         return collapse(view, null); | ||||
|     } | ||||
|  | ||||
|     public boolean collapse(View view, AppBarLayout appBarLayout) { | ||||
|         return collapse(view, appBarLayout, false); | ||||
|     } | ||||
|  | ||||
|     public boolean collapse(View view, AppBarLayout appBarLayout, boolean z) { | ||||
|         if ((view.getVisibility() != 0 || isCollapsing()) && !isExpanding()) { | ||||
|             return false; | ||||
|         } | ||||
|         this.searchBarAnimationHelper.startCollapseAnimation(this, view, appBarLayout, z); | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     public void addCollapseAnimationListener(AnimatorListenerAdapter animatorListenerAdapter) { | ||||
|         this.searchBarAnimationHelper.addCollapseAnimationListener(animatorListenerAdapter); | ||||
|     } | ||||
|  | ||||
|     public boolean removeCollapseAnimationListener(AnimatorListenerAdapter animatorListenerAdapter) { | ||||
|         return this.searchBarAnimationHelper.removeCollapseAnimationListener(animatorListenerAdapter); | ||||
|     } | ||||
|  | ||||
|     float getCompatElevation() { | ||||
|         MaterialShapeDrawable materialShapeDrawable = this.backgroundShape; | ||||
|         return materialShapeDrawable != null ? materialShapeDrawable.getElevation() : ViewCompat.getElevation(this); | ||||
|     } | ||||
|  | ||||
|     public static class ScrollingViewBehavior extends AppBarLayout.ScrollingViewBehavior { | ||||
|         private boolean initialized; | ||||
|  | ||||
|         @Override // com.google.android.material.appbar.HeaderScrollingViewBehavior | ||||
|         protected boolean shouldHeaderOverlapScrollingChild() { | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         public ScrollingViewBehavior() { | ||||
|             this.initialized = false; | ||||
|         } | ||||
|  | ||||
|         public ScrollingViewBehavior(Context context, AttributeSet attributeSet) { | ||||
|             super(context, attributeSet); | ||||
|             this.initialized = false; | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.appbar.AppBarLayout.ScrollingViewBehavior, androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior | ||||
|         public boolean onDependentViewChanged(CoordinatorLayout coordinatorLayout, View view, View view2) { | ||||
|             boolean onDependentViewChanged = super.onDependentViewChanged(coordinatorLayout, view, view2); | ||||
|             if (!this.initialized && (view2 instanceof AppBarLayout)) { | ||||
|                 this.initialized = true; | ||||
|                 setAppBarLayoutTransparent((AppBarLayout) view2); | ||||
|             } | ||||
|             return onDependentViewChanged; | ||||
|         } | ||||
|  | ||||
|         private void setAppBarLayoutTransparent(AppBarLayout appBarLayout) { | ||||
|             appBarLayout.setBackgroundColor(0); | ||||
|             if (Build.VERSION.SDK_INT == 21) { | ||||
|                 appBarLayout.setOutlineProvider(null); | ||||
|             } else { | ||||
|                 appBarLayout.setTargetElevation(0.0f); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.widget.Toolbar, android.view.View | ||||
|     protected Parcelable onSaveInstanceState() { | ||||
|         SavedState savedState = new SavedState(super.onSaveInstanceState()); | ||||
|         CharSequence text = getText(); | ||||
|         savedState.text = text == null ? null : text.toString(); | ||||
|         return savedState; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.widget.Toolbar, android.view.View | ||||
|     protected void onRestoreInstanceState(Parcelable parcelable) { | ||||
|         if (!(parcelable instanceof SavedState)) { | ||||
|             super.onRestoreInstanceState(parcelable); | ||||
|             return; | ||||
|         } | ||||
|         SavedState savedState = (SavedState) parcelable; | ||||
|         super.onRestoreInstanceState(savedState.getSuperState()); | ||||
|         setText(savedState.text); | ||||
|     } | ||||
|  | ||||
|     static class SavedState extends AbsSavedState { | ||||
|         public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.ClassLoaderCreator<SavedState>() { // from class: com.google.android.material.search.SearchBar.SavedState.1 | ||||
|             /* JADX WARN: Can't rename method to resolve collision */ | ||||
|             @Override // android.os.Parcelable.ClassLoaderCreator | ||||
|             public SavedState createFromParcel(Parcel parcel, ClassLoader classLoader) { | ||||
|                 return new SavedState(parcel, classLoader); | ||||
|             } | ||||
|  | ||||
|             @Override // android.os.Parcelable.Creator | ||||
|             public SavedState createFromParcel(Parcel parcel) { | ||||
|                 return new SavedState(parcel); | ||||
|             } | ||||
|  | ||||
|             @Override // android.os.Parcelable.Creator | ||||
|             public SavedState[] newArray(int i) { | ||||
|                 return new SavedState[i]; | ||||
|             } | ||||
|         }; | ||||
|         String text; | ||||
|  | ||||
|         public SavedState(Parcel parcel) { | ||||
|             this(parcel, null); | ||||
|         } | ||||
|  | ||||
|         public SavedState(Parcel parcel, ClassLoader classLoader) { | ||||
|             super(parcel, classLoader); | ||||
|             this.text = parcel.readString(); | ||||
|         } | ||||
|  | ||||
|         public SavedState(Parcelable parcelable) { | ||||
|             super(parcelable); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.customview.view.AbsSavedState, android.os.Parcelable | ||||
|         public void writeToParcel(Parcel parcel, int i) { | ||||
|             super.writeToParcel(parcel, i); | ||||
|             parcel.writeString(this.text); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,380 @@ | ||||
| package com.google.android.material.search; | ||||
|  | ||||
| import android.animation.Animator; | ||||
| import android.animation.AnimatorListenerAdapter; | ||||
| import android.animation.AnimatorSet; | ||||
| import android.animation.ValueAnimator; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import android.widget.TextView; | ||||
| import androidx.appcompat.widget.ActionMenuView; | ||||
| import androidx.core.view.ViewCompat; | ||||
| import com.google.android.material.animation.AnimatableView; | ||||
| import com.google.android.material.animation.AnimationUtils; | ||||
| import com.google.android.material.appbar.AppBarLayout; | ||||
| import com.google.android.material.internal.ExpandCollapseAnimationHelper; | ||||
| import com.google.android.material.internal.MultiViewUpdateListener; | ||||
| import com.google.android.material.internal.ToolbarUtils; | ||||
| import com.google.android.material.internal.ViewUtils; | ||||
| import com.google.android.material.search.SearchBar; | ||||
| import com.google.android.material.shape.MaterialShapeDrawable; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Iterator; | ||||
| import java.util.LinkedHashSet; | ||||
| import java.util.List; | ||||
| import java.util.Objects; | ||||
| import java.util.Set; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| class SearchBarAnimationHelper { | ||||
|     private static final long COLLAPSE_DURATION_MS = 250; | ||||
|     private static final long COLLAPSE_FADE_IN_CHILDREN_DURATION_MS = 100; | ||||
|     private static final long EXPAND_DURATION_MS = 300; | ||||
|     private static final long EXPAND_FADE_OUT_CHILDREN_DURATION_MS = 75; | ||||
|     private static final long ON_LOAD_ANIM_CENTER_VIEW_DEFAULT_FADE_DURATION_MS = 250; | ||||
|     private static final long ON_LOAD_ANIM_CENTER_VIEW_DEFAULT_FADE_IN_START_DELAY_MS = 500; | ||||
|     private static final long ON_LOAD_ANIM_CENTER_VIEW_DEFAULT_FADE_OUT_START_DELAY_MS = 750; | ||||
|     private static final long ON_LOAD_ANIM_SECONDARY_DURATION_MS = 250; | ||||
|     private static final long ON_LOAD_ANIM_SECONDARY_START_DELAY_MS = 250; | ||||
|     private boolean collapsing; | ||||
|     private Animator defaultCenterViewAnimator; | ||||
|     private boolean expanding; | ||||
|     private Animator secondaryViewAnimator; | ||||
|     private final Set<SearchBar.OnLoadAnimationCallback> onLoadAnimationCallbacks = new LinkedHashSet(); | ||||
|     private final Set<AnimatorListenerAdapter> expandAnimationListeners = new LinkedHashSet(); | ||||
|     private final Set<AnimatorListenerAdapter> collapseAnimationListeners = new LinkedHashSet(); | ||||
|     private boolean onLoadAnimationFadeInEnabled = true; | ||||
|     private Animator runningExpandOrCollapseAnimator = null; | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     interface OnLoadAnimationInvocation { | ||||
|         void invoke(SearchBar.OnLoadAnimationCallback onLoadAnimationCallback); | ||||
|     } | ||||
|  | ||||
|     boolean isCollapsing() { | ||||
|         return this.collapsing; | ||||
|     } | ||||
|  | ||||
|     boolean isExpanding() { | ||||
|         return this.expanding; | ||||
|     } | ||||
|  | ||||
|     boolean isOnLoadAnimationFadeInEnabled() { | ||||
|         return this.onLoadAnimationFadeInEnabled; | ||||
|     } | ||||
|  | ||||
|     void setOnLoadAnimationFadeInEnabled(boolean z) { | ||||
|         this.onLoadAnimationFadeInEnabled = z; | ||||
|     } | ||||
|  | ||||
|     SearchBarAnimationHelper() { | ||||
|     } | ||||
|  | ||||
|     /* JADX WARN: Multi-variable type inference failed */ | ||||
|     void startOnLoadAnimation(SearchBar searchBar) { | ||||
|         dispatchOnLoadAnimation(new OnLoadAnimationInvocation() { // from class: com.google.android.material.search.SearchBarAnimationHelper$$ExternalSyntheticLambda3 | ||||
|             @Override // com.google.android.material.search.SearchBarAnimationHelper.OnLoadAnimationInvocation | ||||
|             public final void invoke(SearchBar.OnLoadAnimationCallback onLoadAnimationCallback) { | ||||
|                 onLoadAnimationCallback.onAnimationStart(); | ||||
|             } | ||||
|         }); | ||||
|         TextView textView = searchBar.getTextView(); | ||||
|         final View centerView = searchBar.getCenterView(); | ||||
|         View secondaryActionMenuItemView = ToolbarUtils.getSecondaryActionMenuItemView(searchBar); | ||||
|         final Animator secondaryViewAnimator = getSecondaryViewAnimator(textView, secondaryActionMenuItemView); | ||||
|         secondaryViewAnimator.addListener(new AnimatorListenerAdapter() { // from class: com.google.android.material.search.SearchBarAnimationHelper.1 | ||||
|             @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|             public void onAnimationEnd(Animator animator) { | ||||
|                 SearchBarAnimationHelper.this.dispatchOnLoadAnimation(new OnLoadAnimationInvocation() { // from class: com.google.android.material.search.SearchBarAnimationHelper$1$$ExternalSyntheticLambda0 | ||||
|                     @Override // com.google.android.material.search.SearchBarAnimationHelper.OnLoadAnimationInvocation | ||||
|                     public final void invoke(SearchBar.OnLoadAnimationCallback onLoadAnimationCallback) { | ||||
|                         onLoadAnimationCallback.onAnimationEnd(); | ||||
|                     } | ||||
|                 }); | ||||
|             } | ||||
|         }); | ||||
|         this.secondaryViewAnimator = secondaryViewAnimator; | ||||
|         textView.setAlpha(0.0f); | ||||
|         if (secondaryActionMenuItemView != null) { | ||||
|             secondaryActionMenuItemView.setAlpha(0.0f); | ||||
|         } | ||||
|         if (centerView instanceof AnimatableView) { | ||||
|             Objects.requireNonNull(secondaryViewAnimator); | ||||
|             ((AnimatableView) centerView).startAnimation(new AnimatableView.Listener() { // from class: com.google.android.material.search.SearchBarAnimationHelper$$ExternalSyntheticLambda4 | ||||
|                 @Override // com.google.android.material.animation.AnimatableView.Listener | ||||
|                 public final void onAnimationEnd() { | ||||
|                     secondaryViewAnimator.start(); | ||||
|                 } | ||||
|             }); | ||||
|         } else { | ||||
|             if (centerView != 0) { | ||||
|                 centerView.setAlpha(0.0f); | ||||
|                 centerView.setVisibility(0); | ||||
|                 Animator defaultCenterViewAnimator = getDefaultCenterViewAnimator(centerView); | ||||
|                 this.defaultCenterViewAnimator = defaultCenterViewAnimator; | ||||
|                 defaultCenterViewAnimator.addListener(new AnimatorListenerAdapter() { // from class: com.google.android.material.search.SearchBarAnimationHelper.2 | ||||
|                     @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|                     public void onAnimationEnd(Animator animator) { | ||||
|                         centerView.setVisibility(8); | ||||
|                         secondaryViewAnimator.start(); | ||||
|                     } | ||||
|                 }); | ||||
|                 defaultCenterViewAnimator.start(); | ||||
|                 return; | ||||
|             } | ||||
|             secondaryViewAnimator.start(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /* JADX WARN: Multi-variable type inference failed */ | ||||
|     void stopOnLoadAnimation(SearchBar searchBar) { | ||||
|         Animator animator = this.secondaryViewAnimator; | ||||
|         if (animator != null) { | ||||
|             animator.end(); | ||||
|         } | ||||
|         Animator animator2 = this.defaultCenterViewAnimator; | ||||
|         if (animator2 != null) { | ||||
|             animator2.end(); | ||||
|         } | ||||
|         View centerView = searchBar.getCenterView(); | ||||
|         if (centerView instanceof AnimatableView) { | ||||
|             ((AnimatableView) centerView).stopAnimation(); | ||||
|         } | ||||
|         if (centerView != 0) { | ||||
|             centerView.setAlpha(0.0f); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void addOnLoadAnimationCallback(SearchBar.OnLoadAnimationCallback onLoadAnimationCallback) { | ||||
|         this.onLoadAnimationCallbacks.add(onLoadAnimationCallback); | ||||
|     } | ||||
|  | ||||
|     boolean removeOnLoadAnimationCallback(SearchBar.OnLoadAnimationCallback onLoadAnimationCallback) { | ||||
|         return this.onLoadAnimationCallbacks.remove(onLoadAnimationCallback); | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     public void dispatchOnLoadAnimation(OnLoadAnimationInvocation onLoadAnimationInvocation) { | ||||
|         Iterator<SearchBar.OnLoadAnimationCallback> it = this.onLoadAnimationCallbacks.iterator(); | ||||
|         while (it.hasNext()) { | ||||
|             onLoadAnimationInvocation.invoke(it.next()); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private Animator getDefaultCenterViewAnimator(View view) { | ||||
|         ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f); | ||||
|         ofFloat.addUpdateListener(MultiViewUpdateListener.alphaListener(view)); | ||||
|         ofFloat.setInterpolator(AnimationUtils.LINEAR_INTERPOLATOR); | ||||
|         ofFloat.setDuration(this.onLoadAnimationFadeInEnabled ? 250L : 0L); | ||||
|         ofFloat.setStartDelay(this.onLoadAnimationFadeInEnabled ? ON_LOAD_ANIM_CENTER_VIEW_DEFAULT_FADE_IN_START_DELAY_MS : 0L); | ||||
|         ValueAnimator ofFloat2 = ValueAnimator.ofFloat(1.0f, 0.0f); | ||||
|         ofFloat2.addUpdateListener(MultiViewUpdateListener.alphaListener(view)); | ||||
|         ofFloat2.setInterpolator(AnimationUtils.LINEAR_INTERPOLATOR); | ||||
|         ofFloat2.setDuration(250L); | ||||
|         ofFloat2.setStartDelay(ON_LOAD_ANIM_CENTER_VIEW_DEFAULT_FADE_OUT_START_DELAY_MS); | ||||
|         AnimatorSet animatorSet = new AnimatorSet(); | ||||
|         animatorSet.playSequentially(ofFloat, ofFloat2); | ||||
|         return animatorSet; | ||||
|     } | ||||
|  | ||||
|     private Animator getSecondaryViewAnimator(TextView textView, View view) { | ||||
|         AnimatorSet animatorSet = new AnimatorSet(); | ||||
|         animatorSet.setStartDelay(250L); | ||||
|         animatorSet.play(getTextViewAnimator(textView)); | ||||
|         if (view != null) { | ||||
|             animatorSet.play(getSecondaryActionMenuItemAnimator(view)); | ||||
|         } | ||||
|         return animatorSet; | ||||
|     } | ||||
|  | ||||
|     private Animator getTextViewAnimator(TextView textView) { | ||||
|         ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f); | ||||
|         ofFloat.addUpdateListener(MultiViewUpdateListener.alphaListener(textView)); | ||||
|         ofFloat.setInterpolator(AnimationUtils.LINEAR_INTERPOLATOR); | ||||
|         ofFloat.setDuration(250L); | ||||
|         return ofFloat; | ||||
|     } | ||||
|  | ||||
|     private Animator getSecondaryActionMenuItemAnimator(View view) { | ||||
|         ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f); | ||||
|         ofFloat.addUpdateListener(MultiViewUpdateListener.alphaListener(view)); | ||||
|         ofFloat.setInterpolator(AnimationUtils.LINEAR_INTERPOLATOR); | ||||
|         ofFloat.setDuration(250L); | ||||
|         return ofFloat; | ||||
|     } | ||||
|  | ||||
|     void startExpandAnimation(final SearchBar searchBar, final View view, final AppBarLayout appBarLayout, final boolean z) { | ||||
|         Animator animator; | ||||
|         if (isCollapsing() && (animator = this.runningExpandOrCollapseAnimator) != null) { | ||||
|             animator.cancel(); | ||||
|         } | ||||
|         this.expanding = true; | ||||
|         view.setVisibility(4); | ||||
|         view.post(new Runnable() { // from class: com.google.android.material.search.SearchBarAnimationHelper$$ExternalSyntheticLambda0 | ||||
|             @Override // java.lang.Runnable | ||||
|             public final void run() { | ||||
|                 SearchBarAnimationHelper.this.m248x1b96b119(searchBar, view, appBarLayout, z); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     /* renamed from: lambda$startExpandAnimation$0$com-google-android-material-search-SearchBarAnimationHelper, reason: not valid java name */ | ||||
|     /* synthetic */ void m248x1b96b119(SearchBar searchBar, View view, AppBarLayout appBarLayout, boolean z) { | ||||
|         AnimatorSet animatorSet = new AnimatorSet(); | ||||
|         animatorSet.playSequentially(getFadeOutChildrenAnimator(searchBar, view), getExpandAnimator(searchBar, view, appBarLayout)); | ||||
|         animatorSet.addListener(new AnimatorListenerAdapter() { // from class: com.google.android.material.search.SearchBarAnimationHelper.3 | ||||
|             @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|             public void onAnimationEnd(Animator animator) { | ||||
|                 SearchBarAnimationHelper.this.runningExpandOrCollapseAnimator = null; | ||||
|             } | ||||
|         }); | ||||
|         Iterator<AnimatorListenerAdapter> it = this.expandAnimationListeners.iterator(); | ||||
|         while (it.hasNext()) { | ||||
|             animatorSet.addListener(it.next()); | ||||
|         } | ||||
|         if (z) { | ||||
|             animatorSet.setDuration(0L); | ||||
|         } | ||||
|         animatorSet.start(); | ||||
|         this.runningExpandOrCollapseAnimator = animatorSet; | ||||
|     } | ||||
|  | ||||
|     private Animator getExpandAnimator(final SearchBar searchBar, View view, AppBarLayout appBarLayout) { | ||||
|         return getExpandCollapseAnimationHelper(searchBar, view, appBarLayout).setDuration(EXPAND_DURATION_MS).addListener(new AnimatorListenerAdapter() { // from class: com.google.android.material.search.SearchBarAnimationHelper.4 | ||||
|             @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|             public void onAnimationStart(Animator animator) { | ||||
|                 searchBar.setVisibility(4); | ||||
|             } | ||||
|  | ||||
|             @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|             public void onAnimationEnd(Animator animator) { | ||||
|                 SearchBarAnimationHelper.this.expanding = false; | ||||
|             } | ||||
|         }).getExpandAnimator(); | ||||
|     } | ||||
|  | ||||
|     void addExpandAnimationListener(AnimatorListenerAdapter animatorListenerAdapter) { | ||||
|         this.expandAnimationListeners.add(animatorListenerAdapter); | ||||
|     } | ||||
|  | ||||
|     boolean removeExpandAnimationListener(AnimatorListenerAdapter animatorListenerAdapter) { | ||||
|         return this.expandAnimationListeners.remove(animatorListenerAdapter); | ||||
|     } | ||||
|  | ||||
|     void startCollapseAnimation(SearchBar searchBar, View view, AppBarLayout appBarLayout, boolean z) { | ||||
|         Animator animator; | ||||
|         if (isExpanding() && (animator = this.runningExpandOrCollapseAnimator) != null) { | ||||
|             animator.cancel(); | ||||
|         } | ||||
|         this.collapsing = true; | ||||
|         AnimatorSet animatorSet = new AnimatorSet(); | ||||
|         animatorSet.playSequentially(getCollapseAnimator(searchBar, view, appBarLayout), getFadeInChildrenAnimator(searchBar)); | ||||
|         animatorSet.addListener(new AnimatorListenerAdapter() { // from class: com.google.android.material.search.SearchBarAnimationHelper.5 | ||||
|             @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|             public void onAnimationEnd(Animator animator2) { | ||||
|                 SearchBarAnimationHelper.this.runningExpandOrCollapseAnimator = null; | ||||
|             } | ||||
|         }); | ||||
|         Iterator<AnimatorListenerAdapter> it = this.collapseAnimationListeners.iterator(); | ||||
|         while (it.hasNext()) { | ||||
|             animatorSet.addListener(it.next()); | ||||
|         } | ||||
|         if (z) { | ||||
|             animatorSet.setDuration(0L); | ||||
|         } | ||||
|         animatorSet.start(); | ||||
|         this.runningExpandOrCollapseAnimator = animatorSet; | ||||
|     } | ||||
|  | ||||
|     private Animator getCollapseAnimator(final SearchBar searchBar, View view, AppBarLayout appBarLayout) { | ||||
|         return getExpandCollapseAnimationHelper(searchBar, view, appBarLayout).setDuration(250L).addListener(new AnimatorListenerAdapter() { // from class: com.google.android.material.search.SearchBarAnimationHelper.6 | ||||
|             @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|             public void onAnimationStart(Animator animator) { | ||||
|                 searchBar.stopOnLoadAnimation(); | ||||
|             } | ||||
|  | ||||
|             @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|             public void onAnimationEnd(Animator animator) { | ||||
|                 searchBar.setVisibility(0); | ||||
|                 SearchBarAnimationHelper.this.collapsing = false; | ||||
|             } | ||||
|         }).getCollapseAnimator(); | ||||
|     } | ||||
|  | ||||
|     void addCollapseAnimationListener(AnimatorListenerAdapter animatorListenerAdapter) { | ||||
|         this.collapseAnimationListeners.add(animatorListenerAdapter); | ||||
|     } | ||||
|  | ||||
|     boolean removeCollapseAnimationListener(AnimatorListenerAdapter animatorListenerAdapter) { | ||||
|         return this.collapseAnimationListeners.remove(animatorListenerAdapter); | ||||
|     } | ||||
|  | ||||
|     private ExpandCollapseAnimationHelper getExpandCollapseAnimationHelper(SearchBar searchBar, View view, AppBarLayout appBarLayout) { | ||||
|         return new ExpandCollapseAnimationHelper(searchBar, view).setAdditionalUpdateListener(getExpandedViewBackgroundUpdateListener(searchBar, view)).setCollapsedViewOffsetY(appBarLayout != null ? appBarLayout.getTop() : 0).addEndAnchoredViews(getEndAnchoredViews(view)); | ||||
|     } | ||||
|  | ||||
|     private ValueAnimator.AnimatorUpdateListener getExpandedViewBackgroundUpdateListener(SearchBar searchBar, final View view) { | ||||
|         final MaterialShapeDrawable createWithElevationOverlay = MaterialShapeDrawable.createWithElevationOverlay(view.getContext()); | ||||
|         createWithElevationOverlay.setCornerSize(searchBar.getCornerSize()); | ||||
|         createWithElevationOverlay.setElevation(ViewCompat.getElevation(searchBar)); | ||||
|         return new ValueAnimator.AnimatorUpdateListener() { // from class: com.google.android.material.search.SearchBarAnimationHelper$$ExternalSyntheticLambda1 | ||||
|             @Override // android.animation.ValueAnimator.AnimatorUpdateListener | ||||
|             public final void onAnimationUpdate(ValueAnimator valueAnimator) { | ||||
|                 SearchBarAnimationHelper.lambda$getExpandedViewBackgroundUpdateListener$1(MaterialShapeDrawable.this, view, valueAnimator); | ||||
|             } | ||||
|         }; | ||||
|     } | ||||
|  | ||||
|     static /* synthetic */ void lambda$getExpandedViewBackgroundUpdateListener$1(MaterialShapeDrawable materialShapeDrawable, View view, ValueAnimator valueAnimator) { | ||||
|         materialShapeDrawable.setInterpolation(1.0f - valueAnimator.getAnimatedFraction()); | ||||
|         ViewCompat.setBackground(view, materialShapeDrawable); | ||||
|         view.setAlpha(1.0f); | ||||
|     } | ||||
|  | ||||
|     private Animator getFadeOutChildrenAnimator(SearchBar searchBar, final View view) { | ||||
|         List<View> fadeChildren = getFadeChildren(searchBar); | ||||
|         ValueAnimator ofFloat = ValueAnimator.ofFloat(1.0f, 0.0f); | ||||
|         ofFloat.addUpdateListener(MultiViewUpdateListener.alphaListener(fadeChildren)); | ||||
|         ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { // from class: com.google.android.material.search.SearchBarAnimationHelper$$ExternalSyntheticLambda2 | ||||
|             @Override // android.animation.ValueAnimator.AnimatorUpdateListener | ||||
|             public final void onAnimationUpdate(ValueAnimator valueAnimator) { | ||||
|                 view.setAlpha(0.0f); | ||||
|             } | ||||
|         }); | ||||
|         ofFloat.setDuration(75L); | ||||
|         ofFloat.setInterpolator(AnimationUtils.LINEAR_INTERPOLATOR); | ||||
|         return ofFloat; | ||||
|     } | ||||
|  | ||||
|     private Animator getFadeInChildrenAnimator(SearchBar searchBar) { | ||||
|         List<View> fadeChildren = getFadeChildren(searchBar); | ||||
|         ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f); | ||||
|         ofFloat.addUpdateListener(MultiViewUpdateListener.alphaListener(fadeChildren)); | ||||
|         ofFloat.setDuration(COLLAPSE_FADE_IN_CHILDREN_DURATION_MS); | ||||
|         ofFloat.setInterpolator(AnimationUtils.LINEAR_INTERPOLATOR); | ||||
|         return ofFloat; | ||||
|     } | ||||
|  | ||||
|     private List<View> getFadeChildren(SearchBar searchBar) { | ||||
|         List<View> children = ViewUtils.getChildren(searchBar); | ||||
|         if (searchBar.getCenterView() != null) { | ||||
|             children.remove(searchBar.getCenterView()); | ||||
|         } | ||||
|         return children; | ||||
|     } | ||||
|  | ||||
|     private List<View> getEndAnchoredViews(View view) { | ||||
|         boolean isLayoutRtl = ViewUtils.isLayoutRtl(view); | ||||
|         ArrayList arrayList = new ArrayList(); | ||||
|         if (view instanceof ViewGroup) { | ||||
|             ViewGroup viewGroup = (ViewGroup) view; | ||||
|             for (int i = 0; i < viewGroup.getChildCount(); i++) { | ||||
|                 View childAt = viewGroup.getChildAt(i); | ||||
|                 if ((!isLayoutRtl && (childAt instanceof ActionMenuView)) || (isLayoutRtl && !(childAt instanceof ActionMenuView))) { | ||||
|                     arrayList.add(childAt); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         return arrayList; | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,834 @@ | ||||
| package com.google.android.material.search; | ||||
|  | ||||
| import android.app.Activity; | ||||
| import android.content.Context; | ||||
| import android.graphics.drawable.Drawable; | ||||
| import android.os.Build; | ||||
| import android.os.Parcel; | ||||
| import android.os.Parcelable; | ||||
| import android.text.Editable; | ||||
| import android.text.TextUtils; | ||||
| import android.text.TextWatcher; | ||||
| import android.util.AttributeSet; | ||||
| import android.view.LayoutInflater; | ||||
| import android.view.MotionEvent; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import android.view.Window; | ||||
| import android.widget.EditText; | ||||
| import android.widget.FrameLayout; | ||||
| import android.widget.ImageButton; | ||||
| import android.widget.TextView; | ||||
| import androidx.activity.BackEventCompat; | ||||
| import androidx.appcompat.content.res.AppCompatResources; | ||||
| import androidx.appcompat.graphics.drawable.DrawerArrowDrawable; | ||||
| import androidx.appcompat.widget.Toolbar; | ||||
| import androidx.coordinatorlayout.widget.CoordinatorLayout; | ||||
| import androidx.core.graphics.drawable.DrawableCompat; | ||||
| import androidx.core.view.OnApplyWindowInsetsListener; | ||||
| import androidx.core.view.ViewCompat; | ||||
| import androidx.core.view.WindowInsetsCompat; | ||||
| import androidx.core.widget.TextViewCompat; | ||||
| import androidx.customview.view.AbsSavedState; | ||||
| import com.google.android.material.R; | ||||
| import com.google.android.material.appbar.MaterialToolbar; | ||||
| import com.google.android.material.color.MaterialColors; | ||||
| import com.google.android.material.elevation.ElevationOverlayProvider; | ||||
| import com.google.android.material.internal.ClippableRoundedCornerLayout; | ||||
| import com.google.android.material.internal.ContextUtils; | ||||
| import com.google.android.material.internal.FadeThroughDrawable; | ||||
| import com.google.android.material.internal.ToolbarUtils; | ||||
| import com.google.android.material.internal.TouchObserverFrameLayout; | ||||
| import com.google.android.material.internal.ViewUtils; | ||||
| import com.google.android.material.motion.MaterialBackHandler; | ||||
| import com.google.android.material.motion.MaterialBackOrchestrator; | ||||
| import com.google.android.material.motion.MaterialMainContainerBackHelper; | ||||
| import com.google.android.material.shape.MaterialShapeUtils; | ||||
| import java.util.HashMap; | ||||
| import java.util.Iterator; | ||||
| import java.util.LinkedHashSet; | ||||
| import java.util.Map; | ||||
| import java.util.Set; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class SearchView extends FrameLayout implements CoordinatorLayout.AttachedBehavior, MaterialBackHandler { | ||||
|     private static final int DEF_STYLE_RES = R.style.Widget_Material3_SearchView; | ||||
|     private static final long TALKBACK_FOCUS_CHANGE_DELAY_MS = 100; | ||||
|     private boolean animatedMenuItems; | ||||
|     private boolean animatedNavigationIcon; | ||||
|     private boolean autoShowKeyboard; | ||||
|     private final boolean backHandlingEnabled; | ||||
|     private final MaterialBackOrchestrator backOrchestrator; | ||||
|     private final int backgroundColor; | ||||
|     final View backgroundView; | ||||
|     private Map<View, Integer> childImportantForAccessibilityMap; | ||||
|     final ImageButton clearButton; | ||||
|     final TouchObserverFrameLayout contentContainer; | ||||
|     private TransitionState currentTransitionState; | ||||
|     final View divider; | ||||
|     final Toolbar dummyToolbar; | ||||
|     final EditText editText; | ||||
|     private final ElevationOverlayProvider elevationOverlayProvider; | ||||
|     final FrameLayout headerContainer; | ||||
|     private final boolean layoutInflated; | ||||
|     final ClippableRoundedCornerLayout rootView; | ||||
|     final View scrim; | ||||
|     private SearchBar searchBar; | ||||
|     final TextView searchPrefix; | ||||
|     private final SearchViewAnimationHelper searchViewAnimationHelper; | ||||
|     private int softInputMode; | ||||
|     final View statusBarSpacer; | ||||
|     private boolean statusBarSpacerEnabledOverride; | ||||
|     final MaterialToolbar toolbar; | ||||
|     final FrameLayout toolbarContainer; | ||||
|     private final Set<TransitionListener> transitionListeners; | ||||
|     private boolean useWindowInsetsController; | ||||
|  | ||||
|     public interface TransitionListener { | ||||
|         void onStateChanged(SearchView searchView, TransitionState transitionState, TransitionState transitionState2); | ||||
|     } | ||||
|  | ||||
|     public enum TransitionState { | ||||
|         HIDING, | ||||
|         HIDDEN, | ||||
|         SHOWING, | ||||
|         SHOWN | ||||
|     } | ||||
|  | ||||
|     static /* synthetic */ boolean lambda$setUpRootView$0(View view, MotionEvent motionEvent) { | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     public TransitionState getCurrentTransitionState() { | ||||
|         return this.currentTransitionState; | ||||
|     } | ||||
|  | ||||
|     public EditText getEditText() { | ||||
|         return this.editText; | ||||
|     } | ||||
|  | ||||
|     public TextView getSearchPrefix() { | ||||
|         return this.searchPrefix; | ||||
|     } | ||||
|  | ||||
|     public int getSoftInputMode() { | ||||
|         return this.softInputMode; | ||||
|     } | ||||
|  | ||||
|     public Toolbar getToolbar() { | ||||
|         return this.toolbar; | ||||
|     } | ||||
|  | ||||
|     boolean isAdjustNothingSoftInputMode() { | ||||
|         return this.softInputMode == 48; | ||||
|     } | ||||
|  | ||||
|     public boolean isAnimatedNavigationIcon() { | ||||
|         return this.animatedNavigationIcon; | ||||
|     } | ||||
|  | ||||
|     public boolean isAutoShowKeyboard() { | ||||
|         return this.autoShowKeyboard; | ||||
|     } | ||||
|  | ||||
|     public boolean isMenuItemsAnimated() { | ||||
|         return this.animatedMenuItems; | ||||
|     } | ||||
|  | ||||
|     public boolean isSetupWithSearchBar() { | ||||
|         return this.searchBar != null; | ||||
|     } | ||||
|  | ||||
|     public boolean isUseWindowInsetsController() { | ||||
|         return this.useWindowInsetsController; | ||||
|     } | ||||
|  | ||||
|     public void setAnimatedNavigationIcon(boolean z) { | ||||
|         this.animatedNavigationIcon = z; | ||||
|     } | ||||
|  | ||||
|     public void setAutoShowKeyboard(boolean z) { | ||||
|         this.autoShowKeyboard = z; | ||||
|     } | ||||
|  | ||||
|     public void setMenuItemsAnimated(boolean z) { | ||||
|         this.animatedMenuItems = z; | ||||
|     } | ||||
|  | ||||
|     public void setUseWindowInsetsController(boolean z) { | ||||
|         this.useWindowInsetsController = z; | ||||
|     } | ||||
|  | ||||
|     public SearchView(Context context) { | ||||
|         this(context, null); | ||||
|     } | ||||
|  | ||||
|     public SearchView(Context context, AttributeSet attributeSet) { | ||||
|         this(context, attributeSet, R.attr.materialSearchViewStyle); | ||||
|     } | ||||
|  | ||||
|     /* JADX WARN: Illegal instructions before constructor call */ | ||||
|     /* | ||||
|         Code decompiled incorrectly, please refer to instructions dump. | ||||
|         To view partially-correct add '--show-bad-code' argument | ||||
|     */ | ||||
|     public SearchView(android.content.Context r9, android.util.AttributeSet r10, int r11) { | ||||
|         /* | ||||
|             Method dump skipped, instructions count: 309 | ||||
|             To view this dump add '--comments-level debug' option | ||||
|         */ | ||||
|         throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.search.SearchView.<init>(android.content.Context, android.util.AttributeSet, int):void"); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.ViewGroup | ||||
|     public void addView(View view, int i, ViewGroup.LayoutParams layoutParams) { | ||||
|         if (this.layoutInflated) { | ||||
|             this.contentContainer.addView(view, i, layoutParams); | ||||
|         } else { | ||||
|             super.addView(view, i, layoutParams); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     protected void onFinishInflate() { | ||||
|         super.onFinishInflate(); | ||||
|         updateSoftInputMode(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public void setElevation(float f) { | ||||
|         super.setElevation(f); | ||||
|         setUpBackgroundViewElevationOverlay(f); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.ViewGroup, android.view.View | ||||
|     protected void onAttachedToWindow() { | ||||
|         super.onAttachedToWindow(); | ||||
|         MaterialShapeUtils.setParentAbsoluteElevation(this); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.AttachedBehavior | ||||
|     public CoordinatorLayout.Behavior<SearchView> getBehavior() { | ||||
|         return new Behavior(); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.motion.MaterialBackHandler | ||||
|     public void startBackProgress(BackEventCompat backEventCompat) { | ||||
|         if (isHiddenOrHiding() || this.searchBar == null) { | ||||
|             return; | ||||
|         } | ||||
|         this.searchViewAnimationHelper.startBackProgress(backEventCompat); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.motion.MaterialBackHandler | ||||
|     public void updateBackProgress(BackEventCompat backEventCompat) { | ||||
|         if (isHiddenOrHiding() || this.searchBar == null || Build.VERSION.SDK_INT < 34) { | ||||
|             return; | ||||
|         } | ||||
|         this.searchViewAnimationHelper.updateBackProgress(backEventCompat); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.motion.MaterialBackHandler | ||||
|     public void handleBackInvoked() { | ||||
|         if (isHiddenOrHiding()) { | ||||
|             return; | ||||
|         } | ||||
|         BackEventCompat onHandleBackInvoked = this.searchViewAnimationHelper.onHandleBackInvoked(); | ||||
|         if (Build.VERSION.SDK_INT >= 34 && this.searchBar != null && onHandleBackInvoked != null) { | ||||
|             this.searchViewAnimationHelper.finishBackProgress(); | ||||
|         } else { | ||||
|             hide(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.motion.MaterialBackHandler | ||||
|     public void cancelBackProgress() { | ||||
|         if (isHiddenOrHiding() || this.searchBar == null || Build.VERSION.SDK_INT < 34) { | ||||
|             return; | ||||
|         } | ||||
|         this.searchViewAnimationHelper.cancelBackProgress(); | ||||
|     } | ||||
|  | ||||
|     MaterialMainContainerBackHelper getBackHelper() { | ||||
|         return this.searchViewAnimationHelper.getBackHelper(); | ||||
|     } | ||||
|  | ||||
|     private boolean isHiddenOrHiding() { | ||||
|         return this.currentTransitionState.equals(TransitionState.HIDDEN) || this.currentTransitionState.equals(TransitionState.HIDING); | ||||
|     } | ||||
|  | ||||
|     private Window getActivityWindow() { | ||||
|         Activity activity = ContextUtils.getActivity(getContext()); | ||||
|         if (activity == null) { | ||||
|             return null; | ||||
|         } | ||||
|         return activity.getWindow(); | ||||
|     } | ||||
|  | ||||
|     private void setUpRootView() { | ||||
|         this.rootView.setOnTouchListener(new View.OnTouchListener() { // from class: com.google.android.material.search.SearchView$$ExternalSyntheticLambda6 | ||||
|             @Override // android.view.View.OnTouchListener | ||||
|             public final boolean onTouch(View view, MotionEvent motionEvent) { | ||||
|                 return SearchView.lambda$setUpRootView$0(view, motionEvent); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     private void setUpBackgroundViewElevationOverlay() { | ||||
|         setUpBackgroundViewElevationOverlay(getOverlayElevation()); | ||||
|     } | ||||
|  | ||||
|     private void setUpBackgroundViewElevationOverlay(float f) { | ||||
|         ElevationOverlayProvider elevationOverlayProvider = this.elevationOverlayProvider; | ||||
|         if (elevationOverlayProvider == null || this.backgroundView == null) { | ||||
|             return; | ||||
|         } | ||||
|         this.backgroundView.setBackgroundColor(elevationOverlayProvider.compositeOverlayIfNeeded(this.backgroundColor, f)); | ||||
|     } | ||||
|  | ||||
|     private float getOverlayElevation() { | ||||
|         SearchBar searchBar = this.searchBar; | ||||
|         if (searchBar != null) { | ||||
|             return searchBar.getCompatElevation(); | ||||
|         } | ||||
|         return getResources().getDimension(R.dimen.m3_searchview_elevation); | ||||
|     } | ||||
|  | ||||
|     private void setUpHeaderLayout(int i) { | ||||
|         if (i != -1) { | ||||
|             addHeaderView(LayoutInflater.from(getContext()).inflate(i, (ViewGroup) this.headerContainer, false)); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void setUpEditText(int i, String str, String str2) { | ||||
|         if (i != -1) { | ||||
|             TextViewCompat.setTextAppearance(this.editText, i); | ||||
|         } | ||||
|         this.editText.setText(str); | ||||
|         this.editText.setHint(str2); | ||||
|     } | ||||
|  | ||||
|     private void setUpBackButton(boolean z, boolean z2) { | ||||
|         if (z2) { | ||||
|             this.toolbar.setNavigationIcon((Drawable) null); | ||||
|             return; | ||||
|         } | ||||
|         this.toolbar.setNavigationOnClickListener(new View.OnClickListener() { // from class: com.google.android.material.search.SearchView$$ExternalSyntheticLambda7 | ||||
|             @Override // android.view.View.OnClickListener | ||||
|             public final void onClick(View view) { | ||||
|                 SearchView.this.m251x40e9b054(view); | ||||
|             } | ||||
|         }); | ||||
|         if (z) { | ||||
|             DrawerArrowDrawable drawerArrowDrawable = new DrawerArrowDrawable(getContext()); | ||||
|             drawerArrowDrawable.setColor(MaterialColors.getColor(this, R.attr.colorOnSurface)); | ||||
|             this.toolbar.setNavigationIcon(drawerArrowDrawable); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /* renamed from: lambda$setUpBackButton$1$com-google-android-material-search-SearchView, reason: not valid java name */ | ||||
|     /* synthetic */ void m251x40e9b054(View view) { | ||||
|         hide(); | ||||
|     } | ||||
|  | ||||
|     private void setUpClearButton() { | ||||
|         this.clearButton.setOnClickListener(new View.OnClickListener() { // from class: com.google.android.material.search.SearchView$$ExternalSyntheticLambda2 | ||||
|             @Override // android.view.View.OnClickListener | ||||
|             public final void onClick(View view) { | ||||
|                 SearchView.this.m252xf4a71c3b(view); | ||||
|             } | ||||
|         }); | ||||
|         this.editText.addTextChangedListener(new TextWatcher() { // from class: com.google.android.material.search.SearchView.1 | ||||
|             @Override // android.text.TextWatcher | ||||
|             public void afterTextChanged(Editable editable) { | ||||
|             } | ||||
|  | ||||
|             @Override // android.text.TextWatcher | ||||
|             public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { | ||||
|             } | ||||
|  | ||||
|             @Override // android.text.TextWatcher | ||||
|             public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { | ||||
|                 SearchView.this.clearButton.setVisibility(charSequence.length() > 0 ? 0 : 8); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     /* renamed from: lambda$setUpClearButton$2$com-google-android-material-search-SearchView, reason: not valid java name */ | ||||
|     /* synthetic */ void m252xf4a71c3b(View view) { | ||||
|         clearText(); | ||||
|         requestFocusAndShowKeyboardIfNeeded(); | ||||
|     } | ||||
|  | ||||
|     private void setUpContentOnTouchListener() { | ||||
|         this.contentContainer.setOnTouchListener(new View.OnTouchListener() { // from class: com.google.android.material.search.SearchView$$ExternalSyntheticLambda5 | ||||
|             @Override // android.view.View.OnTouchListener | ||||
|             public final boolean onTouch(View view, MotionEvent motionEvent) { | ||||
|                 return SearchView.this.m253x1cd2d198(view, motionEvent); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     /* renamed from: lambda$setUpContentOnTouchListener$3$com-google-android-material-search-SearchView, reason: not valid java name */ | ||||
|     /* synthetic */ boolean m253x1cd2d198(View view, MotionEvent motionEvent) { | ||||
|         if (!isAdjustNothingSoftInputMode()) { | ||||
|             return false; | ||||
|         } | ||||
|         clearFocusAndHideKeyboard(); | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     private void setUpStatusBarSpacer(int i) { | ||||
|         if (this.statusBarSpacer.getLayoutParams().height != i) { | ||||
|             this.statusBarSpacer.getLayoutParams().height = i; | ||||
|             this.statusBarSpacer.requestLayout(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private int getStatusBarHeight() { | ||||
|         int identifier = getResources().getIdentifier("status_bar_height", "dimen", "android"); | ||||
|         if (identifier > 0) { | ||||
|             return getResources().getDimensionPixelSize(identifier); | ||||
|         } | ||||
|         return 0; | ||||
|     } | ||||
|  | ||||
|     private void updateNavigationIconIfNeeded() { | ||||
|         MaterialToolbar materialToolbar = this.toolbar; | ||||
|         if (materialToolbar == null || isNavigationIconDrawerArrowDrawable(materialToolbar)) { | ||||
|             return; | ||||
|         } | ||||
|         int defaultNavigationIconResource = getDefaultNavigationIconResource(); | ||||
|         if (this.searchBar == null) { | ||||
|             this.toolbar.setNavigationIcon(defaultNavigationIconResource); | ||||
|             return; | ||||
|         } | ||||
|         Drawable wrap = DrawableCompat.wrap(AppCompatResources.getDrawable(getContext(), defaultNavigationIconResource).mutate()); | ||||
|         if (this.toolbar.getNavigationIconTint() != null) { | ||||
|             DrawableCompat.setTint(wrap, this.toolbar.getNavigationIconTint().intValue()); | ||||
|         } | ||||
|         this.toolbar.setNavigationIcon(new FadeThroughDrawable(this.searchBar.getNavigationIcon(), wrap)); | ||||
|         updateNavigationIconProgressIfNeeded(); | ||||
|     } | ||||
|  | ||||
|     private boolean isNavigationIconDrawerArrowDrawable(Toolbar toolbar) { | ||||
|         return DrawableCompat.unwrap(toolbar.getNavigationIcon()) instanceof DrawerArrowDrawable; | ||||
|     } | ||||
|  | ||||
|     private void setUpInsetListeners() { | ||||
|         setUpToolbarInsetListener(); | ||||
|         setUpDividerInsetListener(); | ||||
|         setUpStatusBarSpacerInsetListener(); | ||||
|     } | ||||
|  | ||||
|     private void setUpToolbarInsetListener() { | ||||
|         ViewUtils.doOnApplyWindowInsets(this.toolbar, new ViewUtils.OnApplyWindowInsetsListener() { // from class: com.google.android.material.search.SearchView$$ExternalSyntheticLambda3 | ||||
|             @Override // com.google.android.material.internal.ViewUtils.OnApplyWindowInsetsListener | ||||
|             public final WindowInsetsCompat onApplyWindowInsets(View view, WindowInsetsCompat windowInsetsCompat, ViewUtils.RelativePadding relativePadding) { | ||||
|                 return SearchView.this.m255x7371bf54(view, windowInsetsCompat, relativePadding); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     /* renamed from: lambda$setUpToolbarInsetListener$4$com-google-android-material-search-SearchView, reason: not valid java name */ | ||||
|     /* synthetic */ WindowInsetsCompat m255x7371bf54(View view, WindowInsetsCompat windowInsetsCompat, ViewUtils.RelativePadding relativePadding) { | ||||
|         boolean isLayoutRtl = ViewUtils.isLayoutRtl(this.toolbar); | ||||
|         this.toolbar.setPadding((isLayoutRtl ? relativePadding.end : relativePadding.start) + windowInsetsCompat.getSystemWindowInsetLeft(), relativePadding.top, (isLayoutRtl ? relativePadding.start : relativePadding.end) + windowInsetsCompat.getSystemWindowInsetRight(), relativePadding.bottom); | ||||
|         return windowInsetsCompat; | ||||
|     } | ||||
|  | ||||
|     private void setUpStatusBarSpacerInsetListener() { | ||||
|         setUpStatusBarSpacer(getStatusBarHeight()); | ||||
|         ViewCompat.setOnApplyWindowInsetsListener(this.statusBarSpacer, new OnApplyWindowInsetsListener() { // from class: com.google.android.material.search.SearchView$$ExternalSyntheticLambda9 | ||||
|             @Override // androidx.core.view.OnApplyWindowInsetsListener | ||||
|             public final WindowInsetsCompat onApplyWindowInsets(View view, WindowInsetsCompat windowInsetsCompat) { | ||||
|                 return SearchView.this.m254x941b8403(view, windowInsetsCompat); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     /* renamed from: lambda$setUpStatusBarSpacerInsetListener$5$com-google-android-material-search-SearchView, reason: not valid java name */ | ||||
|     /* synthetic */ WindowInsetsCompat m254x941b8403(View view, WindowInsetsCompat windowInsetsCompat) { | ||||
|         int systemWindowInsetTop = windowInsetsCompat.getSystemWindowInsetTop(); | ||||
|         setUpStatusBarSpacer(systemWindowInsetTop); | ||||
|         if (!this.statusBarSpacerEnabledOverride) { | ||||
|             setStatusBarSpacerEnabledInternal(systemWindowInsetTop > 0); | ||||
|         } | ||||
|         return windowInsetsCompat; | ||||
|     } | ||||
|  | ||||
|     private void setUpDividerInsetListener() { | ||||
|         final ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) this.divider.getLayoutParams(); | ||||
|         final int i = marginLayoutParams.leftMargin; | ||||
|         final int i2 = marginLayoutParams.rightMargin; | ||||
|         ViewCompat.setOnApplyWindowInsetsListener(this.divider, new OnApplyWindowInsetsListener() { // from class: com.google.android.material.search.SearchView$$ExternalSyntheticLambda8 | ||||
|             @Override // androidx.core.view.OnApplyWindowInsetsListener | ||||
|             public final WindowInsetsCompat onApplyWindowInsets(View view, WindowInsetsCompat windowInsetsCompat) { | ||||
|                 return SearchView.lambda$setUpDividerInsetListener$6(marginLayoutParams, i, i2, view, windowInsetsCompat); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     static /* synthetic */ WindowInsetsCompat lambda$setUpDividerInsetListener$6(ViewGroup.MarginLayoutParams marginLayoutParams, int i, int i2, View view, WindowInsetsCompat windowInsetsCompat) { | ||||
|         marginLayoutParams.leftMargin = i + windowInsetsCompat.getSystemWindowInsetLeft(); | ||||
|         marginLayoutParams.rightMargin = i2 + windowInsetsCompat.getSystemWindowInsetRight(); | ||||
|         return windowInsetsCompat; | ||||
|     } | ||||
|  | ||||
|     public void setupWithSearchBar(SearchBar searchBar) { | ||||
|         this.searchBar = searchBar; | ||||
|         this.searchViewAnimationHelper.setSearchBar(searchBar); | ||||
|         if (searchBar != null) { | ||||
|             searchBar.setOnClickListener(new View.OnClickListener() { // from class: com.google.android.material.search.SearchView$$ExternalSyntheticLambda11 | ||||
|                 @Override // android.view.View.OnClickListener | ||||
|                 public final void onClick(View view) { | ||||
|                     SearchView.this.m256x986696e6(view); | ||||
|                 } | ||||
|             }); | ||||
|             if (Build.VERSION.SDK_INT >= 34) { | ||||
|                 try { | ||||
|                     searchBar.setHandwritingDelegatorCallback(new Runnable() { // from class: com.google.android.material.search.SearchView$$ExternalSyntheticLambda12 | ||||
|                         @Override // java.lang.Runnable | ||||
|                         public final void run() { | ||||
|                             SearchView.this.show(); | ||||
|                         } | ||||
|                     }); | ||||
|                     this.editText.setIsHandwritingDelegate(true); | ||||
|                 } catch (LinkageError unused) { | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         updateNavigationIconIfNeeded(); | ||||
|         setUpBackgroundViewElevationOverlay(); | ||||
|         updateListeningForBackCallbacks(getCurrentTransitionState()); | ||||
|     } | ||||
|  | ||||
|     /* renamed from: lambda$setupWithSearchBar$7$com-google-android-material-search-SearchView, reason: not valid java name */ | ||||
|     /* synthetic */ void m256x986696e6(View view) { | ||||
|         show(); | ||||
|     } | ||||
|  | ||||
|     public void addHeaderView(View view) { | ||||
|         this.headerContainer.addView(view); | ||||
|         this.headerContainer.setVisibility(0); | ||||
|     } | ||||
|  | ||||
|     public void removeHeaderView(View view) { | ||||
|         this.headerContainer.removeView(view); | ||||
|         if (this.headerContainer.getChildCount() == 0) { | ||||
|             this.headerContainer.setVisibility(8); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void removeAllHeaderViews() { | ||||
|         this.headerContainer.removeAllViews(); | ||||
|         this.headerContainer.setVisibility(8); | ||||
|     } | ||||
|  | ||||
|     public void addTransitionListener(TransitionListener transitionListener) { | ||||
|         this.transitionListeners.add(transitionListener); | ||||
|     } | ||||
|  | ||||
|     public void removeTransitionListener(TransitionListener transitionListener) { | ||||
|         this.transitionListeners.remove(transitionListener); | ||||
|     } | ||||
|  | ||||
|     public void inflateMenu(int i) { | ||||
|         this.toolbar.inflateMenu(i); | ||||
|     } | ||||
|  | ||||
|     public void setOnMenuItemClickListener(Toolbar.OnMenuItemClickListener onMenuItemClickListener) { | ||||
|         this.toolbar.setOnMenuItemClickListener(onMenuItemClickListener); | ||||
|     } | ||||
|  | ||||
|     public void setSearchPrefixText(CharSequence charSequence) { | ||||
|         this.searchPrefix.setText(charSequence); | ||||
|         this.searchPrefix.setVisibility(TextUtils.isEmpty(charSequence) ? 8 : 0); | ||||
|     } | ||||
|  | ||||
|     public CharSequence getSearchPrefixText() { | ||||
|         return this.searchPrefix.getText(); | ||||
|     } | ||||
|  | ||||
|     public Editable getText() { | ||||
|         return this.editText.getText(); | ||||
|     } | ||||
|  | ||||
|     public void setText(CharSequence charSequence) { | ||||
|         this.editText.setText(charSequence); | ||||
|     } | ||||
|  | ||||
|     public void setText(int i) { | ||||
|         this.editText.setText(i); | ||||
|     } | ||||
|  | ||||
|     public void clearText() { | ||||
|         this.editText.setText(""); | ||||
|     } | ||||
|  | ||||
|     public CharSequence getHint() { | ||||
|         return this.editText.getHint(); | ||||
|     } | ||||
|  | ||||
|     public void setHint(CharSequence charSequence) { | ||||
|         this.editText.setHint(charSequence); | ||||
|     } | ||||
|  | ||||
|     public void setHint(int i) { | ||||
|         this.editText.setHint(i); | ||||
|     } | ||||
|  | ||||
|     public void updateSoftInputMode() { | ||||
|         Window activityWindow = getActivityWindow(); | ||||
|         if (activityWindow != null) { | ||||
|             this.softInputMode = activityWindow.getAttributes().softInputMode; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setStatusBarSpacerEnabled(boolean z) { | ||||
|         this.statusBarSpacerEnabledOverride = true; | ||||
|         setStatusBarSpacerEnabledInternal(z); | ||||
|     } | ||||
|  | ||||
|     private void setStatusBarSpacerEnabledInternal(boolean z) { | ||||
|         this.statusBarSpacer.setVisibility(z ? 0 : 8); | ||||
|     } | ||||
|  | ||||
|     void setTransitionState(TransitionState transitionState) { | ||||
|         setTransitionState(transitionState, true); | ||||
|     } | ||||
|  | ||||
|     private void setTransitionState(TransitionState transitionState, boolean z) { | ||||
|         if (this.currentTransitionState.equals(transitionState)) { | ||||
|             return; | ||||
|         } | ||||
|         if (z) { | ||||
|             if (transitionState == TransitionState.SHOWN) { | ||||
|                 setModalForAccessibility(true); | ||||
|             } else if (transitionState == TransitionState.HIDDEN) { | ||||
|                 setModalForAccessibility(false); | ||||
|             } | ||||
|         } | ||||
|         TransitionState transitionState2 = this.currentTransitionState; | ||||
|         this.currentTransitionState = transitionState; | ||||
|         Iterator it = new LinkedHashSet(this.transitionListeners).iterator(); | ||||
|         while (it.hasNext()) { | ||||
|             ((TransitionListener) it.next()).onStateChanged(this, transitionState2, transitionState); | ||||
|         } | ||||
|         updateListeningForBackCallbacks(transitionState); | ||||
|     } | ||||
|  | ||||
|     private void updateListeningForBackCallbacks(TransitionState transitionState) { | ||||
|         if (this.searchBar == null || !this.backHandlingEnabled) { | ||||
|             return; | ||||
|         } | ||||
|         if (transitionState.equals(TransitionState.SHOWN)) { | ||||
|             this.backOrchestrator.startListeningForBackCallbacks(); | ||||
|         } else if (transitionState.equals(TransitionState.HIDDEN)) { | ||||
|             this.backOrchestrator.stopListeningForBackCallbacks(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public boolean isShowing() { | ||||
|         return this.currentTransitionState.equals(TransitionState.SHOWN) || this.currentTransitionState.equals(TransitionState.SHOWING); | ||||
|     } | ||||
|  | ||||
|     public void show() { | ||||
|         if (this.currentTransitionState.equals(TransitionState.SHOWN) || this.currentTransitionState.equals(TransitionState.SHOWING)) { | ||||
|             return; | ||||
|         } | ||||
|         this.searchViewAnimationHelper.show(); | ||||
|     } | ||||
|  | ||||
|     public void hide() { | ||||
|         if (this.currentTransitionState.equals(TransitionState.HIDDEN) || this.currentTransitionState.equals(TransitionState.HIDING)) { | ||||
|             return; | ||||
|         } | ||||
|         this.searchViewAnimationHelper.hide(); | ||||
|     } | ||||
|  | ||||
|     public void setVisible(boolean z) { | ||||
|         boolean z2 = this.rootView.getVisibility() == 0; | ||||
|         this.rootView.setVisibility(z ? 0 : 8); | ||||
|         updateNavigationIconProgressIfNeeded(); | ||||
|         setTransitionState(z ? TransitionState.SHOWN : TransitionState.HIDDEN, z2 != z); | ||||
|     } | ||||
|  | ||||
|     private void updateNavigationIconProgressIfNeeded() { | ||||
|         ImageButton navigationIconButton = ToolbarUtils.getNavigationIconButton(this.toolbar); | ||||
|         if (navigationIconButton == null) { | ||||
|             return; | ||||
|         } | ||||
|         int i = this.rootView.getVisibility() == 0 ? 1 : 0; | ||||
|         Drawable unwrap = DrawableCompat.unwrap(navigationIconButton.getDrawable()); | ||||
|         if (unwrap instanceof DrawerArrowDrawable) { | ||||
|             ((DrawerArrowDrawable) unwrap).setProgress(i); | ||||
|         } | ||||
|         if (unwrap instanceof FadeThroughDrawable) { | ||||
|             ((FadeThroughDrawable) unwrap).setProgress(i); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void requestFocusAndShowKeyboardIfNeeded() { | ||||
|         if (this.autoShowKeyboard) { | ||||
|             requestFocusAndShowKeyboard(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void requestFocusAndShowKeyboard() { | ||||
|         this.editText.postDelayed(new Runnable() { // from class: com.google.android.material.search.SearchView$$ExternalSyntheticLambda10 | ||||
|             @Override // java.lang.Runnable | ||||
|             public final void run() { | ||||
|                 SearchView.this.m250x2b2700d7(); | ||||
|             } | ||||
|         }, TALKBACK_FOCUS_CHANGE_DELAY_MS); | ||||
|     } | ||||
|  | ||||
|     /* renamed from: lambda$requestFocusAndShowKeyboard$8$com-google-android-material-search-SearchView, reason: not valid java name */ | ||||
|     /* synthetic */ void m250x2b2700d7() { | ||||
|         if (this.editText.requestFocus()) { | ||||
|             this.editText.sendAccessibilityEvent(8); | ||||
|         } | ||||
|         ViewUtils.showKeyboard(this.editText, this.useWindowInsetsController); | ||||
|     } | ||||
|  | ||||
|     public void clearFocusAndHideKeyboard() { | ||||
|         this.editText.post(new Runnable() { // from class: com.google.android.material.search.SearchView$$ExternalSyntheticLambda4 | ||||
|             @Override // java.lang.Runnable | ||||
|             public final void run() { | ||||
|                 SearchView.this.m249xff5aa7db(); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     /* renamed from: lambda$clearFocusAndHideKeyboard$9$com-google-android-material-search-SearchView, reason: not valid java name */ | ||||
|     /* synthetic */ void m249xff5aa7db() { | ||||
|         this.editText.clearFocus(); | ||||
|         SearchBar searchBar = this.searchBar; | ||||
|         if (searchBar != null) { | ||||
|             searchBar.requestFocus(); | ||||
|         } | ||||
|         ViewUtils.hideKeyboard(this.editText, this.useWindowInsetsController); | ||||
|     } | ||||
|  | ||||
|     public void setModalForAccessibility(boolean z) { | ||||
|         ViewGroup viewGroup = (ViewGroup) getRootView(); | ||||
|         if (z) { | ||||
|             this.childImportantForAccessibilityMap = new HashMap(viewGroup.getChildCount()); | ||||
|         } | ||||
|         updateChildImportantForAccessibility(viewGroup, z); | ||||
|         if (z) { | ||||
|             return; | ||||
|         } | ||||
|         this.childImportantForAccessibilityMap = null; | ||||
|     } | ||||
|  | ||||
|     public void setToolbarTouchscreenBlocksFocus(boolean z) { | ||||
|         this.toolbar.setTouchscreenBlocksFocus(z); | ||||
|     } | ||||
|  | ||||
|     private void updateChildImportantForAccessibility(ViewGroup viewGroup, boolean z) { | ||||
|         for (int i = 0; i < viewGroup.getChildCount(); i++) { | ||||
|             View childAt = viewGroup.getChildAt(i); | ||||
|             if (childAt != this) { | ||||
|                 if (childAt.findViewById(this.rootView.getId()) != null) { | ||||
|                     updateChildImportantForAccessibility((ViewGroup) childAt, z); | ||||
|                 } else if (!z) { | ||||
|                     Map<View, Integer> map = this.childImportantForAccessibilityMap; | ||||
|                     if (map != null && map.containsKey(childAt)) { | ||||
|                         ViewCompat.setImportantForAccessibility(childAt, this.childImportantForAccessibilityMap.get(childAt).intValue()); | ||||
|                     } | ||||
|                 } else { | ||||
|                     this.childImportantForAccessibilityMap.put(childAt, Integer.valueOf(childAt.getImportantForAccessibility())); | ||||
|                     ViewCompat.setImportantForAccessibility(childAt, 4); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     protected int getDefaultNavigationIconResource() { | ||||
|         return R.drawable.ic_arrow_back_black_24; | ||||
|     } | ||||
|  | ||||
|     public static class Behavior extends CoordinatorLayout.Behavior<SearchView> { | ||||
|         public Behavior() { | ||||
|         } | ||||
|  | ||||
|         public Behavior(Context context, AttributeSet attributeSet) { | ||||
|             super(context, attributeSet); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior | ||||
|         public boolean onDependentViewChanged(CoordinatorLayout coordinatorLayout, SearchView searchView, View view) { | ||||
|             if (searchView.isSetupWithSearchBar() || !(view instanceof SearchBar)) { | ||||
|                 return false; | ||||
|             } | ||||
|             searchView.setupWithSearchBar((SearchBar) view); | ||||
|             return false; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     protected Parcelable onSaveInstanceState() { | ||||
|         SavedState savedState = new SavedState(super.onSaveInstanceState()); | ||||
|         Editable text = getText(); | ||||
|         savedState.text = text == null ? null : text.toString(); | ||||
|         savedState.visibility = this.rootView.getVisibility(); | ||||
|         return savedState; | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     protected void onRestoreInstanceState(Parcelable parcelable) { | ||||
|         if (!(parcelable instanceof SavedState)) { | ||||
|             super.onRestoreInstanceState(parcelable); | ||||
|             return; | ||||
|         } | ||||
|         SavedState savedState = (SavedState) parcelable; | ||||
|         super.onRestoreInstanceState(savedState.getSuperState()); | ||||
|         setText(savedState.text); | ||||
|         setVisible(savedState.visibility == 0); | ||||
|     } | ||||
|  | ||||
|     static class SavedState extends AbsSavedState { | ||||
|         public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.ClassLoaderCreator<SavedState>() { // from class: com.google.android.material.search.SearchView.SavedState.1 | ||||
|             /* JADX WARN: Can't rename method to resolve collision */ | ||||
|             @Override // android.os.Parcelable.ClassLoaderCreator | ||||
|             public SavedState createFromParcel(Parcel parcel, ClassLoader classLoader) { | ||||
|                 return new SavedState(parcel, classLoader); | ||||
|             } | ||||
|  | ||||
|             @Override // android.os.Parcelable.Creator | ||||
|             public SavedState createFromParcel(Parcel parcel) { | ||||
|                 return new SavedState(parcel); | ||||
|             } | ||||
|  | ||||
|             @Override // android.os.Parcelable.Creator | ||||
|             public SavedState[] newArray(int i) { | ||||
|                 return new SavedState[i]; | ||||
|             } | ||||
|         }; | ||||
|         String text; | ||||
|         int visibility; | ||||
|  | ||||
|         public SavedState(Parcel parcel) { | ||||
|             this(parcel, null); | ||||
|         } | ||||
|  | ||||
|         public SavedState(Parcel parcel, ClassLoader classLoader) { | ||||
|             super(parcel, classLoader); | ||||
|             this.text = parcel.readString(); | ||||
|             this.visibility = parcel.readInt(); | ||||
|         } | ||||
|  | ||||
|         public SavedState(Parcelable parcelable) { | ||||
|             super(parcelable); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.customview.view.AbsSavedState, android.os.Parcelable | ||||
|         public void writeToParcel(Parcel parcel, int i) { | ||||
|             super.writeToParcel(parcel, i); | ||||
|             parcel.writeString(this.text); | ||||
|             parcel.writeInt(this.visibility); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,599 @@ | ||||
| package com.google.android.material.search; | ||||
|  | ||||
| import android.animation.Animator; | ||||
| import android.animation.AnimatorListenerAdapter; | ||||
| import android.animation.AnimatorSet; | ||||
| import android.animation.TimeInterpolator; | ||||
| import android.animation.ValueAnimator; | ||||
| import android.graphics.Rect; | ||||
| import android.graphics.drawable.Drawable; | ||||
| import android.view.Menu; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import android.widget.EditText; | ||||
| import android.widget.FrameLayout; | ||||
| import android.widget.ImageButton; | ||||
| import android.widget.TextView; | ||||
| import androidx.activity.BackEventCompat; | ||||
| import androidx.appcompat.graphics.drawable.DrawerArrowDrawable; | ||||
| import androidx.appcompat.widget.ActionMenuView; | ||||
| import androidx.appcompat.widget.Toolbar; | ||||
| import androidx.core.graphics.drawable.DrawableCompat; | ||||
| import androidx.core.view.MarginLayoutParamsCompat; | ||||
| import androidx.core.view.ViewCompat; | ||||
| import com.google.android.material.animation.AnimationUtils; | ||||
| import com.google.android.material.internal.ClippableRoundedCornerLayout; | ||||
| import com.google.android.material.internal.FadeThroughDrawable; | ||||
| import com.google.android.material.internal.FadeThroughUpdateListener; | ||||
| import com.google.android.material.internal.MultiViewUpdateListener; | ||||
| import com.google.android.material.internal.RectEvaluator; | ||||
| import com.google.android.material.internal.ReversableAnimatedValueInterpolator; | ||||
| import com.google.android.material.internal.ToolbarUtils; | ||||
| import com.google.android.material.internal.TouchObserverFrameLayout; | ||||
| import com.google.android.material.internal.ViewUtils; | ||||
| import com.google.android.material.motion.MaterialMainContainerBackHelper; | ||||
| import com.google.android.material.search.SearchView; | ||||
| import java.util.Objects; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| class SearchViewAnimationHelper { | ||||
|     private static final float CONTENT_FROM_SCALE = 0.95f; | ||||
|     private static final long HIDE_CLEAR_BUTTON_ALPHA_DURATION_MS = 42; | ||||
|     private static final long HIDE_CLEAR_BUTTON_ALPHA_START_DELAY_MS = 0; | ||||
|     private static final long HIDE_CONTENT_ALPHA_DURATION_MS = 83; | ||||
|     private static final long HIDE_CONTENT_ALPHA_START_DELAY_MS = 0; | ||||
|     private static final long HIDE_CONTENT_SCALE_DURATION_MS = 250; | ||||
|     private static final long HIDE_DURATION_MS = 250; | ||||
|     private static final long HIDE_TRANSLATE_DURATION_MS = 300; | ||||
|     private static final long SHOW_CLEAR_BUTTON_ALPHA_DURATION_MS = 50; | ||||
|     private static final long SHOW_CLEAR_BUTTON_ALPHA_START_DELAY_MS = 250; | ||||
|     private static final long SHOW_CONTENT_ALPHA_DURATION_MS = 150; | ||||
|     private static final long SHOW_CONTENT_ALPHA_START_DELAY_MS = 75; | ||||
|     private static final long SHOW_CONTENT_SCALE_DURATION_MS = 300; | ||||
|     private static final long SHOW_DURATION_MS = 300; | ||||
|     private static final long SHOW_TRANSLATE_DURATION_MS = 350; | ||||
|     private static final long SHOW_TRANSLATE_KEYBOARD_START_DELAY_MS = 150; | ||||
|     private final MaterialMainContainerBackHelper backHelper; | ||||
|     private AnimatorSet backProgressAnimatorSet; | ||||
|     private final ImageButton clearButton; | ||||
|     private final TouchObserverFrameLayout contentContainer; | ||||
|     private final View divider; | ||||
|     private final Toolbar dummyToolbar; | ||||
|     private final EditText editText; | ||||
|     private final FrameLayout headerContainer; | ||||
|     private final ClippableRoundedCornerLayout rootView; | ||||
|     private final View scrim; | ||||
|     private SearchBar searchBar; | ||||
|     private final TextView searchPrefix; | ||||
|     private final SearchView searchView; | ||||
|     private final Toolbar toolbar; | ||||
|     private final FrameLayout toolbarContainer; | ||||
|  | ||||
|     MaterialMainContainerBackHelper getBackHelper() { | ||||
|         return this.backHelper; | ||||
|     } | ||||
|  | ||||
|     void setSearchBar(SearchBar searchBar) { | ||||
|         this.searchBar = searchBar; | ||||
|     } | ||||
|  | ||||
|     SearchViewAnimationHelper(SearchView searchView) { | ||||
|         this.searchView = searchView; | ||||
|         this.scrim = searchView.scrim; | ||||
|         ClippableRoundedCornerLayout clippableRoundedCornerLayout = searchView.rootView; | ||||
|         this.rootView = clippableRoundedCornerLayout; | ||||
|         this.headerContainer = searchView.headerContainer; | ||||
|         this.toolbarContainer = searchView.toolbarContainer; | ||||
|         this.toolbar = searchView.toolbar; | ||||
|         this.dummyToolbar = searchView.dummyToolbar; | ||||
|         this.searchPrefix = searchView.searchPrefix; | ||||
|         this.editText = searchView.editText; | ||||
|         this.clearButton = searchView.clearButton; | ||||
|         this.divider = searchView.divider; | ||||
|         this.contentContainer = searchView.contentContainer; | ||||
|         this.backHelper = new MaterialMainContainerBackHelper(clippableRoundedCornerLayout); | ||||
|     } | ||||
|  | ||||
|     void show() { | ||||
|         if (this.searchBar != null) { | ||||
|             startShowAnimationExpand(); | ||||
|         } else { | ||||
|             startShowAnimationTranslate(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     AnimatorSet hide() { | ||||
|         if (this.searchBar != null) { | ||||
|             return startHideAnimationCollapse(); | ||||
|         } | ||||
|         return startHideAnimationTranslate(); | ||||
|     } | ||||
|  | ||||
|     private void startShowAnimationExpand() { | ||||
|         if (this.searchView.isAdjustNothingSoftInputMode()) { | ||||
|             this.searchView.requestFocusAndShowKeyboardIfNeeded(); | ||||
|         } | ||||
|         this.searchView.setTransitionState(SearchView.TransitionState.SHOWING); | ||||
|         setUpDummyToolbarIfNeeded(); | ||||
|         this.editText.setText(this.searchBar.getText()); | ||||
|         EditText editText = this.editText; | ||||
|         editText.setSelection(editText.getText().length()); | ||||
|         this.rootView.setVisibility(4); | ||||
|         this.rootView.post(new Runnable() { // from class: com.google.android.material.search.SearchViewAnimationHelper$$ExternalSyntheticLambda5 | ||||
|             @Override // java.lang.Runnable | ||||
|             public final void run() { | ||||
|                 SearchViewAnimationHelper.this.m258x94743afc(); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     /* renamed from: lambda$startShowAnimationExpand$0$com-google-android-material-search-SearchViewAnimationHelper, reason: not valid java name */ | ||||
|     /* synthetic */ void m258x94743afc() { | ||||
|         AnimatorSet expandCollapseAnimatorSet = getExpandCollapseAnimatorSet(true); | ||||
|         expandCollapseAnimatorSet.addListener(new AnimatorListenerAdapter() { // from class: com.google.android.material.search.SearchViewAnimationHelper.1 | ||||
|             @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|             public void onAnimationStart(Animator animator) { | ||||
|                 SearchViewAnimationHelper.this.rootView.setVisibility(0); | ||||
|                 SearchViewAnimationHelper.this.searchBar.stopOnLoadAnimation(); | ||||
|             } | ||||
|  | ||||
|             @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|             public void onAnimationEnd(Animator animator) { | ||||
|                 if (!SearchViewAnimationHelper.this.searchView.isAdjustNothingSoftInputMode()) { | ||||
|                     SearchViewAnimationHelper.this.searchView.requestFocusAndShowKeyboardIfNeeded(); | ||||
|                 } | ||||
|                 SearchViewAnimationHelper.this.searchView.setTransitionState(SearchView.TransitionState.SHOWN); | ||||
|             } | ||||
|         }); | ||||
|         expandCollapseAnimatorSet.start(); | ||||
|     } | ||||
|  | ||||
|     private AnimatorSet startHideAnimationCollapse() { | ||||
|         if (this.searchView.isAdjustNothingSoftInputMode()) { | ||||
|             this.searchView.clearFocusAndHideKeyboard(); | ||||
|         } | ||||
|         AnimatorSet expandCollapseAnimatorSet = getExpandCollapseAnimatorSet(false); | ||||
|         expandCollapseAnimatorSet.addListener(new AnimatorListenerAdapter() { // from class: com.google.android.material.search.SearchViewAnimationHelper.2 | ||||
|             @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|             public void onAnimationStart(Animator animator) { | ||||
|                 SearchViewAnimationHelper.this.searchView.setTransitionState(SearchView.TransitionState.HIDING); | ||||
|             } | ||||
|  | ||||
|             @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|             public void onAnimationEnd(Animator animator) { | ||||
|                 SearchViewAnimationHelper.this.rootView.setVisibility(8); | ||||
|                 if (!SearchViewAnimationHelper.this.searchView.isAdjustNothingSoftInputMode()) { | ||||
|                     SearchViewAnimationHelper.this.searchView.clearFocusAndHideKeyboard(); | ||||
|                 } | ||||
|                 SearchViewAnimationHelper.this.searchView.setTransitionState(SearchView.TransitionState.HIDDEN); | ||||
|             } | ||||
|         }); | ||||
|         expandCollapseAnimatorSet.start(); | ||||
|         return expandCollapseAnimatorSet; | ||||
|     } | ||||
|  | ||||
|     private void startShowAnimationTranslate() { | ||||
|         if (this.searchView.isAdjustNothingSoftInputMode()) { | ||||
|             final SearchView searchView = this.searchView; | ||||
|             Objects.requireNonNull(searchView); | ||||
|             searchView.postDelayed(new Runnable() { // from class: com.google.android.material.search.SearchViewAnimationHelper$$ExternalSyntheticLambda6 | ||||
|                 @Override // java.lang.Runnable | ||||
|                 public final void run() { | ||||
|                     SearchView.this.requestFocusAndShowKeyboardIfNeeded(); | ||||
|                 } | ||||
|             }, 150L); | ||||
|         } | ||||
|         this.rootView.setVisibility(4); | ||||
|         this.rootView.post(new Runnable() { // from class: com.google.android.material.search.SearchViewAnimationHelper$$ExternalSyntheticLambda7 | ||||
|             @Override // java.lang.Runnable | ||||
|             public final void run() { | ||||
|                 SearchViewAnimationHelper.this.m259x4df249eb(); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     /* renamed from: lambda$startShowAnimationTranslate$1$com-google-android-material-search-SearchViewAnimationHelper, reason: not valid java name */ | ||||
|     /* synthetic */ void m259x4df249eb() { | ||||
|         this.rootView.setTranslationY(r0.getHeight()); | ||||
|         AnimatorSet translateAnimatorSet = getTranslateAnimatorSet(true); | ||||
|         translateAnimatorSet.addListener(new AnimatorListenerAdapter() { // from class: com.google.android.material.search.SearchViewAnimationHelper.3 | ||||
|             @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|             public void onAnimationStart(Animator animator) { | ||||
|                 SearchViewAnimationHelper.this.rootView.setVisibility(0); | ||||
|                 SearchViewAnimationHelper.this.searchView.setTransitionState(SearchView.TransitionState.SHOWING); | ||||
|             } | ||||
|  | ||||
|             @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|             public void onAnimationEnd(Animator animator) { | ||||
|                 if (!SearchViewAnimationHelper.this.searchView.isAdjustNothingSoftInputMode()) { | ||||
|                     SearchViewAnimationHelper.this.searchView.requestFocusAndShowKeyboardIfNeeded(); | ||||
|                 } | ||||
|                 SearchViewAnimationHelper.this.searchView.setTransitionState(SearchView.TransitionState.SHOWN); | ||||
|             } | ||||
|         }); | ||||
|         translateAnimatorSet.start(); | ||||
|     } | ||||
|  | ||||
|     private AnimatorSet startHideAnimationTranslate() { | ||||
|         if (this.searchView.isAdjustNothingSoftInputMode()) { | ||||
|             this.searchView.clearFocusAndHideKeyboard(); | ||||
|         } | ||||
|         AnimatorSet translateAnimatorSet = getTranslateAnimatorSet(false); | ||||
|         translateAnimatorSet.addListener(new AnimatorListenerAdapter() { // from class: com.google.android.material.search.SearchViewAnimationHelper.4 | ||||
|             @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|             public void onAnimationStart(Animator animator) { | ||||
|                 SearchViewAnimationHelper.this.searchView.setTransitionState(SearchView.TransitionState.HIDING); | ||||
|             } | ||||
|  | ||||
|             @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|             public void onAnimationEnd(Animator animator) { | ||||
|                 SearchViewAnimationHelper.this.rootView.setVisibility(8); | ||||
|                 if (!SearchViewAnimationHelper.this.searchView.isAdjustNothingSoftInputMode()) { | ||||
|                     SearchViewAnimationHelper.this.searchView.clearFocusAndHideKeyboard(); | ||||
|                 } | ||||
|                 SearchViewAnimationHelper.this.searchView.setTransitionState(SearchView.TransitionState.HIDDEN); | ||||
|             } | ||||
|         }); | ||||
|         translateAnimatorSet.start(); | ||||
|         return translateAnimatorSet; | ||||
|     } | ||||
|  | ||||
|     private AnimatorSet getTranslateAnimatorSet(boolean z) { | ||||
|         AnimatorSet animatorSet = new AnimatorSet(); | ||||
|         animatorSet.playTogether(getTranslationYAnimator()); | ||||
|         addBackButtonProgressAnimatorIfNeeded(animatorSet); | ||||
|         animatorSet.setInterpolator(ReversableAnimatedValueInterpolator.of(z, AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR)); | ||||
|         animatorSet.setDuration(z ? SHOW_TRANSLATE_DURATION_MS : 300L); | ||||
|         return animatorSet; | ||||
|     } | ||||
|  | ||||
|     private Animator getTranslationYAnimator() { | ||||
|         ValueAnimator ofFloat = ValueAnimator.ofFloat(this.rootView.getHeight(), 0.0f); | ||||
|         ofFloat.addUpdateListener(MultiViewUpdateListener.translationYListener(this.rootView)); | ||||
|         return ofFloat; | ||||
|     } | ||||
|  | ||||
|     private AnimatorSet getExpandCollapseAnimatorSet(final boolean z) { | ||||
|         AnimatorSet animatorSet = new AnimatorSet(); | ||||
|         if (this.backProgressAnimatorSet == null) { | ||||
|             animatorSet.playTogether(getButtonsProgressAnimator(z), getButtonsTranslationAnimator(z)); | ||||
|         } | ||||
|         animatorSet.playTogether(getScrimAlphaAnimator(z), getRootViewAnimator(z), getClearButtonAnimator(z), getContentAnimator(z), getHeaderContainerAnimator(z), getDummyToolbarAnimator(z), getActionMenuViewsAlphaAnimator(z), getEditTextAnimator(z), getSearchPrefixAnimator(z)); | ||||
|         animatorSet.addListener(new AnimatorListenerAdapter() { // from class: com.google.android.material.search.SearchViewAnimationHelper.5 | ||||
|             @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|             public void onAnimationStart(Animator animator) { | ||||
|                 SearchViewAnimationHelper.this.setContentViewsAlpha(z ? 0.0f : 1.0f); | ||||
|             } | ||||
|  | ||||
|             @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|             public void onAnimationEnd(Animator animator) { | ||||
|                 SearchViewAnimationHelper.this.setContentViewsAlpha(z ? 1.0f : 0.0f); | ||||
|                 SearchViewAnimationHelper.this.rootView.resetClipBoundsAndCornerRadius(); | ||||
|             } | ||||
|         }); | ||||
|         return animatorSet; | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     public void setContentViewsAlpha(float f) { | ||||
|         this.clearButton.setAlpha(f); | ||||
|         this.divider.setAlpha(f); | ||||
|         this.contentContainer.setAlpha(f); | ||||
|         setActionMenuViewAlphaIfNeeded(f); | ||||
|     } | ||||
|  | ||||
|     private void setActionMenuViewAlphaIfNeeded(float f) { | ||||
|         ActionMenuView actionMenuView; | ||||
|         if (!this.searchView.isMenuItemsAnimated() || (actionMenuView = ToolbarUtils.getActionMenuView(this.toolbar)) == null) { | ||||
|             return; | ||||
|         } | ||||
|         actionMenuView.setAlpha(f); | ||||
|     } | ||||
|  | ||||
|     private Animator getScrimAlphaAnimator(boolean z) { | ||||
|         TimeInterpolator timeInterpolator = z ? AnimationUtils.LINEAR_INTERPOLATOR : AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR; | ||||
|         ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f); | ||||
|         ofFloat.setDuration(z ? 300L : 250L); | ||||
|         ofFloat.setInterpolator(ReversableAnimatedValueInterpolator.of(z, timeInterpolator)); | ||||
|         ofFloat.addUpdateListener(MultiViewUpdateListener.alphaListener(this.scrim)); | ||||
|         return ofFloat; | ||||
|     } | ||||
|  | ||||
|     private Animator getRootViewAnimator(boolean z) { | ||||
|         Rect initialHideToClipBounds = this.backHelper.getInitialHideToClipBounds(); | ||||
|         Rect initialHideFromClipBounds = this.backHelper.getInitialHideFromClipBounds(); | ||||
|         if (initialHideToClipBounds == null) { | ||||
|             initialHideToClipBounds = ViewUtils.calculateRectFromBounds(this.searchView); | ||||
|         } | ||||
|         if (initialHideFromClipBounds == null) { | ||||
|             initialHideFromClipBounds = ViewUtils.calculateOffsetRectFromBounds(this.rootView, this.searchBar); | ||||
|         } | ||||
|         final Rect rect = new Rect(initialHideFromClipBounds); | ||||
|         final float cornerSize = this.searchBar.getCornerSize(); | ||||
|         final float max = Math.max(this.rootView.getCornerRadius(), this.backHelper.getExpandedCornerSize()); | ||||
|         ValueAnimator ofObject = ValueAnimator.ofObject(new RectEvaluator(rect), initialHideFromClipBounds, initialHideToClipBounds); | ||||
|         ofObject.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { // from class: com.google.android.material.search.SearchViewAnimationHelper$$ExternalSyntheticLambda8 | ||||
|             @Override // android.animation.ValueAnimator.AnimatorUpdateListener | ||||
|             public final void onAnimationUpdate(ValueAnimator valueAnimator) { | ||||
|                 SearchViewAnimationHelper.this.m257xa183b80f(cornerSize, max, rect, valueAnimator); | ||||
|             } | ||||
|         }); | ||||
|         ofObject.setDuration(z ? 300L : 250L); | ||||
|         ofObject.setInterpolator(ReversableAnimatedValueInterpolator.of(z, AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR)); | ||||
|         return ofObject; | ||||
|     } | ||||
|  | ||||
|     /* renamed from: lambda$getRootViewAnimator$2$com-google-android-material-search-SearchViewAnimationHelper, reason: not valid java name */ | ||||
|     /* synthetic */ void m257xa183b80f(float f, float f2, Rect rect, ValueAnimator valueAnimator) { | ||||
|         this.rootView.updateClipBoundsAndCornerRadius(rect, AnimationUtils.lerp(f, f2, valueAnimator.getAnimatedFraction())); | ||||
|     } | ||||
|  | ||||
|     private Animator getClearButtonAnimator(boolean z) { | ||||
|         ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f); | ||||
|         ofFloat.setDuration(z ? SHOW_CLEAR_BUTTON_ALPHA_DURATION_MS : HIDE_CLEAR_BUTTON_ALPHA_DURATION_MS); | ||||
|         ofFloat.setStartDelay(z ? 250L : 0L); | ||||
|         ofFloat.setInterpolator(ReversableAnimatedValueInterpolator.of(z, AnimationUtils.LINEAR_INTERPOLATOR)); | ||||
|         ofFloat.addUpdateListener(MultiViewUpdateListener.alphaListener(this.clearButton)); | ||||
|         return ofFloat; | ||||
|     } | ||||
|  | ||||
|     private AnimatorSet getButtonsProgressAnimator(boolean z) { | ||||
|         AnimatorSet animatorSet = new AnimatorSet(); | ||||
|         addBackButtonProgressAnimatorIfNeeded(animatorSet); | ||||
|         animatorSet.setDuration(z ? 300L : 250L); | ||||
|         animatorSet.setInterpolator(ReversableAnimatedValueInterpolator.of(z, AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR)); | ||||
|         return animatorSet; | ||||
|     } | ||||
|  | ||||
|     private AnimatorSet getButtonsTranslationAnimator(boolean z) { | ||||
|         AnimatorSet animatorSet = new AnimatorSet(); | ||||
|         addBackButtonTranslationAnimatorIfNeeded(animatorSet); | ||||
|         addActionMenuViewAnimatorIfNeeded(animatorSet); | ||||
|         animatorSet.setDuration(z ? 300L : 250L); | ||||
|         animatorSet.setInterpolator(ReversableAnimatedValueInterpolator.of(z, AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR)); | ||||
|         return animatorSet; | ||||
|     } | ||||
|  | ||||
|     private void addBackButtonTranslationAnimatorIfNeeded(AnimatorSet animatorSet) { | ||||
|         ImageButton navigationIconButton = ToolbarUtils.getNavigationIconButton(this.toolbar); | ||||
|         if (navigationIconButton == null) { | ||||
|             return; | ||||
|         } | ||||
|         ValueAnimator ofFloat = ValueAnimator.ofFloat(getFromTranslationXStart(navigationIconButton), 0.0f); | ||||
|         ofFloat.addUpdateListener(MultiViewUpdateListener.translationXListener(navigationIconButton)); | ||||
|         ValueAnimator ofFloat2 = ValueAnimator.ofFloat(getFromTranslationY(), 0.0f); | ||||
|         ofFloat2.addUpdateListener(MultiViewUpdateListener.translationYListener(navigationIconButton)); | ||||
|         animatorSet.playTogether(ofFloat, ofFloat2); | ||||
|     } | ||||
|  | ||||
|     private void addBackButtonProgressAnimatorIfNeeded(AnimatorSet animatorSet) { | ||||
|         ImageButton navigationIconButton = ToolbarUtils.getNavigationIconButton(this.toolbar); | ||||
|         if (navigationIconButton == null) { | ||||
|             return; | ||||
|         } | ||||
|         Drawable unwrap = DrawableCompat.unwrap(navigationIconButton.getDrawable()); | ||||
|         if (this.searchView.isAnimatedNavigationIcon()) { | ||||
|             addDrawerArrowDrawableAnimatorIfNeeded(animatorSet, unwrap); | ||||
|             addFadeThroughDrawableAnimatorIfNeeded(animatorSet, unwrap); | ||||
|         } else { | ||||
|             setFullDrawableProgressIfNeeded(unwrap); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void addDrawerArrowDrawableAnimatorIfNeeded(AnimatorSet animatorSet, Drawable drawable) { | ||||
|         if (drawable instanceof DrawerArrowDrawable) { | ||||
|             final DrawerArrowDrawable drawerArrowDrawable = (DrawerArrowDrawable) drawable; | ||||
|             ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f); | ||||
|             ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { // from class: com.google.android.material.search.SearchViewAnimationHelper$$ExternalSyntheticLambda4 | ||||
|                 @Override // android.animation.ValueAnimator.AnimatorUpdateListener | ||||
|                 public final void onAnimationUpdate(ValueAnimator valueAnimator) { | ||||
|                     DrawerArrowDrawable.this.setProgress(((Float) valueAnimator.getAnimatedValue()).floatValue()); | ||||
|                 } | ||||
|             }); | ||||
|             animatorSet.playTogether(ofFloat); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void addFadeThroughDrawableAnimatorIfNeeded(AnimatorSet animatorSet, Drawable drawable) { | ||||
|         if (drawable instanceof FadeThroughDrawable) { | ||||
|             final FadeThroughDrawable fadeThroughDrawable = (FadeThroughDrawable) drawable; | ||||
|             ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f); | ||||
|             ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { // from class: com.google.android.material.search.SearchViewAnimationHelper$$ExternalSyntheticLambda3 | ||||
|                 @Override // android.animation.ValueAnimator.AnimatorUpdateListener | ||||
|                 public final void onAnimationUpdate(ValueAnimator valueAnimator) { | ||||
|                     FadeThroughDrawable.this.setProgress(((Float) valueAnimator.getAnimatedValue()).floatValue()); | ||||
|                 } | ||||
|             }); | ||||
|             animatorSet.playTogether(ofFloat); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void setFullDrawableProgressIfNeeded(Drawable drawable) { | ||||
|         if (drawable instanceof DrawerArrowDrawable) { | ||||
|             ((DrawerArrowDrawable) drawable).setProgress(1.0f); | ||||
|         } | ||||
|         if (drawable instanceof FadeThroughDrawable) { | ||||
|             ((FadeThroughDrawable) drawable).setProgress(1.0f); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void addActionMenuViewAnimatorIfNeeded(AnimatorSet animatorSet) { | ||||
|         ActionMenuView actionMenuView = ToolbarUtils.getActionMenuView(this.toolbar); | ||||
|         if (actionMenuView == null) { | ||||
|             return; | ||||
|         } | ||||
|         ValueAnimator ofFloat = ValueAnimator.ofFloat(getFromTranslationXEnd(actionMenuView), 0.0f); | ||||
|         ofFloat.addUpdateListener(MultiViewUpdateListener.translationXListener(actionMenuView)); | ||||
|         ValueAnimator ofFloat2 = ValueAnimator.ofFloat(getFromTranslationY(), 0.0f); | ||||
|         ofFloat2.addUpdateListener(MultiViewUpdateListener.translationYListener(actionMenuView)); | ||||
|         animatorSet.playTogether(ofFloat, ofFloat2); | ||||
|     } | ||||
|  | ||||
|     private Animator getDummyToolbarAnimator(boolean z) { | ||||
|         return getTranslationAnimator(z, false, this.dummyToolbar); | ||||
|     } | ||||
|  | ||||
|     private Animator getHeaderContainerAnimator(boolean z) { | ||||
|         return getTranslationAnimator(z, false, this.headerContainer); | ||||
|     } | ||||
|  | ||||
|     private Animator getActionMenuViewsAlphaAnimator(boolean z) { | ||||
|         ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f); | ||||
|         ofFloat.setDuration(z ? 300L : 250L); | ||||
|         ofFloat.setInterpolator(ReversableAnimatedValueInterpolator.of(z, AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR)); | ||||
|         if (this.searchView.isMenuItemsAnimated()) { | ||||
|             ofFloat.addUpdateListener(new FadeThroughUpdateListener(ToolbarUtils.getActionMenuView(this.dummyToolbar), ToolbarUtils.getActionMenuView(this.toolbar))); | ||||
|         } | ||||
|         return ofFloat; | ||||
|     } | ||||
|  | ||||
|     private Animator getSearchPrefixAnimator(boolean z) { | ||||
|         return getTranslationAnimator(z, true, this.searchPrefix); | ||||
|     } | ||||
|  | ||||
|     private Animator getEditTextAnimator(boolean z) { | ||||
|         return getTranslationAnimator(z, true, this.editText); | ||||
|     } | ||||
|  | ||||
|     private Animator getContentAnimator(boolean z) { | ||||
|         AnimatorSet animatorSet = new AnimatorSet(); | ||||
|         animatorSet.playTogether(getContentAlphaAnimator(z), getDividerAnimator(z), getContentScaleAnimator(z)); | ||||
|         return animatorSet; | ||||
|     } | ||||
|  | ||||
|     private Animator getContentAlphaAnimator(boolean z) { | ||||
|         ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f); | ||||
|         ofFloat.setDuration(z ? 150L : HIDE_CONTENT_ALPHA_DURATION_MS); | ||||
|         ofFloat.setStartDelay(z ? 75L : 0L); | ||||
|         ofFloat.setInterpolator(ReversableAnimatedValueInterpolator.of(z, AnimationUtils.LINEAR_INTERPOLATOR)); | ||||
|         ofFloat.addUpdateListener(MultiViewUpdateListener.alphaListener(this.divider, this.contentContainer)); | ||||
|         return ofFloat; | ||||
|     } | ||||
|  | ||||
|     private Animator getDividerAnimator(boolean z) { | ||||
|         ValueAnimator ofFloat = ValueAnimator.ofFloat((this.contentContainer.getHeight() * 0.050000012f) / 2.0f, 0.0f); | ||||
|         ofFloat.setDuration(z ? 300L : 250L); | ||||
|         ofFloat.setInterpolator(ReversableAnimatedValueInterpolator.of(z, AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR)); | ||||
|         ofFloat.addUpdateListener(MultiViewUpdateListener.translationYListener(this.divider)); | ||||
|         return ofFloat; | ||||
|     } | ||||
|  | ||||
|     private Animator getContentScaleAnimator(boolean z) { | ||||
|         ValueAnimator ofFloat = ValueAnimator.ofFloat(CONTENT_FROM_SCALE, 1.0f); | ||||
|         ofFloat.setDuration(z ? 300L : 250L); | ||||
|         ofFloat.setInterpolator(ReversableAnimatedValueInterpolator.of(z, AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR)); | ||||
|         ofFloat.addUpdateListener(MultiViewUpdateListener.scaleListener(this.contentContainer)); | ||||
|         return ofFloat; | ||||
|     } | ||||
|  | ||||
|     private Animator getTranslationAnimator(boolean z, boolean z2, View view) { | ||||
|         ValueAnimator ofFloat = ValueAnimator.ofFloat(z2 ? getFromTranslationXStart(view) : getFromTranslationXEnd(view), 0.0f); | ||||
|         ofFloat.addUpdateListener(MultiViewUpdateListener.translationXListener(view)); | ||||
|         ValueAnimator ofFloat2 = ValueAnimator.ofFloat(getFromTranslationY(), 0.0f); | ||||
|         ofFloat2.addUpdateListener(MultiViewUpdateListener.translationYListener(view)); | ||||
|         AnimatorSet animatorSet = new AnimatorSet(); | ||||
|         animatorSet.playTogether(ofFloat, ofFloat2); | ||||
|         animatorSet.setDuration(z ? 300L : 250L); | ||||
|         animatorSet.setInterpolator(ReversableAnimatedValueInterpolator.of(z, AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR)); | ||||
|         return animatorSet; | ||||
|     } | ||||
|  | ||||
|     private int getFromTranslationXStart(View view) { | ||||
|         int marginStart = MarginLayoutParamsCompat.getMarginStart((ViewGroup.MarginLayoutParams) view.getLayoutParams()); | ||||
|         int paddingStart = ViewCompat.getPaddingStart(this.searchBar); | ||||
|         if (ViewUtils.isLayoutRtl(this.searchBar)) { | ||||
|             return ((this.searchBar.getWidth() - this.searchBar.getRight()) + marginStart) - paddingStart; | ||||
|         } | ||||
|         return (this.searchBar.getLeft() - marginStart) + paddingStart; | ||||
|     } | ||||
|  | ||||
|     private int getFromTranslationXEnd(View view) { | ||||
|         int marginEnd = MarginLayoutParamsCompat.getMarginEnd((ViewGroup.MarginLayoutParams) view.getLayoutParams()); | ||||
|         if (ViewUtils.isLayoutRtl(this.searchBar)) { | ||||
|             return this.searchBar.getLeft() - marginEnd; | ||||
|         } | ||||
|         return (this.searchBar.getRight() - this.searchView.getWidth()) + marginEnd; | ||||
|     } | ||||
|  | ||||
|     private int getFromTranslationY() { | ||||
|         return ((this.searchBar.getTop() + this.searchBar.getBottom()) / 2) - ((this.toolbarContainer.getTop() + this.toolbarContainer.getBottom()) / 2); | ||||
|     } | ||||
|  | ||||
|     private void setUpDummyToolbarIfNeeded() { | ||||
|         Menu menu = this.dummyToolbar.getMenu(); | ||||
|         if (menu != null) { | ||||
|             menu.clear(); | ||||
|         } | ||||
|         if (this.searchBar.getMenuResId() != -1 && this.searchView.isMenuItemsAnimated()) { | ||||
|             this.dummyToolbar.inflateMenu(this.searchBar.getMenuResId()); | ||||
|             setMenuItemsNotClickable(this.dummyToolbar); | ||||
|             this.dummyToolbar.setVisibility(0); | ||||
|             return; | ||||
|         } | ||||
|         this.dummyToolbar.setVisibility(8); | ||||
|     } | ||||
|  | ||||
|     private void setMenuItemsNotClickable(Toolbar toolbar) { | ||||
|         ActionMenuView actionMenuView = ToolbarUtils.getActionMenuView(toolbar); | ||||
|         if (actionMenuView != null) { | ||||
|             for (int i = 0; i < actionMenuView.getChildCount(); i++) { | ||||
|                 View childAt = actionMenuView.getChildAt(i); | ||||
|                 childAt.setClickable(false); | ||||
|                 childAt.setFocusable(false); | ||||
|                 childAt.setFocusableInTouchMode(false); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void startBackProgress(BackEventCompat backEventCompat) { | ||||
|         this.backHelper.startBackProgress(backEventCompat, this.searchBar); | ||||
|     } | ||||
|  | ||||
|     public void updateBackProgress(BackEventCompat backEventCompat) { | ||||
|         if (backEventCompat.getProgress() <= 0.0f) { | ||||
|             return; | ||||
|         } | ||||
|         MaterialMainContainerBackHelper materialMainContainerBackHelper = this.backHelper; | ||||
|         SearchBar searchBar = this.searchBar; | ||||
|         materialMainContainerBackHelper.updateBackProgress(backEventCompat, searchBar, searchBar.getCornerSize()); | ||||
|         AnimatorSet animatorSet = this.backProgressAnimatorSet; | ||||
|         if (animatorSet == null) { | ||||
|             if (this.searchView.isAdjustNothingSoftInputMode()) { | ||||
|                 this.searchView.clearFocusAndHideKeyboard(); | ||||
|             } | ||||
|             if (this.searchView.isAnimatedNavigationIcon()) { | ||||
|                 AnimatorSet buttonsProgressAnimator = getButtonsProgressAnimator(false); | ||||
|                 this.backProgressAnimatorSet = buttonsProgressAnimator; | ||||
|                 buttonsProgressAnimator.start(); | ||||
|                 this.backProgressAnimatorSet.pause(); | ||||
|                 return; | ||||
|             } | ||||
|             return; | ||||
|         } | ||||
|         animatorSet.setCurrentPlayTime((long) (backEventCompat.getProgress() * this.backProgressAnimatorSet.getDuration())); | ||||
|     } | ||||
|  | ||||
|     public BackEventCompat onHandleBackInvoked() { | ||||
|         return this.backHelper.onHandleBackInvoked(); | ||||
|     } | ||||
|  | ||||
|     public void finishBackProgress() { | ||||
|         long totalDuration; | ||||
|         totalDuration = hide().getTotalDuration(); | ||||
|         this.backHelper.finishBackProgress(totalDuration, this.searchBar); | ||||
|         if (this.backProgressAnimatorSet != null) { | ||||
|             getButtonsTranslationAnimator(false).start(); | ||||
|             this.backProgressAnimatorSet.resume(); | ||||
|         } | ||||
|         this.backProgressAnimatorSet = null; | ||||
|     } | ||||
|  | ||||
|     public void cancelBackProgress() { | ||||
|         this.backHelper.cancelBackProgress(this.searchBar); | ||||
|         AnimatorSet animatorSet = this.backProgressAnimatorSet; | ||||
|         if (animatorSet != null) { | ||||
|             animatorSet.reverse(); | ||||
|         } | ||||
|         this.backProgressAnimatorSet = null; | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user