Commit 1602490b authored by wangxuewei's avatar wangxuewei

[提交人]:王雪伟

[提交简述] :幸福农场
[实现方案] :luckyfarm_1.0.4
1.加入瑞狮,sigmob广告平台,接入小满
2.title 钱数加入元单位
3,加速剂给的数量改为后台控制
4.调整土地倒计时,位置上移。
5.加入加速显示缩减时间动画
parent 834a3929
...@@ -36,5 +36,25 @@ ...@@ -36,5 +36,25 @@
<option name="name" value="MavenRepo" /> <option name="name" value="MavenRepo" />
<option name="url" value="https://repo.maven.apache.org/maven2/" /> <option name="url" value="https://repo.maven.apache.org/maven2/" />
</remote-repository> </remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://maven.aliyun.com/repository/google" />
</remote-repository>
<remote-repository>
<option name="id" value="maven2" />
<option name="name" value="maven2" />
<option name="url" value="https://maven.aliyun.com/repository/jcenter" />
</remote-repository>
<remote-repository>
<option name="id" value="maven3" />
<option name="name" value="maven3" />
<option name="url" value="https://maven.aliyun.com/repository/gradle-plugin" />
</remote-repository>
<remote-repository>
<option name="id" value="maven5" />
<option name="name" value="maven5" />
<option name="url" value="http://test.vlion.cn:8081/nexus/content/repositories/inland/" />
</remote-repository>
</component> </component>
</project> </project>
\ No newline at end of file
...@@ -5,8 +5,10 @@ import android.content.Intent ...@@ -5,8 +5,10 @@ import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.text.TextUtils import android.text.TextUtils
import android.util.Log import android.util.Log
import com.bx.adsdk.AdSdk
import com.game.luckyfarm.UnityPlayerActivity import com.game.luckyfarm.UnityPlayerActivity
import com.umeng.analytics.MobclickAgent import com.umeng.analytics.MobclickAgent
import com.ym.admodule.rs.RSADUtils
import com.ym.game.activity.SplashActivity import com.ym.game.activity.SplashActivity
import com.ym.game.activity.WxLoginActivity import com.ym.game.activity.WxLoginActivity
import com.ym.game.listener.IDialogViewCloseCallback import com.ym.game.listener.IDialogViewCloseCallback
...@@ -18,6 +20,7 @@ import com.ym.game.view.TurntableDialog ...@@ -18,6 +20,7 @@ import com.ym.game.view.TurntableDialog
import com.ym.library.AppliContext import com.ym.library.AppliContext
import com.ym.library.Constant import com.ym.library.Constant
import com.ym.library.config.AdManager import com.ym.library.config.AdManager
import com.ym.library.config.ZXADCallback
import com.ym.library.config.ZXADRewardVideo import com.ym.library.config.ZXADRewardVideo
import com.ym.library.down.UpdateVersionManager import com.ym.library.down.UpdateVersionManager
import com.ym.library.listener.ZXADVideoListener import com.ym.library.listener.ZXADVideoListener
...@@ -28,6 +31,7 @@ import com.ym.library.net.RxSchedulers ...@@ -28,6 +31,7 @@ import com.ym.library.net.RxSchedulers
import com.ym.library.net.UserInfoEntity import com.ym.library.net.UserInfoEntity
import com.ym.library.router.RounterApi import com.ym.library.router.RounterApi
import com.ym.library.router.RounterBus import com.ym.library.router.RounterBus
import com.ym.library.sm.SMADUtils
import com.ym.library.utils.* import com.ym.library.utils.*
import io.reactivex.Observable import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
...@@ -43,7 +47,6 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback { ...@@ -43,7 +47,6 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
private var mOrderString = ""; private var mOrderString = "";
private val mContext = AppliContext.get() private val mContext = AppliContext.get()
private var mRefreshLoginObservable: Observable<Boolean>? = null private var mRefreshLoginObservable: Observable<Boolean>? = null
@SuppressLint("CheckResult")
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
EventUtils.onEvent("tab_imp", "幸运农场") EventUtils.onEvent("tab_imp", "幸运农场")
...@@ -69,6 +72,12 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback { ...@@ -69,6 +72,12 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
}, { }, {
}) })
//小满上报
if (Constant.isReportXiaoman) {
AdSdk.exposure("2654", SettingPreference.getToken())
Constant.isReportXiaoman = false
}
} }
override fun onDestroy() { override fun onDestroy() {
...@@ -88,7 +97,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback { ...@@ -88,7 +97,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
super.onResume() super.onResume()
MobclickAgent.onResume(this) MobclickAgent.onResume(this)
Log.d("wxw","onResume") Log.d("wxw","onResume")
callUnity("Form_land", "getLandList", "") // callUnity("Form_land", "getLandList", "")
} }
override fun onPause() { override fun onPause() {
...@@ -125,6 +134,14 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback { ...@@ -125,6 +134,14 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
return false return false
} }
/**
* 小满入口
*/
fun gotoXiaoManActivity(){
EventUtils.onEvent("XiaoManClick","小满入口点击");
JumpUtils.jumpXiaomanActivity("天天领现金")
}
/** /**
* 跳转提现页 * 跳转提现页
*/ */
...@@ -132,6 +149,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback { ...@@ -132,6 +149,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
if(type==1){ if(type==1){
JumpUtils.h5Jump("跳转提现页", Constant.Param.WithDraw2, false,act) JumpUtils.h5Jump("跳转提现页", Constant.Param.WithDraw2, false,act)
}else{ }else{
EventUtils.onEvent("WithDrawClick","提现入口点击");
JumpUtils.h5Jump("跳转提现页", Constant.Param.WithDraw, false,act) JumpUtils.h5Jump("跳转提现页", Constant.Param.WithDraw, false,act)
} }
} }
...@@ -140,16 +158,16 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback { ...@@ -140,16 +158,16 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
* 上榜赚钱 * 上榜赚钱
*/ */
fun ranklistClick() { fun ranklistClick() {
Log.d("wxw", "上榜赚钱")
//JumpUtils.h5Jump("上榜赚钱", Constant.Param.RankList) //JumpUtils.h5Jump("上榜赚钱", Constant.Param.RankList)
JumpUtils.h5Jump("水滴排行榜", Constant.Param.RankList, false,act) EventUtils.onEvent("PaiHangBangClick","上榜入口点击");
JumpUtils.h5Jump("排行榜", Constant.Param.RankList, false,act)
} }
/** /**
* 每日福利 * 每日福利
*/ */
fun oneveryDayWelfareClick() { fun oneveryDayWelfareClick() {
Log.d("wxw", "每日福利") EventUtils.onEvent("MeiRiFuLiClick","每日福利入口点击");
JumpUtils.h5Jump("每日福利", Constant.Param.WelfareCenter, false,act) JumpUtils.h5Jump("每日福利", Constant.Param.WelfareCenter, false,act)
} }
...@@ -158,7 +176,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback { ...@@ -158,7 +176,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
* 打卡提现 * 打卡提现
*/ */
fun clockInMakeMoney() { fun clockInMakeMoney() {
Log.d("wxw", "打卡提现") EventUtils.onEvent("DaKaTiXianClick","打卡提现入口点击");
JumpUtils.h5Jump("打卡提现", Constant.Param.PunchRecord, false,act) JumpUtils.h5Jump("打卡提现", Constant.Param.PunchRecord, false,act)
} }
...@@ -166,6 +184,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback { ...@@ -166,6 +184,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
* 幸运转盘 * 幸运转盘
*/ */
fun luckyTurntable() { fun luckyTurntable() {
EventUtils.onEvent("ZhuanPanClick","转盘入口点击");
this.runOnUiThread(object : Runnable { this.runOnUiThread(object : Runnable {
override fun run() { override fun run() {
if (Utils.isFastClick()) { if (Utils.isFastClick()) {
...@@ -180,6 +199,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback { ...@@ -180,6 +199,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
* 领金币 * 领金币
*/ */
fun getCoin() { fun getCoin() {
EventUtils.onEvent("RenWuClick","领金币任务入口点击");
this.runOnUiThread(object : Runnable { this.runOnUiThread(object : Runnable {
override fun run() { override fun run() {
SiginDropsPopupwindow().init(this@GameActivity, this@GameActivity) SiginDropsPopupwindow().init(this@GameActivity, this@GameActivity)
......
...@@ -10,6 +10,7 @@ import com.bytedance.sdk.openadsdk.TTSplashAd ...@@ -10,6 +10,7 @@ import com.bytedance.sdk.openadsdk.TTSplashAd
import com.gyf.immersionbar.BarHide import com.gyf.immersionbar.BarHide
import com.gyf.immersionbar.ImmersionBar import com.gyf.immersionbar.ImmersionBar
import com.umeng.analytics.MobclickAgent import com.umeng.analytics.MobclickAgent
import com.ym.admodule.rs.RSADUtils
import com.ym.game.GameActivity import com.ym.game.GameActivity
import com.ym.xync.R import com.ym.xync.R
import com.ym.library.Constant import com.ym.library.Constant
...@@ -17,9 +18,13 @@ import com.ym.library.module.ReportEntity ...@@ -17,9 +18,13 @@ import com.ym.library.module.ReportEntity
import com.ym.library.net.SplashPresenter.Companion.PERMISSIONS import com.ym.library.net.SplashPresenter.Companion.PERMISSIONS
import com.ym.game.utils.CenterDialog import com.ym.game.utils.CenterDialog
import com.ym.library.config.AdManager import com.ym.library.config.AdManager
import com.ym.library.config.ZXADCallback
import com.ym.library.config.ZXADRewardVideo
import com.ym.library.listener.ZXADSplashListener import com.ym.library.listener.ZXADSplashListener
import com.ym.library.listener.ZXADVideoListener
import com.ym.library.module.NewsEntity import com.ym.library.module.NewsEntity
import com.ym.library.net.* import com.ym.library.net.*
import com.ym.library.sm.SMADUtils
import com.ym.library.utils.* import com.ym.library.utils.*
import com.ym.library.wechat.UserApiClient import com.ym.library.wechat.UserApiClient
import org.jetbrains.anko.act import org.jetbrains.anko.act
...@@ -37,7 +42,8 @@ class SplashActivity : BaseActivity(), SplashContract.View { ...@@ -37,7 +42,8 @@ class SplashActivity : BaseActivity(), SplashContract.View {
finish() finish()
return return
} }
Constant.ReportSessionId = "" + System.currentTimeMillis() + ReportUtils.getRandom(10)//上报使用的sessionId Constant.ReportSessionId =
"" + System.currentTimeMillis() + ReportUtils.getRandom(10)//上报使用的sessionId
EventUtils.onEvent("app_start") EventUtils.onEvent("app_start")
ImmersionBar.with(this) ImmersionBar.with(this)
.hideBar(BarHide.FLAG_HIDE_NAVIGATION_BAR) .hideBar(BarHide.FLAG_HIDE_NAVIGATION_BAR)
...@@ -66,8 +72,46 @@ class SplashActivity : BaseActivity(), SplashContract.View { ...@@ -66,8 +72,46 @@ class SplashActivity : BaseActivity(), SplashContract.View {
override fun jumpPage() { override fun jumpPage() {
if (!SettingPreference.getIsShowGuide()) { if (!SettingPreference.getIsShowGuide()) {
EventUtils.onEvent("SplashActivity_loadSplash") EventUtils.onEvent("SplashActivity_loadSplash")
// var newsEntity = NewsEntity()
// newsEntity.codeId = "26329"
// RSADUtils.loadSplashAd(
// newsEntity,
// this,
// splash_container!!,
// object : ZXADSplashListener {
// override fun onSuccessResult() {
// }
//
// },
// tv_skipview,
// object : ZXADCallback {
// override fun onAdSuccess() {
// }
//
// override fun onAdFail() {
// }
//
// })
// var newsEntity2 = NewsEntity()
// newsEntity2.codeId = "e95e6a55551"
// SMADUtils.loadSplashAd(newsEntity2,this,splash_container!!,object :ZXADSplashListener{
// override fun onSuccessResult() {
// }
// },tv_skipview,object :ZXADCallback{
// override fun onAdSuccess() {
// }
//
// override fun onAdFail() {
// }
//
// })
AdManager.loadSplashAd(this, AdManager.loadSplashAd(this,
ADConfig.AD_SPLASH, tv_skipview, splash_container!!,object : ZXADSplashListener { ADConfig.AD_SPLASH, tv_skipview, splash_container!!, object : ZXADSplashListener {
override fun onSuccessResult() { override fun onSuccessResult() {
Log.e("huang", "onSuccessResult()") Log.e("huang", "onSuccessResult()")
} }
...@@ -130,11 +174,11 @@ class SplashActivity : BaseActivity(), SplashContract.View { ...@@ -130,11 +174,11 @@ class SplashActivity : BaseActivity(), SplashContract.View {
startTime = System.currentTimeMillis() startTime = System.currentTimeMillis()
// startActivity(Intent(this@SplashActivity, GameActivity::class.java)) // startActivity(Intent(this@SplashActivity, GameActivity::class.java))
val token = SettingPreference.getToken() val token = SettingPreference.getToken()
if (token.isEmpty()){ if (token.isEmpty()) {
EventUtils.onEvent("login_token_null", "未登录") EventUtils.onEvent("login_token_null", "未登录")
startActivity(Intent(this@SplashActivity, WxLoginActivity::class.java)) startActivity(Intent(this@SplashActivity, WxLoginActivity::class.java))
finish() finish()
}else{ } else {
EventUtils.onEvent("login_token_not_null", "已登录") EventUtils.onEvent("login_token_not_null", "已登录")
startActivity(Intent(this@SplashActivity, GameActivity::class.java)) startActivity(Intent(this@SplashActivity, GameActivity::class.java))
finish() finish()
...@@ -204,13 +248,19 @@ class SplashActivity : BaseActivity(), SplashContract.View { ...@@ -204,13 +248,19 @@ class SplashActivity : BaseActivity(), SplashContract.View {
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
EventUtils.onEvent("page_status", Utils.obj2Str(ReportEntity(Constant.ReportSessionId, "SplashActivity", "onResume"))) EventUtils.onEvent(
"page_status",
Utils.obj2Str(ReportEntity(Constant.ReportSessionId, "SplashActivity", "onResume"))
)
MobclickAgent.onResume(this) MobclickAgent.onResume(this)
} }
override fun onPause() { override fun onPause() {
super.onPause() super.onPause()
EventUtils.onEvent("page_status", Utils.obj2Str(ReportEntity(Constant.ReportSessionId, "SplashActivity", "onPause"))) EventUtils.onEvent(
"page_status",
Utils.obj2Str(ReportEntity(Constant.ReportSessionId, "SplashActivity", "onPause"))
)
MobclickAgent.onPause(this) MobclickAgent.onPause(this)
} }
} }
\ No newline at end of file
...@@ -11,6 +11,7 @@ import android.util.Log ...@@ -11,6 +11,7 @@ import android.util.Log
import android.webkit.WebView import android.webkit.WebView
import androidx.multidex.MultiDex import androidx.multidex.MultiDex
import androidx.multidex.MultiDexApplication import androidx.multidex.MultiDexApplication
import com.bx.adsdk.AdSdk
import com.tencent.bugly.crashreport.CrashReport import com.tencent.bugly.crashreport.CrashReport
import com.umeng.commonsdk.UMConfigure import com.umeng.commonsdk.UMConfigure
import com.umeng.socialize.PlatformConfig import com.umeng.socialize.PlatformConfig
...@@ -33,15 +34,16 @@ class BaseApplication : MultiDexApplication() { ...@@ -33,15 +34,16 @@ class BaseApplication : MultiDexApplication() {
// Config.init(this) // Config.init(this)
NetConfig.setBase_Url(NetConfig.Environment.PRODUCT)// TODO 上线之后提成成 NetConfig.Environment.PRODUCT NetConfig.setBase_Url(NetConfig.Environment.PRODUCT)// TODO 上线之后提成成 NetConfig.Environment.PRODUCT
Constant.appLs = "a03d5320d905cf3b"//appls Constant.appLs = "a03d5320d905cf3b"//applsq
AdManager.init(//TODO 替换id AdManager.init(//替换id
this, ZXADConfig this, ZXADConfig
.csjId("5113760") .csjId("5113760")
.gdtId("1111127526") .gdtId("1111127526")
// .bdId("ba584026") // .bdId("ba584026")
// .signMob("5105", "9d597f774eb14956") .signMob("6066", "f81de7f854836db4")
.ksId("533500009") .ksId("533500009")
.ylbId("10000160") .ylbId("10000160")
.rsId("31140")
.Build() .Build()
); );
//TODO Android 9及以上必须设置 (聚合快手时必须添加) //TODO Android 9及以上必须设置 (聚合快手时必须添加)
...@@ -78,8 +80,9 @@ class BaseApplication : MultiDexApplication() { ...@@ -78,8 +80,9 @@ class BaseApplication : MultiDexApplication() {
// ToponManager.init(this,isDebug) // ToponManager.init(this,isDebug)
//小满 //小满
// AdSdk.setDebug(isDebug)//打开日志 AdSdk.setDebug(isDebug)//打开日志
// AdSdk.init(this, "qmcgw-az-hdgj_eatxht", "lRu7697I4cHV913y")//初始化 需要在Applicaiton 中 AdSdk.init(this, "xygy-az-hdgj_depamr", "5R0K7vkJPsoE088c")//初始化 需要在Applicaiton 中
} }
override fun attachBaseContext(base: Context?) { override fun attachBaseContext(base: Context?) {
......
...@@ -32,6 +32,25 @@ public class LandListEntity { ...@@ -32,6 +32,25 @@ public class LandListEntity {
private int ownNum; private int ownNum;
private int cloudSecond;
private int acceleratorsSecond;
public int getCloudSecond() {
return cloudSecond;
}
public void setCloudSecond(int cloudSecond) {
this.cloudSecond = cloudSecond;
}
public int getAcceleratorsSecond() {
return acceleratorsSecond;
}
public void setAcceleratorsSecond(int acceleratorsSecond) {
this.acceleratorsSecond = acceleratorsSecond;
}
public int getOwnNum() { public int getOwnNum() {
return ownNum; return ownNum;
} }
......
...@@ -15,6 +15,15 @@ public class StatusEntity { ...@@ -15,6 +15,15 @@ public class StatusEntity {
private int needCoin; private int needCoin;
private int videoNum; private int videoNum;
private int awardNum;//加速剂数量
public int getAwardNum() {
return awardNum;
}
public void setAwardNum(int awardNum) {
this.awardNum = awardNum;
}
public int getNeedCoin() { public int getNeedCoin() {
return needCoin; return needCoin;
......
...@@ -347,7 +347,7 @@ object TurntableDialog : TurntableUtils(), TurntableContract.View { ...@@ -347,7 +347,7 @@ object TurntableDialog : TurntableUtils(), TurntableContract.View {
btnTurntableLottery?.isEnabled = true btnTurntableLottery?.isEnabled = true
tvTurntableCount?.text = "剩余次数: ${mLotteryResult?.lotteryNum}" tvTurntableCount?.text = "剩余次数: ${mLotteryResult?.lotteryNum}"
RxBusUtil.getDefault().send(RxBusConstant.RX_MAIN_UPDATE_HOME_INFO) // RxBusUtil.getDefault().send(RxBusConstant.RX_MAIN_UPDATE_HOME_INFO)
var type = mLotteryResult?.awardType var type = mLotteryResult?.awardType
if (type != null) { if (type != null) {
if (type != 6) { if (type != 6) {
......
PACKAGE_NAME=com.ym.xync PACKAGE_NAME=com.ym.xync
VERSION_CODE=4 VERSION_CODE=5
VERSION_NAME=1.0.3 VERSION_NAME=1.0.4
\ No newline at end of file \ No newline at end of file
...@@ -6,7 +6,6 @@ buildscript { ...@@ -6,7 +6,6 @@ buildscript {
repositories { repositories {
google() google()
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.6.1' classpath 'com.android.tools.build:gradle:3.6.1'
...@@ -25,6 +24,9 @@ allprojects { ...@@ -25,6 +24,9 @@ allprojects {
maven { maven {
url "http://47.97.184.214:8081/nexus/content/groups/public" url "http://47.97.184.214:8081/nexus/content/groups/public"
} }
maven {
url "http://test.vlion.cn:8081/nexus/content/repositories/inland/"
}
} }
} }
......
...@@ -59,7 +59,7 @@ repositories { ...@@ -59,7 +59,7 @@ repositories {
dependencies { dependencies {
api fileTree(include: ['*.jar'], dir: 'libs') api fileTree(include: ['*.jar'], dir: 'libs')
api fileTree(include: ['*.aar'], dir: 'libs') api fileTree(include: ['*.aar'], dir: 'libs')
api 'androidx.appcompat:appcompat:1.1.0' api 'androidx.appcompat:appcompat:1.2.0-alpha02'
api 'com.android.support:design:28.0.0' api 'com.android.support:design:28.0.0'
api 'com.android.support:support-v4:28.0.0' api 'com.android.support:support-v4:28.0.0'
api 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72' api 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72'
...@@ -91,6 +91,27 @@ dependencies { ...@@ -91,6 +91,27 @@ dependencies {
api 'com.tencent.bugly:crashreport:latest.release' api 'com.tencent.bugly:crashreport:latest.release'
api 'com.tencent.bugly:nativecrashreport:latest.release' api 'com.tencent.bugly:nativecrashreport:latest.release'
api('cn.vlion.inland:inlandmix:9.8.2') {
exclude group: 'cn.vlion.inland', module: 'inlandb'
exclude group: 'cn.vlion.inland', module: 'inlandg'
exclude group: 'cn.vlion.inland', module: 'inlands'
exclude group: 'cn.vlion.inland', module: 'inlandt'
exclude group: 'cn.vlion.inland', module: 'inlandtf'
exclude group: 'pl.droidsonroids.gif'
exclude group: 'cn.vlion.inland', module: 'inlandk'
exclude group: 'cn.vlion.inland', module: 'inlandimb'
exclude group: 'com.squareup.picasso'
exclude group: 'cn.vlion.inland', module: 'inlanddk'
exclude group: 'com.github.bumptech.glide'
exclude group: 'com.tuia'
exclude group: 'cn.vlion.inland', module: 'inlandhy'
exclude group: 'com.mintegral.msdk'
exclude group: 'cn.vlion.inlandsh'
}
api "com.bx:adsdk:1.3.3"
} }
......
This diff is collapsed.
...@@ -591,4 +591,5 @@ public class Constant { ...@@ -591,4 +591,5 @@ public class Constant {
} }
public static String ReportSessionId = ""; public static String ReportSessionId = "";
public static boolean isReportXiaoman = true;
} }
...@@ -595,7 +595,7 @@ abstract class JavaInterface { ...@@ -595,7 +595,7 @@ abstract class JavaInterface {
val data = Utils.str2Obj(str, NewsEntity::class.java) as NewsEntity? val data = Utils.str2Obj(str, NewsEntity::class.java) as NewsEntity?
if (data != null) { if (data != null) {
JumpUtils.adJump(data,act) JumpUtils.adJump(data, act)
} }
} }
...@@ -880,7 +880,7 @@ abstract class JavaInterface { ...@@ -880,7 +880,7 @@ abstract class JavaInterface {
fun jumpWebActivity(json: String) { fun jumpWebActivity(json: String) {
act?.runOnUiThread(Runnable { act?.runOnUiThread(Runnable {
val newsEntity: NewsEntity = Utils.str2Obj(json, NewsEntity::class.java) as NewsEntity val newsEntity: NewsEntity = Utils.str2Obj(json, NewsEntity::class.java) as NewsEntity
JumpUtils.adJump(newsEntity,act) JumpUtils.adJump(newsEntity, act)
/*JumpUtils.webH5Jump( /*JumpUtils.webH5Jump(
newsEntity.title, newsEntity.title,
newsEntity.url, newsEntity.url,
...@@ -910,7 +910,7 @@ abstract class JavaInterface { ...@@ -910,7 +910,7 @@ abstract class JavaInterface {
@JavascriptInterface @JavascriptInterface
fun h5Jump(h5: String) { fun h5Jump(h5: String) {
act?.finish() act?.finish()
JumpUtils.h5Jump("", h5, false,act) JumpUtils.h5Jump("", h5, false, act)
// mWebView?.loadUrl(h5) // mWebView?.loadUrl(h5)
} }
...@@ -920,17 +920,16 @@ abstract class JavaInterface { ...@@ -920,17 +920,16 @@ abstract class JavaInterface {
*/ */
@JavascriptInterface @JavascriptInterface
fun showDialog(waterDropCount: Int, type: Int) { fun showDialog(waterDropCount: Int, type: Int) {
if (act == null) return
mWebView.context.runOnUiThread { mWebView.context.runOnUiThread {
CenterDialog.showgetWaterDrop( CenterDialog.showgetWaterDrop(
mWebView.context, act,
type, type,
waterDropCount, waterDropCount,
object : DialogInterface.OnCancelListener { DialogInterface.OnCancelListener {
override fun onCancel(p0: DialogInterface?) {
mWebView.context.runOnUiThread { mWebView.context.runOnUiThread {
mWebView?.loadUrl("javascript:onResume()") mWebView?.loadUrl("javascript:onResume()")
} }
}
}, },
mWebView mWebView
) )
......
package com.ym.library.activity
import android.util.Log
import com.bx.adsdk.CampaignCallback
import com.bx.adsdk.CampaignFragment
import com.bytedance.sdk.openadsdk.*
import com.google.gson.Gson
import com.qq.e.ads.rewardvideo.RewardVideoAD
import com.qq.e.ads.rewardvideo.RewardVideoADListener
import com.qq.e.comm.managers.GDTADManager
import com.qq.e.comm.util.AdError
import com.umeng.analytics.MobclickAgent
import com.ym.library.Constant
import com.ym.library.R
import com.ym.library.module.ReportEntity
import com.ym.library.net.*
import com.ym.library.utils.EventUtils
import com.ym.library.utils.SettingPreference
import com.ym.library.utils.Utils
import kotlinx.android.synthetic.main.activity_xiaoman.*
class XiaoManActivity : BaseActivity() {
override fun layoutID(): Int = R.layout.activity_xiaoman
private var campaignFragment: CampaignFragment? = null
private var rewardVideoAD: RewardVideoAD? = null
override fun init() {
id_tv_title.text = intent.data?.getQueryParameter("title")
/**
* @param userId 用户id,必传,不能为空,不能为0
* @param placeId 资源位id:必传
* @param callback CampaignCallback 回调
*/
campaignFragment = CampaignFragment.newInstance(SettingPreference.getToken())
campaignFragment?.setPlaceId("2654")
campaignFragment?.setCallback(object : CampaignCallback() {
override fun showAd(params: String) {
super.showAd(params)
val bridgeBean: XiaoManEntity = Gson().fromJson(params, XiaoManEntity::class.java)
val adType: String = bridgeBean.adType.toString()
val pId: String = bridgeBean.pid.toString()
val requestId: String = bridgeBean.requestId.toString()
if (adType.equals("1")) {
showTTAd("5113760", pId, requestId)
} else {
showGDTAd("1111127526", pId, requestId)
}
}
})
// campaignFragment?.canGoBack()//webview 是否可以返回上一页
// campaignFragment?.goBack()//webview 返回上一页
supportFragmentManager.beginTransaction().add(R.id.id_activity_fragment_content, campaignFragment!!).commitAllowingStateLoss()
id_iv_back.setOnClickListener {
finish()
}
}
/**
* 穿山甲广告
*/
fun showTTAd(appId: String, pId: String, requestId: String) {
//强烈建议在应用对应的Application#onCreate()方法中调用,避免出现content为null的异常
TTAdSdk.init(
this@XiaoManActivity,
TTAdConfig.Builder()
.appId(appId)
.useTextureView(true) //使用TextureView控件播放视频,默认为SurfaceView,当有SurfaceView冲突的场景,可以使用TextureView
.appName(this@XiaoManActivity.getString(R.string.app_name))
.titleBarTheme(TTAdConstant.TITLE_BAR_THEME_DARK)
.allowShowNotify(true) //是否允许sdk展示通知栏提示
.allowShowPageWhenScreenLock(true) //是否在锁屏场景支持展示广告落地页
.debug(true) //测试阶段打开,可以通过日志排查问题,上线时去除该调用
.directDownloadNetworkType(
TTAdConstant.NETWORK_STATE_WIFI,
TTAdConstant.NETWORK_STATE_3G
) //允许直接下载的网络状态集合
.supportMultiProcess(false) //是否支持多进程,true支持
//.httpStack(new MyOkStack3())//自定义网络库,demo中给出了okhttp3版本的样例,其余请自行开发或者咨询工作人员。
.build()
)
val mTTAdNative = TTAdSdk.getAdManager().createAdNative(this@XiaoManActivity)
val adSlot = AdSlot.Builder()
.setCodeId(pId)
.setSupportDeepLink(true)
.setAdCount(2) //个性化模板广告需要设置期望个性化模板广告的大小,单位dp,激励视频场景,只要设置的值大于0即可
.setExpressViewAcceptedSize(500f, 500f)
.setImageAcceptedSize(1080, 1920)
.setRewardName("金币") //奖励的名称
.setRewardAmount(0) //奖励的数量
//必传参数,表来标识应用侧唯一用户;若非服务器回调模式或不需sdk透传
//可设置为空字符串
.setUserID("")//userId
.setOrientation(TTAdConstant.VERTICAL) //设置期望视频播放的方向,为TTAdConstant.HORIZONTAL或TTAdConstant.VERTICAL
// .setMediaExtra("media_extra") //用户透传的信息,可不传
.build()
mTTAdNative.loadRewardVideoAd(adSlot, object : TTAdNative.RewardVideoAdListener {
override fun onError(code: Int, message: String) {
campaignFragment?.setVideoError(requestId)
}
//视频广告加载后的视频文件资源缓存到本地的回调
override fun onRewardVideoCached() {}
//视频广告素材加载到,如title,视频url等,不包括视频文件
override fun onRewardVideoAdLoad(ad: TTRewardVideoAd) {
ad.setRewardAdInteractionListener(object :
TTRewardVideoAd.RewardAdInteractionListener {
override fun onAdShow() {
campaignFragment?.setVideoLoad(requestId)
EventUtils.onEvent("XIAO_MAN_CSJ_SHOW","小满穿山甲广告展示")
}
override fun onAdVideoBarClick() {
EventUtils.onEvent("XIAO_MAN_CSJ_CLICK","小满穿山甲广告点击")
}
override fun onAdClose() {
EventUtils.onEvent("XIAO_MAN_CSJ_CLOSE_CLICK","小满穿山甲广告关闭点击")
campaignFragment?.setVideoClose(requestId)
}
override fun onVideoError() {
campaignFragment?.setVideoError(requestId)
}
override fun onVideoComplete() {
campaignFragment?.setVideoComplete(requestId)
}
override fun onRewardVerify(rewardVerify: Boolean, rewardAmount: Int, rewardName: String?) {}
override fun onSkippedVideo() {}
})
ad.setDownloadListener(object : TTAppDownloadListener {
override fun onIdle() {}
override fun onDownloadActive(totalBytes: Long, currBytes: Long, fileName: String, appName: String) {}
override fun onDownloadPaused(totalBytes: Long, currBytes: Long, fileName: String, appName: String) {}
override fun onDownloadFailed(totalBytes: Long, currBytes: Long, fileName: String, appName: String) {}
override fun onDownloadFinished(totalBytes: Long, fileName: String, appName: String) {}
override fun onInstalled(fileName: String, appName: String) {}
})
ad.showRewardVideoAd(this@XiaoManActivity)
}
})
}
/**
* 广点通广告
*/
fun showGDTAd(appID: String, pId: String, requestId: String) {
GDTADManager.getInstance().initWith(this@XiaoManActivity, requestId)
rewardVideoAD = RewardVideoAD(this, appID, pId, object : RewardVideoADListener {
override fun onADLoad() {
if (rewardVideoAD != null) rewardVideoAD?.showAD()
campaignFragment?.setVideoLoad(requestId)
}
override fun onVideoCached() {}
override fun onADShow() {
EventUtils.onEvent("XIAO_MAN_GDT_SHOW","小满广点通广告展示")
}
override fun onADExpose() {}
override fun onReward() {}
override fun onADClick() {
EventUtils.onEvent("XIAO_MAN_GDT_CLICK","小满广点通广告点击")
}
override fun onVideoComplete() {
campaignFragment?.setVideoComplete(requestId)
}
override fun onADClose() {
EventUtils.onEvent("XIAO_MAN_GDT_CLOSE_CLICK","小满广点通广告关闭点击")
campaignFragment?.setVideoClose(requestId)
}
override fun onError(adError: AdError) {
campaignFragment?.setVideoError(requestId)
}
})
rewardVideoAD?.loadAD()
}
override fun onResume() {
super.onResume()
EventUtils.onEvent("page_status", Utils.obj2Str(ReportEntity(Constant.ReportSessionId, "XiaoManActivity", "onResume")))
MobclickAgent.onResume(this)
}
override fun onPause() {
super.onPause()
EventUtils.onEvent("page_status", Utils.obj2Str(ReportEntity(Constant.ReportSessionId, "XiaoManActivity", "onPause")))
MobclickAgent.onPause(this)
}
class XiaoManEntity {
var adType: String? = ""
var requestId: String? = ""
var pid: String? = ""
}
/**
* 看视频上报
*/
fun videoClick() {
// ApiClient.userApi.videoReport().compose(
// RxSchedulers.observableIO2Main()).subscribe(object : BaseObserver<String>() {
// override fun onSuccess(result: String?) {}
// override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {}
// })
}
fun videoShow(){
}
fun videoCloseClick(){
}
}
\ No newline at end of file
...@@ -23,7 +23,7 @@ import com.ym.library.utils.EventUtils ...@@ -23,7 +23,7 @@ import com.ym.library.utils.EventUtils
import com.ym.library.utils.LogHelper import com.ym.library.utils.LogHelper
object BDADUtils { object BDADUtils {
private const val TAG = "AdManager"
//开屏 //开屏
fun loadSplashAd(newsEntity: NewsEntity, activity: Activity, container: ViewGroup, zxadListener: ZXADSplashListener?, skipView: TextView?,zxadCallback: ZXADCallback) { fun loadSplashAd(newsEntity: NewsEntity, activity: Activity, container: ViewGroup, zxadListener: ZXADSplashListener?, skipView: TextView?,zxadCallback: ZXADCallback) {
// 广告展现前先调用sdk初始化方法,可以有效缩短广告第一次展现所需时间 // 广告展现前先调用sdk初始化方法,可以有效缩短广告第一次展现所需时间
...@@ -35,18 +35,18 @@ object BDADUtils { ...@@ -35,18 +35,18 @@ object BDADUtils {
// 增加lp页面关闭回调,不需要该回调的继续使用原来接口就可以 // 增加lp页面关闭回调,不需要该回调的继续使用原来接口就可以
val listener: SplashLpCloseListener = object : SplashLpCloseListener { val listener: SplashLpCloseListener = object : SplashLpCloseListener {
override fun onLpClosed() { override fun onLpClosed() {
Toast.makeText(activity, "lp页面关闭", Toast.LENGTH_SHORT).show() // Toast.makeText(activity, "lp页面关闭", Toast.LENGTH_SHORT).show()
zxadListener?.onAdSkip() zxadListener?.onAdSkip()
Log.d(TAG,"百度 开屏 onLpClosed")
} }
override fun onAdDismissed() { override fun onAdDismissed() {
Log.i("RSplashActivity", "onAdDismissed")
zxadListener?.onAdSkip() zxadListener?.onAdSkip()
Log.d(TAG,"百度 开屏 onAdDismissed")
} }
override fun onAdFailed(arg0: String) { override fun onAdFailed(arg0: String) {
Log.i("RSplashActivity", arg0) Log.d(TAG,"百度 开屏 onAdFailed" + arg0)
zxadListener?.onAdSkip() zxadListener?.onAdSkip()
zxadCallback.onAdFail() zxadCallback.onAdFail()
...@@ -54,12 +54,12 @@ object BDADUtils { ...@@ -54,12 +54,12 @@ object BDADUtils {
} }
override fun onAdPresent() { override fun onAdPresent() {
Log.i("RSplashActivity", "onAdPresent") Log.d(TAG,"百度 开屏 onAdPresent")
container.setVisibility(View.GONE) container.setVisibility(View.GONE)
} }
override fun onAdClick() { override fun onAdClick() {
Log.i("RSplashActivity", "onAdClick") Log.d(TAG,"百度 开屏 onAdClick")
// 设置开屏可接受点击时,该回调可用 // 设置开屏可接受点击时,该回调可用
zxadListener?.onAdClicked(newsEntity) zxadListener?.onAdClicked(newsEntity)
...@@ -166,14 +166,14 @@ object BDADUtils { ...@@ -166,14 +166,14 @@ object BDADUtils {
val handler = object : Handler() { val handler = object : Handler() {
override fun handleMessage(msg: Message?) { override fun handleMessage(msg: Message) {
super.handleMessage(msg)
if (mRewardVideoAd != null) { if (mRewardVideoAd != null) {
mRewardVideoAd.show() mRewardVideoAd.show()
removeCallbacksAndMessages(null) removeCallbacksAndMessages(null)
} else{ } else{
sendEmptyMessageDelayed(1,20) sendEmptyMessageDelayed(1,20)
} }
} }
} }
...@@ -182,70 +182,6 @@ object BDADUtils { ...@@ -182,70 +182,6 @@ object BDADUtils {
} }
//激励视频
fun loadReward2VideoAd(
activity: Activity,
newsEntity: NewsEntity,
listener: ZXADVideoListener,
callback: ZXADCallback
) {
// 激励视屏产品可以选择是否使用SurfaceView进行渲染视频
var mRewardVideoAd = RewardVideoAd(
activity,
newsEntity.codeId, object :RewardVideoAd.RewardVideoAdListener{
override fun onAdFailed(p0: String?) {
callback.onAdFail()
}
override fun playCompletion() {
}
override fun onAdShow() {
// AdUpload.onAdImpression(newsEntity)
}
override fun onAdClick() {
// AdUpload.onAdClick(newsEntity)
}
override fun onAdClose(p0: Float) {
}
override fun onVideoDownloadSuccess() {
}
override fun onVideoDownloadFailed() {
}
}, true)
mRewardVideoAd.load()
listener.onLoadVideoAd(ZXADRewardVideo(mRewardVideoAd))
// val handler = object : Handler() {
// override fun handleMessage(msg: Message?) {
// if (mRewardVideoAd != null) {
// mRewardVideoAd.show()
// removeCallbacksAndMessages(null)
// } else{
// sendEmptyMessageDelayed(1,50)
// }
//
// }
//
// }
// handler.sendEmptyMessageDelayed(1,50)
}
//信息流 原生 //信息流 原生
fun loadFeedNativeAd(activity:Activity,newsEntity: NewsEntity,zxadCallback: ZXADCallback){ fun loadFeedNativeAd(activity:Activity,newsEntity: NewsEntity,zxadCallback: ZXADCallback){
......
...@@ -24,6 +24,9 @@ object ZXADConfig { ...@@ -24,6 +24,9 @@ object ZXADConfig {
//快手 appId //快手 appId
var KS_APP_ID = "" var KS_APP_ID = ""
//瑞狮 appId
var RS_APP_ID = ""
//是否使用 TextureView //是否使用 TextureView
var useTextureView = false var useTextureView = false
...@@ -101,6 +104,10 @@ object ZXADConfig { ...@@ -101,6 +104,10 @@ object ZXADConfig {
KS_APP_ID = appid KS_APP_ID = appid
return zxadConfig return zxadConfig
} }
fun rsId(appid:String): ZXADConfig {
RS_APP_ID = appid
return zxadConfig
}
fun useTextureView(useTextureView: Boolean): ZXADConfig { fun useTextureView(useTextureView: Boolean): ZXADConfig {
ZXADConfig.useTextureView = useTextureView ZXADConfig.useTextureView = useTextureView
return zxadConfig return zxadConfig
......
...@@ -7,8 +7,6 @@ object ZXADType { ...@@ -7,8 +7,6 @@ object ZXADType {
// 1. 穿山甲 2.广点通 3. 快手 4. 搜狗 5.科大讯飞 // 1. 穿山甲 2.广点通 3. 快手 4. 搜狗 5.科大讯飞
/** /**
* 新 * 新
* 1001 chuanshanjia 穿山甲 1 * 1001 chuanshanjia 穿山甲 1
...@@ -21,15 +19,14 @@ object ZXADType { ...@@ -21,15 +19,14 @@ object ZXADType {
const val PLANTFORM_AD_GDT = "guangdiantong" //广点通 const val PLANTFORM_AD_GDT = "guangdiantong" //广点通
const val PLANTFORM_AD_KUS = "kuaishou" //快手 const val PLANTFORM_AD_KUS = "kuaishou" //快手
const val PLANTFORM_SH_YLB = "youliangbao"//优量宝 const val PLANTFORM_SH_YLB = "youliangbao"//优量宝
const val PLANTFORM_AD_SIGNMOB = "sigmob" //sign Mob
const val PLANTFORM_AD_BD = "baidu" //百度
const val PLANTFORM_AD_SH = "shanhu"//珊瑚
const val PLANTFORM_AD_RS = "ruishi"//瑞狮
const val PLANTFORM_AD_SG = 4 //搜狗 const val PLANTFORM_AD_SG = 4 //搜狗
const val PLANTFORM_AD_KDXF = 5 //科大讯飞 const val PLANTFORM_AD_KDXF = 5 //科大讯飞
const val PLANTFORM_AD_SIGNMOB = "signMob" //sign Mob
const val PLANTFORM_AD_BD = "baidu" //百度
const val PLANTFORM_SH_AD = "shanhu"//珊瑚
// =====================================================================stop // =====================================================================stop
...@@ -74,5 +71,4 @@ object ZXADType { ...@@ -74,5 +71,4 @@ object ZXADType {
const val AD_ID_SEL = "1104" const val AD_ID_SEL = "1104"
const val AD_ID_KUS = "1105" const val AD_ID_KUS = "1105"
} }
\ No newline at end of file
...@@ -26,14 +26,13 @@ import com.ym.library.listener.ZXADExpressListener ...@@ -26,14 +26,13 @@ import com.ym.library.listener.ZXADExpressListener
import com.ym.library.listener.ZXADSplashListener import com.ym.library.listener.ZXADSplashListener
import com.ym.library.listener.ZXADVideoListener import com.ym.library.listener.ZXADVideoListener
import com.ym.library.module.NewsEntity import com.ym.library.module.NewsEntity
import com.ym.library.net.AdUpload
import com.ym.library.utils.EventUtils import com.ym.library.utils.EventUtils
import com.ym.library.utils.EventUtils.apiClient import com.ym.library.utils.EventUtils.onEventClick
import com.ym.library.utils.EventUtils.onEventUM import com.ym.library.utils.EventUtils.onEventUM
object GDTAdUtils { object GDTAdUtils {
private val TAG = "AdManager"
/** /**
* 加载开屏广告 * 加载开屏广告
...@@ -52,8 +51,9 @@ object GDTAdUtils { ...@@ -52,8 +51,9 @@ object GDTAdUtils {
override fun onADLoaded(p0: Long) { override fun onADLoaded(p0: Long) {
// AdUpload.onAdImpression(newsEntity) // AdUpload.onAdImpression(newsEntity)
zxadCallback.onAdSuccess() zxadCallback.onAdSuccess()
apiClient(newsEntity?.imp_tracking[0]) Log.d(TAG,"广点通 开屏显示")
onEventUM("ad_splash_show","广点通开屏") EventUtils.onEventShow(newsEntity)
onEventUM("ad_splash_show","广点通 开屏广告")
} }
override fun onNoAD(p0: AdError?) { override fun onNoAD(p0: AdError?) {
...@@ -64,9 +64,11 @@ object GDTAdUtils { ...@@ -64,9 +64,11 @@ object GDTAdUtils {
} }
override fun onADClicked() { override fun onADClicked() {
Log.d(TAG,"广点通 onADClicked")
// AdUpload.onAdClick(newsEntity) // AdUpload.onAdClick(newsEntity)
apiClient(newsEntity?.clk_tracking[0])
onEventUM("ad_splash_click","广点通开屏") EventUtils.onEventClick(newsEntity)
onEventUM("ad_feed_click","广点通 开屏广告")
} }
override fun onADTick(p0: Long) { override fun onADTick(p0: Long) {
...@@ -201,14 +203,19 @@ object GDTAdUtils { ...@@ -201,14 +203,19 @@ object GDTAdUtils {
override fun onADClicked(p0: NativeExpressADView?) { override fun onADClicked(p0: NativeExpressADView?) {
// AdUpload.onAdClick(newsEntity) // AdUpload.onAdClick(newsEntity)
EventUtils.apiClient(newsEntity?.clk_tracking[0]) Log.d(TAG,"广点通 大图 onADClicked")
onEventUM("ad_feed_click","广点通大图");
EventUtils.onEventClick(newsEntity)
onEventUM("ad_feed_click","广点通 大图广告")
} }
override fun onRenderSuccess(p0: NativeExpressADView?) { override fun onRenderSuccess(p0: NativeExpressADView?) {
// AdUpload.onAdImpression(newsEntity) // AdUpload.onAdImpression(newsEntity)
EventUtils.apiClient(newsEntity?.imp_tracking[0]) Log.d(TAG,"广点通 大图 onRenderSuccess")
onEventUM("ad_feed_show","广点通大图");
EventUtils.onEventShow(newsEntity)
onEventUM("ad_feed_show","广点通 大图广告")
} }
}) })
...@@ -264,9 +271,10 @@ object GDTAdUtils { ...@@ -264,9 +271,10 @@ object GDTAdUtils {
} }
override fun onADClick() { override fun onADClick() {
apiClient(entity?.clk_tracking[0])
listener.onAdVideoBarClick(entity) listener.onAdVideoBarClick(entity)
onEventUM("ad_reward_video_click","广点通激励视频") Log.d(TAG,"广点通 激励 onADClick")
onEventClick(entity)
onEventUM("ad_reward_video_click","广点通 激励视频广告")
} }
override fun onVideoCached() { override fun onVideoCached() {
...@@ -297,17 +305,17 @@ object GDTAdUtils { ...@@ -297,17 +305,17 @@ object GDTAdUtils {
override fun onError(p0: AdError?) { override fun onError(p0: AdError?) {
listener.onVideoError() listener.onVideoError()
callback.onAdFail() callback.onAdFail()
Log.d("huang", "adPlatform = " +entity.adPlatform + "----errorMsg= " + p0?.errorMsg)
} }
override fun onADShow() { override fun onADShow() {
// apiClient(entity?.imp_tracking[0]) // apiClient(entity?.imp_tracking[0])
callback.onAdSuccess() callback.onAdSuccess()
listener.onAdShow() listener.onAdShow()
Log.d(TAG,"广点通 激励 onADShow")
// AdUpload.onAdImpression(entity) // AdUpload.onAdImpression(entity)
apiClient(entity.imp_tracking[0]) EventUtils.onEventShow(entity)
onEventUM("ad_reward_video_show","广点通激励视频") onEventUM("ad_reward_video_show","广点通 激励视频广告")
} }
}) // 有声播放 }) // 有声播放
...@@ -318,7 +326,8 @@ object GDTAdUtils { ...@@ -318,7 +326,8 @@ object GDTAdUtils {
var startTime = System.currentTimeMillis() var startTime = System.currentTimeMillis()
val handler = object : Handler() { val handler = object : Handler() {
override fun handleMessage(msg: Message?) { override fun handleMessage(msg: Message) {
super.handleMessage(msg)
if (adLoaded) { //广告展示检查1:广告成功加载,此处也可以使用videoCached来实现视频预加载完成后再展示激励视频广告的逻辑 if (adLoaded) { //广告展示检查1:广告成功加载,此处也可以使用videoCached来实现视频预加载完成后再展示激励视频广告的逻辑
if (!rewardVideoAD.hasShown()) { //广告展示检查2:当前广告数据还没有展示过 if (!rewardVideoAD.hasShown()) { //广告展示检查2:当前广告数据还没有展示过
val delta: Long = 1000 //建议给广告过期时间加个buffer,单位ms,这里demo采用1000ms的buffer val delta: Long = 1000 //建议给广告过期时间加个buffer,单位ms,这里demo采用1000ms的buffer
...@@ -327,7 +336,7 @@ object GDTAdUtils { ...@@ -327,7 +336,7 @@ object GDTAdUtils {
rewardVideoAD.showAD() rewardVideoAD.showAD()
var endTime = System.currentTimeMillis() var endTime = System.currentTimeMillis()
Log.e("HUANG","广点通激励视频耗时"+ (System.currentTimeMillis()-startTime)+"") Log.e(TAG,"广点通激励视频耗时"+ (System.currentTimeMillis()-startTime)+"")
} else { } else {
...@@ -352,88 +361,6 @@ object GDTAdUtils { ...@@ -352,88 +361,6 @@ object GDTAdUtils {
handler.sendEmptyMessageDelayed(1,20) handler.sendEmptyMessageDelayed(1,20)
}
fun loadReward2VideoAd(
activity: Activity,
entity: NewsEntity,
listener: ZXADVideoListener,
callback: ZXADCallback
) {
var rewardVideoAD = RewardVideoAD(activity, entity.codeId, object : RewardVideoADListener {
override fun onADExpose() {
}
override fun onADClick() {
// AdUpload.onAdClick(entity)
}
override fun onVideoCached() {
}
override fun onReward() {
}
override fun onADClose() {
}
//如果这里
override fun onADLoad() {
}
override fun onVideoComplete() {
}
override fun onError(p0: AdError?) {
callback.onAdFail()
}
override fun onADShow() {
// AdUpload.onAdImpression(entity)
}
}) // 有声播放
rewardVideoAD.loadAD()
listener.onLoadVideoAd(ZXADRewardVideo(rewardVideoAD))
// val handler = object : Handler() {
// override fun handleMessage(msg: Message?) {
// if (adLoaded) { //广告展示检查1:广告成功加载,此处也可以使用videoCached来实现视频预加载完成后再展示激励视频广告的逻辑
// if (!rewardVideoAD.hasShown()) { //广告展示检查2:当前广告数据还没有展示过
// val delta: Long = 1000 //建议给广告过期时间加个buffer,单位ms,这里demo采用1000ms的buffer
// //广告展示检查3:展示广告前判断广告数据未过期
// if (SystemClock.elapsedRealtime() < rewardVideoAD.expireTimestamp - delta) {
// rewardVideoAD.showAD()
// var endTime = System.currentTimeMillis()
//
// } else {
//// Toast.makeText(activity, "激励视频广告已过期,请再次请求广告后进行广告展示!", Toast.LENGTH_LONG).show()
// listener.onError()
// }
// removeCallbacksAndMessages(null)
//
// } else {
//// Toast.makeText(activity, "此条广告已经展示过,请再次请求广告后进行广告展示!", Toast.LENGTH_LONG).show()
// listener.onError()
// removeCallbacksAndMessages(null)
// }
// } else {
//// Toast.makeText(activity, "成功加载广告后再进行广告展示!", Toast.LENGTH_LONG).show()
// listener.onError()
// sendEmptyMessageDelayed(1,50)
// }
// }
//
// }
// handler.sendEmptyMessageDelayed(1,50)
} }
//TODO 全屏视频广告 暂时没有 //TODO 全屏视频广告 暂时没有
......
This diff is collapsed.
...@@ -13,6 +13,10 @@ import com.tz.sdk.core.ad.ADEvent; ...@@ -13,6 +13,10 @@ import com.tz.sdk.core.ad.ADEvent;
import com.tz.sdk.core.ad.ADSource; import com.tz.sdk.core.ad.ADSource;
import com.tz.sdk.core.ad.ADType; import com.tz.sdk.core.ad.ADType;
import com.tz.sdk.core.loader.ADLoader; import com.tz.sdk.core.loader.ADLoader;
import com.ym.library.config.ZXADCallback;
import com.ym.library.listener.ZXADVideoListener;
import com.ym.library.module.NewsEntity;
import com.ym.library.utils.EventUtils;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -22,10 +26,23 @@ import java.util.List; ...@@ -22,10 +26,23 @@ import java.util.List;
* Created by wanghl on 2020/6/18 * Created by wanghl on 2020/6/18
*/ */
public final class CoralRewardVideo extends CoralBase { public final class CoralRewardVideo extends CoralBase {
private String TAG = "AdManager";
private NewsEntity data;
private ZXADVideoListener listener;
private ZXADCallback callback;
public CoralRewardVideo(Context context, int taskType) { public CoralRewardVideo(Context context, int taskType) {
super(context, taskType); super(context, taskType);
} }
public CoralRewardVideo build(NewsEntity data,ZXADVideoListener listener,
ZXADCallback callback) {
this.data = data;
this.listener = listener;
this.callback = callback;
return this;
}
@Override @Override
public void pull() { public void pull() {
super.pull(); super.pull();
...@@ -46,8 +63,13 @@ public final class CoralRewardVideo extends CoralBase { ...@@ -46,8 +63,13 @@ public final class CoralRewardVideo extends CoralBase {
public void onAdLoaded(List<CoralAD> adList) { public void onAdLoaded(List<CoralAD> adList) {
if (adList != null && adList.size() > 0) { if (adList != null && adList.size() > 0) {
whenAdLoaded(adList.get(0)); whenAdLoaded(adList.get(0));
callback.onAdSuccess();
listener.onSuccess();
Log.d(TAG,"珊瑚 激励 onAdLoaded");
} else { } else {
whenAdError("视频类(" + mTaskType + ")广告返回数量0"); callback.onAdFail();
Log.d(TAG,"珊瑚 激励视频类(" + mTaskType + ")广告返回数量0");
whenAdError("珊瑚 激励视频类(" + mTaskType + ")广告返回数量0");
} }
} }
...@@ -58,17 +80,30 @@ public final class CoralRewardVideo extends CoralBase { ...@@ -58,17 +80,30 @@ public final class CoralRewardVideo extends CoralBase {
Log.e("CoralRewardVideo", adError.toString()); Log.e("CoralRewardVideo", adError.toString());
} }
whenAdError(adError.toString()); whenAdError(adError.toString());
callback.onAdFail();
listener.onError();
listener.onFail();
Log.d(TAG,"珊瑚 激励 onAdFailed" + adError.toString());
} }
@Override @Override
public boolean onAdShow(@Nullable CoralAD ad) { public boolean onAdShow(@Nullable CoralAD ad) {
whenAdShow(); whenAdShow();
listener.onAdShow();
EventUtils.INSTANCE.onEventShow(data);
EventUtils.INSTANCE.onEventUM("ad_reward_video_show","珊瑚 激励视频广告");
Log.d(TAG,"珊瑚 激励 onAdShow");
return super.onAdShow(ad); return super.onAdShow(ad);
} }
@Override @Override
public boolean onAdClicked(@Nullable CoralAD ad) { public boolean onAdClicked(@Nullable CoralAD ad) {
whenAdClicked(); whenAdClicked();
listener.onAdVideoBarClick(data);
EventUtils.INSTANCE.onEventClick(data);
EventUtils.INSTANCE.onEventUM("ad_reward_video_click","珊瑚 激励视频广告");
Log.d(TAG,"珊瑚 激励 onAdClicked");
return super.onAdClicked(ad); return super.onAdClicked(ad);
} }
...@@ -103,6 +138,8 @@ public final class CoralRewardVideo extends CoralBase { ...@@ -103,6 +138,8 @@ public final class CoralRewardVideo extends CoralBase {
@Override @Override
public boolean onVideoClosed(CoralAD coralAD, String s) { public boolean onVideoClosed(CoralAD coralAD, String s) {
listener.onAdClose();
Log.d(TAG,"珊瑚 激励 onVideoClosed");
return super.onVideoClosed(coralAD, s); return super.onVideoClosed(coralAD, s);
} }
}); });
......
...@@ -86,6 +86,7 @@ public final class CoralSplashImage extends CoralBase { ...@@ -86,6 +86,7 @@ public final class CoralSplashImage extends CoralBase {
public boolean onAdClicked(@Nullable CoralAD ad) { public boolean onAdClicked(@Nullable CoralAD ad) {
whenAdClicked(); whenAdClicked();
// return super.onAdClicked(ad); // return super.onAdClicked(ad);
mISplashImageListener.onAdClicked();
return true; return true;
} }
...@@ -169,5 +170,10 @@ public final class CoralSplashImage extends CoralBase { ...@@ -169,5 +170,10 @@ public final class CoralSplashImage extends CoralBase {
* 倒计时结束 * 倒计时结束
*/ */
void onTimesUp(); void onTimesUp();
/**
* 倒计时结束
*/
void onAdClicked();
} }
} }
...@@ -2,46 +2,63 @@ package com.ym.library.sh ...@@ -2,46 +2,63 @@ package com.ym.library.sh
import android.app.Activity import android.app.Activity
import android.util.Log
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.TextView import android.widget.TextView
import com.tencent.ep.shanhuad.adpublic.adbuilder.RewardVideo
import com.tencent.ep.shanhuad.adpublic.models.AdID
import com.ym.admodule.listener.ZXADDrawListener
import com.ym.library.R
import com.ym.library.config.ZXADCallback import com.ym.library.config.ZXADCallback
import com.ym.library.listener.ZXADSplashListener import com.ym.library.listener.ZXADSplashListener
import com.ym.library.listener.ZXADVideoListener import com.ym.library.listener.ZXADVideoListener
import com.ym.library.module.NewsEntity import com.ym.library.module.NewsEntity
import com.ym.library.net.AdUpload import com.ym.library.utils.EventUtils
import com.ym.library.utils.EventUtils.onEventClick
import com.ym.library.utils.EventUtils.onEventShow
object SHADUtils { object SHADUtils {
private val TAG = "AdManager"
//开屏 //开屏
fun loadSplashAd(newsEntity:NewsEntity,activity: Activity, container: ViewGroup, zxadListener: ZXADSplashListener?, fun loadSplashAd(
skipView: TextView?,zxadCallback: ZXADCallback) { newsEntity: NewsEntity,
activity: Activity,
container: ViewGroup,
zxadListener: ZXADSplashListener?,
skipView: TextView?,
zxadCallback: ZXADCallback
) {
CoralSplashImage(activity, 125) CoralSplashImage(activity, 125)
.container(container) .container(container)
.skip(skipView) .skip(skipView)
.listen(object : CoralSplashImage.ISplashImageListener { .listen(object : CoralSplashImage.ISplashImageListener {
override fun onAdError() { override fun onAdError() {
Log.d(TAG, "珊瑚 开屏 onAdError")
zxadListener?.onErrorResult("广告拉取失败"); zxadListener?.onErrorResult("广告拉取失败");
zxadCallback.onAdFail() zxadCallback.onAdFail()
zxadListener?.onTimeout() zxadListener?.onTimeout()
} }
override fun onAdClicked() {
Log.d(TAG, "珊瑚 开屏 onAdClicked")
onEventClick(newsEntity)
EventUtils.onEventUM("ad_splash_click", "珊瑚 开屏广告")
}
override fun onAdShow() { override fun onAdShow() {
Log.d(TAG, "珊瑚 开屏 onAdShow")
zxadListener?.onAdShow(newsEntity) zxadListener?.onAdShow(newsEntity)
zxadCallback.onAdSuccess() zxadCallback.onAdSuccess()
skipView?.visibility = View.VISIBLE skipView?.visibility = View.VISIBLE
onEventShow(newsEntity)
EventUtils.onEventUM("ad_splash_show", "珊瑚 开屏广告")
} }
override fun onTimeTick(msLeft: Long) { override fun onTimeTick(msLeft: Long) {
skipView?.text = "跳过:" + msLeft / 1000 skipView?.text = "跳过:" + msLeft / 1000
if(msLeft<=1000){ if (msLeft <= 1000) {
zxadListener?.onAdSkip() zxadListener?.onAdSkip()
} }
} }
...@@ -91,9 +108,9 @@ object SHADUtils { ...@@ -91,9 +108,9 @@ object SHADUtils {
// //
// }, newsEntity.codeId?.toInt()?.let { AdID(it, 720, 1080) }, container, skipView) // }, newsEntity.codeId?.toInt()?.let { AdID(it, 720, 1080) }, container, skipView)
// //
// skipView?.setOnClickListener { skipView?.setOnClickListener {
// zxadListener?.onAdSkip() zxadListener?.onAdSkip()
// } }
} }
...@@ -105,8 +122,8 @@ object SHADUtils { ...@@ -105,8 +122,8 @@ object SHADUtils {
callback: ZXADCallback callback: ZXADCallback
) { ) {
CoralRewardVideo(activity, 104 ).pull() // CoralRewardVideo(activity, 104 ).pull()
CoralRewardVideo(activity, 104).build(entity, listener, callback).pull()
// ADLoader(activity)[ADType.REWARD_VIDEO] // ADLoader(activity)[ADType.REWARD_VIDEO]
// .from(ADSource.CORAL) // .from(ADSource.CORAL)
// .count(1) // .count(1)
...@@ -218,7 +235,7 @@ object SHADUtils { ...@@ -218,7 +235,7 @@ object SHADUtils {
} }
//视频流 带广告 //视频流 带广告
fun loadSHFeedSpecialVideoAd(activity: Activity,i:Int) { fun loadSHFeedSpecialVideoAd(activity: Activity, i: Int) {
CoralVideoFeed(activity, 138).container(i).pull() CoralVideoFeed(activity, 138).container(i).pull()
} }
} }
\ No newline at end of file
package com.ym.library.sm package com.ym.library.sm
import android.app.Activity import android.app.Activity
import android.os.Handler
import android.os.Message
import android.util.Log
import android.view.ViewGroup
import android.widget.TextView
import com.sigmob.windad.Splash.WindSplashAD
import com.sigmob.windad.Splash.WindSplashADListener
import com.sigmob.windad.Splash.WindSplashAdRequest
import com.sigmob.windad.WindAdError import com.sigmob.windad.WindAdError
import com.sigmob.windad.WindAds import com.sigmob.windad.WindAds
import com.sigmob.windad.fullscreenvideo.WindFullScreenAdRequest import com.sigmob.windad.fullscreenvideo.WindFullScreenAdRequest
...@@ -11,57 +19,129 @@ import com.sigmob.windad.rewardedVideo.WindRewardInfo ...@@ -11,57 +19,129 @@ import com.sigmob.windad.rewardedVideo.WindRewardInfo
import com.sigmob.windad.rewardedVideo.WindRewardedVideoAd import com.sigmob.windad.rewardedVideo.WindRewardedVideoAd
import com.sigmob.windad.rewardedVideo.WindRewardedVideoAdListener import com.sigmob.windad.rewardedVideo.WindRewardedVideoAdListener
import com.ym.library.config.ZXADCallback import com.ym.library.config.ZXADCallback
import com.ym.library.listener.ZXADSplashListener
import com.ym.library.listener.ZXADVideoListener import com.ym.library.listener.ZXADVideoListener
import com.ym.library.module.NewsEntity import com.ym.library.module.NewsEntity
import com.ym.library.net.AdUpload import com.ym.library.net.AdUpload
import com.ym.library.utils.EventUtils
import com.ym.library.utils.EventUtils.onEventClick
import com.ym.library.utils.EventUtils.onEventShow
import com.ym.library.utils.EventUtils.onEventUM
import com.ym.library.utils.SettingPreference import com.ym.library.utils.SettingPreference
object SMADUtils { object SMADUtils {
private val TAG = "AdManager"
//开屏
fun loadSplashAd(
newsEntity: NewsEntity, activity: Activity, container: ViewGroup,
zxadListener: ZXADSplashListener, skipview: TextView?,
zxadCallback: ZXADCallback
) {
val splashAdRequest = WindSplashAdRequest(newsEntity?.codeId, "", null)
/**
* 广告结束,广告内容是否自动隐藏。
* 若开屏和应用共用Activity,建议false。
* 开屏是单独Activity ,建议true。
*/
splashAdRequest.isDisableAutoHideAd = true
/**
* 广告允许最大等待返回时间
*/
splashAdRequest.fetchDelay = 3
/**
* 全屏开屏展示
*/
var mWindSplashAD =
WindSplashAD(activity, container, splashAdRequest, object : WindSplashADListener {
override fun onSplashAdSuccessPresentScreen() {
Log.d(TAG, "Sigmob 开屏 onSplashAdSuccessPresentScreen")
EventUtils.onEventShow(newsEntity)
onEventUM("ad_splash_show", "Sigmob 开屏广告")
zxadListener.onAdShow(newsEntity)
zxadCallback.onAdSuccess()
}
override fun onSplashAdClicked() {
Log.d(TAG, "Sigmob 开屏 onSplashAdClicked")
zxadListener.onAdClicked(newsEntity)
EventUtils.onEventClick(newsEntity)
onEventUM("ad_splash_click", "Sigmob 开屏广告")
zxadListener.onAdClicked(newsEntity)
}
override fun onSplashClosed() {
Log.d(TAG, "Sigmob 开屏 onSplashClosed")
zxadListener.onAdSkip()
}
override fun onSplashAdFailToPresent(p0: WindAdError?, p1: String?) {
Log.d(
TAG,
"Sigmob 开屏 onSplashAdFailToPresent:errorCode:" + p0?.errorCode + " --- message:" + p1
)
zxadListener.onFailResult(p1 ?: "")
zxadCallback.onAdFail()
}
})
}
//激励视频 //激励视频
fun loadRewardVideoAd( fun loadRewardVideoAd(
activity: Activity, activity: Activity,
entity: NewsEntity?, entity: NewsEntity,
listener: ZXADVideoListener?, listener: ZXADVideoListener?,
callback: ZXADCallback? callback: ZXADCallback?
) { ) {
val startTime = System.currentTimeMillis()
//主动READ_PHONE_STATE,WRITE_EXTERNAL_STORAGE,ACCESS_FINE_LOCATION 权限授权请求 //主动READ_PHONE_STATE,WRITE_EXTERNAL_STORAGE,ACCESS_FINE_LOCATION 权限授权请求
WindAds.requestPermission(activity); WindAds.requestPermission(activity);
val windRewardedVideoAd = WindRewardedVideoAd.sharedInstance() val windRewardedVideoAd = WindRewardedVideoAd.sharedInstance()
//placementId 必填,USER_ID,OPTIONS可不填, //placementId 必填,USER_ID,OPTIONS可不填, "e859a9a8882"
val request = WindRewardAdRequest(entity.codeId, SettingPreference.getUid() ?: "", null)
//placementId 必填,USER_ID,OPTIONS可不填,
val request = WindRewardAdRequest("e859a9a8882",SettingPreference.getUid(),null)
windRewardedVideoAd.loadAd(request) windRewardedVideoAd.loadAd(request)
windRewardedVideoAd.setWindRewardedVideoAdListener(object :WindRewardedVideoAdListener{ windRewardedVideoAd.setWindRewardedVideoAdListener(object : WindRewardedVideoAdListener {
override fun onVideoAdPlayError(p0: WindAdError?, p1: String?) { override fun onVideoAdPlayError(p0: WindAdError?, p1: String?) {
listener?.onVideoError() listener?.onVideoError()
callback?.onAdFail() callback?.onAdFail()
Log.d(TAG, "Sigmob 激励 onVideoAdPlayError" + p0?.message)
} }
override fun onVideoAdPreLoadFail(p0: String?) { override fun onVideoAdPreLoadFail(p0: String?) {
listener?.onVideoError() listener?.onVideoError()
callback?.onAdFail() callback?.onAdFail()
Log.d(TAG, "Sigmob 激励 onVideoAdPreLoadFail" + p0)
} }
override fun onVideoAdPlayStart(p0: String?) { override fun onVideoAdPlayStart(p0: String?) {
callback?.onAdSuccess()
listener?.onAdShow()
onEventShow(entity)
onEventUM("ad_reward_video_show", "Sigmob 激励视频")
Log.d(TAG, "Sigmob 激励 onVideoAdPlayStart")
} }
override fun onVideoAdClosed(p0: WindRewardInfo?, p1: String?) { override fun onVideoAdClosed(p0: WindRewardInfo?, p1: String?) {
Log.d(TAG, "Sigmob 激励 onVideoAdClosed")
listener?.onAdClose() listener?.onAdClose()
} }
override fun onVideoAdPlayEnd(p0: String?) { override fun onVideoAdPlayEnd(p0: String?) {
} }
override fun onVideoAdLoadSuccess(p0: String?) { override fun onVideoAdLoadSuccess(p0: String?) {
listener?.onAdShow() Log.d(TAG, "Sigmob 激励 onVideoAdLoadSuccess")
// AdUpload.onAdImpression(entity)
} }
override fun onVideoAdPreLoadSuccess(p0: String?) { override fun onVideoAdPreLoadSuccess(p0: String?) {
...@@ -69,7 +149,12 @@ object SMADUtils { ...@@ -69,7 +149,12 @@ object SMADUtils {
override fun onVideoAdClicked(p0: String?) { override fun onVideoAdClicked(p0: String?) {
listener?.onVideoComplete() listener?.onVideoComplete()
// AdUpload.onAdClick(entity) AdUpload.onAdClick(entity)
onEventClick(entity)
onEventUM("ad_reward_video_click", "Sigmob 激励视频")
Log.d(TAG, "Sigmob 激励 onVideoAdClicked")
} }
override fun onVideoAdLoadError(p0: WindAdError?, p1: String?) { override fun onVideoAdLoadError(p0: WindAdError?, p1: String?) {
...@@ -79,16 +164,30 @@ object SMADUtils { ...@@ -79,16 +164,30 @@ object SMADUtils {
}) })
val handler: Handler = object : Handler() {
try { override fun handleMessage(msg: Message) {
//检查广告是否准备完毕 super.handleMessage(msg)
Log.d(
TAG, "Sigmob 激励视频耗时" +
(System.currentTimeMillis() - startTime).toString() + ""
)
if (System.currentTimeMillis() - startTime > 6000) {
listener?.onVideoError()
removeCallbacksAndMessages(null)
return
}
if (windRewardedVideoAd.isReady(request.placementId)) { if (windRewardedVideoAd.isReady(request.placementId)) {
//广告播放 //广告播放
Log.d(TAG, "Sigmob 广告播放")
windRewardedVideoAd.show(activity, request) windRewardedVideoAd.show(activity, request)
removeCallbacksAndMessages(null)
} else {
// Toast.makeText(activity, "成功加载广告后再进行广告展示!", Toast.LENGTH_LONG).show()
sendEmptyMessageDelayed(1, 20)
} }
} catch (e: java.lang.IllegalArgumentException) {
e.printStackTrace()
} }
}
handler.sendEmptyMessageDelayed(1, 20)
} }
...@@ -97,7 +196,7 @@ object SMADUtils { ...@@ -97,7 +196,7 @@ object SMADUtils {
entity: NewsEntity?, entity: NewsEntity?,
listener: ZXADVideoListener?, listener: ZXADVideoListener?,
callback: ZXADCallback? callback: ZXADCallback?
){ ) {
// val windFullScreenVideoAd = WindFullScreenVideoAd.sharedInstance() // val windFullScreenVideoAd = WindFullScreenVideoAd.sharedInstance()
...@@ -111,10 +210,12 @@ object SMADUtils { ...@@ -111,10 +210,12 @@ object SMADUtils {
val request = WindFullScreenAdRequest( val request = WindFullScreenAdRequest(
"e8599e387e8", "e8599e387e8",
SettingPreference.getUid(), SettingPreference.getUid(),
null) null
windFullScreenVideoAd.loadAd( request) )
windFullScreenVideoAd.loadAd(request)
windFullScreenVideoAd.setWindFullScreenVideoAdListener(object : WindFullScreenVideoAdListener { windFullScreenVideoAd.setWindFullScreenVideoAdListener(object :
WindFullScreenVideoAdListener {
override fun onFullScreenVideoAdPlayError(p0: WindAdError?, p1: String?) { override fun onFullScreenVideoAdPlayError(p0: WindAdError?, p1: String?) {
} }
......
...@@ -328,7 +328,7 @@ object CenterDialog : BaseDialog() { ...@@ -328,7 +328,7 @@ object CenterDialog : BaseDialog() {
* adType: 广告的类型 * adType: 广告的类型
*/ */
fun showgetWaterDrop( fun showgetWaterDrop(
context: Context?, context: Activity?,
type: Int, type: Int,
rewardCount: Int, rewardCount: Int,
listener: DialogInterface.OnCancelListener, listener: DialogInterface.OnCancelListener,
......
...@@ -4,6 +4,7 @@ package com.ym.library.utils ...@@ -4,6 +4,7 @@ package com.ym.library.utils
import android.util.Log import android.util.Log
import com.umeng.analytics.MobclickAgent import com.umeng.analytics.MobclickAgent
import com.ym.library.AppliContext import com.ym.library.AppliContext
import com.ym.library.module.NewsEntity
import com.ym.library.net.EventApiClient import com.ym.library.net.EventApiClient
import io.reactivex.Observer import io.reactivex.Observer
import io.reactivex.disposables.Disposable import io.reactivex.disposables.Disposable
...@@ -73,6 +74,20 @@ object EventUtils { ...@@ -73,6 +74,20 @@ object EventUtils {
apiClient(jsonObj) apiClient(jsonObj)
MobclickAgent.onEvent(AppliContext.get(), action, value) MobclickAgent.onEvent(AppliContext.get(), action, value)
} }
fun onEventShow(entity: NewsEntity) {
if (entity?.imp_tracking != null && entity?.imp_tracking.size >0) {
apiClient(entity?.imp_tracking[0])
}
}
fun onEventClick(entity: NewsEntity) {
if (entity?.clk_tracking != null && entity?.clk_tracking.size >0) {
apiClient(entity?.clk_tracking[0])
}
}
fun onEventUM(action: String, value: String) { fun onEventUM(action: String, value: String) {
MobclickAgent.onEvent(AppliContext.get(), action, value) MobclickAgent.onEvent(AppliContext.get(), action, value)
} }
......
...@@ -31,9 +31,11 @@ public class WxImplUtils implements UMAuthListener { ...@@ -31,9 +31,11 @@ public class WxImplUtils implements UMAuthListener {
private IWxLoginCallback mCallback; private IWxLoginCallback mCallback;
private Context mContext = AppliContext.get(); private Context mContext = AppliContext.get();
private static final String TAG = "WxImplUtils"; private static final String TAG = "WxImplUtils";
private Activity activity;
public void init(IWxLoginCallback mCallback, Activity activity) { public void init(IWxLoginCallback mCallback, Activity activity) {
this.mCallback = mCallback; this.mCallback = mCallback;
this.activity = activity;
mShareAPI = UMShareAPI.get(activity); mShareAPI = UMShareAPI.get(activity);
mLoading = LoadingDialog.getLoadingDialog(activity, mContext.getString(R.string.wait_ing), true, true); mLoading = LoadingDialog.getLoadingDialog(activity, mContext.getString(R.string.wait_ing), true, true);
mLoading.dismiss(); mLoading.dismiss();
...@@ -71,7 +73,7 @@ public class WxImplUtils implements UMAuthListener { ...@@ -71,7 +73,7 @@ public class WxImplUtils implements UMAuthListener {
Log.i(TAG, "onComplete: "); Log.i(TAG, "onComplete: ");
dismissDialog(); dismissDialog();
ApiClient.INSTANCE.getUserApi().bindWx(data.get("openid"),data.get("accessToken")). ApiClient.INSTANCE.getUserApi().bindWx(data.get("openid"), data.get("accessToken")).
compose(RxSchedulers.observableIO2Main(mContext)) compose(RxSchedulers.observableIO2Main(mContext))
.subscribe(new BaseObserver<WxBindEntity>() { .subscribe(new BaseObserver<WxBindEntity>() {
@Override @Override
...@@ -81,7 +83,7 @@ public class WxImplUtils implements UMAuthListener { ...@@ -81,7 +83,7 @@ public class WxImplUtils implements UMAuthListener {
SettingPreference.setToken(result.getFlushToken()); SettingPreference.setToken(result.getFlushToken());
UserInfoEntity user = SettingPreference.getUserInfoData(); UserInfoEntity user = SettingPreference.getUserInfoData();
if (user!=null){ if (user != null) {
user.setBind(true); user.setBind(true);
user.setHeadimgurl(data.get("iconurl")); user.setHeadimgurl(data.get("iconurl"));
user.setNickname(data.get("screen_name")); user.setNickname(data.get("screen_name"));
...@@ -89,7 +91,7 @@ public class WxImplUtils implements UMAuthListener { ...@@ -89,7 +91,7 @@ public class WxImplUtils implements UMAuthListener {
SettingPreference.saveUserInfo(user); SettingPreference.saveUserInfo(user);
SettingPreference.saveUserInfoName(data.get("screen_name")); SettingPreference.saveUserInfoName(data.get("screen_name"));
mCallback.onWxSuccess(data.get("access_token"), data.get("openid")); mCallback.onWxSuccess(data.get("access_token"), data.get("openid"));
}else { } else {
mCallback.onWxFail("绑定失败"); mCallback.onWxFail("绑定失败");
} }
...@@ -135,7 +137,7 @@ public class WxImplUtils implements UMAuthListener { ...@@ -135,7 +137,7 @@ public class WxImplUtils implements UMAuthListener {
} }
public void dismissDialog() { public void dismissDialog() {
if (mLoading != null) { if (mLoading != null && activity != null && !activity.isFinishing()) {
mLoading.dismiss(); mLoading.dismiss();
} }
} }
...@@ -153,6 +155,7 @@ public class WxImplUtils implements UMAuthListener { ...@@ -153,6 +155,7 @@ public class WxImplUtils implements UMAuthListener {
public interface IWxLoginCallback { public interface IWxLoginCallback {
void onWxSuccess(String token, String openid); void onWxSuccess(String token, String openid);
void onWxFail(String mes); void onWxFail(String mes);
} }
......
...@@ -33,7 +33,7 @@ object WNManager { ...@@ -33,7 +33,7 @@ object WNManager {
override fun onError(code: Int, message: String) { override fun onError(code: Int, message: String) {
listener.onError() listener.onError()
callback.onAdFail() callback.onAdFail()
Log.i("WNManager","code:${code} -- message:${message}") Log.i("WNManager", "code:${code} -- message:${message}")
} }
override fun onLoad(ad: WNRewardVideoAd) { override fun onLoad(ad: WNRewardVideoAd) {
...@@ -42,15 +42,15 @@ object WNManager { ...@@ -42,15 +42,15 @@ object WNManager {
Log.d("WNManager", "激励视频展示") Log.d("WNManager", "激励视频展示")
listener.onAdShow() listener.onAdShow()
callback.onAdSuccess() callback.onAdSuccess()
EventUtils.apiClient(entity?.imp_tracking[0]) EventUtils.onEventShow(entity)
EventUtils.onEventUM("ad_reward_video_show","优量宝激励视频") EventUtils.onEventUM("ad_reward_video_show", "优量宝激励视频")
} }
override fun onAdClick() { override fun onAdClick() {
Log.d("WNManager", "激励视频点击") Log.d("WNManager", "激励视频点击")
listener.onAdVideoBarClick(entity) listener.onAdVideoBarClick(entity)
EventUtils.apiClient(entity?.clk_tracking[0]) EventUtils.onEventClick(entity)
EventUtils.onEventUM("ad_reward_video_click","优量宝激励视频") EventUtils.onEventUM("ad_reward_video_click", "优量宝激励视频")
} }
override fun onAdClose() { override fun onAdClose() {
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="false"
tools:ignore="MissingDefaultResource"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="30dp">
<ImageView
android:id="@+id/id_iv_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/vlion_back"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"/>
<TextView
android:id="@+id/id_tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textStyle="bold"
android:layout_centerInParent="true"/>
</RelativeLayout>
<FrameLayout
android:id="@+id/id_activity_fragment_content"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
\ No newline at end of file
...@@ -5,8 +5,10 @@ import android.content.ClipboardManager ...@@ -5,8 +5,10 @@ import android.content.ClipboardManager
import android.content.Context import android.content.Context
import com.bytedance.sdk.openadsdk.TTNativeExpressAd import com.bytedance.sdk.openadsdk.TTNativeExpressAd
import com.umeng.analytics.MobclickAgent import com.umeng.analytics.MobclickAgent
import com.ym.admodule.rs.RSADUtils
import com.ym.library.Constant import com.ym.library.Constant
import com.ym.library.config.AdManager import com.ym.library.config.AdManager
import com.ym.library.config.ZXADCallback
import com.ym.library.config.ZXADSizeConfig import com.ym.library.config.ZXADSizeConfig
import com.ym.library.down.UpdateVersionManager import com.ym.library.down.UpdateVersionManager
import com.ym.library.listener.ZXADExpressListener import com.ym.library.listener.ZXADExpressListener
...@@ -27,7 +29,7 @@ class SettingActivity : BaseActivity() { ...@@ -27,7 +29,7 @@ class SettingActivity : BaseActivity() {
} }
override fun init() { override fun init() {
if(SettingPreference.getUserInfoData()!=null){ if (SettingPreference.getUserInfoData() != null) {
id_tv_id.text = "ID: ${SettingPreference.getUserInfoData().uid}" id_tv_id.text = "ID: ${SettingPreference.getUserInfoData().uid}"
} }
if (Constant.qq != 0) { if (Constant.qq != 0) {
...@@ -43,22 +45,21 @@ class SettingActivity : BaseActivity() { ...@@ -43,22 +45,21 @@ class SettingActivity : BaseActivity() {
// tv_user_toolbar_title.text = "设置" // tv_user_toolbar_title.text = "设置"
//用户协议 //用户协议
tv_setting_user_agreement.setOnClickListener { tv_setting_user_agreement.setOnClickListener {
JumpUtils.h5Jump("用户协议", Constant.Param.USER, true,this) JumpUtils.h5Jump("用户协议", Constant.Param.USER, true, this)
} }
//隐私条款 //隐私条款
tv_setting_privacy_policy.setOnClickListener { tv_setting_privacy_policy.setOnClickListener {
JumpUtils.h5Jump("隐私条款", Constant.Param.PRIVACY, true,this) JumpUtils.h5Jump("隐私条款", Constant.Param.PRIVACY, true, this)
} }
//关于我们 //关于我们
tv_setting_about_us.setOnClickListener { tv_setting_about_us.setOnClickListener {
JumpUtils.h5Jump("关于我们", Constant.Param.ABOUTUS, true,this) JumpUtils.h5Jump("关于我们", Constant.Param.ABOUTUS, true, this)
} }
//版本升级 //版本升级
id_setting_update_version.setOnClickListener { id_setting_update_version.setOnClickListener {
val updateVersionManager = this?.let { it1 -> UpdateVersionManager(it1) } val updateVersionManager = this?.let { it1 -> UpdateVersionManager(it1) }
updateVersionManager?.checkUpdate(true) updateVersionManager?.checkUpdate(true)
} }
AdManager.loadFeedAd( AdManager.loadFeedAd(
ADConfig.AD_IMG_FADE, ADConfig.AD_IMG_FADE,
this, this,
...@@ -120,7 +121,7 @@ class SettingActivity : BaseActivity() { ...@@ -120,7 +121,7 @@ class SettingActivity : BaseActivity() {
this?.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager this?.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
// 创建普通字符型ClipData // 创建普通字符型ClipData
var idDesc = "123456" var idDesc = "123456"
if (SettingPreference.getUserInfoData()!=null){ if (SettingPreference.getUserInfoData() != null) {
idDesc = SettingPreference.getUserInfoData()?.uid.toString() idDesc = SettingPreference.getUserInfoData()?.uid.toString()
} }
val mClipData: ClipData = val mClipData: ClipData =
......
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