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>()
if
(
it
.
list
.
isNullOrEmpty
())
{
return
@Observer
}
else
{
//设置 默认支付方式 (根据返回参数的第一个值)
if
(
it
.
list
!!
[
0
].
isNotEmpty
())
{
setfirstpaymentwey
(
it
.
list
!!
[
0
])
}
for
(
str
in
it
.
list
!!
)
{
if
(
str
.
isNotEmpty
()
&&
str
.
equals
(
"WEIXIN"
))
{
//第一个位置是否展示
...
...
@@ -214,18 +210,18 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
iv_ly_payfirst
.
setImageResource
(
R
.
mipmap
.
icon_pay_wx
)
tv_ly_payfirst
.
setText
(
"微信支付"
)
ly_payfirst
.
visibility
=
View
.
VISIBLE
}
else
{
}
else
{
iv_ly_paysecond
.
setImageResource
(
R
.
mipmap
.
icon_pay_wx
)
tv_ly_paysecond
.
setText
(
"微信支付"
)
ly_paysecond
.
visibility
=
View
.
VISIBLE
ly_paysecond
.
visibility
=
View
.
VISIBLE
}
if
(
TextUtils
.
isEmpty
(
currentPayType
))
{
/*
if (TextUtils.isEmpty(currentPayType)) {
currentPayType = "WEIXIN"
}
//
ly_payfirst.visibility = View.VISIBLE
//
if (TextUtils.isEmpty(currentPayType)) {
//
currentPayType = "WEIXIN"
// }
ly_payfirst.visibility = View.VISIBLE
if (TextUtils.isEmpty(currentPayType)) {
currentPayType = "WEIXIN"
}*/
}
if
(
str
.
equals
(
"ALIPAY"
))
{
//第一个位置是否展示
...
...
@@ -234,19 +230,21 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
iv_ly_payfirst
.
setImageResource
(
R
.
mipmap
.
icon_pay_zfb
)
tv_ly_payfirst
.
setText
(
"支付宝支付"
)
ly_payfirst
.
visibility
=
View
.
VISIBLE
}
else
{
}
else
{
iv_ly_paysecond
.
setImageResource
(
R
.
mipmap
.
icon_pay_zfb
)
tv_ly_paysecond
.
setText
(
"支付宝支付"
)
ly_paysecond
.
visibility
=
View
.
VISIBLE
ly_paysecond
.
visibility
=
View
.
VISIBLE
}
if
(
TextUtils
.
isEmpty
(
currentPayType
))
{
/*
if (TextUtils.isEmpty(currentPayType)) {
currentPayType = "ALIPAY"
}
//
ly_second.visibility = View.VISIBLE
//
if (TextUtils.isEmpty(currentPayType)) {
//
currentPayType = "ALIPAY"
// }
ly_second.visibility = View.VISIBLE
if (TextUtils.isEmpty(currentPayType)) {
currentPayType = "ALIPAY"
}*/
}
//设置 默认支付方式 (根据返回参数的第一个值)
setOnChecked
(
1
,
tv_ly_payfirst
.
text
)
}
}
...
...
@@ -270,28 +268,19 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
return
true
}
private
fun
setfirstpaymentwey
(
paymentwey
:
String
)
{
if
(
paymentwey
.
equals
(
"WEIXIN"
))
{
setOnChecked
(
1
)
}
else
{
setOnChecked
(
2
)
}
}
override
fun
onClick
(
v
:
View
?)
{
when
(
v
?.
id
)
{
R
.
id
.
iv_left_icon
->
{
backvipDialog
()
}
R
.
id
.
ly_payfirst
->
{
//微信支付
R
.
id
.
ly_payfirst
->
{
//设置选中样式
setOnChecked
(
1
)
currentPayType
=
"WEIXIN"
setOnChecked
(
1
,
tv_ly_payfirst
.
text
)
}
R
.
id
.
ly_paysecond
->
{
//支付宝支付
R
.
id
.
ly_paysecond
->
{
//设置选中样式
setOnChecked
(
2
)
currentPayType
=
"ALIPAY"
setOnChecked
(
2
,
tv_ly_paysecond
.
text
)
}
R
.
id
.
bt_try
->
{
//点击开通全球会员按钮
if
(
UserManager
.
INSTANCE
.
userIsLogin
())
{
...
...
@@ -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
()
{
if
(
vipList
!=
null
&&
vipList
!!
.
size
>
0
&&
gridPaymentAdapter
!=
null
)
{
if
(
TextUtils
.
equals
(
"WEIXIN"
,
currentPayType
))
{
...
...
@@ -337,18 +336,21 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
/**
* 设置选中支付方式view样式
* 1--
微信支付
* 2--
支付宝支付
* 1--
第一个支付方式
* 2--
第二个支付方式
*/
private
fun
setOnChecked
(
paymentflag
:
Int
?)
{
private
fun
setOnChecked
(
paymentflag
:
Int
?,
textflag
:
CharSequence
?)
{
//设置选中方式
setpayweyflag
(
textflag
)
//设置选中方式样式
when
(
paymentflag
)
{
1
->
{
//选中
微信
iv_
weixin
.
setImageResource
(
R
.
mipmap
.
pay_select
)
iv_
alipay
.
setImageResource
(
R
.
mipmap
.
pay_unselect
)
1
->
{
//选中
第一个
iv_
payfirst
.
setImageResource
(
R
.
mipmap
.
pay_select
)
iv_
paysecond
.
setImageResource
(
R
.
mipmap
.
pay_unselect
)
}
2
->
{
//选中
支付宝
iv_
weixin
.
setImageResource
(
R
.
mipmap
.
pay_unselect
)
iv_
alipay
.
setImageResource
(
R
.
mipmap
.
pay_select
)
2
->
{
//选中
第二个
iv_
payfirst
.
setImageResource
(
R
.
mipmap
.
pay_unselect
)
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"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<corners
android:topLeftRadius=
"2
5
dp"
android:topLeftRadius=
"2
0
dp"
android:topRightRadius=
"25dp"
/>
<solid
android:color=
"#E6FFFFFF"
/>
</shape>
\ No newline at end of file
app/src/main/res/layout/activity_openvip.xml
View file @
8797c2a5
...
...
@@ -118,7 +118,7 @@
android:textSize=
"18sp"
/>
<ImageView
android:id=
"@+id/iv_
weixin
"
android:id=
"@+id/iv_
payfirst
"
android:layout_width=
"20dp"
android:layout_height=
"20dp"
android:layout_gravity=
"center_vertical"
...
...
@@ -155,7 +155,7 @@
android:textSize=
"18sp"
/>
<ImageView
android:id=
"@+id/iv_
alipay
"
android:id=
"@+id/iv_
paysecond
"
android:layout_width=
"20dp"
android:layout_height=
"20dp"
android:layout_gravity=
"center_vertical"
...
...
app/src/main/res/layout/layout_hotview.xml
View file @
8797c2a5
...
...
@@ -6,9 +6,11 @@
android:background=
"@drawable/shape_dialog_bg"
>
<ImageView
android:id=
"@+id/iv_close"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:layout_margin=
"8dp"
android:layout_width=
"20dp"
android:layout_height=
"20dp"
android:layout_marginTop=
"8dp"
android:layout_marginRight=
"8dp"
android:layout_marginBottom=
"5dp"
android:src=
"@mipmap/icon_hot_view_close"
android:layout_gravity=
"end"
/>
<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