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
447910b6
Commit
447910b6
authored
Sep 11, 2023
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
4fe678f9
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
391 additions
and
357 deletions
+391
-357
AndroidManifest.xml
video/app/src/main/AndroidManifest.xml
+6
-1
HomePresenter.kt
.../java/com/mints/helivideo/mvp/presenters/HomePresenter.kt
+1
-92
HomeView.kt
...p/src/main/java/com/mints/helivideo/mvp/views/HomeView.kt
+0
-4
WxLoginActivity.kt
.../java/com/mints/helivideo/ui/activitys/WxLoginActivity.kt
+204
-0
TopAdapter.kt
...rc/main/java/com/mints/helivideo/ui/adapter/TopAdapter.kt
+3
-27
MainFragment.kt
...main/java/com/mints/helivideo/ui/fragment/MainFragment.kt
+12
-126
activity_wx_login.xml
video/app/src/main/res/layout/activity_wx_login.xml
+100
-0
fragment_main.xml
video/app/src/main/res/layout/fragment_main.xml
+30
-41
item_rv_top.xml
video/app/src/main/res/layout/item_rv_top.xml
+35
-66
ic_wx_white_login.png
video/app/src/main/res/mipmap-xhdpi/ic_wx_white_login.png
+0
-0
No files found.
video/app/src/main/AndroidManifest.xml
View file @
447910b6
...
...
@@ -103,7 +103,12 @@
android:exported=
"false"
android:launchMode=
"singleTop"
android:screenOrientation=
"portrait"
/>
<activity
android:name=
".ui.activitys.WxLoginActivity"
android:configChanges=
"orientation|screenSize|keyboardHidden"
android:exported=
"false"
android:launchMode=
"singleTop"
android:screenOrientation=
"portrait"
/>
<activity
android:name=
".ui.activitys.MainActivity"
android:configChanges=
"orientation|keyboardHidden|screenSize"
...
...
video/app/src/main/java/com/mints/helivideo/mvp/presenters/HomePresenter.kt
View file @
447910b6
...
...
@@ -67,7 +67,6 @@ class HomePresenter : BasePresenter<HomeView>() {
when
(
code
)
{
200
->
{
view
.
topTabsSuc
(
baseResponse
.
data
)
showTurn
()
}
else
->
{
view
.
showToast
(
message
)
...
...
@@ -77,46 +76,9 @@ class HomePresenter : BasePresenter<HomeView>() {
})
}
private
fun
showTurn
()
{
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
showTurn
(),
object
:
BaseSubscriber
<
BaseResponse
<
NineShowBean
>>()
{
override
fun
onCompleted
()
{
if
(
isLinkView
)
return
}
override
fun
onNext
(
baseResponse
:
BaseResponse
<
NineShowBean
>)
{
if
(
isLinkView
)
return
val
code
=
baseResponse
.
status
val
message
=
baseResponse
.
message
when
(
code
)
{
200
->
{
val
data
=
baseResponse
.
data
if
(
data
!=
null
)
{
view
.
showTurnSuc
(
data
)
// AppPreferencesManager.get()
// .put(Constant.LUCKY_FLAG, data.isShow)
// AppPreferencesManager.get()
// .put(Constant.LUCKY_COMPLETE, data.complete)
// AppPreferencesManager.get()
// .put(Constant.LUCKY_NEED, data.need)
}
}
}
}
override
fun
onError
(
e
:
Throwable
?)
{
if
(
isLinkView
)
return
}
})
}
fun
orders
()
{
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
orders
(),
.
call
(
loanService
.
history
(),
object
:
BaseSubscriber
<
BaseResponse
<
BannerList
>>()
{
override
fun
onCompleted
()
{
if
(
isLinkView
)
return
...
...
@@ -224,57 +186,4 @@ 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
)
}
}
}
})
}
fun
getRecommendVedio
()
{
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
getRecommendVedio
(),
object
:
BaseSubscriber
<
BaseResponse
<
RecoBean
>>()
{
override
fun
onCompleted
()
{
if
(
isLinkView
)
return
}
override
fun
onError
(
e
:
Throwable
)
{
if
(
isLinkView
)
return
}
override
fun
onNext
(
baseResponse
:
BaseResponse
<
RecoBean
>)
{
if
(
isLinkView
)
return
val
code
=
baseResponse
.
status
when
(
code
)
{
200
->
{
view
.
getRecommendVedioSuc
(
baseResponse
.
data
)
}
}
}
})
}
}
\ No newline at end of file
video/app/src/main/java/com/mints/helivideo/mvp/views/HomeView.kt
View file @
447910b6
...
...
@@ -7,8 +7,4 @@ interface HomeView : BaseView {
fun
getHomeV1MsgSuc
(
data
:
HotStyleTypesList
)
fun
topTabsSuc
(
data
:
BannerList
?)
fun
ordersSuc
(
data
:
BannerList
?)
fun
getSoltVedioSuc
(
data
:
IndexList
?)
fun
getRecommendVedioSuc
(
data
:
RecoBean
?)
fun
showTurnSuc
(
data
:
NineShowBean
)
}
video/app/src/main/java/com/mints/helivideo/ui/activitys/WxLoginActivity.kt
0 → 100644
View file @
447910b6
package
com.mints.helivideo.ui.activitys
import
android.os.Bundle
import
android.os.Handler
import
android.os.Looper
import
android.text.TextPaint
import
android.text.style.ClickableSpan
import
android.view.View
import
androidx.core.content.ContextCompat
import
cn.sharesdk.framework.ShareSDK
import
cn.sharesdk.wechat.friends.Wechat
import
com.daimajia.androidanimations.library.Techniques
import
com.daimajia.androidanimations.library.YoYo
import
com.mints.helivideo.MintsApplication
import
com.mints.helivideo.R
import
com.mints.helivideo.common.Constant
import
com.mints.helivideo.login.LoginApi
import
com.mints.helivideo.login.OnLoginListener
import
com.mints.helivideo.mvp.model.WXInfo
import
com.mints.helivideo.mvp.presenters.LoginPresenter
import
com.mints.helivideo.mvp.views.LoginView
import
com.mints.helivideo.ui.activitys.base.BaseActivity
import
com.mints.helivideo.utils.CommonUtils
import
com.mints.helivideo.utils.SpanUtils
import
com.mints.helivideo.utils.ToastUtil
import
com.mints.library.utils.json.JsonUtil
import
com.mints.library.utils.nodoubleclick.AntiShake
import
kotlinx.android.synthetic.main.activity_wx_login.*
/**
* 描述:微信登录
* 作者:孟崔广
* 时间:2020/12/2 13:50
*/
class
WxLoginActivity
:
BaseActivity
(),
LoginView
,
View
.
OnClickListener
,
OnLoginListener
{
private
val
loginPresenter
by
lazy
{
LoginPresenter
()
}
private
val
loginApi
by
lazy
{
LoginApi
()
}
private
var
wxInfo
:
WXInfo
?
=
null
private
var
channel
:
String
=
""
private
var
isCheckAgree
=
false
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
activity_wx_login
override
fun
toggleOverridePendingTransition
()
=
true
override
fun
getOverridePendingTransitionMode
()
=
TransitionMode
.
BOTTOM
override
fun
isApplyKitKatTranslucency
()
=
false
override
fun
initViewsAndEvents
()
{
loginPresenter
.
attachView
(
this
)
channel
=
CommonUtils
.
getAppMetaData
(
MintsApplication
.
getContext
(),
"CHANNEL_NAME"
)
initView
()
initListener
()
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
loginApi
.
setOnLoginListener
(
null
)
loginPresenter
.
detachView
()
}
override
fun
finish
()
{
super
.
finish
()
//关闭窗体动画显示
overridePendingTransition
(
0
,
R
.
anim
.
push_bottom_out
)
}
override
fun
onClick
(
v
:
View
?)
{
if
(
AntiShake
.
check
(
v
?.
id
))
return
when
(
v
?.
id
)
{
R
.
id
.
ivLoginBack
->
{
finish
()
}
R
.
id
.
tvLoginMobile
->
{
readyGo
(
MobileLoginActivity
::
class
.
java
)
}
R
.
id
.
rlLoginWx
->
{
if
(!
isCheckAgree
)
{
ToastUtil
.
showLong
(
context
,
"请勾选同意后再进行登录"
)
llWxloginCheck
.
postDelayed
({
YoYo
.
with
(
Techniques
.
Shake
).
duration
(
500
).
repeat
(
2
).
playOn
(
llWxloginCheck
)
},
200
)
return
}
val
wechat
=
ShareSDK
.
getPlatform
(
Wechat
.
NAME
)
if
(!
wechat
.
isClientValid
)
{
showToast
(
"请先安装微信"
)
return
}
// RxPermissions(this)
// .request(Manifest.permission.READ_PHONE_STATE)
// .subscribe { granted: Boolean ->
// if (granted) {
// loginApi.setOnLoginListener(this@WxLoginActivity)
// loginApi.setPlatform(Wechat.NAME)
// loginApi.login(this@WxLoginActivity)
// } else {
// showMissingPermissionDialog("设备")
// }
// }
loginApi
.
setOnLoginListener
(
this
@WxLoginActivity
)
loginApi
.
setPlatform
(
Wechat
.
NAME
)
loginApi
.
login
(
this
@WxLoginActivity
)
// readyGo(TestActivity::class.java)
}
}
}
override
fun
loginSuc
()
{
showToast
(
"登录成功"
)
hideLoading
()
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
readyGoThenKill
(
MainActivity
::
class
.
java
)
},
1000
)
}
override
fun
sendCodeSuc
()
{
}
override
fun
mergeAccount
(
mobile
:
String
,
wxOpenId
:
String
,
key
:
String
)
{
}
override
fun
onLogin
(
platform
:
String
?,
res
:
HashMap
<
String
,
Any
>):
Boolean
{
try
{
wxInfo
=
WXInfo
()
wxInfo
?.
let
{
it
.
unionid
=
res
[
"unionid"
].
toString
()
+
""
it
.
openid
=
res
[
"openid"
].
toString
()
+
""
it
.
province
=
res
[
"province"
].
toString
()
+
""
it
.
city
=
res
[
"city"
].
toString
()
+
""
it
.
country
=
res
[
"country"
].
toString
()
+
""
it
.
headimgurl
=
res
[
"headimgurl"
].
toString
()
+
""
it
.
nickname
=
res
[
"nickname"
].
toString
()
+
""
it
.
sex
=
(
res
[
"sex"
].
toString
()
+
""
).
toInt
()
}
if
(!
isFinishing
)
{
loginPresenter
.
login
(
JsonUtil
.
toJson
(
wxInfo
))
}
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
}
return
false
}
private
fun
initView
()
{
SpanUtils
.
with
(
tvLoginAgreement
)
.
append
(
"已阅读并同意"
)
.
append
(
"《用户注册协议》"
).
setClickSpan
(
object
:
ClickableSpan
()
{
override
fun
onClick
(
widget
:
View
)
{
val
bundle
=
Bundle
()
bundle
.
putString
(
WebActivity
.
WEB_TITLE
,
getString
(
R
.
string
.
register_name
))
bundle
.
putString
(
WebActivity
.
WEB_URL
,
Constant
.
REGISTER_URL
)
readyGo
(
WebActivity
::
class
.
java
,
bundle
)
}
override
fun
updateDrawState
(
ds
:
TextPaint
)
{
ds
.
color
=
ContextCompat
.
getColor
(
mContext
,
R
.
color
.
color_FF9837
)
ds
.
isUnderlineText
=
false
}
})
.
append
(
"、"
)
.
append
(
"《用户隐私协议》"
).
setClickSpan
(
object
:
ClickableSpan
()
{
override
fun
onClick
(
widget
:
View
)
{
val
bundle
=
Bundle
()
bundle
.
putString
(
WebActivity
.
WEB_TITLE
,
getString
(
R
.
string
.
privacy_name
))
bundle
.
putString
(
WebActivity
.
WEB_URL
,
Constant
.
PRIVACY_URL
)
readyGo
(
WebActivity
::
class
.
java
,
bundle
)
}
override
fun
updateDrawState
(
ds
:
TextPaint
)
{
ds
.
color
=
ContextCompat
.
getColor
(
mContext
,
R
.
color
.
color_FF9837
)
ds
.
isUnderlineText
=
false
}
})
.
append
(
"与您的利益切身相关。请您注册前务必仔细阅读!"
)
.
create
()
}
private
fun
initListener
()
{
ivLoginBack
.
setOnClickListener
(
this
)
tvLoginMobile
.
setOnClickListener
(
this
)
rlLoginWx
.
setOnClickListener
(
this
)
wxloginCheck
.
setOnCheckedChangeListener
{
buttonView
,
isChecked
->
this
.
isCheckAgree
=
isChecked
}
}
}
video/app/src/main/java/com/mints/helivideo/ui/adapter/TopAdapter.kt
View file @
447910b6
...
...
@@ -22,10 +22,9 @@ class TopAdapter(val topList: MutableList<VedioBean>?) :
inner
class
ViewHolder
(
view
:
View
)
:
RecyclerView
.
ViewHolder
(
view
)
{
val
rlTopItemRoot
:
LinearLayout
=
view
.
findViewById
(
R
.
id
.
rlTopItemRoot
)
val
ivTopItem
:
ImageView
=
view
.
findViewById
(
R
.
id
.
ivTopItem
)
val
tvTopItemLable
:
TextView
=
view
.
findViewById
(
R
.
id
.
tvTopItemLable
)
val
tvTopItemCount
:
TextView
=
view
.
findViewById
(
R
.
id
.
tvTopItemCount
)
val
tvTopItemTitle
:
TextView
=
view
.
findViewById
(
R
.
id
.
tvTopItemTitle
)
val
tvTopItemText
:
TextView
=
view
.
findViewById
(
R
.
id
.
tvTopItemText
)
val
tvTopCurText
:
TextView
=
view
.
findViewById
(
R
.
id
.
tvTopCurText
)
}
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
ViewHolder
{
...
...
@@ -38,17 +37,9 @@ class TopAdapter(val topList: MutableList<VedioBean>?) :
override
fun
onBindViewHolder
(
holder
:
ViewHolder
,
position
:
Int
)
{
val
topBean
=
topList
?.
get
(
position
)
if
(
topBean
!=
null
)
{
holder
.
tvTopItemLable
.
text
=
"${position + 1}"
holder
.
tvTopItemCount
.
text
=
topBean
.
showNum
holder
.
tvTopItemTitle
.
text
=
"${topBean.title}"
if
(
topBean
.
orderTags
!=
null
&&
topBean
.
orderTags
.
size
>
0
)
{
val
sb
=
StringBuilder
()
for
(
i
in
0
until
topBean
.
orderTags
.
size
)
{
sb
.
append
(
topBean
.
orderTags
.
get
(
i
)
+
" "
)
}
holder
.
tvTopItemText
.
text
=
"${sb}"
}
holder
.
tvTopItemText
.
text
=
"共${topBean.freeIndex}集"
holder
.
tvTopCurText
.
text
=
"观看至第${topBean.seeIndex}集"
GlideUtils
.
loadImageViewGifForCenterCrop
(
context
,
topBean
.
coverImage
,
...
...
@@ -56,21 +47,6 @@ class TopAdapter(val topList: MutableList<VedioBean>?) :
)
}
when
(
position
)
{
0
->
{
holder
.
tvTopItemLable
.
setBackgroundResource
(
R
.
mipmap
.
y43
)
}
1
->
{
holder
.
tvTopItemLable
.
setBackgroundResource
(
R
.
mipmap
.
y42
)
}
2
->
{
holder
.
tvTopItemLable
.
setBackgroundResource
(
R
.
mipmap
.
y41
)
}
else
->
{
holder
.
tvTopItemLable
.
setBackgroundResource
(
R
.
mipmap
.
y4
)
}
}
holder
.
rlTopItemRoot
.
setOnClickListener
{
mOnItemClickListener
.
onItemClick
(
position
)
}
...
...
video/app/src/main/java/com/mints/helivideo/ui/fragment/MainFragment.kt
View file @
447910b6
package
com.mints.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
...
...
@@ -13,8 +10,6 @@ import androidx.recyclerview.widget.RecyclerView
import
androidx.viewpager2.widget.ViewPager2
import
com.google.android.material.tabs.TabLayout
import
com.google.android.material.tabs.TabLayoutMediator
import
com.scwang.smartrefresh.layout.api.RefreshLayout
import
com.scwang.smartrefresh.layout.listener.OnRefreshListener
import
com.mints.helivideo.R
import
com.mints.helivideo.ad.AdManager
import
com.mints.helivideo.ad.banner.BannerManager
...
...
@@ -26,16 +21,15 @@ import com.mints.helivideo.manager.UserManager
import
com.mints.helivideo.mvp.model.*
import
com.mints.helivideo.mvp.presenters.HomePresenter
import
com.mints.helivideo.mvp.views.HomeView
import
com.mints.helivideo.ui.activitys.
Recommen
dActivity
import
com.mints.helivideo.ui.activitys.
WatchRecor
dActivity
import
com.mints.helivideo.ui.adapter.HomeVideoPageAdapter
import
com.mints.helivideo.ui.adapter.ImageTitleAdapter
import
com.mints.helivideo.ui.adapter.TopAdapter
import
com.mints.helivideo.ui.fragment.base.LazyLoadBaseFragment
import
com.mints.helivideo.utils.AppPreferencesManager
import
com.mints.helivideo.utils.SpanUtils
import
com.mints.library.utils.GlideUtils
import
com.mints.library.utils.json.JsonUtil
import
com.mints.library.utils.nodoubleclick.AntiShake
import
com.scwang.smartrefresh.layout.api.RefreshLayout
import
com.scwang.smartrefresh.layout.listener.OnRefreshListener
import
kotlinx.android.synthetic.main.fragment_main.*
import
java.lang.reflect.Field
import
java.util.*
...
...
@@ -57,7 +51,6 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
private
val
topList
=
mutableListOf
<
VedioBean
>()
private
var
vpAdapter
:
HomeVideoPageAdapter
?
=
null
private
var
topAdapter
:
TopAdapter
?
=
null
private
var
recommendVedioBean
:
RecoBean
?
=
null
private
val
homePresenter
by
lazy
{
HomePresenter
()
}
...
...
@@ -77,26 +70,8 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
if
(!
UserManager
.
getInstance
().
vipFlag
)
{
AdManager
.
instance
.
preLoadAd
(
requireActivity
())
}
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
)
{
homePresenter
.
getRecommendVedio
()
}
}
else
{
homePresenter
.
getSoltVedio
()
}
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
...
...
@@ -106,10 +81,6 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
override
fun
onFragmentResume
()
{
if
(
AppConfig
.
fragmentClickFlag
==
Constant
.
FRAGMENT_CLICK_ONE
)
{
if
(
AntiShake
.
check
(
banner
?.
id
))
return
// if (!UserManager.getInstance().vipFlag) {
// BannerManager.loadAd(requireActivity(), fl_main_banner)
// }
BannerManager
.
loadAd
(
requireActivity
(),
fl_main_banner
)
if
(
AppConfig
.
exitLoginMainRefresh
)
{
...
...
@@ -117,7 +88,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
loadData
()
}
banner
?.
start
()
setWatchingStatus
()
//
setWatchingStatus()
if
(
TextUtils
.
isEmpty
(
userManager
?.
userID
))
{
//获取游客登录数据
...
...
@@ -126,7 +97,6 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
homePresenter
.
topTabs
()
homePresenter
.
orders
()
TrackManager
.
getInstance
().
getMyInfo
()
showRecommendAct
(
recommendVedioBean
)
}
}
}
...
...
@@ -139,7 +109,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
srlMainPage
.
setOnRefreshListener
(
this
)
iv_main_watching_close
.
setOnClickListener
(
this
)
tv_main_watching_goto
.
setOnClickListener
(
this
)
ll_lucky
.
setOnClickListener
(
this
)
tv_main_watchmore
.
setOnClickListener
(
this
)
}
override
fun
onClick
(
v
:
View
?)
{
...
...
@@ -148,7 +118,10 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
when
(
v
?.
id
)
{
R
.
id
.
iv_main_watching_close
->
{
LocalVedioManager
.
closeCacheVedio
()
ll_main_watching_root
.
visibility
=
View
.
GONE
// ll_main_watching_root.visibility = View.GONE
}
R
.
id
.
tv_main_watchmore
->
{
readyGo
(
WatchRecordActivity
::
class
.
java
)
}
R
.
id
.
tv_main_watching_goto
->
{
val
cacheVedio
=
LocalVedioManager
.
getCacheVedio
()
...
...
@@ -156,8 +129,6 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
LocalVedioManager
.
startVedioDetailActivityForType
(
requireActivity
(),
cacheVedio
)
}
}
R
.
id
.
ll_lucky
->
{
}
}
}
...
...
@@ -249,8 +220,8 @@ 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.visibility = View.VISIBLE
//
ll_main_watching_root.setOnClickListener { }
val
cacheVedio
=
LocalVedioManager
.
getCacheVedio
()
if
(
cacheVedio
!=
null
)
{
GlideUtils
.
loadImageViewGifForCenterCrop
(
...
...
@@ -269,7 +240,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
}
}
}
else
{
ll_main_watching_root
.
visibility
=
View
.
GONE
//
ll_main_watching_root.visibility = View.GONE
}
}
...
...
@@ -316,51 +287,6 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
topAdapter
?.
notifyDataSetChanged
()
}
override
fun
getSoltVedioSuc
(
data
:
IndexList
?)
{
AppPreferencesManager
.
get
().
put
(
Constant
.
IS_FIRST_VEDIO
,
true
)
if
(
data
!=
null
&&
data
.
vedioMsg
!=
null
)
{
LocalVedioManager
.
startVedioDetailActivityForType
(
requireActivity
(),
data
.
vedioMsg
)
}
else
{
if
(
UserManager
.
getInstance
().
newFlag
&&
!
UserManager
.
getInstance
().
vipFlag
)
{
homePresenter
.
getRecommendVedio
()
}
}
}
override
fun
getRecommendVedioSuc
(
data
:
RecoBean
?)
{
this
.
recommendVedioBean
=
data
}
override
fun
showTurnSuc
(
data
:
NineShowBean
)
{
AppPreferencesManager
.
get
().
put
(
Constant
.
LUCKY_FLAG
,
data
.
isShow
)
if
(!
data
.
isShow
||
UserManager
.
getInstance
().
vipFlag
)
{
ll_lucky
.
visibility
=
View
.
GONE
return
}
else
{
ll_lucky
.
visibility
=
View
.
VISIBLE
context
?.
let
{
GlideUtils
.
loadRoundImageViewGif
(
it
,
R
.
drawable
.
ic_nine
,
iv_lucky_gif
)
}
}
val
complete
=
data
.
complete
val
need
=
data
.
need
if
(
complete
>=
need
)
{
tv_lucky_status
.
text
=
SpanUtils
()
.
append
(
"可领取"
)
.
setForegroundColor
(
resources
.
getColor
(
R
.
color
.
apk_uninstalled
))
.
create
()
}
else
{
tv_lucky_status
.
text
=
SpanUtils
()
.
append
(
complete
.
toString
())
.
setForegroundColor
(
resources
.
getColor
(
R
.
color
.
red
))
.
append
(
"/"
)
.
append
(
need
.
toString
())
.
create
()
}
}
override
fun
onHiddenChanged
(
hidden
:
Boolean
)
{
super
.
onHiddenChanged
(
hidden
)
if
(
isHidden
)
{
...
...
@@ -370,46 +296,6 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
}
}
/**
* 展示推荐弹窗
*/
private
fun
showRecommendAct
(
data
:
RecoBean
?)
{
if
(
data
==
null
||
data
.
vedio3
==
null
)
return
if
(
AppConfig
.
enterVipAct
)
{
AppConfig
.
enterVipAct
=
false
if
(
UserManager
.
getInstance
().
newFlag
&&
!
UserManager
.
getInstance
().
vipFlag
)
{
// 1、第一次打开app并关闭付费页进首页时出现一次
val
mainFirstRecommend
=
AppPreferencesManager
.
get
().
getBoolean
(
Constant
.
MAIN_FIRST_RECOMMEND
,
false
)
if
(!
mainFirstRecommend
)
{
AppPreferencesManager
.
get
().
put
(
Constant
.
MAIN_FIRST_RECOMMEND
,
true
)
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
val
bundle
=
Bundle
()
bundle
.
putString
(
Constant
.
RECOMMEND_BEAN
,
JsonUtil
.
toJson
(
data
.
vedio3
))
readyGo
(
RecommendActivity
::
class
.
java
,
bundle
)
},
300
)
return
}
// 2、用户第一次打开app未签约付费,而是看了十次广告以上的,则在下一次打开app时关闭启动付费页面后弹出推荐弹框一次
val
mainTwoRecommend
=
AppPreferencesManager
.
get
().
getBoolean
(
Constant
.
MAIN_TWO_RECOMMEND
,
false
)
val
adCount
=
AppPreferencesManager
.
get
().
getInt
(
Constant
.
VEDIO_AD_COUNT
,
0
)
if
(!
mainTwoRecommend
&&
adCount
>
data
.
vedio3
.
adShowCount
)
{
AppPreferencesManager
.
get
().
put
(
Constant
.
MAIN_TWO_RECOMMEND
,
true
)
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
val
bundle
=
Bundle
()
bundle
.
putString
(
Constant
.
RECOMMEND_BEAN
,
JsonUtil
.
toJson
(
data
.
vedio3
))
readyGo
(
RecommendActivity
::
class
.
java
,
bundle
)
},
300
)
}
}
}
}
fun
ViewPager2
.
desensitization
()
{
//动态设置ViewPager2 灵敏度
try
{
...
...
video/app/src/main/res/layout/activity_wx_login.xml
0 → 100644
View file @
447910b6
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
xmlns:tools=
"http://schemas.android.com/tools"
android:background=
"@color/white"
android:orientation=
"vertical"
>
<ImageView
android:id=
"@+id/ivLoginBack"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:paddingLeft=
"25dp"
android:paddingTop=
"40dp"
android:paddingRight=
"25dp"
android:paddingBottom=
"10dp"
android:scaleType=
"center"
android:src=
"@mipmap/ic_activity_quit"
/>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<ImageView
android:layout_width=
"70dp"
android:layout_height=
"70dp"
android:layout_centerHorizontal=
"true"
android:layout_marginTop=
"50dp"
android:src=
"@mipmap/ic_launcher_main"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_alignParentBottom=
"true"
android:layout_marginBottom=
"30dp"
android:orientation=
"vertical"
>
<RelativeLayout
android:id=
"@+id/rlLoginWx"
android:layout_width=
"match_parent"
android:layout_height=
"52dp"
android:layout_gravity=
"center_horizontal"
android:layout_marginLeft=
"40dp"
android:layout_marginTop=
"230dp"
android:layout_marginRight=
"40dp"
android:background=
"@drawable/shape_green"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:drawableLeft=
"@mipmap/ic_wx_white_login"
android:drawablePadding=
"10dp"
android:gravity=
"center_vertical"
android:text=
"微信登录"
android:textColor=
"@color/white"
android:textSize=
"14sp"
/>
</RelativeLayout>
<TextView
android:id=
"@+id/tvLoginMobile"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:padding=
"24dp"
android:text=
"其他登录方式"
android:textColor=
"@color/gray"
android:textSize=
"14sp"
/>
<LinearLayout
android:id=
"@+id/llWxloginCheck"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<CheckBox
android:id=
"@+id/wxloginCheck"
android:layout_width=
"wrap_content"
android:layout_marginLeft=
"20dp"
android:gravity=
"center"
android:checked=
"false"
android:layout_gravity=
"center_vertical"
android:layout_height=
"wrap_content"
></CheckBox>
<TextView
android:id=
"@+id/tvLoginAgreement"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginRight=
"30dp"
android:layout_marginLeft=
"2dp"
tools:text=
"123123123123123123123123123123123123123123123123123123123123123123"
android:textColor=
"#707A8D"
android:textSize=
"12sp"
/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
video/app/src/main/res/layout/fragment_main.xml
View file @
447910b6
...
...
@@ -76,16 +76,36 @@
android:background=
"@drawable/shape_bg_write"
android:orientation=
"vertical"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"6dp"
android:layout_marginTop=
"10dp"
android:layout_marginBottom=
"10dp"
android:text=
"排行榜"
android:textColor=
"@color/black"
android:textSize=
"16sp"
android:textStyle=
"bold"
/>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"6dp"
android:layout_marginTop=
"10dp"
android:layout_marginBottom=
"10dp"
android:text=
"最近观看"
android:textColor=
"@color/black"
android:textSize=
"16sp"
android:textStyle=
"bold"
/>
<TextView
android:id=
"@+id/tv_main_watchmore"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentRight=
"true"
android:layout_marginLeft=
"6dp"
android:layout_marginTop=
"14dp"
android:layout_marginRight=
"10dp"
android:layout_marginBottom=
"10dp"
android:text=
"查看更多"
android:textColor=
"@color/gray"
android:textSize=
"12sp"
android:textStyle=
"bold"
/>
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_main_list"
...
...
@@ -243,35 +263,4 @@
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_lucky"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:visibility=
"gone"
android:layout_marginEnd=
"10dp"
android:layout_marginBottom=
"120dp"
android:gravity=
"center"
android:orientation=
"vertical"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
>
<ImageView
android:id=
"@+id/iv_lucky_gif"
android:layout_width=
"80dp"
android:layout_height=
"70dp"
android:src=
"@mipmap/ic_get_mobile"
/>
<TextView
android:id=
"@+id/tv_lucky_status"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"6dp"
android:background=
"@drawable/shape_bg_black2"
android:paddingLeft=
"16dp"
android:paddingRight=
"16dp"
android:text=
"0/5"
android:textColor=
"@color/white"
android:textSize=
"12sp"
/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
video/app/src/main/res/layout/item_rv_top.xml
View file @
447910b6
...
...
@@ -3,84 +3,53 @@
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/rlTopItemRoot"
android:layout_width=
"
110dp
"
android:layout_width=
"
wrap_content
"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"3dp"
android:layout_marginRight=
"3dp"
android:orientation=
"
vertic
al"
>
android:orientation=
"
horizont
al"
>
<FrameLayout
<ImageView
android:id=
"@+id/ivTopItem"
android:layout_width=
"110dp"
android:layout_height=
"150dp"
>
android:layout_height=
"120dp"
android:scaleType=
"fitXY"
/>
<ImageView
android:id=
"@+id/ivTopItem"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:scaleType=
"fitXY"
/>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"8dp"
android:layout_marginRight=
"20dp"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/tvTopItemLable"
android:layout_width=
"22dp"
android:layout_height=
"22dp"
android:layout_marginLeft=
"10dp"
android:background=
"@mipmap/y4"
android:gravity=
"center"
android:paddingBottom=
"2dp"
android:text=
"1"
android:textColor=
"@color/white"
android:textSize=
"12sp"
android:textStyle=
"bold"
/>
android:id=
"@+id/tvTopItemTitle"
android:layout_width=
"100dp"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"12dp"
android:singleLine=
"true"
android:text=
"我去平行时空"
android:textColor=
"@color/black"
android:textSize=
"13sp"
/>
<LinearLayout
<TextView
android:id=
"@+id/tvTopItemText"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"bottom"
android:background=
"@drawable/bg_shape_twoban"
android:drawableLeft=
"@mipmap/ic_load"
android:drawablePadding=
"4dp"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"6dp"
android:src=
"@mipmap/ic_load"
></ImageView>
<TextView
android:id=
"@+id/tvTopItemCount"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:paddingLeft=
"6dp"
android:paddingTop=
"2dp"
android:paddingRight=
"8dp"
android:paddingBottom=
"2dp"
android:text=
"143.2万"
android:textColor=
"@color/white"
android:textSize=
"12sp"
/>
</LinearLayout>
</FrameLayout>
android:layout_marginTop=
"4dp"
android:singleLine=
"true"
android:textColor=
"@color/gray"
android:textSize=
"11sp"
/>
<TextView
android:id=
"@+id/tvTopCurText"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
android:singleLine=
"true"
android:textColor=
"@color/red"
android:textSize=
"11sp"
/>
</LinearLayout>
<TextView
android:id=
"@+id/tvTopItemTitle"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"2dp"
android:singleLine=
"true"
android:text=
"我去平行时空"
android:textColor=
"@color/black"
android:textSize=
"13sp"
/>
<TextView
android:id=
"@+id/tvTopItemText"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:singleLine=
"true"
android:textColor=
"@color/gray"
android:textSize=
"11sp"
/>
</LinearLayout>
\ No newline at end of file
video/app/src/main/res/mipmap-xhdpi/ic_wx_white_login.png
0 → 100644
View file @
447910b6
1.5 KB
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