Commit cb30794d authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 9c6f453d
...@@ -181,7 +181,7 @@ dependencies { ...@@ -181,7 +181,7 @@ dependencies {
// 三方接入 // 三方接入
// leakcanary // 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:jpush:3.6.6'
implementation 'cn.jiguang.sdk:jcore:2.3.8' implementation 'cn.jiguang.sdk:jcore:2.3.8'
......
...@@ -95,14 +95,6 @@ public class MintsApplication extends MultiDexApplication { ...@@ -95,14 +95,6 @@ public class MintsApplication extends MultiDexApplication {
// 移动安全联盟 oaid // 移动安全联盟 oaid
initMiitHelper(); 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 // 子线程初始化三方SDK
String processName = SystemUtils.INSTANCE.getProcessName(this, android.os.Process.myPid()); String processName = SystemUtils.INSTANCE.getProcessName(this, android.os.Process.myPid());
if (processName != null) { if (processName != null) {
......
...@@ -97,19 +97,21 @@ open class BaseVideoAd(activity: Activity) : BaseView { ...@@ -97,19 +97,21 @@ open class BaseVideoAd(activity: Activity) : BaseView {
vo["carrierType"] = carrierType vo["carrierType"] = carrierType
vo["adtype"] = Constant.ADTYPE_VEDIO vo["adtype"] = Constant.ADTYPE_VEDIO
vo["adsource"] = adsource vo["adsource"] = adsource
var tempExtraId = ""
if (extraId != null) {
tempExtraId = extraId
}
when (carrierType) { when (carrierType) {
Constant.CARRIER_VERSUS_VIDEO -> vo["coin"] = curCoin Constant.CARRIER_VERSUS_VIDEO -> vo["coin"] = curCoin
Constant.CARRIER_HOMEWATER -> vo["waterCoin"] = curCoin Constant.CARRIER_HOMEWATER -> vo["waterCoin"] = curCoin
Constant.CARRIER_OFFLINE_DOUBLE -> { Constant.CARRIER_OFFLINE_DOUBLE -> vo["offline_income"] = curCoin
vo["offline_income"] = curCoin Constant.CARRIER_CHALLENGE_TURN, Constant.CARRIER_CHALLENGE_CARD -> vo["turntableKey"] = tempExtraId
vo["turntableKey"] = extraId!!
}
Constant.CARRIER_CHALLENGE_TURN, Constant.CARRIER_CHALLENGE_CARD -> vo["turntableKey"] = extraId!!
} }
return vo 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() {} open fun onDestory() {}
} }
\ No newline at end of file
...@@ -344,7 +344,7 @@ public class VedioAdingManager { ...@@ -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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -20,12 +20,7 @@ class WnVedioAdManager private constructor(activity: Activity) : ...@@ -20,12 +20,7 @@ class WnVedioAdManager private constructor(activity: Activity) :
lateinit var wnVedioAdPresenter: WnVedioAdPresenter lateinit var wnVedioAdPresenter: WnVedioAdPresenter
private var wnVedioAdListener: WnVedioAdListener? = null private var wnVedioAdListener: WnVedioAdListener? = null
private lateinit var mRewardVideoAd: WNRewardVideoAd private var mRewardVideoAd: WNRewardVideoAd? = null
private var curCoin = 0
private var extraId: String? = null
private var downloadCoin = 10
private var carrierType = ""
private var isClickScreen: Boolean = true private var isClickScreen: Boolean = true
override var activity: Activity? = null override var activity: Activity? = null
...@@ -52,17 +47,10 @@ class WnVedioAdManager private constructor(activity: Activity) : ...@@ -52,17 +47,10 @@ class WnVedioAdManager private constructor(activity: Activity) :
wnVedioAdPresenter.attachView(this) wnVedioAdPresenter.attachView(this)
} }
fun loadWnAd(downloadCoin: Int, curCoin: Int, carrierType: String, extraId: String?) { override fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String?) {
if (activity == null) { this.activity = activity
return
}
isClickScreen = true isClickScreen = true
this.downloadCoin = downloadCoin
this.carrierType = carrierType
this.curCoin = curCoin
this.extraId = extraId
var postId: String = "" var postId: String = ""
when (carrierType) { when (carrierType) {
Constant.CARRIER_VERSUS_VIDEO -> postId = WnManager.WN_AD_VEDIO_MAIN_POSTID Constant.CARRIER_VERSUS_VIDEO -> postId = WnManager.WN_AD_VEDIO_MAIN_POSTID
...@@ -108,7 +96,7 @@ class WnVedioAdManager private constructor(activity: Activity) : ...@@ -108,7 +96,7 @@ class WnVedioAdManager private constructor(activity: Activity) :
} }
override fun onAdClose() { 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, "", "") TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SDHZ, Constant.EVENT_TYPE_THREE, "", "")
...@@ -137,7 +125,7 @@ class WnVedioAdManager private constructor(activity: Activity) : ...@@ -137,7 +125,7 @@ class WnVedioAdManager private constructor(activity: Activity) :
} }
} }
mRewardVideoAd = ad mRewardVideoAd = ad
mRewardVideoAd.showRewardVideoAd(activity) mRewardVideoAd?.showRewardVideoAd(activity)
} }
}) })
} }
...@@ -155,6 +143,13 @@ class WnVedioAdManager private constructor(activity: Activity) : ...@@ -155,6 +143,13 @@ class WnVedioAdManager private constructor(activity: Activity) :
override fun onDestory() { override fun onDestory() {
wnVedioAdPresenter.dispose() wnVedioAdPresenter.dispose()
wnVedioAdPresenter.detachView() wnVedioAdPresenter.detachView()
mRewardVideoAd?.let {
it.downloadListener = null
it.interactionListener = null
}
mRewardVideoAd = null
activity = null activity = null
} }
} }
\ No newline at end of file
...@@ -24,8 +24,6 @@ public class YlhVedioAdManager extends BaseVideoAd implements VedioAdManagerView ...@@ -24,8 +24,6 @@ public class YlhVedioAdManager extends BaseVideoAd implements VedioAdManagerView
// 优量汇激励视频 // 优量汇激励视频
private RewardVideoAD rewardVideoAD; private RewardVideoAD rewardVideoAD;
private int curCoin;
private String extraId;
private YlhVedioAdPresenter ylhVedioAdPresenter; private YlhVedioAdPresenter ylhVedioAdPresenter;
private YlhVedioAdListener ylhVedioAdListener; private YlhVedioAdListener ylhVedioAdListener;
...@@ -73,8 +71,6 @@ public class YlhVedioAdManager extends BaseVideoAd implements VedioAdManagerView ...@@ -73,8 +71,6 @@ public class YlhVedioAdManager extends BaseVideoAd implements VedioAdManagerView
public void loadAd(Activity activity, int curCoin, String carrierType, String extraId) { public void loadAd(Activity activity, int curCoin, String carrierType, String extraId) {
this.activity = activity; this.activity = activity;
isClickScreen = true; isClickScreen = true;
this.curCoin = curCoin;
this.extraId = extraId;
String ylhPostId; String ylhPostId;
switch (carrierType) { switch (carrierType) {
......
...@@ -25,8 +25,8 @@ object WnManager { ...@@ -25,8 +25,8 @@ object WnManager {
*/ */
fun initWn(application: Application) { fun initWn(application: Application) {
WNAdSdk.initialize(WNAdConfig.Builder() WNAdSdk.initialize(WNAdConfig.Builder()
.setAppId(APP_ID) // 平台申请的appId .setAppId(APP_ID)
.setDebug(BuildConfig.DEBUG) // 是否是debug模式, 默认为false .setDebug(BuildConfig.DEBUG)
.setContext(application) .setContext(application)
.build()) .build())
} }
......
...@@ -225,6 +225,8 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener { ...@@ -225,6 +225,8 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
e.printStackTrace() e.printStackTrace()
} }
flAwardAd?.removeAllViews()
vedioAdingManager.setVedioAdingListener(null) vedioAdingManager.setVedioAdingListener(null)
vedioAdingManager.onDestory() vedioAdingManager.onDestory()
......
...@@ -56,6 +56,7 @@ class FoodSubsidyActivity : BaseActivity(), View.OnClickListener, FoodSubsidyVie ...@@ -56,6 +56,7 @@ class FoodSubsidyActivity : BaseActivity(), View.OnClickListener, FoodSubsidyVie
super.onDestroy() super.onDestroy()
svWalk?.destoryAnim() svWalk?.destoryAnim()
flSubsidykAd?.removeAllViews()
ttNativeExpressManager.onTTAdDestroy() ttNativeExpressManager.onTTAdDestroy()
foodSubsidyPresenter.detachView() foodSubsidyPresenter.detachView()
} }
......
...@@ -54,7 +54,7 @@ class MorningClockActivity : BaseActivity() ...@@ -54,7 +54,7 @@ class MorningClockActivity : BaseActivity()
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
flMorningClockAd?.removeAllViews()
ttNativeExpressManager.onTTAdDestroy() ttNativeExpressManager.onTTAdDestroy()
morningClockPresenter.detachView() morningClockPresenter.detachView()
} }
......
...@@ -12,6 +12,7 @@ import com.mints.goodmoney.mvp.views.WalkView ...@@ -12,6 +12,7 @@ import com.mints.goodmoney.mvp.views.WalkView
import com.mints.goodmoney.ui.activitys.base.BaseActivity import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.ui.widgets.StepView import com.mints.goodmoney.ui.widgets.StepView
import kotlinx.android.synthetic.main.activity_walk.* 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 ...@@ -46,6 +47,7 @@ class WalkActivity : BaseActivity(), View.OnClickListener, WalkView, StepView.St
super.onDestroy() super.onDestroy()
svWalk?.destoryAnim() svWalk?.destoryAnim()
flWalkAd?.removeAllViews()
// ttNativeExpressManager.onTTAdDestroy() // ttNativeExpressManager.onTTAdDestroy()
walkPresenter.detachView() walkPresenter.detachView()
} }
......
...@@ -50,6 +50,7 @@ class WaterActivity : BaseActivity(), View.OnClickListener, WaterView.WaterViewL ...@@ -50,6 +50,7 @@ class WaterActivity : BaseActivity(), View.OnClickListener, WaterView.WaterViewL
// 取消水滴动画 // 取消水滴动画
wvWater?.destoryAnim() wvWater?.destoryAnim()
wvWater?.closeWaterViewTime() wvWater?.closeWaterViewTime()
flWaterAd?.removeAllViews()
// ttNativeExpressManager.onTTAdDestroy() // ttNativeExpressManager.onTTAdDestroy()
waterPresenter.detachView() waterPresenter.detachView()
......
...@@ -109,7 +109,7 @@ class HorizChannelFragment : BaseFragment(), HorizChannelView, View.OnClickListe ...@@ -109,7 +109,7 @@ class HorizChannelFragment : BaseFragment(), HorizChannelView, View.OnClickListe
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
YLPlayerConfig.config().unRegisterPlayerCallback()
horizChannelPresenter.detachView() horizChannelPresenter.detachView()
} }
......
...@@ -162,6 +162,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -162,6 +162,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
super.onDestroy() super.onDestroy()
// 广告回调解绑 // 广告回调解绑
YLUIConfig.getInstance().unRegisterAdListener() YLUIConfig.getInstance().unRegisterAdListener()
YLPlayerConfig.config().unRegisterPlayerCallback()
homePresenter.detachView() homePresenter.detachView()
} }
...@@ -176,32 +177,15 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -176,32 +177,15 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
// 保存Ip,用于穿山甲回调校验 // 保存Ip,用于穿山甲回调校验
ps.put(Constant.CSJ_VEDIO_APPIP, data.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,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}")
// 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.csjVedioAdCount = data.vedioRules.csJ_VEDIO.surplus
AppConfig.ylhAdCount = data.vedioRules.ylH_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}") 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