107 lines
3.7 KiB
Java
107 lines
3.7 KiB
Java
package com.discord.views.typing;
|
|
|
|
import android.content.Context;
|
|
import android.util.AttributeSet;
|
|
import android.view.View;
|
|
import android.view.animation.Animation;
|
|
import android.view.animation.AnimationUtils;
|
|
import d0.z.d.m;
|
|
import d0.z.d.o;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function0;
|
|
/* compiled from: TypingDot.kt */
|
|
public final class TypingDot extends View {
|
|
public final Animation i;
|
|
public final Animation j;
|
|
public Function0<Unit> k;
|
|
|
|
/* compiled from: kotlin-style lambda group */
|
|
public static final class a extends o implements Function0<Unit> {
|
|
public final /* synthetic */ int i;
|
|
public final /* synthetic */ Object j;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public a(int i, Object obj) {
|
|
super(0);
|
|
this.i = i;
|
|
this.j = obj;
|
|
}
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
@Override // kotlin.jvm.functions.Function0
|
|
/* renamed from: invoke */
|
|
public final Unit mo1invoke() {
|
|
int i = this.i;
|
|
if (i == 0) {
|
|
TypingDot typingDot = (TypingDot) this.j;
|
|
typingDot.startAnimation(typingDot.j);
|
|
return Unit.a;
|
|
} else if (i == 1) {
|
|
Function0<Unit> onScaleDownCompleteListener = ((TypingDot) this.j).getOnScaleDownCompleteListener();
|
|
if (onScaleDownCompleteListener != null) {
|
|
onScaleDownCompleteListener.mo1invoke();
|
|
}
|
|
return Unit.a;
|
|
} else {
|
|
throw null;
|
|
}
|
|
}
|
|
}
|
|
|
|
/* compiled from: TypingDot.kt */
|
|
public static class b implements Animation.AnimationListener {
|
|
public final Function0<Unit> i;
|
|
|
|
public b(Function0<Unit> function0) {
|
|
m.checkNotNullParameter(function0, "onComplete");
|
|
this.i = function0;
|
|
}
|
|
|
|
@Override // android.view.animation.Animation.AnimationListener
|
|
public void onAnimationEnd(Animation animation) {
|
|
this.i.mo1invoke();
|
|
}
|
|
|
|
@Override // android.view.animation.Animation.AnimationListener
|
|
public void onAnimationRepeat(Animation animation) {
|
|
}
|
|
|
|
@Override // android.view.animation.Animation.AnimationListener
|
|
public void onAnimationStart(Animation animation) {
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public TypingDot(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet, 0);
|
|
m.checkNotNullParameter(context, "context");
|
|
Animation loadAnimation = AnimationUtils.loadAnimation(context, 2130772026);
|
|
m.checkNotNullExpressionValue(loadAnimation, "AnimationUtils.loadAnima…nim_typing_dots_scale_up)");
|
|
this.i = loadAnimation;
|
|
Animation loadAnimation2 = AnimationUtils.loadAnimation(context, 2130772025);
|
|
m.checkNotNullExpressionValue(loadAnimation2, "AnimationUtils.loadAnima…m_typing_dots_scale_down)");
|
|
this.j = loadAnimation2;
|
|
}
|
|
|
|
public final void a(long j) {
|
|
this.i.setStartOffset(j);
|
|
this.i.setAnimationListener(new b(new a(0, this)));
|
|
this.j.setAnimationListener(new b(new a(1, this)));
|
|
startAnimation(this.i);
|
|
}
|
|
|
|
public final Function0<Unit> getOnScaleDownCompleteListener() {
|
|
return this.k;
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void onDetachedFromWindow() {
|
|
super.onDetachedFromWindow();
|
|
this.i.cancel();
|
|
this.j.cancel();
|
|
}
|
|
|
|
public final void setOnScaleDownCompleteListener(Function0<Unit> function0) {
|
|
this.k = function0;
|
|
}
|
|
}
|