Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ShenghuoquanBusiness
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
bp
ShenghuoquanBusiness
Commits
e6753535
Commit
e6753535
authored
Jun 23, 2021
by
shiyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add 身份验证页面搭建
parent
e1e9a629
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
162 additions
and
5 deletions
+162
-5
CountDownTimerUtils.kt
...ian/shenghuoquan/newscontent/utils/CountDownTimerUtils.kt
+12
-2
VerifyIdentityActivity.kt
...nghuoquan/newscontent/wallet/ui/VerifyIdentityActivity.kt
+70
-0
activity_verify_identify.xml
...scontent/src/main/res/layout/activity_verify_identify.xml
+80
-3
No files found.
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/utils/CountDownTimerUtils.kt
View file @
e6753535
...
...
@@ -12,7 +12,17 @@ import android.widget.TextView
*/
class
CountDownTimerUtils
(
textView
:
TextView
,
millisInFuture
:
Long
,
countDownInterval
:
Long
)
:
CountDownTimer
(
millisInFuture
,
countDownInterval
)
{
constructor
(
textView
:
TextView
,
millisInFuture
:
Long
,
countDownInterval
:
Long
,
btnText
:
String
)
:
this
(
textView
,
millisInFuture
,
countDownInterval
)
{
btnContent
=
btnText
}
private
var
mTextView
:
TextView
?
=
textView
private
var
btnContent
:
String
?
=
"获取验证码"
@SuppressLint
(
"SetTextI18n"
)
override
fun
onTick
(
millisUntilFinished
:
Long
)
{
...
...
@@ -23,13 +33,13 @@ class CountDownTimerUtils(textView: TextView, millisInFuture: Long, countDownInt
mTextView
!!
.
text
=
temp
.
toString
()
+
"s"
//设置倒计时时间
}
else
{
mTextView
!!
.
setTextColor
(
Color
.
rgb
(
0
x18
,
0
x52
,
0
xf1
))
mTextView
!!
.
text
=
"获取验证码"
mTextView
!!
.
text
=
btnContent
}
}
override
fun
onFinish
()
{
mTextView
!!
.
setTextColor
(
Color
.
rgb
(
0
x18
,
0
x52
,
0
xf1
))
mTextView
!!
.
text
=
"获取验证码"
mTextView
!!
.
text
=
btnContent
mTextView
!!
.
isClickable
=
true
//重新获得点击
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/wallet/ui/VerifyIdentityActivity.kt
View file @
e6753535
package
com.yidian.shenghuoquan.newscontent.wallet.ui
import
android.annotation.SuppressLint
import
android.os.Bundle
import
com.orhanobut.hawk.Hawk
import
com.yidian.common.HawkConfig
import
com.yidian.common.XRouterPathConstants
import
com.yidian.common.base.BaseActivity
import
com.yidian.common.extensions.clickAntiShake
import
com.yidian.common.extensions.initTitleBar
import
com.yidian.shenghuoquan.newscontent.databinding.ActivityVerifyIdentifyBinding
import
com.yidian.shenghuoquan.newscontent.utils.CountDownTimerUtils
import
com.yidian.shenghuoquan.newscontent.utils.TextWatcherAdapter
/**
* 钱包主人验证身份
*/
class
VerifyIdentityActivity
:
BaseActivity
<
ActivityVerifyIdentifyBinding
>()
{
private
lateinit
var
mCountDownTimerUtils
:
CountDownTimerUtils
override
fun
createViewBinding
():
ActivityVerifyIdentifyBinding
{
return
ActivityVerifyIdentifyBinding
.
inflate
(
layoutInflater
)
}
...
...
@@ -16,4 +26,64 @@ class VerifyIdentityActivity : BaseActivity<ActivityVerifyIdentifyBinding>() {
override
fun
getXPageName
():
String
{
return
XRouterPathConstants
.
VERIFY_IDENTITY
}
override
fun
init
(
savedInstanceState
:
Bundle
?)
{
super
.
init
(
savedInstanceState
)
initView
()
initClick
()
requestSmsCode
()
}
@SuppressLint
(
"SetTextI18n"
)
private
fun
initView
()
{
initTitleBar
(
viewBind
.
include
.
toolbar
,
viewBind
.
include
.
tvTitle
,
""
)
// 默认显示空,等发送成功后再提示接收的手机号
viewBind
.
tvSendMobile
.
text
=
""
// 初始化倒计时
mCountDownTimerUtils
=
CountDownTimerUtils
(
viewBind
.
tvGetCode
,
60000
,
1000
,
"重新获取"
)
}
private
fun
initClick
()
{
// 重新获取验证码
viewBind
.
tvGetCode
.
clickAntiShake
{
viewBind
.
etSmsCode
.
setText
(
""
)
requestSmsCode
()
}
// 验证码输入监听
viewBind
.
etSmsCode
.
addTextChangedListener
(
object
:
TextWatcherAdapter
()
{
override
fun
onTextChanged
(
s
:
CharSequence
?,
start
:
Int
,
before
:
Int
,
count
:
Int
)
{
if
(
s
?.
length
==
6
)
{
// 校验验证码
checkSmsCode
()
}
}
})
}
/**
* 请求验证码
*/
@SuppressLint
(
"SetTextI18n"
)
private
fun
requestSmsCode
()
{
// todo 请求验证码,成功后开始倒计时
mCountDownTimerUtils
.
start
()
// todo 请求验证码成功则,显示接收信息的手机号
val
mobile
=
Hawk
.
get
(
HawkConfig
.
Mobile
,
""
)
viewBind
.
tvSendMobile
.
text
=
"验证码已发送至$mobile"
}
/**
* 校验验证码
*/
private
fun
checkSmsCode
()
{
// todo 校验成功后,进入微信授权
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
mCountDownTimerUtils
.
cancel
()
}
}
Components/newscontent/src/main/res/layout/activity_verify_identify.xml
View file @
e6753535
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:layout_height=
"match_parent"
android:background=
"@color/white"
android:orientation=
"vertical"
>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<include
android:id=
"@+id/include"
layout=
"@layout/layout_common_toolbar"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"@dimen/dp40"
android:layout_marginTop=
"@dimen/dp30"
android:text=
"输入验证码"
android:textColor=
"@color/color_333333"
android:textSize=
"28sp"
/>
<TextView
android:id=
"@+id/tv_send_mobile"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"@dimen/dp40"
android:layout_marginTop=
"@dimen/dp5"
android:textColor=
"@color/color_666666"
android:textSize=
"@dimen/sp16"
tools:text=
"验证码已发送至18888888888"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/dp60"
android:layout_marginStart=
"@dimen/dp40"
android:layout_marginTop=
"@dimen/dp10"
android:layout_marginEnd=
"@dimen/dp40"
android:orientation=
"horizontal"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:gravity=
"center"
android:text=
"验证码"
android:textColor=
"@color/color_333333"
android:textSize=
"@dimen/sp16"
/>
<EditText
android:id=
"@+id/et_sms_code"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_marginStart=
"@dimen/dp25"
android:layout_weight=
"1"
android:background=
"@null"
android:gravity=
"center_vertical"
android:hint=
"请输入"
android:inputType=
"number"
android:maxLength=
"6"
android:textColor=
"@color/color_333333"
android:textColorHint=
"@color/color_999999"
android:textSize=
"16sp"
tools:ignore=
"TextFields"
/>
<TextView
android:id=
"@+id/tv_getCode"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:gravity=
"center_vertical"
android:text=
"重新获取"
android:textColor=
"#1852f1"
android:textSize=
"14sp"
/>
</LinearLayout>
<View
style=
"@style/cut_off_line_style"
android:layout_marginStart=
"@dimen/dp40"
android:layout_marginEnd=
"@dimen/dp40"
android:background=
"@color/color_333333"
/>
</LinearLayout>
\ 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