300 lines
11 KiB
Java
300 lines
11 KiB
Java
package androidx.fragment.app;
|
|
|
|
import android.animation.LayoutTransition;
|
|
import android.content.Context;
|
|
import android.content.res.TypedArray;
|
|
import android.graphics.Canvas;
|
|
import android.os.Bundle;
|
|
import android.util.AttributeSet;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.view.WindowInsets;
|
|
import android.widget.FrameLayout;
|
|
import androidx.core.view.ViewCompat;
|
|
import androidx.core.view.WindowInsetsCompat;
|
|
import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import o.AbstractC13482fbE;
|
|
import o.C14957gcv;
|
|
import o.IUF;
|
|
import o.yRS;
|
|
import org.simpleframework.xml.strategy.Name;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class FragmentContainerView extends FrameLayout {
|
|
private final List<View> a;
|
|
private final List<View> c;
|
|
private View.OnApplyWindowInsetsListener d;
|
|
private boolean e;
|
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
public FragmentContainerView(Context context) {
|
|
super(context);
|
|
C14957gcv.e(context, "");
|
|
this.c = new ArrayList();
|
|
this.a = new ArrayList();
|
|
this.e = true;
|
|
}
|
|
|
|
private /* synthetic */ FragmentContainerView(Context context, AttributeSet attributeSet, byte b) {
|
|
this(context, attributeSet, 0);
|
|
}
|
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
public FragmentContainerView(Context context, AttributeSet attributeSet, int i) {
|
|
super(context, attributeSet, i);
|
|
String str;
|
|
C14957gcv.e(context, "");
|
|
this.c = new ArrayList();
|
|
this.a = new ArrayList();
|
|
this.e = true;
|
|
if (attributeSet != null) {
|
|
String classAttribute = attributeSet.getClassAttribute();
|
|
int[] iArr = IUF.LWm.FragmentContainerView;
|
|
C14957gcv.c(iArr, "");
|
|
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, iArr, 0, 0);
|
|
if (classAttribute == null) {
|
|
classAttribute = obtainStyledAttributes.getString(IUF.LWm.FragmentContainerView_android_name);
|
|
str = "android:name";
|
|
} else {
|
|
str = Name.LABEL;
|
|
}
|
|
obtainStyledAttributes.recycle();
|
|
if (classAttribute == null || isInEditMode()) {
|
|
return;
|
|
}
|
|
StringBuilder sb = new StringBuilder("FragmentContainerView must be within a FragmentActivity to use ");
|
|
sb.append(str);
|
|
sb.append("=\"");
|
|
sb.append(classAttribute);
|
|
sb.append('\"');
|
|
throw new UnsupportedOperationException(sb.toString());
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
public FragmentContainerView(Context context, AttributeSet attributeSet, yRS yrs) {
|
|
super(context, attributeSet);
|
|
C14957gcv.e(context, "");
|
|
C14957gcv.e(attributeSet, "");
|
|
C14957gcv.e(yrs, "");
|
|
this.c = new ArrayList();
|
|
this.a = new ArrayList();
|
|
this.e = true;
|
|
String classAttribute = attributeSet.getClassAttribute();
|
|
int[] iArr = IUF.LWm.FragmentContainerView;
|
|
C14957gcv.c(iArr, "");
|
|
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, iArr, 0, 0);
|
|
classAttribute = classAttribute == null ? obtainStyledAttributes.getString(IUF.LWm.FragmentContainerView_android_name) : classAttribute;
|
|
String string = obtainStyledAttributes.getString(IUF.LWm.FragmentContainerView_android_tag);
|
|
obtainStyledAttributes.recycle();
|
|
int id = getId();
|
|
Fragment findFragmentById = yrs.findFragmentById(id);
|
|
if (classAttribute != null && findFragmentById == null) {
|
|
if (id == -1) {
|
|
String concat = string != null ? " with tag ".concat(String.valueOf(string)) : "";
|
|
StringBuilder sb = new StringBuilder("FragmentContainerView must have an android:id to add Fragment ");
|
|
sb.append(classAttribute);
|
|
sb.append(concat);
|
|
throw new IllegalStateException(sb.toString());
|
|
}
|
|
Fragment instantiate = yrs.p().instantiate(context.getClassLoader(), classAttribute);
|
|
C14957gcv.c(instantiate, "");
|
|
instantiate.onInflate(context, attributeSet, (Bundle) null);
|
|
AbstractC13482fbE a = yrs.a();
|
|
a.r = true;
|
|
FragmentContainerView fragmentContainerView = this;
|
|
instantiate.mContainer = fragmentContainerView;
|
|
a.b(fragmentContainerView.getId(), instantiate, string, 1);
|
|
a.e();
|
|
}
|
|
yrs.c(this);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public final void setLayoutTransition(LayoutTransition layoutTransition) {
|
|
throw new UnsupportedOperationException("FragmentContainerView does not support Layout Transitions or animateLayoutChanges=\"true\".");
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public final WindowInsets dispatchApplyWindowInsets(WindowInsets windowInsets) {
|
|
WindowInsetsCompat e;
|
|
C14957gcv.e(windowInsets, "");
|
|
WindowInsetsCompat tG_ = WindowInsetsCompat.tG_(windowInsets);
|
|
C14957gcv.c(tG_, "");
|
|
if (this.d != null) {
|
|
LWm lWm = LWm.e;
|
|
View.OnApplyWindowInsetsListener onApplyWindowInsetsListener = this.d;
|
|
C14957gcv.e(onApplyWindowInsetsListener);
|
|
e = WindowInsetsCompat.tG_(lWm.yk_(onApplyWindowInsetsListener, this, windowInsets));
|
|
} else {
|
|
e = ViewCompat.e(this, tG_);
|
|
}
|
|
C14957gcv.c(e, "");
|
|
if (!e.h()) {
|
|
int childCount = getChildCount();
|
|
for (int i = 0; i < childCount; i++) {
|
|
ViewCompat.b(getChildAt(i), e);
|
|
}
|
|
}
|
|
return windowInsets;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
protected final void dispatchDraw(Canvas canvas) {
|
|
C14957gcv.e(canvas, "");
|
|
if (this.e) {
|
|
Iterator<T> it = this.c.iterator();
|
|
while (it.hasNext()) {
|
|
super.drawChild(canvas, (View) it.next(), getDrawingTime());
|
|
}
|
|
}
|
|
super.dispatchDraw(canvas);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
protected final boolean drawChild(Canvas canvas, View view, long j) {
|
|
C14957gcv.e(canvas, "");
|
|
C14957gcv.e(view, "");
|
|
if (this.e && (!this.c.isEmpty()) && this.c.contains(view)) {
|
|
return false;
|
|
}
|
|
return super.drawChild(canvas, view, j);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public final void startViewTransition(View view) {
|
|
C14957gcv.e(view, "");
|
|
if (view.getParent() == this) {
|
|
this.a.add(view);
|
|
}
|
|
super.startViewTransition(view);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public final void endViewTransition(View view) {
|
|
C14957gcv.e(view, "");
|
|
this.a.remove(view);
|
|
if (this.c.remove(view)) {
|
|
this.e = true;
|
|
}
|
|
super.endViewTransition(view);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public final void addView(View view, int i, ViewGroup.LayoutParams layoutParams) {
|
|
C14957gcv.e(view, "");
|
|
if (yRS.d(view) == null) {
|
|
StringBuilder sb = new StringBuilder("Views added to a FragmentContainerView must be associated with a Fragment. View ");
|
|
sb.append(view);
|
|
sb.append(" is not associated with a Fragment.");
|
|
throw new IllegalStateException(sb.toString().toString());
|
|
}
|
|
super.addView(view, i, layoutParams);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public final void removeViewAt(int i) {
|
|
View childAt = getChildAt(i);
|
|
C14957gcv.c(childAt, "");
|
|
if (this.a.contains(childAt)) {
|
|
this.c.add(childAt);
|
|
}
|
|
super.removeViewAt(i);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public final void removeViewInLayout(View view) {
|
|
C14957gcv.e(view, "");
|
|
if (this.a.contains(view)) {
|
|
this.c.add(view);
|
|
}
|
|
super.removeViewInLayout(view);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewManager
|
|
public final void removeView(View view) {
|
|
C14957gcv.e(view, "");
|
|
if (this.a.contains(view)) {
|
|
this.c.add(view);
|
|
}
|
|
super.removeView(view);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public final void removeViews(int i, int i2) {
|
|
for (int i3 = i; i3 < i + i2; i3++) {
|
|
View childAt = getChildAt(i3);
|
|
C14957gcv.c(childAt, "");
|
|
if (this.a.contains(childAt)) {
|
|
this.c.add(childAt);
|
|
}
|
|
}
|
|
super.removeViews(i, i2);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public final void removeViewsInLayout(int i, int i2) {
|
|
for (int i3 = i; i3 < i + i2; i3++) {
|
|
View childAt = getChildAt(i3);
|
|
C14957gcv.c(childAt, "");
|
|
if (this.a.contains(childAt)) {
|
|
this.c.add(childAt);
|
|
}
|
|
}
|
|
super.removeViewsInLayout(i, i2);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public final void removeAllViewsInLayout() {
|
|
for (int childCount = getChildCount() - 1; childCount >= 0; childCount--) {
|
|
View childAt = getChildAt(childCount);
|
|
C14957gcv.c(childAt, "");
|
|
if (this.a.contains(childAt)) {
|
|
this.c.add(childAt);
|
|
}
|
|
}
|
|
super.removeAllViewsInLayout();
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
public static final class LWm {
|
|
public static final LWm e = new LWm();
|
|
|
|
private LWm() {
|
|
}
|
|
|
|
public final WindowInsets yk_(View.OnApplyWindowInsetsListener onApplyWindowInsetsListener, View view, WindowInsets windowInsets) {
|
|
C14957gcv.e(onApplyWindowInsetsListener, "");
|
|
C14957gcv.e(view, "");
|
|
C14957gcv.e(windowInsets, "");
|
|
WindowInsets onApplyWindowInsets = onApplyWindowInsetsListener.onApplyWindowInsets(view, windowInsets);
|
|
C14957gcv.c(onApplyWindowInsets, "");
|
|
return onApplyWindowInsets;
|
|
}
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public final void setOnApplyWindowInsetsListener(View.OnApplyWindowInsetsListener onApplyWindowInsetsListener) {
|
|
C14957gcv.e(onApplyWindowInsetsListener, "");
|
|
this.d = onApplyWindowInsetsListener;
|
|
}
|
|
|
|
public final void setDrawDisappearingViewsLast(boolean z) {
|
|
this.e = z;
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public final WindowInsets onApplyWindowInsets(WindowInsets windowInsets) {
|
|
C14957gcv.e(windowInsets, "");
|
|
return windowInsets;
|
|
}
|
|
|
|
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
|
|
public FragmentContainerView(Context context, AttributeSet attributeSet) {
|
|
this(context, attributeSet, (byte) 0);
|
|
C14957gcv.e(context, "");
|
|
}
|
|
}
|