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

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.plugin.voip.a$a;

public class VoipBigIconButton extends FrameLayout {
    private ImageView ikh;
    private OnTouchListener jZu = new 1(this);
    private TextView sW;
    private Drawable sWG = null;
    private Drawable sWH = null;
    private Drawable sWI = null;
    private Drawable sWJ = null;

    public VoipBigIconButton(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        AppMethodBeat.i(4853);
        LayoutInflater.from(context).inflate(2130969928, this);
        TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(attributeSet, a$a.VoipButton, 0, 0);
        try {
            CharSequence string;
            this.sWG = obtainStyledAttributes.getDrawable(0);
            this.sWH = obtainStyledAttributes.getDrawable(1);
            this.sWI = obtainStyledAttributes.getDrawable(2);
            this.sWJ = obtainStyledAttributes.getDrawable(3);
            int resourceId = obtainStyledAttributes.getResourceId(4, -1);
            int resourceId2 = obtainStyledAttributes.getResourceId(4, 0);
            if (resourceId2 != 0) {
                string = getContext().getString(resourceId2);
            } else {
                string = null;
            }
            obtainStyledAttributes.recycle();
            this.sWH = this.sWH == null ? this.sWG : this.sWH;
            this.sWJ = this.sWJ == null ? this.sWI : this.sWJ;
            this.ikh = (ImageView) findViewById(2131825246);
            this.ikh.setBackgroundDrawable(this.sWG);
            this.ikh.setImageDrawable(this.sWI);
            this.ikh.setOnTouchListener(this.jZu);
            this.ikh.setContentDescription(string);
            this.sW = (TextView) findViewById(2131825247);
            if (resourceId != -1) {
                this.sW.setText(getContext().getString(resourceId));
            }
            AppMethodBeat.o(4853);
        } catch (Throwable th) {
            obtainStyledAttributes.recycle();
            AppMethodBeat.o(4853);
        }
    }

    public void setEnabled(boolean z) {
        AppMethodBeat.i(4854);
        this.ikh.setEnabled(z);
        this.sW.setEnabled(z);
        AppMethodBeat.o(4854);
    }

    public void setOnClickListener(OnClickListener onClickListener) {
        AppMethodBeat.i(4855);
        this.ikh.setOnClickListener(onClickListener);
        AppMethodBeat.o(4855);
    }
}
