package xyz.stream.view;

import android.animation.ObjectAnimator;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
import android.widget.TextView;
import android.widget.Toast;
import androidx.core.widget.NestedScrollView;

/* JADX INFO: loaded from: classes3.dex */
public final /* synthetic */ class k implements Runnable {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f36535a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ Object f36536b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ Object f36537c;

    public /* synthetic */ k(Object obj, Object obj2, int i10) {
        this.f36535a = i10;
        this.f36536b = obj;
        this.f36537c = obj2;
    }

    @Override // java.lang.Runnable
    public final void run() {
        int i10 = this.f36535a;
        Object obj = this.f36537c;
        Object obj2 = this.f36536b;
        switch (i10) {
            case 0:
                Context context = (Context) obj2;
                View viewInflate = LayoutInflater.from(context).inflate(R.layout.custom_toast, (ViewGroup) null);
                ((TextView) viewInflate.findViewById(R.id.toast_text)).setText((String) obj);
                Toast toast = new Toast(context);
                toast.setView(viewInflate);
                toast.setDuration(0);
                toast.setGravity(87, 0, UiUtils.dp2px(60.0f));
                toast.show();
                break;
            default:
                NestedScrollView nestedScrollView = (NestedScrollView) obj2;
                View view = (View) obj;
                int[] iArr = new int[2];
                nestedScrollView.getLocationOnScreen(iArr);
                int i11 = iArr[1];
                int[] iArr2 = new int[2];
                view.getLocationOnScreen(iArr2);
                int i12 = iArr2[1];
                int height = nestedScrollView.getHeight();
                int scrollY = nestedScrollView.getScrollY();
                ObjectAnimator objectAnimatorOfInt = ObjectAnimator.ofInt(nestedScrollView, "scrollY", scrollY, Math.max(0, Math.min((view.getHeight() / 2) + (((i12 - i11) + scrollY) - (height / 2)), nestedScrollView.getChildAt(0).getHeight() - height)));
                objectAnimatorOfInt.setDuration(200L);
                objectAnimatorOfInt.setInterpolator(new DecelerateInterpolator());
                objectAnimatorOfInt.start();
                break;
        }
    }
}
