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
import
com.ym.library.down.UpdateVersionManager
import
com.ym.library.listener.ZXADVideoListener
import
com.ym.library.module.NewsEntity
import
com.ym.library.module.ReportEntity
import
com.ym.library.net.ApiClient
import
com.ym.library.net.BaseObserver
import
com.ym.library.net.RxSchedulers
...
...
@@ -82,7 +83,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
override
fun
onDestroy
()
{
super
.
onDestroy
()
if
(
mRefreshLoginObservable
!=
null
)
{
if
(
mRefreshLoginObservable
!=
null
)
{
RxBus
.
get
().
unregister
(
"refresh_login"
,
mRefreshLoginObservable
!!
)
//页面销毁的时候要执行 反注册
}
...
...
@@ -95,13 +96,20 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
override
fun
onResume
()
{
super
.
onResume
()
EventUtils
.
onEvent
(
"page_status"
,
Utils
.
obj2Str
(
ReportEntity
(
Constant
.
ReportSessionId
,
"GameActivity"
,
"onResume"
))
)
MobclickAgent
.
onResume
(
this
)
Log
.
d
(
"wxw"
,
"onResume"
)
// callUnity("Form_land", "getLandList", "")
}
override
fun
onPause
()
{
super
.
onPause
()
EventUtils
.
onEvent
(
"page_status"
,
Utils
.
obj2Str
(
ReportEntity
(
Constant
.
ReportSessionId
,
"GameActivity"
,
"onPause"
))
)
MobclickAgent
.
onPause
(
this
)
}
...
...
@@ -137,8 +145,8 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
/**
* 小满入口
*/
fun
gotoXiaoManActivity
(){
EventUtils
.
onEvent
(
"XiaoManClick"
,
"小满入口点击"
);
fun
gotoXiaoManActivity
()
{
EventUtils
.
onEvent
(
"XiaoManClick"
,
"小满入口点击"
);
JumpUtils
.
jumpXiaomanActivity
(
"天天领现金"
)
}
...
...
@@ -146,11 +154,11 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
* 跳转提现页
*/
fun
gotoWithdrawPage
(
type
:
Int
)
{
if
(
type
==
1
)
{
JumpUtils
.
h5Jump
(
"跳转提现页"
,
Constant
.
Param
.
WithDraw2
,
false
,
act
)
}
else
{
EventUtils
.
onEvent
(
"WithDrawClick"
,
"提现入口点击"
);
JumpUtils
.
h5Jump
(
"跳转提现页"
,
Constant
.
Param
.
WithDraw
,
false
,
act
)
if
(
type
==
1
)
{
JumpUtils
.
h5Jump
(
"跳转提现页"
,
Constant
.
Param
.
WithDraw2
,
false
,
act
)
}
else
{
EventUtils
.
onEvent
(
"WithDrawClick"
,
"提现入口点击"
);
JumpUtils
.
h5Jump
(
"跳转提现页"
,
Constant
.
Param
.
WithDraw
,
false
,
act
)
}
}
...
...
@@ -159,32 +167,31 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
*/
fun
ranklistClick
()
{
//JumpUtils.h5Jump("上榜赚钱", Constant.Param.RankList)
EventUtils
.
onEvent
(
"PaiHangBangClick"
,
"上榜入口点击"
);
JumpUtils
.
h5Jump
(
"排行榜"
,
Constant
.
Param
.
RankList
,
false
,
act
)
EventUtils
.
onEvent
(
"PaiHangBangClick"
,
"上榜入口点击"
);
JumpUtils
.
h5Jump
(
"排行榜"
,
Constant
.
Param
.
RankList
,
false
,
act
)
}
/**
* 每日福利
*/
fun
oneveryDayWelfareClick
()
{
EventUtils
.
onEvent
(
"MeiRiFuLiClick"
,
"每日福利入口点击"
);
JumpUtils
.
h5Jump
(
"每日福利"
,
Constant
.
Param
.
WelfareCenter
,
false
,
act
)
EventUtils
.
onEvent
(
"MeiRiFuLiClick"
,
"每日福利入口点击"
);
JumpUtils
.
h5Jump
(
"每日福利"
,
Constant
.
Param
.
WelfareCenter
,
false
,
act
)
}
/**
* 打卡提现
*/
fun
clockInMakeMoney
()
{
EventUtils
.
onEvent
(
"DaKaTiXianClick"
,
"打卡提现入口点击"
);
JumpUtils
.
h5Jump
(
"打卡提现"
,
Constant
.
Param
.
PunchRecord
,
false
,
act
)
EventUtils
.
onEvent
(
"DaKaTiXianClick"
,
"打卡提现入口点击"
);
JumpUtils
.
h5Jump
(
"打卡提现"
,
Constant
.
Param
.
PunchRecord
,
false
,
act
)
}
/**
* 幸运转盘
*/
fun
luckyTurntable
()
{
EventUtils
.
onEvent
(
"ZhuanPanClick"
,
"转盘入口点击"
);
EventUtils
.
onEvent
(
"ZhuanPanClick"
,
"转盘入口点击"
);
this
.
runOnUiThread
(
object
:
Runnable
{
override
fun
run
()
{
if
(
Utils
.
isFastClick
())
{
...
...
@@ -199,7 +206,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
* 领金币
*/
fun
getCoin
()
{
EventUtils
.
onEvent
(
"RenWuClick"
,
"领金币任务入口点击"
);
EventUtils
.
onEvent
(
"RenWuClick"
,
"领金币任务入口点击"
);
this
.
runOnUiThread
(
object
:
Runnable
{
override
fun
run
()
{
SiginDropsPopupwindow
().
init
(
this
@GameActivity
,
this
@GameActivity
)
...
...
@@ -856,6 +863,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
//关闭view
callUnity
(
"TitleView"
,
"getHomeInfo"
,
""
)
}
fun
getUserInfo
()
{
EventUtils
.
onEvent
(
"SplashPresenter_getUserInfo"
)
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() {
//第一步初始化 application
AppliContext
.
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
AdManager
.
init
(
//替换id
this
,
ZXADConfig
.
csjId
(
"5113760"
)
.
gdtId
(
"1111127526"
)
// .bdId("ba584026")
.
signMob
(
"6066"
,
"f81de7f854836db4"
)
.
ksId
(
"533500009"
)
.
ylbId
(
"10000160"
)
.
rsId
(
"31140"
)
.
Build
()
);
AdManager
.
init
(
this
)
// AdManager.init(//替换id
// this, ZXADConfig
// .csjId("5113760")
// .gdtId("1111127526")
//// .bdId("ba584026")
// .signMob("6066", "f81de7f854836db4")
// .ksId("533500009")
// .ylbId("10000160")
// .rsId("31140")
// .Build()
// );
//TODO Android 9及以上必须设置 (聚合快手时必须添加)
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
// val processName = Application.getProcessName()
...
...
library/build.gradle
View file @
b5f61ae7
...
...
@@ -92,7 +92,7 @@ dependencies {
api
'com.tencent.bugly:crashreport: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:
'inlandg'
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 {
@JavascriptInterface
fun
showWithdrawSucces
(
cashStr
:
String
)
{
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() {
.
titleBarTheme
(
TTAdConstant
.
TITLE_BAR_THEME_DARK
)
.
allowShowNotify
(
true
)
//是否允许sdk展示通知栏提示
.
allowShowPageWhenScreenLock
(
true
)
//是否在锁屏场景支持展示广告落地页
.
debug
(
tru
e
)
//测试阶段打开,可以通过日志排查问题,上线时去除该调用
.
debug
(
fals
e
)
//测试阶段打开,可以通过日志排查问题,上线时去除该调用
.
directDownloadNetworkType
(
TTAdConstant
.
NETWORK_STATE_WIFI
,
TTAdConstant
.
NETWORK_STATE_3G
...
...
library/src/main/java/com/ym/library/bd/BDADUtils.kt
View file @
b5f61ae7
...
...
@@ -46,6 +46,7 @@ object BDADUtils {
}
override
fun
onAdFailed
(
arg0
:
String
)
{
EventUtils
.
onEventPullFail
(
newsEntity
)
Log
.
d
(
TAG
,
"百度 开屏 onAdFailed"
+
arg0
)
zxadListener
?.
onAdSkip
()
...
...
@@ -91,6 +92,7 @@ object BDADUtils {
var
mInterAd
=
InterstitialAd
(
activity
,
newsEntity
.
codeId
)
mInterAd
.
setListener
(
object
:
InterstitialAdListener
{
override
fun
onAdFailed
(
p0
:
String
?)
{
EventUtils
.
onEventShowFail
(
newsEntity
)
callback
.
onAdFail
()
}
...
...
@@ -132,6 +134,7 @@ object BDADUtils {
activity
,
newsEntity
.
codeId
,
object
:
RewardVideoAd
.
RewardVideoAdListener
{
override
fun
onAdFailed
(
p0
:
String
?)
{
EventUtils
.
onEventPullFail
(
newsEntity
)
callback
.
onAdFail
()
listener
.
onError
()
}
...
...
@@ -163,16 +166,23 @@ object BDADUtils {
},
true
)
mRewardVideoAd
.
load
()
var
startTime
=
System
.
currentTimeMillis
()
val
handler
=
object
:
Handler
()
{
override
fun
handleMessage
(
msg
:
Message
)
{
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
)
}
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 {
.
build
()
mTTAdNative
?.
loadSplashAd
(
adSlot
,
object
:
TTAdNative
.
SplashAdListener
{
override
fun
onError
(
i
:
Int
,
s
:
String
)
{
EventUtils
.
onEventPullFail
(
data
)
zxadListener
.
onErrorResult
(
s
)
zxadCallback
.
onAdFail
()
Log
.
d
(
TAG
,
"穿山甲 开屏 onError s="
+
s
)
}
override
fun
onTimeout
()
{
EventUtils
.
onEventShowFail
(
data
)
zxadListener
.
onTimeout
()
zxadCallback
.
onAdFail
()
Log
.
d
(
TAG
,
"穿山甲 开屏 onTimeout"
)
}
override
fun
onSplashAdLoad
(
ad
:
TTSplashAd
)
{
EventUtils
.
onEventPullSuccess
(
data
)
zxadCallback
.
onAdSuccess
()
zxadListener
.
onSplashAdLoad
(
ad
)
val
view
=
ad
.
splashView
...
...
@@ -234,14 +237,16 @@ object TTADUtils {
zxadExpressListener
.
onNativeExpressAdLoad
(
p0
)
if
(
p0
==
null
)
{
EventUtils
.
onEventPullFail
(
newsEntity
)
callback
.
onAdFail
()
return
}
if
(
p0
.
isEmpty
())
{
EventUtils
.
onEventPullFail
(
newsEntity
)
callback
.
onAdFail
()
return
}
EventUtils
.
onEventPullSuccess
(
newsEntity
)
val
mTTAd
=
p0
[
0
]
bindAdListener
(
newsEntity
,
mTTAd
,
zxadExpressListener
,
container
,
callback
)
startTime
=
System
.
currentTimeMillis
()
...
...
@@ -250,6 +255,7 @@ object TTADUtils {
}
override
fun
onError
(
p0
:
Int
,
p1
:
String
?)
{
EventUtils
.
onEventShowFail
(
newsEntity
)
// Toast.makeText(activity, p1, Toast.LENGTH_SHORT).show()
zxadExpressListener
.
onError
(
p1
)
...
...
@@ -297,6 +303,7 @@ object TTADUtils {
msg
:
String
,
code
:
Int
)
{
EventUtils
.
onEventShowFail
(
entity
)
Log
.
e
(
TAG
,
"穿山甲 大图 render fail:"
+
(
System
.
currentTimeMillis
()
-
startTime
))
// TToast.show(mContext, "$msg code:$code")
...
...
@@ -463,6 +470,7 @@ object TTADUtils {
mTTAdNative
.
loadRewardVideoAd
(
adSlot
,
object
:
RewardVideoAdListener
{
override
fun
onError
(
code
:
Int
,
message
:
String
)
{
EventUtils
.
onEventPullFail
(
entity
)
listener
.
onError
()
callback
.
onAdFail
()
}
...
...
@@ -474,6 +482,8 @@ object TTADUtils {
//视频广告素材加载到,如title,视频url等,不包括视频文件
override
fun
onRewardVideoAdLoad
(
ad
:
TTRewardVideoAd
)
{
EventUtils
.
onEventPullSuccess
(
entity
)
callback
.
onAdSuccess
()
var
mttRewardVideoAd
=
ad
...
...
@@ -502,7 +512,7 @@ object TTADUtils {
override
fun
onVideoError
()
{
listener
.
onVideoError
()
EventUtils
.
onEventShowFail
(
entity
)
}
override
fun
onVideoComplete
()
{
...
...
@@ -620,6 +630,7 @@ object TTADUtils {
//加载全屏视频
mTTAdNative
.
loadFullScreenVideoAd
(
adSlot
,
object
:
FullScreenVideoAdListener
{
override
fun
onError
(
code
:
Int
,
message
:
String
)
{
EventUtils
.
onEventShowFail
(
entity
)
listener
.
onError
()
}
...
...
@@ -636,6 +647,10 @@ object TTADUtils {
}
override
fun
onAdVideoBarClick
()
{
listener
.
onAdVideoBarClick
(
entity
)
EventUtils
.
onEventClick
(
entity
)
EventUtils
.
onEventUM
(
"ad_reward_video_click"
,
"穿山甲 激励视频广告"
)
}
override
fun
onAdClose
()
{
...
...
@@ -666,8 +681,8 @@ object TTADUtils {
override
fun
onDownloadActive
(
p0
:
Long
,
p1
:
Long
,
p2
:
String
?,
p3
:
String
?)
{
// AdUpload.onAdClick(entity)
EventUtils
.
onEventClick
(
entity
)
EventUtils
.
onEventUM
(
"ad_reward_video_click"
,
"穿山甲 激励视频广告"
)
//
EventUtils.onEventClick(entity)
//
EventUtils.onEventUM("ad_reward_video_click","穿山甲 激励视频广告")
}
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 {
}
override
fun
onADLoaded
(
p0
:
Long
)
{
EventUtils
.
onEventPullSuccess
(
newsEntity
)
// AdUpload.onAdImpression(newsEntity)
zxadCallback
.
onAdSuccess
()
Log
.
d
(
TAG
,
"广点通 开屏显示"
)
...
...
@@ -57,9 +58,9 @@ object GDTAdUtils {
}
override
fun
onNoAD
(
p0
:
AdError
?)
{
EventUtils
.
onEventPullFail
(
newsEntity
)
zxadListener
.
onAdTimeOver
()
skipview
?.
visibility
=
View
.
VISIBLE
zxadCallback
.
onAdFail
()
}
...
...
@@ -162,6 +163,7 @@ object GDTAdUtils {
}
override
fun
onADLoaded
(
adList
:
MutableList
<
NativeExpressADView
>?)
{
EventUtils
.
onEventPullSuccess
(
newsEntity
)
// 释放前一个 NativeExpressADView 的资源人、
// if (nativeExpressADView != null) {
// nativeExpressADView.destroy();
...
...
@@ -185,6 +187,7 @@ object GDTAdUtils {
}
override
fun
onRenderFail
(
p0
:
NativeExpressADView
?)
{
EventUtils
.
onEventShowFail
(
newsEntity
)
callback
.
onAdFail
()
}
...
...
@@ -198,6 +201,7 @@ object GDTAdUtils {
}
override
fun
onNoAD
(
p0
:
AdError
?)
{
EventUtils
.
onEventPullFail
(
newsEntity
)
callback
.
onAdFail
()
}
...
...
@@ -293,6 +297,7 @@ object GDTAdUtils {
//如果这里
override
fun
onADLoad
()
{
EventUtils
.
onEventPullSuccess
(
entity
)
adLoaded
=
true
listener
.
onRewardVideoAdLoad
()
}
...
...
@@ -303,6 +308,8 @@ object GDTAdUtils {
}
override
fun
onError
(
p0
:
AdError
?)
{
EventUtils
.
onEventPullFail
(
entity
)
listener
.
onVideoError
()
callback
.
onAdFail
()
}
...
...
library/src/main/java/com/ym/library/ks/KSADUtils.java
View file @
b5f61ae7
package
com
.
ym
.
library
.
ks
;
import
android.annotation.SuppressLint
;
import
android.app.Activity
;
import
android.os.Handler
;
import
android.os.Message
;
...
...
@@ -20,6 +21,7 @@ import androidx.fragment.app.Fragment;
import
com.bumptech.glide.Glide
;
import
com.kwad.sdk.api.KsAdSDK
;
import
com.kwad.sdk.api.KsAdVideoPlayConfig
;
import
com.kwad.sdk.api.KsAppDownloadListener
;
import
com.kwad.sdk.api.KsImage
;
import
com.kwad.sdk.api.KsLoadManager
;
...
...
@@ -69,6 +71,7 @@ public class KSADUtils {
KsAdSDK
.
getLoadManager
().
loadNativeAd
(
scene
,
new
KsLoadManager
.
NativeAdListener
()
{
@Override
public
void
onError
(
int
code
,
String
msg
)
{
EventUtils
.
INSTANCE
.
onEventPullFail
(
newsEntity
);
// ToastUtil.showToast(mContext, "广告数据请求失败" + code + msg);
container
.
setVisibility
(
View
.
GONE
);
...
...
@@ -79,8 +82,10 @@ public class KSADUtils {
public
void
onNativeAdLoad
(
@Nullable
List
<
KsNativeAd
>
adList
)
{
if
(
adList
==
null
||
adList
.
isEmpty
())
{
// ToastUtil.showToast(mContext, "广告数据为空");
EventUtils
.
INSTANCE
.
onEventPullFail
(
newsEntity
);
return
;
}
EventUtils
.
INSTANCE
.
onEventPullSuccess
(
newsEntity
);
zxadCallback
.
onAdSuccess
();
showAd
(
adList
.
get
(
0
));
}
...
...
@@ -95,6 +100,8 @@ public class KSADUtils {
KsAdSDK
.
getLoadManager
().
loadSplashScreenAd
(
scene
,
new
KsLoadManager
.
SplashScreenAdListener
()
{
@Override
public
void
onError
(
int
code
,
String
msg
)
{
EventUtils
.
INSTANCE
.
onEventPullFail
(
newsEntity
);
container
.
setVisibility
(
View
.
GONE
);
// showTips("开屏广告请求失败" + code + msg);
zxadCallback
.
onAdFail
();
...
...
@@ -105,7 +112,7 @@ public class KSADUtils {
@Override
public
void
onSplashScreenAdLoad
(
@NonNull
KsSplashScreenAd
splashScreenAd
)
{
LogUtils
.
e
(
TAG
,
"onSplashScreenAdLoad "
+
splashScreenAd
+
" "
);
EventUtils
.
INSTANCE
.
onEventPullSuccess
(
newsEntity
);
zxadCallback
.
onAdSuccess
();
container
.
setVisibility
(
View
.
VISIBLE
);
// showTips("开始数据返回成功");
...
...
@@ -123,9 +130,11 @@ public class KSADUtils {
@Override
public
void
onAdShowError
(
int
code
,
String
extra
)
{
EventUtils
.
INSTANCE
.
onEventShowFail
(
newsEntity
);
// showTips("开屏广告显示错误 " + code + " extra " + extra);
// gotoMainActivity();
zxadListener
.
onErrorResult
(
extra
);
zxadCallback
.
onAdFail
();
LogUtils
.
e
(
TAG
,
"onAdShowError"
+
code
+
" "
+
extra
);
}
...
...
@@ -136,6 +145,7 @@ public class KSADUtils {
// zxadListener.onSplashAdLoad();
LogUtils
.
e
(
TAG
,
" onAdShowEnd"
);
zxadListener
.
onAdTimeOver
();
zxadListener
.
onAdSkip
();
}
@Override
...
...
@@ -179,6 +189,7 @@ public class KSADUtils {
KsAdSDK
.
getLoadManager
().
loadRewardVideoAd
(
scene
,
new
KsLoadManager
.
RewardVideoAdListener
()
{
@Override
public
void
onError
(
int
code
,
String
msg
)
{
EventUtils
.
INSTANCE
.
onEventShowFail
(
entity
);
// ToastUtil.showToast(mContext, "激励视频广告请求失败" + code + msg);
listener
.
onVideoError
();
callback
.
onAdFail
();
...
...
@@ -239,6 +250,7 @@ public class KSADUtils {
@Override
public
void
onVideoPlayError
(
int
code
,
int
extra
)
{
EventUtils
.
INSTANCE
.
onEventShowFail
(
entity
);
// ToastUtil.showToast(mContext, "激励视频广告播放出错");
listener
.
onVideoError
();
Log
.
e
(
TAG
,
"快手 onVideoPlayError code:"
+
code
+
"msg "
+
extra
);
...
...
@@ -302,7 +314,7 @@ public class KSADUtils {
switch
(
ksNativeAd
.
getMaterialType
())
{
case
KsNativeAd
.
MaterialType
.
VIDEO
:
// 视频素材,渲染自定义的视频广告
//
adView = getVideoItemView(mNativeAdContainer, ksNativeAd);
adView
=
getVideoItemView
(
mNativeAdContainer
,
ksNativeAd
);
break
;
case
KsNativeAd
.
MaterialType
.
SINGLE_IMG
:
// 单图素材,渲染自定义的单图广告
...
...
@@ -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
)
{
View
convertView
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
native_item_single_image
,
parent
,
false
);
...
...
@@ -343,8 +430,8 @@ public class KSADUtils {
// 点击转换view的集合,传入的view点击时会触发转换操作:app下载, 打开h5页面
List
<
View
>
clickViewList
=
new
ArrayList
<>();
clickViewList
.
add
(
convertView
);
// 点击整个view都可触发转换
//
clickViewList.add(adBaseViewHolder.mAppDownloadBtn);
//
clickViewList.add(adBaseViewHolder.mH5OpenBtn);
clickViewList
.
add
(
adBaseViewHolder
.
mAppDownloadBtn
);
clickViewList
.
add
(
adBaseViewHolder
.
mH5OpenBtn
);
// 注册View的点击,点击后触发转化
ad
.
registerViewForInteraction
(
convertView
,
clickViewList
,
...
...
@@ -487,4 +574,35 @@ public class KSADUtils {
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 {
var
adType
:
Int
=
0
// 广告类型 4.大图广告 5.开屏 7.激励视频 8.全屏视频
var
clk_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
()
class
backupsEntity
{
...
...
library/src/main/java/com/ym/library/net/ZXAdApi.kt
View file @
b5f61ae7
package
com.ym.library.net
import
com.ym.library.module.AdIdConfig
import
com.ym.library.module.NewsEntity
import
io.reactivex.Observable
import
okhttp3.ResponseBody
...
...
@@ -22,4 +23,9 @@ interface ZXAdApi {
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
import
com.ym.library.module.NewsEntity
import
com.ym.library.utils.EventUtils
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.onEventShowFail
import
com.ym.library.utils.EventUtils.onEventUM
import
show.vion.cn.vlion_ad_inter.splash.SplashViewListener
import
show.vion.cn.vlion_ad_inter.video.VideoViewListener
...
...
@@ -57,20 +60,15 @@ object RSADUtils {
newsEntity
.
codeId
,
object
:
SplashViewListener
{
override
fun
onRequestSuccess
(
adId
:
String
,
viewWidth
:
Int
,
viewHeight
:
Int
)
{
onEventPullSuccess
(
newsEntity
)
zxadCallback
.
onAdSuccess
()
zxadListener
.
onSuccessResult
()
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
)
{
onEventPullFail
(
newsEntity
)
Log
.
e
(
TAG
,
"瑞狮 开屏onRequestFailed: adId:$adId,$code,$errorMsg"
)
zxadListener
.
onErrorResult
(
errorMsg
+
""
)
zxadCallback
.
onAdFail
()
...
...
@@ -84,6 +82,7 @@ object RSADUtils {
}
override
fun
onShowFailed
(
adId
:
String
,
code
:
Int
,
msg
:
String
)
{
onEventShowFail
(
newsEntity
)
Log
.
e
(
TAG
,
"瑞狮 开屏onShowFailed: adId:$adId,$code,$msg"
)
zxadListener
.
onErrorResult
(
msg
+
""
)
container
.
setVisibility
(
View
.
GONE
)
...
...
@@ -113,7 +112,7 @@ object RSADUtils {
callback
:
ZXADCallback
)
{
var
nativeManager
=
NativeManager
.
initNative
()
var
nativeManager
=
NativeManager
.
initNative
()
.
setImageAcceptedSize
(
container
.
getWidth
(),
0
)
//增加父布局
// .setNativeContainer(nativeLayout)
//7030020348049331
...
...
@@ -122,7 +121,14 @@ object RSADUtils {
override
fun
onRequestSuccess
(
adId
:
String
,
data
:
NativeFeedsData
?)
{
// nativeLayout.setVisibility(View.VISIBLE);
Log
.
e
(
TAG
,
"瑞狮 大图广告 数据获取成功 adId:$adId"
)
if
(
data
==
null
)
return
if
(
data
==
null
)
{
onEventPullFail
(
newsEntity
)
return
}
onEventPullSuccess
(
newsEntity
)
container
.
visibility
=
View
.
VISIBLE
val
view
=
data
.
nativeView
if
(
null
!=
view
)
{
...
...
@@ -147,6 +153,7 @@ object RSADUtils {
}
override
fun
onShowFailed
(
adId
:
String
,
code
:
Int
,
msg
:
String
)
{
onEventShowFail
(
newsEntity
)
Log
.
e
(
TAG
,
"瑞狮大图广告 onShowFailed :$adId++code=$code++msg=$msg"
)
container
.
visibility
=
View
.
GONE
}
...
...
@@ -163,6 +170,7 @@ object RSADUtils {
}
override
fun
onRequestFailed
(
adId
:
String
,
code
:
Int
,
message
:
String
)
{
onEventPullFail
(
newsEntity
)
Log
.
e
(
TAG
,
"瑞狮大图广告 数据加载失败 : code = $code , message = $message,adId:$adId"
)
container
.
visibility
=
View
.
GONE
callback
.
onAdFail
()
...
...
@@ -177,10 +185,11 @@ object RSADUtils {
listener
:
ZXADVideoListener
,
callback
:
ZXADCallback
)
{
var
startTime
=
System
.
currentTimeMillis
()
var
startTime
=
System
.
currentTimeMillis
()
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
().
setImageAcceptedSize
(
1080
,
1920
)
...
...
@@ -192,9 +201,10 @@ object RSADUtils {
entity
.
codeId
,
object
:
VideoViewListener
{
override
fun
onLoadVideo
(
adId
:
String
)
{
onEventPullSuccess
(
entity
)
Log
.
e
(
TAG
,
"onLoadVideo:缓存成功,可以展示 adId=$adId"
)
// if (VideoManager.getInstance().isReady) {
//展示广告
//展示广告
// adLoaded = true
// Log.e(TAG, "瑞狮 激励视频耗时" + (System.currentTimeMillis() - startTime) + "")
// VideoManager.getInstance().showVideo();
...
...
@@ -210,6 +220,7 @@ object RSADUtils {
}
override
fun
onVideoPlayFailed
(
adId
:
String
,
code
:
Int
,
msg
:
String
)
{
onEventShowFail
(
entity
)
Log
.
e
(
TAG
,
"onVideoPlayFailed:adId="
+
adId
+
"code="
+
code
+
"msg="
+
msg
)
listener
.
onError
()
}
...
...
@@ -237,6 +248,7 @@ object RSADUtils {
//广告请求失败
override
fun
onRequestFailed
(
adId
:
String
,
code
:
Int
,
errorMsg
:
String
)
{
onEventPullFail
(
entity
)
Log
.
e
(
TAG
,
"onRequestFailed:adId="
+
adId
+
"code="
+
code
+
"errorMsg="
+
errorMsg
...
...
@@ -253,24 +265,19 @@ object RSADUtils {
if
(
System
.
currentTimeMillis
()
-
startTime
>
7000
)
{
listener
.
onVideoError
()
removeCallbacksAndMessages
(
null
)
onEventPullFail
(
entity
)
return
}
if
(!
adLoaded
)
{
//广告展示检查1:广告成功加载,
sendEmptyMessageDelayed
(
1
,
20
)
if
(
VideoManager
.
getInstance
().
isReady
)
{
Log
.
e
(
TAG
,
"播放视频wxw"
)
VideoManager
.
getInstance
().
showVideo
();
removeCallbacksAndMessages
(
null
)
}
}
else
{
if
(
VideoManager
.
getInstance
().
isReady
)
{
Log
.
e
(
TAG
,
"播放视频wxw"
)
VideoManager
.
getInstance
().
showVideo
();
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
import
com.ym.library.module.NewsEntity
import
com.ym.library.utils.EventUtils
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.onEventShowFail
object
SHADUtils
{
...
...
@@ -33,6 +35,8 @@ object SHADUtils {
.
skip
(
skipView
)
.
listen
(
object
:
CoralSplashImage
.
ISplashImageListener
{
override
fun
onAdError
()
{
onEventPullFail
(
newsEntity
)
Log
.
d
(
TAG
,
"珊瑚 开屏 onAdError"
)
zxadListener
?.
onErrorResult
(
"广告拉取失败"
);
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
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.onEventPullFail
import
com.ym.library.utils.EventUtils.onEventPullSuccess
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.SettingPreference
...
...
@@ -59,7 +62,8 @@ object SMADUtils {
WindSplashAD
(
activity
,
container
,
splashAdRequest
,
object
:
WindSplashADListener
{
override
fun
onSplashAdSuccessPresentScreen
()
{
Log
.
d
(
TAG
,
"Sigmob 开屏 onSplashAdSuccessPresentScreen"
)
EventUtils
.
onEventShow
(
newsEntity
)
onEventPullSuccess
(
newsEntity
)
onEventShow
(
newsEntity
)
onEventUM
(
"ad_splash_show"
,
"Sigmob 开屏广告"
)
zxadListener
.
onAdShow
(
newsEntity
)
zxadCallback
.
onAdSuccess
()
...
...
@@ -69,7 +73,7 @@ object SMADUtils {
Log
.
d
(
TAG
,
"Sigmob 开屏 onSplashAdClicked"
)
zxadListener
.
onAdClicked
(
newsEntity
)
EventUtils
.
onEventClick
(
newsEntity
)
onEventClick
(
newsEntity
)
onEventUM
(
"ad_splash_click"
,
"Sigmob 开屏广告"
)
zxadListener
.
onAdClicked
(
newsEntity
)
}
...
...
@@ -80,6 +84,7 @@ object SMADUtils {
}
override
fun
onSplashAdFailToPresent
(
p0
:
WindAdError
?,
p1
:
String
?)
{
onEventPullFail
(
newsEntity
)
Log
.
d
(
TAG
,
"Sigmob 开屏 onSplashAdFailToPresent:errorCode:"
+
p0
?.
errorCode
+
" --- message:"
+
p1
...
...
@@ -110,12 +115,14 @@ object SMADUtils {
windRewardedVideoAd
.
setWindRewardedVideoAdListener
(
object
:
WindRewardedVideoAdListener
{
override
fun
onVideoAdPlayError
(
p0
:
WindAdError
?,
p1
:
String
?)
{
onEventShowFail
(
entity
)
listener
?.
onVideoError
()
callback
?.
onAdFail
()
Log
.
d
(
TAG
,
"Sigmob 激励 onVideoAdPlayError"
+
p0
?.
message
)
}
override
fun
onVideoAdPreLoadFail
(
p0
:
String
?)
{
onEventPullFail
(
entity
)
listener
?.
onVideoError
()
callback
?.
onAdFail
()
Log
.
d
(
TAG
,
"Sigmob 激励 onVideoAdPreLoadFail"
+
p0
)
...
...
@@ -141,6 +148,7 @@ object SMADUtils {
}
override
fun
onVideoAdLoadSuccess
(
p0
:
String
?)
{
onEventPullSuccess
(
entity
)
Log
.
d
(
TAG
,
"Sigmob 激励 onVideoAdLoadSuccess"
)
}
...
...
@@ -149,7 +157,7 @@ object SMADUtils {
override
fun
onVideoAdClicked
(
p0
:
String
?)
{
listener
?.
onVideoComplete
()
AdUpload
.
onAdClick
(
entity
)
//
AdUpload.onAdClick(entity)
onEventClick
(
entity
)
onEventUM
(
"ad_reward_video_click"
,
"Sigmob 激励视频"
)
...
...
@@ -158,6 +166,8 @@ object SMADUtils {
}
override
fun
onVideoAdLoadError
(
p0
:
WindAdError
?,
p1
:
String
?)
{
onEventPullFail
(
entity
)
listener
?.
onVideoError
()
callback
?.
onAdFail
()
}
...
...
library/src/main/java/com/ym/library/utils/CenterDialog.kt
View file @
b5f61ae7
...
...
@@ -58,9 +58,10 @@ object CenterDialog : BaseDialog() {
}
else
{
mDialog
.
setCanceledOnTouchOutside
(
true
)
}
mDialog
.
findViewById
<
ImageView
>(
R
.
id
.
id_close_update_dailog
).
setOnClickListener
(
View
.
OnClickListener
{
mDialog
?.
dismiss
()
})
mDialog
.
findViewById
<
ImageView
>(
R
.
id
.
id_close_update_dailog
)
.
setOnClickListener
(
View
.
OnClickListener
{
mDialog
?.
dismiss
()
})
mDialogView
.
findViewById
<
TextView
>(
R
.
id
.
tv_check_version_desc
).
text
=
desc
mDialogView
.
findViewById
<
TextView
>(
R
.
id
.
btn_update_start
).
setOnClickListener
{
listener
.
onClick
(
it
)
...
...
@@ -68,6 +69,38 @@ object CenterDialog : BaseDialog() {
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 {
apiClient
(
jsonObj
)
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
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
)
{
if
(
entity
?.
clk_tracking
!=
null
&&
entity
?.
clk_tracking
.
size
>
0
)
{
apiClient
(
entity
?.
clk_tracking
[
0
])
...
...
@@ -211,6 +232,7 @@ object EventUtils {
}
override
fun
onError
(
e
:
Throwable
)
{
onEventUM
(
"zxad_report_fail"
,
url
)
}
})
}
catch
(
e
:
Exception
)
{
...
...
library/src/main/java/com/ym/library/ylb/WNManager.kt
View file @
b5f61ae7
...
...
@@ -31,12 +31,14 @@ object WNManager {
WNAdSdk
.
getAdManager
()
.
loadRewardVideoAd
(
slot
,
object
:
WNRewardVideoAd
.
RewardVideoAdListener
{
override
fun
onError
(
code
:
Int
,
message
:
String
)
{
EventUtils
.
onEventPullFail
(
entity
)
listener
.
onError
()
callback
.
onAdFail
()
Log
.
i
(
"WNManager"
,
"code:${code} -- message:${message}"
)
}
override
fun
onLoad
(
ad
:
WNRewardVideoAd
)
{
EventUtils
.
onEventPullSuccess
(
entity
)
ad
.
interactionListener
=
object
:
WNRewardVideoAd
.
InteractionListener
{
override
fun
onAdShow
()
{
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