Commit 4d71e0ed authored by jyx's avatar jyx

CPD数据拉取顺序优化

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