Commit 1e4580a5 authored by jyx's avatar jyx

修改圣于地珊瑚顺序配置,进度条显示不全

parent b4476efa
......@@ -27,7 +27,7 @@ public class TzTaskBean {
private String aid;
public TzTaskBean(String icon, String title,String description, boolean isShCpd,int coin, int state, String downLoadPkgName) {
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;
......@@ -38,7 +38,7 @@ public class TzTaskBean {
this.downLoadPkgName = downLoadPkgName;
}
public TzTaskBean(String icon, String title,int coin, int state, String currentPkgName,String aid) {
public TzTaskBean(String icon, String title, int coin, int state, String currentPkgName, String aid) {
this.icon = icon;
this.title = title;
this.coin = coin;
......@@ -75,19 +75,19 @@ public class TzTaskBean {
this.app_url = app_url;
}
// public CpdModelBean.DataBean.MaterialsBean.TrackerBean getTrackerBean() {
// return trackerBean;
// }
//
// public void setTrackerBean(CpdModelBean.DataBean.MaterialsBean.TrackerBean trackerBean) {
// this.trackerBean = trackerBean;
// }
public CpdModelBean.DataBean.MaterialsBean.TrackerBean getTrackerBean() {
return trackerBean;
}
public void setTrackerBean(CpdModelBean.DataBean.MaterialsBean.TrackerBean trackerBean) {
this.trackerBean = trackerBean;
}
public SydCpdListBean.DataBean.MaterialsBean.TrackerBean getTrackerBean() {
public SydCpdListBean.DataBean.MaterialsBean.TrackerBean getTrackerListBean() {
return trackerListBean;
}
public void setTrackerBean(SydCpdListBean.DataBean.MaterialsBean.TrackerBean trackerListBean) {
public void setTrackerListBean(SydCpdListBean.DataBean.MaterialsBean.TrackerBean trackerListBean) {
this.trackerListBean = trackerListBean;
}
......@@ -143,19 +143,4 @@ public class TzTaskBean {
this.currentPkgName = currentPkgName;
}
@Override
public String toString() {
return "TzTaskBean{" +
"icon='" + icon + '\'' +
", title='" + title + '\'' +
", description='" + description + '\'' +
", app_url='" + app_url + '\'' +
", isShCpd=" + isShCpd +
", coralAd=" + coralAd +
", trackerBean=" + trackerBean +
", coin=" + coin +
", state=" + state +
", currentPkgName='" + currentPkgName + '\'' +
'}';
}
}
......@@ -43,8 +43,13 @@ class TaskPresenter : BasePresenter<TaskView>() {
when (code) {
200 -> {
if (data != null) {
view.getShCpdTimeSuc(data.get("needSeconds").asInt, data.get("coin").asInt,
data.get("CPD").asInt, data.get("CPD_SYD").asInt)
view.getShCpdTimeSuc(
data.get("needSeconds").asInt,
data.get("coin").asInt,
data.get("CPD").asInt,
data.get("CPD_SYD").asInt,
data.get("cpdOrder").asString
)
}
}
}
......@@ -104,9 +109,9 @@ class TaskPresenter : BasePresenter<TaskView>() {
})
}
fun getCpdListDetail(ip: String,number:Int) {
fun getCpdListDetail(ip: String, number: Int) {
AppHttpManager.getInstance(loanApplication)
.call(CpdService.Factory.getInstance().getAdVedio(CpdManager.getCpdLisrUrl(), CpdManager.getCpdListBody(ip,number)),
.call(CpdService.Factory.getInstance().getAdVedio(CpdManager.getCpdLisrUrl(), CpdManager.getCpdListBody(ip, number)),
object : BaseSubscriber<JsonObject>() {
override fun onCompleted() {
}
......
......@@ -4,7 +4,7 @@ import com.mints.goodmoney.mvp.model.CpdModelBean
import com.mints.goodmoney.mvp.model.SydCpdListBean
interface TaskView : BaseView {
fun getShCpdTimeSuc(time: Int, coin: Int, CPD: Int, CPD_SYD: Int)
fun getShCpdTimeSuc(time: Int, coin: Int, CPD: Int, CPD_SYD: Int, CPD_ORDER: String?)
fun getCpdModelSuc(dataBean: CpdModelBean.DataBean)
......
......@@ -377,10 +377,12 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
AppConfig.isSuperTask = false
if (mReceiverBroadcastReceiver != null) {
if (mReceiverBroadcastReceiver!!.isInitialStickyBroadcast) {
mContext.stopService(Intent(context, AppInstallService::class.java))
mContext.unregisterReceiver(mReceiverBroadcastReceiver)
mReceiverBroadcastReceiver = null
}
}
awardPresenter.setHighTaskType("0")
......
......@@ -2,11 +2,11 @@ package com.mints.goodmoney.ui.fragment
import android.Manifest
import android.annotation.SuppressLint
import android.app.Dialog
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.app.Dialog
import android.os.Bundle
import android.text.TextUtils
import android.view.View
......@@ -34,14 +34,11 @@ import com.mints.goodmoney.ui.adapter.GvMyAdapter
import com.mints.goodmoney.ui.adapter.MainMyAdapter
import com.mints.goodmoney.ui.adapter.listener.OnItemChildClickListener
import com.mints.goodmoney.ui.fragment.base.BaseFragment
import com.mints.goodmoney.ui.widgets.dialog.DialogListener
import com.mints.goodmoney.ui.widgets.ShareDialog
import com.mints.goodmoney.ui.widgets.dialog.DialogListener
import com.mints.goodmoney.ui.widgets.dialog.DialogUtils
import com.mints.goodmoney.ui.widgets.seekbar.BubbleUtils
import com.mints.goodmoney.utils.AppUtil
import com.mints.goodmoney.utils.LogUtil
import com.mints.goodmoney.utils.QQJumpUtil
import com.mints.goodmoney.utils.SpanUtils
import com.mints.goodmoney.utils.*
import com.mints.library.net.netstatus.NetUtils
import com.mints.library.utils.CommonUtils
import com.mints.library.utils.GlideUtils
......@@ -721,7 +718,7 @@ class MyFragment : BaseFragment(),
0 -> {
// 牧场人生包名
pkgMCRSCarrier = Constant.CARRIER_MC_FIRSTDOWNLOAD
pkgMCRSKey=""
pkgMCRSKey = ""
pkgMCRSName = taskBean.otherConfig.pkg
// 下载牧场人生
......@@ -1157,7 +1154,7 @@ class MyFragment : BaseFragment(),
}
private fun initExpress(flowAdRules: FlowAdRulesBean) {
PreLoadExpressManager.init(flowAdRules.csj,flowAdRules.ylh,flowAdRules.ks)
PreLoadExpressManager.init(flowAdRules.csj, flowAdRules.ylh, flowAdRules.ks)
}
/**
......@@ -1305,7 +1302,7 @@ class MyFragment : BaseFragment(),
myPresenter.setHighTaskType(Constant.CARRIER_HIGH_ACTIVITY, "3")
} else if (TextUtils.equals(pkg, pkgMCRSName)) {
// 上报后台更新按钮状态
myPresenter.setHighTaskType(pkgMCRSCarrier, "1",pkgMCRSKey)
myPresenter.setHighTaskType(pkgMCRSCarrier, "1", pkgMCRSKey)
}
} catch (e: Exception) {
......
......@@ -68,7 +68,7 @@ class TaskCpdFragment : BaseFragment(), TaskView,
private var tryTimeOut = false
// 圣于地第二次拉取重复不拉取
private var isTwiceGetCpd = false
// private var isTwiceGetCpd = false
private val outNetIp by lazy { SPUtil.getInstance().getString(Constant.OUT_NET_IP) }
......@@ -81,7 +81,7 @@ class TaskCpdFragment : BaseFragment(), TaskView,
@Volatile
private var shLoadCountTime = 0 // 珊瑚 加载广告次数
@Volatile
// @Volatile
private var cpdLoadCountTime = 0 // CPD 加载广告次数
override fun initViewsAndEvents() {
......@@ -97,18 +97,13 @@ class TaskCpdFragment : BaseFragment(), TaskView,
loadData()
}
private fun loadCPDData() {
LogUtil.d(TAG, "syd loadCPDData")
taskPresenter.getCpdDetail(outNetIp)
}
private fun initView() {
val gridLayoutManager = GridLayoutManager(activity, 3)
recy_task.layoutManager = gridLayoutManager
recy_task.addItemDecoration(SpacesItemDecoration(3, SpacesItemDecoration.px2dp(10f)))
mTaskAdapter = TaskAdapter(mFakeTaskList, activity!!)
recy_task.adapter = mTaskAdapter
recy_task.setItemViewCacheSize(20)
recy_task.setItemViewCacheSize(10)
mTaskAdapter?.setOnItemChildClickListener(this)
}
......@@ -141,7 +136,7 @@ class TaskCpdFragment : BaseFragment(), TaskView,
override fun getContentViewLayoutID() = R.layout.activity_task
override fun getShCpdTimeSuc(time: Int, coin: Int, CPD: Int, CPD_SYD: Int) {
override fun getShCpdTimeSuc(time: Int, coin: Int, CPD: Int, CPD_SYD: Int, CPD_ORDER: String?) {
needUseTime = time
mCoin = coin
shMax = CPD
......@@ -159,57 +154,75 @@ class TaskCpdFragment : BaseFragment(), TaskView,
return
}
isTwiceGetCpd = false
// isTwiceGetCpd = false
shLoadCountTime = 0
cpdLoadCountTime = 0
mFakeTaskList.clear()
if (shMax > 0) {
// 先加载珊瑚广告,珊瑚回调判断圣于地
for (i in 0 until shMax) {
mCoralDownload?.pull()
if (TextUtils.isEmpty(CPD_ORDER)) {
notifyDataAndShowAd()
return
}
} else if (cpdMax > 0) {
// for (i in 0 until cpdMax) {
// loadCPDData()
// }
// 珊瑚和CPD展示顺序
if (CPD_ORDER == "CPD_SYD") {
if (cpdMax > 0) {
loadCPDDataList()
} else {
notifyDataAndShowAd()
}
} else if (CPD_ORDER == "CPD_SH") {
if (shMax > 0) {
loadShDataList()
}
private fun loadCPDDataList() {
taskPresenter.getCpdListDetail(outNetIp, cpdMax)
} else {
notifyDataAndShowAd()
}
override fun getCpdModelSuc(dataBean: CpdModelBean.DataBean) {
// for (material in dataBean.materials) {
// // 校验包名、下载apk为空 跳过
// if (TextUtils.isEmpty(material.app_apk_name) || TextUtils.isEmpty(material.app_url)) {
// if (BuildConfig.DEBUG) {
// LogUtil.d(TAG, "syd getCpdModelSuc 校验包名、下载apk为空 跳过${dataBean.uuid}")
// when {
// shMax > 0 -> {
// // 先加载珊瑚广告,珊瑚回调判断圣于地
// for (i in 0 until shMax) {
// mCoralDownload?.pull()
// }
// continue
// }
//
// val tzTaskBean = TzTaskBean(material.icons, material.description, material.title, false, mCoin, 0, material.app_apk_name)
// tzTaskBean.app_url = material.app_url
// tzTaskBean.trackerBean = material.tracker
// mFakeTaskList.add(tzTaskBean)
// cpdMax > 0 -> {
// for (i in 0 until cpdMax) {
// loadCPDData()
// }
//
// // 圣于地广告 循环完成后去重
// if (cpdLoadCountTime++ >= cpdMax - 1) {
// getCpdRepeatPkg()
// loadCPDDataList()
// }
// else -> {
// notifyDataAndShowAd()
// }
// }
}
LogUtil.d(TAG, "syd getCpdModelSuc " + cpdLoadCountTime)
private fun loadShDataList() {
// 珊瑚CPD广告拉取
for (i in shLoadCountTime until shMax) {
mCoralDownload?.pull()
}
}
override fun getCpdListModelSuc(dataBean: SydCpdListBean.DataBean) {
private fun loadCPDDataList() {
// 圣于地CPD广告拉取
for (i in cpdLoadCountTime until cpdMax) {
loadCPDData()
}
}
private fun loadCPDData() {
LogUtil.d(TAG, "syd loadCPDData")
taskPresenter.getCpdDetail(outNetIp)
}
// private fun loadCPDDataList() {
// // 圣于地CPD广告拉取
// taskPresenter.getCpdListDetail(outNetIp, cpdMax)
// }
override fun getCpdModelSuc(dataBean: CpdModelBean.DataBean) {
for (material in dataBean.materials) {
// 校验包名、下载apk为空 跳过
......@@ -220,29 +233,83 @@ class TaskCpdFragment : BaseFragment(), TaskView,
continue
}
val tzTaskBean = TzTaskBean(material.icons, material.app_name, material.description, false, mCoin, 0, material.app_apk_name)
val tzTaskBean = TzTaskBean(material.icons, material.description, material.title, false, mCoin, 0, material.app_apk_name)
tzTaskBean.app_url = material.app_url
tzTaskBean.trackerBean = material.tracker
mFakeTaskList.add(tzTaskBean)
LogUtil.d(tzTaskBean.title)
}
// 圣于地广告 循环完成后去重
if (cpdLoadCountTime++ >= cpdMax - 1) {
for (tzTaskBean in mFakeTaskList) {
LogUtil.d("AA -> " + tzTaskBean.title)
}
getCpdRepeatPkg()
if (shMax == 0 || shLoadCountTime >= shMax) {
notifyDataAndShowAd()
} else {
// 圣于地拉取完成后 调用珊瑚广告
loadShDataList()
}
}
LogUtil.d(TAG, "syd getCpdModelSuc $cpdLoadCountTime")
}
override fun getCpdModelFail() {
// LogUtil.d(TAG, "syd getCpdModelFail")
LogUtil.d(TAG, "syd getCpdModelFail")
// if (cpdLoadCountTime++ >= cpdMax - 1) {
if (cpdLoadCountTime++ >= cpdMax - 1) {
getCpdRepeatPkg()
if (shMax == 0 || shLoadCountTime >= shMax) {
notifyDataAndShowAd()
} else {
// 圣于地拉取完成后 调用珊瑚广告
loadShDataList()
}
}
// getCpdRepeatPkg()
// }
LogUtil.d(TAG, "syd getCpdModelFail $cpdLoadCountTime")
}
override fun getCpdListModelSuc(dataBean: SydCpdListBean.DataBean) {
for (material in dataBean.materials) {
// 校验包名、下载apk为空 跳过
if (TextUtils.isEmpty(material.app_apk_name) || TextUtils.isEmpty(material.app_url)) {
if (BuildConfig.DEBUG) {
LogUtil.d(TAG, "syd getCpdModelSuc 校验包名、下载apk为空 跳过${dataBean.uuid}")
}
continue
}
val tzTaskBean = TzTaskBean(material.icons, material.app_name, material.description, false, mCoin, 0, material.app_apk_name)
tzTaskBean.app_url = material.app_url
tzTaskBean.trackerListBean = material.tracker
mFakeTaskList.add(tzTaskBean)
}
// 圣于地广告 循环完成后去重
getCpdRepeatPkg()
LogUtil.d(TAG, "syd getCpdModelFail " + cpdLoadCountTime)
if (shMax == 0 || shLoadCountTime >= shMax) {
notifyDataAndShowAd()
} else {
// 圣于地拉取完成后 调用珊瑚广告
loadShDataList()
}
}
override fun onRefresh(refreshLayout: RefreshLayout) {
onDestoryBroadcastReceiver()
onDestroyBroadcastReceiver()
loadData()
}
......@@ -251,48 +318,67 @@ class TaskCpdFragment : BaseFragment(), TaskView,
* 遍历去重APP包名
*/
private fun getCpdRepeatPkg() {
if (isTwiceGetCpd) {
notifyDataAndShowAd()
return
}
// if (isTwiceGetCpd) {
// notifyDataAndShowAd()
// return
// }
cpdLoadCountTime = cpdMax
// cpdLoadCountTime = cpdMax
RxjavaUtil.executeRxTask<MutableList<TzTaskBean>>(object : CommonRxTask<MutableList<TzTaskBean>>() {
override fun doInIOThread() {
val newPkgData = mutableListOf<TzTaskBean>()
for (i in 0 until mFakeTaskList.size) {
if (mFakeTaskList[i].isShCpd) {
newPkgData.add(mFakeTaskList[i])
} else {
var flag = true
for (j in 0 until mFakeTaskList.size) {
if (!mFakeTaskList[i].isShCpd && !mFakeTaskList[j].isShCpd) {
var flag = false
// 数据重复
if (i != j && mFakeTaskList[i].downLoadPkgName == mFakeTaskList[j].downLoadPkgName) {
LogUtil.d(TAG, "syd currentPkgName:" + mFakeTaskList[j].downLoadPkgName)
flag = false
break
}
for (oldTaskBean in mFakeTaskList) {
// 珊瑚无须去重操作,直接添加
if (oldTaskBean.isShCpd) {
newPkgData.add(oldTaskBean)
} else {
for (newTaskBean in newPkgData) {
if (!newTaskBean.isShCpd && !oldTaskBean.isShCpd) {
flag = newTaskBean.downLoadPkgName == oldTaskBean.downLoadPkgName
}
}
if (flag) {
if (!flag) {
// 添加未安装app
if (!TextUtils.isEmpty(mFakeTaskList[i].downLoadPkgName) && !DeviceInfo.instance.isLoadingPkg(mFakeTaskList[i].downLoadPkgName)) {
cpdLoadCountTime--
newPkgData.add(mFakeTaskList[i])
if (!TextUtils.isEmpty(oldTaskBean.downLoadPkgName) && !DeviceInfo.instance.isLoadingPkg(oldTaskBean.downLoadPkgName)) {
newPkgData.add(oldTaskBean)
}
}
}
}
// for (i in 0 until mFakeTaskList.size) {
//
// if (mFakeTaskList[i].isShCpd) {
// newPkgData.add(mFakeTaskList[i])
// } else {
// for (j in 0 until mFakeTaskList.size) {
// if (!mFakeTaskList[i].isShCpd && !mFakeTaskList[j].isShCpd) {
// // 数据重复
// if (j != i && mFakeTaskList[i].downLoadPkgName == mFakeTaskList[j].downLoadPkgName) {
// LogUtil.d(TAG, "syd currentPkgName:" + mFakeTaskList[j].downLoadPkgName)
//
// flag = false
// break
// }
// }
// }
//
// if (flag) {
// // 添加未安装app
// if (!TextUtils.isEmpty(mFakeTaskList[i].downLoadPkgName) && !DeviceInfo.instance.isLoadingPkg(mFakeTaskList[i].downLoadPkgName)) {
//// cpdLoadCountTime--
// newPkgData.add(mFakeTaskList[i])
// }
// }
// }
// }
t = newPkgData
}
......@@ -300,7 +386,7 @@ class TaskCpdFragment : BaseFragment(), TaskView,
mFakeTaskList.clear()
mFakeTaskList.addAll(t)
notifyDataAndShowAd()
// notifyDataAndShowAd()
// 重新获取数据
// if (cpdLoadCountTime in 1..cpdMax) {
......@@ -364,15 +450,14 @@ class TaskCpdFragment : BaseFragment(), TaskView,
// 珊瑚循环完成后 调用圣于地广告
if (shLoadCountTime++ >= shMax - 1) {
LogUtil.d(TAG, "shanhu onLoadSuccess")
if (cpdMax == 0) {
if (cpdMax == 0 || cpdLoadCountTime >= cpdMax) {
notifyDataAndShowAd()
return
} else {
// 珊瑚拉取完成后 调用圣于地广告
loadCPDDataList()
}
// for (i in 0 until cpdMax) {
// loadCPDData()
// }
loadCPDDataList()
}
}
......@@ -414,7 +499,7 @@ class TaskCpdFragment : BaseFragment(), TaskView,
mDownloadProcess = null
DownloadApkManager.destroy()
onDestoryBroadcastReceiver()
onDestroyBroadcastReceiver()
taskPresenter.detachView()
super.onDestroy()
......@@ -587,7 +672,7 @@ class TaskCpdFragment : BaseFragment(), TaskView,
val currentPkgName = mFakeTaskList[position].currentPkgName
if (currentPkgName != null) {
onDestoryBroadcastReceiver()
onDestroyBroadcastReceiver()
// 时间为0
if (needUseTime == 0) {
......@@ -699,7 +784,7 @@ class TaskCpdFragment : BaseFragment(), TaskView,
}
}
fun onDestoryBroadcastReceiver() {
private fun onDestroyBroadcastReceiver() {
if (mReceiverBroadcastReceiver != null) {
mContext.stopService(Intent(context, AppInstallService::class.java))
mContext.unregisterReceiver(mReceiverBroadcastReceiver)
......
......@@ -17,7 +17,7 @@
<ProgressBar xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/my_profile_tracker"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:indeterminateOnly="false"
......
......@@ -30,9 +30,7 @@
android:textColor="@color/color_333"
android:textSize="14sp" />
<View
style="@style/line_1"
android:layout_above="@+id/dialog_ll_bottom" />
<View style="@style/line_1" />
<include
android:id="@+id/pb_du_updating"
......
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