Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_vedio
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
android_vedio
Commits
8175cb30
Commit
8175cb30
authored
Aug 15, 2024
by
mengcuiguang2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
ace01f89
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
295 additions
and
292 deletions
+295
-292
BannerManager.kt
...n/java/com/duben/speedplayletu/ad/banner/BannerManager.kt
+7
-7
DrawExpressManager.kt
...ava/com/duben/speedplayletu/ad/draw/DrawExpressManager.kt
+1
-1
HomeDrawExpressManager.kt
...com/duben/speedplayletu/ad/draw/HomeDrawExpressManager.kt
+1
-1
ExpressManager.kt
...java/com/duben/speedplayletu/ad/express/ExpressManager.kt
+244
-243
MainExpressManager.kt
.../com/duben/speedplayletu/ad/express/MainExpressManager.kt
+34
-32
MyExpressManager.kt
...va/com/duben/speedplayletu/ad/express/MyExpressManager.kt
+7
-7
SplashManager.kt
...n/java/com/duben/speedplayletu/ad/splash/SplashManager.kt
+1
-1
No files found.
video/app/src/main/java/com/duben/speedplayletu/ad/banner/BannerManager.kt
View file @
8175cb30
...
...
@@ -70,19 +70,19 @@ object BannerManager {
if
(
it
.
size
>
0
)
{
val
ad
:
TTNativeExpressAd
=
it
[
0
]
bannerAd
=
ad
if
(
bannerAd
!=
null
&&
bannerAd
!!
.
mediationManager
!=
null
&&
bannerAd
!!
.
mediationManager
.
showEcpm
!=
null
)
{
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"adType"
]
=
Constant
.
GRO_MORE_ADTYPE3
vo
[
"cpmFen"
]
=
bannerAd
!!
.
mediationManager
.
showEcpm
.
ecpm
TrackManager
.
getInstance
().
cmtEcpm
(
vo
)
}
bannerAd
?.
setExpressInteractionListener
(
object
:
TTNativeExpressAd
.
ExpressAdInteractionListener
{
override
fun
onAdClicked
(
view
:
View
?,
type
:
Int
)
{
}
override
fun
onAdShow
(
view
:
View
?,
type
:
Int
)
{
if
(
bannerAd
!=
null
&&
bannerAd
!!
.
mediationManager
!=
null
&&
bannerAd
!!
.
mediationManager
.
showEcpm
!=
null
&&
bannerAd
!!
.
mediationManager
.
showEcpm
.
ecpm
!=
null
)
{
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"adType"
]
=
Constant
.
GRO_MORE_ADTYPE3
vo
[
"cpmFen"
]
=
bannerAd
!!
.
mediationManager
.
showEcpm
.
ecpm
TrackManager
.
getInstance
().
cmtEcpm
(
vo
)
}
}
override
fun
onRenderFail
(
view
:
View
?,
msg
:
String
?,
code
:
Int
)
{
...
...
video/app/src/main/java/com/duben/speedplayletu/ad/draw/DrawExpressManager.kt
View file @
8175cb30
...
...
@@ -150,7 +150,7 @@ class DrawExpressManager {
private
fun
showAd
(
ttFeedAd
:
TTFeedAd
?)
{
ttFeedAd
?.
let
{
if
(
it
.
mediationManager
!=
null
&&
it
.
mediationManager
.
showEcpm
!=
null
)
{
if
(
it
.
mediationManager
!=
null
&&
it
.
mediationManager
.
showEcpm
!=
null
&&
it
.
mediationManager
.
showEcpm
.
ecpm
!=
null
)
{
val
ecpm
=
it
.
mediationManager
.
showEcpm
.
ecpm
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"adType"
]
=
Constant
.
GRO_MORE_ADTYPE4
...
...
video/app/src/main/java/com/duben/speedplayletu/ad/draw/HomeDrawExpressManager.kt
View file @
8175cb30
...
...
@@ -143,7 +143,7 @@ class HomeDrawExpressManager {
private
fun
showAd
(
ttFeedAd
:
TTFeedAd
?)
{
ttFeedAd
?.
let
{
if
(
it
.
mediationManager
!=
null
&&
it
.
mediationManager
.
showEcpm
!=
null
)
{
if
(
it
.
mediationManager
!=
null
&&
it
.
mediationManager
.
showEcpm
!=
null
&&
it
.
mediationManager
.
showEcpm
.
ecpm
!=
null
)
{
val
ecpm
=
it
.
mediationManager
.
showEcpm
.
ecpm
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"adType"
]
=
Constant
.
GRO_MORE_ADTYPE4
...
...
video/app/src/main/java/com/duben/speedplayletu/ad/express/ExpressManager.kt
View file @
8175cb30
This diff is collapsed.
Click to expand it.
video/app/src/main/java/com/duben/speedplayletu/ad/express/MainExpressManager.kt
View file @
8175cb30
...
...
@@ -13,6 +13,7 @@ import com.duben.speedplayletu.utils.ForegroundOrBackground
import
com.duben.speedplayletu.utils.LogUtil
import
com.duben.speedplayletu.utils.UIUtils
import
com.duben.speedplayletu.BuildConfig
private
val
TAG
=
MainExpressManager
::
class
.
java
.
simpleName
/**
...
...
@@ -33,21 +34,21 @@ class MainExpressManager {
val
adNativeLoader
=
TTAdSdk
.
getAdManager
().
createAdNative
(
activity
)
val
adslot
=
AdSlot
.
Builder
()
.
setCodeId
(
BuildConfig
.
GROMORE_EXPRESS_CODE
)
/**
* 注:
* 1:单位为px
* 2:如果是信息流自渲染广告,设置广告图片期望的图片宽高 ,不能为0
* 2:如果是信息流模板广告,宽度设置为希望的宽度,高度设置为0(0为高度选择自适应参数)
*/
.
setCodeId
(
BuildConfig
.
GROMORE_EXPRESS_CODE
)
/**
* 注:
* 1:单位为px
* 2:如果是信息流自渲染广告,设置广告图片期望的图片宽高 ,不能为0
* 2:如果是信息流模板广告,宽度设置为希望的宽度,高度设置为0(0为高度选择自适应参数)
*/
// .setImageAcceptedSize(
// UIUtils.getAdWidth2(MintsApplication.getContext()).toInt(),
//// UIUtils.dip2px(MintsApplication.getContext(), 192f)
// 0
// )
.
setImageAcceptedSize
(
UIUtils
.
getScreenWidth
(
activity
),
0
)
.
setAdCount
(
2
)
//请求广告数量为1到3条 (优先采用平台配置的数量)
.
build
()
.
setImageAcceptedSize
(
UIUtils
.
getScreenWidth
(
activity
),
0
)
.
setAdCount
(
2
)
//请求广告数量为1到3条 (优先采用平台配置的数量)
.
build
()
adNativeLoader
.
loadFeedAd
(
adslot
,
object
:
TTAdNative
.
FeedAdListener
{
override
fun
onError
(
p0
:
Int
,
p1
:
String
?)
{
...
...
@@ -56,8 +57,8 @@ class MainExpressManager {
override
fun
onFeedAdLoad
(
ads
:
MutableList
<
TTFeedAd
>?)
{
LogUtil
.
d
(
TAG
,
"gromore首页信息流--> 3、Gromore onAdLoaded"
TAG
,
"gromore首页信息流--> 3、Gromore onAdLoaded"
)
ads
?.
let
{
if
(
it
.
isEmpty
())
{
...
...
@@ -75,17 +76,11 @@ class MainExpressManager {
}
private
fun
showAd
(
ttNativeAd
:
TTFeedAd
?,
expressAdCallback
:
ExpressAdCallback
ttNativeAd
:
TTFeedAd
?,
expressAdCallback
:
ExpressAdCallback
)
{
ttNativeAd
?.
let
{
if
(
it
.
mediationManager
!=
null
&&
it
.
mediationManager
.
showEcpm
!=
null
)
{
val
ecpm
=
it
.
mediationManager
.
showEcpm
.
ecpm
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"adType"
]
=
Constant
.
GRO_MORE_ADTYPE1
vo
[
"cpmFen"
]
=
ecpm
TrackManager
.
getInstance
().
cmtEcpm
(
vo
)
}
if
(
it
.
mediationManager
.
isExpress
)
{
//--------------信息流模板广告渲染----------------
showExpressView
(
it
,
expressAdCallback
)
...
...
@@ -120,19 +115,19 @@ class MainExpressManager {
override
fun
onRenderSuccess
(
p0
:
View
?,
p1
:
Float
,
p2
:
Float
,
p3
:
Boolean
)
{
Log
.
i
(
TAG
,
"onRenderSuccess"
)
it
.
setDislikeCallback
(
ForegroundOrBackground
.
getTopActivity
(),
object
:
TTAdDislike
.
DislikeInteractionCallback
{
override
fun
onShow
()
{
Log
.
i
(
TAG
,
"express dislike 点击show"
)
}
object
:
TTAdDislike
.
DislikeInteractionCallback
{
override
fun
onShow
()
{
Log
.
i
(
TAG
,
"express dislike 点击show"
)
}
override
fun
onSelected
(
position
:
Int
,
value
:
String
?,
enforce
:
Boolean
)
{
Log
.
i
(
TAG
,
"express 点击 $value"
)
}
override
fun
onSelected
(
position
:
Int
,
value
:
String
?,
enforce
:
Boolean
)
{
Log
.
i
(
TAG
,
"express 点击 $value"
)
}
override
fun
onCancel
()
{
Log
.
i
(
TAG
,
"express dislike 点击了取消"
)
}
})
override
fun
onCancel
()
{
Log
.
i
(
TAG
,
"express dislike 点击了取消"
)
}
})
it
.
adView
?.
let
{
view
->
if
(
view
.
parent
!=
null
)
{
(
view
.
parent
as
ViewGroup
).
removeView
(
view
)
...
...
@@ -154,6 +149,13 @@ class MainExpressManager {
override
fun
onAdShow
()
{
Log
.
i
(
TAG
,
"onAdShow"
)
Log
.
i
(
TAG
,
"ad mediaExtraInfo ${it.mediaExtraInfo}"
)
if
(
it
.
mediationManager
!=
null
&&
it
.
mediationManager
.
showEcpm
!=
null
&&
it
.
mediationManager
.
showEcpm
.
ecpm
!=
null
)
{
val
ecpm
=
it
.
mediationManager
.
showEcpm
.
ecpm
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"adType"
]
=
Constant
.
GRO_MORE_ADTYPE1
vo
[
"cpmFen"
]
=
ecpm
TrackManager
.
getInstance
().
cmtEcpm
(
vo
)
}
}
})
...
...
video/app/src/main/java/com/duben/speedplayletu/ad/express/MyExpressManager.kt
View file @
8175cb30
...
...
@@ -118,13 +118,6 @@ class MyExpressManager {
private
fun
showAd
()
{
mTTFeedAd
?.
let
{
if
(
it
.
mediationManager
!=
null
&&
it
.
mediationManager
.
showEcpm
!=
null
)
{
val
ecpm
=
it
.
mediationManager
.
showEcpm
.
ecpm
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"adType"
]
=
Constant
.
GRO_MORE_ADTYPE1
vo
[
"cpmFen"
]
=
ecpm
TrackManager
.
getInstance
().
cmtEcpm
(
vo
)
}
if
(
it
.
mediationManager
.
isExpress
)
{
//--------------信息流模板广告渲染----------------
showExpressView
(
it
)
...
...
@@ -226,6 +219,13 @@ class MyExpressManager {
override
fun
onAdShow
()
{
Log
.
i
(
TAG
,
"onAdShow"
)
Log
.
i
(
TAG
,
"ad mediaExtraInfo ${it.mediaExtraInfo}"
)
if
(
it
.
mediationManager
!=
null
&&
it
.
mediationManager
.
showEcpm
!=
null
&&
it
.
mediationManager
.
showEcpm
.
ecpm
!=
null
)
{
val
ecpm
=
it
.
mediationManager
.
showEcpm
.
ecpm
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"adType"
]
=
Constant
.
GRO_MORE_ADTYPE1
vo
[
"cpmFen"
]
=
ecpm
TrackManager
.
getInstance
().
cmtEcpm
(
vo
)
}
}
})
...
...
video/app/src/main/java/com/duben/speedplayletu/ad/splash/SplashManager.kt
View file @
8175cb30
...
...
@@ -163,7 +163,7 @@ object SplashManager {
LogUtil
.
d
(
TAG
,
"gromore 开屏广告--> 6、onAdShow "
)
mTTSplashAd
?.
let
{
if
(
it
.
mediationManager
!=
null
&&
it
.
mediationManager
.
showEcpm
!=
null
)
{
if
(
it
.
mediationManager
!=
null
&&
it
.
mediationManager
.
showEcpm
!=
null
&&
it
.
mediationManager
.
showEcpm
.
ecpm
!=
null
)
{
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"cpmFen"
]
=
it
.
mediationManager
.
showEcpm
.
ecpm
vo
[
"adType"
]
=
Constant
.
GRO_MORE_ADTYPE0
...
...
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