Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
MiYaFastCashier
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jiangjiantao
MiYaFastCashier
Commits
03eb164d
Commit
03eb164d
authored
Apr 02, 2022
by
zhaopengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
密码设置界面处理
parent
eb4097d7
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
361 additions
and
3 deletions
+361
-3
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+3
-0
LoginActivity.kt
app/src/main/java/com/miya/fastcashier/ui/LoginActivity.kt
+9
-0
ResetAuthorizePasswordActivity.kt
...com/miya/fastcashier/ui/ResetAuthorizePasswordActivity.kt
+106
-0
SettingActivity.kt
app/src/main/java/com/miya/fastcashier/ui/SettingActivity.kt
+2
-3
AccountPasswordManageKit.java
...ya/fastcashier/utils/manage/AccountPasswordManageKit.java
+4
-0
shape_111235_radius8.xml
app/src/main/res/drawable/shape_111235_radius8.xml
+6
-0
activity_reset_authorize_password.xml
...src/main/res/layout/activity_reset_authorize_password.xml
+225
-0
colors.xml
app/src/main/res/values/colors.xml
+2
-0
strings.xml
app/src/main/res/values/strings.xml
+4
-0
No files found.
app/src/main/AndroidManifest.xml
View file @
03eb164d
...
@@ -55,6 +55,9 @@
...
@@ -55,6 +55,9 @@
<activity
<activity
android:name=
".ui.SettingActivity"
android:name=
".ui.SettingActivity"
android:exported=
"true"
/>
android:exported=
"true"
/>
<activity
android:name=
".ui.ResetAuthorizePasswordActivity"
android:exported=
"true"
/>
</application>
</application>
</manifest>
</manifest>
\ No newline at end of file
app/src/main/java/com/miya/fastcashier/ui/LoginActivity.kt
View file @
03eb164d
package
com.miya.fastcashier.ui
package
com.miya.fastcashier.ui
import
android.Manifest
import
android.Manifest
import
android.content.Context
import
android.content.Intent
import
android.content.Intent
import
android.os.Bundle
import
android.os.Bundle
import
android.text.Editable
import
android.text.Editable
...
@@ -28,6 +29,14 @@ class LoginActivity : AppCompatActivity() {
...
@@ -28,6 +29,14 @@ class LoginActivity : AppCompatActivity() {
private
lateinit
var
loginViewModel
:
LoginViewModel
private
lateinit
var
loginViewModel
:
LoginViewModel
private
lateinit
var
binding
:
ActivityLoginBinding
private
lateinit
var
binding
:
ActivityLoginBinding
companion
object
{
fun
start
(
context
:
Context
,
flags
:
Int
)
{
val
intent
=
Intent
(
context
,
LoginActivity
::
class
.
java
)
intent
.
flags
=
Intent
.
FLAG_ACTIVITY_NEW_TASK
or
flags
context
.
startActivity
(
intent
)
}
}
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
super
.
onCreate
(
savedInstanceState
)
binding
=
ActivityLoginBinding
.
inflate
(
layoutInflater
)
binding
=
ActivityLoginBinding
.
inflate
(
layoutInflater
)
...
...
app/src/main/java/com/miya/fastcashier/ui/ResetAuthorizePasswordActivity.kt
0 → 100644
View file @
03eb164d
package
com.miya.fastcashier.ui
import
android.content.Context
import
android.content.Intent
import
android.os.Bundle
import
android.text.TextUtils
import
android.view.Gravity
import
com.blankj.utilcode.util.ToastUtils
import
com.miya.fastcashier.R
import
com.miya.fastcashier.databinding.ActivityResetAuthorizePasswordBinding
import
com.miya.fastcashier.databinding.ActivitySettingBinding
import
com.miya.fastcashier.service.AccountService
import
com.miya.fastcashier.ui.dialog.CommonDialog
import
com.miya.fastcashier.utils.CenterToasty
import
com.miya.fastcashier.utils.clickWithTrigger
import
com.miya.fastcashier.utils.manage.AccountPasswordManageKit
import
com.tencent.mmkv.MMKV
class
ResetAuthorizePasswordActivity
:
BaseActivity
()
{
private
lateinit
var
viewBinding
:
ActivityResetAuthorizePasswordBinding
companion
object
{
@JvmStatic
fun
start
(
context
:
Context
)
{
val
intent
=
Intent
(
context
,
ResetAuthorizePasswordActivity
::
class
.
java
)
context
.
startActivity
(
intent
)
}
}
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
viewBinding
=
ActivityResetAuthorizePasswordBinding
.
inflate
(
layoutInflater
)
setContentView
(
viewBinding
.
root
)
init
()
}
private
fun
init
()
{
viewBinding
.
llBack
.
clickWithTrigger
{
finish
()
}
viewBinding
.
tvConfirm
.
clickWithTrigger
{
updateAuthorizePassword
()
}
}
private
fun
updateAuthorizePassword
()
{
val
originPassword
=
viewBinding
.
etOriginPassword
.
text
.
toString
()
val
newPassword
=
viewBinding
.
etNewPassword
.
text
.
toString
()
val
newConfirmPassword
=
viewBinding
.
etNewPasswordConfirm
.
text
.
toString
()
if
(
TextUtils
.
isEmpty
(
originPassword
)
or
TextUtils
.
isEmpty
(
newPassword
)
or
TextUtils
.
isEmpty
(
newConfirmPassword
)
)
{
when
{
TextUtils
.
isEmpty
(
originPassword
)
->
CenterToasty
.
error
(
this
,
"请输入原始密码!"
).
show
()
TextUtils
.
isEmpty
(
newPassword
)
->
CenterToasty
.
error
(
this
,
"请输入新密码!"
).
show
()
TextUtils
.
isEmpty
(
newConfirmPassword
)
->
CenterToasty
.
error
(
this
,
"请输入确认密码!"
).
show
()
}
return
}
if
(
originPassword
.
length
!=
6
)
{
CenterToasty
.
error
(
this
,
"请输入6位原始密码!"
).
show
()
return
}
if
(
newPassword
.
length
!=
6
)
{
CenterToasty
.
error
(
this
,
"请输入6位新密码!"
).
show
()
return
}
if
(
newConfirmPassword
.
length
!=
6
)
{
CenterToasty
.
error
(
this
,
"请输入6位确认密码!"
).
show
()
return
}
if
(!
newPassword
.
equals
(
newConfirmPassword
))
{
CenterToasty
.
error
(
this
,
"新密码两次输入不一致!"
).
show
()
return
}
val
accountAuthorizePassword
=
AccountPasswordManageKit
.
getInstance
().
accountPassword
if
(
TextUtils
.
isEmpty
(
accountAuthorizePassword
))
{
AccountPasswordManageKit
.
getInstance
()
.
loadAccountPassword
(
this
,
AccountPasswordManageKit
.
AccountPasswordManageCallback
{
if
(!
it
.
equals
(
originPassword
))
{
CenterToasty
.
error
(
this
,
"原始密码输入错误!"
).
show
()
}
else
{
updateAuthorizePasswordSucced
(
newPassword
)
}
})
}
else
{
if
(!
accountAuthorizePassword
.
equals
(
originPassword
))
{
CenterToasty
.
error
(
this
,
"原始密码输入错误!"
).
show
()
}
else
{
updateAuthorizePasswordSucced
(
newPassword
)
}
}
}
private
fun
updateAuthorizePasswordSucced
(
newPassword
:
String
)
{
CenterToasty
.
success
(
this
,
"修改成功!"
,
1
).
show
()
AccountPasswordManageKit
.
getInstance
().
updateAccountPassword
(
newPassword
)
finish
()
}
}
\ No newline at end of file
app/src/main/java/com/miya/fastcashier/ui/SettingActivity.kt
View file @
03eb164d
...
@@ -37,7 +37,7 @@ class SettingActivity : BaseActivity() {
...
@@ -37,7 +37,7 @@ class SettingActivity : BaseActivity() {
private
fun
init
(){
private
fun
init
(){
viewBinding
.
llBack
.
clickWithTrigger
{
finish
()
}
viewBinding
.
llBack
.
clickWithTrigger
{
finish
()
}
viewBinding
.
vLoginOut
.
clickWithTrigger
{
loginOut
()
}
viewBinding
.
vLoginOut
.
clickWithTrigger
{
loginOut
()
}
viewBinding
.
vUpdatePassword
.
clickWithTrigger
{
ToastUtils
.
showLong
(
"点击修改密码"
)
}
viewBinding
.
vUpdatePassword
.
clickWithTrigger
{
ResetAuthorizePasswordActivity
.
start
(
this
)
}
}
}
private
fun
loginOut
()
{
private
fun
loginOut
()
{
...
@@ -59,8 +59,7 @@ class SettingActivity : BaseActivity() {
...
@@ -59,8 +59,7 @@ class SettingActivity : BaseActivity() {
run
{
run
{
MMKV
.
defaultMMKV
().
clearAll
()
MMKV
.
defaultMMKV
().
clearAll
()
AccountService
.
clear
()
AccountService
.
clear
()
val
intent
=
Intent
(
this
@SettingActivity
,
LoginActivity
::
class
.
java
)
LoginActivity
.
start
(
this
@SettingActivity
,
Intent
.
FLAG_ACTIVITY_CLEAR_TASK
)
startActivity
(
intent
)
finish
()
finish
()
}
}
}
}
...
...
app/src/main/java/com/miya/fastcashier/utils/manage/AccountPasswordManageKit.java
View file @
03eb164d
...
@@ -121,6 +121,10 @@ public class AccountPasswordManageKit {
...
@@ -121,6 +121,10 @@ public class AccountPasswordManageKit {
}
}
}
}
public
String
getAccountPassword
()
{
return
AccountService
.
INSTANCE
.
getAccountPassword
();
}
public
void
updateAccountPassword
(
String
password
)
{
public
void
updateAccountPassword
(
String
password
)
{
if
(
TextUtils
.
isEmpty
(
password
))
return
;
if
(
TextUtils
.
isEmpty
(
password
))
return
;
AccountService
.
INSTANCE
.
setAccountPassword
(
password
);
AccountService
.
INSTANCE
.
setAccountPassword
(
password
);
...
...
app/src/main/res/drawable/shape_111235_radius8.xml
0 → 100755
View file @
03eb164d
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"@color/color_111235"
/>
<corners
android:radius=
"8dp"
/>
</shape>
\ No newline at end of file
app/src/main/res/layout/activity_reset_authorize_password.xml
0 → 100644
View file @
03eb164d
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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:background=
"@color/color_E5E5E5"
tools:context=
".ui.SettingActivity"
>
<View
android:id=
"@+id/v_top"
android:layout_width=
"match_parent"
android:layout_height=
"87dp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
android:background=
"@color/colorPrimary"
/>
<androidx.appcompat.widget.LinearLayoutCompat
android:id=
"@+id/ll_back"
android:layout_width=
"200dp"
android:layout_height=
"87dp"
android:orientation=
"horizontal"
android:gravity=
"center_vertical"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<androidx.appcompat.widget.AppCompatImageView
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@+id/tvBack"
app:layout_constraintTop_toTopOf=
"@+id/tvBack"
app:layout_constraintBottom_toBottomOf=
"@+id/tvBack"
android:layout_width=
"24dp"
android:layout_height=
"48dp"
android:layout_marginLeft=
"32dp"
android:padding=
"6dp"
android:src=
"@mipmap/ic_left_arrow"
android:contentDescription=
"@string/back"
/>
<androidx.appcompat.widget.AppCompatTextView
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"16dp"
android:layout_marginLeft=
"16dp"
android:textColor=
"@color/white"
android:text=
"@string/back"
android:textSize=
"24sp"
/>
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.appcompat.widget.AppCompatImageView
android:layout_width=
"195dp"
android:layout_height=
"20dp"
android:layout_marginEnd=
"32dp"
android:layout_marginRight=
"32dp"
android:src=
"@mipmap/ic_logo_white"
app:layout_constraintBottom_toBottomOf=
"@+id/ll_back"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"@+id/ll_back"
/>
<View
android:id=
"@+id/v_origin_password"
android:layout_width=
"match_parent"
android:layout_height=
"103dp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/v_top"
android:background=
"@color/white"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_origin_password_text"
android:layout_width=
"200dp"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"32dp"
android:layout_marginStart=
"32dp"
android:layout_marginEnd=
"32dp"
android:textSize=
"28sp"
android:gravity=
"left"
android:textColor=
"@color/color_333333"
app:layout_constraintStart_toStartOf=
"@id/v_origin_password"
app:layout_constraintTop_toTopOf=
"@id/v_origin_password"
app:layout_constraintBottom_toBottomOf=
"@id/v_origin_password"
android:text=
"@string/app_setting_origin_password"
/>
<androidx.appcompat.widget.AppCompatEditText
android:id=
"@+id/et_origin_password"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:background=
"@android:color/white"
android:singleLine=
"true"
android:inputType=
"numberPassword"
android:layout_marginEnd=
"32dp"
android:gravity=
"center_vertical|left"
android:textSize=
"28sp"
android:textColor=
"@color/color_333333"
android:textColorHint=
"@color/color_CCCCCC"
android:hint=
"请输入原始密码"
android:maxLength=
"6"
app:layout_constraintLeft_toRightOf=
"@+id/tv_origin_password_text"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/v_origin_password"
app:layout_constraintBottom_toBottomOf=
"@id/v_origin_password"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1px"
android:background=
"@color/color_E9E9E9"
android:layout_marginStart=
"25dp"
android:layout_marginRight=
"25dp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"@id/v_origin_password"
/>
<View
android:id=
"@+id/v_new_password"
android:layout_width=
"match_parent"
android:layout_height=
"103dp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/v_origin_password"
android:background=
"@color/white"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_new_password_text"
android:layout_width=
"200dp"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"32dp"
android:text=
"@string/app_setting_new_password"
android:textColor=
"@color/color_333333"
android:textSize=
"28sp"
android:gravity=
"left"
app:layout_constraintBottom_toBottomOf=
"@id/v_new_password"
app:layout_constraintStart_toStartOf=
"@id/v_new_password"
app:layout_constraintTop_toTopOf=
"@id/v_new_password"
/>
<androidx.appcompat.widget.AppCompatEditText
android:id=
"@+id/et_new_password"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:background=
"@android:color/white"
android:singleLine=
"true"
android:inputType=
"numberPassword"
android:layout_marginEnd=
"32dp"
android:gravity=
"center_vertical|left"
android:textSize=
"28sp"
android:textColor=
"@color/color_333333"
android:textColorHint=
"@color/color_CCCCCC"
android:hint=
"请输入新密码"
android:maxLength=
"6"
app:layout_constraintLeft_toRightOf=
"@+id/tv_new_password_text"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/v_new_password"
app:layout_constraintBottom_toBottomOf=
"@id/v_new_password"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1px"
android:background=
"@color/color_E9E9E9"
android:layout_marginStart=
"25dp"
android:layout_marginRight=
"25dp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"@id/v_new_password"
/>
<View
android:id=
"@+id/v_new_password_confirm"
android:layout_width=
"match_parent"
android:layout_height=
"103dp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/v_new_password"
android:background=
"@color/white"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_new_password_confirm_text"
android:layout_width=
"200dp"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"32dp"
android:layout_marginStart=
"32dp"
android:textSize=
"28sp"
android:gravity=
"left"
android:textColor=
"@color/color_333333"
app:layout_constraintStart_toStartOf=
"@id/v_new_password_confirm"
app:layout_constraintTop_toTopOf=
"@id/v_new_password_confirm"
app:layout_constraintBottom_toBottomOf=
"@id/v_new_password_confirm"
android:text=
"@string/app_setting_confirm_password"
/>
<androidx.appcompat.widget.AppCompatEditText
android:id=
"@+id/et_new_password_confirm"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:background=
"@android:color/white"
android:singleLine=
"true"
android:inputType=
"numberPassword"
android:layout_marginEnd=
"32dp"
android:gravity=
"center_vertical|left"
android:textSize=
"28sp"
android:textColor=
"@color/color_333333"
android:textColorHint=
"@color/color_CCCCCC"
android:hint=
"请再次输入密码"
android:maxLength=
"6"
app:layout_constraintLeft_toRightOf=
"@+id/tv_new_password_confirm_text"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/v_new_password_confirm"
app:layout_constraintBottom_toBottomOf=
"@id/v_new_password_confirm"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_confirm"
android:layout_width=
"match_parent"
android:layout_height=
"100dp"
android:layout_marginStart=
"32dp"
android:layout_marginEnd=
"32dp"
android:textSize=
"32sp"
android:gravity=
"center"
android:textColor=
"@color/white"
android:layout_marginBottom=
"65dp"
android:background=
"@drawable/shape_111235_radius8"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
android:text=
"@string/app_confirm_update"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/values/colors.xml
View file @
03eb164d
...
@@ -18,4 +18,6 @@
...
@@ -18,4 +18,6 @@
<color
name=
"color_E5E5E5"
>
#E5E5E5
</color>
<color
name=
"color_E5E5E5"
>
#E5E5E5
</color>
<color
name=
"color_E9E9E9"
>
#E9E9E9
</color>
<color
name=
"color_E9E9E9"
>
#E9E9E9
</color>
<color
name=
"color_D83773"
>
#D83773
</color>
<color
name=
"color_D83773"
>
#D83773
</color>
<color
name=
"color_CCCCCC"
>
#CCCCCC
</color>
<color
name=
"color_111235"
>
#111235
</color>
</resources>
</resources>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
03eb164d
...
@@ -26,5 +26,9 @@
...
@@ -26,5 +26,9 @@
<string
name=
"app_login_out"
>
退出登录
</string>
<string
name=
"app_login_out"
>
退出登录
</string>
<string
name=
"text_refund_amount"
>
退款金额¥%s,是否确认退款
</string>
<string
name=
"text_refund_amount"
>
退款金额¥%s,是否确认退款
</string>
<string
name=
"text_update_account_password"
>
修改授权密码
</string>
<string
name=
"text_update_account_password"
>
修改授权密码
</string>
<string
name=
"app_setting_origin_password"
>
原始密码
</string>
<string
name=
"app_setting_new_password"
>
新密码
</string>
<string
name=
"app_setting_confirm_password"
>
确认密码
</string>
<string
name=
"app_confirm_update"
>
确认修改
</string>
</resources>
</resources>
\ 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