alexandroid/decompiled/jadx/sources/androidx/transition/Scene.java
KaKi87 a47fad5135 📦 Add decompiled Alexa 2.2.730155.0 (jadx, apktool, Hermes strings)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 00:04:16 +01:00

104 lines
3.1 KiB
Java

package androidx.transition;
import android.content.Context;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
/* loaded from: classes14.dex */
public class Scene {
private Context mContext;
private Runnable mEnterAction;
private Runnable mExitAction;
private View mLayout;
private int mLayoutId;
private ViewGroup mSceneRoot;
public Scene(@NonNull ViewGroup viewGroup, @NonNull View view) {
this.mLayoutId = -1;
this.mSceneRoot = viewGroup;
this.mLayout = view;
}
@Nullable
public static Scene getCurrentScene(@NonNull ViewGroup viewGroup) {
return (Scene) viewGroup.getTag(R.id.transition_current_scene);
}
@NonNull
public static Scene getSceneForLayout(@NonNull ViewGroup viewGroup, @LayoutRes int i, @NonNull Context context) {
SparseArray sparseArray = (SparseArray) viewGroup.getTag(R.id.transition_scene_layoutid_cache);
if (sparseArray == null) {
sparseArray = new SparseArray();
viewGroup.setTag(R.id.transition_scene_layoutid_cache, sparseArray);
}
Scene scene = (Scene) sparseArray.get(i);
if (scene != null) {
return scene;
}
Scene scene2 = new Scene(viewGroup, i, context);
sparseArray.put(i, scene2);
return scene2;
}
public static void setCurrentScene(@NonNull ViewGroup viewGroup, @Nullable Scene scene) {
viewGroup.setTag(R.id.transition_current_scene, scene);
}
public void enter() {
if (this.mLayoutId > 0 || this.mLayout != null) {
getSceneRoot().removeAllViews();
if (this.mLayoutId > 0) {
LayoutInflater.from(this.mContext).inflate(this.mLayoutId, this.mSceneRoot);
} else {
this.mSceneRoot.addView(this.mLayout);
}
}
Runnable runnable = this.mEnterAction;
if (runnable != null) {
runnable.run();
}
setCurrentScene(this.mSceneRoot, this);
}
public void exit() {
Runnable runnable;
if (getCurrentScene(this.mSceneRoot) != this || (runnable = this.mExitAction) == null) {
return;
}
runnable.run();
}
@NonNull
public ViewGroup getSceneRoot() {
return this.mSceneRoot;
}
public boolean isCreatedFromLayoutResource() {
return this.mLayoutId > 0;
}
public void setEnterAction(@Nullable Runnable runnable) {
this.mEnterAction = runnable;
}
public void setExitAction(@Nullable Runnable runnable) {
this.mExitAction = runnable;
}
private Scene(ViewGroup viewGroup, int i, Context context) {
this.mContext = context;
this.mSceneRoot = viewGroup;
this.mLayoutId = i;
}
public Scene(@NonNull ViewGroup viewGroup) {
this.mLayoutId = -1;
this.mSceneRoot = viewGroup;
}
}