Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_freeworld
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_freeworld
Commits
8797c2a5
Commit
8797c2a5
authored
Aug 09, 2021
by
张释方
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化支付方式顺序
parent
7b3f6b7f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
46 deletions
+50
-46
OpenvipActivity.kt
...src/main/java/com/mints/street/main/my/OpenvipActivity.kt
+42
-40
shape_dialog_bg.xml
app/src/main/res/drawable/shape_dialog_bg.xml
+1
-1
activity_openvip.xml
app/src/main/res/layout/activity_openvip.xml
+2
-2
layout_hotview.xml
app/src/main/res/layout/layout_hotview.xml
+5
-3
No files found.
app/src/main/java/com/mints/street/main/my/OpenvipActivity.kt
View file @
8797c2a5
...
@@ -202,10 +202,6 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
...
@@ -202,10 +202,6 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
if
(
it
.
list
.
isNullOrEmpty
())
{
if
(
it
.
list
.
isNullOrEmpty
())
{
return
@Observer
return
@Observer
}
else
{
}
else
{
//设置 默认支付方式 (根据返回参数的第一个值)
if
(
it
.
list
!!
[
0
].
isNotEmpty
())
{
setfirstpaymentwey
(
it
.
list
!!
[
0
])
}
for
(
str
in
it
.
list
!!
)
{
for
(
str
in
it
.
list
!!
)
{
if
(
str
.
isNotEmpty
()
&&
str
.
equals
(
"WEIXIN"
))
{
if
(
str
.
isNotEmpty
()
&&
str
.
equals
(
"WEIXIN"
))
{
//第一个位置是否展示
//第一个位置是否展示
...
@@ -214,18 +210,18 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
...
@@ -214,18 +210,18 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
iv_ly_payfirst
.
setImageResource
(
R
.
mipmap
.
icon_pay_wx
)
iv_ly_payfirst
.
setImageResource
(
R
.
mipmap
.
icon_pay_wx
)
tv_ly_payfirst
.
setText
(
"微信支付"
)
tv_ly_payfirst
.
setText
(
"微信支付"
)
ly_payfirst
.
visibility
=
View
.
VISIBLE
ly_payfirst
.
visibility
=
View
.
VISIBLE
}
else
{
}
else
{
iv_ly_paysecond
.
setImageResource
(
R
.
mipmap
.
icon_pay_wx
)
iv_ly_paysecond
.
setImageResource
(
R
.
mipmap
.
icon_pay_wx
)
tv_ly_paysecond
.
setText
(
"微信支付"
)
tv_ly_paysecond
.
setText
(
"微信支付"
)
ly_paysecond
.
visibility
=
View
.
VISIBLE
ly_paysecond
.
visibility
=
View
.
VISIBLE
}
}
if
(
TextUtils
.
isEmpty
(
currentPayType
))
{
/*
if (TextUtils.isEmpty(currentPayType)) {
currentPayType = "WEIXIN"
currentPayType = "WEIXIN"
}
}
//
ly_payfirst.visibility = View.VISIBLE
ly_payfirst.visibility = View.VISIBLE
//
if (TextUtils.isEmpty(currentPayType)) {
if (TextUtils.isEmpty(currentPayType)) {
//
currentPayType = "WEIXIN"
currentPayType = "WEIXIN"
// }
}*/
}
}
if
(
str
.
equals
(
"ALIPAY"
))
{
if
(
str
.
equals
(
"ALIPAY"
))
{
//第一个位置是否展示
//第一个位置是否展示
...
@@ -234,19 +230,21 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
...
@@ -234,19 +230,21 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
iv_ly_payfirst
.
setImageResource
(
R
.
mipmap
.
icon_pay_zfb
)
iv_ly_payfirst
.
setImageResource
(
R
.
mipmap
.
icon_pay_zfb
)
tv_ly_payfirst
.
setText
(
"支付宝支付"
)
tv_ly_payfirst
.
setText
(
"支付宝支付"
)
ly_payfirst
.
visibility
=
View
.
VISIBLE
ly_payfirst
.
visibility
=
View
.
VISIBLE
}
else
{
}
else
{
iv_ly_paysecond
.
setImageResource
(
R
.
mipmap
.
icon_pay_zfb
)
iv_ly_paysecond
.
setImageResource
(
R
.
mipmap
.
icon_pay_zfb
)
tv_ly_paysecond
.
setText
(
"支付宝支付"
)
tv_ly_paysecond
.
setText
(
"支付宝支付"
)
ly_paysecond
.
visibility
=
View
.
VISIBLE
ly_paysecond
.
visibility
=
View
.
VISIBLE
}
}
if
(
TextUtils
.
isEmpty
(
currentPayType
))
{
/*
if (TextUtils.isEmpty(currentPayType)) {
currentPayType = "ALIPAY"
currentPayType = "ALIPAY"
}
}
//
ly_second.visibility = View.VISIBLE
ly_second.visibility = View.VISIBLE
//
if (TextUtils.isEmpty(currentPayType)) {
if (TextUtils.isEmpty(currentPayType)) {
//
currentPayType = "ALIPAY"
currentPayType = "ALIPAY"
// }
}*/
}
}
//设置 默认支付方式 (根据返回参数的第一个值)
setOnChecked
(
1
,
tv_ly_payfirst
.
text
)
}
}
}
}
...
@@ -270,28 +268,19 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
...
@@ -270,28 +268,19 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
return
true
return
true
}
}
private
fun
setfirstpaymentwey
(
paymentwey
:
String
)
{
if
(
paymentwey
.
equals
(
"WEIXIN"
))
{
setOnChecked
(
1
)
}
else
{
setOnChecked
(
2
)
}
}
override
fun
onClick
(
v
:
View
?)
{
override
fun
onClick
(
v
:
View
?)
{
when
(
v
?.
id
)
{
when
(
v
?.
id
)
{
R
.
id
.
iv_left_icon
->
{
R
.
id
.
iv_left_icon
->
{
backvipDialog
()
backvipDialog
()
}
}
R
.
id
.
ly_payfirst
->
{
//微信支付
R
.
id
.
ly_payfirst
->
{
//设置选中样式
//设置选中样式
setOnChecked
(
1
)
setOnChecked
(
1
,
tv_ly_payfirst
.
text
)
currentPayType
=
"WEIXIN"
}
}
R
.
id
.
ly_paysecond
->
{
//支付宝支付
R
.
id
.
ly_paysecond
->
{
//设置选中样式
//设置选中样式
setOnChecked
(
2
)
setOnChecked
(
2
,
tv_ly_paysecond
.
text
)
currentPayType
=
"ALIPAY"
}
}
R
.
id
.
bt_try
->
{
//点击开通全球会员按钮
R
.
id
.
bt_try
->
{
//点击开通全球会员按钮
if
(
UserManager
.
INSTANCE
.
userIsLogin
())
{
if
(
UserManager
.
INSTANCE
.
userIsLogin
())
{
...
@@ -303,6 +292,16 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
...
@@ -303,6 +292,16 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
}
}
}
}
//设置选中标记
private
fun
setpayweyflag
(
textflag
:
CharSequence
?)
{
if
(
textflag
!!
.
equals
(
"微信支付"
))
{
currentPayType
=
"WEIXIN"
}
else
{
currentPayType
=
"ALIPAY"
}
}
private
fun
payVip
()
{
private
fun
payVip
()
{
if
(
vipList
!=
null
&&
vipList
!!
.
size
>
0
&&
gridPaymentAdapter
!=
null
)
{
if
(
vipList
!=
null
&&
vipList
!!
.
size
>
0
&&
gridPaymentAdapter
!=
null
)
{
if
(
TextUtils
.
equals
(
"WEIXIN"
,
currentPayType
))
{
if
(
TextUtils
.
equals
(
"WEIXIN"
,
currentPayType
))
{
...
@@ -337,18 +336,21 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
...
@@ -337,18 +336,21 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
/**
/**
* 设置选中支付方式view样式
* 设置选中支付方式view样式
* 1--
微信支付
* 1--
第一个支付方式
* 2--
支付宝支付
* 2--
第二个支付方式
*/
*/
private
fun
setOnChecked
(
paymentflag
:
Int
?)
{
private
fun
setOnChecked
(
paymentflag
:
Int
?,
textflag
:
CharSequence
?)
{
//设置选中方式
setpayweyflag
(
textflag
)
//设置选中方式样式
when
(
paymentflag
)
{
when
(
paymentflag
)
{
1
->
{
//选中
微信
1
->
{
//选中
第一个
iv_
weixin
.
setImageResource
(
R
.
mipmap
.
pay_select
)
iv_
payfirst
.
setImageResource
(
R
.
mipmap
.
pay_select
)
iv_
alipay
.
setImageResource
(
R
.
mipmap
.
pay_unselect
)
iv_
paysecond
.
setImageResource
(
R
.
mipmap
.
pay_unselect
)
}
}
2
->
{
//选中
支付宝
2
->
{
//选中
第二个
iv_
weixin
.
setImageResource
(
R
.
mipmap
.
pay_unselect
)
iv_
payfirst
.
setImageResource
(
R
.
mipmap
.
pay_unselect
)
iv_
alipay
.
setImageResource
(
R
.
mipmap
.
pay_select
)
iv_
paysecond
.
setImageResource
(
R
.
mipmap
.
pay_select
)
}
}
}
}
}
}
...
...
app/src/main/res/drawable/shape_dialog_bg.xml
View file @
8797c2a5
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<corners
<corners
android:topLeftRadius=
"2
5
dp"
android:topLeftRadius=
"2
0
dp"
android:topRightRadius=
"25dp"
/>
android:topRightRadius=
"25dp"
/>
<solid
android:color=
"#E6FFFFFF"
/>
<solid
android:color=
"#E6FFFFFF"
/>
</shape>
</shape>
\ No newline at end of file
app/src/main/res/layout/activity_openvip.xml
View file @
8797c2a5
...
@@ -118,7 +118,7 @@
...
@@ -118,7 +118,7 @@
android:textSize=
"18sp"
/>
android:textSize=
"18sp"
/>
<ImageView
<ImageView
android:id=
"@+id/iv_
weixin
"
android:id=
"@+id/iv_
payfirst
"
android:layout_width=
"20dp"
android:layout_width=
"20dp"
android:layout_height=
"20dp"
android:layout_height=
"20dp"
android:layout_gravity=
"center_vertical"
android:layout_gravity=
"center_vertical"
...
@@ -155,7 +155,7 @@
...
@@ -155,7 +155,7 @@
android:textSize=
"18sp"
/>
android:textSize=
"18sp"
/>
<ImageView
<ImageView
android:id=
"@+id/iv_
alipay
"
android:id=
"@+id/iv_
paysecond
"
android:layout_width=
"20dp"
android:layout_width=
"20dp"
android:layout_height=
"20dp"
android:layout_height=
"20dp"
android:layout_gravity=
"center_vertical"
android:layout_gravity=
"center_vertical"
...
...
app/src/main/res/layout/layout_hotview.xml
View file @
8797c2a5
...
@@ -6,9 +6,11 @@
...
@@ -6,9 +6,11 @@
android:background=
"@drawable/shape_dialog_bg"
>
android:background=
"@drawable/shape_dialog_bg"
>
<ImageView
<ImageView
android:id=
"@+id/iv_close"
android:id=
"@+id/iv_close"
android:layout_width=
"30dp"
android:layout_width=
"20dp"
android:layout_height=
"30dp"
android:layout_height=
"20dp"
android:layout_margin=
"8dp"
android:layout_marginTop=
"8dp"
android:layout_marginRight=
"8dp"
android:layout_marginBottom=
"5dp"
android:src=
"@mipmap/icon_hot_view_close"
android:src=
"@mipmap/icon_hot_view_close"
android:layout_gravity=
"end"
/>
android:layout_gravity=
"end"
/>
<androidx.recyclerview.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
...
...
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