package com.tencent.mm.plugin.sns.ui;

import android.content.Context;
import android.graphics.Canvas;
import android.os.Looper;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.sdk.platformtools.ak;

public class MaskImageView extends TagImageView {
    private int a = 90;
    private int b = 0;
    private boolean enable = true;
    private int g = 0;
    private int r = 0;
    private ak rgT = new ak(Looper.getMainLooper());
    private Runnable rgU = new 1(this);

    public MaskImageView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        AppMethodBeat.i(38309);
        super.setOnTouchListener(new 2(this));
        super.setContentDescription(getContext().getResources().getString(2131303660));
        AppMethodBeat.o(38309);
    }

    public void settouchEnable(boolean z) {
        this.enable = z;
    }

    public final boolean d(View view, MotionEvent motionEvent) {
        AppMethodBeat.i(38310);
        switch (motionEvent.getAction()) {
            case 0:
                view.setPressed(true);
                view.invalidate();
                this.rgT.removeCallbacks(this.rgU);
                break;
            case 1:
            case 3:
                this.rgT.post(this.rgU);
                break;
        }
        if (isClickable() || isLongClickable()) {
            AppMethodBeat.o(38310);
            return false;
        }
        AppMethodBeat.o(38310);
        return true;
    }

    public void onDraw(Canvas canvas) {
        AppMethodBeat.i(38311);
        super.onDraw(canvas);
        if (isPressed()) {
            canvas.drawARGB(this.a, this.r, this.g, this.b);
        }
        AppMethodBeat.o(38311);
    }

    public void onAttachedToWindow() {
        AppMethodBeat.i(38312);
        super.onAttachedToWindow();
        AppMethodBeat.o(38312);
    }

    public void onDetachedFromWindow() {
        AppMethodBeat.i(38313);
        super.onDetachedFromWindow();
        AppMethodBeat.o(38313);
    }
}
