ADD week 5
This commit is contained in:
		
							
								
								
									
										172
									
								
								02-Easy5/E5/sources/androidx/activity/ComponentDialog.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										172
									
								
								02-Easy5/E5/sources/androidx/activity/ComponentDialog.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,172 @@ | ||||
| package androidx.activity; | ||||
|  | ||||
| import android.app.Dialog; | ||||
| import android.content.Context; | ||||
| import android.os.Build; | ||||
| import android.os.Bundle; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import android.view.Window; | ||||
| import android.window.OnBackInvokedDispatcher; | ||||
| import androidx.lifecycle.Lifecycle; | ||||
| import androidx.lifecycle.LifecycleOwner; | ||||
| import androidx.lifecycle.LifecycleRegistry; | ||||
| import androidx.lifecycle.ViewTreeLifecycleOwner; | ||||
| import androidx.savedstate.SavedStateRegistry; | ||||
| import androidx.savedstate.SavedStateRegistryController; | ||||
| import androidx.savedstate.SavedStateRegistryOwner; | ||||
| import androidx.savedstate.ViewTreeSavedStateRegistryOwner; | ||||
| import kotlin.Metadata; | ||||
| import kotlin.jvm.internal.DefaultConstructorMarker; | ||||
| import kotlin.jvm.internal.Intrinsics; | ||||
|  | ||||
| /* compiled from: ComponentDialog.kt */ | ||||
| @Metadata(d1 = {"\u0000d\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0006\b\u0016\u0018\u00002\u00020\u00012\u00020\u00022\u00020\u00032\u00020\u0004B\u0019\b\u0007\u0012\u0006\u0010\u0005\u001a\u00020\u0006\u0012\b\b\u0003\u0010\u0007\u001a\u00020\b¢\u0006\u0002\u0010\tJ\u001a\u0010\u001f\u001a\u00020 2\u0006\u0010!\u001a\u00020\"2\b\u0010#\u001a\u0004\u0018\u00010$H\u0016J\b\u0010%\u001a\u00020 H\u0017J\b\u0010&\u001a\u00020 H\u0017J\u0012\u0010'\u001a\u00020 2\b\u0010(\u001a\u0004\u0018\u00010)H\u0015J\b\u0010*\u001a\u00020)H\u0016J\b\u0010+\u001a\u00020 H\u0015J\b\u0010,\u001a\u00020 H\u0015J\u0010\u0010-\u001a\u00020 2\u0006\u0010!\u001a\u00020\"H\u0016J\u001a\u0010-\u001a\u00020 2\u0006\u0010!\u001a\u00020\"2\b\u0010#\u001a\u0004\u0018\u00010$H\u0016J\u0010\u0010-\u001a\u00020 2\u0006\u0010.\u001a\u00020\bH\u0016R\u0010\u0010\n\u001a\u0004\u0018\u00010\u000bX\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\f\u001a\u00020\r8VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u000e\u0010\u000fR\u0014\u0010\u0010\u001a\u00020\u000b8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u0011\u0010\u0012R\u0017\u0010\u0013\u001a\u00020\u0014¢\u0006\u000e\n\u0000\u0012\u0004\b\u0015\u0010\u0016\u001a\u0004\b\u0017\u0010\u0018R\u0014\u0010\u0019\u001a\u00020\u001a8VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u001b\u0010\u001cR\u000e\u0010\u001d\u001a\u00020\u001eX\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006/"}, d2 = {"Landroidx/activity/ComponentDialog;", "Landroid/app/Dialog;", "Landroidx/lifecycle/LifecycleOwner;", "Landroidx/activity/OnBackPressedDispatcherOwner;", "Landroidx/savedstate/SavedStateRegistryOwner;", "context", "Landroid/content/Context;", "themeResId", "", "(Landroid/content/Context;I)V", "_lifecycleRegistry", "Landroidx/lifecycle/LifecycleRegistry;", "lifecycle", "Landroidx/lifecycle/Lifecycle;", "getLifecycle", "()Landroidx/lifecycle/Lifecycle;", "lifecycleRegistry", "getLifecycleRegistry", "()Landroidx/lifecycle/LifecycleRegistry;", "onBackPressedDispatcher", "Landroidx/activity/OnBackPressedDispatcher;", "getOnBackPressedDispatcher$annotations", "()V", "getOnBackPressedDispatcher", "()Landroidx/activity/OnBackPressedDispatcher;", "savedStateRegistry", "Landroidx/savedstate/SavedStateRegistry;", "getSavedStateRegistry", "()Landroidx/savedstate/SavedStateRegistry;", "savedStateRegistryController", "Landroidx/savedstate/SavedStateRegistryController;", "addContentView", "", "view", "Landroid/view/View;", "params", "Landroid/view/ViewGroup$LayoutParams;", "initializeViewTreeOwners", "onBackPressed", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onSaveInstanceState", "onStart", "onStop", "setContentView", "layoutResID", "activity_release"}, k = 1, mv = {1, 8, 0}, xi = 48) | ||||
| /* loaded from: classes.dex */ | ||||
| public class ComponentDialog extends Dialog implements LifecycleOwner, OnBackPressedDispatcherOwner, SavedStateRegistryOwner { | ||||
|     private LifecycleRegistry _lifecycleRegistry; | ||||
|     private final OnBackPressedDispatcher onBackPressedDispatcher; | ||||
|     private final SavedStateRegistryController savedStateRegistryController; | ||||
|  | ||||
|     /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */ | ||||
|     public ComponentDialog(Context context) { | ||||
|         this(context, 0, 2, null); | ||||
|         Intrinsics.checkNotNullParameter(context, "context"); | ||||
|     } | ||||
|  | ||||
|     public static /* synthetic */ void getOnBackPressedDispatcher$annotations() { | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.activity.OnBackPressedDispatcherOwner | ||||
|     public final OnBackPressedDispatcher getOnBackPressedDispatcher() { | ||||
|         return this.onBackPressedDispatcher; | ||||
|     } | ||||
|  | ||||
|     public /* synthetic */ ComponentDialog(Context context, int i, int i2, DefaultConstructorMarker defaultConstructorMarker) { | ||||
|         this(context, (i2 & 2) != 0 ? 0 : i); | ||||
|     } | ||||
|  | ||||
|     /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ | ||||
|     public ComponentDialog(Context context, int i) { | ||||
|         super(context, i); | ||||
|         Intrinsics.checkNotNullParameter(context, "context"); | ||||
|         this.savedStateRegistryController = SavedStateRegistryController.INSTANCE.create(this); | ||||
|         this.onBackPressedDispatcher = new OnBackPressedDispatcher(new Runnable() { // from class: androidx.activity.ComponentDialog$$ExternalSyntheticLambda1 | ||||
|             @Override // java.lang.Runnable | ||||
|             public final void run() { | ||||
|                 ComponentDialog.onBackPressedDispatcher$lambda$1(ComponentDialog.this); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     private final LifecycleRegistry getLifecycleRegistry() { | ||||
|         LifecycleRegistry lifecycleRegistry = this._lifecycleRegistry; | ||||
|         if (lifecycleRegistry != null) { | ||||
|             return lifecycleRegistry; | ||||
|         } | ||||
|         LifecycleRegistry lifecycleRegistry2 = new LifecycleRegistry(this); | ||||
|         this._lifecycleRegistry = lifecycleRegistry2; | ||||
|         return lifecycleRegistry2; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.savedstate.SavedStateRegistryOwner | ||||
|     public SavedStateRegistry getSavedStateRegistry() { | ||||
|         return this.savedStateRegistryController.getSavedStateRegistry(); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.lifecycle.LifecycleOwner | ||||
|     public Lifecycle getLifecycle() { | ||||
|         return getLifecycleRegistry(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.app.Dialog | ||||
|     public Bundle onSaveInstanceState() { | ||||
|         Bundle onSaveInstanceState = super.onSaveInstanceState(); | ||||
|         Intrinsics.checkNotNullExpressionValue(onSaveInstanceState, "super.onSaveInstanceState()"); | ||||
|         this.savedStateRegistryController.performSave(onSaveInstanceState); | ||||
|         return onSaveInstanceState; | ||||
|     } | ||||
|  | ||||
|     @Override // android.app.Dialog | ||||
|     protected void onCreate(Bundle savedInstanceState) { | ||||
|         OnBackInvokedDispatcher onBackInvokedDispatcher; | ||||
|         super.onCreate(savedInstanceState); | ||||
|         if (Build.VERSION.SDK_INT >= 33) { | ||||
|             OnBackPressedDispatcher onBackPressedDispatcher = this.onBackPressedDispatcher; | ||||
|             onBackInvokedDispatcher = getOnBackInvokedDispatcher(); | ||||
|             Intrinsics.checkNotNullExpressionValue(onBackInvokedDispatcher, "onBackInvokedDispatcher"); | ||||
|             onBackPressedDispatcher.setOnBackInvokedDispatcher(onBackInvokedDispatcher); | ||||
|         } | ||||
|         this.savedStateRegistryController.performRestore(savedInstanceState); | ||||
|         getLifecycleRegistry().handleLifecycleEvent(Lifecycle.Event.ON_CREATE); | ||||
|     } | ||||
|  | ||||
|     @Override // android.app.Dialog | ||||
|     protected void onStart() { | ||||
|         super.onStart(); | ||||
|         getLifecycleRegistry().handleLifecycleEvent(Lifecycle.Event.ON_RESUME); | ||||
|     } | ||||
|  | ||||
|     @Override // android.app.Dialog | ||||
|     protected void onStop() { | ||||
|         getLifecycleRegistry().handleLifecycleEvent(Lifecycle.Event.ON_DESTROY); | ||||
|         this._lifecycleRegistry = null; | ||||
|         super.onStop(); | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     public static final void onBackPressedDispatcher$lambda$1(ComponentDialog this$0) { | ||||
|         Intrinsics.checkNotNullParameter(this$0, "this$0"); | ||||
|         super.onBackPressed(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.app.Dialog | ||||
|     public void onBackPressed() { | ||||
|         this.onBackPressedDispatcher.onBackPressed(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.app.Dialog | ||||
|     public void setContentView(int layoutResID) { | ||||
|         initializeViewTreeOwners(); | ||||
|         super.setContentView(layoutResID); | ||||
|     } | ||||
|  | ||||
|     @Override // android.app.Dialog | ||||
|     public void setContentView(View view) { | ||||
|         Intrinsics.checkNotNullParameter(view, "view"); | ||||
|         initializeViewTreeOwners(); | ||||
|         super.setContentView(view); | ||||
|     } | ||||
|  | ||||
|     @Override // android.app.Dialog | ||||
|     public void setContentView(View view, ViewGroup.LayoutParams params) { | ||||
|         Intrinsics.checkNotNullParameter(view, "view"); | ||||
|         initializeViewTreeOwners(); | ||||
|         super.setContentView(view, params); | ||||
|     } | ||||
|  | ||||
|     @Override // android.app.Dialog | ||||
|     public void addContentView(View view, ViewGroup.LayoutParams params) { | ||||
|         Intrinsics.checkNotNullParameter(view, "view"); | ||||
|         initializeViewTreeOwners(); | ||||
|         super.addContentView(view, params); | ||||
|     } | ||||
|  | ||||
|     public void initializeViewTreeOwners() { | ||||
|         Window window = getWindow(); | ||||
|         Intrinsics.checkNotNull(window); | ||||
|         View decorView = window.getDecorView(); | ||||
|         Intrinsics.checkNotNullExpressionValue(decorView, "window!!.decorView"); | ||||
|         ViewTreeLifecycleOwner.set(decorView, this); | ||||
|         Window window2 = getWindow(); | ||||
|         Intrinsics.checkNotNull(window2); | ||||
|         View decorView2 = window2.getDecorView(); | ||||
|         Intrinsics.checkNotNullExpressionValue(decorView2, "window!!.decorView"); | ||||
|         ViewTreeOnBackPressedDispatcherOwner.set(decorView2, this); | ||||
|         Window window3 = getWindow(); | ||||
|         Intrinsics.checkNotNull(window3); | ||||
|         View decorView3 = window3.getDecorView(); | ||||
|         Intrinsics.checkNotNullExpressionValue(decorView3, "window!!.decorView"); | ||||
|         ViewTreeSavedStateRegistryOwner.set(decorView3, this); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user