package com.discord.views; import android.content.Context; import android.util.AttributeSet; import com.google.android.material.appbar.AppBarLayout; import d0.z.d.m; import d0.z.d.o; import kotlin.Unit; import kotlin.jvm.functions.Function1; /* compiled from: CustomAppBarLayout.kt */ public final class CustomAppBarLayout extends AppBarLayout { public float i; public final AppBarLayout.OnOffsetChangedListener j = new b(this); public Function1 k = a.i; /* compiled from: CustomAppBarLayout.kt */ public static final class a extends o implements Function1 { public static final a i = new a(); public a() { super(1); } /* Return type fixed from 'java.lang.Object' to match base method */ /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // kotlin.jvm.functions.Function1 public Unit invoke(Float f) { f.floatValue(); return Unit.a; } } /* compiled from: CustomAppBarLayout.kt */ public static final class b implements AppBarLayout.OnOffsetChangedListener { public final /* synthetic */ CustomAppBarLayout a; public b(CustomAppBarLayout customAppBarLayout) { this.a = customAppBarLayout; } @Override // com.google.android.material.appbar.AppBarLayout.OnOffsetChangedListener, com.google.android.material.appbar.AppBarLayout.BaseOnOffsetChangedListener public final void onOffsetChanged(AppBarLayout appBarLayout, int i) { m.checkNotNullExpressionValue(appBarLayout, "appBar"); float abs = appBarLayout.getTotalScrollRange() <= 0 ? 1.0f : ((float) Math.abs(i)) / ((float) appBarLayout.getTotalScrollRange()); CustomAppBarLayout customAppBarLayout = this.a; if (abs != customAppBarLayout.i) { customAppBarLayout.i = abs; customAppBarLayout.k.invoke(Float.valueOf(abs)); } } } /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public CustomAppBarLayout(Context context, AttributeSet attributeSet) { super(context, attributeSet); m.checkNotNullParameter(context, "context"); } public final boolean a() { return this.i == 1.0f; } @Override // com.google.android.material.appbar.AppBarLayout, android.view.View, android.view.ViewGroup public void onAttachedToWindow() { super.onAttachedToWindow(); addOnOffsetChangedListener(this.j); } @Override // com.google.android.material.appbar.AppBarLayout, android.view.View, android.view.ViewGroup public void onDetachedFromWindow() { removeOnOffsetChangedListener(this.j); super.onDetachedFromWindow(); } public final void setOnPercentCollapsedCallback(Function1 function1) { m.checkNotNullParameter(function1, "callback"); this.k = function1; } }