package com.tencent.mm.plugin.card.ui.view;

import android.text.TextUtils;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.tencent.mm.plugin.card.base.b;
import com.tencent.mm.plugin.card.d.c;
import com.tencent.mm.plugin.card.d.l;
import com.tencent.mm.plugin.card.d.m;
import com.tencent.mm.protocal.protobuf.tm;
import com.tencent.mm.sdk.platformtools.bo;
import com.tencent.mm.ui.MMActivity;

public abstract class h implements ab {
    protected MMActivity jiE;
    protected g kqH;

    public abstract boolean bet();

    public abstract boolean beu();

    public h(g gVar, MMActivity mMActivity) {
        this.kqH = gVar;
        this.jiE = mMActivity;
    }

    public void c(ViewGroup viewGroup, b bVar) {
        if (bet()) {
            TextView textView = (TextView) viewGroup.findViewById(2131821958);
            String str = this.kqH.code;
            if (bVar.aZQ() || (!bo.isNullOrNil(str) && str.length() <= 40)) {
                textView.setText(m.Hu(str));
                if (bVar.aZL()) {
                    textView.setVisibility(0);
                    textView.setOnLongClickListener(new 1(this, bVar));
                    this.kqH.d(c.krI);
                } else {
                    textView.setVisibility(8);
                }
            } else {
                textView.setVisibility(8);
            }
        }
        if (beu()) {
            LinearLayout linearLayout = (LinearLayout) viewGroup.findViewById(2131821970);
            if (bVar == null || bVar.aZV() == null || bVar.aZV().vUA == null || bo.isNullOrNil(bVar.aZV().vUA.title)) {
                linearLayout.setVisibility(8);
                return;
            }
            viewGroup.findViewById(2131821969).setVisibility(8);
            linearLayout.setVisibility(0);
            tm tmVar = bVar.aZV().vUA;
            TextView textView2 = (TextView) viewGroup.findViewById(2131821971);
            textView2.setText(tmVar.title);
            String str2 = bVar.aZV().color;
            if (!bo.isNullOrNil(str2)) {
                textView2.setTextColor(l.Hn(str2));
            }
            textView2 = (TextView) viewGroup.findViewById(2131821972);
            String str3 = tmVar.kbX;
            if (TextUtils.isEmpty(str3)) {
                if (textView2 != null) {
                    textView2.setVisibility(8);
                }
            } else if (textView2 != null) {
                textView2.setText(str3);
                textView2.setVisibility(0);
            }
            linearLayout.setOnClickListener(new 2(this, bVar));
        }
    }

    public boolean g(b bVar) {
        return true;
    }

    public void l(ViewGroup viewGroup) {
    }
}
