Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_flowbox
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_flowbox
Commits
aafd69a6
Commit
aafd69a6
authored
Jul 27, 2021
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加登录勾选按钮
parent
dc9e1cd2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
87 additions
and
13 deletions
+87
-13
MobileLoginActivity.kt
...ava/com/mints/flowbox/ui/activitys/MobileLoginActivity.kt
+62
-10
WxLoginActivity.kt
...in/java/com/mints/flowbox/ui/activitys/WxLoginActivity.kt
+10
-1
activity_mobile_login.xml
app/src/main/res/layout/activity_mobile_login.xml
+12
-1
activity_wx_login.xml
app/src/main/res/layout/activity_wx_login.xml
+1
-1
themes.xml
app/src/main/res/values/themes.xml
+2
-0
No files found.
app/src/main/java/com/mints/flowbox/ui/activitys/MobileLoginActivity.kt
View file @
aafd69a6
package
com.mints.flowbox.ui.activitys
package
com.mints.flowbox.ui.activitys
import
android.Manifest
import
android.Manifest
import
android.os.Bundle
import
android.text.TextPaint
import
android.text.TextUtils
import
android.text.TextUtils
import
android.text.style.ClickableSpan
import
android.view.View
import
android.view.View
import
com.daimajia.androidanimations.library.Techniques
import
com.daimajia.androidanimations.library.YoYo
import
com.hjq.toast.ToastUtils
import
com.tbruyelle.rxpermissions.RxPermissions
import
com.tbruyelle.rxpermissions.RxPermissions
import
com.mints.library.utils.nodoubleclick.AntiShake
import
com.mints.library.utils.nodoubleclick.AntiShake
import
com.mints.flowbox.R
import
com.mints.flowbox.R
import
com.mints.flowbox.common.Constant
import
com.mints.flowbox.manager.TrackManager
import
com.mints.flowbox.manager.TrackManager
import
com.mints.flowbox.manager.UserManager
import
com.mints.flowbox.manager.UserManager
import
com.mints.flowbox.mvp.presenters.LoginPresenter
import
com.mints.flowbox.mvp.presenters.LoginPresenter
...
@@ -13,7 +20,15 @@ import com.mints.flowbox.mvp.views.LoginView
...
@@ -13,7 +20,15 @@ import com.mints.flowbox.mvp.views.LoginView
import
com.mints.flowbox.ui.activitys.base.BaseActivity
import
com.mints.flowbox.ui.activitys.base.BaseActivity
import
com.mints.flowbox.utils.BackInputUtil
import
com.mints.flowbox.utils.BackInputUtil
import
com.mints.flowbox.utils.LogUtil
import
com.mints.flowbox.utils.LogUtil
import
com.mints.flowbox.utils.SpanUtils
import
kotlinx.android.synthetic.main.activity_bind_mobile.*
import
kotlinx.android.synthetic.main.activity_bind_mobile.*
import
kotlinx.android.synthetic.main.activity_bind_mobile.etLoginCode
import
kotlinx.android.synthetic.main.activity_bind_mobile.etLoginMobile
import
kotlinx.android.synthetic.main.activity_bind_mobile.tvLoginNext
import
kotlinx.android.synthetic.main.activity_bind_mobile.tvLoginSendcode
import
kotlinx.android.synthetic.main.activity_mobile_login.*
import
kotlinx.android.synthetic.main.activity_mobile_login.tvLoginAgreement
import
kotlinx.android.synthetic.main.activity_wx_login.*
import
kotlinx.android.synthetic.main.header_layout.*
import
kotlinx.android.synthetic.main.header_layout.*
/**
/**
...
@@ -61,6 +76,12 @@ class MobileLoginActivity : BaseActivity(), LoginView, View.OnClickListener {
...
@@ -61,6 +76,12 @@ class MobileLoginActivity : BaseActivity(), LoginView, View.OnClickListener {
loginPresenter
.
sendMobileCode
(
mobile
)
loginPresenter
.
sendMobileCode
(
mobile
)
}
}
R
.
id
.
tvLoginNext
->
{
R
.
id
.
tvLoginNext
->
{
if
(!
tvLoginAgreement
.
isChecked
)
{
ToastUtils
.
show
(
"请勾选同意《用户注册协议》及《用户隐私协议》"
)
YoYo
.
with
(
Techniques
.
Shake
).
duration
(
1000
).
repeat
(
1
).
playOn
(
tvLoginAgreement
)
return
}
var
mobile
=
etLoginMobile
.
text
.
toString
().
trim
()
var
mobile
=
etLoginMobile
.
text
.
toString
().
trim
()
if
(
mobile
.
length
<
13
)
{
if
(
mobile
.
length
<
13
)
{
showToast
(
"请输入手机号"
)
showToast
(
"请输入手机号"
)
...
@@ -75,17 +96,17 @@ class MobileLoginActivity : BaseActivity(), LoginView, View.OnClickListener {
...
@@ -75,17 +96,17 @@ class MobileLoginActivity : BaseActivity(), LoginView, View.OnClickListener {
RxPermissions
(
this
@MobileLoginActivity
)
RxPermissions
(
this
@MobileLoginActivity
)
.
request
(
Manifest
.
permission
.
READ_PHONE_STATE
)
.
request
(
Manifest
.
permission
.
READ_PHONE_STATE
)
.
subscribe
{
granted
:
Boolean
->
.
subscribe
{
granted
:
Boolean
->
if
(
granted
)
{
if
(
granted
)
{
mobile
=
mobile
.
replace
(
" "
.
toRegex
(),
""
)
mobile
=
mobile
.
replace
(
" "
.
toRegex
(),
""
)
// 登录
// 登录
loginPresenter
.
login
(
mobile
,
code
)
loginPresenter
.
login
(
mobile
,
code
)
}
else
{
}
else
{
showMissingPermissionDialog
(
"设备"
)
showMissingPermissionDialog
(
"设备"
)
}
}
}
}
}
}
}
}
}
}
...
@@ -131,6 +152,37 @@ class MobileLoginActivity : BaseActivity(), LoginView, View.OnClickListener {
...
@@ -131,6 +152,37 @@ class MobileLoginActivity : BaseActivity(), LoginView, View.OnClickListener {
etLoginMobile
.
setText
(
mobile
)
etLoginMobile
.
setText
(
mobile
)
etLoginMobile
.
setSelection
(
mobile
!!
.
length
+
2
)
etLoginMobile
.
setSelection
(
mobile
!!
.
length
+
2
)
}
}
SpanUtils
.
with
(
tvLoginAgreement
)
.
append
(
"《用户注册协议》"
).
setClickSpan
(
object
:
ClickableSpan
()
{
override
fun
onClick
(
widget
:
View
)
{
val
bundle
=
Bundle
()
bundle
.
putString
(
WebActivity
.
WEB_TITLE
,
getString
(
R
.
string
.
register_name
))
bundle
.
putString
(
WebActivity
.
WEB_URL
,
Constant
.
REGISTER_URL
)
readyGo
(
WebActivity
::
class
.
java
,
bundle
)
}
override
fun
updateDrawState
(
ds
:
TextPaint
)
{
ds
.
color
=
resources
.
getColor
(
R
.
color
.
color_main
)
ds
.
isUnderlineText
=
false
}
})
.
append
(
"、"
)
.
append
(
"《用户隐私协议》"
).
setClickSpan
(
object
:
ClickableSpan
()
{
override
fun
onClick
(
widget
:
View
)
{
val
bundle
=
Bundle
()
bundle
.
putString
(
WebActivity
.
WEB_TITLE
,
getString
(
R
.
string
.
privacy_name
))
bundle
.
putString
(
WebActivity
.
WEB_URL
,
Constant
.
PRIVACY_URL
)
readyGo
(
WebActivity
::
class
.
java
,
bundle
)
}
override
fun
updateDrawState
(
ds
:
TextPaint
)
{
ds
.
color
=
resources
.
getColor
(
R
.
color
.
color_main
)
ds
.
isUnderlineText
=
false
}
})
.
append
(
"与您的利益切身相关。请您注册前务必仔细阅读!"
)
.
create
()
}
}
private
fun
initListener
()
{
private
fun
initListener
()
{
...
...
app/src/main/java/com/mints/flowbox/ui/activitys/WxLoginActivity.kt
View file @
aafd69a6
...
@@ -9,6 +9,9 @@ import android.view.KeyEvent
...
@@ -9,6 +9,9 @@ import android.view.KeyEvent
import
android.view.View
import
android.view.View
import
cn.sharesdk.framework.ShareSDK
import
cn.sharesdk.framework.ShareSDK
import
cn.sharesdk.wechat.friends.Wechat
import
cn.sharesdk.wechat.friends.Wechat
import
com.daimajia.androidanimations.library.Techniques
import
com.daimajia.androidanimations.library.YoYo
import
com.hjq.toast.ToastUtils
import
com.tbruyelle.rxpermissions.RxPermissions
import
com.tbruyelle.rxpermissions.RxPermissions
import
com.mints.library.utils.CommonUtils
import
com.mints.library.utils.CommonUtils
import
com.mints.library.utils.json.JsonUtil
import
com.mints.library.utils.json.JsonUtil
...
@@ -90,6 +93,12 @@ class WxLoginActivity : BaseActivity(), LoginView, View.OnClickListener, OnLogin
...
@@ -90,6 +93,12 @@ class WxLoginActivity : BaseActivity(), LoginView, View.OnClickListener, OnLogin
readyGo
(
MobileLoginActivity
::
class
.
java
)
readyGo
(
MobileLoginActivity
::
class
.
java
)
}
}
R
.
id
.
rlLoginWx
->
{
R
.
id
.
rlLoginWx
->
{
if
(!
tvLoginAgreement
.
isChecked
)
{
ToastUtils
.
show
(
"请勾选同意《用户注册协议》及《用户隐私协议》"
)
YoYo
.
with
(
Techniques
.
Shake
).
duration
(
1000
).
repeat
(
1
).
playOn
(
tvLoginAgreement
)
return
}
val
wechat
=
ShareSDK
.
getPlatform
(
Wechat
.
NAME
)
val
wechat
=
ShareSDK
.
getPlatform
(
Wechat
.
NAME
)
if
(!
wechat
.
isClientValid
)
{
if
(!
wechat
.
isClientValid
)
{
showToast
(
"请先安装微信"
)
showToast
(
"请先安装微信"
)
...
@@ -191,7 +200,7 @@ class WxLoginActivity : BaseActivity(), LoginView, View.OnClickListener, OnLogin
...
@@ -191,7 +200,7 @@ class WxLoginActivity : BaseActivity(), LoginView, View.OnClickListener, OnLogin
ds
.
isUnderlineText
=
false
ds
.
isUnderlineText
=
false
}
}
})
})
.
append
(
"与您的利益切身相关。请您注册前务必仔细阅读!
点击登录即表示您同意并愿意遵守协议
"
)
.
append
(
"与您的利益切身相关。请您注册前务必仔细阅读!"
)
.
create
()
.
create
()
}
}
...
...
app/src/main/res/layout/activity_mobile_login.xml
View file @
aafd69a6
...
@@ -90,7 +90,7 @@
...
@@ -90,7 +90,7 @@
android:layout_centerVertical=
"true"
android:layout_centerVertical=
"true"
android:gravity=
"center"
android:gravity=
"center"
android:text=
"发送验证码"
android:text=
"发送验证码"
android:textColor=
"@color/color_
FF9837
"
android:textColor=
"@color/color_
main
"
android:textSize=
"12sp"
/>
android:textSize=
"12sp"
/>
</RelativeLayout>
</RelativeLayout>
...
@@ -115,6 +115,17 @@
...
@@ -115,6 +115,17 @@
android:textColor=
"@color/white"
android:textColor=
"@color/white"
android:textSize=
"14sp"
/>
android:textSize=
"14sp"
/>
<CheckBox
android:id=
"@+id/tvLoginAgreement"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginLeft=
"20dp"
android:layout_marginTop=
"20dp"
android:layout_marginRight=
"20dp"
android:textColor=
"@color/color_707A8D"
android:textSize=
"12sp"
/>
<TextView
<TextView
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
...
...
app/src/main/res/layout/activity_wx_login.xml
View file @
aafd69a6
...
@@ -67,7 +67,7 @@
...
@@ -67,7 +67,7 @@
android:textColor=
"@color/gray"
android:textColor=
"@color/gray"
android:textSize=
"14sp"
/>
android:textSize=
"14sp"
/>
<
TextView
<
CheckBox
android:id=
"@+id/tvLoginAgreement"
android:id=
"@+id/tvLoginAgreement"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
...
...
app/src/main/res/values/themes.xml
View file @
aafd69a6
...
@@ -19,6 +19,8 @@
...
@@ -19,6 +19,8 @@
<style
name=
"AppTheme.Base"
parent=
"Theme.AppCompat.Light.NoActionBar"
>
<style
name=
"AppTheme.Base"
parent=
"Theme.AppCompat.Light.NoActionBar"
>
<item
name=
"windowActionBar"
>
false
</item>
<item
name=
"windowActionBar"
>
false
</item>
<item
name=
"windowNoTitle"
>
true
</item>
<item
name=
"windowNoTitle"
>
true
</item>
<item
name=
"colorPrimary"
>
@color/color_main
</item>
<item
name=
"colorAccent"
>
@color/color_main
</item>
</style>
</style>
<style
name=
"AppTheme.AppBarOverlay"
parent=
"ThemeOverlay.AppCompat.Dark.ActionBar"
/>
<style
name=
"AppTheme.AppBarOverlay"
parent=
"ThemeOverlay.AppCompat.Dark.ActionBar"
/>
...
...
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