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
5e296a17
Commit
5e296a17
authored
Oct 31, 2024
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
4860ce9b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
26 deletions
+45
-26
VipActivity.kt
.../java/com/duben/miaoquplaylet/ui/activitys/VipActivity.kt
+20
-17
RuleAgreementDialog.kt
...com/duben/miaoquplaylet/ui/widgets/RuleAgreementDialog.kt
+24
-9
dialog_agreement_rule.xml
video/app/src/main/res/layout/dialog_agreement_rule.xml
+1
-0
No files found.
video/app/src/main/java/com/duben/miaoquplaylet/ui/activitys/VipActivity.kt
View file @
5e296a17
...
@@ -254,10 +254,10 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
...
@@ -254,10 +254,10 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
//0 app内部,1.只签约转支付宝浏览器支付 2.带uid转支付宝小程序(暂定只有一个小程序)
//0 app内部,1.只签约转支付宝浏览器支付 2.带uid转支付宝小程序(暂定只有一个小程序)
when
(
payToModel
)
{
when
(
payToModel
)
{
0
->
{
0
->
{
wxPay
(
paramsBean
,
payToModel
)
wxPay
(
paramsBean
,
payToModel
)
}
}
1
->
{
1
->
{
wxPay
(
paramsBean
,
payToModel
)
wxPay
(
paramsBean
,
payToModel
)
}
}
}
}
}
}
...
@@ -348,22 +348,21 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
...
@@ -348,22 +348,21 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
vipAdapter
.
setPosition
(
0
)
vipAdapter
.
setPosition
(
0
)
vipAdapter
.
notifyDataSetChanged
()
vipAdapter
.
notifyDataSetChanged
()
val
vipBean
=
vipList
!!
[
0
]
if
(
TextUtils
.
equals
(
payType
,
"WEIXIN"
))
{
if
(
TextUtils
.
equals
(
payType
,
WEIXIN_PAY
))
{
ll_vip_alipay
.
visibility
=
View
.
GONE
ll_vip_alipay
.
visibility
=
View
.
GONE
ll_vip_wx
.
visibility
=
View
.
VISIBLE
ll_vip_wx
.
visibility
=
View
.
VISIBLE
payType
=
WEIXIN_PAY
payType
=
WEIXIN_PAY
iv_vip_wx
.
setImageResource
(
R
.
mipmap
.
ic_vip_enable_blue
)
iv_vip_wx
.
setImageResource
(
R
.
mipmap
.
ic_vip_enable_blue
)
iv_vip_alipay
.
setImageResource
(
R
.
mipmap
.
ic_vip_none
)
iv_vip_alipay
.
setImageResource
(
R
.
mipmap
.
ic_vip_none
)
}
else
{
}
else
{
if
(
vipBean
.
trial
==
1
)
{
ll_vip_alipay
.
visibility
=
View
.
VISIBLE
ll_vip_alipay
.
visibility
=
View
.
VISIBLE
ll_vip_wx
.
visibility
=
View
.
GONE
ll_vip_wx
.
visibility
=
View
.
GONE
payType
=
ALIPAY
payType
=
ALIPAY
iv_vip_alipay
.
setImageResource
(
R
.
mipmap
.
ic_vip_enable_blue
)
iv_vip_alipay
.
setImageResource
(
R
.
mipmap
.
ic_vip_enable_blue
)
iv_vip_wx
.
setImageResource
(
R
.
mipmap
.
ic_vip_none
)
iv_vip_wx
.
setImageResource
(
R
.
mipmap
.
ic_vip_none
)
}
}
}
val
vipBean
=
vipList
!!
[
0
]
backPayYesDialog
(
vipBean
)
backPayYesDialog
(
vipBean
)
return
true
return
true
}
}
...
@@ -385,14 +384,18 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
...
@@ -385,14 +384,18 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
vipAdapter
.
setPosition
(
0
)
vipAdapter
.
setPosition
(
0
)
vipAdapter
.
notifyDataSetChanged
()
vipAdapter
.
notifyDataSetChanged
()
val
vipBean
=
vipList
!!
[
0
]
val
vipBean
=
vipList
!!
[
0
]
if
(
vipBean
.
trial
==
1
)
{
if
(
TextUtils
.
equals
(
payType
,
WEIXIN_PAY
))
{
ll_vip_alipay
.
visibility
=
View
.
GONE
ll_vip_wx
.
visibility
=
View
.
VISIBLE
payType
=
WEIXIN_PAY
iv_vip_wx
.
setImageResource
(
R
.
mipmap
.
ic_vip_enable_blue
)
iv_vip_alipay
.
setImageResource
(
R
.
mipmap
.
ic_vip_none
)
}
else
{
ll_vip_alipay
.
visibility
=
View
.
VISIBLE
ll_vip_alipay
.
visibility
=
View
.
VISIBLE
ll_vip_wx
.
visibility
=
View
.
GONE
ll_vip_wx
.
visibility
=
View
.
GONE
payType
=
ALIPAY
payType
=
ALIPAY
iv_vip_alipay
.
setImageResource
(
R
.
mipmap
.
ic_vip_enable_blue
)
iv_vip_alipay
.
setImageResource
(
R
.
mipmap
.
ic_vip_enable_blue
)
iv_vip_wx
.
setImageResource
(
R
.
mipmap
.
ic_vip_none
)
iv_vip_wx
.
setImageResource
(
R
.
mipmap
.
ic_vip_none
)
}
else
{
payType
=
ALIPAY
}
}
backPayYesDialog
(
vipBean
)
backPayYesDialog
(
vipBean
)
}
else
{
}
else
{
...
@@ -476,7 +479,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
...
@@ -476,7 +479,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
}
}
}
}
fun
wxPay
(
wxParanBean
:
WxPayParamBean
,
payToModel
:
Int
)
{
fun
wxPay
(
wxParanBean
:
WxPayParamBean
,
payToModel
:
Int
)
{
val
data
=
wxParanBean
.
params
val
data
=
wxParanBean
.
params
//实例化微信支付策略
//实例化微信支付策略
val
wxPay
:
WXPay
=
WXPay
.
getInstance
()
val
wxPay
:
WXPay
=
WXPay
.
getInstance
()
...
@@ -628,7 +631,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
...
@@ -628,7 +631,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
private
fun
ruleAgreementPayDialog
()
{
private
fun
ruleAgreementPayDialog
()
{
if
(
vipList
!=
null
&&
vipList
!!
.
size
>
0
)
{
if
(
vipList
!=
null
&&
vipList
!!
.
size
>
0
)
{
val
vipBean
=
vipList
!!
[
vipAdapter
.
getPosition
()]
val
vipBean
=
vipList
!!
[
vipAdapter
.
getPosition
()]
ruleAgreementDialog
=
RuleAgreementDialog
(
context
,
object
:
DialogListener
()
{
ruleAgreementDialog
=
RuleAgreementDialog
(
context
,
payType
,
object
:
DialogListener
()
{
override
fun
onClick
(
v
:
View
)
{
override
fun
onClick
(
v
:
View
)
{
if
(!
isFinishing
()
&&
ruleAgreementDialog
!=
null
&&
ruleAgreementDialog
!!
.
isShowing
())
{
if
(!
isFinishing
()
&&
ruleAgreementDialog
!=
null
&&
ruleAgreementDialog
!!
.
isShowing
())
{
ruleAgreementDialog
!!
.
dismiss
()
ruleAgreementDialog
!!
.
dismiss
()
...
...
video/app/src/main/java/com/duben/miaoquplaylet/ui/widgets/RuleAgreementDialog.kt
View file @
5e296a17
...
@@ -3,6 +3,7 @@ package com.duben.miaoquplaylet.ui.widgets
...
@@ -3,6 +3,7 @@ package com.duben.miaoquplaylet.ui.widgets
import
android.app.Dialog
import
android.app.Dialog
import
android.content.Context
import
android.content.Context
import
android.os.Handler
import
android.os.Handler
import
android.text.TextUtils
import
android.view.Gravity
import
android.view.Gravity
import
android.view.KeyEvent
import
android.view.KeyEvent
import
android.view.View
import
android.view.View
...
@@ -12,13 +13,19 @@ import android.widget.TextView
...
@@ -12,13 +13,19 @@ import android.widget.TextView
import
com.daimajia.androidanimations.library.Techniques
import
com.daimajia.androidanimations.library.Techniques
import
com.daimajia.androidanimations.library.YoYo
import
com.daimajia.androidanimations.library.YoYo
import
com.duben.miaoquplaylet.R
import
com.duben.miaoquplaylet.R
import
com.duben.miaoquplaylet.ui.activitys.VipActivity
import
com.duben.miaoquplaylet.ui.widgets.countdowntimer.CountDownTimerSupport
import
com.duben.miaoquplaylet.ui.widgets.countdowntimer.CountDownTimerSupport
import
com.duben.miaoquplaylet.ui.widgets.countdowntimer.OnCountDownTimerListener
import
com.duben.miaoquplaylet.ui.widgets.countdowntimer.OnCountDownTimerListener
import
com.duben.miaoquplaylet.utils.SpanUtils
import
com.duben.miaoquplaylet.utils.SpanUtils
import
com.duben.miaoquplaylet.utils.TimeRender
import
com.duben.miaoquplaylet.utils.TimeRender
import
kotlinx.android.synthetic.main.activity_new_vip.*
import
java.util.*
import
java.util.*
class
RuleAgreementDialog
(
private
val
context
:
Context
,
private
val
listener
:
DialogListener
)
:
class
RuleAgreementDialog
(
private
val
context
:
Context
,
val
payType
:
String
,
private
val
listener
:
DialogListener
)
:
Dialog
(
Dialog
(
context
,
R
.
style
.
dialog
context
,
R
.
style
.
dialog
)
{
)
{
...
@@ -27,6 +34,7 @@ class RuleAgreementDialog(private val context: Context, private val listener: Di
...
@@ -27,6 +34,7 @@ class RuleAgreementDialog(private val context: Context, private val listener: Di
private
val
tv_agreement_next
:
TextView
private
val
tv_agreement_next
:
TextView
private
val
tv_rule_date1
:
TextView
private
val
tv_rule_date1
:
TextView
private
val
tv_rule_date2
:
TextView
private
val
tv_rule_date2
:
TextView
private
val
tv_rule_name
:
TextView
var
timer
:
CountDownTimerSupport
?
=
null
var
timer
:
CountDownTimerSupport
?
=
null
init
{
init
{
...
@@ -52,6 +60,7 @@ class RuleAgreementDialog(private val context: Context, private val listener: Di
...
@@ -52,6 +60,7 @@ class RuleAgreementDialog(private val context: Context, private val listener: Di
iv_agreement_quit
=
findViewById
<
View
>(
R
.
id
.
iv_agreement_quit
)
as
ImageView
iv_agreement_quit
=
findViewById
<
View
>(
R
.
id
.
iv_agreement_quit
)
as
ImageView
tv_rule_date1
=
findViewById
<
View
>(
R
.
id
.
tv_rule_date1
)
as
TextView
tv_rule_date1
=
findViewById
<
View
>(
R
.
id
.
tv_rule_date1
)
as
TextView
tv_rule_date2
=
findViewById
<
View
>(
R
.
id
.
tv_rule_date2
)
as
TextView
tv_rule_date2
=
findViewById
<
View
>(
R
.
id
.
tv_rule_date2
)
as
TextView
tv_rule_name
=
findViewById
<
View
>(
R
.
id
.
tv_rule_name
)
as
TextView
iv_agreement_quit
.
setOnClickListener
(
listener
)
iv_agreement_quit
.
setOnClickListener
(
listener
)
tv_agreement_next
.
setOnClickListener
(
listener
)
tv_agreement_next
.
setOnClickListener
(
listener
)
...
@@ -59,7 +68,13 @@ class RuleAgreementDialog(private val context: Context, private val listener: Di
...
@@ -59,7 +68,13 @@ class RuleAgreementDialog(private val context: Context, private val listener: Di
startTimer
()
startTimer
()
},
200
)
},
200
)
if
(
TextUtils
.
equals
(
payType
,
VipActivity
.
WEIXIN_PAY
))
{
tv_rule_name
.
text
=
"微信支付"
tv_rule_name
.
setCompoundDrawablesWithIntrinsicBounds
(
R
.
mipmap
.
ic_call_wx
,
0
,
0
,
0
)
}
else
{
tv_rule_name
.
text
=
"支付宝支付"
tv_rule_name
.
setCompoundDrawablesWithIntrinsicBounds
(
R
.
mipmap
.
ic_alipay
,
0
,
0
,
0
)
}
}
}
...
@@ -97,13 +112,13 @@ class RuleAgreementDialog(private val context: Context, private val listener: Di
...
@@ -97,13 +112,13 @@ class RuleAgreementDialog(private val context: Context, private val listener: Di
timer
!!
.
start
()
timer
!!
.
start
()
}
}
fun
setText
(
remarks
:
String
,
days
:
Int
,
cash
:
Double
,
title
:
String
)
{
fun
setText
(
remarks
:
String
,
days
:
Int
,
cash
:
Double
,
title
:
String
)
{
tv_rule_date2
.
text
=
TimeRender
.
getDateAfter
(
Date
(),
days
)
+
":"
+
remarks
tv_rule_date2
.
text
=
TimeRender
.
getDateAfter
(
Date
(),
days
)
+
":"
+
remarks
SpanUtils
.
with
(
tv_rule_date1
)
SpanUtils
.
with
(
tv_rule_date1
)
.
append
(
TimeRender
.
formatDateDot
(
Date
()))
.
append
(
TimeRender
.
formatDateDot
(
Date
()))
.
append
(
": "
)
.
append
(
": "
)
.
append
(
"${cash}元开启${title}体验"
)
.
append
(
"${cash}元开启${title}体验"
)
.
setForegroundColor
(
context
.
resources
.
getColor
(
R
.
color
.
main_mints
))
.
setForegroundColor
(
context
.
resources
.
getColor
(
R
.
color
.
main_mints
))
.
create
()
.
create
()
}
}
}
}
\ No newline at end of file
video/app/src/main/res/layout/dialog_agreement_rule.xml
View file @
5e296a17
...
@@ -156,6 +156,7 @@
...
@@ -156,6 +156,7 @@
android:orientation=
"horizontal"
>
android:orientation=
"horizontal"
>
<TextView
<TextView
android:id=
"@+id/tv_rule_name"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:drawableLeft=
"@mipmap/ic_alipay"
android:drawableLeft=
"@mipmap/ic_alipay"
...
...
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