discord-jadx/app/src/main/java/com/discord/widgets/chat/input/SmoothKeyboardReactionHelpe...

59 lines
2.4 KiB
Java

package com.discord.widgets.chat.input;
import android.annotation.TargetApi;
import android.os.Build;
import android.view.View;
import android.view.WindowInsets;
import android.view.WindowInsetsAnimation;
import d0.z.d.m;
import java.util.List;
/* compiled from: SmoothKeyboardReactionHelper.kt */
@TargetApi(30)
public final class SmoothKeyboardReactionHelper {
public static final SmoothKeyboardReactionHelper INSTANCE = new SmoothKeyboardReactionHelper();
/* compiled from: SmoothKeyboardReactionHelper.kt */
public static final class Callback extends WindowInsetsAnimation.Callback {
private final View view;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public Callback(View view) {
super(0);
m.checkNotNullParameter(view, "view");
this.view = view;
}
@Override // android.view.WindowInsetsAnimation.Callback
public WindowInsets onProgress(WindowInsets windowInsets, List<WindowInsetsAnimation> list) {
m.checkNotNullParameter(windowInsets, "insets");
m.checkNotNullParameter(list, "runningAnimations");
return windowInsets;
}
@Override // android.view.WindowInsetsAnimation.Callback
public WindowInsetsAnimation.Bounds onStart(WindowInsetsAnimation windowInsetsAnimation, WindowInsetsAnimation.Bounds bounds) {
m.checkNotNullParameter(windowInsetsAnimation, "animation");
m.checkNotNullParameter(bounds, "bounds");
if (this.view.getRootWindowInsets().isVisible(WindowInsets.Type.ime())) {
this.view.setTranslationY((float) bounds.getUpperBound().bottom);
} else {
this.view.setTranslationY(-((float) bounds.getUpperBound().bottom));
}
this.view.animate().setDuration(windowInsetsAnimation.getDurationMillis()).setInterpolator(windowInsetsAnimation.getInterpolator()).translationY(0.0f);
WindowInsetsAnimation.Bounds onStart = super.onStart(windowInsetsAnimation, bounds);
m.checkNotNullExpressionValue(onStart, "super.onStart(animation, bounds)");
return onStart;
}
}
private SmoothKeyboardReactionHelper() {
}
public final void install(View view) {
m.checkNotNullParameter(view, "view");
if (Build.VERSION.SDK_INT >= 30) {
view.setWindowInsetsAnimationCallback(new Callback(view));
}
}
}