ADD week 5
This commit is contained in:
		| @@ -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); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user