package com.google.android.material.bottomsheet;

import android.view.View;
import com.google.android.material.animation.AnimationUtils;
import defpackage.pqa;
import defpackage.vo6;
import defpackage.wqa;
import java.util.Iterator;
import java.util.List;

/* JADX INFO: loaded from: classes2.dex */
class InsetsAnimationCallback extends pqa.b {
    private int startTranslationY;
    private int startY;
    private final int[] tmpLocation = new int[2];
    private final View view;

    public InsetsAnimationCallback(View view) {
        this.view = view;
    }

    @Override // pqa.b
    public void onEnd(@vo6 pqa pqaVar) {
        this.view.setTranslationY(0.0f);
    }

    @Override // pqa.b
    public void onPrepare(@vo6 pqa pqaVar) {
        this.view.getLocationOnScreen(this.tmpLocation);
        this.startY = this.tmpLocation[1];
    }

    @Override // pqa.b
    @vo6
    public wqa onProgress(@vo6 wqa wqaVar, @vo6 List<pqa> list) {
        Iterator<pqa> it = list.iterator();
        while (true) {
            if (!it.hasNext()) {
                break;
            }
            if ((it.next().b() & 8) != 0) {
                this.view.setTranslationY(AnimationUtils.lerp(this.startTranslationY, 0, r0.a()));
                break;
            }
        }
        return wqaVar;
    }

    @Override // pqa.b
    @vo6
    public pqa.a onStart(@vo6 pqa pqaVar, @vo6 pqa.a aVar) {
        this.view.getLocationOnScreen(this.tmpLocation);
        int i = this.startY - this.tmpLocation[1];
        this.startTranslationY = i;
        this.view.setTranslationY(i);
        return aVar;
    }
}
