Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_goodmoney
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_goodmoney
Commits
c00e92b1
Commit
c00e92b1
authored
Jan 15, 2021
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
dbf7ee9e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
46 deletions
+45
-46
ShVideoAdManager.kt
...ain/java/com/mints/goodmoney/ad/video/ShVideoAdManager.kt
+18
-19
VideoAdingManager.java
.../java/com/mints/goodmoney/ad/video/VideoAdingManager.java
+27
-27
No files found.
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/video/
Tz
VideoAdManager.kt
→
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/video/
Sh
VideoAdManager.kt
View file @
c00e92b1
...
...
@@ -17,18 +17,18 @@ import com.tz.sdk.core.ad.ADSource
import
com.tz.sdk.core.ad.ADType
import
com.tz.sdk.core.loader.ADLoader
private
val
TAG
=
Tz
VideoAdManager
::
class
.
java
.
simpleName
private
val
TAG
=
Sh
VideoAdManager
::
class
.
java
.
simpleName
/**
* 天卓珊瑚广告视频
*/
class
Tz
VideoAdManager
private
constructor
(
activity
:
Activity
)
:
class
Sh
VideoAdManager
private
constructor
(
activity
:
Activity
)
:
BaseVideoAd
(
activity
),
VideoAdManagerView
{
private
var
isClickScreen
:
Boolean
=
true
private
var
tzVideoAdPresenter
:
TzVideoAdPresenter
?
=
null
private
var
tzVideoAdListener
:
Tz
VideoAdListener
?
=
null
private
var
shVideoAdListener
:
Sh
VideoAdListener
?
=
null
companion
object
{
...
...
@@ -40,12 +40,12 @@ class TzVideoAdManager private constructor(activity: Activity) :
const
val
TZ_REWRAD_TYPE_DEBUG
=
131
const
val
TZ_REWRAD_TYPE_RELEASE
=
104
private
var
_inst
:
Tz
VideoAdManager
?
=
null
fun
getInstance
(
activity
:
Activity
):
Tz
VideoAdManager
?
{
private
var
_inst
:
Sh
VideoAdManager
?
=
null
fun
getInstance
(
activity
:
Activity
):
Sh
VideoAdManager
?
{
return
if
(
_inst
!=
null
)
{
_inst
}
else
{
_inst
=
Tz
VideoAdManager
(
activity
)
_inst
=
Sh
VideoAdManager
(
activity
)
_inst
}
}
...
...
@@ -87,7 +87,6 @@ class TzVideoAdManager private constructor(activity: Activity) :
.
load
(
object
:
CoralVideoListener
()
{
override
fun
onAdLoaded
(
adList
:
List
<
CoralAD
>?)
{
LogUtil
.
d
(
TAG
,
"onAdLoaded"
)
// if (adList != null && adList.isNotEmpty()) {
// val ad = adList[0]
// ad.playVideo(activity)
...
...
@@ -101,8 +100,8 @@ class TzVideoAdManager private constructor(activity: Activity) :
TrackManager
.
getInstance
().
addCallImp
(
Constant
.
AD_SOURCE_SH
,
Constant
.
EVENT_TYPE_ONE
,
(
adError
.
code
).
toString
(),
""
)
if
(
tz
VideoAdListener
!=
null
)
{
tzVideoAdListener
?.
tz
VideoAdFail
()
if
(
sh
VideoAdListener
!=
null
)
{
shVideoAdListener
?.
sh
VideoAdFail
()
}
}
...
...
@@ -125,8 +124,8 @@ class TzVideoAdManager private constructor(activity: Activity) :
TrackManager
.
getInstance
().
addCallImp
(
Constant
.
AD_SOURCE_SH
,
Constant
.
EVENT_TYPE_FOUR
,
""
,
""
)
isClickScreen
=
false
}
if
(
tz
VideoAdListener
!=
null
)
{
tzVideoAdListener
?.
tz
VideoAdDownload
()
if
(
sh
VideoAdListener
!=
null
)
{
shVideoAdListener
?.
sh
VideoAdDownload
()
}
return
super
.
onAdClicked
(
ad
)
...
...
@@ -169,8 +168,8 @@ class TzVideoAdManager private constructor(activity: Activity) :
TrackManager
.
getInstance
().
addCallImp
(
Constant
.
AD_SOURCE_SH
,
Constant
.
EVENT_TYPE_THREE
,
""
,
""
)
if
(
tz
VideoAdListener
!=
null
)
{
tzVideoAdListener
?.
tz
VideoAdSuccess
()
if
(
sh
VideoAdListener
!=
null
)
{
shVideoAdListener
?.
sh
VideoAdSuccess
()
}
return
super
.
onVideoClosed
(
coralAD
,
s
)
...
...
@@ -179,14 +178,14 @@ class TzVideoAdManager private constructor(activity: Activity) :
}
fun
set
TzVideoAdListener
(
tzVideoAdListener
:
Tz
VideoAdListener
?)
{
this
.
tzVideoAdListener
=
tz
VideoAdListener
fun
set
ShVideoAdListener
(
shVideoAdListener
:
Sh
VideoAdListener
?)
{
this
.
shVideoAdListener
=
sh
VideoAdListener
}
interface
Tz
VideoAdListener
{
fun
tz
VideoAdSuccess
()
fun
tz
VideoAdFail
()
fun
tz
VideoAdDownload
()
interface
Sh
VideoAdListener
{
fun
sh
VideoAdSuccess
()
fun
sh
VideoAdFail
()
fun
sh
VideoAdDownload
()
}
override
fun
onDestroy
()
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/video/VideoAdingManager.java
View file @
c00e92b1
...
...
@@ -28,8 +28,8 @@ public class VideoAdingManager {
private
CsjVideoAdManager
csjVideoAdManager
;
private
YlhVideoAdManager
ylhVideoAdManager
;
private
MhVideoAdManager
mhVideoAdManager
;
private
TzVideoAdManager
tz
VideoAdManager
;
private
CsjFullVideoAdManager
csjFullV
edi
oAdManager
;
private
ShVideoAdManager
sh
VideoAdManager
;
private
CsjFullVideoAdManager
csjFullV
ide
oAdManager
;
private
int
wnWeight
;
private
int
ylhWeight
;
...
...
@@ -70,8 +70,8 @@ public class VideoAdingManager {
ylhVideoAdManager
=
YlhVideoAdManager
.
getInstance
(
activity
);
wnVideoAdManager
=
WnVideoAdManager
.
Companion
.
getInstance
(
activity
);
mhVideoAdManager
=
MhVideoAdManager
.
Companion
.
getInstance
(
activity
);
tzVideoAdManager
=
Tz
VideoAdManager
.
Companion
.
getInstance
(
activity
);
csjFullV
edi
oAdManager
=
CsjFullVideoAdManager
.
getInstance
(
activity
);
shVideoAdManager
=
Sh
VideoAdManager
.
Companion
.
getInstance
(
activity
);
csjFullV
ide
oAdManager
=
CsjFullVideoAdManager
.
getInstance
(
activity
);
weightList
=
new
ArrayList
<>();
}
...
...
@@ -237,7 +237,7 @@ public class VideoAdingManager {
if
(
AppConfig
.
shVideoAdCount
>
0
)
{
weightList
.
add
(
new
WeightBean
(
wnWeight
,
Constant
.
SH_VEDIO_AD
));
weight
=
weight
+
shVideoWeight
;
LogUtil
.
d
(
TAG
,
"权重值:s
dhz
Weight:"
+
shVideoWeight
);
LogUtil
.
d
(
TAG
,
"权重值:s
h
Weight:"
+
shVideoWeight
);
}
// 权重随机
...
...
@@ -310,15 +310,15 @@ public class VideoAdingManager {
mhVideoAdManager
.
onDestroy
();
mhVideoAdManager
=
null
;
}
if
(
csjFullV
edi
oAdManager
!=
null
)
{
csjFullV
edi
oAdManager
.
setCsjFullVedioAdListener
(
null
);
csjFullV
edi
oAdManager
.
onDestroy
();
csjFullV
edi
oAdManager
=
null
;
if
(
csjFullV
ide
oAdManager
!=
null
)
{
csjFullV
ide
oAdManager
.
setCsjFullVedioAdListener
(
null
);
csjFullV
ide
oAdManager
.
onDestroy
();
csjFullV
ide
oAdManager
=
null
;
}
if
(
tz
VideoAdManager
!=
null
)
{
tzVideoAdManager
.
setTz
VideoAdListener
(
null
);
tz
VideoAdManager
.
onDestroy
();
tz
VideoAdManager
=
null
;
if
(
sh
VideoAdManager
!=
null
)
{
shVideoAdManager
.
setSh
VideoAdListener
(
null
);
sh
VideoAdManager
.
onDestroy
();
sh
VideoAdManager
=
null
;
}
activity
=
null
;
...
...
@@ -485,28 +485,28 @@ public class VideoAdingManager {
mhVideoAdManager
.
loadAd
(
activity
,
bean
.
getCurCoin
(),
bean
.
getCarrierType
(),
bean
.
getExtraId
());
}
else
if
(
TextUtils
.
equals
(
videoAdType
,
Constant
.
CSJ_FULL_AD
))
{
// 穿山甲全屏广告激励视频
if
(
csjFullV
edi
oAdManager
==
null
)
{
if
(
csjFullV
ide
oAdManager
==
null
)
{
if
(
activity
==
null
)
{
if
(
videoAdingListener
!=
null
)
{
videoAdingListener
.
videoAdingListenerError
(
Constant
.
SH_VEDIO
_AD
);
videoAdingListener
.
videoAdingListenerError
(
Constant
.
CSJ_FULL
_AD
);
}
return
;
}
csjFullV
edi
oAdManager
=
CsjFullVideoAdManager
.
getInstance
(
activity
);
csjFullV
ide
oAdManager
=
CsjFullVideoAdManager
.
getInstance
(
activity
);
}
csjFullV
edi
oAdManager
.
setCsjFullVedioAdListener
(
new
CsjFullVideoAdManager
.
CsjFullVedioAdListener
()
{
csjFullV
ide
oAdManager
.
setCsjFullVedioAdListener
(
new
CsjFullVideoAdManager
.
CsjFullVedioAdListener
()
{
@Override
public
void
csjFullVedioAdSuccess
()
{
AppConfig
.
shVideoAdCount
--;
if
(
videoAdingListener
!=
null
)
{
videoAdingListener
.
videoAdingListenerSuccess
(
Constant
.
SH_VEDIO
_AD
);
videoAdingListener
.
videoAdingListenerSuccess
(
Constant
.
CSJ_FULL
_AD
);
}
}
@Override
public
void
csjFullVedioAdFail
()
{
if
(
videoAdingListener
!=
null
)
{
videoAdingListener
.
videoAdingListenerFail
(
Constant
.
SH_VEDIO
_AD
);
videoAdingListener
.
videoAdingListenerFail
(
Constant
.
CSJ_FULL
_AD
);
}
}
...
...
@@ -516,21 +516,21 @@ public class VideoAdingManager {
}
});
csjFullV
edi
oAdManager
.
loadAd
(
activity
,
bean
.
getCurCoin
(),
bean
.
getCarrierType
(),
bean
.
getExtraId
());
csjFullV
ide
oAdManager
.
loadAd
(
activity
,
bean
.
getCurCoin
(),
bean
.
getCarrierType
(),
bean
.
getExtraId
());
}
else
if
(
TextUtils
.
equals
(
videoAdType
,
Constant
.
SH_VEDIO_AD
))
{
// 珊瑚广告激励视频
if
(
tz
VideoAdManager
==
null
)
{
if
(
sh
VideoAdManager
==
null
)
{
if
(
activity
==
null
)
{
if
(
videoAdingListener
!=
null
)
{
videoAdingListener
.
videoAdingListenerError
(
Constant
.
SH_VEDIO_AD
);
}
return
;
}
tzVideoAdManager
=
Tz
VideoAdManager
.
Companion
.
getInstance
(
activity
);
shVideoAdManager
=
Sh
VideoAdManager
.
Companion
.
getInstance
(
activity
);
}
tzVideoAdManager
.
setTzVideoAdListener
(
new
TzVideoAdManager
.
Tz
VideoAdListener
()
{
shVideoAdManager
.
setShVideoAdListener
(
new
ShVideoAdManager
.
Sh
VideoAdListener
()
{
@Override
public
void
tz
VideoAdSuccess
()
{
public
void
sh
VideoAdSuccess
()
{
AppConfig
.
shVideoAdCount
--;
if
(
videoAdingListener
!=
null
)
{
videoAdingListener
.
videoAdingListenerSuccess
(
Constant
.
SH_VEDIO_AD
);
...
...
@@ -538,19 +538,19 @@ public class VideoAdingManager {
}
@Override
public
void
tz
VideoAdFail
()
{
public
void
sh
VideoAdFail
()
{
if
(
videoAdingListener
!=
null
)
{
videoAdingListener
.
videoAdingListenerFail
(
Constant
.
SH_VEDIO_AD
);
}
}
@Override
public
void
tz
VideoAdDownload
()
{
public
void
sh
VideoAdDownload
()
{
isVideoAdDownload
=
true
;
}
});
tz
VideoAdManager
.
loadAd
(
activity
,
bean
.
getCurCoin
(),
bean
.
getCarrierType
(),
bean
.
getExtraId
());
sh
VideoAdManager
.
loadAd
(
activity
,
bean
.
getCurCoin
(),
bean
.
getCarrierType
(),
bean
.
getExtraId
());
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
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