Commit dcc3ef90 authored by mengcuiguang's avatar mengcuiguang

优化内存泄漏

parent 8c70a554
......@@ -314,6 +314,7 @@
# ===================== 穿山甲 START ================
-keep class com.bytedance.sdk.openadsdk.** { *; }
-keep public interface com.bytedance.sdk.openadsdk.downloadnew.** {*;}
-keep class com.pgl.sys.ces.* {*;}
# ======================= 穿山甲 END ================
......@@ -396,55 +397,3 @@
-keep class com.lechuan.midunovel.** { *; }
# ======================= 推啊AD END ================
# ===================== Mintegral START ================
-keep class com.mintegral.** {*; }
-keep interface com.mintegral.** {*; }
-keep class android.support.v4.** { *; }
-dontwarn com.mintegral.**
-keep class **.R$* { public static final int mintegral*; }
-keep class com.alphab.** {*; }
-keep interface com.alphab.** {*; }
# ======================= Mintegral END ================
# ===================== 多盟 START ================
-keep class com.dm.sdk.ads.splash.**{
public <methods>;
}
-keep class com.dm.sdk.common.util.AdError{
public <methods>;
}
-keep class com.dm.sdk.ads.DMAdActivity{
public <methods>;
}
# ======================= 多盟 END ================
# ===================== 创神 START ================
-keep class com.toukeads.code.AdCode{ *;}
-keep class com.toukeads.code.config.**{ *;}
-keep class com.toukeads.code.annotation.**{ *;}
-keep class com.toukeads.code.listener.**{ *;}
-keep class com.toukeads.code.utils.LogUtil{ *;}
-keep class com.toukeads.code.object.AdSave{ *;}
-keep class com.toukeads.code.object.ViewHeaderIm{ *;}
-keep class com.toukeads.code.model.**{ *;}
-keep class com.toukeads.code.server.**{ *;}
-keep class com.toukeads.code.cache.CacheListener{ *;}
-keep class com.toukeads.code.cache.HttpProxyCacheServer{ *;}
# ======================= 创神 END ================
# ===================== 闪电盒子 START ================
-keep class com.wannuosili.sdk.** {*;}
-dontwarn com.wannuosili.sdk.**
# ======================= 闪电盒子 END ================
......@@ -66,7 +66,7 @@ public class CsjVedioAdManager implements VedioAdManagerView {
userManager = UserManager.getInstance();
TTNativeExpressManager ttNativeExpressManager = new TTNativeExpressManager();
ttAdNative = ttNativeExpressManager.initTTAd( false);
ttAdNative = ttNativeExpressManager.initTTAd(false);
csjVedioAdPresenter = new CsjVedioAdPresenter();
csjVedioAdPresenter.attachView(this);
......@@ -102,22 +102,21 @@ public class CsjVedioAdManager implements VedioAdManagerView {
String codeId = TtCsjAdManager.TT_AD_VEDIO_MAIN_DEV;
if (!BuildConfig.DEBUG) {
switch (carrierType) {
case Constant.CARRIER_VERSUS_VIDEO:// 任务赚每日任务-视频
case Constant.CARRIER_VERSUS_VIDEO:// 每日任务视频
codeId = TtCsjAdManager.TT_AD_VEDIO_MAIN;
break;
case Constant.CARRIER_OFFLINE_DOUBLE:// 离线收益翻倍
codeId = TtCsjAdManager.TT_AD_VEDIO_MOREDIALOG;
break;
case Constant.CARRIER_SIGNIN_HOMEPAGE_CARD:// 签到翻倍
case Constant.CARRIER_WALK_BUBBLE:// 汽泡
codeId = TtCsjAdManager.TT_AD_VEDIO_MOREDIALOG;
break;
case Constant.CARRIER_HOMEWATER:// 喝水正常
case Constant.CARRIER_HOMEWATER:// 喝水
codeId = TtCsjAdManager.TT_AD_VEDIO_DRINK;
break;
case Constant.CARRIER_CHALLENGE_TURN:// 挑战大转盘
case Constant.CARRIER_CHALLENGE_TURN:// 大转盘
codeId = TtCsjAdManager.TT_AD_VEDIO_TURNABLE;
break;
case Constant.CARRIER_CHALLENGE_CARD:// 挑战刮刮乐
case Constant.CARRIER_CHALLENGE_CARD:// 刮刮乐
codeId = TtCsjAdManager.TT_AD_VEDIO_ERASE;
break;
default:// 在线收益翻倍
......@@ -259,22 +258,11 @@ public class CsjVedioAdManager implements VedioAdManagerView {
vo.put("waterCoin", curCoin);
break;
case Constant.CARRIER_OFFLINE_DOUBLE:// 离线收益翻倍
if (curCoin != -1) {
vo.put("offline_income", curCoin);
}
case Constant.CARRIER_SIGNIN_HOMEPAGE_CARD:// 签到翻倍
break;
vo.put("offline_income", curCoin);
case Constant.CARRIER_CHALLENGE_TURN:// 挑战大转盘
vo.put("turntableKey", extraId);
break;
case Constant.CARRIER_CHALLENGE_CARD:// 挑战刮刮乐
vo.put("turntableKey", extraId);
break;
default:// 在线收益翻倍
if (curCoin != -1) {
vo.put("online_income", curCoin);
}
break;
}
return vo;
}
......
......@@ -127,7 +127,7 @@ public class VedioAdingManager {
int weight = 0;
// 若没有视频完成数,不加入权重计算范围内
// 穿山甲激励> 优量汇> 珊瑚>创神>多盟>mintegral>东方网>全屏
// 穿山甲激励> 优量汇
if (AppConfig.csjVedioAdCount > 0) {
weightList.add(new WeightBean(csjVedioWeight, Constant.CSJ_VEDIO_AD));
weight = weight + csjVedioWeight;
......
......@@ -218,11 +218,7 @@ public class YlhVedioAdManager implements VedioAdManagerView {
break;
case Constant.CARRIER_OFFLINE_DOUBLE:// 离线收益翻倍
vo.put("offline_income", curCoin);
case Constant.CARRIER_SIGNIN_HOMEPAGE_CARD:// 签到翻倍
break;
case Constant.CARRIER_CHALLENGE_TURN:// 挑战大转盘
vo.put("turntableKey", extraId);
break;
case Constant.CARRIER_CHALLENGE_CARD:// 挑战刮刮乐
vo.put("turntableKey", extraId);
break;
......
......@@ -78,7 +78,7 @@ object Constant {
// 载体
const val CARRIER_VERSUS_VIDEO = "CHALLENGE_VEDIO1" //挑战任务-视频
const val CARRIER_VERSUS_VIDEO = "CHALLENGE_VEDIO" //任务-视频
const val CARRIER_CHALLENGE_TURN = "CHALLENGE_TURN" //大转盘
const val CARRIER_SIGNIN_HOMEPAGE_CARD = "SIGNIN_HOMEPAGE_CARD" //签到翻倍
const val CARRIER_SIGNIN_HOMEPAGE_AWARD = "SIGNIN_HOMEPAGE_AWARD" //签到奖励
......
......@@ -170,8 +170,9 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
Constant.CARRIER_OFFLINE_DOUBLE, Constant.CARRIER_SIGNIN_HOMEPAGE_CARD,
Constant.CARRIER_CHALLENGE_TURN, Constant.CARRIER_CHALLENGE_CARD,
Constant.CARRIER_VERSUS_VIDEO, Constant.CARRIER_WALK_BUBBLE,
Constant.CARRIER_CHALLENGE_SHAREFRIEND_DOUBLE -> {
awardVedio()
Constant.CARRIER_CHALLENGE_SHAREFRIEND_DOUBLE, Constant.CARRIER_HOMEVEDIO_BIG -> {
// awardVedio()
finish()
}
else -> {
finish()
......@@ -198,7 +199,6 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
bean.setExtraId(extraId)
loadVedio(vedioAdingManager, bean)
return
}
/**
......
......@@ -113,9 +113,8 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
R.id.tab_rl_main -> clickTab1Layout()
R.id.tab_rl_pan -> clickTab2Layout()
R.id.tab_rl_friends -> {
// clickTab3Layout()
// YwSDK_WebActivity.open(this)
readyGo(AwardActivity::class.java)
clickTab3Layout()
// readyGo(AwardActivity::class.java)
}
R.id.tab_rl_my -> clickTab4Layout()
}
......
......@@ -59,6 +59,7 @@ class MainFragment : BaseFragment(), HomeView, AdVideoCallback, View.OnClickList
override fun initViewsAndEvents() {
homePresenter.attachView(this)
// 奖励页预加载 信息流广告
TTPreLoadExpressManager.getInstance().loadTtFrameLayout()
// 首次显示权限弹窗
......@@ -137,12 +138,12 @@ class MainFragment : BaseFragment(), HomeView, AdVideoCallback, View.OnClickList
}
// 离线收益
// if (data.offlineBean.offlineIncome > 0) {
// val bundle = Bundle()
// bundle.putInt(Constant.MAIN_CUR_COIN, data.offlineBean.offlineIncome)
// bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_OFFLINE_DOUBLE)
// readyGo(AwardActivity::class.java, bundle)
// }
if (data.offlineBean.offlineIncome > 0) {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, data.offlineBean.offlineIncome)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_OFFLINE_DOUBLE)
readyGo(AwardActivity::class.java, bundle)
}
// 调用金币视频信息接口
homePresenter.getHomeVedioMsg()
......@@ -162,7 +163,7 @@ class MainFragment : BaseFragment(), HomeView, AdVideoCallback, View.OnClickList
smallRewardCoin = data.smallRewardCoin
bigRewardCoin = data.bigRewardCoin
// ivMainBox.visibility = if (bigRewardCoin > 0) View.VISIBLE else View.GONE
ivMainBox.visibility = if (bigRewardCoin > 0) View.VISIBLE else View.GONE
if (data.isToCreateReward) {
// 防止界面切换 重置倒计时
......
......@@ -18,6 +18,7 @@ import cn.sharesdk.wechat.friends.Wechat
import com.component.dly.xzzq_ywsdk.YwSDK_WebActivity.Companion.open
import com.mints.goodmoney.BuildConfig
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.VedioAdingManager
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.UserManager
......@@ -58,6 +59,8 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
private val myPresenter by lazy { MyPresenter() }
private val userManager by lazy { UserManager.getInstance() }
private lateinit var vedioAdingManager: VedioAdingManager
private var loadVedioFailCount = 0
private var userConfig: MyInfo? = null
private var hotList: List<BannerBean.ListBean>? = arrayListOf()
......@@ -78,6 +81,8 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
myPresenter.attachView(this)
srl_my.setOnRefreshListener(this)
vedioAdingManager = VedioAdingManager.getInstance(activity)
initView()
initRecy()
......@@ -139,6 +144,7 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
override fun onDestroy() {
super.onDestroy()
vedioAdingManager.destory()
myPresenter.detachView()
}
......@@ -381,11 +387,17 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
}
val task2 = TaskBean(R.mipmap.icon_my_invite, "邀好友,赚金币", progressStrInvited, btnStr, 2)
// 看福利视频赚金币
// var progressStrVideo = ""
// if (userConfig != null) {
// progressStrVideo = "(" + userConfig!!.taskVeido.complete + "/" + userConfig!!.taskVeido.max + ")"
// }
// val task3 = TaskBean(R.mipmap.icon_my_video, "看福利视频赚金币", progressStrVideo, "赚金币", 3)
var progressStrVideo = ""
var task3Str = ""
if (userConfig != null) {
progressStrVideo = "(" + userConfig!!.taskVeido.complete + "/" + userConfig!!.taskVeido.max + ")"
if (userConfig!!.taskVeido.complete == userConfig!!.taskVeido.max) {
task3Str = "已完成"
} else {
task3Str = "赚金币"
}
}
val task3 = TaskBean(R.mipmap.icon_my_video, "看福利视频赚金币", progressStrVideo, task3Str, 3)
// // 玩游戏,赚金币
// var task4Str = ""
// if (userConfig != null) {
......@@ -398,7 +410,7 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
// val task6 = TaskBean(R.mipmap.icon_my_demo, "试玩平台", "", "赚金币", 5)
dataList.add(task1)
dataList.add(task2)
// dataList.add(task3)
dataList.add(task3)
// dataList.add(task4)
//// dataList.add(task5)
// dataList.add(task6)
......@@ -461,6 +473,7 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
return
}
awardVedio(userConfig!!.taskVeido!!.coin)
}
// 玩游戏,赚金币
MainMyAdapter.TASK_TYPE_GAME -> {
......@@ -555,12 +568,6 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
Constant.HOT_ACTIVITY_CARD -> {
readyGo(EraseActivity::class.java)
}
Constant.HOT_ACTIVITY_H5 -> {
val bundle = Bundle()
bundle.putString(WebActivity.WEB_TITLE, hotBean.title)
bundle.putString(WebActivity.WEB_URL, hotBean.url)
readyGo(WebActivity::class.java, bundle)
}
else -> {
val bundle = Bundle()
bundle.putString(WebActivity.WEB_TITLE, hotBean.title)
......@@ -571,4 +578,53 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
}
}
/**
* 获取激励视频
*/
private fun awardVedio(coin: Int) {
if (vedioAdingManager.getVedioFinishFlag()) {
showToast("今日视频已看完,请明天再来吧")
return
}
showLoading("加载中...")
val bean = VedioAdingBean()
bean.setCarrierType(Constant.CARRIER_VERSUS_VIDEO)
bean.setCurCoin(coin)
loadVedio(vedioAdingManager, bean)
}
/**
* 加载激励视频
*/
private fun loadVedio(vedioAdingManager: VedioAdingManager, bean: VedioAdingBean) {
vedioAdingManager.setVedioAdingListener(object : VedioAdingManager.VedioAdingListener {
override fun vedioAdingListenerError(adType: String) {
showToast("加载超时,请休息一下")
hideLoading()
}
override fun vedioAdingListenerFail(adType: String) {
loadVedioFailCount++
if (loadVedioFailCount >= 2) {
hideLoading()
showToast("加载失败,请稍后重试!")
} else {
loadVedio(vedioAdingManager, bean)
}
}
override fun vedioAdingListenerSuccess(adType: String) {
hideLoading()
vedioAdingSuccess(adType)
}
})
vedioAdingManager.loadFailAding(bean)
}
private fun vedioAdingSuccess(adType: String) {
readyGo(AwardActivity::class.java)
}
}
\ 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