79 lines
3 KiB
Java
79 lines
3 KiB
Java
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 j;
|
|
public final AppBarLayout.OnOffsetChangedListener k = new b(this);
|
|
public Function1<? super Float, Unit> l = a.j;
|
|
|
|
/* compiled from: CustomAppBarLayout.kt */
|
|
public static final class a extends o implements Function1<Float, Unit> {
|
|
public static final a j = 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.j) {
|
|
customAppBarLayout.j = abs;
|
|
customAppBarLayout.l.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.j == 1.0f;
|
|
}
|
|
|
|
@Override // com.google.android.material.appbar.AppBarLayout, android.view.View, android.view.ViewGroup
|
|
public void onAttachedToWindow() {
|
|
super.onAttachedToWindow();
|
|
addOnOffsetChangedListener(this.k);
|
|
}
|
|
|
|
@Override // com.google.android.material.appbar.AppBarLayout, android.view.View, android.view.ViewGroup
|
|
public void onDetachedFromWindow() {
|
|
removeOnOffsetChangedListener(this.k);
|
|
super.onDetachedFromWindow();
|
|
}
|
|
|
|
public final void setOnPercentCollapsedCallback(Function1<? super Float, Unit> function1) {
|
|
m.checkNotNullParameter(function1, "callback");
|
|
this.l = function1;
|
|
}
|
|
}
|