Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_street
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_street
Commits
5f46575c
Commit
5f46575c
authored
Jul 14, 2021
by
张释方
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交支付界面代码
parent
49d0ee24
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
211 additions
and
45 deletions
+211
-45
GridPaymentAdapter.kt
.../main/java/com/mints/street/adapter/GridPaymentAdapter.kt
+45
-0
LoginActivity.kt
app/src/main/java/com/mints/street/login/LoginActivity.kt
+32
-2
LoginViewModel.kt
app/src/main/java/com/mints/street/login/LoginViewModel.kt
+6
-3
BindMobileActivity.kt
.../main/java/com/mints/street/main/my/BindMobileActivity.kt
+1
-0
BindMobileViewModel.kt
...main/java/com/mints/street/main/my/BindMobileViewModel.kt
+30
-0
MyFragment.kt
app/src/main/java/com/mints/street/main/my/MyFragment.kt
+0
-1
OpenvipActivity.kt
...src/main/java/com/mints/street/main/my/OpenvipActivity.kt
+20
-0
btn_payment_selectored.xml
app/src/main/res/drawable/btn_payment_selectored.xml
+5
-0
shape_bg_payment.xml
app/src/main/res/drawable/shape_bg_payment.xml
+6
-0
shape_bg_payment_down.xml
app/src/main/res/drawable/shape_bg_payment_down.xml
+6
-0
activity_bindmobile.xml
app/src/main/res/layout/activity_bindmobile.xml
+8
-5
activity_login.xml
app/src/main/res/layout/activity_login.xml
+1
-0
activity_openvip.xml
app/src/main/res/layout/activity_openvip.xml
+11
-30
item_grid_map_adapter.xml
app/src/main/res/layout/item_grid_map_adapter.xml
+4
-4
item_grid_payment_adpater.xml
app/src/main/res/layout/item_grid_payment_adpater.xml
+36
-0
No files found.
app/src/main/java/com/mints/street/adapter/GridPaymentAdapter.kt
0 → 100644
View file @
5f46575c
package
com.mints.street.adapter
import
android.content.Context
import
android.graphics.Paint
import
com.alibaba.android.vlayout.layout.GridLayoutHelper
import
com.fry.base.adapter.AbstractVLayoutBaseAdapter
import
com.fry.base.adapter.BindingViewHolder
import
com.fry.base.binding.setMargin
import
com.mints.street.R
import
com.mints.street.databinding.ItemGridPaymentAdpaterBinding
import
me.goldze.mvvmhabit.utils.AppUtils
class
GridPaymentAdapter
(
val
context
:
Context
,
val
list
:
List
<
String
>)
:
AbstractVLayoutBaseAdapter
<
ItemGridPaymentAdpaterBinding
,
List
<
String
>>(
context
,
list
,
3
)
{
private
var
mposition
:
Int
=
-
1
override
fun
onBindViewHolder
(
holder
:
BindingViewHolder
<
ItemGridPaymentAdpaterBinding
>,
position
:
Int
)
{
holder
.
binding
.
text1
.
paint
.
flags
=
Paint
.
FAKE_BOLD_TEXT_FLAG
var
a
=
holder
.
binding
.
bg
.
layoutParams
holder
.
binding
.
bg
.
setMargin
(
AppUtils
.
dp2Px
(
context
,
10F
),
0
,
AppUtils
.
dp2Px
(
context
,
10F
),
0
,
null
,
null
,
null
)
holder
.
itemView
.
setOnClickListener
{
mposition
=
holder
.
adapterPosition
holder
.
binding
.
bg
.
setBackgroundResource
(
R
.
drawable
.
shape_bg_payment_down
)
notifyDataSetChanged
()
}
if
(
mposition
==
position
)
{
holder
.
binding
.
bg
.
setBackgroundResource
(
R
.
drawable
.
shape_bg_payment_down
)
}
else
{
holder
.
binding
.
bg
.
setBackgroundResource
(
R
.
drawable
.
shape_bg_payment
)
}
}
override
fun
getItemCount
()
=
list
.
size
override
fun
onCreateLayoutHelper
()
=
GridLayoutHelper
(
3
)
override
fun
getLayoutId
(
viewType
:
Int
)
=
R
.
layout
.
item_grid_payment_adpater
}
\ No newline at end of file
app/src/main/java/com/mints/street/login/LoginActivity.kt
View file @
5f46575c
...
...
@@ -3,12 +3,17 @@ package com.mints.street.login
import
android.graphics.Color
import
android.os.Bundle
import
android.os.PersistableBundle
import
android.text.TextUtils
import
android.view.View
import
androidx.lifecycle.Observer
import
com.fry.base.base.BaseActivity
import
com.mints.street.BR
import
com.mints.street.R
import
com.mints.street.databinding.ActivityLoginBinding
import
com.mints.street.manager.UserManager
import
com.mints.street.utils.BackInputUtil
import
kotlinx.android.synthetic.main.activity_bindmobile.*
import
kotlinx.android.synthetic.main.activity_login.*
import
kotlinx.android.synthetic.main.include_header.*
import
me.goldze.mvvmhabit.utils.ToastUtils
...
...
@@ -17,6 +22,8 @@ import me.goldze.mvvmhabit.utils.ToastUtils
*/
class
LoginActivity
:
BaseActivity
<
ActivityLoginBinding
,
LoginViewModel
>(),
View
.
OnClickListener
{
private
var
mobile
:
String
?
=
null
override
fun
initContentView
(
savedInstanceState
:
Bundle
?)
=
R
.
layout
.
activity_login
override
fun
initVariableId
()
=
BR
.
viewModel
...
...
@@ -30,7 +37,22 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View
private
fun
initListener
()
{
binding
.
button
.
setOnClickListener
{
viewModel
.
login
(
"18311400069"
,
"123456"
)
viewModel
.
login
(
"18311400069"
,
"123456"
)
}
binding
.
tvSendSms
.
setOnClickListener
{
// ToastUtils.showLong("点击获取验证码")
var
mobile
=
et_phone
.
text
.
toString
().
trim
()
if
(
mobile
.
length
<
13
)
{
ToastUtils
.
showLong
(
"请输入手机号"
)
return
@setOnClickListener
}
mobile
=
mobile
.
replace
(
" "
.
toRegex
(),
""
)
viewModel
.
sendMobileCode
(
mobile
)
}
iv_left_icon
.
setOnClickListener
(
this
)
...
...
@@ -42,11 +64,19 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View
iv_left_icon
.
setImageResource
(
R
.
mipmap
.
iv_return_white
)
iv_left_icon
.
visibility
=
View
.
VISIBLE
//手机号设置格式
BackInputUtil
.
phoneNumAddSpace
(
et_phone
)
/*mobile = UserManager.INSTANCE.getMobile()
if (!TextUtils.isEmpty(mobile)) {
et_sms.setText(mobile)
et_sms.setSelection(mobile!!.length + 2)
}*/
}
override
fun
initViewObservable
()
{
super
.
initViewObservable
()
viewModel
.
data
.
observe
(
this
,
Observer
<
String
>{
viewModel
.
data
.
observe
(
this
,
Observer
<
String
>
{
ToastUtils
.
showLong
(
"初始化成功"
)
})
...
...
app/src/main/java/com/mints/street/login/LoginViewModel.kt
View file @
5f46575c
...
...
@@ -47,6 +47,10 @@ class LoginViewModel(application: Application) : BaseViewModel(application) {
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
Any
>)
{
KLog
.
e
(
"sendMobileCode"
,
response
.
result
.
toString
())
}
override
fun
onError
(
e
:
Throwable
)
{
data
.
value
=
"失败"
KLog
.
e
(
"sendMobileCode"
,
"发送验证码错误"
)
}
})
}
...
...
@@ -62,10 +66,9 @@ class LoginViewModel(application: Application) : BaseViewModel(application) {
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
UserBean
>)
{
data
.
value
=
response
.
message
KLog
.
e
(
"login"
,
response
.
result
.
toString
())
ToastUtils
.
showShort
(
"登录信息="
+
response
.
result
.
ConsumerBean
().
idcode
)
//
ToastUtils.showShort("登录信息="+response.result.ConsumerBean().idcode)
//展示业务逻辑
UserManager
.
INSTANCE
.
saveUserInfo
(
response
.
result
)
this
@LoginViewModel
.
saveTerminalInfo
()
}
...
...
app/src/main/java/com/mints/street/main/my/BindMobileActivity.kt
View file @
5f46575c
...
...
@@ -60,6 +60,7 @@ class BindMobileActivity : BaseActivity<ActivityBindmobileBinding, BindMobileVie
mobile
=
mobile
.
replace
(
" "
.
toRegex
(),
""
)
// loginPresenter.sendMobileBindingCode(mobile)
viewModel
.
sendMobileCode
(
mobile
)
}
R
.
id
.
tvLoginNext
->
{
var
mobile
=
etLoginMobile
.
text
.
toString
().
trim
()
...
...
app/src/main/java/com/mints/street/main/my/BindMobileViewModel.kt
View file @
5f46575c
package
com.mints.street.main.my
import
android.app.Application
import
androidx.lifecycle.MutableLiveData
import
com.mints.street.model.ApiModel
import
com.mints.street.netwrok.base.HttpSubscribeImpl
import
me.goldze.mvvmhabit.base.BaseViewModel
import
me.goldze.mvvmhabit.http.BaseResponse
import
me.goldze.mvvmhabit.utils.KLog
import
java.util.HashMap
class
BindMobileViewModel
(
application
:
Application
):
BaseViewModel
(
application
)
{
val
data
:
MutableLiveData
<
String
>
=
MutableLiveData
()
/**
* 手机验证码
*
* @param mobile
*/
fun
sendMobileCode
(
mobile
:
String
)
{
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"mobile"
]
=
mobile
vo
[
"type"
]
=
1
ApiModel
.
sendMobileCode
(
lifecycleProvider
,
vo
).
safeSubscribe
(
object
:
HttpSubscribeImpl
<
BaseResponse
<
Any
>>(
this
@BindMobileViewModel
,
true
)
{
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
Any
>)
{
KLog
.
e
(
"sendMobileCode"
,
response
.
result
.
toString
())
}
override
fun
onError
(
e
:
Throwable
)
{
data
.
value
=
"失败"
KLog
.
e
(
"sendMobileCode"
,
"发送验证码错误"
)
}
})
}
}
app/src/main/java/com/mints/street/main/my/MyFragment.kt
View file @
5f46575c
...
...
@@ -40,7 +40,6 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), View.OnClickL
override
fun
initData
()
{
super
.
initData
()
initView
()
}
private
fun
initView
()
{
...
...
app/src/main/java/com/mints/street/main/my/OpenvipActivity.kt
View file @
5f46575c
...
...
@@ -2,9 +2,14 @@ package com.mints.street.main.my
import
android.graphics.Color
import
android.os.Bundle
import
android.view.View
import
com.alibaba.android.vlayout.DelegateAdapter
import
com.alibaba.android.vlayout.VirtualLayoutManager
import
com.fry.base.base.BaseActivity
import
com.mints.street.BR
import
com.mints.street.R
import
com.mints.street.adapter.EnterDestinationAdapter
import
com.mints.street.adapter.GridMapAdapter
import
com.mints.street.adapter.GridPaymentAdapter
import
com.mints.street.databinding.ActivityOpenvipBinding
import
kotlinx.android.synthetic.main.activity_openvip.*
import
kotlinx.android.synthetic.main.include_header.*
...
...
@@ -12,6 +17,11 @@ import kotlinx.android.synthetic.main.include_header.*
class
OpenvipActivity
:
BaseActivity
<
ActivityOpenvipBinding
,
OpenvipViewModel
>(),
View
.
OnClickListener
{
// private var vLayout: VirtualLayoutManager? = null
// private var mAdapter: DelegateAdapter? = null
private
var
vLayout
:
VirtualLayoutManager
?=
null
private
var
mAdapter
:
DelegateAdapter
?=
null
override
fun
initVariableId
()
=
BR
.
viewModel
override
fun
initContentView
(
savedInstanceState
:
Bundle
?)=
R
.
layout
.
activity_openvip
override
fun
initData
()
{
...
...
@@ -45,6 +55,16 @@ class OpenvipActivity: BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>(),
tv_title
.
setTextColor
(
Color
.
WHITE
)
iv_left_icon
.
setImageResource
(
R
.
mipmap
.
ic_arrow_back
)
iv_left_icon
.
visibility
=
View
.
VISIBLE
//recycleView管理
vLayout
=
VirtualLayoutManager
(
this
)
mAdapter
=
DelegateAdapter
(
vLayout
,
false
)
binding
.
listview
.
adapter
=
mAdapter
binding
.
listview
.
layoutManager
=
vLayout
mAdapter
?.
addAdapter
(
GridPaymentAdapter
(
this
,
listOf
(
"1"
,
"2"
,
"3"
)))
}
override
fun
onClick
(
v
:
View
?)
{
...
...
app/src/main/res/drawable/btn_payment_selectored.xml
0 → 100644
View file @
5f46575c
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"@drawable/shape_bg_payment"
android:state_enabled=
"true"
/>
<item
android:drawable=
"@drawable/shape_bg_payment_down"
android:state_enabled=
"false"
/>
</selector>
\ No newline at end of file
app/src/main/res/drawable/shape_bg_payment.xml
0 → 100644
View file @
5f46575c
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"@color/white"
/>
<corners
android:radius=
"2dp"
/>
<stroke
android:color=
"#FF9800"
android:width=
"1dp"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/shape_bg_payment_down.xml
0 → 100644
View file @
5f46575c
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"#F6CF82"
/>
<corners
android:radius=
"2dp"
/>
<stroke
android:color=
"#FF9800"
android:width=
"1dp"
/>
</shape>
\ No newline at end of file
app/src/main/res/layout/activity_bindmobile.xml
View file @
5f46575c
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<data>
<variable
name=
"viewModel"
type=
"com.mints.street.main.my.BindMobileViewModel"
/>
</data>
<data>
<variable
name=
"viewModel"
type=
"com.mints.street.main.my.BindMobileViewModel"
/>
</data>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
...
...
app/src/main/res/layout/activity_login.xml
View file @
5f46575c
...
...
@@ -55,6 +55,7 @@
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
android:layout_marginStart=
"10dp"
android:paddingRight=
"20dp"
android:background=
"@null"
android:gravity=
"center_vertical"
android:hint=
"@string/str_input_phone"
...
...
app/src/main/res/layout/activity_openvip.xml
View file @
5f46575c
...
...
@@ -356,36 +356,17 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_margin=
"10dp"
android:orientation=
"horizontal"
>
<View
android:layout_width=
"100dp"
android:layout_height=
"100dp"
android:layout_marginRight=
"10dp"
android:background=
"@drawable/shape_bt_disagree"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/imageView"
/>
<View
android:layout_width=
"100dp"
android:layout_height=
"100dp"
android:layout_marginRight=
"10dp"
android:background=
"@drawable/shape_bt_disagree"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/imageView"
/>
<View
android:layout_width=
"100dp"
android:layout_height=
"100dp"
android:background=
"@drawable/shape_bt_disagree"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/imageView"
/>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:orientation=
"horizontal"
>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/listview"
android:layout_width=
"match_parent"
android:layout_height=
"100dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
...
...
app/src/main/res/layout/item_grid_map_adapter.xml
View file @
5f46575c
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<layout
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<data>
<variable
name=
"viewModel"
type=
"com.mints.street.adapter.GridMapAdapter"
/>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/bg"
android:layout_width=
"150dp"
android:layout_height=
"150dp"
android:background=
"@drawable/shape_gold_card_20"
>
android:background=
"@drawable/shape_gold_card_20"
>
<ImageView
android:id=
"@+id/image"
app:layout_constraintTop_toTopOf=
"parent"
...
...
app/src/main/res/layout/item_grid_payment_adpater.xml
0 → 100644
View file @
5f46575c
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<data>
<variable
name=
"viewModel"
type=
"com.mints.street.adapter.GridPaymentAdapter"
/>
</data>
<LinearLayout
android:id=
"@+id/bg"
android:layout_width=
"100dp"
android:layout_height=
"100dp"
android:orientation=
"vertical"
android:gravity=
"center"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"6个月"
android:textColor=
"@color/black"
android:textStyle=
"bold"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"¥68.0"
android:textStyle=
"bold"
android:textSize=
"20dp"
android:textColor=
"#FF5722"
/>
<TextView
android:id=
"@+id/text1"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"原价¥108.0"
android:textSize=
"8dp"
android:textColor=
"#25000000"
/>
</LinearLayout>
</layout>
\ No newline at end of file
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