QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685
以下内容为反编译后的 JunkCleanWelFareCard.java 源代码,内容仅作参考
package com.tencent.mtt.fileclean.page.view;
import MTT.WelfareDetail;
import MTT.WelfareTaskInfo;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.tencent.luggage.wxa.cy.e;
import com.tencent.mtt.R;
import com.tencent.mtt.account.base.IAccount;
import com.tencent.mtt.account.base.UserLoginListener;
import com.tencent.mtt.base.account.AccountInfo;
import com.tencent.mtt.base.functionwindow.ActivityHandler;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.browser.setting.manager.SkinManager;
import com.tencent.mtt.browser.share.export.socialshare.qqshare.QQShareActivity;
import com.tencent.mtt.browser.window.UrlParams;
import com.tencent.mtt.businesscenter.facade.IFrameworkDelegate;
import com.tencent.mtt.file.page.statistics.FileKeyEvent;
import com.tencent.mtt.fileclean.stat.JunkEventHelper;
import com.tencent.mtt.fileclean.utils.IAcceptWelfareTaskCallBack;
import com.tencent.mtt.fileclean.utils.JunkCleanWelFareManager;
import com.tencent.mtt.newskin.SimpleSkinBuilder;
import com.tencent.mtt.nxeasy.page.EasyPageContext;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.resources.BrowserBusinessBaseRes;
import com.tencent.mtt.sdkcontext.SDKContext;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
import java.util.Map;
public class JunkCleanWelFareCard extends RelativeLayout implements UserLoginListener {
Context f66107a;
EasyPageContext f66108b;
LinearLayout f66109c;
TextView f66110d;
TextView e;
int f;
int g;
int h;
int i;
WelfareTaskInfo j;
boolean k;
boolean l;
IAccount m;
public JunkCleanWelFareCard(EasyPageContext easyPageContext, WelfareTaskInfo welfareTaskInfo) {
super(easyPageContext.f68800c);
this.k = false;
this.l = false;
this.f66107a = easyPageContext.f68800c;
this.f66108b = easyPageContext;
this.j = welfareTaskInfo;
this.h = welfareTaskInfo.isContinueTask ? welfareTaskInfo.totalTaskDays : welfareTaskInfo.total;
this.i = welfareTaskInfo.isContinueTask ? welfareTaskInfo.continueTaskDays : welfareTaskInfo.completed;
this.m = (IAccount) SDKContext.getInstance().getService(IAccount.class);
b(welfareTaskInfo);
}
private void a(WelfareTaskInfo welfareTaskInfo, boolean z) {
TextView textView;
int i;
TextView textView2;
String str;
this.f66110d = new TextView(this.f66107a);
this.f66110d.setId(1002);
if (SkinManager.s().l()) {
textView = this.f66110d;
i = R.drawable.e_;
} else {
textView = this.f66110d;
i = R.drawable.e9;
}
textView.setBackground(MttResources.i(i));
this.f66110d.setTextSize(0, MttResources.s(17));
this.f66110d.setGravity(17);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(MttResources.s(e.CTRL_INDEX), MttResources.s(40));
layoutParams.addRule(3, 1001);
layoutParams.addRule(14);
layoutParams.topMargin = MttResources.s(10);
WelfareDetail welfareDetail = welfareTaskInfo.welfares.get(Integer.valueOf(this.g));
if (welfareDetail != null) {
if (welfareDetail.welfareInfo.value != 0) {
this.f66110d.setText("领取" + welfareDetail.welfareInfo.value + "金币");
} else {
this.f66110d.setText("领取金币大礼包");
}
}
SimpleSkinBuilder.a(this.f66110d).g(R.color.theme_common_color_a5).f();
this.f66110d.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
EventCollector.getInstance().onViewClickedBefore(view);
JunkCleanWelFareCard.this.a();
EventCollector.getInstance().onViewClicked(view);
}
});
addView(this.f66110d, layoutParams);
if (z) {
this.f66110d.setText("今日已领取");
this.f66110d.setAlpha(0.4f);
this.f66110d.setClickable(false);
}
this.e = new TextView(this.f66107a);
this.e.setTextSize(0, MttResources.s(12));
SimpleSkinBuilder.a(this.e).g(R.color.theme_common_color_a4).f();
RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(-2, -2);
layoutParams2.addRule(3, 1002);
layoutParams2.addRule(14);
long currentTimeMillis = (welfareTaskInfo.endTime - (System.currentTimeMillis() / 1000)) / 86400;
if (currentTimeMillis > 0) {
textView2 = this.e;
str = "活动还剩" + currentTimeMillis + "天,已领取" + this.f + "金币";
} else {
textView2 = this.e;
str = "活动最后1天,已领取" + this.f + "金币";
}
textView2.setText(str);
layoutParams2.topMargin = MttResources.s(10);
addView(this.e, layoutParams2);
}
private void a(LinearLayout.LayoutParams layoutParams, Map<Integer, WelfareDetail> map, WelfareDetail welfareDetail, boolean z) {
boolean z2;
WelfareDetail welfareDetail2 = welfareDetail;
int i = 1;
while (i <= this.h) {
JunkGoldItemView junkGoldItemView = new JunkGoldItemView(this.f66107a);
this.f66109c.addView(junkGoldItemView, layoutParams);
WelfareDetail welfareDetail3 = map.get(Integer.valueOf(i));
int i2 = (welfareDetail2 == null || welfareDetail3 == null) ? 100 : (welfareDetail3.welfareInfo.value * 100) / welfareDetail2.welfareInfo.value;
if (!(z && i == this.i) && (z || i != this.i + 1)) {
z2 = false;
} else {
this.g = i;
z2 = true;
}
boolean z3 = i <= this.i;
if (z3 && welfareDetail3 != null) {
this.f += welfareDetail3.welfareInfo.value;
}
junkGoldItemView.a(Integer.valueOf(i), welfareDetail3, i2, z3, z2);
i++;
welfareDetail2 = welfareDetail3;
}
}
private void b(WelfareTaskInfo welfareTaskInfo) {
setBackground(MttResources.i((SkinManager.s().l() || SkinManager.s().g()) ? BrowserBusinessBaseRes.s : BrowserBusinessBaseRes.t));
TextView textView = new TextView(this.f66107a);
textView.setGravity(80);
textView.setTextSize(0, MttResources.s(14));
textView.setText("清理得金币活动");
SimpleSkinBuilder.a(textView).g(R.color.theme_common_color_a1).f();
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-2, MttResources.s(22));
layoutParams.leftMargin = MttResources.s(8);
addView(textView, layoutParams);
TextView textView2 = new TextView(this.f66107a);
textView2.setGravity(80);
textView2.setTextSize(0, MttResources.s(12));
textView2.setText("去福利中心提现 >");
SimpleSkinBuilder.a(textView2).g(R.color.theme_common_color_b5).f();
RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(-2, MttResources.s(22));
layoutParams2.rightMargin = MttResources.s(11);
layoutParams2.addRule(11);
addView(textView2, layoutParams2);
textView2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
EventCollector.getInstance().onViewClickedBefore(view);
((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(new UrlParams("https://qbact.html5.qq.com/newtickets_v2?addressbar=hide#/"));
EventCollector.getInstance().onViewClicked(view);
}
});
this.f66109c = new LinearLayout(this.f66107a);
this.f66109c.setId(1001);
RelativeLayout.LayoutParams layoutParams3 = new RelativeLayout.LayoutParams(-1, MttResources.s(91));
this.f66109c.setOrientation(0);
layoutParams3.topMargin = MttResources.s(22);
int s = MttResources.s(7);
layoutParams3.rightMargin = s;
layoutParams3.leftMargin = s;
addView(this.f66109c, layoutParams3);
LinearLayout.LayoutParams layoutParams4 = new LinearLayout.LayoutParams(-1, -1);
layoutParams4.weight = 1.0f;
Map<Integer, WelfareDetail> map = welfareTaskInfo.welfares;
boolean z = welfareTaskInfo.taskEvolve == 2;
a(layoutParams4, map, null, z);
a(welfareTaskInfo, z);
}
public void a() {
this.k = true;
new FileKeyEvent("JUNK_0255", this.f66108b.g, this.f66108b.h, "JUNK_FINISH", "JK", "", JunkEventHelper.b()).b();
IAccount iAccount = (IAccount) SDKContext.getInstance().getService(IAccount.class);
if (this.l) {
return;
}
AccountInfo currentUserInfo = iAccount.getCurrentUserInfo();
if (currentUserInfo != null && currentUserInfo.isLogined()) {
b();
return;
}
Bundle bundle = new Bundle();
bundle.putInt(QQShareActivity.KEY_FROM_WHERE, 8);
bundle.putBoolean(MttResources.l(R.string.f30776c), false);
bundle.putInt("LOGIN_CUSTOM_TYPE", 3);
iAccount.callUserLogin(ActivityHandler.b().a(), bundle);
iAccount.addUIListener(this);
}
public void a(WelfareTaskInfo welfareTaskInfo) {
this.f66110d.setClickable(false);
(this.k ? new FileKeyEvent("JUNK_0256", this.f66108b.g, this.f66108b.h, "JUNK_FINISH", "JK", "", JunkEventHelper.b()) : new FileKeyEvent("JUNK_0254", this.f66108b.g, this.f66108b.h, "JUNK_FINISH", "JK", "", JunkEventHelper.b())).b();
((JunkGoldItemView) this.f66109c.getChildAt(this.g - 1)).a(welfareTaskInfo.welfares.get(Integer.valueOf(this.g)));
this.f66110d.setText("今日已领取");
this.f66110d.setAlpha(0.4f);
WelfareDetail welfareDetail = welfareTaskInfo.welfares.get(Integer.valueOf(this.g));
if (welfareDetail != null) {
this.f += welfareDetail.welfareInfo.value;
}
long currentTimeMillis = (welfareTaskInfo.endTime - (System.currentTimeMillis() / 1000)) / 86400;
if (currentTimeMillis <= 0) {
this.e.setText("活动最后1天,已领取" + this.f + "金币");
return;
}
this.e.setText("活动还剩" + currentTimeMillis + "天,已领取" + this.f + "金币");
}
public void b() {
this.l = true;
JunkCleanWelFareManager.a().a(new IAcceptWelfareTaskCallBack() {
@Override
public void a(boolean z, String str, WelfareTaskInfo welfareTaskInfo) {
JunkCleanWelFareCard junkCleanWelFareCard = JunkCleanWelFareCard.this;
junkCleanWelFareCard.l = false;
if (z) {
junkCleanWelFareCard.a(welfareTaskInfo);
}
}
});
}
public void c() {
this.m.removeUIListener(this);
}
@Override
public void onLoginFailed(int i, String str) {
this.l = false;
}
@Override
public void onLoginSuccess() {
b();
}
}