QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685
以下内容为反编译后的 DownloadDetailsPageProgressView.java 源代码,内容仅作参考
package com.tencent.mtt.browser.download.business.ui.page;
import android.animation.Animator;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import com.tencent.common.data.MediaFileType;
import com.tencent.common.featuretoggle.FeatureToggle;
import com.tencent.common.task.QBTask;
import com.tencent.common.utils.StringUtils;
import com.tencent.mtt.R;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.stat.StatManager;
import com.tencent.mtt.base.ui.widget.QBWebImageView;
import com.tencent.mtt.base.wup.PreferenceData;
import com.tencent.mtt.browser.download.business.core.BusinessDownloadService;
import com.tencent.mtt.browser.download.business.core.DownloadUtils;
import com.tencent.mtt.browser.download.business.report.DownloadStatUtils;
import com.tencent.mtt.browser.download.business.ui.page.component.DownloadProgressView;
import com.tencent.mtt.browser.download.core.facade.OverwritePolicy;
import com.tencent.mtt.browser.download.core.facade.ResultCallback;
import com.tencent.mtt.browser.download.core.impl.DownloadServiceManager;
import com.tencent.mtt.browser.download.engine.DownloadErrorDetail;
import com.tencent.mtt.browser.download.engine.DownloadInfo;
import com.tencent.mtt.browser.download.engine.DownloadTask;
import com.tencent.mtt.browser.download.engine.DownloadTaskListener;
import com.tencent.mtt.browser.download.engine.PauseReason;
import com.tencent.mtt.browser.window.UrlParams;
import com.tencent.mtt.businesscenter.facade.IFrameworkDelegate;
import com.tencent.mtt.common.operation.CommonOpManager;
import com.tencent.mtt.common.operation.CommonOpReqParam;
import com.tencent.mtt.common.operation.ICommonOpWrapper;
import com.tencent.mtt.file.pagecommon.views.SuccessTipViewHelper;
import com.tencent.mtt.newskin.SimpleSkinBuilder;
import com.tencent.mtt.nxeasy.page.EasyPageContext;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.view.common.QBImageTextView;
import com.tencent.mtt.view.common.QBImageView;
import com.tencent.mtt.view.common.QBTextView;
import com.tencent.mtt.view.common.QBView;
import com.tencent.mtt.view.layout.QBFrameLayout;
import com.tencent.mtt.view.layout.QBLinearLayout;
import com.tencent.mtt.view.scrollview.QBScrollView;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
import java.util.concurrent.Callable;
import qb.a.e;
import qb.download.business.BuildConfig;
public class DownloadDetailsPageProgressView extends DownloadDetailsPageContentBaseView implements DownloadTaskListener, SuccessTipViewHelper.AnimationEnd {
public static final int f37227c = MttResources.s(60);
public static final int f37228d = MttResources.s(40);
QBFrameLayout e;
QBLinearLayout f;
DownloadProgressView g;
QBTextView h;
QBTextView i;
String j;
EasyPageContext k;
QBScrollView l;
ICommonOpWrapper m;
SuccessTipViewHelper n;
CommonOpReqParam o;
QBLinearLayout p;
DownloadTaskListener q;
QBLinearLayout r;
int s;
View.OnClickListener t;
private int u;
private boolean v;
public DownloadDetailsPageProgressView(EasyPageContext easyPageContext, DownloadInfo downloadInfo, DownloadTask downloadTask, IDownloadDetailsPageViewInterface iDownloadDetailsPageViewInterface, DownloadTaskListener downloadTaskListener) {
super(easyPageContext.f68800c, iDownloadDetailsPageViewInterface);
this.j = "";
this.n = null;
this.u = -1;
this.s = 0;
this.v = false;
this.t = new View.OnClickListener() {
@Override
public void onClick(View view) {
EventCollector.getInstance().onViewClickedBefore(view);
if (view.getId() == 1002) {
if (DownloadDetailsPageProgressView.this.f37225a == null || DownloadDetailsPageProgressView.this.u != 2) {
DownloadDetailsPageProgressView.this.g();
} else {
DownloadDetailsPageProgressView.this.h();
}
}
EventCollector.getInstance().onViewClicked(view);
}
};
this.q = downloadTaskListener;
this.k = easyPageContext;
this.f37226b = downloadInfo;
this.j = DownloadUtils.a(downloadTask);
this.l = new QBScrollView(easyPageContext.f68800c);
this.l.setOverScrollMode(2);
this.l.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
this.r = new QBLinearLayout(getContext());
this.r.setContentDescription("rootContentContainer");
this.r.setOrientation(1);
this.r.setLayoutParams(new ViewGroup.LayoutParams(-1, -2));
a(this.r, downloadTask);
b(this.r, downloadTask);
f();
this.r.addView(this.p);
this.l.addView(this.r);
addView(this.l, new FrameLayout.LayoutParams(-1, -2));
c(this.r, downloadTask);
DownloadServiceManager.a().addTaskListener(this.f37226b.f37604a, this);
c(downloadTask);
}
public CommonOpReqParam a(int i, DownloadTask downloadTask) {
CommonOpReqParam commonOpReqParam = this.o;
if (commonOpReqParam == null) {
this.o = new CommonOpReqParam(i);
if (this.f37226b != null) {
this.o.e = this.f37226b.g;
this.o.f47837b = this.f37226b.f37606c;
this.o.f47839d = this.f37226b.e;
this.o.f47838c = this.f37226b.L;
this.o.h = this.f37226b.q;
if (downloadTask != null) {
this.o.i = downloadTask.T();
}
this.o.f47836a = this.f37225a.getPageFrom();
if (!TextUtils.isEmpty(this.o.e)) {
CommonOpReqParam commonOpReqParam2 = this.o;
commonOpReqParam2.f = a(commonOpReqParam2.f47837b);
} else if (TextUtils.isEmpty(this.o.f47838c)) {
CommonOpReqParam commonOpReqParam3 = this.o;
commonOpReqParam3.f47838c = a(commonOpReqParam3.f47837b);
}
}
} else {
commonOpReqParam.g = i;
}
return this.o;
}
private String a(String str) {
int lastIndexOf;
if (TextUtils.isEmpty(str) || (lastIndexOf = str.lastIndexOf(".")) < 0) {
return null;
}
return str.substring(0, lastIndexOf);
}
public void a(ResultCallback.Result result) {
if (result != ResultCallback.Result.OK) {
UrlParams urlParams = new UrlParams("qb://pagedownload/downloadhomepage");
urlParams.d(true);
((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(urlParams);
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
DownloadDetailsPageProgressView.this.k.f68798a.b();
}
}, 300L);
}
}
private void a(DownloadTask downloadTask) {
DownloadStatUtils.a("DLPOP_0120", this.f37225a.getPageFrom(), this.f37225a.getActionID(), this.f37226b);
QBTextView qBTextView = this.h;
if (qBTextView != null) {
qBTextView.setText("下载成功");
}
if (this.i != null && this.f37226b != null) {
this.i.setEllipsize(TextUtils.TruncateAt.MIDDLE);
String a2 = StringUtils.a(this.f37226b.f37607d);
this.i.setText(this.j + "(" + String.valueOf(a2) + ")");
}
QBFrameLayout qBFrameLayout = this.e;
if (qBFrameLayout != null) {
qBFrameLayout.removeAllViews();
this.n = new SuccessTipViewHelper(getContext());
View a3 = this.n.a();
this.n.a(this);
this.n.b();
if (a3 != null) {
this.e.addView(a3, new LinearLayout.LayoutParams(-1, -1));
}
}
QBLinearLayout qBLinearLayout = this.f;
if (qBLinearLayout != null) {
qBLinearLayout.removeAllViews();
this.f.setOrientation(0);
QBView qBView = new QBView(getContext());
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
layoutParams.weight = 1.0f;
this.f.addView(qBView, layoutParams);
DownloadProgressView downloadProgressView = new DownloadProgressView(getContext());
downloadProgressView.a();
downloadProgressView.setText("进入下载管理");
downloadProgressView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
EventCollector.getInstance().onViewClickedBefore(view);
DownloadStatUtils.a("DLPOP_0122", DownloadDetailsPageProgressView.this.f37225a.getPageFrom(), DownloadDetailsPageProgressView.this.f37225a.getActionID(), DownloadDetailsPageProgressView.this.f37226b);
DownloadStatUtils.b("DLPOP_0070", (String) null, DownloadDetailsPageProgressView.this.f37225a.getActionID(), DownloadDetailsPageProgressView.this.f37226b);
Bundle bundle = new Bundle();
bundle.putString("down:key_from_scene", "download_midpage");
UrlParams urlParams = new UrlParams("qb://pagedownload/downloadhomepage");
urlParams.a(bundle);
urlParams.d(true);
((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(urlParams);
EventCollector.getInstance().onViewClicked(view);
}
});
this.f.addView(downloadProgressView, new LinearLayout.LayoutParams(MttResources.s(150), f37228d));
this.f37225a.c(this.f);
this.f.addView(new QBView(getContext()), layoutParams);
ICommonOpWrapper iCommonOpWrapper = this.m;
if (iCommonOpWrapper != null) {
iCommonOpWrapper.a(a(2, downloadTask));
}
}
}
private void a(QBLinearLayout qBLinearLayout, DownloadTask downloadTask) {
int b2;
this.e = new QBFrameLayout(getContext());
this.e.setContentDescription("downloadMidPageIcon");
int i = f37227c;
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(i, i);
layoutParams.topMargin = getIconTopMargin();
layoutParams.gravity = 1;
qBLinearLayout.addView(this.e, layoutParams);
if (downloadTask == null || downloadTask.aq() || this.f37226b == null || TextUtils.isEmpty(this.f37226b.G)) {
QBImageView qBImageView = new QBImageView(getContext(), true);
qBImageView.setUseMaskForNightMode(true);
if (downloadTask == null || !downloadTask.aq()) {
b2 = MediaFileType.Utils.b(this.j);
if (b2 == 0) {
MediaFileType.b();
b2 = MediaFileType.Utils.b(this.j);
}
} else {
b2 = R.drawable.aph;
}
qBImageView.setImageNormalIds(b2);
qBImageView.setId(101);
qBImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
this.e.addView(qBImageView, new LinearLayout.LayoutParams(-1, -1));
} else {
QBWebImageView qBWebImageView = new QBWebImageView(getContext());
qBWebImageView.setUseMaskForNightMode(true);
qBWebImageView.setUrl(this.f37226b.G);
qBWebImageView.setId(101);
SimpleSkinBuilder.a((ImageView) qBWebImageView).f();
this.e.addView(qBWebImageView, new LinearLayout.LayoutParams(-1, -1));
}
this.h = new QBTextView(getContext(), true);
this.h.setGravity(17);
this.h.setTextColorNormalIds(e.ax);
this.h.setTextSize(MttResources.s(16));
this.h.setText(this.j);
this.h.setSingleLine(true);
this.h.setEllipsize(TextUtils.TruncateAt.MIDDLE);
StatManager.b().c("CQIE001_2");
LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-1, -2);
layoutParams2.setMargins(MttResources.s(20), getFileNameTopMargin(), MttResources.s(20), 0);
qBLinearLayout.addView(this.h, layoutParams2);
QBLinearLayout qBLinearLayout2 = new QBLinearLayout(getContext());
qBLinearLayout2.setOrientation(0);
QBView qBView = new QBView(getContext());
LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(-1, -1);
layoutParams3.weight = 1.0f;
qBLinearLayout2.addView(qBView, layoutParams3);
this.i = new QBTextView(getContext(), true);
LinearLayout.LayoutParams layoutParams4 = new LinearLayout.LayoutParams(-2, -2);
layoutParams4.setMargins(MttResources.s(20), 0, MttResources.s(20), 0);
this.i.setLayoutParams(layoutParams4);
this.i.setTextColorNormalIds(R.color.theme_common_color_a3);
this.i.setTextSize(MttResources.s(12));
this.i.setSingleLine(true);
String a2 = StringUtils.a(this.f37226b.f37607d);
if (this.f37226b.f37607d <= 0) {
a2 = MttResources.l(R.string.a0o);
}
this.i.setText(String.valueOf(a2));
qBLinearLayout2.addView(this.i);
this.f37225a.b(qBLinearLayout2);
QBView qBView2 = new QBView(getContext());
LinearLayout.LayoutParams layoutParams5 = new LinearLayout.LayoutParams(-1, -1);
layoutParams5.weight = 1.0f;
qBLinearLayout2.addView(qBView2, layoutParams5);
LinearLayout.LayoutParams layoutParams6 = new LinearLayout.LayoutParams(-1, -2);
layoutParams6.topMargin = MttResources.s(6);
qBLinearLayout.addView(qBLinearLayout2, layoutParams6);
DownloadStatUtils.a("DLPOP_0148", this.f37225a.getPageFrom(), this.f37225a.getActionID(), this.f37226b);
}
private void b(DownloadTask downloadTask) {
DownloadStatUtils.b("DLPOP_0075", (String) null, this.f37225a.getActionID(), this.f37226b);
DownloadStatUtils.a("DLPOP_0133", this.f37225a.getPageFrom(), this.f37225a.getActionID(), this.f37226b);
QBTextView qBTextView = this.h;
if (qBTextView != null) {
qBTextView.setText("下载失败");
}
if (this.i != null && this.f37226b != null) {
String a2 = StringUtils.a(this.f37226b.f37607d);
this.i.setText(this.j + "(" + String.valueOf(a2) + ")");
}
QBFrameLayout qBFrameLayout = this.e;
if (qBFrameLayout != null) {
qBFrameLayout.removeAllViews();
QBWebImageView qBWebImageView = new QBWebImageView(getContext());
qBWebImageView.setUseMaskForNightMode(true);
qBWebImageView.setUrl("https://static.res.qq.com/qbt/file/icon_error_large.png");
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
SimpleSkinBuilder.a((ImageView) qBWebImageView).f();
this.e.addView(qBWebImageView, layoutParams);
}
QBLinearLayout qBLinearLayout = this.f;
if (qBLinearLayout != null) {
qBLinearLayout.removeAllViews();
this.f.setOrientation(0);
QBView qBView = new QBView(getContext());
LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-1, -1);
layoutParams2.weight = 1.0f;
this.f.addView(qBView, layoutParams2);
DownloadProgressView downloadProgressView = new DownloadProgressView(getContext());
downloadProgressView.setProgress(100);
downloadProgressView.a();
downloadProgressView.setText("返回重试");
downloadProgressView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
EventCollector.getInstance().onViewClickedBefore(view);
DownloadStatUtils.b("DLPOP_0076", (String) null, DownloadDetailsPageProgressView.this.f37225a.getActionID(), DownloadDetailsPageProgressView.this.f37226b);
DownloadStatUtils.a("DLPOP_0134", DownloadDetailsPageProgressView.this.f37225a.getPageFrom(), DownloadDetailsPageProgressView.this.f37225a.getActionID(), DownloadDetailsPageProgressView.this.f37226b);
DownloadDetailsPageProgressView.this.k.f68798a.a();
EventCollector.getInstance().onViewClicked(view);
}
});
LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(MttResources.s(150), f37228d);
layoutParams3.gravity = 1;
this.f.addView(downloadProgressView, layoutParams3);
this.f.addView(new QBView(getContext()), layoutParams2);
ICommonOpWrapper iCommonOpWrapper = this.m;
if (iCommonOpWrapper != null) {
iCommonOpWrapper.a(a(2, downloadTask));
}
}
}
private void b(QBLinearLayout qBLinearLayout, DownloadTask downloadTask) {
this.f = new QBLinearLayout(getContext());
this.g = new DownloadProgressView(getContext());
this.g.a();
this.g.setId(1002);
this.g.setContentDescription("progress_download_button");
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
layoutParams.leftMargin = MttResources.s(20);
layoutParams.rightMargin = MttResources.s(20);
this.g.setOnClickListener(this.t);
if (downloadTask != null) {
int V = downloadTask.V();
long Z = downloadTask.Z();
long o = downloadTask.o();
String a2 = StringUtils.a(Z);
String a3 = StringUtils.a(o);
this.g.setProgress(V);
this.g.setText(String.format(MttResources.l(R.string.a09), a2, a3));
}
this.f.addView(this.g, layoutParams);
LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-1, f37228d);
layoutParams2.topMargin = getButtonTopMargin();
layoutParams2.bottomMargin = getButtonBottomMargin();
qBLinearLayout.addView(this.f, layoutParams2);
}
public void c(DownloadTask downloadTask) {
if (downloadTask == null) {
return;
}
if (downloadTask != null) {
this.u = downloadTask.U();
}
int i = this.u;
if (i != 0) {
if (i == 1 || i == 2) {
if (!this.v) {
this.v = true;
DownloadStatUtils.b("DLPOP_0113", (String) null, this.f37225a.getActionID(), this.f37226b);
}
QBLinearLayout qBLinearLayout = this.p;
if (qBLinearLayout != null) {
qBLinearLayout.setVisibility(8);
}
int V = downloadTask.V();
this.j = DownloadUtils.a(downloadTask);
QBTextView qBTextView = this.h;
if (qBTextView != null) {
qBTextView.setText(this.j);
}
this.g.setProgress(V);
setProgressInfo(downloadTask);
return;
}
if (i == 3) {
this.j = DownloadUtils.a(downloadTask);
this.f37226b.f = downloadTask.r();
this.f37226b.f37606c = downloadTask.m();
this.f37226b.f37607d = downloadTask.n();
QBLinearLayout qBLinearLayout2 = this.p;
if (qBLinearLayout2 != null) {
qBLinearLayout2.setVisibility(8);
}
DownloadTaskListener downloadTaskListener = this.q;
if (downloadTaskListener != null) {
downloadTaskListener.onTaskCompleted(downloadTask);
}
a(downloadTask);
return;
}
if (i == 5) {
this.f37226b.f = downloadTask.r();
this.f37226b.f37606c = downloadTask.m();
this.f37226b.f37607d = downloadTask.n();
this.j = DownloadUtils.a(downloadTask);
QBLinearLayout qBLinearLayout3 = this.p;
if (qBLinearLayout3 != null) {
qBLinearLayout3.setVisibility(8);
}
b(downloadTask);
return;
}
if (i == 6) {
DownloadProgressView downloadProgressView = this.g;
if (downloadProgressView != null) {
downloadProgressView.setText("继续下载");
}
QBLinearLayout qBLinearLayout4 = this.p;
if (qBLinearLayout4 != null) {
qBLinearLayout4.setVisibility(8);
return;
}
return;
}
if (i != 20) {
return;
}
}
int V2 = downloadTask.V();
long Z = downloadTask.Z();
long o = downloadTask.o();
String a2 = StringUtils.a(Z);
String a3 = StringUtils.a(o);
DownloadProgressView downloadProgressView2 = this.g;
if (downloadProgressView2 != null) {
downloadProgressView2.setProgress(V2);
this.g.setText(String.format(MttResources.l(R.string.a08), a2, a3));
}
QBLinearLayout qBLinearLayout5 = this.p;
if (qBLinearLayout5 != null && qBLinearLayout5.getVisibility() != 0) {
DownloadStatUtils.a("DLPOP_0117", this.f37225a.getPageFrom(), this.f37225a.getActionID(), this.f37226b);
}
QBLinearLayout qBLinearLayout6 = this.p;
if (qBLinearLayout6 != null) {
qBLinearLayout6.setVisibility(0);
}
}
private void c(final QBLinearLayout qBLinearLayout, final DownloadTask downloadTask) {
post(new Runnable() {
@Override
public void run() {
if (DownloadDetailsPageProgressView.this.f37225a != null) {
DownloadDetailsPageProgressView.this.m = CommonOpManager.a().a(DownloadDetailsPageProgressView.this.f37225a.getAdID(), DownloadDetailsPageProgressView.this.getOpAreaHeight());
DownloadDetailsPageProgressView.this.l.a(new QBScrollView.MttScrollViewListener() {
@Override
public void a() {
}
@Override
public void a(int i) {
}
@Override
public void a(int i, int i2) {
if (i2 == 0) {
DownloadDetailsPageProgressView.this.m.f();
}
}
@Override
public void b(int i) {
}
});
if (DownloadDetailsPageProgressView.this.m != null) {
qBLinearLayout.addView(DownloadDetailsPageProgressView.this.m.getContentView());
if (DownloadDetailsPageProgressView.this.m != null) {
int i = 2;
if (DownloadDetailsPageProgressView.this.u != 3 && DownloadDetailsPageProgressView.this.u != 5) {
i = 1;
}
DownloadDetailsPageProgressView.this.m.a(DownloadDetailsPageProgressView.this.a(i, downloadTask));
}
}
}
}
});
}
private void f() {
this.p = new QBLinearLayout(getContext());
this.p.setOrientation(0);
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, -2);
layoutParams.gravity = 81;
this.p.setLayoutParams(layoutParams);
QBView qBView = new QBView(getContext());
LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-1, -1);
layoutParams2.weight = 1.0f;
this.p.addView(qBView, layoutParams2);
QBTextView qBTextView = new QBTextView(getContext(), true);
qBTextView.setTextSize(MttResources.s(12));
qBTextView.setTextColorNormalIds(e.f85873b);
qBTextView.setText("下载队列已满,进入");
this.p.addView(qBTextView, new LinearLayout.LayoutParams(-2, -2));
QBImageTextView qBImageTextView = new QBImageTextView(getContext(), 2);
qBImageTextView.setImageNormalIds(R.drawable.avt);
qBImageTextView.setUseMaskForNightMode(true);
qBImageTextView.setTextSize(MttResources.s(12));
qBImageTextView.mQBTextView.setTextColorNormalIds(R.color.og);
qBImageTextView.setText("下载管理");
qBImageTextView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
EventCollector.getInstance().onViewClickedBefore(view);
Bundle bundle = new Bundle();
bundle.putString("down:key_from_scene", "download_midpage");
UrlParams urlParams = new UrlParams("qb://pagedownload/downloadhomepage");
urlParams.a(bundle);
urlParams.d(true);
((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(urlParams);
DownloadStatUtils.b("DLPOP_0066", (String) null, DownloadDetailsPageProgressView.this.f37225a.getActionID(), DownloadDetailsPageProgressView.this.f37226b);
DownloadStatUtils.a("DLPOP_0118", DownloadDetailsPageProgressView.this.f37225a.getPageFrom(), DownloadDetailsPageProgressView.this.f37225a.getActionID(), DownloadDetailsPageProgressView.this.f37226b);
EventCollector.getInstance().onViewClicked(view);
}
});
this.p.addView(qBImageTextView, new LinearLayout.LayoutParams(-2, -2));
QBView qBView2 = new QBView(getContext());
LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(-1, -1);
layoutParams3.weight = 1.0f;
this.p.addView(qBView2, layoutParams3);
this.p.setVisibility(8);
}
public void g() {
DownloadStatUtils.a("DLPOP_0115", this.f37225a.getPageFrom(), this.f37225a.getActionID(), this.f37226b);
this.f37226b.j = false;
this.f37226b.k = false;
BusinessDownloadService.getInstance().startDownloadTask(this.f37226b, OverwritePolicy.NEED_CONFIRM, new ResultCallback<DownloadTask>() {
@Override
public void onResult(ResultCallback.Result result, DownloadTask downloadTask) {
DownloadDetailsPageProgressView.this.a(result);
}
});
}
private int getButtonBottomMargin() {
return MttResources.s(StringUtils.b(PreferenceData.a(getKey()), 0) == 2 ? 16 : 20);
}
private int getButtonTopMargin() {
return MttResources.s(StringUtils.b(PreferenceData.a(getKey()), 0) == 2 ? 50 : 28);
}
private int getFileNameTopMargin() {
return MttResources.s(StringUtils.b(PreferenceData.a(getKey()), 0) == 2 ? 22 : 20);
}
private int getIconTopMargin() {
return MttResources.s(StringUtils.b(PreferenceData.a(getKey()), 0) == 2 ? 70 : 30);
}
private String getKey() {
int fileType = this.f37225a.getFileType();
return fileType != 2 ? fileType != 3 ? "KEY_DOWNLOAD_MID_PAGE_EXPRIMENT_NORMAL" : "KEY_DOWNLOAD_MID_PAGE_EXPRIMENT_VIDEO" : "KEY_DOWNLOAD_MID_PAGE_EXPRIMENT_APK";
}
public int getOpAreaHeight() {
if (this.s <= 0) {
this.s = getMeasuredHeight() - this.r.getMeasuredHeight();
}
return this.s;
}
public void h() {
BusinessDownloadService.getInstance().pauseDownloadTask(this.f37226b.f37604a, PauseReason.MANUAL);
DownloadStatUtils.a("DLPOP_0114", this.f37225a.getPageFrom(), this.f37225a.getActionID(), this.f37226b);
}
private void setProgressInfo(DownloadTask downloadTask) {
DownloadProgressView downloadProgressView;
String format;
long Z = downloadTask.Z();
long o = downloadTask.o();
String a2 = StringUtils.a(Z);
if (o > 0 || !FeatureToggle.a(BuildConfig.BUG_TOGGLE_DOWNLOADFILESIZE_93556715)) {
String a3 = StringUtils.a(o);
this.i.setText(a3);
downloadProgressView = this.g;
format = String.format(MttResources.l(R.string.a09), a2, a3);
} else {
this.i.setText(a2);
float d2 = downloadTask.d();
downloadProgressView = this.g;
format = String.format(MttResources.l(R.string.a09), StringUtils.c(d2), a2);
}
downloadProgressView.setText(format);
}
@Override
public void a() {
String str;
ICommonOpWrapper iCommonOpWrapper = this.m;
if (iCommonOpWrapper != null) {
iCommonOpWrapper.e();
}
int i = this.u;
if (i != 0) {
if (i != 1 && i != 2) {
if (i == 3) {
str = "DLPOP_0132";
} else if (i == 5) {
str = "DLPOP_0137";
} else if (i != 6) {
if (i != 20) {
str = "";
}
}
DownloadStatUtils.a(str, this.f37225a.getPageFrom(), this.f37225a.getActionID(), this.f37226b);
DownloadServiceManager.a().removeTaskListener(this);
}
str = "DLPOP_0116";
DownloadStatUtils.a(str, this.f37225a.getPageFrom(), this.f37225a.getActionID(), this.f37226b);
DownloadServiceManager.a().removeTaskListener(this);
}
str = "DLPOP_0119";
DownloadStatUtils.a(str, this.f37225a.getPageFrom(), this.f37225a.getActionID(), this.f37226b);
DownloadServiceManager.a().removeTaskListener(this);
}
@Override
public void a(Animator animator) {
}
@Override
public void b() {
ICommonOpWrapper iCommonOpWrapper = this.m;
if (iCommonOpWrapper != null) {
iCommonOpWrapper.c();
}
}
@Override
public void c() {
ICommonOpWrapper iCommonOpWrapper = this.m;
if (iCommonOpWrapper != null) {
iCommonOpWrapper.d();
}
}
@Override
public void d() {
ICommonOpWrapper iCommonOpWrapper = this.m;
if (iCommonOpWrapper != null) {
iCommonOpWrapper.a();
}
}
@Override
public void e() {
ICommonOpWrapper iCommonOpWrapper = this.m;
if (iCommonOpWrapper != null) {
iCommonOpWrapper.b();
}
}
@Override
public void onTaskCompleted(final DownloadTask downloadTask) {
QBTask.b((Callable) new Callable<Object>() {
@Override
public Object call() throws Exception {
DownloadDetailsPageProgressView.this.c(downloadTask);
return null;
}
});
}
@Override
public void onTaskCreated(final DownloadTask downloadTask) {
QBTask.b((Callable) new Callable<Object>() {
@Override
public Object call() throws Exception {
if (DownloadDetailsPageProgressView.this.q != null) {
DownloadDetailsPageProgressView.this.q.onTaskCreated(downloadTask);
}
DownloadDetailsPageProgressView.this.c(downloadTask);
return null;
}
});
}
@Override
public void onTaskFailed(final DownloadTask downloadTask, DownloadErrorDetail downloadErrorDetail) {
QBTask.b((Callable) new Callable<Object>() {
@Override
public Object call() throws Exception {
DownloadDetailsPageProgressView.this.c(downloadTask);
return null;
}
});
}
@Override
public void onTaskPaused(final DownloadTask downloadTask, PauseReason pauseReason) {
QBTask.b((Callable) new Callable<Object>() {
@Override
public Object call() throws Exception {
DownloadDetailsPageProgressView.this.c(downloadTask);
return null;
}
});
}
@Override
public void onTaskProgress(final DownloadTask downloadTask) {
QBTask.b((Callable) new Callable<Object>() {
@Override
public Object call() throws Exception {
DownloadDetailsPageProgressView.this.c(downloadTask);
return null;
}
});
}
@Override
public void onTaskRemoved(final DownloadTask downloadTask) {
QBTask.b((Callable) new Callable<Object>() {
@Override
public Object call() throws Exception {
DownloadDetailsPageProgressView.this.c(downloadTask);
return null;
}
});
}
@Override
public void onTaskStarted(final DownloadTask downloadTask) {
QBTask.b((Callable) new Callable<Object>() {
@Override
public Object call() throws Exception {
DownloadDetailsPageProgressView.this.c(downloadTask);
return null;
}
});
}
@Override
public void onTaskWaiting(final DownloadTask downloadTask) {
QBTask.b((Callable) new Callable<Object>() {
@Override
public Object call() throws Exception {
DownloadDetailsPageProgressView.this.c(downloadTask);
return null;
}
});
}
}