package com.tencent.mm.plugin.sight.decode.ui;

import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.FrameLayout.LayoutParams;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.sdk.platformtools.ab;

class AdVideoPlayerLoadingBar$1 implements OnTouchListener {
    final /* synthetic */ AdVideoPlayerLoadingBar qyz;

    AdVideoPlayerLoadingBar$1(AdVideoPlayerLoadingBar adVideoPlayerLoadingBar) {
        this.qyz = adVideoPlayerLoadingBar;
    }

    public final boolean onTouch(View view, MotionEvent motionEvent) {
        AppMethodBeat.i(117915);
        if (motionEvent.getAction() == 0) {
            ab.i("MicroMsg.VideoPlayerLoadingBar", "ontouch down");
            this.qyz.hOy = false;
            this.qyz.qyu = motionEvent.getX();
            if (this.qyz.qyk != null) {
                this.qyz.qyk.aFw();
            }
        } else if (motionEvent.getAction() == 2) {
            float x = motionEvent.getX();
            LayoutParams layoutParams = (LayoutParams) this.qyz.qyn.getLayoutParams();
            layoutParams.leftMargin = AdVideoPlayerLoadingBar.a(this.qyz, ((int) (x - this.qyz.qyu)) + layoutParams.leftMargin);
            this.qyz.qyn.setLayoutParams(layoutParams);
            int currentTimeByBarPoint = this.qyz.getCurrentTimeByBarPoint();
            if (this.qyz.qyr > 0) {
                layoutParams = (LayoutParams) this.qyz.qyl.getLayoutParams();
                layoutParams.width = (int) (((((double) currentTimeByBarPoint) * 1.0d) / ((double) this.qyz.qyr)) * ((double) this.qyz.getBarLen()));
                this.qyz.qyl.setLayoutParams(layoutParams);
            }
            this.qyz.qyp.setText(AdVideoPlayerLoadingBar.oy(currentTimeByBarPoint / 60) + ":" + AdVideoPlayerLoadingBar.oy(currentTimeByBarPoint % 60));
            this.qyz.hOy = true;
        } else if (this.qyz.hOy) {
            int currentTimeByBarPoint2 = this.qyz.getCurrentTimeByBarPoint();
            if (this.qyz.qyk != null) {
                ab.i("MicroMsg.VideoPlayerLoadingBar", "current time : ".concat(String.valueOf(currentTimeByBarPoint2)));
                this.qyz.qyk.oA(currentTimeByBarPoint2);
            }
            this.qyz.hOy = false;
        }
        AppMethodBeat.o(117915);
        return true;
    }
}
