Commit cb30794d authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 9c6f453d
......@@ -181,7 +181,7 @@ dependencies {
// 三方接入
// leakcanary
// debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.4'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.4'
// 极光推送
implementation 'cn.jiguang.sdk:jpush:3.6.6'
implementation 'cn.jiguang.sdk:jcore:2.3.8'
......
......@@ -95,14 +95,6 @@ public class MintsApplication extends MultiDexApplication {
// 移动安全联盟 oaid
initMiitHelper();
//Android 9 or above must be set
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
String processName = getProcessName();
if (!getPackageName().equals(processName)) {
WebView.setDataDirectorySuffix(processName);
}
}
// 子线程初始化三方SDK
String processName = SystemUtils.INSTANCE.getProcessName(this, android.os.Process.myPid());
if (processName != null) {
......
......@@ -97,19 +97,21 @@ open class BaseVideoAd(activity: Activity) : BaseView {
vo["carrierType"] = carrierType
vo["adtype"] = Constant.ADTYPE_VEDIO
vo["adsource"] = adsource
var tempExtraId = ""
if (extraId != null) {
tempExtraId = extraId
}
when (carrierType) {
Constant.CARRIER_VERSUS_VIDEO -> vo["coin"] = curCoin
Constant.CARRIER_HOMEWATER -> vo["waterCoin"] = curCoin
Constant.CARRIER_OFFLINE_DOUBLE -> {
vo["offline_income"] = curCoin
vo["turntableKey"] = extraId!!
}
Constant.CARRIER_CHALLENGE_TURN, Constant.CARRIER_CHALLENGE_CARD -> vo["turntableKey"] = extraId!!
Constant.CARRIER_OFFLINE_DOUBLE -> vo["offline_income"] = curCoin
Constant.CARRIER_CHALLENGE_TURN, Constant.CARRIER_CHALLENGE_CARD -> vo["turntableKey"] = tempExtraId
}
return vo
}
open fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String) {}
open fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String?) {}
open fun onDestory() {}
}
\ No newline at end of file
......@@ -344,7 +344,7 @@ public class VedioAdingManager {
}
});
wnVedioAdManager.loadWnAd(bean.getDownloadCoin(), bean.getCurCoin(), bean.getCarrierType(), bean.getExtraId());
wnVedioAdManager.loadAd(activity, bean.getCurCoin(), bean.getCarrierType(), bean.getExtraId());
}
} catch (Exception e) {
e.printStackTrace();
......
......@@ -20,12 +20,7 @@ class WnVedioAdManager private constructor(activity: Activity) :
lateinit var wnVedioAdPresenter: WnVedioAdPresenter
private var wnVedioAdListener: WnVedioAdListener? = null
private lateinit var mRewardVideoAd: WNRewardVideoAd
private var curCoin = 0
private var extraId: String? = null
private var downloadCoin = 10
private var carrierType = ""
private var mRewardVideoAd: WNRewardVideoAd? = null
private var isClickScreen: Boolean = true
override var activity: Activity? = null
......@@ -52,17 +47,10 @@ class WnVedioAdManager private constructor(activity: Activity) :
wnVedioAdPresenter.attachView(this)
}
fun loadWnAd(downloadCoin: Int, curCoin: Int, carrierType: String, extraId: String?) {
if (activity == null) {
return
}
override fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String?) {
this.activity = activity
isClickScreen = true
this.downloadCoin = downloadCoin
this.carrierType = carrierType
this.curCoin = curCoin
this.extraId = extraId
var postId: String = ""
when (carrierType) {
Constant.CARRIER_VERSUS_VIDEO -> postId = WnManager.WN_AD_VEDIO_MAIN_POSTID
......@@ -108,7 +96,7 @@ class WnVedioAdManager private constructor(activity: Activity) :
}
override fun onAdClose() {
wnVedioAdPresenter.reportAddCoinMsg(activity, getAdMapVO(carrierType,Constant.AD_SOURCE_SDHZ,extraId,curCoin))
wnVedioAdPresenter.reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_SDHZ, extraId, curCoin))
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SDHZ, Constant.EVENT_TYPE_THREE, "", "")
......@@ -137,7 +125,7 @@ class WnVedioAdManager private constructor(activity: Activity) :
}
}
mRewardVideoAd = ad
mRewardVideoAd.showRewardVideoAd(activity)
mRewardVideoAd?.showRewardVideoAd(activity)
}
})
}
......@@ -155,6 +143,13 @@ class WnVedioAdManager private constructor(activity: Activity) :
override fun onDestory() {
wnVedioAdPresenter.dispose()
wnVedioAdPresenter.detachView()
mRewardVideoAd?.let {
it.downloadListener = null
it.interactionListener = null
}
mRewardVideoAd = null
activity = null
}
}
\ No newline at end of file
......@@ -24,8 +24,6 @@ public class YlhVedioAdManager extends BaseVideoAd implements VedioAdManagerView
// 优量汇激励视频
private RewardVideoAD rewardVideoAD;
private int curCoin;
private String extraId;
private YlhVedioAdPresenter ylhVedioAdPresenter;
private YlhVedioAdListener ylhVedioAdListener;
......@@ -73,8 +71,6 @@ public class YlhVedioAdManager extends BaseVideoAd implements VedioAdManagerView
public void loadAd(Activity activity, int curCoin, String carrierType, String extraId) {
this.activity = activity;
isClickScreen = true;
this.curCoin = curCoin;
this.extraId = extraId;
String ylhPostId;
switch (carrierType) {
......
......@@ -25,8 +25,8 @@ object WnManager {
*/
fun initWn(application: Application) {
WNAdSdk.initialize(WNAdConfig.Builder()
.setAppId(APP_ID) // 平台申请的appId
.setDebug(BuildConfig.DEBUG) // 是否是debug模式, 默认为false
.setAppId(APP_ID)
.setDebug(BuildConfig.DEBUG)
.setContext(application)
.build())
}
......
......@@ -225,6 +225,8 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
e.printStackTrace()
}
flAwardAd?.removeAllViews()
vedioAdingManager.setVedioAdingListener(null)
vedioAdingManager.onDestory()
......
......@@ -56,6 +56,7 @@ class FoodSubsidyActivity : BaseActivity(), View.OnClickListener, FoodSubsidyVie
super.onDestroy()
svWalk?.destoryAnim()
flSubsidykAd?.removeAllViews()
ttNativeExpressManager.onTTAdDestroy()
foodSubsidyPresenter.detachView()
}
......
......@@ -54,7 +54,7 @@ class MorningClockActivity : BaseActivity()
override fun onDestroy() {
super.onDestroy()
flMorningClockAd?.removeAllViews()
ttNativeExpressManager.onTTAdDestroy()
morningClockPresenter.detachView()
}
......
......@@ -12,6 +12,7 @@ import com.mints.goodmoney.mvp.views.WalkView
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.ui.widgets.StepView
import kotlinx.android.synthetic.main.activity_walk.*
import kotlinx.android.synthetic.main.activity_water.*
/**
* 描述:走路赚钱
......@@ -46,6 +47,7 @@ class WalkActivity : BaseActivity(), View.OnClickListener, WalkView, StepView.St
super.onDestroy()
svWalk?.destoryAnim()
flWalkAd?.removeAllViews()
// ttNativeExpressManager.onTTAdDestroy()
walkPresenter.detachView()
}
......
......@@ -50,6 +50,7 @@ class WaterActivity : BaseActivity(), View.OnClickListener, WaterView.WaterViewL
// 取消水滴动画
wvWater?.destoryAnim()
wvWater?.closeWaterViewTime()
flWaterAd?.removeAllViews()
// ttNativeExpressManager.onTTAdDestroy()
waterPresenter.detachView()
......
......@@ -109,7 +109,7 @@ class HorizChannelFragment : BaseFragment(), HorizChannelView, View.OnClickListe
override fun onDestroy() {
super.onDestroy()
YLPlayerConfig.config().unRegisterPlayerCallback()
horizChannelPresenter.detachView()
}
......
......@@ -162,6 +162,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
super.onDestroy()
// 广告回调解绑
YLUIConfig.getInstance().unRegisterAdListener()
YLPlayerConfig.config().unRegisterPlayerCallback()
homePresenter.detachView()
}
......@@ -176,32 +177,15 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
// 保存Ip,用于穿山甲回调校验
ps.put(Constant.CSJ_VEDIO_APPIP, data.ip)
// 放到个人中心展示 防止首页红包转动异常
// 新人福利
// if (data.userMsg.firstGiveCoin > 0) {
// val bundle = Bundle()
// bundle.putInt(Constant.MAIN_CUR_COIN, data.userMsg.firstGiveCoin)
// bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_NEW_USER)
// readyGo(AwardActivity::class.java, bundle)
// } else {
// // 离线收益
// 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)
// }
// }
// 新人福利 放到个人中心展示 防止首页红包转动异常
// 设置视频权限
// vedioAdingManager?.initAdWeight(data.vedioRules.csJ_VEDIO.rate, data.vedioRules.ylH_VEDIO.rate,data.vedioRules.sdhZ_VEDIO.rate)
vedioAdingManager?.initAdWeight(data.vedioRules.csJ_VEDIO.rate, data.vedioRules.ylH_VEDIO.rate,0)
// LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} ylhWeight:${data.vedioRules.ylH_VEDIO.rate} sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate}")
vedioAdingManager?.initAdWeight(data.vedioRules.csJ_VEDIO.rate, data.vedioRules.ylH_VEDIO.rate,data.vedioRules.sdhZ_VEDIO.rate)
LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} ylhWeight:${data.vedioRules.ylH_VEDIO.rate} sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate}")
// 广告视频数
AppConfig.csjVedioAdCount = data.vedioRules.csJ_VEDIO.surplus
AppConfig.ylhAdCount = data.vedioRules.ylH_VEDIO.surplus
// AppConfig.wnVedioAdCount = data.vedioRules.sdhZ_VEDIO.surplus
AppConfig.wnVedioAdCount = data.vedioRules.sdhZ_VEDIO.surplus
LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVedioAdCount} ylhCount:${AppConfig.ylhAdCount} sdhzCount:${AppConfig.wnVedioAdCount}")
// 调用金币视频信息接口
......
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