Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
HBHAndroid
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
1
Merge Requests
1
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
杨秀秀
HBHAndroid
Commits
1b334810
Commit
1b334810
authored
Jan 25, 2024
by
小费同学阿
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商户端隐私协议逻辑更改
parent
775355a2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
21 deletions
+28
-21
LoginActivity.kt
...rc/main/java/com/xx/merchanthbh/ui/login/LoginActivity.kt
+13
-10
LoginActivity.kt
...rc/main/java/com/xx/hbhbcompany/ui/login/LoginActivity.kt
+14
-10
dialog_comm_text_agree.xml
xxviewlibrary/src/main/res/layout/dialog_comm_text_agree.xml
+1
-1
No files found.
app/src/main/java/com/xx/merchanthbh/ui/login/LoginActivity.kt
View file @
1b334810
...
@@ -54,11 +54,11 @@ class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() {
...
@@ -54,11 +54,11 @@ class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() {
viewModel
.
getProtocols
()
viewModel
.
getProtocols
()
SPUtils
.
getInstance
().
clear
()
SPUtils
.
getInstance
().
clear
()
super
.
initData
()
super
.
initData
()
// 使用SharedPreferences检查是否是第一次打开应用
// 使用SharedPreferences检查是否是第一次打开应用
val
preferences
=
getPreferences
(
Context
.
MODE_PRIVATE
)
val
preferences
=
getPreferences
(
Context
.
MODE_PRIVATE
)
val
isFirstRun
=
preferences
.
getBoolean
(
"is_first_run"
,
true
)
val
isAgreeFlag
=
preferences
.
getBoolean
(
"is_agree_flag"
,
true
)
if
(
isAgreeFlag
)
{
if
(
isFirstRun
)
{
// 如果是第一次打开应用,执行相应的操作
// 如果是第一次打开应用,执行相应的操作
// ToastUtils.showShort("第一次登录")
// ToastUtils.showShort("第一次登录")
viewModel
.
agreeContent
.
observe
(
this
)
{
agreeContent
:
String
?
->
viewModel
.
agreeContent
.
observe
(
this
)
{
agreeContent
:
String
?
->
...
@@ -66,14 +66,21 @@ class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() {
...
@@ -66,14 +66,21 @@ class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() {
agreementContext
=
agreeContent
agreementContext
=
agreeContent
/*在这里加上隐私协议弹窗*/
/*在这里加上隐私协议弹窗*/
showCommTextAgreeDialog
(
showCommTextAgreeDialog
(
RefuseDialogBean
(
agreementContext
,
"
已知晓"
,
null
,
"隐私条款"
),
RefuseDialogBean
(
agreementContext
,
"
同意"
,
"不同意"
,
"隐私条款"
),
object
:
CommTextAgreeDialog
.
onAcceptCallBack
{
object
:
CommTextAgreeDialog
.
onAcceptCallBack
{
override
fun
refuseBack
()
{
override
fun
refuseBack
()
{
finish
()
val
intent
=
Intent
(
Intent
.
ACTION_MAIN
)
intent
.
addCategory
(
Intent
.
CATEGORY_HOME
)
intent
.
flags
=
Intent
.
FLAG_ACTIVITY_NEW_TASK
startActivity
(
intent
)
}
}
override
fun
acceptBack
()
{
override
fun
acceptBack
()
{
// 设置is_agree_flag标记为false,表示隐私协议已同意
val
editor
=
preferences
.
edit
()
editor
.
putBoolean
(
"is_agree_flag"
,
false
)
editor
.
apply
()
}
}
})
})
}
}
...
@@ -81,10 +88,6 @@ class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() {
...
@@ -81,10 +88,6 @@ class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() {
}
}
// 设置is_first_run标记为false,表示应用已经不是第一次运行
val
editor
=
preferences
.
edit
()
editor
.
putBoolean
(
"is_first_run"
,
false
)
editor
.
apply
()
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
R
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
R
)
{
if
(!
Environment
.
isExternalStorageManager
())
{
if
(!
Environment
.
isExternalStorageManager
())
{
...
...
hbhbcompany/src/main/java/com/xx/hbhbcompany/ui/login/LoginActivity.kt
View file @
1b334810
package
com.xx.hbhbcompany.ui.login
package
com.xx.hbhbcompany.ui.login
import
android.content.Context
import
android.content.Context
import
android.content.Intent
import
android.os.Bundle
import
android.os.Bundle
import
android.text.SpannableStringBuilder
import
android.text.SpannableStringBuilder
import
android.text.Spanned
import
android.text.Spanned
...
@@ -41,11 +42,11 @@ class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() {
...
@@ -41,11 +42,11 @@ class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() {
viewModel
.
getProtocols
()
viewModel
.
getProtocols
()
SPUtils
.
getInstance
().
clear
()
SPUtils
.
getInstance
().
clear
()
super
.
initData
()
super
.
initData
()
// 使用SharedPreferences检查是否是第一次打开应用
// 使用SharedPreferences检查是否是第一次打开应用
val
preferences
=
getPreferences
(
Context
.
MODE_PRIVATE
)
val
preferences
=
getPreferences
(
Context
.
MODE_PRIVATE
)
val
isFirstRun
=
preferences
.
getBoolean
(
"is_first_run"
,
true
)
val
isAgreeFlag
=
preferences
.
getBoolean
(
"is_agree_flag"
,
true
)
if
(
isAgreeFlag
)
{
if
(
isFirstRun
)
{
// 如果是第一次打开应用,执行相应的操作
// 如果是第一次打开应用,执行相应的操作
// ToastUtils.showShort("第一次登录")
// ToastUtils.showShort("第一次登录")
viewModel
.
agreeContent
.
observe
(
this
)
{
agreeContent
:
String
?
->
viewModel
.
agreeContent
.
observe
(
this
)
{
agreeContent
:
String
?
->
...
@@ -53,14 +54,21 @@ class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() {
...
@@ -53,14 +54,21 @@ class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() {
agreementContext
=
agreeContent
agreementContext
=
agreeContent
/*在这里加上隐私协议弹窗*/
/*在这里加上隐私协议弹窗*/
showCommTextAgreeDialog
(
showCommTextAgreeDialog
(
RefuseDialogBean
(
agreementContext
,
"
已知晓"
,
null
,
"隐私条款"
),
RefuseDialogBean
(
agreementContext
,
"
同意"
,
"不同意"
,
"隐私条款"
),
object
:
CommTextAgreeDialog
.
onAcceptCallBack
{
object
:
CommTextAgreeDialog
.
onAcceptCallBack
{
override
fun
refuseBack
()
{
override
fun
refuseBack
()
{
finish
()
val
intent
=
Intent
(
Intent
.
ACTION_MAIN
)
intent
.
addCategory
(
Intent
.
CATEGORY_HOME
)
intent
.
flags
=
Intent
.
FLAG_ACTIVITY_NEW_TASK
startActivity
(
intent
)
}
}
override
fun
acceptBack
()
{
override
fun
acceptBack
()
{
// 设置is_agree_flag标记为false,表示隐私协议已同意
val
editor
=
preferences
.
edit
()
editor
.
putBoolean
(
"is_agree_flag"
,
false
)
editor
.
apply
()
}
}
})
})
}
}
...
@@ -68,10 +76,6 @@ class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() {
...
@@ -68,10 +76,6 @@ class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() {
}
}
// 设置is_first_run标记为false,表示应用已经不是第一次运行
val
editor
=
preferences
.
edit
()
editor
.
putBoolean
(
"is_first_run"
,
false
)
editor
.
apply
()
if
(
viewModel
.
isAgree
)
if
(
viewModel
.
isAgree
)
{
{
...
...
xxviewlibrary/src/main/res/layout/dialog_comm_text_agree.xml
View file @
1b334810
...
@@ -62,7 +62,7 @@
...
@@ -62,7 +62,7 @@
android:layout_weight=
"1"
android:layout_weight=
"1"
android:background=
"#00000000"
android:background=
"#00000000"
android:onClick=
"@{dialog.refuseClick}"
android:onClick=
"@{dialog.refuseClick}"
android:text=
"@{model.
sur
eTxt.toString()}"
android:text=
"@{model.
refus
eTxt.toString()}"
android:textColor=
"@color/text_grey"
android:textColor=
"@color/text_grey"
android:textSize=
"16sp"
android:textSize=
"16sp"
android:visibility=
"@{model.refuseTxt==null? View.GONE : View.VISIBLE}"
/>
android:visibility=
"@{model.refuseTxt==null? View.GONE : View.VISIBLE}"
/>
...
...
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