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
Show 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
...
@@ -17,18 +17,18 @@ import com.tz.sdk.core.ad.ADSource
import
com.tz.sdk.core.ad.ADType
import
com.tz.sdk.core.ad.ADType
import
com.tz.sdk.core.loader.ADLoader
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
{
BaseVideoAd
(
activity
),
VideoAdManagerView
{
private
var
isClickScreen
:
Boolean
=
true
private
var
isClickScreen
:
Boolean
=
true
private
var
tzVideoAdPresenter
:
TzVideoAdPresenter
?
=
null
private
var
tzVideoAdPresenter
:
TzVideoAdPresenter
?
=
null
private
var
tzVideoAdListener
:
Tz
VideoAdListener
?
=
null
private
var
shVideoAdListener
:
Sh
VideoAdListener
?
=
null
companion
object
{
companion
object
{
...
@@ -40,12 +40,12 @@ class TzVideoAdManager private constructor(activity: Activity) :
...
@@ -40,12 +40,12 @@ class TzVideoAdManager private constructor(activity: Activity) :
const
val
TZ_REWRAD_TYPE_DEBUG
=
131
const
val
TZ_REWRAD_TYPE_DEBUG
=
131
const
val
TZ_REWRAD_TYPE_RELEASE
=
104
const
val
TZ_REWRAD_TYPE_RELEASE
=
104
private
var
_inst
:
Tz
VideoAdManager
?
=
null
private
var
_inst
:
Sh
VideoAdManager
?
=
null
fun
getInstance
(
activity
:
Activity
):
Tz
VideoAdManager
?
{
fun
getInstance
(
activity
:
Activity
):
Sh
VideoAdManager
?
{
return
if
(
_inst
!=
null
)
{
return
if
(
_inst
!=
null
)
{
_inst
_inst
}
else
{
}
else
{
_inst
=
Tz
VideoAdManager
(
activity
)
_inst
=
Sh
VideoAdManager
(
activity
)
_inst
_inst
}
}
}
}
...
@@ -87,7 +87,6 @@ class TzVideoAdManager private constructor(activity: Activity) :
...
@@ -87,7 +87,6 @@ class TzVideoAdManager private constructor(activity: Activity) :
.
load
(
object
:
CoralVideoListener
()
{
.
load
(
object
:
CoralVideoListener
()
{
override
fun
onAdLoaded
(
adList
:
List
<
CoralAD
>?)
{
override
fun
onAdLoaded
(
adList
:
List
<
CoralAD
>?)
{
LogUtil
.
d
(
TAG
,
"onAdLoaded"
)
LogUtil
.
d
(
TAG
,
"onAdLoaded"
)
// if (adList != null && adList.isNotEmpty()) {
// if (adList != null && adList.isNotEmpty()) {
// val ad = adList[0]
// val ad = adList[0]
// ad.playVideo(activity)
// ad.playVideo(activity)
...
@@ -101,8 +100,8 @@ class TzVideoAdManager private constructor(activity: 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
(),
""
)
TrackManager
.
getInstance
().
addCallImp
(
Constant
.
AD_SOURCE_SH
,
Constant
.
EVENT_TYPE_ONE
,
(
adError
.
code
).
toString
(),
""
)
if
(
tz
VideoAdListener
!=
null
)
{
if
(
sh
VideoAdListener
!=
null
)
{
tzVideoAdListener
?.
tz
VideoAdFail
()
shVideoAdListener
?.
sh
VideoAdFail
()
}
}
}
}
...
@@ -125,8 +124,8 @@ class TzVideoAdManager private constructor(activity: Activity) :
...
@@ -125,8 +124,8 @@ class TzVideoAdManager private constructor(activity: Activity) :
TrackManager
.
getInstance
().
addCallImp
(
Constant
.
AD_SOURCE_SH
,
Constant
.
EVENT_TYPE_FOUR
,
""
,
""
)
TrackManager
.
getInstance
().
addCallImp
(
Constant
.
AD_SOURCE_SH
,
Constant
.
EVENT_TYPE_FOUR
,
""
,
""
)
isClickScreen
=
false
isClickScreen
=
false
}
}
if
(
tz
VideoAdListener
!=
null
)
{
if
(
sh
VideoAdListener
!=
null
)
{
tzVideoAdListener
?.
tz
VideoAdDownload
()
shVideoAdListener
?.
sh
VideoAdDownload
()
}
}
return
super
.
onAdClicked
(
ad
)
return
super
.
onAdClicked
(
ad
)
...
@@ -169,8 +168,8 @@ class TzVideoAdManager private constructor(activity: Activity) :
...
@@ -169,8 +168,8 @@ class TzVideoAdManager private constructor(activity: Activity) :
TrackManager
.
getInstance
().
addCallImp
(
Constant
.
AD_SOURCE_SH
,
Constant
.
EVENT_TYPE_THREE
,
""
,
""
)
TrackManager
.
getInstance
().
addCallImp
(
Constant
.
AD_SOURCE_SH
,
Constant
.
EVENT_TYPE_THREE
,
""
,
""
)
if
(
tz
VideoAdListener
!=
null
)
{
if
(
sh
VideoAdListener
!=
null
)
{
tzVideoAdListener
?.
tz
VideoAdSuccess
()
shVideoAdListener
?.
sh
VideoAdSuccess
()
}
}
return
super
.
onVideoClosed
(
coralAD
,
s
)
return
super
.
onVideoClosed
(
coralAD
,
s
)
...
@@ -179,14 +178,14 @@ class TzVideoAdManager private constructor(activity: Activity) :
...
@@ -179,14 +178,14 @@ class TzVideoAdManager private constructor(activity: Activity) :
}
}
fun
set
TzVideoAdListener
(
tzVideoAdListener
:
Tz
VideoAdListener
?)
{
fun
set
ShVideoAdListener
(
shVideoAdListener
:
Sh
VideoAdListener
?)
{
this
.
tzVideoAdListener
=
tz
VideoAdListener
this
.
shVideoAdListener
=
sh
VideoAdListener
}
}
interface
Tz
VideoAdListener
{
interface
Sh
VideoAdListener
{
fun
tz
VideoAdSuccess
()
fun
sh
VideoAdSuccess
()
fun
tz
VideoAdFail
()
fun
sh
VideoAdFail
()
fun
tz
VideoAdDownload
()
fun
sh
VideoAdDownload
()
}
}
override
fun
onDestroy
()
{
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 {
...
@@ -28,8 +28,8 @@ public class VideoAdingManager {
private
CsjVideoAdManager
csjVideoAdManager
;
private
CsjVideoAdManager
csjVideoAdManager
;
private
YlhVideoAdManager
ylhVideoAdManager
;
private
YlhVideoAdManager
ylhVideoAdManager
;
private
MhVideoAdManager
mhVideoAdManager
;
private
MhVideoAdManager
mhVideoAdManager
;
private
TzVideoAdManager
tz
VideoAdManager
;
private
ShVideoAdManager
sh
VideoAdManager
;
private
CsjFullVideoAdManager
csjFullV
edi
oAdManager
;
private
CsjFullVideoAdManager
csjFullV
ide
oAdManager
;
private
int
wnWeight
;
private
int
wnWeight
;
private
int
ylhWeight
;
private
int
ylhWeight
;
...
@@ -70,8 +70,8 @@ public class VideoAdingManager {
...
@@ -70,8 +70,8 @@ public class VideoAdingManager {
ylhVideoAdManager
=
YlhVideoAdManager
.
getInstance
(
activity
);
ylhVideoAdManager
=
YlhVideoAdManager
.
getInstance
(
activity
);
wnVideoAdManager
=
WnVideoAdManager
.
Companion
.
getInstance
(
activity
);
wnVideoAdManager
=
WnVideoAdManager
.
Companion
.
getInstance
(
activity
);
mhVideoAdManager
=
MhVideoAdManager
.
Companion
.
getInstance
(
activity
);
mhVideoAdManager
=
MhVideoAdManager
.
Companion
.
getInstance
(
activity
);
tzVideoAdManager
=
Tz
VideoAdManager
.
Companion
.
getInstance
(
activity
);
shVideoAdManager
=
Sh
VideoAdManager
.
Companion
.
getInstance
(
activity
);
csjFullV
edi
oAdManager
=
CsjFullVideoAdManager
.
getInstance
(
activity
);
csjFullV
ide
oAdManager
=
CsjFullVideoAdManager
.
getInstance
(
activity
);
weightList
=
new
ArrayList
<>();
weightList
=
new
ArrayList
<>();
}
}
...
@@ -237,7 +237,7 @@ public class VideoAdingManager {
...
@@ -237,7 +237,7 @@ public class VideoAdingManager {
if
(
AppConfig
.
shVideoAdCount
>
0
)
{
if
(
AppConfig
.
shVideoAdCount
>
0
)
{
weightList
.
add
(
new
WeightBean
(
wnWeight
,
Constant
.
SH_VEDIO_AD
));
weightList
.
add
(
new
WeightBean
(
wnWeight
,
Constant
.
SH_VEDIO_AD
));
weight
=
weight
+
shVideoWeight
;
weight
=
weight
+
shVideoWeight
;
LogUtil
.
d
(
TAG
,
"权重值:s
dhz
Weight:"
+
shVideoWeight
);
LogUtil
.
d
(
TAG
,
"权重值:s
h
Weight:"
+
shVideoWeight
);
}
}
// 权重随机
// 权重随机
...
@@ -310,15 +310,15 @@ public class VideoAdingManager {
...
@@ -310,15 +310,15 @@ public class VideoAdingManager {
mhVideoAdManager
.
onDestroy
();
mhVideoAdManager
.
onDestroy
();
mhVideoAdManager
=
null
;
mhVideoAdManager
=
null
;
}
}
if
(
csjFullV
edi
oAdManager
!=
null
)
{
if
(
csjFullV
ide
oAdManager
!=
null
)
{
csjFullV
edi
oAdManager
.
setCsjFullVedioAdListener
(
null
);
csjFullV
ide
oAdManager
.
setCsjFullVedioAdListener
(
null
);
csjFullV
edi
oAdManager
.
onDestroy
();
csjFullV
ide
oAdManager
.
onDestroy
();
csjFullV
edi
oAdManager
=
null
;
csjFullV
ide
oAdManager
=
null
;
}
}
if
(
tz
VideoAdManager
!=
null
)
{
if
(
sh
VideoAdManager
!=
null
)
{
tzVideoAdManager
.
setTz
VideoAdListener
(
null
);
shVideoAdManager
.
setSh
VideoAdListener
(
null
);
tz
VideoAdManager
.
onDestroy
();
sh
VideoAdManager
.
onDestroy
();
tz
VideoAdManager
=
null
;
sh
VideoAdManager
=
null
;
}
}
activity
=
null
;
activity
=
null
;
...
@@ -485,28 +485,28 @@ public class VideoAdingManager {
...
@@ -485,28 +485,28 @@ public class VideoAdingManager {
mhVideoAdManager
.
loadAd
(
activity
,
bean
.
getCurCoin
(),
bean
.
getCarrierType
(),
bean
.
getExtraId
());
mhVideoAdManager
.
loadAd
(
activity
,
bean
.
getCurCoin
(),
bean
.
getCarrierType
(),
bean
.
getExtraId
());
}
else
if
(
TextUtils
.
equals
(
videoAdType
,
Constant
.
CSJ_FULL_AD
))
{
}
else
if
(
TextUtils
.
equals
(
videoAdType
,
Constant
.
CSJ_FULL_AD
))
{
// 穿山甲全屏广告激励视频
// 穿山甲全屏广告激励视频
if
(
csjFullV
edi
oAdManager
==
null
)
{
if
(
csjFullV
ide
oAdManager
==
null
)
{
if
(
activity
==
null
)
{
if
(
activity
==
null
)
{
if
(
videoAdingListener
!=
null
)
{
if
(
videoAdingListener
!=
null
)
{
videoAdingListener
.
videoAdingListenerError
(
Constant
.
SH_VEDIO
_AD
);
videoAdingListener
.
videoAdingListenerError
(
Constant
.
CSJ_FULL
_AD
);
}
}
return
;
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
@Override
public
void
csjFullVedioAdSuccess
()
{
public
void
csjFullVedioAdSuccess
()
{
AppConfig
.
shVideoAdCount
--;
AppConfig
.
shVideoAdCount
--;
if
(
videoAdingListener
!=
null
)
{
if
(
videoAdingListener
!=
null
)
{
videoAdingListener
.
videoAdingListenerSuccess
(
Constant
.
SH_VEDIO
_AD
);
videoAdingListener
.
videoAdingListenerSuccess
(
Constant
.
CSJ_FULL
_AD
);
}
}
}
}
@Override
@Override
public
void
csjFullVedioAdFail
()
{
public
void
csjFullVedioAdFail
()
{
if
(
videoAdingListener
!=
null
)
{
if
(
videoAdingListener
!=
null
)
{
videoAdingListener
.
videoAdingListenerFail
(
Constant
.
SH_VEDIO
_AD
);
videoAdingListener
.
videoAdingListenerFail
(
Constant
.
CSJ_FULL
_AD
);
}
}
}
}
...
@@ -516,21 +516,21 @@ public class VideoAdingManager {
...
@@ -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
))
{
}
else
if
(
TextUtils
.
equals
(
videoAdType
,
Constant
.
SH_VEDIO_AD
))
{
// 珊瑚广告激励视频
// 珊瑚广告激励视频
if
(
tz
VideoAdManager
==
null
)
{
if
(
sh
VideoAdManager
==
null
)
{
if
(
activity
==
null
)
{
if
(
activity
==
null
)
{
if
(
videoAdingListener
!=
null
)
{
if
(
videoAdingListener
!=
null
)
{
videoAdingListener
.
videoAdingListenerError
(
Constant
.
SH_VEDIO_AD
);
videoAdingListener
.
videoAdingListenerError
(
Constant
.
SH_VEDIO_AD
);
}
}
return
;
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
@Override
public
void
tz
VideoAdSuccess
()
{
public
void
sh
VideoAdSuccess
()
{
AppConfig
.
shVideoAdCount
--;
AppConfig
.
shVideoAdCount
--;
if
(
videoAdingListener
!=
null
)
{
if
(
videoAdingListener
!=
null
)
{
videoAdingListener
.
videoAdingListenerSuccess
(
Constant
.
SH_VEDIO_AD
);
videoAdingListener
.
videoAdingListenerSuccess
(
Constant
.
SH_VEDIO_AD
);
...
@@ -538,19 +538,19 @@ public class VideoAdingManager {
...
@@ -538,19 +538,19 @@ public class VideoAdingManager {
}
}
@Override
@Override
public
void
tz
VideoAdFail
()
{
public
void
sh
VideoAdFail
()
{
if
(
videoAdingListener
!=
null
)
{
if
(
videoAdingListener
!=
null
)
{
videoAdingListener
.
videoAdingListenerFail
(
Constant
.
SH_VEDIO_AD
);
videoAdingListener
.
videoAdingListenerFail
(
Constant
.
SH_VEDIO_AD
);
}
}
}
}
@Override
@Override
public
void
tz
VideoAdDownload
()
{
public
void
sh
VideoAdDownload
()
{
isVideoAdDownload
=
true
;
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
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
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