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
03e5e97e
Commit
03e5e97e
authored
Aug 28, 2024
by
mengcuiguang2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
9481a1f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
72 deletions
+75
-72
VipActivity.kt
...n/java/com/duben/happyplaylet/ui/activitys/VipActivity.kt
+74
-71
dialog_powe2.xml
video/app/src/main/res/layout/dialog_powe2.xml
+1
-1
No files found.
video/app/src/main/java/com/duben/happyplaylet/ui/activitys/VipActivity.kt
View file @
03e5e97e
...
...
@@ -51,8 +51,8 @@ import java.net.URLEncoder
* 时间:2022/12/22 14:48
*/
class
VipActivity
:
BaseActivity
(),
VipView
,
View
.
OnClickListener
,
VipAdapter
.
OnItemClickListener
,
CompoundButton
.
OnCheckedChangeListener
{
VipAdapter
.
OnItemClickListener
,
CompoundButton
.
OnCheckedChangeListener
{
companion
object
{
const
val
IS_DETAIL
=
"IS_DETAIL"
//是否从剧集详情页进入
...
...
@@ -249,6 +249,9 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
openAlipayApp
(
vipBean
.
payToModel2SecondAlipayAppid
)
}
}
3
->
{
openWxApp
()
}
}
}
}
...
...
@@ -286,7 +289,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
()
}
...
...
@@ -303,7 +306,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
)
...
...
@@ -332,7 +335,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
()
...
...
@@ -363,15 +366,15 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
}
else
{
if
(
TextUtils
.
equals
(
payType
,
WEIXIN_PAY
))
{
vipPresenter
.
getVipPayParams
(
"WEIXIN"
,
vipBean
.
pid
,
isAliPayInstalled
(),
ENTER_TYPE_ACTIVITY
"WEIXIN"
,
vipBean
.
pid
,
isAliPayInstalled
(),
ENTER_TYPE_ACTIVITY
)
}
else
if
(
TextUtils
.
equals
(
payType
,
ALIPAY
))
{
vipPresenter
.
getVipPayParams
(
"ALIPAY"
,
vipBean
.
pid
,
isAliPayInstalled
(),
ENTER_TYPE_ACTIVITY
"ALIPAY"
,
vipBean
.
pid
,
isAliPayInstalled
(),
ENTER_TYPE_ACTIVITY
)
}
}
...
...
@@ -412,7 +415,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
)
...
...
@@ -492,22 +495,22 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
vipPresenter
.
queryVipOrder
(
wxParanBean
.
tid
.
toString
(),
false
)
mainHandler
.
postDelayed
(
{
if
(
isFinishing
)
return
@postDelayed
{
if
(
isFinishing
)
return
@postDelayed
// 挽留弹窗存在也不弹
if
(
payYesDialog
!=
null
&&
payYesDialog
!!
.
isShowing
)
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
()
if
(
vipList
!=
null
&&
vipList
!!
.
size
>
0
)
{
val
vipBean
=
vipList
!!
[
vipAdapter
.
getPosition
()]
// 0.01
if
(
vipBean
.
trial
!=
0
)
{
showPayCancelDialog
()
}
}
}
},
2000
},
2000
)
}
})
...
...
@@ -564,16 +567,16 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
val
vipBean
=
vipList
!!
[
vipAdapter
.
getPosition
()]
if
(
TextUtils
.
equals
(
payType
,
WEIXIN_PAY
))
{
vipPresenter
.
getVipPayParams
(
"WEIXIN"
,
vipBean
.
pid
,
isAliPayInstalled
(),
ENTER_TYPE_DIALOG
"WEIXIN"
,
vipBean
.
pid
,
isAliPayInstalled
(),
ENTER_TYPE_DIALOG
)
}
else
if
(
TextUtils
.
equals
(
payType
,
ALIPAY
))
{
vipPresenter
.
getVipPayParams
(
"ALIPAY"
,
vipBean
.
pid
,
isAliPayInstalled
(),
ENTER_TYPE_DIALOG
"ALIPAY"
,
vipBean
.
pid
,
isAliPayInstalled
(),
ENTER_TYPE_DIALOG
)
}
}
else
{
...
...
@@ -620,15 +623,15 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
R
.
id
.
tv_agreement_next
->
{
if
(
TextUtils
.
equals
(
payType
,
WEIXIN_PAY
))
{
vipPresenter
.
getVipPayParams
(
"WEIXIN"
,
vipBean
.
pid
,
isAliPayInstalled
(),
ENTER_TYPE_ACTIVITY
"WEIXIN"
,
vipBean
.
pid
,
isAliPayInstalled
(),
ENTER_TYPE_ACTIVITY
)
}
else
if
(
TextUtils
.
equals
(
payType
,
ALIPAY
))
{
vipPresenter
.
getVipPayParams
(
"ALIPAY"
,
vipBean
.
pid
,
isAliPayInstalled
(),
ENTER_TYPE_ACTIVITY
"ALIPAY"
,
vipBean
.
pid
,
isAliPayInstalled
(),
ENTER_TYPE_ACTIVITY
)
}
...
...
@@ -637,10 +640,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
{
...
...
@@ -671,15 +674,15 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
}
else
{
if
(
TextUtils
.
equals
(
payType
,
WEIXIN_PAY
))
{
vipPresenter
.
getVipPayParams
(
"WEIXIN"
,
vipBean
.
pid
,
isAliPayInstalled
(),
ENTER_TYPE_ACTIVITY
"WEIXIN"
,
vipBean
.
pid
,
isAliPayInstalled
(),
ENTER_TYPE_ACTIVITY
)
}
else
if
(
TextUtils
.
equals
(
payType
,
ALIPAY
))
{
vipPresenter
.
getVipPayParams
(
"ALIPAY"
,
vipBean
.
pid
,
isAliPayInstalled
(),
ENTER_TYPE_ACTIVITY
"ALIPAY"
,
vipBean
.
pid
,
isAliPayInstalled
(),
ENTER_TYPE_ACTIVITY
)
}
}
...
...
@@ -702,7 +705,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
)
...
...
@@ -724,23 +727,23 @@ 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
)
}
...
...
@@ -754,13 +757,13 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
vipPresenter
.
getVipPayParams
(
"ALIPAY"
,
vipBean
.
pid
,
isAliPayInstalled
(),
ENTER_TYPE_DIALOG
"ALIPAY"
,
vipBean
.
pid
,
isAliPayInstalled
(),
ENTER_TYPE_DIALOG
)
}
})
.
show
()
.
show
()
}
fun
startTimer
()
{
...
...
@@ -796,11 +799,11 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
try
{
val
alipayAppId
=
"2021004157617228"
val
path
=
"app_uid="
+
UserManager
.
getInstance
().
userID
+
"&package_app="
+
Constant
.
MINTS_PKG_NAME
//这里是传的参数
"app_uid="
+
UserManager
.
getInstance
().
userID
+
"&package_app="
+
Constant
.
MINTS_PKG_NAME
//这里是传的参数
val
link
=
URLEncoder
.
encode
(
path
,
"UTF-8"
)
//这里是encode传的参数
val
url
=
// "alipays://platformapi/startapp?appId=2021004129666486&page=pages/loading&query=" + link
"alipays://platformapi/startapp?appId="
+
alipayAppId
+
"&page=pages/loading&query="
+
link
"alipays://platformapi/startapp?appId="
+
alipayAppId
+
"&page=pages/loading&query="
+
link
val
uri
=
Uri
.
parse
(
url
)
// url为你要链接的地址
val
intent
=
Intent
(
Intent
.
ACTION_VIEW
,
uri
)
startActivity
(
intent
)
...
...
@@ -812,14 +815,14 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
private
fun
openWxApp
()
{
// AppConfig.enterAlipay = true
try
{
val
appId
=
"wxdafe24fe177a5661"
// 填移动应用(App)的 AppId,非小程序的 AppID
val
appId
=
wxAppId
// 填移动应用(App)的 AppId,非小程序的 AppID
val
api
:
IWXAPI
=
WXAPIFactory
.
createWXAPI
(
context
,
appId
)
val
req
=
WXLaunchMiniProgram
.
Req
()
req
.
userName
=
"gh_439c32026e1b"
// 填小程序原始id
req
.
path
=
"/pages/loading?testApp1=mcg1&testApp2=mcg2"
////拉起小程序页面的可带参路径,不填默认拉起小程序首页,对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。
"/pages/loading?"
+
"app_uid="
+
UserManager
.
getInstance
().
userID
+
"&package_app="
+
Constant
.
MINTS_PKG_NAME
+
"&source_type=android"
req
.
miniprogramType
=
WXLaunchMiniProgram
.
Req
.
MINIPTOGRAM_TYPE_RELEASE
// 可选打开 开发版,体验版和正式版
WXLaunchMiniProgram
.
Req
.
MINIPTOGRAM_TYPE_RELEASE
// 可选打开 开发版,体验版和正式版
api
.
sendReq
(
req
)
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
...
...
video/app/src/main/res/layout/dialog_powe2.xml
View file @
03e5e97e
...
...
@@ -17,7 +17,7 @@
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"20dp"
android:text=
"欢迎使用
爱都安居
"
android:text=
"欢迎使用"
android:textColor=
"@color/black"
android:textSize=
"18sp"
android:textStyle=
"bold"
/>
...
...
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