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

import android.content.Context;
import android.graphics.Bitmap;
import android.util.AttributeSet;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.pluginsdk.ui.a.b;
import com.tencent.mm.pluginsdk.ui.e.j;
import com.tencent.mm.sdk.platformtools.bo;
import com.tencent.mm.storage.ad;
import com.tencent.mm.ui.base.preference.Preference;

public class PersonalPreference extends Preference {
    private String cIR;
    private String dFl;
    private TextView emg = null;
    Bitmap fru = null;
    ImageView moN = null;
    private TextView qkY = null;
    int qkZ = -1;
    String qla = null;
    private OnClickListener qlb;
    private String username;

    public PersonalPreference(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
    }

    public PersonalPreference(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        AppMethodBeat.i(126972);
        setLayoutResource(2130970127);
        setWidgetLayoutResource(2130970202);
        AppMethodBeat.o(126972);
    }

    public final View onCreateView(ViewGroup viewGroup) {
        AppMethodBeat.i(126973);
        View onCreateView = super.onCreateView(viewGroup);
        ViewGroup viewGroup2 = (ViewGroup) onCreateView.findViewById(2131821019);
        viewGroup2.removeAllViews();
        View.inflate(this.mContext, 2130970159, viewGroup2);
        AppMethodBeat.o(126973);
        return onCreateView;
    }

    public final void onBindView(View view) {
        AppMethodBeat.i(126974);
        if (this.moN == null) {
            this.moN = (ImageView) view.findViewById(2131822184);
        }
        if (this.fru != null) {
            this.moN.setImageBitmap(this.fru);
        } else if (this.qkZ > 0) {
            this.moN.setImageResource(this.qkZ);
        } else if (this.qla != null) {
            b.b(this.moN, this.qla);
        }
        this.moN.setOnClickListener(this.qlb);
        if (!(this.emg == null || this.cIR == null)) {
            this.emg.setText(j.b(this.mContext, this.cIR, this.emg.getTextSize()));
        }
        if (this.qkY != null) {
            String str = bo.isNullOrNil(this.dFl) ? this.username : this.dFl;
            if (bo.isNullOrNil(this.dFl) && ad.aoA(this.username)) {
                this.qkY.setVisibility(8);
            }
            this.qkY.setText(this.mContext.getString(2131296930) + str);
        }
        super.onBindView(view);
        AppMethodBeat.o(126974);
    }
}
