package com.tencent.mm.plugin.luckymoney.f2f.ui;

import android.animation.ValueAnimator;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.bz.a;
import com.tencent.mm.pluginsdk.f;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.ah;

class LuckyMoneyF2FQRCodeUI$7 implements SensorEventListener {
    final int nVA = 3;
    float nVB = ((float) a.al(ah.getContext(), 2131427796));
    int nVC;
    ValueAnimator nVD;
    final /* synthetic */ LuckyMoneyF2FQRCodeUI nVw;
    float neH;

    LuckyMoneyF2FQRCodeUI$7(LuckyMoneyF2FQRCodeUI luckyMoneyF2FQRCodeUI) {
        this.nVw = luckyMoneyF2FQRCodeUI;
        AppMethodBeat.i(42179);
        AppMethodBeat.o(42179);
    }

    public final void onSensorChanged(SensorEvent sensorEvent) {
        float f = -3.0f;
        AppMethodBeat.i(42180);
        if (sensorEvent.sensor.getType() == 1) {
            if (LuckyMoneyF2FQRCodeUI.g(this.nVw) <= 0) {
                AppMethodBeat.o(42180);
                return;
            }
            if (this.nVC == 0) {
                this.nVC = f.de(this.nVw) + ((int) this.nVB);
            }
            float f2 = sensorEvent.values[1];
            if (((double) Math.abs(f2 - this.neH)) < 0.05d) {
                AppMethodBeat.o(42180);
                return;
            }
            this.neH = f2;
            ab.d("LuckyMoneyF2FQRCodeUI", "[onSensorChanged] y:%s ", new Object[]{Float.valueOf(f2)});
            if (f2 >= -3.0f) {
                if (f2 > 0.0f) {
                    f = 0.0f;
                } else {
                    f = f2;
                }
            }
            f = ((f / 3.0f) * ((float) this.nVC)) + ((float) this.nVC);
            ab.d("LuckyMoneyF2FQRCodeUI", "paddingTop:%s nowPaddingTop:%s", new Object[]{Float.valueOf(f), Integer.valueOf(LuckyMoneyF2FQRCodeUI.N(this.nVw).getPaddingTop())});
            if (this.nVD != null) {
                this.nVD.cancel();
            }
            this.nVD = ValueAnimator.ofFloat(new float[]{(float) LuckyMoneyF2FQRCodeUI.N(this.nVw).getPaddingTop(), f}).setDuration(200);
            this.nVD.addUpdateListener(new 1(this));
            this.nVD.start();
        }
        AppMethodBeat.o(42180);
    }

    public final void onAccuracyChanged(Sensor sensor, int i) {
        AppMethodBeat.i(42181);
        ab.i("LuckyMoneyF2FQRCodeUI", "onAccuracyChanged");
        AppMethodBeat.o(42181);
    }
}
