Commit 4d71e0ed authored by jyx's avatar jyx

CPD数据拉取顺序优化

parent 0887ddbc
......@@ -7,7 +7,6 @@ import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.mvp.model.WeightBean
import com.mints.goodmoney.utils.LogUtil
import com.mints.goodmoney.utils.ToastUtil
import com.qq.e.ads.nativ.NativeExpressADView
import java.util.*
......@@ -19,8 +18,8 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
private val TAG = PreLoadExpressManager::class.java.simpleName
@Volatile
private var currentIndex = 0
// @Volatile
// private var currentIndex = 0
@Volatile
private var mAdFrameLayout: FrameLayout? = null
......
......@@ -6,7 +6,6 @@ import android.widget.FrameLayout;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.manager.TTNativeExpressManager;
import com.mints.goodmoney.manager.TtCsjAdManager;
import com.mints.goodmoney.utils.Utils;
public class TTPreLoadExpressManager {
......
......@@ -284,9 +284,6 @@ public class VersionUpdatePresenter {
@Override
public void finishProgress() {
if (pbDuUpdating != null) {
pbDuUpdating.setProgress(100);
}
if (btnDuUpdate != null) {
btnDuUpdate.setEnabled(true);
btnDuUpdate.setText("立即安装");
......
......@@ -259,18 +259,20 @@ public class UpdateService extends Service {
if (httpURLConnection.getResponseCode() == 404) {
throw new Exception("fail!");
}
inputStream = httpURLConnection.getInputStream();
outputStream = new FileOutputStream(file, false);// 文件存在则覆盖掉
byte buffer[] = new byte[1024];
int readsize = 0;
byte[] buffer = new byte[2048];
int readsize;
while ((readsize = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, readsize);
downloadCount += readsize;// 时时获取下载到的大小
/**
/*
* 每次增张5%
*/
if (updateCount == 0
|| (downloadCount * 100 / totalSize - down_step) >= updateCount) {
|| (downloadCount / (totalSize / 100) - down_step) >= updateCount) {
updateCount += down_step;
message = new Message();
message.what = DOWN_PROGRESS;
......
......@@ -16,7 +16,6 @@ import com.mints.goodmoney.ui.adapter.listener.OnItemChildClickListener
import com.mints.goodmoney.ui.adapter.listener.OnItemClickListener
import com.mints.library.utils.GlideUtils
import com.tz.sdk.core.ui.ADContainer
import java.lang.ref.WeakReference
class TaskAdapter(val dataList: List<TzTaskBean>, val context: Context) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
......@@ -60,7 +59,7 @@ class TaskAdapter(val dataList: List<TzTaskBean>, val context: Context) : Recycl
}
val holder = viewHolder as BaseViewHolder
GlideUtils.loadImageView(context, data.icon, holder.ivAvatar)
GlideUtils.loadImageViewNoAnim(context, data.icon, holder.ivAvatar)
holder.tvTitle.text = data.title
holder.tvCoin.text = "+" + data.coin + "金币"
when (data.state) {
......
......@@ -167,7 +167,10 @@ class TaskCpdFragment : BaseFragment(), TaskView,
// 珊瑚和CPD展示顺序
if (CPD_ORDER == "CPD_SYD") {
if (cpdMax > 0) {
loadCPDDataList()
// 拉取数组数据
// loadCPDDataList()
// 循环拉取数据
loadCPDDataCycle()
}
} else if (CPD_ORDER == "CPD_SH") {
if (shMax > 0) {
......@@ -176,26 +179,6 @@ class TaskCpdFragment : BaseFragment(), TaskView,
} else {
notifyDataAndShowAd()
}
// when {
// shMax > 0 -> {
// // 先加载珊瑚广告,珊瑚回调判断圣于地
// for (i in 0 until shMax) {
// mCoralDownload?.pull()
// }
// }
// cpdMax > 0 -> {
// for (i in 0 until cpdMax) {
// loadCPDData()
// }
// loadCPDDataList()
// }
// else -> {
// notifyDataAndShowAd()
// }
// }
}
private fun loadShDataList() {
......@@ -205,17 +188,17 @@ class TaskCpdFragment : BaseFragment(), TaskView,
}
}
// private fun loadCPDDataCycle() {
// // 循环拉取圣于地CPD广告拉取
// for (i in cpdLoadCountTime until cpdMax) {
// loadCPDData()
// }
// }
private fun loadCPDDataCycle() {
// 循环拉取圣于地CPD广告拉取
for (i in cpdLoadCountTime until cpdMax) {
loadCPDData()
}
}
// private fun loadCPDData() {
// LogUtil.d(TAG, "syd loadCPDData")
// taskPresenter.getCpdDetail(outNetIp)
// }
private fun loadCPDData() {
LogUtil.d(TAG, "syd loadCPDData")
taskPresenter.getCpdDetail(outNetIp)
}
private fun loadCPDDataList() {
// 圣于地CPD广告拉取
......@@ -243,13 +226,6 @@ class TaskCpdFragment : BaseFragment(), TaskView,
if (cpdLoadCountTime++ >= cpdMax - 1) {
getCpdRepeatPkg()
if (shMax == 0 || shLoadCountTime >= shMax) {
notifyDataAndShowAd()
} else {
// 圣于地拉取完成后 调用珊瑚广告
loadShDataList()
}
}
LogUtil.d(TAG, "syd getCpdModelSuc $cpdLoadCountTime")
......@@ -297,6 +273,8 @@ class TaskCpdFragment : BaseFragment(), TaskView,
if (shMax == 0 || shLoadCountTime >= shMax) {
notifyDataAndShowAd()
} else {
cpdLoadCountTime = cpdMax
// 圣于地拉取完成后 调用珊瑚广告
loadShDataList()
}
......@@ -380,6 +358,13 @@ class TaskCpdFragment : BaseFragment(), TaskView,
mFakeTaskList.clear()
mFakeTaskList.addAll(t)
if (shMax == 0 || shLoadCountTime >= shMax) {
notifyDataAndShowAd()
} else {
// 圣于地拉取完成后 调用珊瑚广告
loadShDataList()
}
// notifyDataAndShowAd()
// 重新获取数据
......
......@@ -33,6 +33,11 @@ public class GlideUtils {
Glide.with(mContext).load(path).into(mImageView);
}
//默认加载
public static void loadImageViewNoAnim(Context mContext, String path, ImageView mImageView) {
Glide.with(mContext).load(path).dontAnimate().into(mImageView);
}
//设置加载中图片
public static void loadImageViewLoding(Context mContext, String path, ImageView mImageView, int lodingImage) {
RequestOptions requestOptions = new RequestOptions();
......
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