Commit 5783f84c authored by wangxuewei's avatar wangxuewei

[提交人]:王雪伟

[提交简述] :多多花园1.0.1
[实现方案] :上线
parent fefeb972
...@@ -53,19 +53,19 @@ class BaseApplication : BaseApplication() { ...@@ -53,19 +53,19 @@ class BaseApplication : BaseApplication() {
private var backToFrontTime: Long = 0 private var backToFrontTime: Long = 0
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
NetConfig.setBase_Url(NetConfig.Environment.DEV)// TODO 上线之后提成成 NetConfig.Environment.PRODUCT NetConfig.setBase_Url(NetConfig.Environment.PRODUCT)// TODO 上线之后提成成 NetConfig.Environment.PRODUCT
// NetConfig.BASE_FEED_URL="https://fsapi.ihuomao.com/" NetConfig.BASE_FEED_URL="https://fsapi.ihuomao.com/"
// NetConfig.BASE_AD_URL="https://bs.ihuomao.com/" NetConfig.BASE_AD_URL="https://bs.ihuomao.com/"
// NetConfig.URL_REPORT_BASE="http://report.ihuomao.com/" NetConfig.URL_REPORT_BASE="http://report.ihuomao.com/"
//TODO 上线去掉测试地址 //TODO 上线去掉测试地址
NetConfig.BASE_FEED_URL = "http://feedapitest2.zhangxinhulian.com/" // NetConfig.BASE_FEED_URL = "http://feedapitest2.zhangxinhulian.com/"
// Constant.appLs = "b59e7d03c0f91730"//appls // Constant.appLs = "b59e7d03c0f91730"//appls
AdManager.init(this,"b59e7d03c0f91730") AdManager.init(this,"b59e7d03c0f91730")
LogUtils.getConfig().logSwitch = true LogUtils.getConfig().logSwitch = false
UMConfigure.setLogEnabled(true) UMConfigure.setLogEnabled(false)
UMConfigure.init(this, "5fc658ef4034454d32e7e6ba", "", UMConfigure.DEVICE_TYPE_PHONE, "") UMConfigure.init(this, "5fc658ef4034454d32e7e6ba", "", UMConfigure.DEVICE_TYPE_PHONE, "")
PlatformConfig.setWeixin(Constant.WX_APPID, Constant.WX_APPKEY) PlatformConfig.setWeixin(Constant.WX_APPID, Constant.WX_APPKEY)
......
...@@ -6,7 +6,6 @@ object ADConfig{ ...@@ -6,7 +6,6 @@ object ADConfig{
val AD_SPLASH = "splash"//开屏 val AD_SPLASH = "splash"//开屏
val AD_LOAD_SPLASH = "task_load_splash"//开屏 val AD_LOAD_SPLASH = "task_load_splash"//开屏
val AD_VIDEO = "luck_card_video"
val AD_COINS_VIDEO = "sleep_coins_video" val AD_COINS_VIDEO = "sleep_coins_video"
val AD_CARD_BIGIMAGE = "scratch_card_bigimage"//模板 val AD_CARD_BIGIMAGE = "scratch_card_bigimage"//模板
val AD_ACTIVITY_POPUP = "home_activity_popup"//插屏 val AD_ACTIVITY_POPUP = "home_activity_popup"//插屏
......
package com.ym.library.utils package com.ym.library.utils
import android.app.Activity import android.app.Activity
import android.os.Handler
import android.os.Message
import android.util.Log import android.util.Log
import android.widget.FrameLayout import android.widget.FrameLayout
import com.ym.admodule.config.AdManager import com.ym.admodule.config.AdManager
...@@ -11,12 +13,25 @@ import com.ym.library.module.StatusEntity ...@@ -11,12 +13,25 @@ import com.ym.library.module.StatusEntity
import com.ym.library.net.BaseObserver import com.ym.library.net.BaseObserver
import com.ym.library.net.GameApiClient import com.ym.library.net.GameApiClient
import com.ym.library.net.RxSchedulers import com.ym.library.net.RxSchedulers
import com.ym.modulecommon.AppliContext
import java.lang.Exception
object AdUtils { object AdUtils {
val TAG = "AdUtils" val TAG = "AdUtils"
var activity: Activity? = null
var handler = object : Handler() {
override fun handleMessage(msg: Message?) {
super.handleMessage(msg)
when(msg?.what) {
0 -> {
if (activity != null) {
AdManager.loadNextCacheRewardVideoAd(ADConfig.AD_REWARD_VIDIO, activity!!)
}
}
}
}
}
fun playRewardAd(activity: Activity, actionName: String, listener: IAdVideoListener) { fun playRewardAd(activity: Activity, actionName: String, listener: IAdVideoListener) {
this.activity = activity
AdManager.playRewardAd( AdManager.playRewardAd(
ADConfig.AD_REWARD_VIDIO, ADConfig.AD_REWARD_VIDIO,
actionName, actionName,
...@@ -27,33 +42,30 @@ object AdUtils { ...@@ -27,33 +42,30 @@ object AdUtils {
override fun onAdClose() { override fun onAdClose() {
listener?.onAdClose() listener?.onAdClose()
//预加载 //预加载
loadNextCacheRewardVideoAd(activity) // loadNextCacheRewardVideoAd(activity)
//看视频上报 //看视频上报
getVideoAcceleratorsReceive(); getVideoAcceleratorsReceive();
handler?.removeCallbacksAndMessages(null)
} }
override fun onAdShow() { override fun onAdShow() {
Utils.showToast(activity, "看完视频可获得奖励") Utils.showToast(activity, "看完视频可获得奖励")
// AdManager.loadNextCacheRewardVideoAd(ADConfig.AD_VIDEO, activity!!) handler?.sendEmptyMessageDelayed(0, 2000)
} }
override fun onAdVideoBarClick() { override fun onAdVideoBarClick() {
Log.d(TAG,"onAdVideoBarClick:") Log.d(TAG, "onAdVideoBarClick:")
} }
override fun onError(errorMsg: String?) { override fun onError(errorMsg: String?) {
listener?.onError(errorMsg) listener?.onError(errorMsg)
Log.d(TAG,"onError:" + errorMsg) Log.d(TAG, "onError:" + errorMsg)
} }
}) })
} }
fun showFeedAd(activity: Activity, actionName: String, view: FrameLayout) { fun showFeedAd(activity: Activity, actionName: String, view: FrameLayout) {
if(activity?.isFinishing){
return
}
AdManager.showFeedAd( AdManager.showFeedAd(
ADConfig.AD_IMG_FADE, ADConfig.AD_IMG_FADE,
actionName, actionName,
...@@ -68,12 +80,15 @@ object AdUtils { ...@@ -68,12 +80,15 @@ object AdUtils {
// try { // try {
// view.postDelayed(object :Runnable { // view.postDelayed(object :Runnable {
// override fun run() { // override fun run() {
// if(activity?.isFinishing){
// return
// }
// //
// activity?.runOnUiThread() { // activity?.runOnUiThread() {
// //
// } // }
// } // }
// },500) // },0)
// } catch (e: Exception) { // } catch (e: Exception) {
// } // }
} }
......
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