discord-jadx/app/src/main/java/com/discord/utilities/views/ContentResizingCoordinatorL...

130 lines
6.2 KiB
Java

package com.discord.utilities.views;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import com.discord.utilities.view.extensions.ViewExtensions;
import com.google.android.material.appbar.AppBarLayout;
import d0.z.d.m;
import java.util.Objects;
import kotlin.jvm.internal.DefaultConstructorMarker;
/* compiled from: ContentResizingCoordinatorLayout.kt */
public final class ContentResizingCoordinatorLayout extends CoordinatorLayout {
private AppBarLayout appBarLayout;
private View content;
private int currentVerticalOffset;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public ContentResizingCoordinatorLayout(Context context) {
super(context);
m.checkNotNullParameter(context, "context");
}
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public ContentResizingCoordinatorLayout(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
m.checkNotNullParameter(context, "context");
}
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public ContentResizingCoordinatorLayout(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
m.checkNotNullParameter(context, "context");
}
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
public /* synthetic */ ContentResizingCoordinatorLayout(Context context, AttributeSet attributeSet, int i, int i2, DefaultConstructorMarker defaultConstructorMarker) {
this(context, (i2 & 2) != 0 ? null : attributeSet, (i2 & 4) != 0 ? 0 : i);
}
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
public /* synthetic */ ContentResizingCoordinatorLayout(Context context, AttributeSet attributeSet, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(context, (i & 2) != 0 ? null : attributeSet);
}
public static final /* synthetic */ AppBarLayout access$getAppBarLayout$p(ContentResizingCoordinatorLayout contentResizingCoordinatorLayout) {
AppBarLayout appBarLayout = contentResizingCoordinatorLayout.appBarLayout;
if (appBarLayout == null) {
m.throwUninitializedPropertyAccessException("appBarLayout");
}
return appBarLayout;
}
public static final /* synthetic */ int access$getCurrentVerticalOffset$p(ContentResizingCoordinatorLayout contentResizingCoordinatorLayout) {
return contentResizingCoordinatorLayout.currentVerticalOffset;
}
public static final /* synthetic */ void access$setAppBarLayout$p(ContentResizingCoordinatorLayout contentResizingCoordinatorLayout, AppBarLayout appBarLayout) {
contentResizingCoordinatorLayout.appBarLayout = appBarLayout;
}
public static final /* synthetic */ void access$setCurrentVerticalOffset$p(ContentResizingCoordinatorLayout contentResizingCoordinatorLayout, int i) {
contentResizingCoordinatorLayout.currentVerticalOffset = i;
}
public static final /* synthetic */ void access$updateContentLayoutParams(ContentResizingCoordinatorLayout contentResizingCoordinatorLayout, int i, int i2, int i3, int i4, int i5) {
contentResizingCoordinatorLayout.updateContentLayoutParams(i, i2, i3, i4, i5);
}
private final void updateContentLayoutParams(int i, int i2, int i3, int i4, int i5) {
int i6 = i2 + i;
View view = this.content;
if (view == null) {
m.throwUninitializedPropertyAccessException("content");
}
ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
layoutParams.height = i3 - i6;
View view2 = this.content;
if (view2 == null) {
m.throwUninitializedPropertyAccessException("content");
}
view2.setLayoutParams(layoutParams);
View view3 = this.content;
if (view3 == null) {
m.throwUninitializedPropertyAccessException("content");
}
measureChild(view3, i4, i5);
}
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout, android.view.View
public void onMeasure(int i, int i2) {
int size = View.MeasureSpec.getSize(i2);
if (this.appBarLayout == null && getChildCount() >= 2) {
View childAt = getChildAt(0);
Objects.requireNonNull(childAt, "null cannot be cast to non-null type com.google.android.material.appbar.AppBarLayout");
this.appBarLayout = (AppBarLayout) childAt;
View childAt2 = getChildAt(1);
Objects.requireNonNull(childAt2, "null cannot be cast to non-null type android.view.View");
this.content = childAt2;
AppBarLayout appBarLayout = this.appBarLayout;
if (appBarLayout == null) {
m.throwUninitializedPropertyAccessException("appBarLayout");
}
measureChild(appBarLayout, i, i2);
AppBarLayout appBarLayout2 = this.appBarLayout;
if (appBarLayout2 == null) {
m.throwUninitializedPropertyAccessException("appBarLayout");
}
appBarLayout2.offsetTopAndBottom(0);
AppBarLayout appBarLayout3 = this.appBarLayout;
if (appBarLayout3 == null) {
m.throwUninitializedPropertyAccessException("appBarLayout");
}
updateContentLayoutParams(0, appBarLayout3.getMeasuredHeight(), size, i, i2);
AppBarLayout appBarLayout4 = this.appBarLayout;
if (appBarLayout4 == null) {
m.throwUninitializedPropertyAccessException("appBarLayout");
}
appBarLayout4.addOnOffsetChangedListener((AppBarLayout.OnOffsetChangedListener) new ContentResizingCoordinatorLayout$onMeasure$2(this, i, i2));
AppBarLayout appBarLayout5 = this.appBarLayout;
if (appBarLayout5 == null) {
m.throwUninitializedPropertyAccessException("appBarLayout");
}
ViewExtensions.addOnHeightChangedListener(appBarLayout5, new ContentResizingCoordinatorLayout$onMeasure$3(this, i, i2));
}
super.onMeasure(i, i2);
}
}