QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685
以下内容为反编译后的 BrowserCouponAdDialog.java 源代码,内容仅作参考
package com.tencent.mtt.ad.coupon;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.text.TextPaint;
import android.text.TextUtils;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import com.tencent.common.featuretoggle.FeatureToggle;
import com.tencent.mtt.R;
import com.tencent.mtt.ad.BrowserAdItem;
import com.tencent.mtt.ad.callback.IAdCommonListener;
import com.tencent.mtt.ad.tools.BrowserAdUtils;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.ui.widget.QBWebImageView;
import com.tencent.mtt.browser.setting.manager.SkinManager;
import com.tencent.mtt.browser.window.UrlParams;
import com.tencent.mtt.businesscenter.facade.IFrameworkDelegate;
import com.tencent.mtt.external.reader.IReader;
import com.tencent.mtt.newskin.SimpleSkinBuilder;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.uifw2.base.resource.QBResource;
import com.tencent.mtt.view.common.QBImageView;
import com.tencent.mtt.view.common.QBTextView;
import com.tencent.mtt.view.dialog.QBDialogBase;
import com.tencent.mtt.view.layout.QBRelativeLayout;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
import qb.a.e;
import qb.a.g;
import qb.browserbusinessbase.BuildConfig;
public class BrowserCouponAdDialog extends QBDialogBase {
private static final int f31057a = MttResources.s(300);
private static final int f31058b = MttResources.s(IReader.ENTER_STYLE_SET_MODE);
private IAdCommonListener f31059c;
private Context f31060d;
private boolean e;
private AdContentView f;
private BrowserAdItem g;
public class AdContentView extends QBRelativeLayout implements View.OnClickListener {
QBWebImageView f31062a;
QBWebImageView f31063b;
QBTextView f31064c;
QBWebImageView f31065d;
QBTextView e;
QBTextView f;
public AdContentView(Context context) {
super(context);
a(context);
setBackgroundColor(MttResources.c(e.U));
}
private void a(Context context) {
QBRelativeLayout qBRelativeLayout = new QBRelativeLayout(context);
qBRelativeLayout.setOnClickListener(this);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(BrowserCouponAdDialog.f31057a, MttResources.s(IReader.XLS_CONVERT_TO_XLSX));
layoutParams.addRule(12);
layoutParams.addRule(14);
addView(qBRelativeLayout, layoutParams);
this.f31062a = new QBWebImageView(context);
this.f31062a.setPlaceHolderColorId(e.U);
this.f31062a.setUrl("https://res.imtt.qq.com/res_mtt/file/junk_red_package_bg2.png");
this.f31062a.setUseMaskForNightMode(true);
this.f31062a.setOnClickListener(this);
SimpleSkinBuilder.a((ImageView) this.f31062a).f();
qBRelativeLayout.addView(this.f31062a, new RelativeLayout.LayoutParams(-1, -1));
this.f31063b = new QBWebImageView(context);
this.f31063b.setPlaceHolderColorId(e.U);
this.f31063b.setId(1);
this.f31063b.setUseMaskForNightMode(true);
int s = MttResources.s(40);
this.f31063b.setRadius(s / 2);
RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(s, s);
layoutParams2.addRule(14);
layoutParams2.addRule(10);
layoutParams2.topMargin = MttResources.s(84);
SimpleSkinBuilder.a((ImageView) this.f31063b).f();
qBRelativeLayout.addView(this.f31063b, layoutParams2);
this.f31064c = new QBTextView(context);
this.f31064c.setTextSize(MttResources.s(16));
this.f31064c.setGravity(17);
this.f31064c.setTextColor(MttResources.c(e.r));
this.f31064c.setSingleLine(false);
this.f31064c.setWidth(MttResources.s(150));
this.f31064c.setId(2);
this.f31064c.setOnClickListener(this);
RelativeLayout.LayoutParams layoutParams3 = new RelativeLayout.LayoutParams(-2, -2);
layoutParams3.addRule(3, 1);
layoutParams3.addRule(14);
layoutParams3.topMargin = MttResources.s(28);
qBRelativeLayout.addView(this.f31064c, layoutParams3);
this.f31065d = new QBWebImageView(context);
this.f31065d.setPlaceHolderColorId(R.color.transparent);
this.f31065d.setUseMaskForNightMode(true);
this.f31065d.setOnClickListener(this);
this.f31065d.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
SimpleSkinBuilder.a((ImageView) this.f31065d).f();
RelativeLayout.LayoutParams layoutParams4 = new RelativeLayout.LayoutParams(MttResources.s(156), MttResources.s(38));
layoutParams4.addRule(3, 1);
layoutParams4.addRule(14);
layoutParams4.topMargin = MttResources.s(31);
qBRelativeLayout.addView(this.f31065d, layoutParams4);
this.e = new QBTextView(context);
this.e.setTextSize(MttResources.s(14));
this.e.setTextColor(Color.parseColor("#FFB72A00"));
TextPaint paint = this.e.getPaint();
if (paint != null) {
paint.setFakeBoldText(true);
}
if (SkinManager.s().l()) {
this.e.setAlpha(0.4f);
}
this.e.setId(3);
this.e.setUseMaskForNightMode(true);
this.e.setOnClickListener(this);
RelativeLayout.LayoutParams layoutParams5 = new RelativeLayout.LayoutParams(-2, -2);
layoutParams5.addRule(12);
layoutParams5.addRule(14);
layoutParams5.bottomMargin = MttResources.s(76);
qBRelativeLayout.addView(this.e, layoutParams5);
this.f = new QBTextView(context);
this.f.setTextSize(MttResources.s(12));
this.f.setTextColor(MttResources.c(e.r));
this.f.setAlpha(0.6f);
RelativeLayout.LayoutParams layoutParams6 = new RelativeLayout.LayoutParams(-2, -2);
layoutParams6.addRule(12);
layoutParams6.addRule(14);
layoutParams6.bottomMargin = MttResources.s(43);
qBRelativeLayout.addView(this.f, layoutParams6);
QBImageView qBImageView = new QBImageView(context);
qBImageView.setImageNormalIds(g.aV);
qBImageView.setUseMaskForNightMode(true);
qBImageView.setId(4);
qBImageView.setOnClickListener(this);
qBImageView.setScaleType(ImageView.ScaleType.FIT_XY);
RelativeLayout.LayoutParams layoutParams7 = new RelativeLayout.LayoutParams(MttResources.s(26), MttResources.s(26));
layoutParams7.addRule(10);
layoutParams7.addRule(11);
layoutParams7.rightMargin = MttResources.s(42);
addView(qBImageView, layoutParams7);
}
public void a(BrowserAdItem browserAdItem) {
this.f31064c.setVisibility(0);
this.f31065d.setVisibility(8);
this.e.setText("立即领取");
if (!TextUtils.isEmpty(browserAdItem.k)) {
this.f31064c.setText(browserAdItem.k);
}
if (!TextUtils.isEmpty(browserAdItem.l)) {
this.f.setText(browserAdItem.l);
}
this.f31063b.setUrl(browserAdItem.o);
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
if (BrowserCouponAdDialog.this.f31059c != null) {
BrowserCouponAdDialog.this.f31059c.d(BrowserCouponAdDialog.this.g);
}
}
@Override
public void onClick(View view) {
EventCollector.getInstance().onViewClickedBefore(view);
if (view.getId() != 4) {
if (!FeatureToggle.a(BuildConfig.FEATURE_TOGGLE_869646675) || view.getId() == 3) {
BrowserCouponAdDialog.this.e = true;
if (BrowserCouponAdDialog.this.g.p && BrowserAdUtils.a(BrowserCouponAdDialog.this.f31060d, BrowserCouponAdDialog.this.g.q)) {
BrowserAdUtils.a(BrowserCouponAdDialog.this.f31060d, BrowserCouponAdDialog.this.g);
} else {
((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(new UrlParams(BrowserCouponAdDialog.this.g.e));
}
if (BrowserCouponAdDialog.this.f31059c != null) {
BrowserCouponAdDialog.this.f31059c.b(BrowserCouponAdDialog.this.g);
}
}
EventCollector.getInstance().onViewClicked(view);
}
BrowserCouponAdDialog.this.dismiss();
EventCollector.getInstance().onViewClicked(view);
}
}
public BrowserCouponAdDialog(Context context) {
super(context);
this.e = false;
this.f31060d = context;
requestWindowFeature(1);
getWindow().addFlags(131072);
getWindow().setBackgroundDrawable(new ColorDrawable(QBResource.b(e.U)));
setCanceledOnTouchOutside(false);
this.f = new AdContentView(context);
setContentView(this.f, new FrameLayout.LayoutParams(f31057a, f31058b));
setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialogInterface) {
if (BrowserCouponAdDialog.this.e || BrowserCouponAdDialog.this.f31059c == null) {
return;
}
BrowserCouponAdDialog.this.f31059c.c(BrowserCouponAdDialog.this.g);
}
});
}
public void a(BrowserAdItem browserAdItem) {
this.g = browserAdItem;
AdContentView adContentView = this.f;
if (adContentView != null) {
adContentView.a(browserAdItem);
}
}
public void a(IAdCommonListener iAdCommonListener) {
this.f31059c = iAdCommonListener;
}
@Override
public void show() {
}
}