Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
L
LuckyFarm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王雪伟
LuckyFarm
Commits
b5f61ae7
Commit
b5f61ae7
authored
Oct 30, 2020
by
wangxuewei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[提交人]:王雪伟
[提交简述] :幸福农场 [实现方案] :luckyfarm_1.0.5 加入新的广告拉取上报
parent
1b861e2e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
775 additions
and
109 deletions
+775
-109
GameActivity.kt
app/src/main/java/com/ym/game/GameActivity.kt
+26
-18
BaseApplication.kt
app/src/main/java/com/ym/game/application/BaseApplication.kt
+13
-12
build.gradle
library/build.gradle
+1
-1
JavaInterface.kt
...ry/src/main/java/com/ym/library/activity/JavaInterface.kt
+3
-1
XiaoManActivity.kt
.../src/main/java/com/ym/library/activity/XiaoManActivity.kt
+1
-1
BDADUtils.kt
library/src/main/java/com/ym/library/bd/BDADUtils.kt
+14
-4
AdManager.kt
library/src/main/java/com/ym/library/config/AdManager.kt
+215
-31
TTADUtils.kt
library/src/main/java/com/ym/library/csj/TTADUtils.kt
+19
-4
GDTAdUtils.kt
library/src/main/java/com/ym/library/gdt/GDTAdUtils.kt
+8
-1
KSADUtils.java
library/src/main/java/com/ym/library/ks/KSADUtils.java
+122
-4
AdIdConfig.kt
library/src/main/java/com/ym/library/module/AdIdConfig.kt
+12
-0
NewsEntity.kt
library/src/main/java/com/ym/library/module/NewsEntity.kt
+3
-0
ZXAdApi.kt
library/src/main/java/com/ym/library/net/ZXAdApi.kt
+6
-0
RSADUtils.kt
library/src/main/java/com/ym/library/rs/RSADUtils.kt
+32
-25
SHADUtils.kt
library/src/main/java/com/ym/library/sh/SHADUtils.kt
+4
-0
SMADUtils.kt
library/src/main/java/com/ym/library/sm/SMADUtils.kt
+13
-3
CenterDialog.kt
library/src/main/java/com/ym/library/utils/CenterDialog.kt
+36
-3
EventUtils.kt
library/src/main/java/com/ym/library/utils/EventUtils.kt
+23
-1
WNManager.kt
library/src/main/java/com/ym/library/ylb/WNManager.kt
+2
-0
bg_dialog_lib_get_money.png
.../src/main/res/drawable-xxhdpi/bg_dialog_lib_get_money.png
+0
-0
icon_dialog_lib_get_money_cancel.png
.../res/drawable-xxhdpi/icon_dialog_lib_get_money_cancel.png
+0
-0
icon_lib_get_money_title_acquire.png
.../res/drawable-xxhdpi/icon_lib_get_money_title_acquire.png
+0
-0
dialog_lib_get_money.xml
library/src/main/res/layout/dialog_lib_get_money.xml
+53
-0
native_item_group_image.xml
library/src/main/res/layout/native_item_group_image.xml
+90
-0
native_item_normal.xml
library/src/main/res/layout/native_item_normal.xml
+16
-0
native_item_video.xml
library/src/main/res/layout/native_item_video.xml
+63
-0
No files found.
app/src/main/java/com/ym/game/GameActivity.kt
View file @
b5f61ae7
...
@@ -25,6 +25,7 @@ import com.ym.library.config.ZXADRewardVideo
...
@@ -25,6 +25,7 @@ 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
import
com.ym.library.module.NewsEntity
import
com.ym.library.module.NewsEntity
import
com.ym.library.module.ReportEntity
import
com.ym.library.net.ApiClient
import
com.ym.library.net.ApiClient
import
com.ym.library.net.BaseObserver
import
com.ym.library.net.BaseObserver
import
com.ym.library.net.RxSchedulers
import
com.ym.library.net.RxSchedulers
...
@@ -82,7 +83,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
...
@@ -82,7 +83,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
override
fun
onDestroy
()
{
override
fun
onDestroy
()
{
super
.
onDestroy
()
super
.
onDestroy
()
if
(
mRefreshLoginObservable
!=
null
)
{
if
(
mRefreshLoginObservable
!=
null
)
{
RxBus
.
get
().
unregister
(
"refresh_login"
,
mRefreshLoginObservable
!!
)
//页面销毁的时候要执行 反注册
RxBus
.
get
().
unregister
(
"refresh_login"
,
mRefreshLoginObservable
!!
)
//页面销毁的时候要执行 反注册
}
}
...
@@ -95,13 +96,20 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
...
@@ -95,13 +96,20 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
override
fun
onResume
()
{
override
fun
onResume
()
{
super
.
onResume
()
super
.
onResume
()
EventUtils
.
onEvent
(
"page_status"
,
Utils
.
obj2Str
(
ReportEntity
(
Constant
.
ReportSessionId
,
"GameActivity"
,
"onResume"
))
)
MobclickAgent
.
onResume
(
this
)
MobclickAgent
.
onResume
(
this
)
Log
.
d
(
"wxw"
,
"onResume"
)
// callUnity("Form_land", "getLandList", "")
// callUnity("Form_land", "getLandList", "")
}
}
override
fun
onPause
()
{
override
fun
onPause
()
{
super
.
onPause
()
super
.
onPause
()
EventUtils
.
onEvent
(
"page_status"
,
Utils
.
obj2Str
(
ReportEntity
(
Constant
.
ReportSessionId
,
"GameActivity"
,
"onPause"
))
)
MobclickAgent
.
onPause
(
this
)
MobclickAgent
.
onPause
(
this
)
}
}
...
@@ -137,8 +145,8 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
...
@@ -137,8 +145,8 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
/**
/**
* 小满入口
* 小满入口
*/
*/
fun
gotoXiaoManActivity
(){
fun
gotoXiaoManActivity
()
{
EventUtils
.
onEvent
(
"XiaoManClick"
,
"小满入口点击"
);
EventUtils
.
onEvent
(
"XiaoManClick"
,
"小满入口点击"
);
JumpUtils
.
jumpXiaomanActivity
(
"天天领现金"
)
JumpUtils
.
jumpXiaomanActivity
(
"天天领现金"
)
}
}
...
@@ -146,11 +154,11 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
...
@@ -146,11 +154,11 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
* 跳转提现页
* 跳转提现页
*/
*/
fun
gotoWithdrawPage
(
type
:
Int
)
{
fun
gotoWithdrawPage
(
type
:
Int
)
{
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"
,
"提现入口点击"
);
EventUtils
.
onEvent
(
"WithDrawClick"
,
"提现入口点击"
);
JumpUtils
.
h5Jump
(
"跳转提现页"
,
Constant
.
Param
.
WithDraw
,
false
,
act
)
JumpUtils
.
h5Jump
(
"跳转提现页"
,
Constant
.
Param
.
WithDraw
,
false
,
act
)
}
}
}
}
...
@@ -159,32 +167,31 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
...
@@ -159,32 +167,31 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
*/
*/
fun
ranklistClick
()
{
fun
ranklistClick
()
{
//JumpUtils.h5Jump("上榜赚钱", Constant.Param.RankList)
//JumpUtils.h5Jump("上榜赚钱", Constant.Param.RankList)
EventUtils
.
onEvent
(
"PaiHangBangClick"
,
"上榜入口点击"
);
EventUtils
.
onEvent
(
"PaiHangBangClick"
,
"上榜入口点击"
);
JumpUtils
.
h5Jump
(
"排行榜"
,
Constant
.
Param
.
RankList
,
false
,
act
)
JumpUtils
.
h5Jump
(
"排行榜"
,
Constant
.
Param
.
RankList
,
false
,
act
)
}
}
/**
/**
* 每日福利
* 每日福利
*/
*/
fun
oneveryDayWelfareClick
()
{
fun
oneveryDayWelfareClick
()
{
EventUtils
.
onEvent
(
"MeiRiFuLiClick"
,
"每日福利入口点击"
);
EventUtils
.
onEvent
(
"MeiRiFuLiClick"
,
"每日福利入口点击"
);
JumpUtils
.
h5Jump
(
"每日福利"
,
Constant
.
Param
.
WelfareCenter
,
false
,
act
)
JumpUtils
.
h5Jump
(
"每日福利"
,
Constant
.
Param
.
WelfareCenter
,
false
,
act
)
}
}
/**
/**
* 打卡提现
* 打卡提现
*/
*/
fun
clockInMakeMoney
()
{
fun
clockInMakeMoney
()
{
EventUtils
.
onEvent
(
"DaKaTiXianClick"
,
"打卡提现入口点击"
);
EventUtils
.
onEvent
(
"DaKaTiXianClick"
,
"打卡提现入口点击"
);
JumpUtils
.
h5Jump
(
"打卡提现"
,
Constant
.
Param
.
PunchRecord
,
false
,
act
)
JumpUtils
.
h5Jump
(
"打卡提现"
,
Constant
.
Param
.
PunchRecord
,
false
,
act
)
}
}
/**
/**
* 幸运转盘
* 幸运转盘
*/
*/
fun
luckyTurntable
()
{
fun
luckyTurntable
()
{
EventUtils
.
onEvent
(
"ZhuanPanClick"
,
"转盘入口点击"
);
EventUtils
.
onEvent
(
"ZhuanPanClick"
,
"转盘入口点击"
);
this
.
runOnUiThread
(
object
:
Runnable
{
this
.
runOnUiThread
(
object
:
Runnable
{
override
fun
run
()
{
override
fun
run
()
{
if
(
Utils
.
isFastClick
())
{
if
(
Utils
.
isFastClick
())
{
...
@@ -199,7 +206,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
...
@@ -199,7 +206,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
* 领金币
* 领金币
*/
*/
fun
getCoin
()
{
fun
getCoin
()
{
EventUtils
.
onEvent
(
"RenWuClick"
,
"领金币任务入口点击"
);
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
)
...
@@ -856,6 +863,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
...
@@ -856,6 +863,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
//关闭view
//关闭view
callUnity
(
"TitleView"
,
"getHomeInfo"
,
""
)
callUnity
(
"TitleView"
,
"getHomeInfo"
,
""
)
}
}
fun
getUserInfo
()
{
fun
getUserInfo
()
{
EventUtils
.
onEvent
(
"SplashPresenter_getUserInfo"
)
EventUtils
.
onEvent
(
"SplashPresenter_getUserInfo"
)
ApiClient
.
userApi
.
getUserInfo
().
compose
(
RxSchedulers
.
observableIO2Main
())
ApiClient
.
userApi
.
getUserInfo
().
compose
(
RxSchedulers
.
observableIO2Main
())
...
...
app/src/main/java/com/ym/game/application/BaseApplication.kt
View file @
b5f61ae7
...
@@ -32,20 +32,21 @@ class BaseApplication : MultiDexApplication() {
...
@@ -32,20 +32,21 @@ class BaseApplication : MultiDexApplication() {
//第一步初始化 application
//第一步初始化 application
AppliContext
.
init
(
this
)
AppliContext
.
init
(
this
)
// Config.init(this)
// Config.init(this)
NetConfig
.
setBase_Url
(
NetConfig
.
Environment
.
PRODUCT
)
// TODO 上线之后提成成 NetConfig.Environment.PRODUCT
NetConfig
.
setBase_Url
(
NetConfig
.
Environment
.
DEV
)
// TODO 上线之后提成成 NetConfig.Environment.PRODUCT
Constant
.
appLs
=
"a03d5320d905cf3b"
//applsq
Constant
.
appLs
=
"a03d5320d905cf3b"
//applsq
AdManager
.
init
(
//替换id
AdManager
.
init
(
this
)
this
,
ZXADConfig
// AdManager.init(//替换id
.
csjId
(
"5113760"
)
// this, ZXADConfig
.
gdtId
(
"1111127526"
)
// .csjId("5113760")
// .bdId("ba584026")
// .gdtId("1111127526")
.
signMob
(
"6066"
,
"f81de7f854836db4"
)
//// .bdId("ba584026")
.
ksId
(
"533500009"
)
// .signMob("6066", "f81de7f854836db4")
.
ylbId
(
"10000160"
)
// .ksId("533500009")
.
rsId
(
"31140"
)
// .ylbId("10000160")
.
Build
()
// .rsId("31140")
);
// .Build()
// );
//TODO Android 9及以上必须设置 (聚合快手时必须添加)
//TODO Android 9及以上必须设置 (聚合快手时必须添加)
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
// val processName = Application.getProcessName()
// val processName = Application.getProcessName()
...
...
library/build.gradle
View file @
b5f61ae7
...
@@ -92,7 +92,7 @@ dependencies {
...
@@ -92,7 +92,7 @@ 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
'
)
{
api
(
'cn.vlion.inland:inlandmix:9.8.
3
'
)
{
exclude
group:
'cn.vlion.inland'
,
module:
'inlandb'
exclude
group:
'cn.vlion.inland'
,
module:
'inlandb'
exclude
group:
'cn.vlion.inland'
,
module:
'inlandg'
exclude
group:
'cn.vlion.inland'
,
module:
'inlandg'
exclude
group:
'cn.vlion.inland'
,
module:
'inlands'
exclude
group:
'cn.vlion.inland'
,
module:
'inlands'
...
...
library/src/main/java/com/ym/library/activity/JavaInterface.kt
View file @
b5f61ae7
...
@@ -942,7 +942,9 @@ abstract class JavaInterface {
...
@@ -942,7 +942,9 @@ abstract class JavaInterface {
@JavascriptInterface
@JavascriptInterface
fun
showWithdrawSucces
(
cashStr
:
String
)
{
fun
showWithdrawSucces
(
cashStr
:
String
)
{
mWebView
.
context
.
runOnUiThread
{
mWebView
.
context
.
runOnUiThread
{
// CenterDialog.showGuideGetMoney(act,cashStr,mWebView)
if
(
act
!=
null
){
CenterDialog
.
showGuideGetMoney
(
act
,
cashStr
,
mWebView
)
}
}
}
}
}
...
...
library/src/main/java/com/ym/library/activity/XiaoManActivity.kt
View file @
b5f61ae7
...
@@ -73,7 +73,7 @@ class XiaoManActivity : BaseActivity() {
...
@@ -73,7 +73,7 @@ class XiaoManActivity : BaseActivity() {
.
titleBarTheme
(
TTAdConstant
.
TITLE_BAR_THEME_DARK
)
.
titleBarTheme
(
TTAdConstant
.
TITLE_BAR_THEME_DARK
)
.
allowShowNotify
(
true
)
//是否允许sdk展示通知栏提示
.
allowShowNotify
(
true
)
//是否允许sdk展示通知栏提示
.
allowShowPageWhenScreenLock
(
true
)
//是否在锁屏场景支持展示广告落地页
.
allowShowPageWhenScreenLock
(
true
)
//是否在锁屏场景支持展示广告落地页
.
debug
(
tru
e
)
//测试阶段打开,可以通过日志排查问题,上线时去除该调用
.
debug
(
fals
e
)
//测试阶段打开,可以通过日志排查问题,上线时去除该调用
.
directDownloadNetworkType
(
.
directDownloadNetworkType
(
TTAdConstant
.
NETWORK_STATE_WIFI
,
TTAdConstant
.
NETWORK_STATE_WIFI
,
TTAdConstant
.
NETWORK_STATE_3G
TTAdConstant
.
NETWORK_STATE_3G
...
...
library/src/main/java/com/ym/library/bd/BDADUtils.kt
View file @
b5f61ae7
...
@@ -46,6 +46,7 @@ object BDADUtils {
...
@@ -46,6 +46,7 @@ object BDADUtils {
}
}
override
fun
onAdFailed
(
arg0
:
String
)
{
override
fun
onAdFailed
(
arg0
:
String
)
{
EventUtils
.
onEventPullFail
(
newsEntity
)
Log
.
d
(
TAG
,
"百度 开屏 onAdFailed"
+
arg0
)
Log
.
d
(
TAG
,
"百度 开屏 onAdFailed"
+
arg0
)
zxadListener
?.
onAdSkip
()
zxadListener
?.
onAdSkip
()
...
@@ -91,6 +92,7 @@ object BDADUtils {
...
@@ -91,6 +92,7 @@ object BDADUtils {
var
mInterAd
=
InterstitialAd
(
activity
,
newsEntity
.
codeId
)
var
mInterAd
=
InterstitialAd
(
activity
,
newsEntity
.
codeId
)
mInterAd
.
setListener
(
object
:
InterstitialAdListener
{
mInterAd
.
setListener
(
object
:
InterstitialAdListener
{
override
fun
onAdFailed
(
p0
:
String
?)
{
override
fun
onAdFailed
(
p0
:
String
?)
{
EventUtils
.
onEventShowFail
(
newsEntity
)
callback
.
onAdFail
()
callback
.
onAdFail
()
}
}
...
@@ -132,6 +134,7 @@ object BDADUtils {
...
@@ -132,6 +134,7 @@ object BDADUtils {
activity
,
activity
,
newsEntity
.
codeId
,
object
:
RewardVideoAd
.
RewardVideoAdListener
{
newsEntity
.
codeId
,
object
:
RewardVideoAd
.
RewardVideoAdListener
{
override
fun
onAdFailed
(
p0
:
String
?)
{
override
fun
onAdFailed
(
p0
:
String
?)
{
EventUtils
.
onEventPullFail
(
newsEntity
)
callback
.
onAdFail
()
callback
.
onAdFail
()
listener
.
onError
()
listener
.
onError
()
}
}
...
@@ -163,16 +166,23 @@ object BDADUtils {
...
@@ -163,16 +166,23 @@ object BDADUtils {
},
true
)
},
true
)
mRewardVideoAd
.
load
()
mRewardVideoAd
.
load
()
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
)
super
.
handleMessage
(
msg
)
if
(
mRewardVideoAd
!=
null
)
{
mRewardVideoAd
.
show
()
if
(
System
.
currentTimeMillis
()-
startTime
<
3000
){
if
(
mRewardVideoAd
!=
null
)
{
mRewardVideoAd
.
show
()
removeCallbacksAndMessages
(
null
)
}
else
{
sendEmptyMessageDelayed
(
1
,
20
)
}
}
else
{
EventUtils
.
onEventPullFail
(
newsEntity
)
removeCallbacksAndMessages
(
null
)
removeCallbacksAndMessages
(
null
)
}
else
{
sendEmptyMessageDelayed
(
1
,
20
)
}
}
}
}
...
...
library/src/main/java/com/ym/library/config/AdManager.kt
View file @
b5f61ae7
This diff is collapsed.
Click to expand it.
library/src/main/java/com/ym/library/csj/TTADUtils.kt
View file @
b5f61ae7
...
@@ -127,18 +127,21 @@ object TTADUtils {
...
@@ -127,18 +127,21 @@ object TTADUtils {
.
build
()
.
build
()
mTTAdNative
?.
loadSplashAd
(
adSlot
,
object
:
TTAdNative
.
SplashAdListener
{
mTTAdNative
?.
loadSplashAd
(
adSlot
,
object
:
TTAdNative
.
SplashAdListener
{
override
fun
onError
(
i
:
Int
,
s
:
String
)
{
override
fun
onError
(
i
:
Int
,
s
:
String
)
{
EventUtils
.
onEventPullFail
(
data
)
zxadListener
.
onErrorResult
(
s
)
zxadListener
.
onErrorResult
(
s
)
zxadCallback
.
onAdFail
()
zxadCallback
.
onAdFail
()
Log
.
d
(
TAG
,
"穿山甲 开屏 onError s="
+
s
)
Log
.
d
(
TAG
,
"穿山甲 开屏 onError s="
+
s
)
}
}
override
fun
onTimeout
()
{
override
fun
onTimeout
()
{
EventUtils
.
onEventShowFail
(
data
)
zxadListener
.
onTimeout
()
zxadListener
.
onTimeout
()
zxadCallback
.
onAdFail
()
zxadCallback
.
onAdFail
()
Log
.
d
(
TAG
,
"穿山甲 开屏 onTimeout"
)
Log
.
d
(
TAG
,
"穿山甲 开屏 onTimeout"
)
}
}
override
fun
onSplashAdLoad
(
ad
:
TTSplashAd
)
{
override
fun
onSplashAdLoad
(
ad
:
TTSplashAd
)
{
EventUtils
.
onEventPullSuccess
(
data
)
zxadCallback
.
onAdSuccess
()
zxadCallback
.
onAdSuccess
()
zxadListener
.
onSplashAdLoad
(
ad
)
zxadListener
.
onSplashAdLoad
(
ad
)
val
view
=
ad
.
splashView
val
view
=
ad
.
splashView
...
@@ -234,14 +237,16 @@ object TTADUtils {
...
@@ -234,14 +237,16 @@ object TTADUtils {
zxadExpressListener
.
onNativeExpressAdLoad
(
p0
)
zxadExpressListener
.
onNativeExpressAdLoad
(
p0
)
if
(
p0
==
null
)
{
if
(
p0
==
null
)
{
EventUtils
.
onEventPullFail
(
newsEntity
)
callback
.
onAdFail
()
callback
.
onAdFail
()
return
return
}
}
if
(
p0
.
isEmpty
())
{
if
(
p0
.
isEmpty
())
{
EventUtils
.
onEventPullFail
(
newsEntity
)
callback
.
onAdFail
()
callback
.
onAdFail
()
return
return
}
}
EventUtils
.
onEventPullSuccess
(
newsEntity
)
val
mTTAd
=
p0
[
0
]
val
mTTAd
=
p0
[
0
]
bindAdListener
(
newsEntity
,
mTTAd
,
zxadExpressListener
,
container
,
callback
)
bindAdListener
(
newsEntity
,
mTTAd
,
zxadExpressListener
,
container
,
callback
)
startTime
=
System
.
currentTimeMillis
()
startTime
=
System
.
currentTimeMillis
()
...
@@ -250,6 +255,7 @@ object TTADUtils {
...
@@ -250,6 +255,7 @@ object TTADUtils {
}
}
override
fun
onError
(
p0
:
Int
,
p1
:
String
?)
{
override
fun
onError
(
p0
:
Int
,
p1
:
String
?)
{
EventUtils
.
onEventShowFail
(
newsEntity
)
// Toast.makeText(activity, p1, Toast.LENGTH_SHORT).show()
// Toast.makeText(activity, p1, Toast.LENGTH_SHORT).show()
zxadExpressListener
.
onError
(
p1
)
zxadExpressListener
.
onError
(
p1
)
...
@@ -297,6 +303,7 @@ object TTADUtils {
...
@@ -297,6 +303,7 @@ object TTADUtils {
msg
:
String
,
msg
:
String
,
code
:
Int
code
:
Int
)
{
)
{
EventUtils
.
onEventShowFail
(
entity
)
Log
.
e
(
TAG
,
"穿山甲 大图 render fail:"
+
(
System
.
currentTimeMillis
()
-
startTime
))
Log
.
e
(
TAG
,
"穿山甲 大图 render fail:"
+
(
System
.
currentTimeMillis
()
-
startTime
))
// TToast.show(mContext, "$msg code:$code")
// TToast.show(mContext, "$msg code:$code")
...
@@ -463,6 +470,7 @@ object TTADUtils {
...
@@ -463,6 +470,7 @@ object TTADUtils {
mTTAdNative
.
loadRewardVideoAd
(
adSlot
,
object
:
RewardVideoAdListener
{
mTTAdNative
.
loadRewardVideoAd
(
adSlot
,
object
:
RewardVideoAdListener
{
override
fun
onError
(
code
:
Int
,
message
:
String
)
{
override
fun
onError
(
code
:
Int
,
message
:
String
)
{
EventUtils
.
onEventPullFail
(
entity
)
listener
.
onError
()
listener
.
onError
()
callback
.
onAdFail
()
callback
.
onAdFail
()
}
}
...
@@ -474,6 +482,8 @@ object TTADUtils {
...
@@ -474,6 +482,8 @@ object TTADUtils {
//视频广告素材加载到,如title,视频url等,不包括视频文件
//视频广告素材加载到,如title,视频url等,不包括视频文件
override
fun
onRewardVideoAdLoad
(
ad
:
TTRewardVideoAd
)
{
override
fun
onRewardVideoAdLoad
(
ad
:
TTRewardVideoAd
)
{
EventUtils
.
onEventPullSuccess
(
entity
)
callback
.
onAdSuccess
()
callback
.
onAdSuccess
()
var
mttRewardVideoAd
=
ad
var
mttRewardVideoAd
=
ad
...
@@ -502,7 +512,7 @@ object TTADUtils {
...
@@ -502,7 +512,7 @@ object TTADUtils {
override
fun
onVideoError
()
{
override
fun
onVideoError
()
{
listener
.
onVideoError
()
listener
.
onVideoError
()
EventUtils
.
onEventShowFail
(
entity
)
}
}
override
fun
onVideoComplete
()
{
override
fun
onVideoComplete
()
{
...
@@ -620,6 +630,7 @@ object TTADUtils {
...
@@ -620,6 +630,7 @@ object TTADUtils {
//加载全屏视频
//加载全屏视频
mTTAdNative
.
loadFullScreenVideoAd
(
adSlot
,
object
:
FullScreenVideoAdListener
{
mTTAdNative
.
loadFullScreenVideoAd
(
adSlot
,
object
:
FullScreenVideoAdListener
{
override
fun
onError
(
code
:
Int
,
message
:
String
)
{
override
fun
onError
(
code
:
Int
,
message
:
String
)
{
EventUtils
.
onEventShowFail
(
entity
)
listener
.
onError
()
listener
.
onError
()
}
}
...
@@ -636,6 +647,10 @@ object TTADUtils {
...
@@ -636,6 +647,10 @@ object TTADUtils {
}
}
override
fun
onAdVideoBarClick
()
{
override
fun
onAdVideoBarClick
()
{
listener
.
onAdVideoBarClick
(
entity
)
EventUtils
.
onEventClick
(
entity
)
EventUtils
.
onEventUM
(
"ad_reward_video_click"
,
"穿山甲 激励视频广告"
)
}
}
override
fun
onAdClose
()
{
override
fun
onAdClose
()
{
...
@@ -666,8 +681,8 @@ object TTADUtils {
...
@@ -666,8 +681,8 @@ object TTADUtils {
override
fun
onDownloadActive
(
p0
:
Long
,
p1
:
Long
,
p2
:
String
?,
p3
:
String
?)
{
override
fun
onDownloadActive
(
p0
:
Long
,
p1
:
Long
,
p2
:
String
?,
p3
:
String
?)
{
// AdUpload.onAdClick(entity)
// AdUpload.onAdClick(entity)
EventUtils
.
onEventClick
(
entity
)
//
EventUtils.onEventClick(entity)
EventUtils
.
onEventUM
(
"ad_reward_video_click"
,
"穿山甲 激励视频广告"
)
//
EventUtils.onEventUM("ad_reward_video_click","穿山甲 激励视频广告")
}
}
override
fun
onDownloadFinished
(
p0
:
Long
,
p1
:
String
?,
p2
:
String
?)
{
override
fun
onDownloadFinished
(
p0
:
Long
,
p1
:
String
?,
p2
:
String
?)
{
...
...
library/src/main/java/com/ym/library/gdt/GDTAdUtils.kt
View file @
b5f61ae7
...
@@ -49,6 +49,7 @@ object GDTAdUtils {
...
@@ -49,6 +49,7 @@ object GDTAdUtils {
}
}
override
fun
onADLoaded
(
p0
:
Long
)
{
override
fun
onADLoaded
(
p0
:
Long
)
{
EventUtils
.
onEventPullSuccess
(
newsEntity
)
// AdUpload.onAdImpression(newsEntity)
// AdUpload.onAdImpression(newsEntity)
zxadCallback
.
onAdSuccess
()
zxadCallback
.
onAdSuccess
()
Log
.
d
(
TAG
,
"广点通 开屏显示"
)
Log
.
d
(
TAG
,
"广点通 开屏显示"
)
...
@@ -57,9 +58,9 @@ object GDTAdUtils {
...
@@ -57,9 +58,9 @@ object GDTAdUtils {
}
}
override
fun
onNoAD
(
p0
:
AdError
?)
{
override
fun
onNoAD
(
p0
:
AdError
?)
{
EventUtils
.
onEventPullFail
(
newsEntity
)
zxadListener
.
onAdTimeOver
()
zxadListener
.
onAdTimeOver
()
skipview
?.
visibility
=
View
.
VISIBLE
skipview
?.
visibility
=
View
.
VISIBLE
zxadCallback
.
onAdFail
()
zxadCallback
.
onAdFail
()
}
}
...
@@ -162,6 +163,7 @@ object GDTAdUtils {
...
@@ -162,6 +163,7 @@ object GDTAdUtils {
}
}
override
fun
onADLoaded
(
adList
:
MutableList
<
NativeExpressADView
>?)
{
override
fun
onADLoaded
(
adList
:
MutableList
<
NativeExpressADView
>?)
{
EventUtils
.
onEventPullSuccess
(
newsEntity
)
// 释放前一个 NativeExpressADView 的资源人、
// 释放前一个 NativeExpressADView 的资源人、
// if (nativeExpressADView != null) {
// if (nativeExpressADView != null) {
// nativeExpressADView.destroy();
// nativeExpressADView.destroy();
...
@@ -185,6 +187,7 @@ object GDTAdUtils {
...
@@ -185,6 +187,7 @@ object GDTAdUtils {
}
}
override
fun
onRenderFail
(
p0
:
NativeExpressADView
?)
{
override
fun
onRenderFail
(
p0
:
NativeExpressADView
?)
{
EventUtils
.
onEventShowFail
(
newsEntity
)
callback
.
onAdFail
()
callback
.
onAdFail
()
}
}
...
@@ -198,6 +201,7 @@ object GDTAdUtils {
...
@@ -198,6 +201,7 @@ object GDTAdUtils {
}
}
override
fun
onNoAD
(
p0
:
AdError
?)
{
override
fun
onNoAD
(
p0
:
AdError
?)
{
EventUtils
.
onEventPullFail
(
newsEntity
)
callback
.
onAdFail
()
callback
.
onAdFail
()
}
}
...
@@ -293,6 +297,7 @@ object GDTAdUtils {
...
@@ -293,6 +297,7 @@ object GDTAdUtils {
//如果这里
//如果这里
override
fun
onADLoad
()
{
override
fun
onADLoad
()
{
EventUtils
.
onEventPullSuccess
(
entity
)
adLoaded
=
true
adLoaded
=
true
listener
.
onRewardVideoAdLoad
()
listener
.
onRewardVideoAdLoad
()
}
}
...
@@ -303,6 +308,8 @@ object GDTAdUtils {
...
@@ -303,6 +308,8 @@ object GDTAdUtils {
}
}
override
fun
onError
(
p0
:
AdError
?)
{
override
fun
onError
(
p0
:
AdError
?)
{
EventUtils
.
onEventPullFail
(
entity
)
listener
.
onVideoError
()
listener
.
onVideoError
()
callback
.
onAdFail
()
callback
.
onAdFail
()
}
}
...
...
library/src/main/java/com/ym/library/ks/KSADUtils.java
View file @
b5f61ae7
package
com
.
ym
.
library
.
ks
;
package
com
.
ym
.
library
.
ks
;
import
android.annotation.SuppressLint
;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.os.Message
;
import
android.os.Message
;
...
@@ -20,6 +21,7 @@ import androidx.fragment.app.Fragment;
...
@@ -20,6 +21,7 @@ import androidx.fragment.app.Fragment;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.Glide
;
import
com.kwad.sdk.api.KsAdSDK
;
import
com.kwad.sdk.api.KsAdSDK
;
import
com.kwad.sdk.api.KsAdVideoPlayConfig
;
import
com.kwad.sdk.api.KsAppDownloadListener
;
import
com.kwad.sdk.api.KsAppDownloadListener
;
import
com.kwad.sdk.api.KsImage
;
import
com.kwad.sdk.api.KsImage
;
import
com.kwad.sdk.api.KsLoadManager
;
import
com.kwad.sdk.api.KsLoadManager
;
...
@@ -69,6 +71,7 @@ public class KSADUtils {
...
@@ -69,6 +71,7 @@ public class KSADUtils {
KsAdSDK
.
getLoadManager
().
loadNativeAd
(
scene
,
new
KsLoadManager
.
NativeAdListener
()
{
KsAdSDK
.
getLoadManager
().
loadNativeAd
(
scene
,
new
KsLoadManager
.
NativeAdListener
()
{
@Override
@Override
public
void
onError
(
int
code
,
String
msg
)
{
public
void
onError
(
int
code
,
String
msg
)
{
EventUtils
.
INSTANCE
.
onEventPullFail
(
newsEntity
);
// ToastUtil.showToast(mContext, "广告数据请求失败" + code + msg);
// ToastUtil.showToast(mContext, "广告数据请求失败" + code + msg);
container
.
setVisibility
(
View
.
GONE
);
container
.
setVisibility
(
View
.
GONE
);
...
@@ -79,8 +82,10 @@ public class KSADUtils {
...
@@ -79,8 +82,10 @@ public class KSADUtils {
public
void
onNativeAdLoad
(
@Nullable
List
<
KsNativeAd
>
adList
)
{
public
void
onNativeAdLoad
(
@Nullable
List
<
KsNativeAd
>
adList
)
{
if
(
adList
==
null
||
adList
.
isEmpty
())
{
if
(
adList
==
null
||
adList
.
isEmpty
())
{
// ToastUtil.showToast(mContext, "广告数据为空");
// ToastUtil.showToast(mContext, "广告数据为空");
EventUtils
.
INSTANCE
.
onEventPullFail
(
newsEntity
);
return
;
return
;
}
}
EventUtils
.
INSTANCE
.
onEventPullSuccess
(
newsEntity
);
zxadCallback
.
onAdSuccess
();
zxadCallback
.
onAdSuccess
();
showAd
(
adList
.
get
(
0
));
showAd
(
adList
.
get
(
0
));
}
}
...
@@ -95,6 +100,8 @@ public class KSADUtils {
...
@@ -95,6 +100,8 @@ public class KSADUtils {
KsAdSDK
.
getLoadManager
().
loadSplashScreenAd
(
scene
,
new
KsLoadManager
.
SplashScreenAdListener
()
{
KsAdSDK
.
getLoadManager
().
loadSplashScreenAd
(
scene
,
new
KsLoadManager
.
SplashScreenAdListener
()
{
@Override
@Override
public
void
onError
(
int
code
,
String
msg
)
{
public
void
onError
(
int
code
,
String
msg
)
{
EventUtils
.
INSTANCE
.
onEventPullFail
(
newsEntity
);
container
.
setVisibility
(
View
.
GONE
);
container
.
setVisibility
(
View
.
GONE
);
// showTips("开屏广告请求失败" + code + msg);
// showTips("开屏广告请求失败" + code + msg);
zxadCallback
.
onAdFail
();
zxadCallback
.
onAdFail
();
...
@@ -105,7 +112,7 @@ public class KSADUtils {
...
@@ -105,7 +112,7 @@ public class KSADUtils {
@Override
@Override
public
void
onSplashScreenAdLoad
(
@NonNull
KsSplashScreenAd
splashScreenAd
)
{
public
void
onSplashScreenAdLoad
(
@NonNull
KsSplashScreenAd
splashScreenAd
)
{
LogUtils
.
e
(
TAG
,
"onSplashScreenAdLoad "
+
splashScreenAd
+
" "
);
LogUtils
.
e
(
TAG
,
"onSplashScreenAdLoad "
+
splashScreenAd
+
" "
);
EventUtils
.
INSTANCE
.
onEventPullSuccess
(
newsEntity
);
zxadCallback
.
onAdSuccess
();
zxadCallback
.
onAdSuccess
();
container
.
setVisibility
(
View
.
VISIBLE
);
container
.
setVisibility
(
View
.
VISIBLE
);
// showTips("开始数据返回成功");
// showTips("开始数据返回成功");
...
@@ -123,9 +130,11 @@ public class KSADUtils {
...
@@ -123,9 +130,11 @@ public class KSADUtils {
@Override
@Override
public
void
onAdShowError
(
int
code
,
String
extra
)
{
public
void
onAdShowError
(
int
code
,
String
extra
)
{
EventUtils
.
INSTANCE
.
onEventShowFail
(
newsEntity
);
// showTips("开屏广告显示错误 " + code + " extra " + extra);
// showTips("开屏广告显示错误 " + code + " extra " + extra);
// gotoMainActivity();
// gotoMainActivity();
zxadListener
.
onErrorResult
(
extra
);
zxadListener
.
onErrorResult
(
extra
);
zxadCallback
.
onAdFail
();
LogUtils
.
e
(
TAG
,
"onAdShowError"
+
code
+
" "
+
extra
);
LogUtils
.
e
(
TAG
,
"onAdShowError"
+
code
+
" "
+
extra
);
}
}
...
@@ -136,6 +145,7 @@ public class KSADUtils {
...
@@ -136,6 +145,7 @@ public class KSADUtils {
// zxadListener.onSplashAdLoad();
// zxadListener.onSplashAdLoad();
LogUtils
.
e
(
TAG
,
" onAdShowEnd"
);
LogUtils
.
e
(
TAG
,
" onAdShowEnd"
);
zxadListener
.
onAdTimeOver
();
zxadListener
.
onAdTimeOver
();
zxadListener
.
onAdSkip
();
}
}
@Override
@Override
...
@@ -179,6 +189,7 @@ public class KSADUtils {
...
@@ -179,6 +189,7 @@ public class KSADUtils {
KsAdSDK
.
getLoadManager
().
loadRewardVideoAd
(
scene
,
new
KsLoadManager
.
RewardVideoAdListener
()
{
KsAdSDK
.
getLoadManager
().
loadRewardVideoAd
(
scene
,
new
KsLoadManager
.
RewardVideoAdListener
()
{
@Override
@Override
public
void
onError
(
int
code
,
String
msg
)
{
public
void
onError
(
int
code
,
String
msg
)
{
EventUtils
.
INSTANCE
.
onEventShowFail
(
entity
);
// ToastUtil.showToast(mContext, "激励视频广告请求失败" + code + msg);
// ToastUtil.showToast(mContext, "激励视频广告请求失败" + code + msg);
listener
.
onVideoError
();
listener
.
onVideoError
();
callback
.
onAdFail
();
callback
.
onAdFail
();
...
@@ -239,6 +250,7 @@ public class KSADUtils {
...
@@ -239,6 +250,7 @@ public class KSADUtils {
@Override
@Override
public
void
onVideoPlayError
(
int
code
,
int
extra
)
{
public
void
onVideoPlayError
(
int
code
,
int
extra
)
{
EventUtils
.
INSTANCE
.
onEventShowFail
(
entity
);
// ToastUtil.showToast(mContext, "激励视频广告播放出错");
// ToastUtil.showToast(mContext, "激励视频广告播放出错");
listener
.
onVideoError
();
listener
.
onVideoError
();
Log
.
e
(
TAG
,
"快手 onVideoPlayError code:"
+
code
+
"msg "
+
extra
);
Log
.
e
(
TAG
,
"快手 onVideoPlayError code:"
+
code
+
"msg "
+
extra
);
...
@@ -302,7 +314,7 @@ public class KSADUtils {
...
@@ -302,7 +314,7 @@ public class KSADUtils {
switch
(
ksNativeAd
.
getMaterialType
())
{
switch
(
ksNativeAd
.
getMaterialType
())
{
case
KsNativeAd
.
MaterialType
.
VIDEO
:
case
KsNativeAd
.
MaterialType
.
VIDEO
:
// 视频素材,渲染自定义的视频广告
// 视频素材,渲染自定义的视频广告
//
adView = getVideoItemView(mNativeAdContainer, ksNativeAd);
adView
=
getVideoItemView
(
mNativeAdContainer
,
ksNativeAd
);
break
;
break
;
case
KsNativeAd
.
MaterialType
.
SINGLE_IMG
:
case
KsNativeAd
.
MaterialType
.
SINGLE_IMG
:
// 单图素材,渲染自定义的单图广告
// 单图素材,渲染自定义的单图广告
...
@@ -322,6 +334,81 @@ public class KSADUtils {
...
@@ -322,6 +334,81 @@ public class KSADUtils {
}
}
}
}
/**
* 使用SDK渲染的播放控件
*/
protected
static
View
getVideoItemView
(
ViewGroup
parent
,
KsNativeAd
ksNativeAd
)
{
View
convertView
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
native_item_video
,
parent
,
false
);
AdVideoViewHolder
videoViewHolder
=
new
AdVideoViewHolder
(
convertView
);
// 设置广告数据
bindCommonData
((
ViewGroup
)
convertView
,
videoViewHolder
,
ksNativeAd
);
ksNativeAd
.
setVideoPlayListener
(
new
KsNativeAd
.
VideoPlayListener
()
{
@Override
public
void
onVideoPlayStart
()
{
}
@Override
public
void
onVideoPlayComplete
()
{
}
@Override
public
void
onVideoPlayError
(
int
what
,
int
extra
)
{
}
});
// SDK默认渲染的视频view
KsAdVideoPlayConfig
videoPlayConfig
=
new
KsAdVideoPlayConfig
.
Builder
()
.
videoSoundEnable
(
true
)
// 有声播放
.
dataFlowAutoStart
(
true
)
// 流量下自动播放
.
build
();
View
videoView
=
ksNativeAd
.
getVideoView
(
parent
.
getContext
(),
videoPlayConfig
);
if
(
videoView
!=
null
&&
videoView
.
getParent
()
==
null
)
{
videoViewHolder
.
mAdVideoContainer
.
removeAllViews
();
videoViewHolder
.
mAdVideoContainer
.
addView
(
videoView
);
}
return
convertView
;
}
@SuppressLint
(
"DefaultLocale"
)
protected
static
View
getNormalItemView
(
ViewGroup
parent
)
{
View
convertView
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
native_item_normal
,
parent
,
false
);
NormalViewHolder
normalViewHolder
=
new
NormalViewHolder
(
convertView
);
normalViewHolder
.
textView
.
setText
(
"没有广告"
);
return
convertView
;
}
protected
static
View
getGroupImageItemView
(
ViewGroup
parent
,
KsNativeAd
ksNativeAd
)
{
View
convertView
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
native_item_group_image
,
parent
,
false
);
AdGroupImageViewHolder
viewHolder
=
new
AdGroupImageViewHolder
(
convertView
);
bindCommonData
((
ViewGroup
)
convertView
,
viewHolder
,
ksNativeAd
);
// 获取图片资源
List
<
KsImage
>
ksImageList
=
ksNativeAd
.
getImageList
();
if
(
ksImageList
!=
null
&&
!
ksImageList
.
isEmpty
())
{
for
(
int
i
=
0
;
i
<
ksImageList
.
size
();
i
++)
{
KsImage
image
=
ksNativeAd
.
getImageList
().
get
(
i
);
if
(
image
!=
null
&&
image
.
isValid
())
{
if
(
i
==
0
)
{
Glide
.
with
(
parent
.
getContext
()).
load
(
image
.
getImageUrl
()).
into
(
viewHolder
.
mAdImageLeft
);
}
else
if
(
i
==
1
)
{
Glide
.
with
(
parent
.
getContext
()).
load
(
image
.
getImageUrl
()).
into
(
viewHolder
.
mAdImageMid
);
}
else
if
(
i
==
2
)
{
Glide
.
with
(
parent
.
getContext
()).
load
(
image
.
getImageUrl
()).
into
(
viewHolder
.
mAdImageRight
);
}
}
}
}
return
convertView
;
}
protected
static
View
getSingleImageItemView
(
ViewGroup
parent
,
KsNativeAd
ksNativeAd
)
{
protected
static
View
getSingleImageItemView
(
ViewGroup
parent
,
KsNativeAd
ksNativeAd
)
{
View
convertView
=
View
convertView
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
native_item_single_image
,
parent
,
false
);
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
native_item_single_image
,
parent
,
false
);
...
@@ -343,8 +430,8 @@ public class KSADUtils {
...
@@ -343,8 +430,8 @@ public class KSADUtils {
// 点击转换view的集合,传入的view点击时会触发转换操作:app下载, 打开h5页面
// 点击转换view的集合,传入的view点击时会触发转换操作:app下载, 打开h5页面
List
<
View
>
clickViewList
=
new
ArrayList
<>();
List
<
View
>
clickViewList
=
new
ArrayList
<>();
clickViewList
.
add
(
convertView
);
// 点击整个view都可触发转换
clickViewList
.
add
(
convertView
);
// 点击整个view都可触发转换
//
clickViewList.add(adBaseViewHolder.mAppDownloadBtn);
clickViewList
.
add
(
adBaseViewHolder
.
mAppDownloadBtn
);
//
clickViewList.add(adBaseViewHolder.mH5OpenBtn);
clickViewList
.
add
(
adBaseViewHolder
.
mH5OpenBtn
);
// 注册View的点击,点击后触发转化
// 注册View的点击,点击后触发转化
ad
.
registerViewForInteraction
(
convertView
,
clickViewList
,
ad
.
registerViewForInteraction
(
convertView
,
clickViewList
,
...
@@ -487,4 +574,35 @@ public class KSADUtils {
...
@@ -487,4 +574,35 @@ public class KSADUtils {
mDislikeBtn
=
convertView
.
findViewById
(
R
.
id
.
ad_dislike
);
mDislikeBtn
=
convertView
.
findViewById
(
R
.
id
.
ad_dislike
);
}
}
}
}
private
static
class
AdVideoViewHolder
extends
AdBaseViewHolder
{
FrameLayout
mAdVideoContainer
;
AdVideoViewHolder
(
View
convertView
)
{
super
(
convertView
);
mAdVideoContainer
=
convertView
.
findViewById
(
R
.
id
.
video_container
);
}
}
private
static
class
AdGroupImageViewHolder
extends
AdBaseViewHolder
{
ImageView
mAdImageLeft
;
ImageView
mAdImageMid
;
ImageView
mAdImageRight
;
AdGroupImageViewHolder
(
View
convertView
)
{
super
(
convertView
);
mAdImageLeft
=
convertView
.
findViewById
(
R
.
id
.
ad_image_left
);
mAdImageMid
=
convertView
.
findViewById
(
R
.
id
.
ad_image_mid
);
mAdImageRight
=
convertView
.
findViewById
(
R
.
id
.
ad_image_right
);
}
}
private
static
class
NormalViewHolder
{
TextView
textView
;
NormalViewHolder
(
View
convertView
)
{
this
.
textView
=
convertView
.
findViewById
(
R
.
id
.
tv
);
}
}
}
}
library/src/main/java/com/ym/library/module/AdIdConfig.kt
0 → 100644
View file @
b5f61ae7
package
com.ym.library.module
/**
* @author (wangXuewei)
* @datetime 2020-10-30 11:41 GMT+8
* @detail :
*/
data class
AdIdConfig
(
val
adPlatform
:
String
?,
val
codeAppId
:
String
?,
val
codeAppKey
:
String
?
)
\ No newline at end of file
library/src/main/java/com/ym/library/module/NewsEntity.kt
View file @
b5f61ae7
...
@@ -20,6 +20,9 @@ class NewsEntity : Serializable {
...
@@ -20,6 +20,9 @@ class NewsEntity : Serializable {
var
adType
:
Int
=
0
// 广告类型 4.大图广告 5.开屏 7.激励视频 8.全屏视频
var
adType
:
Int
=
0
// 广告类型 4.大图广告 5.开屏 7.激励视频 8.全屏视频
var
clk_tracking
:
List
<
String
>
=
arrayListOf
()
var
clk_tracking
:
List
<
String
>
=
arrayListOf
()
var
imp_tracking
:
List
<
String
>
=
arrayListOf
()
var
imp_tracking
:
List
<
String
>
=
arrayListOf
()
var
showfail_tracking
:
List
<
String
>
=
ArrayList
()
var
pullsucc_tracking
:
List
<
String
>
=
ArrayList
()
var
pullfail_tracking
:
List
<
String
>
=
ArrayList
()
var
backups
:
List
<
NewsEntity
>
=
arrayListOf
()
var
backups
:
List
<
NewsEntity
>
=
arrayListOf
()
class
backupsEntity
{
class
backupsEntity
{
...
...
library/src/main/java/com/ym/library/net/ZXAdApi.kt
View file @
b5f61ae7
package
com.ym.library.net
package
com.ym.library.net
import
com.ym.library.module.AdIdConfig
import
com.ym.library.module.NewsEntity
import
com.ym.library.module.NewsEntity
import
io.reactivex.Observable
import
io.reactivex.Observable
import
okhttp3.ResponseBody
import
okhttp3.ResponseBody
...
@@ -22,4 +23,9 @@ interface ZXAdApi {
...
@@ -22,4 +23,9 @@ interface ZXAdApi {
fun
showAd
(
@Url
url
:
String
):
Observable
<
ResponseBody
>
fun
showAd
(
@Url
url
:
String
):
Observable
<
ResponseBody
>
// 测试环境 获取广告平台的appId http://bstest.zhangxinhulian.com/v1/fetch/adAppIds?pkg=com.ym.xync
@GET
(
"v1/fetch/adAppIds"
)
fun
getADConfig
(
@Query
(
"pkg"
)
pkg
:
String
):
Observable
<
Response
<
List
<
AdIdConfig
>>>
}
}
\ No newline at end of file
library/src/main/java/com/ym/library/rs/RSADUtils.kt
View file @
b5f61ae7
...
@@ -21,7 +21,10 @@ import com.ym.library.listener.ZXADVideoListener
...
@@ -21,7 +21,10 @@ import com.ym.library.listener.ZXADVideoListener
import
com.ym.library.module.NewsEntity
import
com.ym.library.module.NewsEntity
import
com.ym.library.utils.EventUtils
import
com.ym.library.utils.EventUtils
import
com.ym.library.utils.EventUtils.onEventClick
import
com.ym.library.utils.EventUtils.onEventClick
import
com.ym.library.utils.EventUtils.onEventPullFail
import
com.ym.library.utils.EventUtils.onEventPullSuccess
import
com.ym.library.utils.EventUtils.onEventShow
import
com.ym.library.utils.EventUtils.onEventShow
import
com.ym.library.utils.EventUtils.onEventShowFail
import
com.ym.library.utils.EventUtils.onEventUM
import
com.ym.library.utils.EventUtils.onEventUM
import
show.vion.cn.vlion_ad_inter.splash.SplashViewListener
import
show.vion.cn.vlion_ad_inter.splash.SplashViewListener
import
show.vion.cn.vlion_ad_inter.video.VideoViewListener
import
show.vion.cn.vlion_ad_inter.video.VideoViewListener
...
@@ -57,20 +60,15 @@ object RSADUtils {
...
@@ -57,20 +60,15 @@ object RSADUtils {
newsEntity
.
codeId
,
newsEntity
.
codeId
,
object
:
SplashViewListener
{
object
:
SplashViewListener
{
override
fun
onRequestSuccess
(
adId
:
String
,
viewWidth
:
Int
,
viewHeight
:
Int
)
{
override
fun
onRequestSuccess
(
adId
:
String
,
viewWidth
:
Int
,
viewHeight
:
Int
)
{
onEventPullSuccess
(
newsEntity
)
zxadCallback
.
onAdSuccess
()
zxadCallback
.
onAdSuccess
()
zxadListener
.
onSuccessResult
()
zxadListener
.
onSuccessResult
()
Log
.
e
(
TAG
,
"瑞狮 开屏onRequestSuccess: adId:$adId,$viewWidth,$viewHeight"
)
Log
.
e
(
TAG
,
"瑞狮 开屏onRequestSuccess: adId:$adId,$viewWidth,$viewHeight"
)
// if (viewWidth > 0 && viewHeight > 0) {
// splashAdContainer.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
// splashAdContainer.getLayoutParams().height = ScreenUtil.getScreenWidth(SplashActivity.this) * viewHeight / viewWidth;
// }
// else {
// splashAdContainer.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
// splashAdContainer.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT;
// }
}
}
override
fun
onRequestFailed
(
adId
:
String
,
code
:
Int
,
errorMsg
:
String
)
{
override
fun
onRequestFailed
(
adId
:
String
,
code
:
Int
,
errorMsg
:
String
)
{
onEventPullFail
(
newsEntity
)
Log
.
e
(
TAG
,
"瑞狮 开屏onRequestFailed: adId:$adId,$code,$errorMsg"
)
Log
.
e
(
TAG
,
"瑞狮 开屏onRequestFailed: adId:$adId,$code,$errorMsg"
)
zxadListener
.
onErrorResult
(
errorMsg
+
""
)
zxadListener
.
onErrorResult
(
errorMsg
+
""
)
zxadCallback
.
onAdFail
()
zxadCallback
.
onAdFail
()
...
@@ -84,6 +82,7 @@ object RSADUtils {
...
@@ -84,6 +82,7 @@ object RSADUtils {
}
}
override
fun
onShowFailed
(
adId
:
String
,
code
:
Int
,
msg
:
String
)
{
override
fun
onShowFailed
(
adId
:
String
,
code
:
Int
,
msg
:
String
)
{
onEventShowFail
(
newsEntity
)
Log
.
e
(
TAG
,
"瑞狮 开屏onShowFailed: adId:$adId,$code,$msg"
)
Log
.
e
(
TAG
,
"瑞狮 开屏onShowFailed: adId:$adId,$code,$msg"
)
zxadListener
.
onErrorResult
(
msg
+
""
)
zxadListener
.
onErrorResult
(
msg
+
""
)
container
.
setVisibility
(
View
.
GONE
)
container
.
setVisibility
(
View
.
GONE
)
...
@@ -113,7 +112,7 @@ object RSADUtils {
...
@@ -113,7 +112,7 @@ object RSADUtils {
callback
:
ZXADCallback
callback
:
ZXADCallback
)
{
)
{
var
nativeManager
=
NativeManager
.
initNative
()
var
nativeManager
=
NativeManager
.
initNative
()
.
setImageAcceptedSize
(
container
.
getWidth
(),
0
)
//增加父布局
.
setImageAcceptedSize
(
container
.
getWidth
(),
0
)
//增加父布局
// .setNativeContainer(nativeLayout)
// .setNativeContainer(nativeLayout)
//7030020348049331
//7030020348049331
...
@@ -122,7 +121,14 @@ object RSADUtils {
...
@@ -122,7 +121,14 @@ object RSADUtils {
override
fun
onRequestSuccess
(
adId
:
String
,
data
:
NativeFeedsData
?)
{
override
fun
onRequestSuccess
(
adId
:
String
,
data
:
NativeFeedsData
?)
{
// nativeLayout.setVisibility(View.VISIBLE);
// nativeLayout.setVisibility(View.VISIBLE);
Log
.
e
(
TAG
,
"瑞狮 大图广告 数据获取成功 adId:$adId"
)
Log
.
e
(
TAG
,
"瑞狮 大图广告 数据获取成功 adId:$adId"
)
if
(
data
==
null
)
return
if
(
data
==
null
)
{
onEventPullFail
(
newsEntity
)
return
}
onEventPullSuccess
(
newsEntity
)
container
.
visibility
=
View
.
VISIBLE
container
.
visibility
=
View
.
VISIBLE
val
view
=
data
.
nativeView
val
view
=
data
.
nativeView
if
(
null
!=
view
)
{
if
(
null
!=
view
)
{
...
@@ -147,6 +153,7 @@ object RSADUtils {
...
@@ -147,6 +153,7 @@ object RSADUtils {
}
}
override
fun
onShowFailed
(
adId
:
String
,
code
:
Int
,
msg
:
String
)
{
override
fun
onShowFailed
(
adId
:
String
,
code
:
Int
,
msg
:
String
)
{
onEventShowFail
(
newsEntity
)
Log
.
e
(
TAG
,
"瑞狮大图广告 onShowFailed :$adId++code=$code++msg=$msg"
)
Log
.
e
(
TAG
,
"瑞狮大图广告 onShowFailed :$adId++code=$code++msg=$msg"
)
container
.
visibility
=
View
.
GONE
container
.
visibility
=
View
.
GONE
}
}
...
@@ -163,6 +170,7 @@ object RSADUtils {
...
@@ -163,6 +170,7 @@ object RSADUtils {
}
}
override
fun
onRequestFailed
(
adId
:
String
,
code
:
Int
,
message
:
String
)
{
override
fun
onRequestFailed
(
adId
:
String
,
code
:
Int
,
message
:
String
)
{
onEventPullFail
(
newsEntity
)
Log
.
e
(
TAG
,
"瑞狮大图广告 数据加载失败 : code = $code , message = $message,adId:$adId"
)
Log
.
e
(
TAG
,
"瑞狮大图广告 数据加载失败 : code = $code , message = $message,adId:$adId"
)
container
.
visibility
=
View
.
GONE
container
.
visibility
=
View
.
GONE
callback
.
onAdFail
()
callback
.
onAdFail
()
...
@@ -177,10 +185,11 @@ object RSADUtils {
...
@@ -177,10 +185,11 @@ object RSADUtils {
listener
:
ZXADVideoListener
,
listener
:
ZXADVideoListener
,
callback
:
ZXADCallback
callback
:
ZXADCallback
)
{
)
{
var
startTime
=
System
.
currentTimeMillis
()
var
startTime
=
System
.
currentTimeMillis
()
var
adLoaded
=
false
var
adLoaded
=
false
//视频的填充适配类型
//视频的填充适配类型
VideoManager
.
getInstance
().
setAdScalingModel
(
Config
.
AD_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING
)
VideoManager
.
getInstance
()
.
setAdScalingModel
(
Config
.
AD_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING
)
VideoManager
.
getInstance
().
setVideoOrientation
(
Config
.
AD_VERTIVAL_SCREEN_DISPLAY
)
VideoManager
.
getInstance
().
setVideoOrientation
(
Config
.
AD_VERTIVAL_SCREEN_DISPLAY
)
//视频的尺寸
//视频的尺寸
VideoManager
.
getInstance
().
setImageAcceptedSize
(
1080
,
1920
)
VideoManager
.
getInstance
().
setImageAcceptedSize
(
1080
,
1920
)
...
@@ -192,9 +201,10 @@ object RSADUtils {
...
@@ -192,9 +201,10 @@ object RSADUtils {
entity
.
codeId
,
entity
.
codeId
,
object
:
VideoViewListener
{
object
:
VideoViewListener
{
override
fun
onLoadVideo
(
adId
:
String
)
{
override
fun
onLoadVideo
(
adId
:
String
)
{
onEventPullSuccess
(
entity
)
Log
.
e
(
TAG
,
"onLoadVideo:缓存成功,可以展示 adId=$adId"
)
Log
.
e
(
TAG
,
"onLoadVideo:缓存成功,可以展示 adId=$adId"
)
// if (VideoManager.getInstance().isReady) {
// if (VideoManager.getInstance().isReady) {
//展示广告
//展示广告
// adLoaded = true
// adLoaded = true
// Log.e(TAG, "瑞狮 激励视频耗时" + (System.currentTimeMillis() - startTime) + "")
// Log.e(TAG, "瑞狮 激励视频耗时" + (System.currentTimeMillis() - startTime) + "")
// VideoManager.getInstance().showVideo();
// VideoManager.getInstance().showVideo();
...
@@ -210,6 +220,7 @@ object RSADUtils {
...
@@ -210,6 +220,7 @@ object RSADUtils {
}
}
override
fun
onVideoPlayFailed
(
adId
:
String
,
code
:
Int
,
msg
:
String
)
{
override
fun
onVideoPlayFailed
(
adId
:
String
,
code
:
Int
,
msg
:
String
)
{
onEventShowFail
(
entity
)
Log
.
e
(
TAG
,
"onVideoPlayFailed:adId="
+
adId
+
"code="
+
code
+
"msg="
+
msg
)
Log
.
e
(
TAG
,
"onVideoPlayFailed:adId="
+
adId
+
"code="
+
code
+
"msg="
+
msg
)
listener
.
onError
()
listener
.
onError
()
}
}
...
@@ -237,6 +248,7 @@ object RSADUtils {
...
@@ -237,6 +248,7 @@ object RSADUtils {
//广告请求失败
//广告请求失败
override
fun
onRequestFailed
(
adId
:
String
,
code
:
Int
,
errorMsg
:
String
)
{
override
fun
onRequestFailed
(
adId
:
String
,
code
:
Int
,
errorMsg
:
String
)
{
onEventPullFail
(
entity
)
Log
.
e
(
Log
.
e
(
TAG
,
TAG
,
"onRequestFailed:adId="
+
adId
+
"code="
+
code
+
"errorMsg="
+
errorMsg
"onRequestFailed:adId="
+
adId
+
"code="
+
code
+
"errorMsg="
+
errorMsg
...
@@ -253,24 +265,19 @@ object RSADUtils {
...
@@ -253,24 +265,19 @@ object RSADUtils {
if
(
System
.
currentTimeMillis
()
-
startTime
>
7000
)
{
if
(
System
.
currentTimeMillis
()
-
startTime
>
7000
)
{
listener
.
onVideoError
()
listener
.
onVideoError
()
removeCallbacksAndMessages
(
null
)
removeCallbacksAndMessages
(
null
)
onEventPullFail
(
entity
)
return
return
}
}
if
(
VideoManager
.
getInstance
().
isReady
)
{
if
(!
adLoaded
)
{
//广告展示检查1:广告成功加载,
Log
.
e
(
TAG
,
"播放视频wxw"
)
sendEmptyMessageDelayed
(
1
,
20
)
VideoManager
.
getInstance
().
showVideo
();
if
(
VideoManager
.
getInstance
().
isReady
)
{
Log
.
e
(
TAG
,
"播放视频wxw"
)
VideoManager
.
getInstance
().
showVideo
();
removeCallbacksAndMessages
(
null
)
}
}
else
{
removeCallbacksAndMessages
(
null
)
removeCallbacksAndMessages
(
null
)
}
else
{
sendEmptyMessageDelayed
(
1
,
20
)
}
}
}
}
}
}
if
(!
adLoaded
){
handler
.
sendEmptyMessageDelayed
(
1
,
20
)
handler
.
sendEmptyMessageDelayed
(
1
,
20
)
}
}
}
}
}
\ No newline at end of file
library/src/main/java/com/ym/library/sh/SHADUtils.kt
View file @
b5f61ae7
...
@@ -12,7 +12,9 @@ import com.ym.library.listener.ZXADVideoListener
...
@@ -12,7 +12,9 @@ import com.ym.library.listener.ZXADVideoListener
import
com.ym.library.module.NewsEntity
import
com.ym.library.module.NewsEntity
import
com.ym.library.utils.EventUtils
import
com.ym.library.utils.EventUtils
import
com.ym.library.utils.EventUtils.onEventClick
import
com.ym.library.utils.EventUtils.onEventClick
import
com.ym.library.utils.EventUtils.onEventPullFail
import
com.ym.library.utils.EventUtils.onEventShow
import
com.ym.library.utils.EventUtils.onEventShow
import
com.ym.library.utils.EventUtils.onEventShowFail
object
SHADUtils
{
object
SHADUtils
{
...
@@ -33,6 +35,8 @@ object SHADUtils {
...
@@ -33,6 +35,8 @@ object SHADUtils {
.
skip
(
skipView
)
.
skip
(
skipView
)
.
listen
(
object
:
CoralSplashImage
.
ISplashImageListener
{
.
listen
(
object
:
CoralSplashImage
.
ISplashImageListener
{
override
fun
onAdError
()
{
override
fun
onAdError
()
{
onEventPullFail
(
newsEntity
)
Log
.
d
(
TAG
,
"珊瑚 开屏 onAdError"
)
Log
.
d
(
TAG
,
"珊瑚 开屏 onAdError"
)
zxadListener
?.
onErrorResult
(
"广告拉取失败"
);
zxadListener
?.
onErrorResult
(
"广告拉取失败"
);
zxadCallback
.
onAdFail
()
zxadCallback
.
onAdFail
()
...
...
library/src/main/java/com/ym/library/sm/SMADUtils.kt
View file @
b5f61ae7
...
@@ -25,7 +25,10 @@ import com.ym.library.module.NewsEntity
...
@@ -25,7 +25,10 @@ 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
import
com.ym.library.utils.EventUtils.onEventClick
import
com.ym.library.utils.EventUtils.onEventClick
import
com.ym.library.utils.EventUtils.onEventPullFail
import
com.ym.library.utils.EventUtils.onEventPullSuccess
import
com.ym.library.utils.EventUtils.onEventShow
import
com.ym.library.utils.EventUtils.onEventShow
import
com.ym.library.utils.EventUtils.onEventShowFail
import
com.ym.library.utils.EventUtils.onEventUM
import
com.ym.library.utils.EventUtils.onEventUM
import
com.ym.library.utils.SettingPreference
import
com.ym.library.utils.SettingPreference
...
@@ -59,7 +62,8 @@ object SMADUtils {
...
@@ -59,7 +62,8 @@ object SMADUtils {
WindSplashAD
(
activity
,
container
,
splashAdRequest
,
object
:
WindSplashADListener
{
WindSplashAD
(
activity
,
container
,
splashAdRequest
,
object
:
WindSplashADListener
{
override
fun
onSplashAdSuccessPresentScreen
()
{
override
fun
onSplashAdSuccessPresentScreen
()
{
Log
.
d
(
TAG
,
"Sigmob 开屏 onSplashAdSuccessPresentScreen"
)
Log
.
d
(
TAG
,
"Sigmob 开屏 onSplashAdSuccessPresentScreen"
)
EventUtils
.
onEventShow
(
newsEntity
)
onEventPullSuccess
(
newsEntity
)
onEventShow
(
newsEntity
)
onEventUM
(
"ad_splash_show"
,
"Sigmob 开屏广告"
)
onEventUM
(
"ad_splash_show"
,
"Sigmob 开屏广告"
)
zxadListener
.
onAdShow
(
newsEntity
)
zxadListener
.
onAdShow
(
newsEntity
)
zxadCallback
.
onAdSuccess
()
zxadCallback
.
onAdSuccess
()
...
@@ -69,7 +73,7 @@ object SMADUtils {
...
@@ -69,7 +73,7 @@ object SMADUtils {
Log
.
d
(
TAG
,
"Sigmob 开屏 onSplashAdClicked"
)
Log
.
d
(
TAG
,
"Sigmob 开屏 onSplashAdClicked"
)
zxadListener
.
onAdClicked
(
newsEntity
)
zxadListener
.
onAdClicked
(
newsEntity
)
EventUtils
.
onEventClick
(
newsEntity
)
onEventClick
(
newsEntity
)
onEventUM
(
"ad_splash_click"
,
"Sigmob 开屏广告"
)
onEventUM
(
"ad_splash_click"
,
"Sigmob 开屏广告"
)
zxadListener
.
onAdClicked
(
newsEntity
)
zxadListener
.
onAdClicked
(
newsEntity
)
}
}
...
@@ -80,6 +84,7 @@ object SMADUtils {
...
@@ -80,6 +84,7 @@ object SMADUtils {
}
}
override
fun
onSplashAdFailToPresent
(
p0
:
WindAdError
?,
p1
:
String
?)
{
override
fun
onSplashAdFailToPresent
(
p0
:
WindAdError
?,
p1
:
String
?)
{
onEventPullFail
(
newsEntity
)
Log
.
d
(
Log
.
d
(
TAG
,
TAG
,
"Sigmob 开屏 onSplashAdFailToPresent:errorCode:"
+
p0
?.
errorCode
+
" --- message:"
+
p1
"Sigmob 开屏 onSplashAdFailToPresent:errorCode:"
+
p0
?.
errorCode
+
" --- message:"
+
p1
...
@@ -110,12 +115,14 @@ object SMADUtils {
...
@@ -110,12 +115,14 @@ object SMADUtils {
windRewardedVideoAd
.
setWindRewardedVideoAdListener
(
object
:
WindRewardedVideoAdListener
{
windRewardedVideoAd
.
setWindRewardedVideoAdListener
(
object
:
WindRewardedVideoAdListener
{
override
fun
onVideoAdPlayError
(
p0
:
WindAdError
?,
p1
:
String
?)
{
override
fun
onVideoAdPlayError
(
p0
:
WindAdError
?,
p1
:
String
?)
{
onEventShowFail
(
entity
)
listener
?.
onVideoError
()
listener
?.
onVideoError
()
callback
?.
onAdFail
()
callback
?.
onAdFail
()
Log
.
d
(
TAG
,
"Sigmob 激励 onVideoAdPlayError"
+
p0
?.
message
)
Log
.
d
(
TAG
,
"Sigmob 激励 onVideoAdPlayError"
+
p0
?.
message
)
}
}
override
fun
onVideoAdPreLoadFail
(
p0
:
String
?)
{
override
fun
onVideoAdPreLoadFail
(
p0
:
String
?)
{
onEventPullFail
(
entity
)
listener
?.
onVideoError
()
listener
?.
onVideoError
()
callback
?.
onAdFail
()
callback
?.
onAdFail
()
Log
.
d
(
TAG
,
"Sigmob 激励 onVideoAdPreLoadFail"
+
p0
)
Log
.
d
(
TAG
,
"Sigmob 激励 onVideoAdPreLoadFail"
+
p0
)
...
@@ -141,6 +148,7 @@ object SMADUtils {
...
@@ -141,6 +148,7 @@ object SMADUtils {
}
}
override
fun
onVideoAdLoadSuccess
(
p0
:
String
?)
{
override
fun
onVideoAdLoadSuccess
(
p0
:
String
?)
{
onEventPullSuccess
(
entity
)
Log
.
d
(
TAG
,
"Sigmob 激励 onVideoAdLoadSuccess"
)
Log
.
d
(
TAG
,
"Sigmob 激励 onVideoAdLoadSuccess"
)
}
}
...
@@ -149,7 +157,7 @@ object SMADUtils {
...
@@ -149,7 +157,7 @@ object SMADUtils {
override
fun
onVideoAdClicked
(
p0
:
String
?)
{
override
fun
onVideoAdClicked
(
p0
:
String
?)
{
listener
?.
onVideoComplete
()
listener
?.
onVideoComplete
()
AdUpload
.
onAdClick
(
entity
)
//
AdUpload.onAdClick(entity)
onEventClick
(
entity
)
onEventClick
(
entity
)
onEventUM
(
"ad_reward_video_click"
,
"Sigmob 激励视频"
)
onEventUM
(
"ad_reward_video_click"
,
"Sigmob 激励视频"
)
...
@@ -158,6 +166,8 @@ object SMADUtils {
...
@@ -158,6 +166,8 @@ object SMADUtils {
}
}
override
fun
onVideoAdLoadError
(
p0
:
WindAdError
?,
p1
:
String
?)
{
override
fun
onVideoAdLoadError
(
p0
:
WindAdError
?,
p1
:
String
?)
{
onEventPullFail
(
entity
)
listener
?.
onVideoError
()
listener
?.
onVideoError
()
callback
?.
onAdFail
()
callback
?.
onAdFail
()
}
}
...
...
library/src/main/java/com/ym/library/utils/CenterDialog.kt
View file @
b5f61ae7
...
@@ -58,9 +58,10 @@ object CenterDialog : BaseDialog() {
...
@@ -58,9 +58,10 @@ object CenterDialog : BaseDialog() {
}
else
{
}
else
{
mDialog
.
setCanceledOnTouchOutside
(
true
)
mDialog
.
setCanceledOnTouchOutside
(
true
)
}
}
mDialog
.
findViewById
<
ImageView
>(
R
.
id
.
id_close_update_dailog
).
setOnClickListener
(
View
.
OnClickListener
{
mDialog
.
findViewById
<
ImageView
>(
R
.
id
.
id_close_update_dailog
)
mDialog
?.
dismiss
()
.
setOnClickListener
(
View
.
OnClickListener
{
})
mDialog
?.
dismiss
()
})
mDialogView
.
findViewById
<
TextView
>(
R
.
id
.
tv_check_version_desc
).
text
=
desc
mDialogView
.
findViewById
<
TextView
>(
R
.
id
.
tv_check_version_desc
).
text
=
desc
mDialogView
.
findViewById
<
TextView
>(
R
.
id
.
btn_update_start
).
setOnClickListener
{
mDialogView
.
findViewById
<
TextView
>(
R
.
id
.
btn_update_start
).
setOnClickListener
{
listener
.
onClick
(
it
)
listener
.
onClick
(
it
)
...
@@ -68,6 +69,38 @@ object CenterDialog : BaseDialog() {
...
@@ -68,6 +69,38 @@ object CenterDialog : BaseDialog() {
mDialog
?.
show
()
mDialog
?.
show
()
}
}
/**
* 获得微信红包
*/
fun
showGuideGetMoney
(
activity
:
Activity
?,
cashStr
:
String
,
webView
:
WebView
)
{
if
(
activity
==
null
)
{
return
}
val
mDialog
=
Dialog
(
activity
,
R
.
style
.
UpdateVersionCompatDialogTheme75
)
val
mDialogView
=
showBottomDialog
(
R
.
layout
.
dialog_lib_get_money
,
activity
,
mDialog
,
0
,
Gravity
.
CENTER
)
val
tv_money
=
mDialogView
?.
findViewById
<
TextView
>(
R
.
id
.
tv_money
)
tv_money
.
text
=
"${cashStr}元"
mDialogView
.
findViewById
<
ImageView
>(
R
.
id
.
id_iv_back
).
setOnClickListener
{
webView
?.
loadUrl
(
"javascript:onResume()"
)
mDialog
.
dismiss
()
}
mDialogView
.
findViewById
<
ImageView
>(
R
.
id
.
id_get_money_cancel
).
setOnClickListener
{
webView
?.
loadUrl
(
"javascript:onResume()"
)
mDialog
.
dismiss
()
}
mDialog
.
setCanceledOnTouchOutside
(
false
)
mDialog
.
setCancelable
(
false
)
mDialog
.
show
()
}
// /**
// /**
// * 领取红包奖励
// * 领取红包奖励
...
...
library/src/main/java/com/ym/library/utils/EventUtils.kt
View file @
b5f61ae7
...
@@ -74,13 +74,34 @@ object EventUtils {
...
@@ -74,13 +74,34 @@ object EventUtils {
apiClient
(
jsonObj
)
apiClient
(
jsonObj
)
MobclickAgent
.
onEvent
(
AppliContext
.
get
(),
action
,
value
)
MobclickAgent
.
onEvent
(
AppliContext
.
get
(),
action
,
value
)
}
}
//广告成功展示
fun
onEventShow
(
entity
:
NewsEntity
)
{
fun
onEventShow
(
entity
:
NewsEntity
)
{
if
(
entity
?.
imp_tracking
!=
null
&&
entity
?.
imp_tracking
.
size
>
0
)
{
if
(
entity
?.
imp_tracking
!=
null
&&
entity
?.
imp_tracking
.
size
>
0
)
{
apiClient
(
entity
?.
imp_tracking
[
0
])
apiClient
(
entity
?.
imp_tracking
[
0
])
}
}
}
}
//广告展示失败 渲染失败
fun
onEventShowFail
(
entity
:
NewsEntity
)
{
if
(
entity
?.
showfail_tracking
!=
null
&&
entity
?.
showfail_tracking
.
size
>
0
)
{
apiClient
(
entity
?.
showfail_tracking
[
0
])
}
}
//广告拉取成功
fun
onEventPullSuccess
(
entity
:
NewsEntity
)
{
Log
.
d
(
"EventUtils"
,
"拉取成功: "
)
if
(
entity
?.
pullsucc_tracking
!=
null
&&
entity
?.
pullsucc_tracking
.
size
>
0
)
{
apiClient
(
entity
?.
pullsucc_tracking
[
0
])
}
}
//广告拉取失败
fun
onEventPullFail
(
entity
:
NewsEntity
)
{
Log
.
d
(
"EventUtils"
,
"拉取失败: "
)
if
(
entity
?.
pullfail_tracking
!=
null
&&
entity
?.
pullfail_tracking
.
size
>
0
)
{
apiClient
(
entity
?.
pullfail_tracking
[
0
])
}
}
//广告点击
fun
onEventClick
(
entity
:
NewsEntity
)
{
fun
onEventClick
(
entity
:
NewsEntity
)
{
if
(
entity
?.
clk_tracking
!=
null
&&
entity
?.
clk_tracking
.
size
>
0
)
{
if
(
entity
?.
clk_tracking
!=
null
&&
entity
?.
clk_tracking
.
size
>
0
)
{
apiClient
(
entity
?.
clk_tracking
[
0
])
apiClient
(
entity
?.
clk_tracking
[
0
])
...
@@ -211,6 +232,7 @@ object EventUtils {
...
@@ -211,6 +232,7 @@ object EventUtils {
}
}
override
fun
onError
(
e
:
Throwable
)
{
override
fun
onError
(
e
:
Throwable
)
{
onEventUM
(
"zxad_report_fail"
,
url
)
}
}
})
})
}
catch
(
e
:
Exception
)
{
}
catch
(
e
:
Exception
)
{
...
...
library/src/main/java/com/ym/library/ylb/WNManager.kt
View file @
b5f61ae7
...
@@ -31,12 +31,14 @@ object WNManager {
...
@@ -31,12 +31,14 @@ object WNManager {
WNAdSdk
.
getAdManager
()
WNAdSdk
.
getAdManager
()
.
loadRewardVideoAd
(
slot
,
object
:
WNRewardVideoAd
.
RewardVideoAdListener
{
.
loadRewardVideoAd
(
slot
,
object
:
WNRewardVideoAd
.
RewardVideoAdListener
{
override
fun
onError
(
code
:
Int
,
message
:
String
)
{
override
fun
onError
(
code
:
Int
,
message
:
String
)
{
EventUtils
.
onEventPullFail
(
entity
)
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
)
{
EventUtils
.
onEventPullSuccess
(
entity
)
ad
.
interactionListener
=
object
:
WNRewardVideoAd
.
InteractionListener
{
ad
.
interactionListener
=
object
:
WNRewardVideoAd
.
InteractionListener
{
override
fun
onAdShow
()
{
override
fun
onAdShow
()
{
Log
.
d
(
"WNManager"
,
"激励视频展示"
)
Log
.
d
(
"WNManager"
,
"激励视频展示"
)
...
...
library/src/main/res/drawable-xxhdpi/bg_dialog_lib_get_money.png
0 → 100644
View file @
b5f61ae7
72.1 KB
library/src/main/res/drawable-xxhdpi/icon_dialog_lib_get_money_cancel.png
0 → 100644
View file @
b5f61ae7
5.5 KB
library/src/main/res/drawable-xxhdpi/icon_lib_get_money_title_acquire.png
0 → 100644
View file @
b5f61ae7
9.98 KB
library/src/main/res/layout/dialog_lib_get_money.xml
0 → 100644
View file @
b5f61ae7
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<ImageView
android:id=
"@+id/id_iv_back"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentRight=
"true"
android:layout_marginTop=
"39dp"
android:layout_marginRight=
"28dp"
android:src=
"@drawable/icon_dialog_lib_get_money_cancel"
/>
<RelativeLayout
android:layout_width=
"320dp"
android:layout_height=
"360dp"
android:layout_centerInParent=
"true"
android:background=
"@drawable/bg_dialog_lib_get_money"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerHorizontal=
"true"
android:src=
"@drawable/icon_lib_get_money_title_acquire"
/>
<TextView
android:id=
"@+id/tv_money"
android:layout_width=
"120dp"
android:layout_height=
"130dp"
android:layout_centerInParent=
"true"
android:background=
"@drawable/icon_dialog_lib_get_money_red_paper"
android:paddingLeft=
"25dp"
android:paddingTop=
"17dp"
android:text=
"0.3元"
android:textColor=
"#ffffffff"
android:textSize=
"20sp"
/>
<ImageView
android:id=
"@+id/id_get_money_cancel"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentBottom=
"true"
android:layout_centerHorizontal=
"true"
android:src=
"@drawable/icon_lib_get_money_btn_accept"
/>
</RelativeLayout>
</RelativeLayout>
</FrameLayout>
library/src/main/res/layout/native_item_group_image.xml
0 → 100644
View file @
b5f61ae7
<?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=
"wrap_content"
android:orientation=
"vertical"
tools:ignore=
"ContentDescription,SpUsage,RtlHardcoded"
>
<TextView
android:id=
"@+id/ad_desc"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:maxLines=
"2"
android:textColor=
"#020202"
android:textSize=
"18dp"
tools:text=
"快手广告快手广告快手广告快手广告快手广告快手广告快手广告快手广告快手广告快手广告"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"200dp"
android:layout_marginTop=
"8dp"
android:layout_marginBottom=
"8dp"
>
<ImageView
android:id=
"@+id/ad_image_left"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:scaleType=
"centerCrop"
/>
<ImageView
android:id=
"@+id/ad_image_mid"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:layout_marginLeft=
"4dp"
android:layout_marginRight=
"4dp"
android:layout_weight=
"1"
android:scaleType=
"centerCrop"
/>
<ImageView
android:id=
"@+id/ad_image_right"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:scaleType=
"centerCrop"
/>
</LinearLayout>
<include
android:id=
"@+id/ad_download_container"
layout=
"@layout/native_item_app_download"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:visibility=
"gone"
tools:visibility=
"visible"
/>
<include
android:id=
"@+id/ad_h5_container"
layout=
"@layout/native_item_h5_open"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:visibility=
"gone"
tools:visibility=
"visible"
/>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"24dp"
android:layout_marginTop=
"4dp"
tools:ignore=
"ContentDescription,RtlHardcoded"
>
<ImageView
android:layout_width=
"35dp"
android:layout_height=
"12dp"
android:layout_alignParentLeft=
"true"
android:layout_centerVertical=
"true"
android:src=
"@drawable/test_ad_label_gray"
/>
<ImageView
android:id=
"@+id/ad_dislike"
android:layout_width=
"24dp"
android:layout_height=
"24dp"
android:layout_alignParentRight=
"true"
android:layout_centerVertical=
"true"
android:src=
"@drawable/test_dislike_gray"
/>
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
library/src/main/res/layout/native_item_normal.xml
0 → 100644
View file @
b5f61ae7
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
tools:ignore=
"HardcodedText"
>
<TextView
android:id=
"@+id/tv"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
android:layout_margin=
"16dp"
android:gravity=
"center"
android:text=
"普通的view"
/>
</RelativeLayout>
\ No newline at end of file
library/src/main/res/layout/native_item_video.xml
0 → 100644
View file @
b5f61ae7
<?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=
"wrap_content"
android:orientation=
"vertical"
tools:ignore=
"ContentDescription,SpUsage,RtlHardcoded"
>
<TextView
android:id=
"@+id/ad_desc"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:maxLines=
"2"
android:textColor=
"#020202"
android:textSize=
"18dp"
tools:text=
"快手广告快手广告快手广告快手广告快手广告快手广告快手广告快手广告快手广告快手广告"
/>
<FrameLayout
android:id=
"@+id/video_container"
android:layout_width=
"match_parent"
android:layout_height=
"200dp"
android:layout_marginTop=
"8dp"
android:layout_marginBottom=
"8dp"
/>
<include
android:id=
"@+id/ad_download_container"
layout=
"@layout/native_item_app_download"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:visibility=
"gone"
tools:visibility=
"visible"
/>
<include
android:id=
"@+id/ad_h5_container"
layout=
"@layout/native_item_h5_open"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:visibility=
"gone"
tools:visibility=
"visible"
/>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"24dp"
android:layout_marginTop=
"4dp"
tools:ignore=
"ContentDescription,RtlHardcoded"
>
<ImageView
android:layout_width=
"35dp"
android:layout_height=
"12dp"
android:layout_alignParentLeft=
"true"
android:layout_centerVertical=
"true"
android:src=
"@drawable/test_ad_label_gray"
/>
<ImageView
android:id=
"@+id/ad_dislike"
android:layout_width=
"24dp"
android:layout_height=
"24dp"
android:layout_alignParentRight=
"true"
android:layout_centerVertical=
"true"
android:src=
"@drawable/test_dislike_gray"
/>
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment