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
2cb786fe
Commit
2cb786fe
authored
Sep 22, 2023
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
b589b02b
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
87 additions
and
175 deletions
+87
-175
HalfScreenManager.java
.../java/com/duben/dayplaylet/ad/half/HalfScreenManager.java
+4
-0
HalfScreenManagerNoPre.java
.../com/duben/dayplaylet/ad/half/HalfScreenManagerNoPre.java
+0
-140
AlipayAuthManager.kt
...in/java/com/duben/dayplaylet/manager/AlipayAuthManager.kt
+36
-20
UserManager.java
...c/main/java/com/duben/dayplaylet/manager/UserManager.java
+7
-1
NineActivity.kt
...in/java/com/duben/dayplaylet/ui/activitys/NineActivity.kt
+0
-1
MainFragment.kt
...ain/java/com/duben/dayplaylet/ui/fragment/MainFragment.kt
+32
-10
MusicFragment.kt
...in/java/com/duben/dayplaylet/ui/fragment/MusicFragment.kt
+2
-0
MyFragment.kt
.../main/java/com/duben/dayplaylet/ui/fragment/MyFragment.kt
+5
-2
DrawCashFragment.kt
...com/duben/dayplaylet/ui/fragment/draw/DrawCashFragment.kt
+1
-1
ic_my_avat.png
video/app/src/main/res/mipmap-xhdpi/ic_my_avat.png
+0
-0
No files found.
video/app/src/main/java/com/duben/dayplaylet/ad/half/HalfScreenManager.java
View file @
2cb786fe
...
...
@@ -177,6 +177,10 @@ public class HalfScreenManager {
vo
.
put
(
"adType"
,
Constant
.
GRO_MORE_ADTYPE3
);
TrackManager
.
getInstance
().
reporGromeEcpm
(
vo
);
}
if
(
weakActivity
.
get
()
!=
null
)
{
preLoadAd
(
weakActivity
.
get
());
}
LogUtil
.
d
(
TAG
,
"gromore预加载 插全屏广告-半屏-->onAdShow"
);
}
...
...
video/app/src/main/java/com/duben/dayplaylet/ad/half/HalfScreenManagerNoPre.java
deleted
100644 → 0
View file @
b589b02b
package
com
.
duben
.
dayplaylet
.
ad
.
half
;
import
android.app.Activity
;
import
com.bytedance.sdk.openadsdk.AdSlot
;
import
com.bytedance.sdk.openadsdk.TTAdConstant
;
import
com.bytedance.sdk.openadsdk.TTAdNative
;
import
com.bytedance.sdk.openadsdk.TTAdSdk
;
import
com.bytedance.sdk.openadsdk.TTFullScreenVideoAd
;
import
com.bytedance.sdk.openadsdk.mediation.ad.MediationAdSlot
;
import
com.duben.dayplaylet.BuildConfig
;
import
com.duben.dayplaylet.ad.AdStatusListener
;
import
com.duben.dayplaylet.common.Constant
;
import
com.duben.dayplaylet.manager.TrackManager
;
import
com.duben.dayplaylet.utils.LogUtil
;
import
java.lang.ref.WeakReference
;
import
java.util.HashMap
;
/**
* 插全屏广告实时加载-半屏-半屏
*/
public
class
HalfScreenManagerNoPre
{
private
static
final
String
TAG
=
HalfScreenManagerNoPre
.
class
.
getSimpleName
();
private
static
HalfScreenManagerNoPre
_inst
;
public
static
HalfScreenManagerNoPre
getInstance
()
{
if
(
_inst
==
null
)
{
_inst
=
new
HalfScreenManagerNoPre
();
}
return
_inst
;
}
private
HalfScreenManagerNoPre
()
{
}
private
TTFullScreenVideoAd
mTtFullScreenVideoAd
;
private
WeakReference
<
Activity
>
weakActivity
;
private
boolean
isPreLoad
=
false
;
//是否是预加载调用,需要躲避监听
private
AdStatusListener
adStatusListener
;
public
void
showAd
(
Activity
_activity
,
AdStatusListener
adStatusListener
)
{
this
.
adStatusListener
=
adStatusListener
;
this
.
weakActivity
=
new
WeakReference
(
_activity
);
TTAdNative
adNativeLoader
=
TTAdSdk
.
getAdManager
().
createAdNative
(
weakActivity
.
get
());
AdSlot
adSlot
=
new
AdSlot
.
Builder
()
.
setCodeId
(
BuildConfig
.
GROMORE_HALF_CODE
)
.
setOrientation
(
TTAdConstant
.
ORIENTATION_VERTICAL
)
.
setMediationAdSlot
(
new
MediationAdSlot
.
Builder
()
.
setMuted
(
false
)
.
setVolume
(
0.7f
)
.
setBidNotify
(
true
)
.
build
()
).
build
();
adNativeLoader
.
loadFullScreenVideoAd
(
adSlot
,
new
TTAdNative
.
FullScreenVideoAdListener
()
{
@Override
public
void
onError
(
int
i
,
String
s
)
{
LogUtil
.
d
(
TAG
,
"gromore预加载 插全屏广告实时加载-半屏--> 4、onError "
);
if
(
adStatusListener
!=
null
)
{
adStatusListener
.
adFail
();
}
}
@Override
public
void
onFullScreenVideoAdLoad
(
TTFullScreenVideoAd
ttFullScreenVideoAd
)
{
}
@Override
public
void
onFullScreenVideoCached
()
{
}
@Override
public
void
onFullScreenVideoCached
(
TTFullScreenVideoAd
ttFullScreenVideoAd
)
{
LogUtil
.
d
(
TAG
,
"gromore预加载 插全屏广告实时加载-半屏--> 4、onRewardVideoCached "
);
if
(
adStatusListener
!=
null
)
{
adStatusListener
.
adSuccess
();
}
mTtFullScreenVideoAd
=
ttFullScreenVideoAd
;
mTtFullScreenVideoAd
.
showFullScreenVideoAd
(
weakActivity
.
get
());
mTtFullScreenVideoAd
.
setFullScreenVideoAdInteractionListener
(
mTTFullScreenAdListener
);
}
});
}
private
final
TTFullScreenVideoAd
.
FullScreenVideoAdInteractionListener
mTTFullScreenAdListener
=
new
TTFullScreenVideoAd
.
FullScreenVideoAdInteractionListener
()
{
@Override
public
void
onAdShow
()
{
if
(
mTtFullScreenVideoAd
!=
null
&&
mTtFullScreenVideoAd
.
getMediationManager
().
getShowEcpm
()
!=
null
)
{
HashMap
<
String
,
Object
>
vo
=
new
HashMap
<>();
vo
.
put
(
"adcode"
,
mTtFullScreenVideoAd
.
getMediationManager
().
getShowEcpm
().
getSlotId
());
vo
.
put
(
"ecpm"
,
mTtFullScreenVideoAd
.
getMediationManager
().
getShowEcpm
().
getEcpm
());
vo
.
put
(
"adSource"
,
mTtFullScreenVideoAd
.
getMediationManager
().
getShowEcpm
().
getSdkName
());
vo
.
put
(
"adid"
,
BuildConfig
.
GROMORE_HALF_CODE
);
vo
.
put
(
"adType"
,
Constant
.
GRO_MORE_ADTYPE3
);
TrackManager
.
getInstance
().
reporGromeEcpm
(
vo
);
}
LogUtil
.
d
(
TAG
,
"gromore预加载 插全屏广告实时加载-半屏-->onAdShow"
);
}
@Override
public
void
onAdVideoBarClick
()
{
LogUtil
.
d
(
TAG
,
"gromore预加载 插全屏广告实时加载-半屏-->onAdVideoBarClick"
);
}
@Override
public
void
onAdClose
()
{
LogUtil
.
d
(
TAG
,
"gromore预加载 插全屏广告实时加载-半屏-->onAdClose"
);
//
if
(
adStatusListener
!=
null
)
{
adStatusListener
.
adClose
(
null
);
}
adStatusListener
=
null
;
}
@Override
public
void
onVideoComplete
()
{
LogUtil
.
d
(
TAG
,
"gromore预加载 插全屏广告实时加载-半屏-->onVideoComplete"
);
}
@Override
public
void
onSkippedVideo
()
{
}
};
}
video/app/src/main/java/com/duben/dayplaylet/manager/AlipayAuthManager.kt
View file @
2cb786fe
...
...
@@ -9,6 +9,7 @@ import com.alipay.sdk.app.AuthTask
import
com.duben.dayplaylet.MintsApplication
import
com.duben.dayplaylet.mvp.model.AuthResult
import
com.duben.dayplaylet.mvp.model.BaseResponse
import
com.duben.dayplaylet.utils.ToastUtil
import
com.duben.library.net.neterror.BaseSubscriber
import
com.duben.library.net.neterror.Throwable
import
java.lang.ref.WeakReference
...
...
@@ -36,6 +37,7 @@ object AlipayAuthManager {
)
{
// 获取alipay_open_id,调支付时作为参数extern_token 的value
// 传入,则支付账户为该授权账户
UserManager
.
getInstance
().
alipaySet
=
true
authListener
?.
authSuccess
()
}
else
{
// 其他状态值则为授权失败
...
...
@@ -47,10 +49,12 @@ object AlipayAuthManager {
}
}
private
fun
getAuthData
()
{
private
fun
commitAlipayAutoInfo
(
info
:
String
)
{
val
vo
=
HashMap
<
String
,
Any
>()
vo
.
put
(
""
,
info
)
val
baseApplication
=
MintsApplication
.
getContext
()
as
MintsApplication
AppHttpManager
.
getInstance
(
baseApplication
)
.
call
(
baseApplication
.
loanService
.
homeV1Types
,
.
call
(
baseApplication
.
loanService
.
cancelCollect
(
vo
)
,
object
:
BaseSubscriber
<
BaseResponse
<
Any
>>()
{
override
fun
onError
(
e
:
Throwable
)
{
...
...
@@ -58,11 +62,6 @@ object AlipayAuthManager {
override
fun
onNext
(
t
:
BaseResponse
<
Any
>)
{
if
(
t
.
status
==
200
)
{
}
else
{
}
}
})
}
...
...
@@ -70,22 +69,39 @@ object AlipayAuthManager {
/**
* 支付宝账户授权业务示例
*/
fun
authV2
(
a
uthInfo
:
String
,
a
ctivity
:
Activity
,
listener
:
AuthListener
?)
{
fun
authV2
(
activity
:
Activity
,
listener
:
AuthListener
?)
{
authListener
=
listener
val
weakReference
=
WeakReference
(
activity
)
val
authRunnable
=
Runnable
{
// 构造AuthTask 对象
val
authTask
=
AuthTask
(
weakReference
.
get
())
// 调用授权接口,获取授权结果
val
result
=
authTask
.
authV2
(
authInfo
,
true
)
val
msg
=
Message
()
msg
.
what
=
SDK_AUTH_FLAG
msg
.
obj
=
result
mHandler
.
sendMessage
(
msg
)
}
val
baseApplication
=
MintsApplication
.
getContext
()
as
MintsApplication
AppHttpManager
.
getInstance
(
baseApplication
)
.
call
(
baseApplication
.
loanService
.
homeV1Types
,
object
:
BaseSubscriber
<
BaseResponse
<
Any
>>()
{
override
fun
onError
(
e
:
Throwable
)
{
}
// 必须异步调用
val
authThread
=
Thread
(
authRunnable
)
authThread
.
start
()
override
fun
onNext
(
t
:
BaseResponse
<
Any
>)
{
if
(
t
.
status
==
200
)
{
val
authInfo
=
""
val
authRunnable
=
Runnable
{
// 构造AuthTask 对象
val
authTask
=
AuthTask
(
weakReference
.
get
())
// 调用授权接口,获取授权结果
val
result
=
authTask
.
authV2
(
authInfo
,
true
)
val
msg
=
Message
()
msg
.
what
=
SDK_AUTH_FLAG
msg
.
obj
=
result
mHandler
.
sendMessage
(
msg
)
}
// 必须异步调用
val
authThread
=
Thread
(
authRunnable
)
authThread
.
start
()
}
else
{
ToastUtil
.
show
(
MintsApplication
.
getContext
(),
t
.
message
)
}
}
})
}
private
var
authListener
:
AuthListener
?
=
null
...
...
video/app/src/main/java/com/duben/dayplaylet/manager/UserManager.java
View file @
2cb786fe
...
...
@@ -175,6 +175,13 @@ public class UserManager {
return
ps
.
getBoolean
(
ALIPAYSET
,
false
);
}
public
void
setAlipaySet
(
Boolean
flag
)
{
if
(
ps
==
null
)
{
return
;
}
ps
.
put
(
ALIPAYSET
,
flag
);
}
/**
* 获取用户登陆状态
...
...
@@ -222,7 +229,6 @@ public class UserManager {
}
public
boolean
getVipFlag
()
{
if
(
ps
==
null
)
{
return
false
;
...
...
video/app/src/main/java/com/duben/dayplaylet/ui/activitys/NineActivity.kt
View file @
2cb786fe
...
...
@@ -17,7 +17,6 @@ import com.duben.dayplaylet.ad.AdManager
import
com.duben.dayplaylet.ad.AdStatusListener
import
com.duben.dayplaylet.ad.NoPreAdManager
import
com.duben.dayplaylet.ad.half.HalfScreenManager
import
com.duben.dayplaylet.ad.half.HalfScreenManagerNoPre
import
com.duben.dayplaylet.common.AppConfig
import
com.duben.dayplaylet.common.Constant
import
com.duben.dayplaylet.manager.TrackManager
...
...
video/app/src/main/java/com/duben/dayplaylet/ui/fragment/MainFragment.kt
View file @
2cb786fe
...
...
@@ -24,9 +24,11 @@ import com.duben.dayplaylet.ad.AdManager
import
com.duben.dayplaylet.ad.AdStatusListener
import
com.duben.dayplaylet.ad.NoPreAdManager
import
com.duben.dayplaylet.ad.banner.BannerManager
import
com.duben.dayplaylet.ad.express.MyExpressManager
import
com.duben.dayplaylet.ad.half.HalfScreenManager
import
com.duben.dayplaylet.common.AppConfig
import
com.duben.dayplaylet.common.Constant
import
com.duben.dayplaylet.manager.AlipayAuthManager
import
com.duben.dayplaylet.manager.LocalVedioManager
import
com.duben.dayplaylet.manager.TrackManager
import
com.duben.dayplaylet.manager.UserManager
...
...
@@ -113,6 +115,8 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
BannerManager
.
loadAd
(
requireActivity
(),
fl_main_banner
)
banner
?.
start
()
MyExpressManager
.
instance
.
preLoadAd
()
if
(
TextUtils
.
isEmpty
(
userManager
?.
userID
))
{
//获取游客登录数据
homePresenter
.
userLogin
()
...
...
@@ -502,18 +506,36 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
dialog
?.
dismiss
()
}
R
.
id
.
tv_sign_withdraw
->
{
dialog
?.
dismiss
()
userInfo
?.
let
{
if
(
it
.
isAlipaySet
)
{
dialog
?.
dismiss
()
val
bundle
=
Bundle
()
if
(
signMsg
!=
null
)
{
val
signWeekCashArr
=
signMsg
!!
.
signWeekCashArr
val
cash
=
signWeekCashArr
[
signMsg
!!
.
signDay
-
1
]
bundle
.
putString
(
LoadingActivity
.
TEXT
,
"${cash}元现金马上到账"
)
val
bundle
=
Bundle
()
if
(
signMsg
!=
null
)
{
val
signWeekCashArr
=
signMsg
!!
.
signWeekCashArr
val
cash
=
signWeekCashArr
[
signMsg
!!
.
signDay
-
1
]
bundle
.
putString
(
LoadingActivity
.
TEXT
,
"${cash}元现金马上到账"
)
}
readyGo
(
LoadingActivity
::
class
.
java
,
bundle
)
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
showAd
(
Constant
.
CARRIERTYPE_SIGN
)
},
2500
)
}
else
{
showToast
(
"发起支付宝授权.."
)
AlipayAuthManager
.
authV2
(
requireActivity
(),
object
:
AlipayAuthManager
.
AuthListener
{
override
fun
authSuccess
()
{
showToast
(
"支付宝授权成功"
)
}
override
fun
authFail
(
resultStatus
:
String
)
{
showToast
(
"支付宝授权失败"
+
resultStatus
)
}
})
}
}
readyGo
(
LoadingActivity
::
class
.
java
,
bundle
)
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
showAd
(
Constant
.
CARRIERTYPE_SIGN
)
},
2500
)
}
}
...
...
video/app/src/main/java/com/duben/dayplaylet/ui/fragment/MusicFragment.kt
View file @
2cb786fe
...
...
@@ -31,6 +31,7 @@ import com.duben.dayplaylet.R
import
com.duben.dayplaylet.ad.AdManager
import
com.duben.dayplaylet.ad.AdStatusListener
import
com.duben.dayplaylet.ad.NoPreAdManager
import
com.duben.dayplaylet.ad.express.MyExpressManager
import
com.duben.dayplaylet.ad.half.HalfScreenManager
import
com.duben.dayplaylet.common.AppConfig
import
com.duben.dayplaylet.common.Constant
...
...
@@ -113,6 +114,7 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView, View.OnClickListener {
mIDPWidget
?.
fragment
?.
onResume
()
mIDPWidget
?.
fragment
?.
userVisibleHint
=
true
MyExpressManager
.
instance
.
preLoadAd
()
musicPresenter
.
rdSongMsg
()
}
}
...
...
video/app/src/main/java/com/duben/dayplaylet/ui/fragment/MyFragment.kt
View file @
2cb786fe
...
...
@@ -9,7 +9,8 @@ import com.duben.dayplaylet.R
import
com.duben.dayplaylet.ad.AdManager
import
com.duben.dayplaylet.ad.AdStatusListener
import
com.duben.dayplaylet.ad.NoPreAdManager
import
com.duben.dayplaylet.ad.half.HalfScreenManagerNoPre
import
com.duben.dayplaylet.ad.express.MyExpressManager
import
com.duben.dayplaylet.ad.half.HalfScreenManager
import
com.duben.dayplaylet.common.AppConfig
import
com.duben.dayplaylet.common.Constant
import
com.duben.dayplaylet.manager.UserManager
...
...
@@ -91,7 +92,7 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
override
fun
onFragmentFirstVisible
()
{
super
.
onFragmentFirstVisible
()
HalfScreenManager
NoPre
.
getInstance
().
showAd
(
requireActivity
(),
null
)
HalfScreenManager
.
getInstance
().
showAd
(
requireActivity
(),
null
)
}
override
fun
onDestroy
()
{
...
...
@@ -105,6 +106,8 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
if
(
AppConfig
.
fragmentClickFlag
==
Constant
.
FRAGMENT_CLICK_FOUR
)
{
if
(
AntiShake
.
check
(
tv_my_id
?.
id
))
return
MyExpressManager
.
instance
.
preLoadAd
()
if
(!
TextUtils
.
isEmpty
(
userManager
?.
userID
))
{
myPresenter
.
getMyInfo
()
myPresenter
.
rdUserHallList
()
...
...
video/app/src/main/java/com/duben/dayplaylet/ui/fragment/draw/DrawCashFragment.kt
View file @
2cb786fe
...
...
@@ -182,7 +182,7 @@ class DrawCashFragment : LazyLoadBaseFragment(), DrawCashView, DrawCashAdapter.O
R
.
id
.
btn_draw
->
{
//1、支付渠道
if
(
TextUtils
.
equals
(
payChannel
,
WEIXIN_PAY
))
{
showToast
(
"微信支付维护中"
)
//
showToast("微信支付维护中")
return
}
...
...
video/app/src/main/res/mipmap-xhdpi/ic_my_avat.png
View replaced file @
b589b02b
View file @
2cb786fe
7.37 KB
|
W:
|
H:
9.19 KB
|
W:
|
H:
2-up
Swipe
Onion skin
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