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
8cb8e9f1
Commit
8cb8e9f1
authored
May 26, 2021
by
zhenghongbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add 登录页面UI
parent
c9a51baa
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
159 additions
and
27 deletions
+159
-27
EditTextInputCallback.kt
...in/java/com/yidian/common/widget/EditTextInputCallback.kt
+5
-0
PhoneNumberTextWatcher.kt
...n/java/com/yidian/common/widget/PhoneNumberTextWatcher.kt
+44
-0
WXEntryActivity.kt
.../src/main/java/com/yidian/common/wxapi/WXEntryActivity.kt
+0
-5
protocol_checkbox_bg.xml
...Lib/Common/src/main/res/drawable/protocol_checkbox_bg.xml
+5
-0
cb_select_off.png
...onLib/Common/src/main/res/mipmap-xxhdpi/cb_select_off.png
+0
-0
cb_select_on.png
CommonLib/Common/src/main/res/mipmap-xxhdpi/cb_select_on.png
+0
-0
styles.xml
CommonLib/Common/src/main/res/values/styles.xml
+4
-0
LoginLifeCircleActivity.kt
...an/shenghuoquan/newscontent/ui/LoginLifeCircleActivity.kt
+82
-11
CountDownTimerUtils.kt
...ian/shenghuoquan/newscontent/utils/CountDownTimerUtils.kt
+10
-8
activity_login.xml
...onents/newscontent/src/main/res/layout/activity_login.xml
+9
-3
No files found.
CommonLib/Common/src/main/java/com/yidian/common/widget/EditTextInputCallback.kt
0 → 100644
View file @
8cb8e9f1
package
com.yidian.common.widget
interface
EditTextInputCallback
{
fun
inputCallback
(
s
:
String
)
}
\ No newline at end of file
CommonLib/Common/src/main/java/com/yidian/common/widget/PhoneNumberTextWatcher.kt
0 → 100644
View file @
8cb8e9f1
package
com.yidian.common.widget
import
android.text.Editable
import
android.text.TextWatcher
import
android.widget.EditText
class
PhoneNumberTextWatcher
(
var
editText
:
EditText
,
var
inputCallback
:
EditTextInputCallback
):
TextWatcher
{
private
var
isDelete
=
false
private
var
lastContentLength
=
0
private
val
sb
=
StringBuffer
()
override
fun
beforeTextChanged
(
s
:
CharSequence
?,
start
:
Int
,
count
:
Int
,
after
:
Int
)
{
}
override
fun
onTextChanged
(
s
:
CharSequence
?,
start
:
Int
,
before
:
Int
,
count
:
Int
)
{
sb
.
delete
(
0
,
sb
.
length
)
sb
.
append
(
s
)
isDelete
=
s
?.
length
!!
<=
lastContentLength
if
(!
isDelete
&&
(
s
.
length
==
4
||
s
.
length
==
9
)){
if
(
s
.
length
==
4
)
{
sb
.
insert
(
3
,
" "
)
}
else
{
sb
.
insert
(
8
,
" "
)
}
setContent
(
sb
)
}
if
(
isDelete
&&
(
s
.
length
==
4
||
s
.
length
==
9
))
{
sb
.
deleteCharAt
(
sb
.
length
-
1
)
setContent
(
sb
)
}
lastContentLength
=
sb
.
length
inputCallback
.
inputCallback
(
sb
.
toString
())
}
override
fun
afterTextChanged
(
s
:
Editable
?)
{
}
private
fun
setContent
(
sb
:
StringBuffer
){
editText
.
setText
(
sb
.
toString
())
editText
.
setSelection
(
sb
.
length
)
}
}
\ No newline at end of file
CommonLib/Common/src/main/java/com/yidian/common/wxapi/WXEntryActivity.kt
deleted
100644 → 0
View file @
c9a51baa
package
com.yidian.common.wxapi
//import com.umeng.socialize.weixin.view.WXCallbackActivity
class
WXEntryActivity
:
WXCallbackActivity
()
\ No newline at end of file
CommonLib/Common/src/main/res/drawable/protocol_checkbox_bg.xml
0 → 100644
View file @
8cb8e9f1
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"@mipmap/cb_select_on"
android:state_checked=
"true"
/>
<item
android:drawable=
"@mipmap/cb_select_off"
android:state_checked=
"false"
/>
</selector>
\ No newline at end of file
CommonLib/Common/src/main/res/mipmap-xxhdpi/cb_select_off.png
0 → 100644
View file @
8cb8e9f1
639 Bytes
CommonLib/Common/src/main/res/mipmap-xxhdpi/cb_select_on.png
0 → 100644
View file @
8cb8e9f1
969 Bytes
CommonLib/Common/src/main/res/values/styles.xml
View file @
8cb8e9f1
...
@@ -10,6 +10,10 @@
...
@@ -10,6 +10,10 @@
<item
name=
"android:button"
>
@drawable/checkbox_bg
</item>
<item
name=
"android:button"
>
@drawable/checkbox_bg
</item>
</style>
</style>
<style
name=
"protocol_checkboxBg"
parent=
"@android:style/Widget.CompoundButton.CheckBox"
>
<item
name=
"android:button"
>
@drawable/protocol_checkbox_bg
</item>
</style>
<style
name=
"normal_dialog"
parent=
"android:style/Theme.Dialog"
>
<style
name=
"normal_dialog"
parent=
"android:style/Theme.Dialog"
>
<item
name=
"android:windowFrame"
>
@null
</item>
<item
name=
"android:windowFrame"
>
@null
</item>
<item
name=
"android:windowNoTitle"
>
true
</item>
<item
name=
"android:windowNoTitle"
>
true
</item>
...
...
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/LoginLifeCircleActivity.kt
View file @
8cb8e9f1
package
com.yidian.shenghuoquan.newscontent.ui
package
com.yidian.shenghuoquan.newscontent.ui
import
android.content.Intent
import
android.os.Bundle
import
android.os.Bundle
import
android.text.Editable
import
android.text.TextWatcher
import
com.yidian.common.XRouterPathConstants.Companion.LOGIN_LIFE_CIRCLE
import
com.yidian.common.XRouterPathConstants.Companion.LOGIN_LIFE_CIRCLE
import
com.yidian.common.base.BaseActivity
import
com.yidian.common.base.BaseActivity
import
com.yidian.common.widget.EditTextInputCallback
import
com.yidian.common.widget.PhoneNumberTextWatcher
import
com.yidian.shenghuoquan.newscontent.databinding.ActivityLoginBinding
import
com.yidian.shenghuoquan.newscontent.databinding.ActivityLoginBinding
import
com.yidian.shenghuoquan.newscontent.ui.alive.AliveTestActivity
import
com.yidian.shenghuoquan.newscontent.ui.idcard.IDCardTestActivity
import
com.yidian.shenghuoquan.newscontent.utils.CountDownTimerUtils
import
com.yidian.shenghuoquan.newscontent.utils.CountDownTimerUtils
import
com.yidian.utils.ToastUtil
/**
/**
* Author:
sym
* Author:
zhb
* Date: 2021/5/
18 5:14
PM
* Date: 2021/5/
26 16:05
PM
* Describe:短信登陆页面
* Describe:短信登陆页面
*/
*/
class
LoginLifeCircleActivity
:
BaseActivity
<
ActivityLoginBinding
>()
{
class
LoginLifeCircleActivity
:
BaseActivity
<
ActivityLoginBinding
>()
{
private
lateinit
var
mCountDownTimerUtils
:
CountDownTimerUtils
private
lateinit
var
mCountDownTimerUtils
:
CountDownTimerUtils
private
var
mobileFinish
=
false
private
var
codeFinish
=
false
private
var
protocolAgree
=
false
override
fun
createViewBinding
():
ActivityLoginBinding
{
override
fun
createViewBinding
():
ActivityLoginBinding
{
return
ActivityLoginBinding
.
inflate
(
layoutInflater
)
return
ActivityLoginBinding
.
inflate
(
layoutInflater
)
...
@@ -32,17 +37,83 @@ class LoginLifeCircleActivity : BaseActivity<ActivityLoginBinding>() {
...
@@ -32,17 +37,83 @@ class LoginLifeCircleActivity : BaseActivity<ActivityLoginBinding>() {
}
}
private
fun
initView
()
{
private
fun
initView
()
{
// mCountDownTimerUtils = CountDownTimerUtils(viewBind.getBtn, 60000, 1000)
setLoginButtonStatus
(
false
)
mCountDownTimerUtils
=
CountDownTimerUtils
(
viewBind
.
tvGetCode
,
60000
,
1000
)
}
}
private
fun
setOnListener
()
{
private
fun
setOnListener
()
{
// viewBind.getBtn.setOnClickListener {
viewBind
.
tvGetCode
.
setOnClickListener
{
// mCountDownTimerUtils.start()
mCountDownTimerUtils
.
start
()
// }
}
viewBind
.
etMobileNo
.
addTextChangedListener
(
PhoneNumberTextWatcher
(
viewBind
.
etMobileNo
,
object
:
EditTextInputCallback
{
override
fun
inputCallback
(
s
:
String
)
{
if
(
s
.
length
==
13
){
mobileFinish
=
true
changeLoginButtonStatus
()
}
else
if
(
mobileFinish
){
mobileFinish
=
false
changeLoginButtonStatus
()
}
}
}))
viewBind
.
etCode
.
addTextChangedListener
(
object
:
TextWatcher
{
override
fun
beforeTextChanged
(
s
:
CharSequence
?,
start
:
Int
,
count
:
Int
,
after
:
Int
)
{
}
override
fun
onTextChanged
(
s
:
CharSequence
?,
start
:
Int
,
before
:
Int
,
count
:
Int
)
{
if
(
s
?.
length
==
6
){
codeFinish
=
true
changeLoginButtonStatus
()
}
else
if
(
codeFinish
){
codeFinish
=
false
changeLoginButtonStatus
()
}
}
override
fun
afterTextChanged
(
s
:
Editable
?)
{
}
})
// viewBind.loginBtn.setOnClickListener {
viewBind
.
tvLogin
.
setOnClickListener
{
ToastUtil
.
showToast
(
this
,
"登录"
)
// startActivity(Intent(this@LoginLifeCircleActivity, IDCardTestActivity::class.java))
// startActivity(Intent(this@LoginLifeCircleActivity, IDCardTestActivity::class.java))
// startActivity(Intent(this@LoginLifeCircleActivity, AliveTestActivity::class.java))
// startActivity(Intent(this@LoginLifeCircleActivity, AliveTestActivity::class.java))
// }
}
viewBind
.
cbProtocol
.
setOnCheckedChangeListener
{
buttonView
,
isChecked
->
protocolAgree
=
isChecked
changeLoginButtonStatus
()
}
viewBind
.
tvProtocol
.
setOnClickListener
{
ToastUtil
.
showToast
(
this
,
"用户协议"
)
}
viewBind
.
tvPrivacy
.
setOnClickListener
{
ToastUtil
.
showToast
(
this
,
"隐私政策"
)
}
}
private
fun
changeLoginButtonStatus
(){
if
(
mobileFinish
&&
codeFinish
&&
protocolAgree
){
setLoginButtonStatus
(
true
)
}
else
{
setLoginButtonStatus
(
false
)
}
}
private
fun
setLoginButtonStatus
(
flag
:
Boolean
){
if
(
flag
){
viewBind
.
tvLogin
.
alpha
=
1.0f
viewBind
.
tvLogin
.
isEnabled
=
true
}
else
{
viewBind
.
tvLogin
.
alpha
=
0.32f
viewBind
.
tvLogin
.
isEnabled
=
false
}
}
}
}
}
\ No newline at end of file
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/utils/CountDownTimerUtils.kt
View file @
8cb8e9f1
package
com.yidian.shenghuoquan.newscontent.utils
package
com.yidian.shenghuoquan.newscontent.utils
import
android.annotation.SuppressLint
import
android.graphics.Color
import
android.os.CountDownTimer
import
android.os.CountDownTimer
import
android.widget.TextView
import
android.widget.TextView
...
@@ -8,24 +10,24 @@ import android.widget.TextView
...
@@ -8,24 +10,24 @@ import android.widget.TextView
* Date: 2021/5/18 7:43 PM
* Date: 2021/5/18 7:43 PM
* Describe:
* Describe:
*/
*/
class
CountDownTimerUtils
:
CountDownTimer
{
class
CountDownTimerUtils
(
textView
:
TextView
,
millisInFuture
:
Long
,
countDownInterval
:
Long
)
:
private
var
mTextView
:
TextView
?
=
null
CountDownTimer
(
millisInFuture
,
countDownInterval
)
{
private
var
mTextView
:
TextView
?
=
textView
constructor
(
textView
:
TextView
,
millisInFuture
:
Long
,
countDownInterval
:
Long
)
:
super
(
millisInFuture
,
countDownInterval
)
{
mTextView
=
textView
}
@SuppressLint
(
"SetTextI18n"
)
override
fun
onTick
(
millisUntilFinished
:
Long
)
{
override
fun
onTick
(
millisUntilFinished
:
Long
)
{
mTextView
!!
.
isClickable
=
false
//设置不可点击
mTextView
!!
.
isClickable
=
false
//设置不可点击
var
temp
:
Long
=
millisUntilFinished
/
1000
mTextView
!!
.
setTextColor
(
Color
.
rgb
(
0
xc2
,
0
xc2
,
0
xc2
))
val
temp
:
Long
=
millisUntilFinished
/
1000
if
(
temp
.
toString
()
!=
"0"
)
{
if
(
temp
.
toString
()
!=
"0"
)
{
mTextView
!!
.
text
=
temp
.
toString
()
+
"s
后重新获取
"
//设置倒计时时间
mTextView
!!
.
text
=
temp
.
toString
()
+
"s"
//设置倒计时时间
}
else
{
}
else
{
mTextView
!!
.
text
=
"获取验证码"
mTextView
!!
.
text
=
"获取验证码"
}
}
}
}
override
fun
onFinish
()
{
override
fun
onFinish
()
{
mTextView
!!
.
setTextColor
(
Color
.
rgb
(
0
x18
,
0
x52
,
0
xf1
))
mTextView
!!
.
text
=
"获取验证码"
mTextView
!!
.
text
=
"获取验证码"
mTextView
!!
.
isClickable
=
true
//重新获得点击
mTextView
!!
.
isClickable
=
true
//重新获得点击
}
}
...
...
Components/newscontent/src/main/res/layout/activity_login.xml
View file @
8cb8e9f1
...
@@ -38,6 +38,7 @@
...
@@ -38,6 +38,7 @@
android:gravity=
"center_vertical"
android:gravity=
"center_vertical"
android:background=
"@null"
android:background=
"@null"
android:inputType=
"number"
android:inputType=
"number"
android:maxLength=
"13"
android:textColor=
"#333333"
android:textColor=
"#333333"
android:textSize=
"16sp"
android:textSize=
"16sp"
tools:ignore=
"TextFields"
tools:ignore=
"TextFields"
...
@@ -106,7 +107,7 @@
...
@@ -106,7 +107,7 @@
<TextView
<TextView
android:id=
"@+id/
btn
_login"
android:id=
"@+id/
tv
_login"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"44dp"
android:layout_height=
"44dp"
android:layout_marginStart=
"40dp"
android:layout_marginStart=
"40dp"
...
@@ -115,18 +116,21 @@
...
@@ -115,18 +116,21 @@
android:gravity=
"center"
android:gravity=
"center"
android:textSize=
"18sp"
android:textSize=
"18sp"
android:textColor=
"@color/white"
android:textColor=
"@color/white"
android:background=
"@drawable/account_btn_gradient_bg"
android:text=
"登 录"
/>
android:text=
"登 录"
/>
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"
16dp
"
android:layout_height=
"
wrap_content
"
android:layout_marginTop=
"20dp"
android:layout_marginTop=
"20dp"
android:gravity=
"center"
android:gravity=
"center"
android:orientation=
"horizontal"
>
android:orientation=
"horizontal"
>
<CheckBox
<CheckBox
android:id=
"@+id/cb_protocol"
android:layout_width=
"25dp"
android:layout_width=
"25dp"
android:layout_height=
"25dp"
/>
android:layout_height=
"23dp"
style=
"@style/protocol_checkboxBg"
/>
<TextView
<TextView
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
...
@@ -137,6 +141,7 @@
...
@@ -137,6 +141,7 @@
android:text=
"我同意"
/>
android:text=
"我同意"
/>
<TextView
<TextView
android:id=
"@+id/tv_protocol"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:textSize=
"14sp"
android:textSize=
"14sp"
...
@@ -144,6 +149,7 @@
...
@@ -144,6 +149,7 @@
android:text=
"《用户协议》"
/>
android:text=
"《用户协议》"
/>
<TextView
<TextView
android:id=
"@+id/tv_privacy"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:textSize=
"14sp"
android:textSize=
"14sp"
...
...
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