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
6e0b7e23
Commit
6e0b7e23
authored
Jul 20, 2023
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
7f9289e1
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
84 additions
and
147 deletions
+84
-147
LocalVedioManager.kt
...ain/java/com/xinfu/helivideo/manager/LocalVedioManager.kt
+3
-10
HomePresenter.kt
.../java/com/xinfu/helivideo/mvp/presenters/HomePresenter.kt
+27
-0
TrackPresenter.java
...va/com/xinfu/helivideo/mvp/presenters/TrackPresenter.java
+2
-27
HomeView.kt
...p/src/main/java/com/xinfu/helivideo/mvp/views/HomeView.kt
+2
-0
SplashActivity.kt
...n/java/com/xinfu/helivideo/ui/activitys/SplashActivity.kt
+1
-32
SplashAdActivity.kt
...java/com/xinfu/helivideo/ui/activitys/SplashAdActivity.kt
+1
-32
VipActivity.kt
...main/java/com/xinfu/helivideo/ui/activitys/VipActivity.kt
+10
-0
MainFragment.kt
...main/java/com/xinfu/helivideo/ui/fragment/MainFragment.kt
+36
-7
DramaApiDetailActivity.kt
.../java/com/xinfu/helivideo/video/DramaApiDetailActivity.kt
+1
-20
TxVideoActivity.kt
...rc/main/java/com/xinfu/helivideo/video/TxVideoActivity.kt
+1
-19
No files found.
video/app/src/main/java/com/xinfu/helivideo/manager/LocalVedioManager.kt
View file @
6e0b7e23
...
...
@@ -86,8 +86,7 @@ object LocalVedioManager {
activity
:
Activity
,
data
:
VedioBean
?,
isPlayNext
:
Boolean
=
false
,
isThirdId
:
Boolean
=
false
,
isSplash
:
Boolean
=
false
isThirdId
:
Boolean
=
false
)
{
if
(
data
?.
createType
==
1
)
{
//自有短剧
...
...
@@ -95,17 +94,14 @@ object LocalVedioManager {
bundle
.
putString
(
Constant
.
VEDIO_BEAN
,
JsonUtil
.
toJson
(
data
))
bundle
.
putBoolean
(
Constant
.
VEDIO_NEXT
,
isPlayNext
)
bundle
.
putBoolean
(
Constant
.
VEDIO_THIRD
,
isThirdId
)
if
(
isSplash
)
{
bundle
.
putBoolean
(
Constant
.
VEDIO_SPLASH
,
true
)
}
readyGo
(
activity
,
TxVideoActivity
::
class
.
java
,
bundle
)
}
else
{
requestDrama
(
activity
,
data
,
isSplash
)
requestDrama
(
activity
,
data
)
}
}
// 请求穿山甲数据
private
fun
requestDrama
(
activity
:
Activity
,
data
:
VedioBean
?
,
isSplash
:
Boolean
)
{
private
fun
requestDrama
(
activity
:
Activity
,
data
:
VedioBean
?)
{
if
(
DPSdk
.
isStartSuccess
()
&&
data
!=
null
)
{
DPSdk
.
factory
().
requestDrama
(
arrayListOf
(
data
.
thirdId
.
toLong
()),
object
:
IDPWidgetFactory
.
DramaCallback
{
...
...
@@ -122,9 +118,6 @@ object LocalVedioManager {
//穿山甲短剧
val
bundle
=
Bundle
()
bundle
.
putString
(
Constant
.
VEDIO_BEAN
,
JsonUtil
.
toJson
(
data
))
if
(
isSplash
)
{
bundle
.
putBoolean
(
Constant
.
VEDIO_SPLASH
,
true
)
}
readyGo
(
activity
,
DramaApiDetailActivity
::
class
.
java
,
bundle
)
}
...
...
video/app/src/main/java/com/xinfu/helivideo/mvp/presenters/HomePresenter.kt
View file @
6e0b7e23
...
...
@@ -184,4 +184,31 @@ class HomePresenter : BasePresenter<HomeView>() {
}
})
}
fun
getSoltVedio
()
{
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
getSoltVedio
(),
object
:
BaseSubscriber
<
BaseResponse
<
IndexList
>>()
{
override
fun
onCompleted
()
{
if
(
isLinkView
)
return
}
override
fun
onError
(
e
:
Throwable
)
{
if
(
isLinkView
)
return
}
override
fun
onNext
(
baseResponse
:
BaseResponse
<
IndexList
>)
{
if
(
isLinkView
)
return
val
code
=
baseResponse
.
status
val
message
=
baseResponse
.
message
when
(
code
)
{
200
->
{
view
.
getSoltVedioSuc
(
baseResponse
.
data
)
}
}
}
})
}
}
\ No newline at end of file
video/app/src/main/java/com/xinfu/helivideo/mvp/presenters/TrackPresenter.java
View file @
6e0b7e23
package
com
.
xinfu
.
helivideo
.
mvp
.
presenters
;
import
android.content.Context
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.util.Log
;
import
com.google.gson.JsonObject
;
...
...
@@ -111,7 +113,6 @@ public class TrackPresenter extends BaseTrackPresenter {
switch
(
baseResponse
.
getStatus
())
{
case
200
:
{
getMyInfo
();
getSoltVedio
();
}
}
}
...
...
@@ -224,30 +225,4 @@ public class TrackPresenter extends BaseTrackPresenter {
});
}
public
void
getSoltVedio
()
{
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
getSoltVedio
(),
new
BaseSubscriber
<
BaseResponse
<
IndexList
>>()
{
@Override
public
void
onCompleted
()
{
}
@Override
public
void
onError
(
Throwable
e
)
{
}
@Override
public
void
onNext
(
BaseResponse
<
IndexList
>
baseResponse
)
{
switch
(
baseResponse
.
getStatus
())
{
case
200
:
{
IndexList
data
=
baseResponse
.
getData
();
if
(
data
!=
null
&&
data
.
getVedioMsg
()
!=
null
)
{
AppPreferencesManager
.
INSTANCE
.
get
().
put
(
Constant
.
IS_FIRST_VEDIO
,
true
);
LocalVedioManager
.
INSTANCE
.
commitVedio
(
data
.
getVedioMsg
());
}
}
}
}
});
}
}
video/app/src/main/java/com/xinfu/helivideo/mvp/views/HomeView.kt
View file @
6e0b7e23
...
...
@@ -2,10 +2,12 @@ package com.xinfu.helivideo.mvp.views
import
com.xinfu.helivideo.mvp.model.BannerList
import
com.xinfu.helivideo.mvp.model.HotStyleTypesList
import
com.xinfu.helivideo.mvp.model.IndexList
interface
HomeView
:
BaseView
{
fun
getHomeV1MsgSuc
(
data
:
HotStyleTypesList
)
fun
topTabsSuc
(
data
:
BannerList
?)
fun
ordersSuc
(
data
:
BannerList
?)
fun
getSoltVedioSuc
(
data
:
IndexList
?)
}
video/app/src/main/java/com/xinfu/helivideo/ui/activitys/SplashActivity.kt
View file @
6e0b7e23
...
...
@@ -143,38 +143,7 @@ class SplashActivity : BaseActivity() {
* 跳转到主页面
*/
private
fun
goToMainActivity
()
{
// val vipEnter = AppPreferencesManager.get().getBoolean(Constant.IS_FIRST_VIP_BTN, false)
// if ((UserManager.getInstance().newFlag && !UserManager.getInstance().vipFlag) || !vipEnter) {
val
firstVedio
=
AppPreferencesManager
.
get
().
getBoolean
(
Constant
.
IS_FIRST_VEDIO
,
false
)
if
(
firstVedio
)
{
// 匹配用户 进来后直接播放剧
AppPreferencesManager
.
get
().
put
(
Constant
.
IS_FIRST_VEDIO
,
false
)
val
cacheVedio
=
LocalVedioManager
.
getCacheVedio
()
if
(
cacheVedio
!=
null
)
{
LocalVedioManager
.
startVedioDetailActivityForType
(
this
,
cacheVedio
,
isSplash
=
true
)
}
else
{
if
(
UserManager
.
getInstance
().
newFlag
&&
!
UserManager
.
getInstance
().
vipFlag
)
{
// AppPreferencesManager.get().put(Constant.IS_FIRST_VIP_BTN, true)
// 匹配用户 且 不是vip
val
bundle
=
Bundle
()
bundle
.
putBoolean
(
VipActivity
.
IS_GUIDE
,
true
)
readyGoThenKill
(
VipActivity
::
class
.
java
,
bundle
)
}
else
{
readyGoThenKill
(
MainActivity
::
class
.
java
)
}
}
}
else
{
if
(
UserManager
.
getInstance
().
newFlag
&&
!
UserManager
.
getInstance
().
vipFlag
)
{
// AppPreferencesManager.get().put(Constant.IS_FIRST_VIP_BTN, true)
// 匹配用户 且 不是vip
val
bundle
=
Bundle
()
bundle
.
putBoolean
(
VipActivity
.
IS_GUIDE
,
true
)
readyGoThenKill
(
VipActivity
::
class
.
java
,
bundle
)
}
else
{
readyGoThenKill
(
MainActivity
::
class
.
java
)
}
}
readyGoThenKill
(
MainActivity
::
class
.
java
)
}
override
fun
onKeyDown
(
keyCode
:
Int
,
event
:
KeyEvent
):
Boolean
{
...
...
video/app/src/main/java/com/xinfu/helivideo/ui/activitys/SplashAdActivity.kt
View file @
6e0b7e23
...
...
@@ -96,38 +96,7 @@ class SplashAdActivity : BaseActivity() {
* 跳转到主页面
*/
private
fun
goToMainActivity
()
{
// val vipEnter = AppPreferencesManager.get().getBoolean(Constant.IS_FIRST_VIP_BTN, false)
// if ((UserManager.getInstance().newFlag && !UserManager.getInstance().vipFlag) || !vipEnter) {
val
firstVedio
=
AppPreferencesManager
.
get
().
getBoolean
(
Constant
.
IS_FIRST_VEDIO
,
false
)
if
(
firstVedio
)
{
// 匹配用户 进来后直接播放剧
AppPreferencesManager
.
get
().
put
(
Constant
.
IS_FIRST_VEDIO
,
false
)
val
cacheVedio
=
LocalVedioManager
.
getCacheVedio
()
if
(
cacheVedio
!=
null
)
{
LocalVedioManager
.
startVedioDetailActivityForType
(
this
,
cacheVedio
,
isSplash
=
true
)
}
else
{
if
(
UserManager
.
getInstance
().
newFlag
&&
!
UserManager
.
getInstance
().
vipFlag
)
{
// AppPreferencesManager.get().put(Constant.IS_FIRST_VIP_BTN, true)
// 匹配用户 且 不是vip
val
bundle
=
Bundle
()
bundle
.
putBoolean
(
VipActivity
.
IS_GUIDE
,
true
)
readyGoThenKill
(
VipActivity
::
class
.
java
,
bundle
)
}
else
{
readyGoThenKill
(
MainActivity
::
class
.
java
)
}
}
}
else
{
if
(
UserManager
.
getInstance
().
newFlag
&&
!
UserManager
.
getInstance
().
vipFlag
)
{
// AppPreferencesManager.get().put(Constant.IS_FIRST_VIP_BTN, true)
// 匹配用户 且 不是vip
val
bundle
=
Bundle
()
bundle
.
putBoolean
(
VipActivity
.
IS_GUIDE
,
true
)
readyGoThenKill
(
VipActivity
::
class
.
java
,
bundle
)
}
else
{
readyGoThenKill
(
MainActivity
::
class
.
java
)
}
}
readyGoThenKill
(
MainActivity
::
class
.
java
)
}
/**
...
...
video/app/src/main/java/com/xinfu/helivideo/ui/activitys/VipActivity.kt
View file @
6e0b7e23
...
...
@@ -71,6 +71,10 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, VipAdapter.On
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
activity_vip
override
fun
toggleOverridePendingTransition
()
=
true
override
fun
getOverridePendingTransitionMode
()
=
TransitionMode
.
BOTTOM
override
fun
isApplyKitKatTranslucency
()
=
false
override
fun
getBundleExtras
(
extras
:
Bundle
?)
{
...
...
@@ -93,6 +97,12 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, VipAdapter.On
initListener
()
}
override
fun
finish
()
{
super
.
finish
()
//关闭窗体动画显示
overridePendingTransition
(
0
,
R
.
anim
.
push_bottom_out
)
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
...
...
video/app/src/main/java/com/xinfu/helivideo/ui/fragment/MainFragment.kt
View file @
6e0b7e23
package
com.xinfu.helivideo.ui.fragment
import
android.os.Bundle
import
android.os.Handler
import
android.os.Looper
import
android.text.TextUtils
import
android.view.LayoutInflater
import
android.view.View
import
android.widget.ImageView
import
android.widget.TextView
import
androidx.core.content.ContextCompat
import
androidx.recyclerview.widget.LinearLayoutManager
import
com.bumptech.glide.Glide
import
com.google.android.material.tabs.TabLayout
import
com.google.android.material.tabs.TabLayoutMediator
import
com.
xinfu.library.utils.GlideUtils
import
com.
xinfu.library.utils.nodoubleclick.AntiShake
import
com.
scwang.smartrefresh.layout.api.RefreshLayout
import
com.
scwang.smartrefresh.layout.listener.OnRefreshListener
import
com.xinfu.helivideo.R
import
com.xinfu.helivideo.common.AppConfig
import
com.xinfu.helivideo.common.Constant
...
...
@@ -21,12 +22,15 @@ import com.xinfu.helivideo.manager.UserManager
import
com.xinfu.helivideo.mvp.model.*
import
com.xinfu.helivideo.mvp.presenters.HomePresenter
import
com.xinfu.helivideo.mvp.views.HomeView
import
com.xinfu.helivideo.ui.activitys.VipActivity
import
com.xinfu.helivideo.ui.adapter.HomeVideoPageAdapter
import
com.xinfu.helivideo.ui.adapter.ImageTitleAdapter
import
com.xinfu.helivideo.ui.adapter.TopAdapter
import
com.xinfu.helivideo.ui.fragment.base.LazyLoadBaseFragment
import
com.scwang.smartrefresh.layout.api.RefreshLayout
import
com.scwang.smartrefresh.layout.listener.OnRefreshListener
import
com.xinfu.helivideo.utils.AppPreferencesManager
import
com.xinfu.helivideo.utils.AppPreferencesManager.get
import
com.xinfu.library.utils.GlideUtils
import
com.xinfu.library.utils.nodoubleclick.AntiShake
import
kotlinx.android.synthetic.main.fragment_main.*
import
java.util.*
import
kotlin.concurrent.schedule
...
...
@@ -61,6 +65,24 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
initVp
()
initListener
()
loadData
()
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
goToMainActivity
()
},
300
)
}
/**
* 跳转到主页面
*/
private
fun
goToMainActivity
()
{
val
firstVedio
=
AppPreferencesManager
.
get
().
getBoolean
(
Constant
.
IS_FIRST_VEDIO
,
false
)
if
(
firstVedio
)
{
if
(
UserManager
.
getInstance
().
newFlag
&&
!
UserManager
.
getInstance
().
vipFlag
)
{
readyGo
(
VipActivity
::
class
.
java
)
}
}
else
{
homePresenter
.
getSoltVedio
()
}
}
override
fun
onDestroy
()
{
...
...
@@ -205,7 +227,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
fun
setWatchingStatus
()
{
if
(
LocalVedioManager
.
isCacheVedio
())
{
ll_main_watching_root
.
visibility
=
View
.
VISIBLE
ll_main_watching_root
.
setOnClickListener
{
}
ll_main_watching_root
.
setOnClickListener
{
}
val
cacheVedio
=
LocalVedioManager
.
getCacheVedio
()
if
(
cacheVedio
!=
null
)
{
GlideUtils
.
loadImageViewGifForCenterCrop
(
...
...
@@ -266,6 +288,13 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
topAdapter
?.
notifyDataSetChanged
()
}
override
fun
getSoltVedioSuc
(
data
:
IndexList
?)
{
get
().
put
(
Constant
.
IS_FIRST_VEDIO
,
true
)
if
(
data
!=
null
&&
data
.
vedioMsg
!=
null
)
{
LocalVedioManager
.
startVedioDetailActivityForType
(
requireActivity
(),
data
.
vedioMsg
)
}
}
override
fun
onHiddenChanged
(
hidden
:
Boolean
)
{
super
.
onHiddenChanged
(
hidden
)
if
(
isHidden
)
{
...
...
video/app/src/main/java/com/xinfu/helivideo/video/DramaApiDetailActivity.kt
View file @
6e0b7e23
...
...
@@ -83,7 +83,6 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
private
var
isThirdId
=
false
private
var
isPlayNext
=
false
private
var
isSplashEnter
=
false
private
var
mode
=
DPDramaDetailConfig
.
SPECIFIC_DETAIL
...
...
@@ -96,7 +95,6 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
val
json
=
extras
?.
getString
(
Constant
.
VEDIO_BEAN
)
isThirdId
=
extras
?.
getBoolean
(
Constant
.
VEDIO_THIRD
,
false
)
==
true
isPlayNext
=
extras
?.
getBoolean
(
Constant
.
VEDIO_NEXT
,
false
)
==
true
isSplashEnter
=
extras
?.
getBoolean
(
Constant
.
VEDIO_SPLASH
,
false
)
==
true
mVedioBean
=
Gson
().
fromJson
(
json
,
VedioBean
::
class
.
java
)
...
...
@@ -174,11 +172,7 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
.
commit
()
leaveBtn
?.
setOnClickListener
{
if
(
isSplashEnter
)
{
readyGoThenKill
(
MainActivity
::
class
.
java
)
}
else
{
finish
()
}
finish
()
}
vipBtn
?.
setOnClickListener
{
val
bundle
=
Bundle
()
...
...
@@ -191,19 +185,6 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
isInited
=
true
}
override
fun
onKeyDown
(
keyCode
:
Int
,
event
:
KeyEvent
?):
Boolean
{
when
(
keyCode
)
{
KeyEvent
.
KEYCODE_BACK
->
{
if
(
isSplashEnter
)
{
readyGoThenKill
(
MainActivity
::
class
.
java
)
}
else
{
finish
()
}
}
}
return
true
}
private
fun
initWidget
()
{
drama
?.
let
{
drama
->
dpWidget
=
DPSdk
.
factory
().
createDramaDetail
(
...
...
video/app/src/main/java/com/xinfu/helivideo/video/TxVideoActivity.kt
View file @
6e0b7e23
...
...
@@ -46,7 +46,6 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
private
var
orderTagsList
:
ArrayList
<
String
>?
=
null
private
var
isPlayNext
=
false
private
var
isSplashEnter
=
false
private
var
playIndex
=
1
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
activity_tx_video
...
...
@@ -60,7 +59,6 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
override
fun
getBundleExtras
(
extras
:
Bundle
?)
{
val
json
=
extras
?.
getString
(
Constant
.
VEDIO_BEAN
)
isPlayNext
=
extras
?.
getBoolean
(
Constant
.
VEDIO_NEXT
,
false
)
==
true
isSplashEnter
=
extras
?.
getBoolean
(
Constant
.
VEDIO_SPLASH
,
false
)
==
true
mVedioBean
=
Gson
().
fromJson
(
json
,
VedioBean
::
class
.
java
)
orderTagsList
=
mVedioBean
?.
orderTags
if
(
isPlayNext
)
{
...
...
@@ -113,28 +111,12 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
close_iv
.
setOnClickListener
(
this
)
}
override
fun
onKeyDown
(
keyCode
:
Int
,
event
:
KeyEvent
?):
Boolean
{
when
(
keyCode
)
{
KeyEvent
.
KEYCODE_BACK
->
{
if
(
isSplashEnter
)
{
readyGoThenKill
(
MainActivity
::
class
.
java
)
}
else
{
finish
()
}
}
}
return
true
}
override
fun
onClick
(
v
:
View
?)
{
if
(
AntiShake
.
check
(
v
?.
id
))
return
when
(
v
?.
id
)
{
R
.
id
.
close_iv
->
{
if
(
isSplashEnter
)
{
readyGoThenKill
(
MainActivity
::
class
.
java
)
}
else
{
finish
()
}
finish
()
}
R
.
id
.
fm_bottom
->
{
showEpisodeDialog
()
...
...
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