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
be03d715
Commit
be03d715
authored
Jul 17, 2021
by
张释方
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交防止重复点击代码
parent
69b06f74
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
77 additions
and
32 deletions
+77
-32
LoginActivity.kt
app/src/main/java/com/mints/street/login/LoginActivity.kt
+28
-0
MoresettingsActivity.kt
...ain/java/com/mints/street/main/my/MoresettingsActivity.kt
+17
-8
MyFragment.kt
app/src/main/java/com/mints/street/main/my/MyFragment.kt
+27
-19
shape_gold_blue.xml
app/src/main/res/drawable/shape_gold_blue.xml
+1
-1
activity_login.xml
app/src/main/res/layout/activity_login.xml
+2
-2
activity_permissions.xml
app/src/main/res/layout/activity_permissions.xml
+2
-2
No files found.
app/src/main/java/com/mints/street/login/LoginActivity.kt
View file @
be03d715
...
...
@@ -47,6 +47,7 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View
return
@setOnClickListener
}
sendCodeThread
()
mobile
=
mobile
.
replace
(
" "
.
toRegex
(),
""
)
viewModel
.
sendMobileCode
(
mobile
)
...
...
@@ -117,4 +118,31 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View
R
.
id
.
iv_left_icon
->
finish
()
}
}
/**
* 发送手机验证码,按钮动态改变状态
*/
var
num
=
0
var
run
:
Runnable
?
=
null
fun
sendCodeThread
()
{
num
=
60
tv_send_sms
?.
let
{
it
.
isEnabled
=
false
it
.
text
=
"($num)重新获取"
run
=
object
:
Runnable
{
override
fun
run
()
{
num
--
if
(
num
==
0
)
{
it
.
text
=
"重新获取"
it
.
isEnabled
=
true
}
else
{
it
.
text
=
"($num)重新获取"
it
.
postDelayed
(
this
,
1000
)
}
}
}
it
.
postDelayed
(
run
,
1000
)
}
}
}
\ No newline at end of file
app/src/main/java/com/mints/street/main/my/MoresettingsActivity.kt
View file @
be03d715
...
...
@@ -16,6 +16,7 @@ import com.mints.street.manager.UserManager
import
kotlinx.android.synthetic.main.activity_moresettings.*
import
kotlinx.android.synthetic.main.include_header.*
import
me.goldze.mvvmhabit.utils.KLog
import
me.goldze.mvvmhabit.utils.RxUtils
import
me.goldze.mvvmhabit.utils.ToastUtils
import
org.w3c.dom.Text
...
...
@@ -53,6 +54,14 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
item_phone
.
findViewById
<
TextView
>(
R
.
id
.
tv_right
).
setTextColor
(
Color
.
BLACK
)
item_phone
.
findViewById
<
TextView
>(
R
.
id
.
tv_right
).
text
=
"去绑定"
item_phone
.
setOnClickListener
(
this
)
RxUtils
.
onMultiClick
(
item_phone
){
if
(
userManager
.
userIsLogin
())
{
startActivity
(
BindMobileActivity
::
class
.
java
)
return
@onMultiClick
}
else
{
ToastUtils
.
showLong
(
"请先使用微信登录"
)
}
}
}
}
private
fun
initView
()
{
...
...
@@ -96,14 +105,14 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
R
.
id
.
iv_left_icon
->
{
finish
()
}
R
.
id
.
item_phone
->
{
if
(
userManager
.
userIsLogin
())
{
startActivity
(
BindMobileActivity
::
class
.
java
)
return
}
else
{
ToastUtils
.
showLong
(
"请先使用微信登录"
)
}
}
//
R.id.item_phone -> {
//
if (userManager.userIsLogin()) {
//
startActivity(BindMobileActivity::class.java)
//
return
//
} else {
//
ToastUtils.showLong("请先使用微信登录")
//
}
//
}
R
.
id
.
btn_switch
->
{
//退出登录
UserManager
.
INSTANCE
.
userLogout
()
...
...
app/src/main/java/com/mints/street/main/my/MyFragment.kt
View file @
be03d715
...
...
@@ -32,6 +32,7 @@ import com.scwang.smartrefresh.layout.listener.OnRefreshListener
import
com.tbruyelle.rxpermissions2.RxPermissions
import
kotlinx.android.synthetic.main.fragment_my.*
import
me.goldze.mvvmhabit.utils.KLog
import
me.goldze.mvvmhabit.utils.RxUtils
import
me.goldze.mvvmhabit.utils.ToastUtils
import
java.util.*
...
...
@@ -90,7 +91,8 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
private
fun
initListener
()
{
//设置登录点击事件
binding
.
llMyLogin
.
setOnClickListener
{
RxUtils
.
onMultiClick
(
binding
.
llMyLogin
){
// binding.llMyLogin.setOnClickListener {
if
(!
userManager
.
userIsLogin
())
{
//创建弹窗
...
...
@@ -109,7 +111,15 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
tv_regist
?.
setOnClickListener
(
this
)
tv_private
?.
setOnClickListener
(
this
)
iv_weixin
?.
setOnClickListener
(
this
)
ly_phone
?.
setOnClickListener
(
this
)
// ly_phone?.setOnClickListener(this)
RxUtils
.
onMultiClick
(
ly_phone
){
if
(
cb_checked
!!
.
isChecked
)
{
startActivity
(
LoginActivity
::
class
.
java
)
mBottomSheetDialog
!!
.
dismiss
()
}
else
{
ToastUtils
.
showShort
(
"请先同意用户协议与隐私政策"
)
}
}
}
}
...
...
@@ -124,8 +134,13 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
}
}
aboutus
.
setOnClickListener
(
this
)
moresettings
.
setOnClickListener
(
this
)
RxUtils
.
onMultiClick
(
aboutus
){
startActivity
(
AboutusActivity
::
class
.
java
)
}
RxUtils
.
onMultiClick
(
moresettings
){
startActivity
(
MoresettingsActivity
::
class
.
java
)
}
}
private
fun
initView
()
{
...
...
@@ -147,13 +162,6 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
override
fun
onClick
(
v
:
View
?)
{
when
(
v
?.
id
)
{
R
.
id
.
aboutus
->
{
startActivity
(
AboutusActivity
::
class
.
java
)
// startActivity(PermissionsActivity::class.java)
}
R
.
id
.
moresettings
->
{
startActivity
(
MoresettingsActivity
::
class
.
java
)
}
R
.
id
.
iv_weixin
->
{
if
(
cb_checked
!!
.
isChecked
)
{
// ToastUtils.showShort("未完成微信登录对接")
...
...
@@ -178,14 +186,14 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
ToastUtils
.
showShort
(
"请先同意用户协议与隐私政策"
)
}
}
R
.
id
.
ly_phone
->
{
if
(
cb_checked
!!
.
isChecked
)
{
startActivity
(
LoginActivity
::
class
.
java
)
mBottomSheetDialog
!!
.
dismiss
()
}
else
{
ToastUtils
.
showShort
(
"请先同意用户协议与隐私政策"
)
}
}
//
R.id.ly_phone -> {
//
if (cb_checked!!.isChecked) {
//
startActivity(LoginActivity::class.java)
//
mBottomSheetDialog!!.dismiss()
//
} else {
//
ToastUtils.showShort("请先同意用户协议与隐私政策")
//
}
//
}
R
.
id
.
tv_regist
->
{
KLog
.
e
(
"sssss"
,
"点击了《注册协议》"
)
ToastUtils
.
showShort
(
"点击了《注册协议》"
)
...
...
app/src/main/res/drawable/shape_gold_blue.xml
View file @
be03d715
...
...
@@ -4,7 +4,7 @@
<!-- 边框的颜色和粗细 -->
<stroke
android:width=
"1dp"
android:color=
"#
C7EDCC
"
android:color=
"#
03A9F4
"
/>
<solid
android:color=
"#ffffffff"
/>
<corners
android:radius=
"10dp"
/>
...
...
app/src/main/res/layout/activity_login.xml
View file @
be03d715
...
...
@@ -104,8 +104,8 @@
<TextView
android:id=
"@+id/tv_send_sms"
android:layout_width=
"1
0
0dp"
android:layout_height=
"
30dp
"
android:layout_width=
"1
2
0dp"
android:layout_height=
"
match_parent
"
android:layout_alignParentEnd=
"true"
android:layout_centerVertical=
"true"
android:gravity=
"center"
...
...
app/src/main/res/layout/activity_permissions.xml
View file @
be03d715
...
...
@@ -219,8 +219,8 @@
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"
match_par
ent"
android:
layout_marginBottom=
"2
0dp"
android:layout_height=
"
wrap_cont
ent"
android:
paddingTop=
"1
0dp"
android:gravity=
"bottom|center_horizontal"
android:orientation=
"horizontal"
>
...
...
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