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
d5433e67
Commit
d5433e67
authored
Oct 26, 2020
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
一览升级
parent
259f4d8a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
146 additions
and
87 deletions
+146
-87
build.gradle
GoodMoney/app/build.gradle
+2
-2
YlhVedioAdManager.java
...c/main/java/com/mints/goodmoney/ad/YlhVedioAdManager.java
+1
-1
SplashADActivity.kt
...java/com/mints/goodmoney/ui/activitys/SplashADActivity.kt
+3
-3
SplashYlhActivity.kt
...ava/com/mints/goodmoney/ui/activitys/SplashYlhActivity.kt
+1
-1
MainFragment.kt
...main/java/com/mints/goodmoney/ui/fragment/MainFragment.kt
+139
-80
No files found.
GoodMoney/app/build.gradle
View file @
d5433e67
...
@@ -196,11 +196,11 @@ dependencies {
...
@@ -196,11 +196,11 @@ dependencies {
// TalkingDada
// TalkingDada
implementation
files
(
'libs/SaaS_AppAnalytics_Android_SDK_V4.0.36.jar'
)
implementation
files
(
'libs/SaaS_AppAnalytics_Android_SDK_V4.0.36.jar'
)
// 一览视频
// 一览视频
implementation
(
"com.yilan.sdk:ui:2.
0.0.4
"
)
{
implementation
(
"com.yilan.sdk:ui:2.
5.0.10
"
)
{
exclude
group:
'com.yilan.sdk'
,
module:
'toutiao'
exclude
group:
'com.yilan.sdk'
,
module:
'toutiao'
exclude
group:
'com.yilan.sdk'
,
module:
'gdt'
exclude
group:
'com.yilan.sdk'
,
module:
'gdt'
}
}
implementation
"com.yilan.sdk:ad:2.
0.0.4
"
implementation
"com.yilan.sdk:ad:2.
5.0.10
"
implementation
(
'com.aliyun.ams:alicloud-android-httpdns:1.2.3@aar'
)
{
implementation
(
'com.aliyun.ams:alicloud-android-httpdns:1.2.3@aar'
)
{
transitive
true
transitive
true
}
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/YlhVedioAdManager.java
View file @
d5433e67
...
@@ -111,7 +111,7 @@ public class YlhVedioAdManager implements VedioAdManagerView {
...
@@ -111,7 +111,7 @@ public class YlhVedioAdManager implements VedioAdManagerView {
rewardVideoAD
=
null
;
rewardVideoAD
=
null
;
}
}
rewardVideoAD
=
new
RewardVideoAD
(
activity
,
ylhPostId
,
new
RewardVideoADListener
()
{
rewardVideoAD
=
new
RewardVideoAD
(
activity
,
YlhAdManager
.
YLH_AD_APPID
,
ylhPostId
,
new
RewardVideoADListener
()
{
@Override
@Override
public
void
onADLoad
()
{
//广告加载成功,可在此回调后进行广告展示,此时广告过期时间确定,可通过RewardVideoAD.getExpireTimestamp()获取
public
void
onADLoad
()
{
//广告加载成功,可在此回调后进行广告展示,此时广告过期时间确定,可通过RewardVideoAD.getExpireTimestamp()获取
try
{
try
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/SplashADActivity.kt
View file @
d5433e67
...
@@ -71,7 +71,7 @@ class SplashADActivity : BaseActivity(), SplashADListener {
...
@@ -71,7 +71,7 @@ class SplashADActivity : BaseActivity(), SplashADListener {
private
fun
fetchSplashAD
(
activity
:
Activity
,
adContainer
:
ViewGroup
?,
skipContainer
:
View
?,
private
fun
fetchSplashAD
(
activity
:
Activity
,
adContainer
:
ViewGroup
?,
skipContainer
:
View
?,
posId
:
String
,
adListener
:
SplashADListener
,
fetchDelay
:
Int
)
{
posId
:
String
,
adListener
:
SplashADListener
,
fetchDelay
:
Int
)
{
fetchSplashADTime
=
System
.
currentTimeMillis
()
fetchSplashADTime
=
System
.
currentTimeMillis
()
splashAD
=
SplashAD
(
activity
,
skipContainer
,
posId
,
adListener
,
fetchDelay
)
splashAD
=
SplashAD
(
activity
,
skipContainer
,
YlhAdManager
.
YLH_AD_APPID
,
posId
,
adListener
,
fetchDelay
)
splashAD
!!
.
fetchAndShowIn
(
adContainer
)
splashAD
!!
.
fetchAndShowIn
(
adContainer
)
}
}
...
@@ -102,8 +102,8 @@ class SplashADActivity : BaseActivity(), SplashADListener {
...
@@ -102,8 +102,8 @@ class SplashADActivity : BaseActivity(), SplashADListener {
}
}
override
fun
onADLoaded
(
expireTimestamp
:
Long
)
{
override
fun
onADLoaded
(
expireTimestamp
:
Long
)
{
Log
.
i
(
"AD_DEMO"
,
"SplashADFetch expireTimestamp: "
+
expireTimestamp
//
Log.i("AD_DEMO", "SplashADFetch expireTimestamp: " + expireTimestamp
+
", eCPMLevel = "
+
splashAD
!!
.
ecpmLevel
)
//
+ ", eCPMLevel = " + splashAD!!.ecpmLevel)
}
}
override
fun
onADDismissed
()
{
override
fun
onADDismissed
()
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/SplashYlhActivity.kt
View file @
d5433e67
...
@@ -116,7 +116,7 @@ class SplashYlhActivity : BaseActivity(), SplashADListener {
...
@@ -116,7 +116,7 @@ class SplashYlhActivity : BaseActivity(), SplashADListener {
private
fun
fetchSplashAD
(
activity
:
Activity
,
adContainer
:
ViewGroup
?,
skipContainer
:
View
?,
private
fun
fetchSplashAD
(
activity
:
Activity
,
adContainer
:
ViewGroup
?,
skipContainer
:
View
?,
posId
:
String
,
adListener
:
SplashADListener
,
fetchDelay
:
Int
)
{
posId
:
String
,
adListener
:
SplashADListener
,
fetchDelay
:
Int
)
{
fetchSplashADTime
=
System
.
currentTimeMillis
()
fetchSplashADTime
=
System
.
currentTimeMillis
()
splashAD
=
SplashAD
(
activity
,
skipContainer
,
posId
,
adListener
,
fetchDelay
)
splashAD
=
SplashAD
(
activity
,
skipContainer
,
YlhAdManager
.
YLH_AD_APPID
,
posId
,
adListener
,
fetchDelay
)
splashAD
!!
.
fetchAndShowIn
(
adContainer
)
splashAD
!!
.
fetchAndShowIn
(
adContainer
)
}
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/MainFragment.kt
View file @
d5433e67
...
@@ -22,10 +22,11 @@ import com.mints.goodmoney.ui.widgets.PowerDialog
...
@@ -22,10 +22,11 @@ import com.mints.goodmoney.ui.widgets.PowerDialog
import
com.mints.goodmoney.utils.LogUtil
import
com.mints.goodmoney.utils.LogUtil
import
com.mints.library.utils.json.JsonUtil
import
com.mints.library.utils.json.JsonUtil
import
com.yilan.sdk.player.UserCallback
import
com.yilan.sdk.player.UserCallback
import
com.yilan.sdk.player.ylplayer.callback.OnPlayerCallBack
import
com.yilan.sdk.ui.ad.entity.AdEntity
import
com.yilan.sdk.ui.ad.entity.AdEntity
import
com.yilan.sdk.ui.configs.AdVideoCallback
import
com.yilan.sdk.ui.configs.AdVideoCallback
import
com.yilan.sdk.ui.configs.LittleVideoConfig
import
com.yilan.sdk.ui.configs.LittleVideoConfig
import
com.yilan.sdk.ui.little
video.
LittleVideoFragment
import
com.yilan.sdk.ui.little
.YL
LittleVideoFragment
import
kotlinx.android.synthetic.main.fragment_main_first.*
import
kotlinx.android.synthetic.main.fragment_main_first.*
import
net.grandcentrix.tray.AppPreferences
import
net.grandcentrix.tray.AppPreferences
...
@@ -34,7 +35,7 @@ import net.grandcentrix.tray.AppPreferences
...
@@ -34,7 +35,7 @@ import net.grandcentrix.tray.AppPreferences
* 作者:孟崔广
* 作者:孟崔广
* 时间:2020/10/10 17:30
* 时间:2020/10/10 17:30
*/
*/
class
MainFragment
:
BaseFragment
(),
HomeView
,
AdVideoCallback
,
View
.
OnClickListener
{
class
MainFragment
:
BaseFragment
(),
HomeView
,
View
.
OnClickListener
,
OnPlayerCallBack
{
private
val
TAG
=
MainFragment
::
class
.
java
.
simpleName
private
val
TAG
=
MainFragment
::
class
.
java
.
simpleName
...
@@ -47,7 +48,7 @@ class MainFragment : BaseFragment(), HomeView, AdVideoCallback, View.OnClickList
...
@@ -47,7 +48,7 @@ class MainFragment : BaseFragment(), HomeView, AdVideoCallback, View.OnClickList
// 视频相关
// 视频相关
private
var
bigRewardCoin
=
0
// 大红包
private
var
bigRewardCoin
=
0
// 大红包
private
var
smallRewardCoin
=
0
// 小红包
private
var
smallRewardCoin
=
0
// 小红包
private
var
littleVideoFragment
:
LittleVideoFragment
?
=
null
private
var
littleVideoFragment
:
YL
LittleVideoFragment
?
=
null
private
val
VEDIO_MAX_COUNT
=
12
// 当前缓存视频id最大数
private
val
VEDIO_MAX_COUNT
=
12
// 当前缓存视频id最大数
private
val
vedioIdList
by
lazy
{
ArrayList
<
String
>()
}
//记录播放的视频id
private
val
vedioIdList
by
lazy
{
ArrayList
<
String
>()
}
//记录播放的视频id
private
var
isFirstLoadVedio
=
true
// 首次加载视频初始化
private
var
isFirstLoadVedio
=
true
// 首次加载视频初始化
...
@@ -126,8 +127,7 @@ class MainFragment : BaseFragment(), HomeView, AdVideoCallback, View.OnClickList
...
@@ -126,8 +127,7 @@ class MainFragment : BaseFragment(), HomeView, AdVideoCallback, View.OnClickList
super
.
onDestroy
()
super
.
onDestroy
()
cdvvYilanTime
?.
setCountDownVedioListener
(
null
)
cdvvYilanTime
?.
setCountDownVedioListener
(
null
)
littleVideoFragment
?.
setUserCallBack
(
null
)
littleVideoConfig
.
unRegisterPlayerCallback
();
littleVideoConfig
.
adVideoCallback
=
null
homePresenter
.
detachView
()
homePresenter
.
detachView
()
}
}
...
@@ -196,38 +196,6 @@ class MainFragment : BaseFragment(), HomeView, AdVideoCallback, View.OnClickList
...
@@ -196,38 +196,6 @@ class MainFragment : BaseFragment(), HomeView, AdVideoCallback, View.OnClickList
}
}
}
}
override
fun
onVideoAdPaused
(
entity
:
AdEntity
?)
{
LogUtil
.
d
(
TAG
,
"override onVideoAdPaused"
)
// pauseDownloadTime()
}
override
fun
onVideoAdComplete
(
entity
:
AdEntity
?)
{
LogUtil
.
d
(
TAG
,
"override onVideoAdComplete"
)
// addVedioIdList(entity?.reqId!!)
// pauseDownloadTime()
}
override
fun
onVideoAdStartPlay
(
entity
:
AdEntity
?)
{
LogUtil
.
d
(
TAG
,
"override onVideoAdStartPlay"
)
}
override
fun
onVideoError
(
code
:
Int
,
entity
:
AdEntity
?)
{
LogUtil
.
d
(
TAG
,
"override onVideoError"
)
LogUtil
.
d
(
"MainFragment"
,
"code:${code} entity:${entity?.toString()}"
)
// pauseDownloadTime()
}
override
fun
onVideoAdContinuePlay
(
entity
:
AdEntity
?)
{
LogUtil
.
d
(
TAG
,
"override onVideoAdContinuePlay"
)
}
override
fun
onVideoLoad
(
entity
:
AdEntity
?)
{
LogUtil
.
d
(
TAG
,
"override onVideoLoad"
)
}
private
fun
showPowerDialog
()
{
private
fun
showPowerDialog
()
{
if
(
ps
.
getBoolean
(
Constant
.
LOAN_PERMISSION_FLAG
,
true
))
{
if
(
ps
.
getBoolean
(
Constant
.
LOAN_PERMISSION_FLAG
,
true
))
{
powerDialog
()
powerDialog
()
...
@@ -238,52 +206,52 @@ class MainFragment : BaseFragment(), HomeView, AdVideoCallback, View.OnClickList
...
@@ -238,52 +206,52 @@ class MainFragment : BaseFragment(), HomeView, AdVideoCallback, View.OnClickList
* 一览视频初始化
* 一览视频初始化
*/
*/
private
fun
showLittle
()
{
private
fun
showLittle
()
{
littleVideoConfig
.
adVideoCallback
=
this
val
transaction
:
FragmentTransaction
=
supportFragmentManager
.
beginTransaction
()
val
transaction
:
FragmentTransaction
=
supportFragmentManager
.
beginTransaction
()
if
(
littleVideoFragment
==
null
)
{
if
(
littleVideoFragment
==
null
)
{
littleVideoFragment
=
LittleVideoFragment
.
newInstance
()
littleVideoFragment
=
YLLittleVideoFragment
.
newInstance
()
transaction
.
add
(
R
.
id
.
yilan_fragment_frame_container
,
littleVideoFragment
!!
,
LittleVideoFragment
::
class
.
java
.
simpleName
)
transaction
.
add
(
R
.
id
.
yilan_fragment_frame_container
,
littleVideoFragment
!!
,
YLLittleVideoFragment
::
class
.
java
.
simpleName
)
littleVideoConfig
.
registerPlayerCallBack
(
this
)
// 设置点击的item播放状态,callback返回true标识用户已经处理了event,返回false,标识使用播放器内部逻辑处理event。
// 设置点击的item播放状态,callback返回true标识用户已经处理了event,返回false,标识使用播放器内部逻辑处理event。
littleVideoFragment
!!
.
setUserCallBack
(
UserCallb
ack
{
type
,
data
,
playerHash
->
//播放状态 type
// LittleVideoConfig.getInstance().registerPlayerCallBack(OnPlayerCallB
ack { type, data, playerHash -> //播放状态 type
//播放的数据,可能为null data
//
//播放的数据,可能为null data
//哪个播放器ß playerHash
//
//哪个播放器ß playerHash
when
(
type
)
{
//
when (type) {
com
.
yilan
.
sdk
.
player
.
utils
.
Constant
.
STATE_PREPARED
->
{
//
com.yilan.sdk.player.utils.Constant.STATE_PREPARED -> {
LogUtil
.
d
(
TAG
,
"type STATE_PREPARED"
)
//
LogUtil.d(TAG, "type STATE_PREPARED")
//
// 防止网络异常时, 第一次加载倒计时红包
//
// 防止网络异常时, 第一次加载倒计时红包
if
(
isFirstLoadVedio
)
{
//
if (isFirstLoadVedio) {
isFirstLoadVedio
=
false
//
isFirstLoadVedio = false
initTimeview
()
//
initTimeview()
}
//
}
//
vedioId
=
data
.
videoId
//
vedioId = data.videoId
}
//
}
com
.
yilan
.
sdk
.
player
.
utils
.
Constant
.
STATE_ERROR
->
{
//
com.yilan.sdk.player.utils.Constant.STATE_ERROR -> {
LogUtil
.
d
(
TAG
,
"type STATE_ERROR"
)
//
LogUtil.d(TAG, "type STATE_ERROR")
//
pauseDownloadTime
()
//
pauseDownloadTime()
}
//
}
com
.
yilan
.
sdk
.
player
.
utils
.
Constant
.
STATE_PLAYING
->
{
//
com.yilan.sdk.player.utils.Constant.STATE_PLAYING -> {
LogUtil
.
d
(
TAG
,
"type STATE_PLAYING"
)
//
LogUtil.d(TAG, "type STATE_PLAYING")
//
resumeDownloadTime
(
data
.
videoId
)
//
resumeDownloadTime(data.videoId)
}
//
}
//
com
.
yilan
.
sdk
.
player
.
utils
.
Constant
.
STATE_COMPLETE
->
{
//
com.yilan.sdk.player.utils.Constant.STATE_COMPLETE -> {
LogUtil
.
d
(
TAG
,
"type STATE_COMPLETE"
)
//
LogUtil.d(TAG, "type STATE_COMPLETE")
//
addVedioIdList
(
data
.
videoId
)
//
addVedioIdList(data.videoId)
pauseDownloadTime
()
//
pauseDownloadTime()
}
//
}
com
.
yilan
.
sdk
.
player
.
utils
.
Constant
.
STATE_PAUSED
->
{
//
com.yilan.sdk.player.utils.Constant.STATE_PAUSED -> {
LogUtil
.
d
(
TAG
,
"type STATE_PAUSED"
)
//
LogUtil.d(TAG, "type STATE_PAUSED")
//
pauseDownloadTime
()
//
pauseDownloadTime()
}
//
}
}
//
}
false
//
false
})
//
})
}
else
{
}
else
{
transaction
.
show
(
littleVideoFragment
!!
)
transaction
.
show
(
littleVideoFragment
!!
)
}
}
...
@@ -399,4 +367,95 @@ class MainFragment : BaseFragment(), HomeView, AdVideoCallback, View.OnClickList
...
@@ -399,4 +367,95 @@ class MainFragment : BaseFragment(), HomeView, AdVideoCallback, View.OnClickList
powerDialog
!!
.
show
()
powerDialog
!!
.
show
()
}
}
/**
* 视频卡顿,开始缓冲
*
* @param videoID 视频id
* @param taskID 本次播放任务唯一标识
*/
override
fun
onStuckStart
(
pager
:
String
,
videoID
:
String
,
taskID
:
String
)
{
LogUtil
.
d
(
TAG
,
"onStuckStart --> taskID:"
+
taskID
)
}
/**
* 播放完成
*
* @param videoID 视频id
* @param taskID 本次播放任务唯一标识
*/
override
fun
onComplete
(
pager
:
String
,
videoID
:
String
,
taskID
:
String
)
{
LogUtil
.
d
(
TAG
,
"onComplete --> taskID:"
+
taskID
)
}
/**
* 继续播放
*
* @param videoID 视频id
* @param taskID 本次播放任务唯一标识
*/
override
fun
onResume
(
pager
:
String
,
videoID
:
String
,
taskID
:
String
)
{
LogUtil
.
d
(
TAG
,
"onResume --> taskID:"
+
taskID
)
}
/**
* 暂停播放
*
* @param videoID 视频id
* @param taskID 本次播放任务唯一标识
*/
override
fun
onPause
(
pager
:
String
,
videoID
:
String
,
taskID
:
String
)
{
LogUtil
.
d
(
TAG
,
"onPause --> taskID:"
+
taskID
)
}
/**
* 视频卡顿,缓冲完毕,继续播放
*
* @param videoID 视频id
* @param taskID 本次播放任务唯一标识
*/
override
fun
onStuckEnd
(
pager
:
String
,
videoID
:
String
,
taskID
:
String
)
{
LogUtil
.
d
(
TAG
,
"onStuckEnd --> taskID:"
+
taskID
)
}
/**
* 视频播放错误
*
* @param videoID 视频id
* @param taskID 本次播放任务唯一标识
*/
override
fun
onError
(
pager
:
String
,
videoID
:
String
,
taskID
:
String
)
{
LogUtil
.
d
(
TAG
,
"onError --> taskID:"
+
taskID
)
}
/**
* 在循环播放模式下,一次播放完成
*
* @param videoID 视频id
* @param taskID 本次播放任务唯一标识
* @param num 第几次循环播放
*/
override
fun
onLoopComplete
(
pager
:
String
,
videoID
:
String
,
taskID
:
String
,
num
:
Int
)
{
LogUtil
.
d
(
TAG
,
"onLoopComplete --> taskID:"
+
taskID
)
}
/**
* 开始播放
*
* @param videoID 视频id
* @param taskID 本次播放任务唯一标识
*/
override
fun
onStart
(
pager
:
String
,
videoID
:
String
,
taskID
:
String
)
{
LogUtil
.
d
(
TAG
,
"onStart --> taskID:"
+
taskID
)
}
/**
* 视频停止
*
* @param videoID 视频id
* @param taskID 本次播放任务唯一标识
*/
override
fun
onStop
(
pager
:
String
,
videoID
:
String
,
taskID
:
String
)
{
LogUtil
.
d
(
TAG
,
"onStop --> taskID:"
+
taskID
)
}
}
}
\ No newline at end of file
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