Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_aiyuebao
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_aiyuebao
Commits
697d7183
Commit
697d7183
authored
May 20, 2021
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
146ae67c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
40 deletions
+31
-40
VideoAdingManager.java
.../java/com/wenshu/aiyuebao/ad/video/VideoAdingManager.java
+31
-40
No files found.
app/src/main/java/com/wenshu/aiyuebao/ad/video/VideoAdingManager.java
View file @
697d7183
...
...
@@ -76,7 +76,7 @@ public class VideoAdingManager {
/**
* 初始化广告manager
*
* @param activity
* @param activity
—
*/
private
void
init
(
Activity
activity
)
{
this
.
activity
=
activity
;
...
...
@@ -179,11 +179,12 @@ public class VideoAdingManager {
/**
* 根据广告优先级获取下一个
* <p>
* 穿山甲>优量汇>穿山甲全屏>快手>珊瑚>闪电盒子>枫岚(兜底)
* <p>
* 穿山甲>优量汇>快手>oneway>闪电盒子>穿山甲全屏>珊瑚>枫岚(兜底)
*/
private
String
getNextFailAdType
()
{
// 高额任务时 会为空
if
(
adList
==
null
||
currentRandomAdList
==
null
)
{
if
(
isHighWeight
||
adList
==
null
||
currentRandomAdList
==
null
)
{
return
getHighWeight
();
}
...
...
@@ -228,7 +229,6 @@ public class VideoAdingManager {
this
.
isHighWeight
=
isHighWeight
;
}
/**
* 高额任务广告类型
*
...
...
@@ -323,27 +323,28 @@ public class VideoAdingManager {
weightList
.
add
(
new
WeightBean
(
wnWeight
,
Constant
.
SDHZ_VEDIO_AD
));
weight
=
weight
+
wnWeight
;
LogUtil
.
d
(
TAG
,
"权重值:sdhzWeight:"
+
wnWeight
);
adList
.
add
(
"
d
"
);
adList
.
add
(
"
e
"
);
}
if
(
AppConfig
.
csjFullVedioAdCount
>
0
)
{
weightList
.
add
(
new
WeightBean
(
csjFullVideoWeight
,
Constant
.
CSJ_FULL_AD
));
weight
=
weight
+
csjFullVideoWeight
;
LogUtil
.
d
(
TAG
,
"权重值:csjFullVideoWeight:"
+
csjFullVideoWeight
);
adList
.
add
(
"
e
"
);
adList
.
add
(
"
f
"
);
}
if
(
AppConfig
.
shVideoAdCount
>
0
)
{
weightList
.
add
(
new
WeightBean
(
shVideoWeight
,
Constant
.
SH_VEDIO_AD
));
weight
=
weight
+
shVideoWeight
;
LogUtil
.
d
(
TAG
,
"权重值:shWeight:"
+
shVideoWeight
);
adList
.
add
(
"
f
"
);
adList
.
add
(
"
g
"
);
}
if
(
AppConfig
.
flVideoAdCount
>
0
)
{
weightList
.
add
(
new
WeightBean
(
flVideoWeight
,
Constant
.
FL_VEDIO_AD
));
weight
=
weight
+
flVideoWeight
;
LogUtil
.
d
(
TAG
,
"权重值:flVideoWeight:"
+
flVideoWeight
);
adList
.
add
(
"
g
"
);
adList
.
add
(
"
h
"
);
}
// 权重随机
if
(
weightList
!=
null
&&
weightList
.
size
()
>
0
&&
weight
>
0
)
{
LogUtil
.
d
(
TAG
,
"1、权重总值:"
+
weight
);
...
...
@@ -382,17 +383,11 @@ public class VideoAdingManager {
int
wnAdCount
=
AppConfig
.
wnVideoAdCount
;
int
flVideoAdCount
=
AppConfig
.
flVideoAdCount
;
int
tzVideoAdCount
=
AppConfig
.
shVideoAdCount
;
int
ksVideoAdCount
=
AppConfig
.
ksVideoAdCount
;
int
csjFullVedioAdCount
=
AppConfig
.
csjFullVedioAdCount
;
int
ksVideoAdCount
=
AppConfig
.
ksVideoAdCount
;
if
(
ylhAdCount
<=
0
&&
csjVideoAdCount
<=
0
&&
wnAdCount
<=
0
&&
flVideoAdCount
<=
0
&&
tzVideoAdCount
<=
0
&&
csjFullVedioAdCount
<=
0
&&
ksVideoAdCount
<=
0
)
{
// showToast("今日视频已看完,请明天再来吧");
if
(
ylhAdCount
<=
0
&&
csjVideoAdCount
<=
0
&&
wnAdCount
<=
0
&&
flVideoAdCount
<=
0
&&
tzVideoAdCount
<=
0
&&
csjFullVedioAdCount
<=
0
&&
ksVideoAdCount
<=
0
)
{
return
true
;
}
return
false
;
...
...
@@ -485,13 +480,6 @@ public class VideoAdingManager {
* @param bean
*/
private
void
loadAdVideo
(
String
videoAdType
,
VideoAdingBean
bean
)
{
if
(
TextUtils
.
isEmpty
(
videoAdType
))
{
if
(
videoAdingListener
!=
null
)
{
videoAdingListener
.
videoAdingListenerError
(
bean
.
getCarrierType
());
}
return
;
}
try
{
if
(
TextUtils
.
equals
(
videoAdType
,
Constant
.
YLH_VEDIO_AD
))
{
// 优量汇
...
...
@@ -763,31 +751,34 @@ public class VideoAdingManager {
}
private
String
getCode
(
String
adtype
)
{
String
code
=
"g"
;
// 穿山甲>优量汇>快手>oneway>闪电盒子>穿山甲全屏>珊瑚>枫岚(兜底)
String
code
=
"h"
;
switch
(
adtype
)
{
case
"a"
:
code
=
Constant
.
CSJ_VEDIO_AD
;
case
Constant
.
CSJ_VEDIO_AD
:
code
=
"a"
;
break
;
case
"b"
:
code
=
Constant
.
YLH_VEDIO_AD
;
case
Constant
.
YLH_VEDIO_AD
:
code
=
"b"
;
break
;
case
"c"
:
code
=
Constant
.
KS_VEDIO_AD
;
case
Constant
.
KS_VEDIO_AD
:
code
=
"c"
;
break
;
case
"d"
:
code
=
Constant
.
SDHZ_VEDIO_AD
;
case
Constant
.
SDHZ_VEDIO_AD
:
code
=
"e"
;
break
;
case
"e"
:
code
=
Constant
.
CSJ_FULL_AD
;
case
Constant
.
CSJ_FULL_AD
:
code
=
"f"
;
break
;
case
"f"
:
code
=
Constant
.
SH_VEDIO_AD
;
case
Constant
.
SH_VEDIO_AD
:
code
=
"g"
;
break
;
}
return
code
;
}
private
String
getAdtype
(
String
code
)
{
//// 穿山甲>优量汇>快手>oneway>闪电盒子>穿山甲全屏>珊瑚>枫岚(兜底)
String
adtype
=
Constant
.
FL_VEDIO_AD
;
switch
(
code
)
{
case
"a"
:
...
...
@@ -799,13 +790,13 @@ public class VideoAdingManager {
case
"c"
:
adtype
=
Constant
.
KS_VEDIO_AD
;
break
;
case
"
d
"
:
case
"
e
"
:
adtype
=
Constant
.
SDHZ_VEDIO_AD
;
break
;
case
"
e
"
:
case
"
f
"
:
adtype
=
Constant
.
CSJ_FULL_AD
;
break
;
case
"
f
"
:
case
"
g
"
:
adtype
=
Constant
.
SH_VEDIO_AD
;
break
;
}
...
...
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