Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
X
xxsq
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
王雪伟
xxsq
Commits
d44b5e48
Commit
d44b5e48
authored
Sep 22, 2022
by
maxiaoliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改广告代码
parent
19c437cc
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
110 additions
and
58 deletions
+110
-58
AndroidManifest.xml
moduleMain/src/main/AndroidManifest.xml
+1
-1
SplashBackgroundActivity.kt
.../com/zxbw/modulemain/activity/SplashBackgroundActivity.kt
+2
-29
UserCenterFragment.kt
...n/java/com/zxbw/modulemain/fragment/UserCenterFragment.kt
+1
-1
activity_layout_splash_backound.xml
...n/src/main/res/layout/activity_layout_splash_backound.xml
+42
-0
open_ad_sdk.aar
moduleZxAd/libs/open_ad_sdk.aar
+0
-0
CSJAdManager.kt
...ZxAd/src/main/java/com/zx/ad/platform/csj/CSJAdManager.kt
+64
-27
No files found.
moduleMain/src/main/AndroidManifest.xml
View file @
d44b5e48
...
...
@@ -397,7 +397,7 @@
</activity>
<activity
android:name=
".activity.SplashBackgroundActivity"
android:
launchMode=
"singleTop
"
>
android:
screenOrientation=
"portrait
"
>
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
...
...
moduleMain/src/main/java/com/zxbw/modulemain/activity/SplashBackgroundActivity.kt
View file @
d44b5e48
...
...
@@ -8,20 +8,11 @@ import com.zx.ad.AdManager
import
com.zx.ad.callback.SplashAdListener
import
com.zxbw.modulemain.R
import
com.zxbw.modulemain.contract.SplashContract
import
com.zxbw.modulemain.presenter.SplashPresenter
import
com.zxhl.cms.common.Constant
import
com.zxhl.cms.common.NetConfig
import
com.zxhl.cms.common.base.BaseActivity
import
com.zxhl.cms.net.ApiClient
import
com.zxhl.cms.net.RxSchedulers
import
com.zxhl.cms.net.SettingPreference
import
com.zxhl.cms.net.callback.BaseObserver
import
com.zxhl.cms.net.model.box.AppInEntity
import
com.zxhl.cms.router.RounterApi
import
com.zxhl.cms.router.RounterBus
import
com.zxhl.cms.utils.EventUtils
import
com.zxhl.cms.utils.JumpUtils
import
com.zxhl.cms.widget.CenterDialog
import
kotlinx.android.synthetic.main.activity_splash.*
class
SplashBackgroundActivity
:
BaseActivity
()
{
...
...
@@ -29,16 +20,12 @@ class SplashBackgroundActivity: BaseActivity() {
override
fun
onClick
(
v
:
View
?)
{
}
override
fun
layoutID
():
Int
=
R
.
layout
.
activity_
splash
override
fun
layoutID
():
Int
=
R
.
layout
.
activity_
layout_splash_backound
private
var
mPresenter
:
SplashContract
.
Presenter
?
=
null
override
fun
init
()
{
if
(!
isTaskRoot
)
{
finish
()
return
}
initSplashAd
()
...
...
@@ -53,11 +40,10 @@ class SplashBackgroundActivity: BaseActivity() {
}
override
fun
onAdSkip
()
{
finish
()
}
override
fun
onError
(
errorMsg
:
String
?)
{
Log
.
e
(
"MXL"
,
"MSG:"
+
errorMsg
)
jumpMainPage
()
}
})
...
...
@@ -78,18 +64,5 @@ class SplashBackgroundActivity: BaseActivity() {
private
var
isPause
=
false
override
fun
onResume
()
{
super
.
onResume
()
MobclickAgent
.
onResume
(
this
)
}
override
fun
onPause
()
{
super
.
onPause
()
MobclickAgent
.
onPause
(
this
)
}
}
\ No newline at end of file
moduleMain/src/main/java/com/zxbw/modulemain/fragment/UserCenterFragment.kt
View file @
d44b5e48
moduleMain/src/main/res/layout/activity_layout_splash_backound.xml
0 → 100644
View file @
d44b5e48
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@drawable/splash_bg"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_centerHorizontal=
"true"
android:layout_marginTop=
"150dp"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@drawable/logo"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"小象省钱黑钻卡"
android:textColor=
"#FFD9C5A7"
android:layout_marginTop=
"15dp"
android:textSize=
"23sp"
android:textStyle=
"bold"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"2dp"
android:text=
"一 张 巨 省 钱 的 黑 钻 卡"
android:textSize=
"10sp"
android:textColor=
"#FFD7CDC1"
/>
</LinearLayout>
<FrameLayout
android:id=
"@+id/id_splash_view"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
</RelativeLayout>
moduleZxAd/libs/open_ad_sdk
_4.5.1.1
.aar
→
moduleZxAd/libs/open_ad_sdk.aar
View file @
d44b5e48
No preview for this file type
moduleZxAd/src/main/java/com/zx/ad/platform/csj/CSJAdManager.kt
View file @
d44b5e48
...
...
@@ -35,7 +35,7 @@ object CSJAdManager {
fun
adInit
(
context
:
Context
,
appId
:
String
,
initCallback
:
TTAdSdk
.
InitCallback
?)
{
TTAdManagerHolder
.
init
(
context
,
appId
,
initCallback
)
// TTAdManagerHolder.init(context, "5001121"
)
// TTAdManagerHolder.init(context, "5335826", initCallback
)
}
private
var
splashAd
:
TTSplashAd
?
=
null
...
...
@@ -46,6 +46,7 @@ object CSJAdManager {
fun
loadSplashAd
(
context
:
Context
,
entity
:
NewsEntity
,
loadCallBack
:
AdLoadCallBack
)
{
//本次针对穿山甲处理,当加入其它平台时需要测试未初始化的情况下,是否有error回调
if
(!
TTAdSdk
.
isInitSuccess
())
{
Log
.
e
(
"MXL"
,
"TTAdSdk.isInitSuccess"
)
adInit
(
context
,
entity
.
codeAppId
,
object
:
TTAdSdk
.
InitCallback
{
override
fun
success
()
{
loadSplashAd2
(
context
,
entity
,
loadCallBack
)
...
...
@@ -143,27 +144,34 @@ object CSJAdManager {
})
}
private
var
innterstitialAd
:
TT
Interaction
Ad
?
=
null
private
var
innterstitialAd
:
TT
FullScreenVideo
Ad
?
=
null
//加载插屏广告
fun
loadIntertialAd
(
context
:
Context
,
entity
:
NewsEntity
,
loadCallBack
:
AdLoadCallBack
)
{
mTTAdNative
=
TTAdManagerHolder
.
get
().
createAdNative
(
context
)
// val adSlot = AdSlot.Builder()
// .setCodeId("949814576")
// .setSupportDeepLink(true)
// .setAdCount(2) //请求广告数量为1到3条
// // .setExpressViewAcceptedSize(300f, 300f) //期望模板广告view的size,单位dp
// .setAdLoadType(TTAdLoadType.LOAD) //推荐使用,用于标注此次的广告请求用途为预加载(当做缓存)还是实时加载,方便后续为开发者优化相关策略
// .build()
//step4:创建广告请求参数AdSlot,具体参数含义参考文档
val
adSlot
=
AdSlot
.
Builder
()
.
setCodeId
(
entity
.
codeId
)
.
setSupportDeepLink
(
true
)
.
setAdCount
(
1
)
//请求广告数量为1到3条
//.setExpressViewAcceptedSize(300f, 300f) //期望模板广告view的size,单位dp
// .setAdLoadType(TTAdLoadType.LOAD) //推荐使用,用于标注此次的广告请求用途为预加载(当做缓存)还是实时加载,方便后续为开发者优化相关策略
.
setCodeId
(
entity
.
codeId
)
//此次加载广告的用途是实时加载,当用来作为缓存时,请使用:TTAdLoadType.PRELOAD
.
setAdLoadType
(
TTAdLoadType
.
LOAD
)
.
build
()
mTTAdNative
?.
loadFullScreenVideoAd
(
adSlot
,
object
:
TTAdNative
.
FullScreenVideoAdListener
{
mTTAdNative
?.
loadFullScreenVideoAd
(
adSlot
,
object
:
TTAdNative
.
FullScreenVideoAdListener
{
override
fun
onError
(
p0
:
Int
,
p1
:
String
?)
{
AdEventUtils
.
onEventPullFail
(
entity
)
Log
.
e
(
"MXL"
,
"CSJ Interaction Ad Fail"
+
p1
)
loadCallBack
.
OnAdLoadFail
(
"CSJ Interaction error p0:${p0} p1:${p1}"
)
}
override
fun
onFullScreenVideoAdLoad
(
p0
:
TTFullScreenVideoAd
?)
{
override
fun
onFullScreenVideoAdLoad
(
ad
:
TTFullScreenVideoAd
?)
{
AdEventUtils
.
onEventPullSuccess
(
entity
)
// innterstitialAd=p0
innterstitialAd
=
ad
loadCallBack
.
OnAdLoadSuccess
(
ADType
.
PLATFORM_AD_TT
,
entity
)
}
...
...
@@ -175,29 +183,58 @@ object CSJAdManager {
}
})
}
fun
showIntereiAd
(
context
:
Activity
,
entity
:
NewsEntity
,
listener
:
InterertionAdListener
){
if
(
innterstitialAd
==
null
){
fun
showIntereiAd
(
context
:
Activity
,
entity
:
NewsEntity
,
listener
:
InterertionAdListener
)
{
if
(
innterstitialAd
==
null
)
{
listener
.
onAdError
(
"CSJ innterstitialAd Is Null"
)
return
}
if
(!
context
.
isFinishing
)
{
innterstitialAd
?.
setAdInteractionListener
(
object
:
TTInteractionAd
.
AdInteractionListener
{
override
fun
onAdClicked
()
{
}
//step6:在获取到广告后展示
//该方法直接展示广告
//mttFullVideoAd.showFullScreenVideoAd(FullScreenVideoActivity.this);
innterstitialAd
?.
showFullScreenVideoAd
(
context
)
innterstitialAd
=
null
innterstitialAd
?.
setFullScreenVideoAdInteractionListener
(
object
:
TTFullScreenVideoAd
.
FullScreenVideoAdInteractionListener
{
override
fun
onAdShow
()
{
AdEventUtils
.
onEventShowSuccess
(
entity
)
listener
.
onAdShow
()
}
override
fun
onAdDismiss
()
{
override
fun
onAdVideoBarClick
()
{
}
override
fun
onAdClose
()
{
listener
.
onAdClose
()
}
})
override
fun
onVideoComplete
()
{
}
override
fun
onSkippedVideo
()
{
}
// override fun onAdClicked() {
//
// }
//
// override fun onAdShow() {
//
// }
//
// override fun onAdDismiss() {
//
// }
})
}
private
var
rewardVideoAd
:
TTRewardVideoAd
?
=
null
/**
...
...
@@ -211,7 +248,7 @@ object CSJAdManager {
.
setExpressViewAcceptedSize
(
500f
,
500f
)
.
setOrientation
(
TTAdConstant
.
VERTICAL
)
//必填参数,期望视频的播放方向:TTAdConstant.HORIZONTAL 或 TTAdConstant.VERTICAL
.
setAdLoadType
(
TTAdLoadType
.
UNKNOWN
)
//推荐使用,用于标注此次的广告请求用途为预加载(当做缓存)还是实时加载,方便后续为开发者优化相关策略
.
build
()
;
.
build
()
mTTAdNative
?.
loadRewardVideoAd
(
adSlot
,
object
:
TTAdNative
.
RewardVideoAdListener
{
override
fun
onError
(
p0
:
Int
,
p1
:
String
?)
{
...
...
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