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
4ae4c218
Commit
4ae4c218
authored
Feb 20, 2024
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
eda5d071
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
95 additions
and
67 deletions
+95
-67
AppConfig.java
...p/src/main/java/com/duben/shortplay/common/AppConfig.java
+1
-0
Constant.kt
.../app/src/main/java/com/duben/shortplay/common/Constant.kt
+1
-0
VipActivity.kt
...main/java/com/duben/shortplay/ui/activitys/VipActivity.kt
+78
-64
VipPayCancelDialog.kt
...java/com/duben/shortplay/ui/widgets/VipPayCancelDialog.kt
+1
-0
dialog_vip_pay_cancel.xml
video/app/src/main/res/layout/dialog_vip_pay_cancel.xml
+14
-3
No files found.
video/app/src/main/java/com/duben/shortplay/common/AppConfig.java
View file @
4ae4c218
...
...
@@ -17,6 +17,7 @@ public class AppConfig {
*/
public
static
int
fragmentClickFlag
=
0
;
public
static
int
vedioId
=
0
;
public
static
int
alipayCancelCount
=
0
;
// 退出登录首页刷新
public
static
boolean
exitLoginMainRefresh
=
false
;
...
...
video/app/src/main/java/com/duben/shortplay/common/Constant.kt
View file @
4ae4c218
...
...
@@ -29,6 +29,7 @@ object Constant {
const
val
MAIN_TWO_RECOMMEND
=
"MAIN_TWO_RECOMMEND"
const
val
VEDIO_AD_COUNT
=
"VEDIO_AD_COUNT"
const
val
VEDIO_MAIN_COUNT
=
"VEDIO_MAIN_COUNT"
const
val
ALIPAY_COUNT
=
"ALIPAY_COUNT"
const
val
CARRIERTYPE_CSJ_VEDIO
=
"1"
...
...
video/app/src/main/java/com/duben/shortplay/ui/activitys/VipActivity.kt
View file @
4ae4c218
...
...
@@ -55,8 +55,8 @@ import kotlinx.android.synthetic.main.fragment_main.*
* 时间:2022/12/22 14:48
*/
class
VipActivity
:
BaseActivity
(),
VipView
,
View
.
OnClickListener
,
VipAdapter
.
OnItemClickListener
,
CompoundButton
.
OnCheckedChangeListener
{
VipAdapter
.
OnItemClickListener
,
CompoundButton
.
OnCheckedChangeListener
{
companion
object
{
const
val
IS_GUIDE
=
"IS_GUIDE"
//是否从引导页进入
...
...
@@ -68,6 +68,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
const
val
THIRD_ID
=
"THIRD_ID"
const
val
VEDIO_ID
=
"VEDIO_ID"
}
var
timer
:
CountDownTimerSupport
?
=
null
private
var
breathAnim
:
YoYo
.
YoYoString
?
=
null
...
...
@@ -193,7 +194,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
if
(!
TextUtils
.
isEmpty
(
bean
.
remarks
))
{
tv_vip_hint
.
text
=
bean
.
remarks
tv_vip_hint
.
text
=
bean
.
remarks
tv_vip_hint
.
visibility
=
View
.
VISIBLE
}
else
{
tv_vip_hint
.
visibility
=
View
.
INVISIBLE
...
...
@@ -259,7 +260,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
if
(
data
.
expireTime
>
0
)
{
readyGo
(
MainActivity
::
class
.
java
)
val
activity
=
ActivityPageManager
.
getInstance
().
getActivity
(
MainActivity
::
class
.
java
)
ActivityPageManager
.
getInstance
().
getActivity
(
MainActivity
::
class
.
java
)
if
(
activity
!=
null
&&
activity
is
MainActivity
)
{
activity
.
clickTab4Layout
()
}
...
...
@@ -276,7 +277,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
when
(
keyCode
)
{
KeyEvent
.
KEYCODE_BACK
->
{
if
(
UserManager
.
getInstance
().
newFlag
&&
vipList
!=
null
&&
vipList
!!
.
size
>
0
&&
vipList
!=
null
&&
vipList
!!
.
size
>
0
)
{
vipAdapter
.
setPosition
(
0
)
...
...
@@ -309,7 +310,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
when
(
v
?.
id
)
{
R
.
id
.
ic_vip_quit
->
{
if
(
UserManager
.
getInstance
().
newFlag
&&
vipList
!=
null
&&
vipList
!!
.
size
>
0
vipList
!=
null
&&
vipList
!!
.
size
>
0
)
{
vipAdapter
.
setPosition
(
0
)
vipAdapter
.
notifyDataSetChanged
()
...
...
@@ -344,13 +345,13 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
}
else
{
if
(
TextUtils
.
equals
(
payType
,
WEIXIN_PAY
))
{
vipPresenter
.
getVipPayParams
(
"WEIXIN"
,
vipBean
.
pid
,
isAliPayInstalled
()
"WEIXIN"
,
vipBean
.
pid
,
isAliPayInstalled
()
)
}
else
if
(
TextUtils
.
equals
(
payType
,
ALIPAY
))
{
vipPresenter
.
getVipPayParams
(
"ALIPAY"
,
vipBean
.
pid
,
isAliPayInstalled
()
"ALIPAY"
,
vipBean
.
pid
,
isAliPayInstalled
()
)
}
}
...
...
@@ -391,7 +392,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
shimmer_text
?.
postDelayed
({
shimmer_text
?.
startShimmerAnimation
()
breathAnim
=
YoYo
.
with
(
Techniques
.
Pulse
).
duration
(
700
).
repeat
(-
1
).
playOn
(
shimmer_text
)
YoYo
.
with
(
Techniques
.
Pulse
).
duration
(
700
).
repeat
(-
1
).
playOn
(
shimmer_text
)
},
200
)
ic_vip_quit
.
setOnClickListener
(
this
)
...
...
@@ -481,22 +482,27 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
vipPresenter
.
queryVipOrder
(
wxParanBean
.
tid
.
toString
(),
false
)
mainHandler
.
postDelayed
(
{
if
(
isFinishing
)
return
@postDelayed
// 挽留弹窗存在也不弹
if
(
payYesDialog
!=
null
&&
payYesDialog
!!
.
isShowing
)
return
@postDelayed
if
(
vipList
!=
null
&&
vipList
!!
.
size
>
0
)
{
val
vipBean
=
vipList
!!
[
vipAdapter
.
getPosition
()]
// 0.01
if
(
vipBean
.
trial
!=
0
)
{
showPayCancelDialog
()
}
}
},
2000
{
if
(
isFinishing
)
return
@postDelayed
// 挽留弹窗存在也不弹
if
(
payYesDialog
!=
null
&&
payYesDialog
!!
.
isShowing
)
return
@postDelayed
val
alipayCount
=
AppPreferencesManager
.
get
().
getInt
(
Constant
.
ALIPAY_COUNT
,
0
)
AppPreferencesManager
.
get
().
put
(
Constant
.
ALIPAY_COUNT
,
alipayCount
+
1
)
showPayCancelDialog
()
// if (vipList != null && vipList!!.size > 0) {
// val vipBean = vipList!![vipAdapter.getPosition()]
// // 0.01
// if (vipBean.trial != 0) {
// showPayCancelDialog()
// }
// }
},
2000
)
}
})
...
...
@@ -535,6 +541,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
* 返回支付弹窗-签约
*/
private
fun
backPayYesDialog
(
vipBean
:
VipBean
.
ListBean
)
{
// 金额
payYesDialog
=
PayYesDialog
(
context
,
vipBean
,
object
:
DialogListener
()
{
override
fun
onClick
(
v
:
View
)
{
if
(!
isFinishing
()
&&
payYesDialog
!=
null
&&
payYesDialog
!!
.
isShowing
())
{
...
...
@@ -556,13 +563,13 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
val
vipBean
=
vipList
!!
[
vipAdapter
.
getPosition
()]
if
(
TextUtils
.
equals
(
payType
,
WEIXIN_PAY
))
{
vipPresenter
.
getVipPayParams
(
"WEIXIN"
,
vipBean
.
pid
,
isAliPayInstalled
()
"WEIXIN"
,
vipBean
.
pid
,
isAliPayInstalled
()
)
}
else
if
(
TextUtils
.
equals
(
payType
,
ALIPAY
))
{
vipPresenter
.
getVipPayParams
(
"ALIPAY"
,
vipBean
.
pid
,
isAliPayInstalled
()
"ALIPAY"
,
vipBean
.
pid
,
isAliPayInstalled
()
)
}
}
else
{
...
...
@@ -609,13 +616,13 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
R
.
id
.
tv_agreement_next
->
{
if
(
TextUtils
.
equals
(
payType
,
WEIXIN_PAY
))
{
vipPresenter
.
getVipPayParams
(
"WEIXIN"
,
vipBean
.
pid
,
isAliPayInstalled
()
"WEIXIN"
,
vipBean
.
pid
,
isAliPayInstalled
()
)
}
else
if
(
TextUtils
.
equals
(
payType
,
ALIPAY
))
{
vipPresenter
.
getVipPayParams
(
"ALIPAY"
,
vipBean
.
pid
,
isAliPayInstalled
()
"ALIPAY"
,
vipBean
.
pid
,
isAliPayInstalled
()
)
}
...
...
@@ -624,10 +631,10 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
}
})
ruleAgreementDialog
!!
.
setText
(
vipBean
.
remarks
,
vipBean
.
trialFirstDay
,
vipBean
.
price
,
vipBean
.
title
vipBean
.
remarks
,
vipBean
.
trialFirstDay
,
vipBean
.
price
,
vipBean
.
title
)
ruleAgreementDialog
!!
.
show
()
}
else
{
...
...
@@ -658,13 +665,13 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
}
else
{
if
(
TextUtils
.
equals
(
payType
,
WEIXIN_PAY
))
{
vipPresenter
.
getVipPayParams
(
"WEIXIN"
,
vipBean
.
pid
,
isAliPayInstalled
()
"WEIXIN"
,
vipBean
.
pid
,
isAliPayInstalled
()
)
}
else
if
(
TextUtils
.
equals
(
payType
,
ALIPAY
))
{
vipPresenter
.
getVipPayParams
(
"ALIPAY"
,
vipBean
.
pid
,
isAliPayInstalled
()
"ALIPAY"
,
vipBean
.
pid
,
isAliPayInstalled
()
)
}
}
...
...
@@ -687,7 +694,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
private
fun
setBanner
(
data
:
List
<
VedioBean
>)
{
mainHandler
.
postDelayed
({
val
scrollToBottomAnimator
=
ValueAnimator
.
ofInt
(
0
,
nsv
.
getChildAt
(
0
).
height
-
nsv
.
height
)
ValueAnimator
.
ofInt
(
0
,
nsv
.
getChildAt
(
0
).
height
-
nsv
.
height
)
scrollToBottomAnimator
.
addUpdateListener
{
animator
->
val
value
=
animator
.
animatedValue
as
Int
nsv
.
scrollTo
(
0
,
value
)
...
...
@@ -709,42 +716,49 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
val
adapter
=
VipBannerAdapter
(
data
)
// 绑定生命周期
vip_banner
.
addBannerLifecycleObserver
(
this
)
.
setBannerGalleryEffect
(
80
,
15
,
0.8f
)
.
setAdapter
(
adapter
)
.
addOnPageChangeListener
(
object
:
OnPageChangeListener
{
override
fun
onPageScrolled
(
position
:
Int
,
positionOffset
:
Float
,
positionOffsetPixels
:
Int
)
{
}
.
setBannerGalleryEffect
(
80
,
15
,
0.8f
)
.
setAdapter
(
adapter
)
.
addOnPageChangeListener
(
object
:
OnPageChangeListener
{
override
fun
onPageScrolled
(
position
:
Int
,
positionOffset
:
Float
,
positionOffsetPixels
:
Int
)
{
}
override
fun
onPageSelected
(
position
:
Int
)
{
GlideUtils
.
loadBlurImageView
(
mContext
,
data
[
position
].
coverImage
,
iv_blur
)
tv_banner_title
.
text
=
String
.
format
(
"《%1s》"
,
data
[
position
].
title
)
}
override
fun
onPageSelected
(
position
:
Int
)
{
GlideUtils
.
loadBlurImageView
(
mContext
,
data
[
position
].
coverImage
,
iv_blur
)
tv_banner_title
.
text
=
String
.
format
(
"《%1s》"
,
data
[
position
].
title
)
}
override
fun
onPageScrollStateChanged
(
state
:
Int
)
{}
})
override
fun
onPageScrollStateChanged
(
state
:
Int
)
{}
})
GlideUtils
.
loadBlurImageView
(
mContext
,
data
[
0
].
coverImage
,
iv_blur
)
tv_banner_title
.
text
=
String
.
format
(
"《%1s》"
,
data
[
0
].
title
)
}
private
fun
showPayCancelDialog
()
{
// 金额
val
alipayCount
=
AppPreferencesManager
.
get
().
getInt
(
Constant
.
ALIPAY_COUNT
,
0
)
if
(
alipayCount
==
1
)
{
}
else
if
(
alipayCount
==
2
)
{
}
val
vipBean
=
vipList
!!
[
0
]
VipPayCancelDialog
(
this
,
vipBean
.
price
,
object
:
DialogListener
()
{
override
fun
onClick
(
dialog
:
Dialog
?,
v
:
View
?)
{
super
.
onClick
(
dialog
,
v
)
dialog
?.
dismiss
()
vipPresenter
.
getVipPayParams
(
"ALIPAY"
,
vipBean
.
pid
,
isAliPayInstalled
()
"ALIPAY"
,
vipBean
.
pid
,
isAliPayInstalled
()
)
}
})
.
show
()
.
show
()
}
fun
startTimer
()
{
...
...
@@ -756,7 +770,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
timer
!!
.
setOnCountDownTimerListener
(
object
:
OnCountDownTimerListener
{
override
fun
onTick
(
millisUntilFinished
:
Long
)
{
if
(!
isFinishing
)
{
if
(
millisUntilFinished
==
4000L
)
{
if
(
millisUntilFinished
==
4000L
)
{
vipPresenter
.
getMyInfo
()
}
}
...
...
video/app/src/main/java/com/duben/shortplay/ui/widgets/VipPayCancelDialog.kt
View file @
4ae4c218
...
...
@@ -42,6 +42,7 @@ class VipPayCancelDialog(
dismiss
()
}
tv_cancel_cash
.
text
=
"${cash}元"
tv_cancel_coupon
.
text
=
"赠送${cash}元体验券"
listener
.
setDialog
(
this
)
findViewById
<
View
>(
R
.
id
.
btn
).
setOnClickListener
(
listener
)
...
...
video/app/src/main/res/layout/dialog_vip_pay_cancel.xml
View file @
4ae4c218
...
...
@@ -43,6 +43,15 @@
android:layout_marginTop=
"193dp"
android:textColor=
"@color/tv_message_recente_money"
android:layout_height=
"wrap_content"
></TextView>
<TextView
android:id=
"@+id/tv_count_down"
android:layout_width=
"wrap_content"
android:textSize=
"18dp"
android:text=
"-"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"272dp"
android:textColor=
"@color/gray"
android:layout_height=
"wrap_content"
></TextView>
</FrameLayout>
...
...
@@ -57,12 +66,14 @@
app:layout_constraintTop_toTopOf=
"@+id/guideline3"
/>
<TextView
android:id=
"@+id/tv_c
ount_dow
n"
android:id=
"@+id/tv_c
ancel_coupo
n"
android:layout_width=
"160dp"
android:layout_height=
"36dp"
android:background=
"@drawable/shape_linear_yellow"
android:gravity=
"center"
android:textColor=
"@color/color_FD7E0E"
android:text=
"赠送-元体验券"
android:textSize=
"18sp"
android:textColor=
"@color/red"
app:layout_constraintBottom_toTopOf=
"@id/guideline2"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
...
...
@@ -80,7 +91,7 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
app:layout_constraintGuide_begin=
"3
1
4dp"
/>
app:layout_constraintGuide_begin=
"3
3
4dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
...
...
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