Commit 8efd08e8 authored by jyx's avatar jyx

代码优化

parent b116c2fc
......@@ -14,8 +14,9 @@ public class TzTaskBean {
private int coin;
private int state;
private String currentPkgName;
private String downLoadPkgName;
public TzTaskBean(String icon, String title,String description, boolean isShCpd,int coin, int state, String currentPkgName) {
public TzTaskBean(String icon, String title,String description, boolean isShCpd,int coin, int state, String downLoadPkgName) {
this.icon = icon;
this.title = title;
this.description = description;
......@@ -23,7 +24,15 @@ public class TzTaskBean {
this.coralAd = coralAd;
this.coin = coin;
this.state = state;
this.currentPkgName = currentPkgName;
this.downLoadPkgName = downLoadPkgName;
}
public String getDownLoadPkgName() {
return downLoadPkgName;
}
public void setDownLoadPkgName(String downLoadPkgName) {
this.downLoadPkgName = downLoadPkgName;
}
public String getDescription() {
......
......@@ -218,7 +218,7 @@ class TaskActivity : BaseActivity(), TaskView,
if (!mFakeTaskList[i].isShCpd && !mFakeTaskList[j].isShCpd) {
// 数据重复
if (i != j && mFakeTaskList[i].currentPkgName == mFakeTaskList[j].currentPkgName) {
if (i != j && mFakeTaskList[i].downLoadPkgName == mFakeTaskList[j].downLoadPkgName) {
flag = false
break
}
......@@ -227,7 +227,7 @@ class TaskActivity : BaseActivity(), TaskView,
if (flag) {
// 是否已经安装此app
if (!DeviceInfo.instance.isLoadingPkg(mFakeTaskList[i].currentPkgName)) {
if (!DeviceInfo.instance.isLoadingPkg(mFakeTaskList[i].downLoadPkgName)) {
cpdLoadCountTime--
newPkgData.add(mFakeTaskList[i])
}
......@@ -470,8 +470,9 @@ class TaskActivity : BaseActivity(), TaskView,
taskPresenter.cmtImp(trackerBean.clikc[0])
}
// 圣于地开始下载
DownloadApkManager.setOnMyDownloadListener(this@TaskActivity)
DownloadApkManager.downloadApk(this@TaskActivity, mFakeTaskList[position].app_url, mFakeTaskList[position].currentPkgName)
DownloadApkManager.downloadApk(this@TaskActivity, mFakeTaskList[position].app_url, mFakeTaskList[position].downLoadPkgName)
}
})
taskCpdDialog?.setData(mFakeTaskList[position].title, mFakeTaskList[position].description, mFakeTaskList[position].icon, needUseTime, mCoin)
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/header_layout" />
<com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/srl_task"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_F8F"
app:srlAccentColor="@color/gray"
app:srlPrimaryColor="@color/color_50E8E8E8">
<com.scwang.smartrefresh.layout.header.ClassicsHeader
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recy_task"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<ImageView
android:id="@+id/iv_empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@mipmap/ic_record_empty"
android:visibility="gone" />
</FrameLayout>
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</LinearLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment