Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
MobileManager
Project
Overview
Details
Activity
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
Wang Xu
MobileManager
Commits
8e1d1d33
Commit
8e1d1d33
authored
Mar 26, 2020
by
Baoxy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 完成需求
1.新增密保 2.输入密码时需要两次确认
parent
7fee0f44
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
1100 additions
and
174 deletions
+1100
-174
AndroidManifest.xml
Launcher3/AndroidManifest.xml
+7
-2
build.gradle
Launcher3/build.gradle
+1
-0
ripple_bg.xml
Launcher3/res/drawable/ripple_bg.xml
+23
-0
activity_change_pwd.xml
Launcher3/res/layout/activity_change_pwd.xml
+8
-2
activity_encrypted.xml
Launcher3/res/layout/activity_encrypted.xml
+15
-0
activity_pwd_pin_set.xml
Launcher3/res/layout/activity_pwd_pin_set.xml
+38
-2
fragment_encrypted_set.xml
Launcher3/res/layout/fragment_encrypted_set.xml
+111
-0
fragment_encrypted_ver.xml
Launcher3/res/layout/fragment_encrypted_ver.xml
+107
-0
strings.xml
Launcher3/res/values/strings.xml
+18
-0
Launcher.java
Launcher3/src/com/android/launcher3/Launcher.java
+61
-28
ManagerAuthActivity.java
Launcher3/src/com/android/launcher3/ManagerAuthActivity.java
+66
-4
ChangePwdActivity.kt
...c/com/android/launcher3/function/pwd/ChangePwdActivity.kt
+50
-3
EncryptedActivity.kt
...c/com/android/launcher3/function/pwd/EncryptedActivity.kt
+58
-0
PwdPinSetPwdActivity.java
.../android/launcher3/function/pwd/PwdPinSetPwdActivity.java
+36
-17
SettingPwdActivity.kt
.../com/android/launcher3/function/pwd/SettingPwdActivity.kt
+10
-10
EncryptedSetFragment.kt
...d/launcher3/function/pwd/fragment/EncryptedSetFragment.kt
+95
-0
EncryptedVerifyFragment.kt
...auncher3/function/pwd/fragment/EncryptedVerifyFragment.kt
+105
-0
SettingAdminActivity.kt
...ndroid/launcher3/function/setting/SettingAdminActivity.kt
+1
-1
BlankActivity.java
...er3/src/com/android/launcher3/settings/BlankActivity.java
+9
-0
gradle.properties
gradle.properties
+3
-2
AlertDialogHolder.java
...m/secspace/lib/common/dialog/other/AlertDialogHolder.java
+36
-18
Assignable.java
...java/com/secspace/lib/common/dialog/other/Assignable.java
+2
-0
BuildBean.java
.../java/com/secspace/lib/common/dialog/other/BuildBean.java
+3
-1
DialogAssigner.java
.../com/secspace/lib/common/dialog/other/DialogAssigner.java
+24
-3
DialogConfig.java
...va/com/secspace/lib/common/dialog/other/DialogConfig.java
+1
-1
DialogUIUtils.java
...a/com/secspace/lib/common/dialog/other/DialogUIUtils.java
+6
-2
DialogManager.kt
...in/java/com/secspace/lib/common/function/DialogManager.kt
+28
-3
WorkManager.kt
...main/java/com/secspace/lib/common/function/WorkManager.kt
+24
-2
Encrypted.kt
.../java/com/secspace/lib/common/function/model/Encrypted.kt
+4
-0
JsonUtil.java
...src/main/java/com/secspace/lib/common/utils/JsonUtil.java
+20
-0
Prefs.java
...on/src/main/java/com/secspace/lib/common/utils/Prefs.java
+102
-70
Utils.kt
...mmon/src/main/java/com/secspace/lib/common/utils/Utils.kt
+12
-0
dialogui_holder_alert.xml
lib_common/src/main/res/layout/dialogui_holder_alert.xml
+16
-3
No files found.
Launcher3/AndroidManifest.xml
View file @
8e1d1d33
...
...
@@ -69,7 +69,7 @@
android:exported=
"true"
/>
<activity
android:name=
".function.
setting
.ChangePwdActivity"
android:name=
".function.
pwd
.ChangePwdActivity"
android:excludeFromRecents=
"true"
android:theme=
"@style/SettingTheme"
/>
...
...
@@ -98,7 +98,7 @@
android:excludeFromRecents=
"true"
android:theme=
"@style/SettingTheme"
/>
<activity
android:name=
".function.
setting
.SettingPwdActivity"
android:name=
".function.
pwd
.SettingPwdActivity"
android:excludeFromRecents=
"true"
android:theme=
"@style/SettingTheme"
/>
<activity
...
...
@@ -110,6 +110,11 @@
android:excludeFromRecents=
"true"
android:theme=
"@style/Theme.AppCompat.Light.NoActionBar"
/>
<activity
android:name=
".function.pwd.EncryptedActivity"
android:excludeFromRecents=
"true"
android:theme=
"@style/Theme.AppCompat.Light.NoActionBar"
/>
<activity
android:name=
".function.setting.AppChooseActivity"
android:excludeFromRecents=
"true"
android:resizeableActivity=
"false"
...
...
Launcher3/build.gradle
View file @
8e1d1d33
...
...
@@ -147,6 +147,7 @@ dependencies {
implementation
'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1'
implementation
"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation
"com.qmuiteam:qmui:1.3.0"
implementation
"org.jetbrains.kotlin:kotlin-reflect:1.3.61"
// implementation 'com.dou361.dialogui:jjdxm-dialogui:1.0.2'
}
...
...
Launcher3/res/drawable/ripple_bg.xml
0 → 100644
View file @
8e1d1d33
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<!--按下点击-->
<item
android:state_enabled=
"true"
android:state_pressed=
"true"
>
<shape>
<stroke
android:width=
"1px"
android:color=
"#B22d80df"
/>
<solid
android:color=
"#B22d80df"
/>
</shape>
</item>
<!--正常状态-->
<item
android:state_enabled=
"false"
android:state_pressed=
"false"
>
<shape>
<stroke
android:width=
"1px"
android:color=
"#B22d80df"
/>
<solid
android:color=
"#662d80df"
/>
</shape>
</item>
</selector>
\ No newline at end of file
Launcher3/res/layout/activity_change_pwd.xml
View file @
8e1d1d33
...
...
@@ -5,7 +5,7 @@
android:layout_height=
"match_parent"
android:fitsSystemWindows=
"true"
android:orientation=
"vertical"
tools:context=
"com.android.launcher3.function.
setting
.ChangePwdActivity"
>
tools:context=
"com.android.launcher3.function.
pwd
.ChangePwdActivity"
>
<TextView
android:id=
"@+id/tv_setting_title"
...
...
@@ -28,6 +28,8 @@
android:background=
"#FFFFFF"
android:hint=
"@string/edu_item_input_oldpwd"
android:paddingLeft=
"16dp"
android:maxLines=
"1"
android:maxLength=
"20"
android:paddingRight=
"16dp"
android:textColor=
"#363636"
android:inputType=
"textPassword"
...
...
@@ -45,6 +47,8 @@
android:layout_height=
"48dp"
android:background=
"#FFFFFF"
android:hint=
"@string/edu_item_input_newpwd"
android:maxLines=
"1"
android:maxLength=
"20"
android:paddingLeft=
"16dp"
android:inputType=
"textPassword"
android:paddingRight=
"16dp"
...
...
@@ -64,6 +68,8 @@
android:background=
"#FFFFFF"
android:inputType=
"textPassword"
android:hint=
"@string/edu_item_input_newpwd_again"
android:maxLines=
"1"
android:maxLength=
"20"
android:paddingLeft=
"16dp"
android:paddingRight=
"16dp"
android:textColor=
"#363636"
...
...
@@ -93,7 +99,7 @@
android:layout_height=
"48dp"
android:layout_marginTop=
"10dp"
android:layout_marginBottom=
"10dp"
android:background=
"@drawable/
btn_select
"
android:background=
"@drawable/
ripple_bg
"
android:elevation=
"3dp"
android:onClick=
"btnClick"
android:gravity=
"center"
...
...
Launcher3/res/layout/activity_encrypted.xml
0 → 100644
View file @
8e1d1d33
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:fitsSystemWindows=
"true"
android:orientation=
"vertical"
tools:context=
"com.android.launcher3.function.pwd.ChangePwdActivity"
>
<FrameLayout
android:id=
"@+id/ll_encrypted_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
</LinearLayout>
\ No newline at end of file
Launcher3/res/layout/activity_pwd_pin_set.xml
View file @
8e1d1d33
...
...
@@ -41,16 +41,16 @@
<EditText
android:id=
"@+id/edit_pwd"
android:layout_width=
"0dp"
android:layout_weight=
"1"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:background=
"@null"
android:hint=
"请输入密码"
android:inputType=
"textPassword"
android:maxLength=
"16"
android:maxLines=
"1"
android:padding=
"12dp"
android:textColorHint=
"#c2c2c2"
android:textColor=
"#c2c2c2"
android:textColorHint=
"#c2c2c2"
android:textSize=
"16dp"
/>
<CheckBox
...
...
@@ -63,6 +63,42 @@
android:checked=
"true"
/>
</LinearLayout>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:background=
"#c2c2c2"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"#ffffff"
android:orientation=
"horizontal"
>
<EditText
android:id=
"@+id/edit_pwd_again"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:background=
"@null"
android:hint=
"请再次输入密码"
android:inputType=
"textPassword"
android:maxLength=
"16"
android:maxLines=
"1"
android:padding=
"12dp"
android:textColor=
"#c2c2c2"
android:textColorHint=
"#c2c2c2"
android:textSize=
"16dp"
/>
<CheckBox
android:id=
"@+id/cb_show_pwd_again"
android:layout_width=
"40dp"
android:layout_height=
"25dp"
android:layout_centerVertical=
"true"
android:layout_marginRight=
"20dp"
android:button=
"@drawable/cb_selector"
android:checked=
"true"
/>
</LinearLayout>
<Button
android:id=
"@+id/btn_sure"
android:layout_width=
"match_parent"
...
...
Launcher3/res/layout/fragment_encrypted_set.xml
0 → 100644
View file @
8e1d1d33
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:fitsSystemWindows=
"true"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/tv_setting_title"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:drawableStart=
"@mipmap/ic_back"
android:drawablePadding=
"10dp"
android:gravity=
"center_vertical"
android:onClick=
"close"
android:paddingLeft=
"16dp"
android:paddingRight=
"16dp"
android:text=
"@string/edu_item_about"
android:textColor=
"#363636"
android:textSize=
"16sp"
/>
<EditText
android:id=
"@+id/et_question1"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:background=
"#FFFFFF"
android:hint=
"@string/edu_item_input_encryted_question1"
android:maxLength=
"50"
android:maxLines=
"1"
android:paddingLeft=
"16dp"
android:paddingRight=
"16dp"
android:textColor=
"#363636"
android:textColorHint=
"#8D8D8D"
android:textSize=
"16sp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:background=
"#DDDFE1"
/>
<EditText
android:id=
"@+id/et_answer1"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:background=
"#FFFFFF"
android:hint=
"@string/edu_item_input_encryted_answer1"
android:maxLength=
"50"
android:maxLines=
"1"
android:paddingLeft=
"16dp"
android:paddingRight=
"16dp"
android:textColor=
"#363636"
android:textColorHint=
"#8D8D8D"
android:textSize=
"16sp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:background=
"#DDDFE1"
/>
<EditText
android:id=
"@+id/et_question2"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:background=
"#FFFFFF"
android:hint=
"@string/edu_item_input_encryted_question2"
android:maxLength=
"50"
android:maxLines=
"1"
android:paddingLeft=
"16dp"
android:paddingRight=
"16dp"
android:textColor=
"#363636"
android:textColorHint=
"#8D8D8D"
android:textSize=
"16sp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:background=
"#DDDFE1"
/>
<EditText
android:id=
"@+id/et_answer2"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:background=
"#FFFFFF"
android:hint=
"@string/edu_item_input_encryted_answer2"
android:maxLength=
"50"
android:maxLines=
"1"
android:paddingLeft=
"16dp"
android:paddingRight=
"16dp"
android:textColor=
"#363636"
android:textColorHint=
"#8D8D8D"
android:textSize=
"16sp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:background=
"#DDDFE1"
/>
<Button
android:id=
"@+id/btn_encrypted_set"
style=
"@style/Widget.AppCompat.Button.Borderless"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:layout_marginTop=
"10dp"
android:layout_marginBottom=
"10dp"
android:background=
"@drawable/ripple_bg"
android:elevation=
"3dp"
android:gravity=
"center"
android:text=
"@string/common_sure"
android:textColor=
"#fafafa"
android:textSize=
"16sp"
/>
</LinearLayout>
Launcher3/res/layout/fragment_encrypted_ver.xml
0 → 100644
View file @
8e1d1d33
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:fitsSystemWindows=
"true"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/tv_setting_title"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:drawableStart=
"@mipmap/ic_back"
android:drawablePadding=
"10dp"
android:gravity=
"center_vertical"
android:onClick=
"close"
android:paddingLeft=
"16dp"
android:paddingRight=
"16dp"
android:text=
"@string/edu_item_about"
android:textColor=
"#363636"
android:textSize=
"16sp"
/>
<TextView
android:id=
"@+id/tv_question1"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:drawablePadding=
"10dp"
android:gravity=
"center_vertical"
android:paddingLeft=
"16dp"
android:paddingRight=
"16dp"
android:text=
"@string/edu_item_input_encryted_question1"
android:textColor=
"#363636"
android:textSize=
"16sp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:background=
"#DDDFE1"
/>
<EditText
android:id=
"@+id/et_answer1"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:background=
"#FFFFFF"
android:hint=
"@string/edu_item_input_encryted_answer1"
android:maxLines=
"1"
android:maxLength=
"50"
android:paddingLeft=
"16dp"
android:paddingRight=
"16dp"
android:textColor=
"#363636"
android:textColorHint=
"#8D8D8D"
android:textSize=
"16sp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:background=
"#DDDFE1"
/>
<TextView
android:id=
"@+id/tv_question2"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:drawablePadding=
"10dp"
android:gravity=
"center_vertical"
android:paddingLeft=
"16dp"
android:paddingRight=
"16dp"
android:text=
"@string/edu_item_input_encryted_question1"
android:textColor=
"#363636"
android:textSize=
"16sp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:background=
"#DDDFE1"
/>
<EditText
android:id=
"@+id/et_answer2"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:background=
"#FFFFFF"
android:hint=
"@string/edu_item_input_encryted_answer2"
android:maxLines=
"1"
android:maxLength=
"50"
android:paddingLeft=
"16dp"
android:paddingRight=
"16dp"
android:textColor=
"#363636"
android:textColorHint=
"#8D8D8D"
android:textSize=
"16sp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:background=
"#DDDFE1"
/>
<Button
android:id=
"@+id/btn_encrypted_set"
style=
"@style/Widget.AppCompat.Button.Borderless"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:layout_marginTop=
"10dp"
android:layout_marginBottom=
"10dp"
android:background=
"@drawable/ripple_bg"
android:elevation=
"3dp"
android:gravity=
"center"
android:text=
"@string/common_sure"
android:textColor=
"#fafafa"
android:textSize=
"16sp"
/>
</LinearLayout>
Launcher3/res/values/strings.xml
View file @
8e1d1d33
...
...
@@ -361,5 +361,23 @@
<string
name=
"edu_item_input_pwd_different"
>
两次输入密码不一致,请重新输入
</string>
<string
name=
"edu_item_input_pwd_change_success"
>
密码修改成功
</string>
<string
name=
"edu_item_input_encryted_set"
>
设置密保
</string>
<string
name=
"edu_item_input_encryted_verfiy"
>
验证密保
</string>
<string
name=
"edu_item_input_encryted_question1"
>
问题一
</string>
<string
name=
"edu_item_input_encryted_question2"
>
问题二
</string>
<string
name=
"edu_item_input_encryted_answer1"
>
答案一
</string>
<string
name=
"edu_item_input_encryted_answer2"
>
答案二
</string>
<string
name=
"edu_item_input_question_null"
>
问题为空
</string>
<string
name=
"edu_item_input_answer_null"
>
答案为空
</string>
<string
name=
"edu_item_input_encryted_set_success"
>
密保设置成功
</string>
<string
name=
"edu_item_input_encryted_ver_success"
>
密保验证成功
</string>
<string
name=
"edu_item_input_encryted_error"
>
未获取到密保答案
</string>
<string
name=
"edu_item_input_answer1_error"
>
问题一答案错误
</string>
<string
name=
"edu_item_input_answer2_error"
>
问题二答案错误
</string>
<string
name=
"edu_item_input_encryted_title"
>
请输入密保答案
</string>
</resources>
Launcher3/src/com/android/launcher3/Launcher.java
View file @
8e1d1d33
...
...
@@ -61,7 +61,7 @@ import android.os.SystemClock;
import
android.os.Trace
;
import
android.os.UserHandle
;
import
android.support.annotation.Nullable
;
import
android.text.
InputTyp
e
;
import
android.text.
Editabl
e
;
import
android.text.Selection
;
import
android.text.SpannableStringBuilder
;
import
android.text.TextUtils
;
...
...
@@ -160,6 +160,7 @@ import com.secspace.lib.common.event.RefreshWorkSpaceEvent;
import
com.secspace.lib.common.function.ActivationHelper
;
import
com.secspace.lib.common.function.DialogManager
;
import
com.secspace.lib.common.function.WorkManager
;
import
com.secspace.lib.common.function.model.Encrypted
;
import
com.secspace.lib.common.update.CheckUpdateCore
;
import
com.secspace.lib.common.utils.ActivityHelper
;
import
com.secspace.lib.common.utils.DeviceUtil
;
...
...
@@ -168,8 +169,10 @@ import com.secspace.lib.common.utils.FileUtil;
import
com.secspace.lib.common.utils.ImeiCheckUtils
;
import
com.secspace.lib.common.utils.InputUtil
;
import
com.secspace.lib.common.utils.IntentUtil
;
import
com.secspace.lib.common.utils.JsonUtil
;
import
com.secspace.lib.common.utils.Prefs
;
import
com.secspace.lib.common.utils.ToastUtil
;
import
com.secspace.lib.common.utils.UtilsKt
;
import
com.secspace.mdmengine.api.manager.MdmFactoryManager
;
import
org.greenrobot.eventbus.EventBus
;
...
...
@@ -406,6 +409,8 @@ public class Launcher extends BaseActivity
private
RotationPrefChangeHandler
mRotationPrefChangeHandler
;
private
String
mWallpaperPath
;
private
String
question
;
private
String
answer1
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
...
@@ -1200,36 +1205,14 @@ public class Launcher extends BaseActivity
if
(
mLauncherCallbacks
!=
null
)
{
mLauncherCallbacks
.
onResume
();
}
ActivationHelper
.
INSTANCE
.
active
(
this
,
new
ActivationHelper
.
ActivationListener
()
{
@Override
public
void
activationFailed
()
{
DialogManager
.
INSTANCE
.
showActivateLoseDialog
(
Launcher
.
this
,
getString
(
R
.
string
.
common_remind
)
,
getString
(
R
.
string
.
dialog_tip_activate_lose
),
new
DialogManager
.
MessageListener
()
{
@Override
public
void
onPositive
()
{
IntentUtil
.
startHomeIntent
(
Launcher
.
this
);
}
@Override
public
void
onNegative
()
{
}
})
;
}
@Override
public
void
activated
()
{
WorkManager
.
INSTANCE
.
enter
(
Launcher
.
this
);
}
},
false
);
WorkManager
.
INSTANCE
.
enter
(
Launcher
.
this
);
}
public
static
void
forceReload
(){
public
static
void
forceReload
()
{
LauncherAppState
app
=
LauncherAppState
.
getInstanceNoCreate
();
if
(
app
!=
null
)
{
LauncherModel
model
=
app
.
getModel
();
if
(
model
!=
null
)
{
if
(
model
!=
null
)
{
model
.
forceReload
();
}
}
...
...
@@ -3124,12 +3107,17 @@ public class Launcher extends BaseActivity
}
private
void
showPwdDialog
()
{
DialogManager
.
INSTANCE
.
showPwdDialog
(
this
,
"请输入密码"
,
new
DialogManager
.
PwdListener
(){
DialogManager
.
INSTANCE
.
showPwdDialog
(
this
,
"请输入密码"
,
new
DialogManager
.
PwdCanVerListener
()
{
@Override
public
void
onNeutral
()
{
showEncryptedVerDialog
();
}
@Override
public
void
onPositive
(
View
view
)
{
InputUtil
.
closeSoftInput
(
getApplicationContext
(),
view
);
if
(
TextUtils
.
equals
(((
EditText
)
view
).
getText
().
toString
(),
Prefs
.
getLoginPwd
(
mAppContext
)))
{
if
(
TextUtils
.
equals
(((
EditText
)
view
).
getText
().
toString
(),
Prefs
.
getLoginPwd
(
mAppContext
)))
{
IntentUtil
.
startExitService
(
mAppContext
);
}
else
{
DialogUIUtils
.
showToastCenter
(
"密码错误"
);
...
...
@@ -3143,6 +3131,51 @@ public class Launcher extends BaseActivity
});
}
private
void
showEncryptedVerDialog
()
{
String
encryptedStr
=
Prefs
.
getEncrypted
(
mAppContext
);
if
(
TextUtils
.
isEmpty
(
encryptedStr
))
{
DialogUIUtils
.
showToastCenter
(
"请先设置密保"
);
return
;
}
Encrypted
encrypted
=
JsonUtil
.
fromJson
(
encryptedStr
,
Encrypted
.
class
);
if
(
TextUtils
.
equals
(
encrypted
.
getQuestion1
(),
question
))
{
question
=
encrypted
.
getQuestion2
();
answer1
=
encrypted
.
getAnswer2
();
}
else
{
question
=
encrypted
.
getQuestion1
();
answer1
=
encrypted
.
getAnswer1
();
}
DialogManager
.
INSTANCE
.
showEncryptedVerDialog
(
this
,
getString
(
R
.
string
.
edu_item_input_encryted_title
),
question
,
new
DialogManager
.
PwdListener
()
{
@Override
public
void
onPositive
(
View
view
)
{
InputUtil
.
closeSoftInput
(
getApplicationContext
(),
view
);
EditText
editText
=
(
EditText
)
view
;
Editable
editable
=
editText
.
getText
();
if
(
editable
==
null
||
TextUtils
.
isEmpty
(
editable
.
toString
()))
{
DialogUIUtils
.
showToastCenter
(
R
.
string
.
edu_item_input_encryted_title
);
return
;
}
String
answer
=
editable
.
toString
();
answer
=
UtilsKt
.
encrypt
(
answer
);
if
(
TextUtils
.
equals
(
answer1
,
answer
))
{
Intent
intent
=
new
Intent
(
mAppContext
,
PwdPinSetPwdActivity
.
class
);
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
startActivity
(
intent
);
return
;
}
DialogUIUtils
.
showToastCenter
(
"密保答案错误"
);
}
@Override
public
void
onNegative
()
{
showEncryptedVerDialog
();
}
});
}
@Override
public
boolean
dispatchTouchEvent
(
MotionEvent
ev
)
{
mLastDispatchTouchEventX
=
ev
.
getX
();
...
...
Launcher3/src/com/android/launcher3/ManagerAuthActivity.java
View file @
8e1d1d33
...
...
@@ -5,21 +5,29 @@ import android.content.Context;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.text.Editable
;
import
android.text.TextUtils
;
import
android.view.View
;
import
android.widget.EditText
;
import
com.android.launcher3.function.pwd.PwdPinSetPwdActivity
;
import
com.android.launcher3.function.setting.SettingAdminActivity
;
import
com.android.launcher3.settings.ErrorTimeHelper
;
import
com.secspace.lib.common.dialog.other.DialogUIUtils
;
import
com.secspace.lib.common.function.DialogManager
;
import
com.secspace.lib.common.function.model.Encrypted
;
import
com.secspace.lib.common.utils.InputUtil
;
import
com.secspace.lib.common.utils.JsonUtil
;
import
com.secspace.lib.common.utils.Prefs
;
import
com.secspace.lib.common.utils.ToastUtil
;
import
com.secspace.lib.common.utils.UtilsKt
;
public
class
ManagerAuthActivity
extends
BaseActivity
{
protected
Context
mAppContext
;
private
String
question
;
private
String
answer1
;
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
...
...
@@ -29,14 +37,19 @@ public class ManagerAuthActivity extends BaseActivity {
}
private
void
showPwdDialog
()
{
DialogManager
.
INSTANCE
.
showPwdDialog
(
this
,
"请输入密码"
,
new
DialogManager
.
PwdListener
(){
DialogManager
.
INSTANCE
.
showPwdDialog
(
this
,
"请输入密码"
,
new
DialogManager
.
PwdCanVerListener
()
{
@Override
public
void
onNeutral
()
{
showEncryptedVerDialog
();
}
@Override
public
void
onPositive
(
View
view
)
{
EditText
editText
=
(
EditText
)
view
;
InputUtil
.
closeSoftInput
(
getApplicationContext
(),
editText
);
boolean
canInputPwd
=
ErrorTimeHelper
.
getInstance
(
mAppContext
).
canInputPwd
();
if
(
canInputPwd
){
if
(
canInputPwd
)
{
if
(
TextUtils
.
equals
(
editText
.
getText
().
toString
(),
Prefs
.
getLoginPwd
(
mAppContext
)))
{
finish
();
ErrorTimeHelper
.
getInstance
(
mAppContext
).
resetLockTimeAndCount
();
...
...
@@ -48,14 +61,63 @@ public class ManagerAuthActivity extends BaseActivity {
ErrorTimeHelper
.
getInstance
(
mAppContext
).
addErrorCount
();
finish
();
}
}
else
{
ToastUtil
.
showShort
(
mAppContext
,
"请在"
+
ErrorTimeHelper
.
getInstance
(
mAppContext
).
getCountDownTime
()+
"秒后重试"
);
}
else
{
ToastUtil
.
showShort
(
mAppContext
,
"请在"
+
ErrorTimeHelper
.
getInstance
(
mAppContext
).
getCountDownTime
()
+
"秒后重试"
);
finish
();
}
}
@Override
public
void
onNegative
()
{
finish
();
}
});
}
private
void
showEncryptedVerDialog
()
{
String
encryptedStr
=
Prefs
.
getEncrypted
(
mAppContext
);
if
(
TextUtils
.
isEmpty
(
encryptedStr
))
{
DialogUIUtils
.
showToastCenter
(
"请先设置密保"
);
finish
();
return
;
}
Encrypted
encrypted
=
JsonUtil
.
fromJson
(
encryptedStr
,
Encrypted
.
class
);
if
(
TextUtils
.
equals
(
encrypted
.
getQuestion1
(),
question
))
{
question
=
encrypted
.
getQuestion2
();
answer1
=
encrypted
.
getAnswer2
();
}
else
{
question
=
encrypted
.
getQuestion1
();
answer1
=
encrypted
.
getAnswer1
();
}
DialogManager
.
INSTANCE
.
showEncryptedVerDialog
(
this
,
getString
(
R
.
string
.
edu_item_input_encryted_title
),
question
,
new
DialogManager
.
PwdListener
()
{
@Override
public
void
onPositive
(
View
view
)
{
EditText
editText
=
(
EditText
)
view
;
InputUtil
.
closeSoftInput
(
getApplicationContext
(),
editText
);
Editable
editable
=
editText
.
getText
();
if
(
editable
==
null
||
TextUtils
.
isEmpty
(
editable
.
toString
()))
{
DialogUIUtils
.
showToastCenter
(
R
.
string
.
edu_item_input_encryted_title
);
finish
();
return
;
}
String
answer
=
editable
.
toString
();
answer
=
UtilsKt
.
encrypt
(
answer
);
if
(
TextUtils
.
equals
(
answer1
,
answer
))
{
Intent
intent
=
new
Intent
(
mAppContext
,
PwdPinSetPwdActivity
.
class
);
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
startActivity
(
intent
);
finish
();
return
;
}
DialogUIUtils
.
showToastCenter
(
"密保答案错误"
);
finish
();
}
@Override
public
void
onNegative
()
{
showEncryptedVerDialog
();
}
});
}
...
...
Launcher3/src/com/android/launcher3/function/
setting
/ChangePwdActivity.kt
→
Launcher3/src/com/android/launcher3/function/
pwd
/ChangePwdActivity.kt
View file @
8e1d1d33
package
com.android.launcher3.function.
setting
package
com.android.launcher3.function.
pwd
import
android.content.Context
import
android.content.Intent
import
android.os.Bundle
import
android.text.SpannableString
import
android.text.Spanned
...
...
@@ -12,16 +13,22 @@ import android.view.inputmethod.InputMethodManager
import
android.widget.EditText
import
com.android.launcher3.BaseActivity
import
com.android.launcher3.R
import
com.android.launcher3.function.pwd.PwdPinSetPwdActivity
import
com.android.launcher3.settings.ErrorTimeHelper
import
com.secspace.lib.common.dialog.other.DialogUIUtils
import
com.secspace.lib.common.function.DialogManager
import
com.secspace.lib.common.function.model.Encrypted
import
com.secspace.lib.common.utils.InputUtil
import
com.secspace.lib.common.utils.JsonUtil
import
com.secspace.lib.common.utils.Prefs
import
com.secspace.lib.common.utils.encrypt
import
kotlinx.android.synthetic.main.activity_change_pwd.*
import
kotlinx.android.synthetic.main.activity_setting.tv_setting_title
class
ChangePwdActivity
:
BaseActivity
()
{
private
var
mContext
:
Context
?
=
null
private
var
question
:
String
?
=
null
private
var
answer1
:
String
?
=
null
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
...
...
@@ -38,7 +45,7 @@ class ChangePwdActivity : BaseActivity() {
setHintSize
(
et_new_pwd_again
,
getString
(
R
.
string
.
edu_item_input_newpwd_again
))
tv_confir_pwd_protection
.
setOnClickListener
{
DialogUIUtils
.
showToastCenter
(
R
.
string
.
edu_toast_wait
)
showEncryptedVerDialog
(
)
}
}
...
...
@@ -87,6 +94,46 @@ class ChangePwdActivity : BaseActivity() {
finish
()
}
private
fun
showEncryptedVerDialog
()
{
val
encryptedStr
=
Prefs
.
getEncrypted
(
mAppContext
)
if
(
TextUtils
.
isEmpty
(
encryptedStr
))
{
DialogUIUtils
.
showToastCenter
(
"请先设置密保"
)
return
}
val
(
question1
,
answer11
,
question2
,
answer2
)
=
JsonUtil
.
fromJson
(
encryptedStr
,
Encrypted
::
class
.
java
)
if
(
TextUtils
.
equals
(
question1
,
question
))
{
question
=
question2
answer1
=
answer2
}
else
{
question
=
question1
answer1
=
answer11
}
DialogManager
.
showEncryptedVerDialog
(
this
,
getString
(
R
.
string
.
edu_item_input_encryted_title
),
question
,
object
:
DialogManager
.
PwdListener
{
override
fun
onPositive
(
view
:
View
?)
{
val
editText
=
view
as
EditText
?
InputUtil
.
closeSoftInput
(
applicationContext
,
editText
)
val
editable
=
editText
!!
.
text
if
(
editable
==
null
||
TextUtils
.
isEmpty
(
editable
.
toString
()))
{
DialogUIUtils
.
showToastCenter
(
R
.
string
.
edu_item_input_encryted_title
)
return
}
var
answer
=
editable
.
toString
()
answer
=
encrypt
(
answer
)
if
(
TextUtils
.
equals
(
answer1
,
answer
))
{
val
intent
=
Intent
(
mAppContext
,
PwdPinSetPwdActivity
::
class
.
java
)
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
)
startActivity
(
intent
)
return
}
DialogUIUtils
.
showToastCenter
(
"密保答案错误"
)
}
override
fun
onNegative
()
{
showEncryptedVerDialog
()
}
})
}
fun
close
(
view
:
View
?)
{
finish
()
}
...
...
Launcher3/src/com/android/launcher3/function/pwd/EncryptedActivity.kt
0 → 100644
View file @
8e1d1d33
package
com.android.launcher3.function.pwd
import
android.content.Context
import
android.os.Bundle
import
android.support.v4.app.Fragment
import
android.support.v4.app.FragmentManager
import
android.support.v4.app.FragmentTransaction
import
android.view.View
import
com.android.launcher3.BaseActivity
import
com.android.launcher3.R
import
com.android.launcher3.function.pwd.fragment.EncryptedSetFragment
import
com.android.launcher3.function.pwd.fragment.EncryptedVerifyFragment
import
com.secspace.lib.common.utils.Prefs
class
EncryptedActivity
:
BaseActivity
()
{
private
var
mContext
:
Context
?
=
null
private
val
encryptedSet
=
EncryptedSetFragment
()
private
val
encryptedVer
=
EncryptedVerifyFragment
()
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
setAndroidNativeLightStatusBar
(
true
)
setContentView
(
R
.
layout
.
activity_encrypted
)
mContext
=
this
val
from
=
intent
.
getStringExtra
(
"from"
)
if
(
from
==
null
){
val
encrypted
=
Prefs
.
getEncrypted
(
mContext
)
if
(
encrypted
==
""
)
{
replaceFragment
(
encryptedSet
)
}
else
{
replaceFragment
(
encryptedVer
)
}
return
}
replaceFragment
(
encryptedSet
)
}
private
fun
replaceFragment
(
fragment
:
Fragment
)
{
val
fragmentManager
:
FragmentManager
=
supportFragmentManager
val
fragmentTransaction
:
FragmentTransaction
=
fragmentManager
.
beginTransaction
()
fragmentTransaction
.
replace
(
R
.
id
.
ll_encrypted_parent
,
fragment
,
""
)
fragmentTransaction
.
addToBackStack
(
null
)
fragmentTransaction
.
commit
()
}
fun
close
(
view
:
View
?)
{
finish
()
}
override
fun
onBackPressed
()
{
super
.
onBackPressed
()
finish
()
}
}
\ No newline at end of file
Launcher3/src/com/android/launcher3/function/pwd/PwdPinSetPwdActivity.java
View file @
8e1d1d33
...
...
@@ -44,10 +44,12 @@ public class PwdPinSetPwdActivity extends BaseActivity implements View.OnClickLi
* 密码短程度
*/
public
static
final
int
PWD_TINY_LENGTH
=
6
;
EditText
mEditPwd
;
CheckBox
mCbShowPwd
;
Button
mBtSure
;
TextView
mTvtip
;
private
EditText
mEditPwd
;
private
CheckBox
mCbShowPwd
;
private
EditText
mEditPwdAgain
;
private
CheckBox
mCbShowPwdAgain
;
private
Button
mBtSure
;
private
TextView
mTvtip
;
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
...
...
@@ -58,11 +60,14 @@ public class PwdPinSetPwdActivity extends BaseActivity implements View.OnClickLi
private
void
initView
()
{
mEditPwd
=
findViewById
(
R
.
id
.
edit_pwd
);
mEditPwdAgain
=
findViewById
(
R
.
id
.
edit_pwd_again
);
mCbShowPwd
=
findViewById
(
R
.
id
.
cb_show_pwd
);
mCbShowPwdAgain
=
findViewById
(
R
.
id
.
cb_show_pwd_again
);
mBtSure
=
findViewById
(
R
.
id
.
btn_sure
);
mTvtip
=
findViewById
(
R
.
id
.
tv_tip
);
mBtSure
.
setOnClickListener
(
this
);
mCbShowPwd
.
setOnCheckedChangeListener
(
this
);
mCbShowPwdAgain
.
setOnCheckedChangeListener
(
this
);
}
private
void
startLauncher
()
{
...
...
@@ -84,19 +89,21 @@ public class PwdPinSetPwdActivity extends BaseActivity implements View.OnClickLi
case
R
.
id
.
btn_sure
:
InputMethodManager
imm
=
(
InputMethodManager
)
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
);
imm
.
hideSoftInputFromWindow
(
getWindow
().
getDecorView
().
getWindowToken
(),
0
);
String
pwd
=
String
.
valueOf
(
mEditPwd
.
getText
());
if
(
TextUtils
.
isEmpty
(
pwd
))
{
DialogUIUtils
.
showToastCenter
(
"密码不能为空"
);
String
pwdAgain
=
String
.
valueOf
(
mEditPwdAgain
.
getText
());
if
(
TextUtils
.
isEmpty
(
pwd
)
||
(
pwd
.
length
()
<
PWD_TINY_LENGTH
))
{
DialogUIUtils
.
showToastCenter
(
"密码为空或长度小于6位"
);
return
;
}
if
(
pwd
.
length
()
<
PWD_TINY_LENGTH
)
{
DialogUIUtils
.
showToastCenter
(
"密码至少为6位"
);
if
(
TextUtils
.
isEmpty
(
pwdAgain
)
||
(
pwdAgain
.
length
()
<
PWD_TINY_LENGTH
))
{
DialogUIUtils
.
showToastCenter
(
"确认密码为空或长度小于6位"
);
return
;
}
if
(!
TextUtils
.
equals
(
pwd
,
pwdAgain
))
{
DialogUIUtils
.
showToastCenter
(
"两次输入密码不同"
);
return
;
}
// if (pwd.length() > PWD_MAX_LENGTH) {
// ToastUtil.showShort(this, "密码不能超过16位");
// return;
// }
Log
.
i
(
TAG
,
"matches: "
+
datePatt
.
matcher
(
pwd
).
matches
());
// if (!datePatt.matcher(pwd).matches()) {
// ToastUtil.showShort(this, "新密码必须为数字、字母或常用符号的8-16位组合");
...
...
@@ -112,11 +119,23 @@ public class PwdPinSetPwdActivity extends BaseActivity implements View.OnClickLi
@Override
public
void
onCheckedChanged
(
CompoundButton
buttonView
,
boolean
isChecked
)
{
if
(
isChecked
)
{
Log
.
i
(
TAG
,
"onCheckedChanged: TYPE_TEXT_VARIATION_PASSWORD"
);
mEditPwd
.
setInputType
(
InputType
.
TYPE_CLASS_TEXT
|
InputType
.
TYPE_TEXT_VARIATION_PASSWORD
);
}
else
{
mEditPwd
.
setInputType
(
InputType
.
TYPE_CLASS_NUMBER
|
InputType
.
TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
);
switch
(
buttonView
.
getId
())
{
case
R
.
id
.
cb_show_pwd
:
if
(
isChecked
)
{
mEditPwd
.
setInputType
(
InputType
.
TYPE_CLASS_TEXT
|
InputType
.
TYPE_TEXT_VARIATION_PASSWORD
);
}
else
{
mEditPwd
.
setInputType
(
InputType
.
TYPE_CLASS_NUMBER
|
InputType
.
TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
);
}
break
;
case
R
.
id
.
cb_show_pwd_again
:
if
(
isChecked
)
{
mEditPwdAgain
.
setInputType
(
InputType
.
TYPE_CLASS_TEXT
|
InputType
.
TYPE_TEXT_VARIATION_PASSWORD
);
}
else
{
mEditPwdAgain
.
setInputType
(
InputType
.
TYPE_CLASS_NUMBER
|
InputType
.
TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
);
}
break
;
}
}
}
Launcher3/src/com/android/launcher3/function/
setting
/SettingPwdActivity.kt
→
Launcher3/src/com/android/launcher3/function/
pwd
/SettingPwdActivity.kt
View file @
8e1d1d33
package
com.android.launcher3.function.
setting
package
com.android.launcher3.function.
pwd
import
android.content.Context
import
android.content.Intent
import
android.os.Bundle
import
android.text.TextUtils
import
android.view.View
import
android.widget.EditText
import
android.widget.GridLayout
import
com.android.launcher3.BaseActivity
import
com.android.launcher3.R
import
com.android.launcher3.mdm.DisableCompat
import
com.android.launcher3.settings.Contants
import
com.qmuiteam.qmui.widget.grouplist.QMUICommonListItemView
import
com.qmuiteam.qmui.widget.grouplist.QMUIGroupListView
import
com.secspace.lib.common.utils.PkgManager
import
com.secspace.lib.common.utils.Prefs
import
com.secspace.lib.common.utils.ToastUtil
import
com.secspace.lib.common.utils.dp2px
import
com.secspace.lib.common.dialog.other.DialogUIUtils
import
com.secspace.lib.common.function.DialogManager.PwdListener
import
com.secspace.lib.common.function.DialogManager.showEncryptedVerDialog
import
com.secspace.lib.common.function.model.Encrypted
import
com.secspace.lib.common.utils.*
import
kotlinx.android.synthetic.main.activity_setting.*
class
SettingPwdActivity
:
BaseActivity
(){
...
...
@@ -46,12 +48,10 @@ class SettingPwdActivity : BaseActivity(){
dp2px
(
48f
))
QMUIGroupListView
.
newSection
(
this
)
.
addItemView
(
pwd
)
{
val
intent1
=
Intent
(
this
,
ChangePwdActivity
::
class
.
java
)
intent1
.
putExtra
(
Contants
.
IS_SHOW_ORIGINAL_PWD
,
true
)
startActivity
(
intent1
)
startActivity
(
Intent
(
this
,
ChangePwdActivity
::
class
.
java
))
}
.
addItemView
(
pwdCar
)
{
ToastUtil
.
showShort
(
mContext
,
R
.
string
.
edu_toast_wait
)
startActivity
(
Intent
(
this
,
EncryptedActivity
::
class
.
java
)
)
}
.
addTo
(
grouplistview
)
}
...
...
Launcher3/src/com/android/launcher3/function/pwd/fragment/EncryptedSetFragment.kt
0 → 100644
View file @
8e1d1d33
package
com.android.launcher3.function.pwd.fragment
import
android.content.Context
import
android.os.Bundle
import
android.support.v4.app.Fragment
import
android.text.SpannableString
import
android.text.Spanned
import
android.text.SpannedString
import
android.text.style.AbsoluteSizeSpan
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.view.inputmethod.InputMethodManager
import
android.widget.Button
import
android.widget.EditText
import
android.widget.TextView
import
com.android.launcher3.R
import
com.secspace.lib.common.function.model.Encrypted
import
com.android.launcher3.settings.ErrorTimeHelper
import
com.google.gson.Gson
import
com.secspace.lib.common.dialog.other.DialogUIUtils
import
com.secspace.lib.common.utils.Prefs
import
com.secspace.lib.common.utils.encrypt
class
EncryptedSetFragment
:
Fragment
()
{
private
lateinit
var
questionEt1
:
EditText
private
lateinit
var
questionEt2
:
EditText
private
lateinit
var
answerEt1
:
EditText
private
lateinit
var
answerEt2
:
EditText
private
lateinit
var
sureBtn
:
Button
private
lateinit
var
titleTv
:
TextView
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
?
{
val
view
:
View
=
inflater
.
inflate
(
R
.
layout
.
fragment_encrypted_set
,
container
,
false
)
initView
(
view
)
return
view
}
private
fun
initView
(
view
:
View
)
{
titleTv
=
view
.
findViewById
(
R
.
id
.
tv_setting_title
)
sureBtn
=
view
.
findViewById
(
R
.
id
.
btn_encrypted_set
)
questionEt1
=
view
.
findViewById
(
R
.
id
.
et_question1
)
questionEt2
=
view
.
findViewById
(
R
.
id
.
et_question2
)
answerEt1
=
view
.
findViewById
(
R
.
id
.
et_answer1
)
answerEt2
=
view
.
findViewById
(
R
.
id
.
et_answer2
)
titleTv
.
setText
(
R
.
string
.
edu_item_input_encryted_set
)
setHintSize
(
questionEt1
,
getString
(
R
.
string
.
edu_item_input_encryted_question1
))
setHintSize
(
answerEt1
,
getString
(
R
.
string
.
edu_item_input_encryted_answer1
))
setHintSize
(
questionEt2
,
getString
(
R
.
string
.
edu_item_input_encryted_question2
))
setHintSize
(
answerEt2
,
getString
(
R
.
string
.
edu_item_input_encryted_answer2
))
sureBtn
.
setOnClickListener
{
btnClick
()
}
titleTv
.
setOnClickListener
{
activity
?.
finish
()
}
}
private
fun
setHintSize
(
editText
:
EditText
,
text
:
String
)
{
val
ss
=
SpannableString
(
text
)
val
ass
=
AbsoluteSizeSpan
(
15
,
true
)
ss
.
setSpan
(
ass
,
0
,
ss
.
length
,
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
)
editText
.
hint
=
SpannedString
(
ss
)
}
private
fun
btnClick
()
{
val
imm
:
InputMethodManager
=
activity
?.
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
)
as
InputMethodManager
imm
.
hideSoftInputFromWindow
(
activity
?.
window
?.
decorView
?.
windowToken
,
0
)
val
question1
=
questionEt1
.
text
.
toString
()
var
answer1
=
answerEt1
.
text
.
toString
()
val
question2
=
questionEt2
.
text
.
toString
()
var
answer2
=
answerEt2
.
text
.
toString
()
if
(
question1
.
isEmpty
()
||
question2
.
isEmpty
())
{
DialogUIUtils
.
showToastCenter
(
R
.
string
.
edu_item_input_question_null
)
return
}
if
(
answer1
.
isEmpty
()
||
answer2
.
isEmpty
())
{
DialogUIUtils
.
showToastCenter
(
R
.
string
.
edu_item_input_answer_null
)
return
}
DialogUIUtils
.
showToastCenter
(
R
.
string
.
edu_item_input_encryted_set_success
)
answer1
=
encrypt
(
answer1
)
answer2
=
encrypt
(
answer2
)
val
encrypted
=
Encrypted
(
question1
,
answer1
,
question2
,
answer2
)
Prefs
.
setEncrypted
(
activity
,
Gson
().
toJson
(
encrypted
))
//如果存在输错密码多次的情况下重置密码
ErrorTimeHelper
.
getInstance
(
activity
).
resetLockTimeAndCount
()
activity
?.
finish
()
}
}
\ No newline at end of file
Launcher3/src/com/android/launcher3/function/pwd/fragment/EncryptedVerifyFragment.kt
0 → 100644
View file @
8e1d1d33
package
com.android.launcher3.function.pwd.fragment
import
android.content.Context
import
android.content.Intent
import
android.os.Bundle
import
android.support.v4.app.Fragment
import
android.text.SpannableString
import
android.text.Spanned
import
android.text.SpannedString
import
android.text.style.AbsoluteSizeSpan
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.view.inputmethod.InputMethodManager
import
android.widget.Button
import
android.widget.EditText
import
android.widget.TextView
import
com.android.launcher3.R
import
com.secspace.lib.common.function.model.Encrypted
import
com.android.launcher3.function.pwd.EncryptedActivity
import
com.secspace.lib.common.dialog.other.DialogUIUtils
import
com.secspace.lib.common.utils.JsonUtil
import
com.secspace.lib.common.utils.Prefs
import
com.secspace.lib.common.utils.encrypt
class
EncryptedVerifyFragment
:
Fragment
()
{
private
lateinit
var
questionTv1
:
TextView
private
lateinit
var
questionTv2
:
TextView
private
lateinit
var
answerEt1
:
EditText
private
lateinit
var
answerEt2
:
EditText
private
lateinit
var
sureBtn
:
Button
private
lateinit
var
titleTv
:
TextView
private
lateinit
var
encrypted
:
Encrypted
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
?
{
val
view
:
View
=
inflater
.
inflate
(
R
.
layout
.
fragment_encrypted_ver
,
container
,
false
)
val
encryptedStr
=
Prefs
.
getEncrypted
(
activity
)
if
(
encryptedStr
.
isEmpty
())
{
DialogUIUtils
.
showToastCenter
(
R
.
string
.
edu_item_input_encryted_error
)
}
encrypted
=
JsonUtil
.
fromJson
(
encryptedStr
,
Encrypted
::
class
.
java
)
initView
(
view
)
return
view
}
private
fun
initView
(
view
:
View
)
{
titleTv
=
view
.
findViewById
(
R
.
id
.
tv_setting_title
)
sureBtn
=
view
.
findViewById
(
R
.
id
.
btn_encrypted_set
)
questionTv1
=
view
.
findViewById
(
R
.
id
.
tv_question1
)
questionTv2
=
view
.
findViewById
(
R
.
id
.
tv_question2
)
answerEt1
=
view
.
findViewById
(
R
.
id
.
et_answer1
)
answerEt2
=
view
.
findViewById
(
R
.
id
.
et_answer2
)
titleTv
.
setText
(
R
.
string
.
edu_item_input_encryted_verfiy
)
setHintSize
(
answerEt1
,
getString
(
R
.
string
.
edu_item_input_encryted_answer1
))
setHintSize
(
answerEt2
,
getString
(
R
.
string
.
edu_item_input_encryted_answer2
))
questionTv1
.
text
=
encrypted
.
question1
questionTv2
.
text
=
encrypted
.
question2
sureBtn
.
setOnClickListener
{
btnClick
()
}
titleTv
.
setOnClickListener
{
activity
?.
finish
()
}
}
private
fun
setHintSize
(
editText
:
EditText
,
text
:
String
)
{
val
ss
=
SpannableString
(
text
)
val
ass
=
AbsoluteSizeSpan
(
15
,
true
)
ss
.
setSpan
(
ass
,
0
,
ss
.
length
,
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
)
editText
.
hint
=
SpannedString
(
ss
)
}
private
fun
btnClick
()
{
val
imm
:
InputMethodManager
=
activity
?.
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
)
as
InputMethodManager
imm
.
hideSoftInputFromWindow
(
activity
?.
window
?.
decorView
?.
windowToken
,
0
)
var
answer1
=
answerEt1
.
text
.
toString
()
var
answer2
=
answerEt2
.
text
.
toString
()
if
(
answer1
.
isEmpty
()
||
answer2
.
isEmpty
())
{
DialogUIUtils
.
showToastCenter
(
R
.
string
.
edu_item_input_answer_null
)
return
}
answer1
=
encrypt
(
answer1
)
answer2
=
encrypt
(
answer2
)
if
(
answer1
!=
encrypted
.
answer1
)
{
DialogUIUtils
.
showToastCenter
(
R
.
string
.
edu_item_input_answer1_error
)
return
}
if
(
answer2
!=
encrypted
.
answer2
)
{
DialogUIUtils
.
showToastCenter
(
R
.
string
.
edu_item_input_answer2_error
)
return
}
DialogUIUtils
.
showToastCenter
(
R
.
string
.
edu_item_input_encryted_ver_success
)
val
intent
=
Intent
(
activity
,
EncryptedActivity
::
class
.
java
)
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
)
intent
.
putExtra
(
"from"
,
EncryptedVerifyFragment
::
class
.
java
.
simpleName
)
startActivity
(
intent
)
activity
?.
finish
()
}
}
\ No newline at end of file
Launcher3/src/com/android/launcher3/function/setting/SettingAdminActivity.kt
View file @
8e1d1d33
...
...
@@ -8,11 +8,11 @@ import android.view.View
import
android.widget.GridLayout
import
com.android.launcher3.BaseActivity
import
com.android.launcher3.R
import
com.android.launcher3.function.pwd.SettingPwdActivity
import
com.android.launcher3.mdm.DisableCompat
import
com.qmuiteam.qmui.widget.grouplist.QMUICommonListItemView
import
com.qmuiteam.qmui.widget.grouplist.QMUIGroupListView
import
com.secspace.lib.common.dialog.LoadingDialog
import
com.secspace.lib.common.dialog.SwitcherDialog
import
com.secspace.lib.common.event.ChangeWallPaperEvent
import
com.secspace.lib.common.function.DialogManager
import
com.secspace.lib.common.utils.PkgManager
...
...
Launcher3/src/com/android/launcher3/settings/BlankActivity.java
View file @
8e1d1d33
...
...
@@ -6,6 +6,7 @@ import android.support.annotation.Nullable;
import
android.text.TextUtils
;
import
android.view.WindowManager
;
import
com.android.launcher3.function.pwd.EncryptedActivity
;
import
com.android.launcher3.function.pwd.PwdPinSetPwdActivity
;
import
com.secspace.lib.common.base.BaseActivity
;
import
com.secspace.lib.common.function.DialogManager
;
...
...
@@ -37,9 +38,17 @@ public class BlankActivity extends BaseActivity {
DialogManager
.
INSTANCE
.
showPrivacyPolicyDialog
(
this
);
return
;
}
String
encrypted
=
Prefs
.
getEncrypted
(
this
);
if
(
TextUtils
.
isEmpty
(
encrypted
)){
Intent
intent
=
new
Intent
(
this
,
EncryptedActivity
.
class
);
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
startActivity
(
intent
);
return
;
}
String
pwd
=
Prefs
.
getLoginPwd
(
this
);
if
(
TextUtils
.
isEmpty
(
pwd
))
{
Intent
intent
=
new
Intent
(
this
,
PwdPinSetPwdActivity
.
class
);
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
startActivity
(
intent
);
return
;
}
...
...
gradle.properties
View file @
8e1d1d33
...
...
@@ -26,8 +26,8 @@ MAVEN_URL=http://192.168.0.170:13000/nexus/content/repositories/releases/
MAVEN_URL_SNAPSHOT
=
http://192.168.0.170:13000/nexus/content/repositories/releases/
#32位有符号数2147483647(10)
versionIntCode
=
2020032
402
versionIntCode
=
2020032
601
versionNameMajor
=
1
versionNameMinor
=
1
versionNameMinor
=
2
versionNamePatch
=
0
\ No newline at end of file
lib_common/src/main/java/com/secspace/lib/common/dialog/other/AlertDialogHolder.java
View file @
8e1d1d33
...
...
@@ -36,6 +36,7 @@ import com.secspace.lib.common.R;
public
class
AlertDialogHolder
extends
SuperHolder
{
protected
TextView
tvTitle
;
public
TextView
tvMsg
;
public
TextView
tvThird
;
public
EditText
et1
;
public
EditText
et2
;
protected
View
line
;
...
...
@@ -58,23 +59,24 @@ public class AlertDialogHolder extends SuperHolder {
@Override
protected
void
findViews
()
{
tvTitle
=
(
TextView
)
rootView
.
findViewById
(
R
.
id
.
dialogui_tv_title
);
tvMsg
=
(
TextView
)
rootView
.
findViewById
(
R
.
id
.
dialogui_tv_msg
);
et1
=
(
EditText
)
rootView
.
findViewById
(
R
.
id
.
et_1
);
et2
=
(
EditText
)
rootView
.
findViewById
(
R
.
id
.
et_2
);
line
=
(
View
)
rootView
.
findViewById
(
R
.
id
.
line
);
btn1
=
(
Button
)
rootView
.
findViewById
(
R
.
id
.
btn_1
);
lineBtn2
=
(
View
)
rootView
.
findViewById
(
R
.
id
.
line_btn2
);
btn2
=
(
Button
)
rootView
.
findViewById
(
R
.
id
.
btn_2
);
lineBtn3
=
(
View
)
rootView
.
findViewById
(
R
.
id
.
line_btn3
);
btn3
=
(
Button
)
rootView
.
findViewById
(
R
.
id
.
btn_3
);
llContainerHorizontal
=
(
LinearLayout
)
rootView
.
findViewById
(
R
.
id
.
ll_container_horizontal
);
btn1Vertical
=
(
Button
)
rootView
.
findViewById
(
R
.
id
.
btn_1_vertical
);
lineBtn2Vertical
=
(
View
)
rootView
.
findViewById
(
R
.
id
.
line_btn2_vertical
);
btn2Vertical
=
(
Button
)
rootView
.
findViewById
(
R
.
id
.
btn_2_vertical
);
lineBtn3Vertical
=
(
View
)
rootView
.
findViewById
(
R
.
id
.
line_btn3_vertical
);
btn3Vertical
=
(
Button
)
rootView
.
findViewById
(
R
.
id
.
btn_3_vertical
);
llContainerVertical
=
(
LinearLayout
)
rootView
.
findViewById
(
R
.
id
.
ll_container_vertical
);
tvTitle
=
rootView
.
findViewById
(
R
.
id
.
dialogui_tv_title
);
tvMsg
=
rootView
.
findViewById
(
R
.
id
.
dialogui_tv_msg
);
et1
=
rootView
.
findViewById
(
R
.
id
.
et_1
);
et2
=
rootView
.
findViewById
(
R
.
id
.
et_2
);
line
=
rootView
.
findViewById
(
R
.
id
.
line
);
btn1
=
rootView
.
findViewById
(
R
.
id
.
btn_1
);
lineBtn2
=
rootView
.
findViewById
(
R
.
id
.
line_btn2
);
btn2
=
rootView
.
findViewById
(
R
.
id
.
btn_2
);
lineBtn3
=
rootView
.
findViewById
(
R
.
id
.
line_btn3
);
btn3
=
rootView
.
findViewById
(
R
.
id
.
btn_3
);
llContainerHorizontal
=
rootView
.
findViewById
(
R
.
id
.
ll_container_horizontal
);
btn1Vertical
=
rootView
.
findViewById
(
R
.
id
.
btn_1_vertical
);
lineBtn2Vertical
=
rootView
.
findViewById
(
R
.
id
.
line_btn2_vertical
);
btn2Vertical
=
rootView
.
findViewById
(
R
.
id
.
btn_2_vertical
);
lineBtn3Vertical
=
rootView
.
findViewById
(
R
.
id
.
line_btn3_vertical
);
btn3Vertical
=
rootView
.
findViewById
(
R
.
id
.
btn_3_vertical
);
llContainerVertical
=
rootView
.
findViewById
(
R
.
id
.
ll_container_vertical
);
tvThird
=
rootView
.
findViewById
(
R
.
id
.
tv_third
);
}
...
...
@@ -93,6 +95,9 @@ public class AlertDialogHolder extends SuperHolder {
tvTitle
.
setTextColor
(
ToolUtils
.
getColor
(
tvTitle
.
getContext
(),
bean
.
titleTxtColor
));
tvTitle
.
setTextSize
(
bean
.
titleTxtSize
);
tvThird
.
setTextColor
(
ToolUtils
.
getColor
(
tvThird
.
getContext
(),
bean
.
inputTxtColor
));
tvThird
.
setTextSize
(
bean
.
thirdTxtSize
);
btn3Vertical
.
setTextSize
(
bean
.
btnTxtSize
);
btn2Vertical
.
setTextSize
(
bean
.
btnTxtSize
);
btn1Vertical
.
setTextSize
(
bean
.
btnTxtSize
);
...
...
@@ -134,6 +139,13 @@ public class AlertDialogHolder extends SuperHolder {
tvMsg
.
setTextSize
(
bean
.
msgTxtSize
);
}
if
(
TextUtils
.
isEmpty
(
bean
.
thirdTxt
))
{
tvThird
.
setVisibility
(
View
.
GONE
);
}
else
{
tvThird
.
setVisibility
(
View
.
VISIBLE
);
tvThird
.
setText
(
bean
.
thirdTxt
);
}
if
(
bean
.
isPassword
)
{
et1
.
setVisibility
(
View
.
VISIBLE
);
et2
.
setVisibility
(
View
.
GONE
);
...
...
@@ -221,7 +233,13 @@ public class AlertDialogHolder extends SuperHolder {
}
}
tvThird
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
DialogUIUtils
.
dismiss
(
bean
.
dialog
,
bean
.
alertDialog
);
bean
.
listener
.
onNeutral
();
}
});
//事件
if
(
bean
.
isVertical
)
{
btn1Vertical
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
...
...
lib_common/src/main/java/com/secspace/lib/common/dialog/other/Assignable.java
View file @
8e1d1d33
...
...
@@ -62,6 +62,8 @@ public interface Assignable {
BuildBean
assignAlertPassword
(
Context
activity
,
CharSequence
title
,
CharSequence
msg
,
CharSequence
hint1
,
CharSequence
hint2
,
CharSequence
firstTxt
,
CharSequence
secondTxt
,
boolean
isVertical
,
boolean
cancleable
,
boolean
outsideTouchable
,
final
DialogUIListener
listener
);
BuildBean
assignAlertPasswordCanVer
(
Context
activity
,
CharSequence
title
,
CharSequence
msg
,
CharSequence
thirdTxt
,
CharSequence
hint1
,
CharSequence
hint2
,
CharSequence
firstTxt
,
CharSequence
secondTxt
,
boolean
isVertical
,
boolean
cancleable
,
boolean
outsideTouchable
,
final
DialogUIListener
listener
);
/**
* 自定义弹出框
*/
...
...
lib_common/src/main/java/com/secspace/lib/common/dialog/other/BuildBean.java
View file @
8e1d1d33
...
...
@@ -57,6 +57,7 @@ public class BuildBean extends Buildable implements Styleable {
public
CharSequence
text1
=
DialogConfig
.
dialogui_btnTxt1
;
public
CharSequence
text2
=
DialogConfig
.
dialogui_btnTxt2
;
public
CharSequence
text3
;
public
CharSequence
thirdTxt
;
public
CharSequence
bottomTxt
=
DialogConfig
.
dialogui_bottomTxt
;
public
CharSequence
hint1
;
...
...
@@ -113,10 +114,11 @@ public class BuildBean extends Buildable implements Styleable {
//字体大小
public
int
btnTxtSize
=
17
;
// in sp
public
int
titleTxtSize
=
1
4
;
public
int
titleTxtSize
=
1
7
;
public
int
msgTxtSize
=
14
;
public
int
itemTxtSize
=
14
;
public
int
inputTxtSize
=
14
;
public
int
thirdTxtSize
=
14
;
@SuppressLint
(
"ResourceType"
)
...
...
lib_common/src/main/java/com/secspace/lib/common/dialog/other/DialogAssigner.java
View file @
8e1d1d33
...
...
@@ -25,7 +25,7 @@ public class DialogAssigner implements Assignable {
@Override
public
BuildBean
assignLoading
(
Context
context
,
CharSequence
msg
,
boolean
isVertical
,
boolean
cancleable
,
boolean
outsideTouchable
,
boolean
isWhiteBg
)
{
public
BuildBean
assignLoading
(
Context
context
,
CharSequence
msg
,
boolean
isVertical
,
boolean
cancleable
,
boolean
outsideTouchable
,
boolean
isWhiteBg
)
{
BuildBean
bean
=
new
BuildBean
();
bean
.
mContext
=
context
;
bean
.
msg
=
msg
;
...
...
@@ -39,7 +39,7 @@ public class DialogAssigner implements Assignable {
}
@Override
public
BuildBean
assignMdLoading
(
Context
context
,
CharSequence
msg
,
boolean
isVertical
,
boolean
cancleable
,
boolean
outsideTouchable
,
boolean
isWhiteBg
)
{
public
BuildBean
assignMdLoading
(
Context
context
,
CharSequence
msg
,
boolean
isVertical
,
boolean
cancleable
,
boolean
outsideTouchable
,
boolean
isWhiteBg
)
{
BuildBean
bean
=
new
BuildBean
();
bean
.
mContext
=
context
;
bean
.
msg
=
msg
;
...
...
@@ -108,7 +108,27 @@ public class DialogAssigner implements Assignable {
@Override
public
BuildBean
assignAlertPassword
(
Context
activity
,
CharSequence
title
,
CharSequence
msg
,
CharSequence
hint1
,
CharSequence
hint2
,
CharSequence
firstTxt
,
CharSequence
secondTxt
,
boolean
isVertical
,
boolean
cancleable
,
boolean
outsideTouchable
,
DialogUIListener
listener
)
{
CharSequence
firstTxt
,
CharSequence
secondTxt
,
boolean
isVertical
,
boolean
cancleable
,
boolean
outsideTouchable
,
DialogUIListener
listener
)
{
BuildBean
bean
=
new
BuildBean
();
bean
.
mContext
=
activity
;
bean
.
msg
=
msg
;
bean
.
title
=
title
;
bean
.
hint1
=
hint1
;
bean
.
hint2
=
hint2
;
bean
.
text1
=
firstTxt
;
bean
.
text2
=
secondTxt
;
bean
.
isVertical
=
isVertical
;
bean
.
gravity
=
Gravity
.
CENTER
;
bean
.
cancelable
=
cancleable
;
bean
.
outsideTouchable
=
outsideTouchable
;
bean
.
listener
=
listener
;
bean
.
type
=
DialogConfig
.
TYPE_ALERT
;
bean
.
isPassword
=
true
;
return
bean
;
}
@Override
public
BuildBean
assignAlertPasswordCanVer
(
Context
activity
,
CharSequence
title
,
CharSequence
msg
,
CharSequence
thirdTxt
,
CharSequence
hint1
,
CharSequence
hint2
,
CharSequence
firstTxt
,
CharSequence
secondTxt
,
boolean
isVertical
,
boolean
cancleable
,
boolean
outsideTouchable
,
DialogUIListener
listener
)
{
BuildBean
bean
=
new
BuildBean
();
bean
.
mContext
=
activity
;
bean
.
msg
=
msg
;
...
...
@@ -124,6 +144,7 @@ public class DialogAssigner implements Assignable {
bean
.
listener
=
listener
;
bean
.
type
=
DialogConfig
.
TYPE_ALERT
;
bean
.
isPassword
=
true
;
bean
.
thirdTxt
=
thirdTxt
;
return
bean
;
}
...
...
lib_common/src/main/java/com/secspace/lib/common/dialog/other/DialogConfig.java
View file @
8e1d1d33
...
...
@@ -27,7 +27,7 @@ import com.secspace.lib.common.R;
public
class
DialogConfig
{
@ColorRes
public
static
int
iosBtnColor
=
R
.
color
.
ios_btntext_blue
;
public
static
int
iosBtnColor
=
R
.
color
.
text_title_11
;
@ColorRes
public
static
int
lvItemTxtColor
=
R
.
color
.
text_item_33
;
@ColorRes
...
...
lib_common/src/main/java/com/secspace/lib/common/dialog/other/DialogUIUtils.java
View file @
8e1d1d33
...
...
@@ -221,10 +221,14 @@ public class DialogUIUtils {
}
public
static
BuildBean
showAlertPassword
(
Activity
activity
,
CharSequence
title
,
CharSequence
msg
,
CharSequence
hint1
,
CharSequence
hint2
,
CharSequence
firstTxt
,
CharSequence
secondTxt
,
boolean
isVertical
,
boolean
cancleable
,
boolean
outsideTouchable
,
DialogUIListener
listener
)
{
return
DialogAssigner
.
getInstance
().
assignAlertPassword
(
activity
,
title
,
msg
,
hint1
,
hint2
,
firstTxt
,
secondTxt
,
isVertical
,
cancleable
,
outsideTouchable
,
listener
);
CharSequence
sure
,
CharSequence
cancel
,
boolean
isVertical
,
boolean
cancleable
,
boolean
outsideTouchable
,
DialogUIListener
listener
)
{
return
DialogAssigner
.
getInstance
().
assignAlertPassword
(
activity
,
title
,
msg
,
hint1
,
hint2
,
sure
,
cancel
,
isVertical
,
cancleable
,
outsideTouchable
,
listener
);
}
public
static
BuildBean
showAlertPasswordCanVer
(
Activity
activity
,
CharSequence
title
,
CharSequence
msg
,
CharSequence
thirdTx
,
CharSequence
hint1
,
CharSequence
hint2
,
CharSequence
sure
,
CharSequence
cancel
,
boolean
isVertical
,
boolean
cancleable
,
boolean
outsideTouchable
,
DialogUIListener
listener
)
{
return
DialogAssigner
.
getInstance
().
assignAlertPasswordCanVer
(
activity
,
title
,
msg
,
thirdTx
,
hint1
,
hint2
,
sure
,
cancel
,
isVertical
,
cancleable
,
outsideTouchable
,
listener
);
}
/**
* 短时间中下位置显示。线程安全,可以在非UI线程调用。
*/
...
...
lib_common/src/main/java/com/secspace/lib/common/function/DialogManager.kt
View file @
8e1d1d33
...
...
@@ -21,7 +21,7 @@ import org.greenrobot.eventbus.EventBus
* Created by cyw_m on 2018/4/6.
*/
@SuppressLint
(
"StaticFieldLeak"
)
object
DialogManager
{
object
DialogManager
{
private
var
mSimpleDialog
:
SimpleDialog
?
=
null
/**
* 安装中间件弹窗
...
...
@@ -80,8 +80,26 @@ object DialogManager{
}).
show
()
}
fun
showPwdDialog
(
activity
:
Activity
?,
title
:
String
?,
listener
:
PwdListener
)
{
val
buildBean
=
DialogUIUtils
.
showAlertPassword
(
activity
,
title
,
""
,
""
,
""
,
"确定"
,
"取消"
,
false
,
false
,
false
,
object
:
DialogUIListener
()
{
fun
showPwdDialog
(
activity
:
Activity
?,
title
:
String
?,
listener
:
PwdCanVerListener
)
{
val
buildBean
=
DialogUIUtils
.
showAlertPasswordCanVer
(
activity
,
title
,
""
,
"忘记密码"
,
""
,
""
,
"确定"
,
"取消"
,
false
,
false
,
false
,
object
:
DialogUIListener
()
{
override
fun
onPositive
(
view
:
View
)
{
listener
.
onPositive
(
view
)
}
override
fun
onPositive
()
{}
override
fun
onNegative
()
{
listener
.
onNegative
()
}
override
fun
onNeutral
()
{
listener
.
onNeutral
()
}
})
buildBean
.
show
()
}
fun
showEncryptedVerDialog
(
activity
:
Activity
?,
title
:
String
?,
question
:
String
?,
listener
:
PwdListener
)
{
val
buildBean
=
DialogUIUtils
.
showAlert
(
activity
,
title
,
question
,
"答案"
,
""
,
"确定"
,
"切换问题"
,
false
,
false
,
false
,
object
:
DialogUIListener
()
{
override
fun
onPositive
(
view
:
View
)
{
listener
.
onPositive
(
view
)
}
...
...
@@ -103,4 +121,10 @@ object DialogManager{
fun
onPositive
(
view
:
View
?)
fun
onNegative
()
}
interface
PwdCanVerListener
{
fun
onPositive
(
view
:
View
?)
fun
onNegative
()
fun
onNeutral
()
}
}
\ No newline at end of file
lib_common/src/main/java/com/secspace/lib/common/function/WorkManager.kt
View file @
8e1d1d33
...
...
@@ -10,6 +10,10 @@ import android.os.SystemClock
import
com.secspace.lib.common.R
import
com.secspace.lib.common.dialog.LoadingDialog
import
com.secspace.lib.common.env.SEnvironment
import
com.secspace.lib.common.function.ActivationHelper.ActivationListener
import
com.secspace.lib.common.function.ActivationHelper.active
import
com.secspace.lib.common.function.DialogManager.MessageListener
import
com.secspace.lib.common.function.DialogManager.showActivateLoseDialog
import
com.secspace.lib.common.utils.*
import
com.secspace.log.Log
import
com.secspace.mdmengine.api.manager.MdmFactoryManager
...
...
@@ -56,13 +60,31 @@ object WorkManager {
LoadingDialog
.
getInstance
(
launcher
).
show
(
"切换中"
)
GlobalScope
.
launch
(
Dispatchers
.
IO
)
{
SwitchInMdm
.
onInit
(
launcher
)
checkLocalUpdateFile
()
//检查本地更新文件
activate
(
launcher
)
// checkLocalUpdateFile() //检查本地更新文件
ActivationHelper
.
checkActivate
(
launcher
,
EduCheckActiveStatusListener
(
launcher
))
}
isChecksCompleted
=
true
Prefs
.
setMdmInitializedWhenEnter
(
mContext
,
true
)
}
fun
activate
(
activity
:
Activity
)
{
active
(
activity
,
object
:
ActivationListener
{
override
fun
activationFailed
()
{
showActivateLoseDialog
(
activity
,
activity
.
getString
(
R
.
string
.
common_remind
)
,
activity
.
getString
(
R
.
string
.
dialog_tip_activate_lose
),
object
:
MessageListener
{
override
fun
onPositive
()
{
IntentUtil
.
startExitService
(
activity
)
}
override
fun
onNegative
()
{}
})
}
override
fun
activated
()
{}
},
false
)
}
fun
exit
(
context
:
Context
?)
{
GlobalScope
.
launch
(
Dispatchers
.
IO
)
{
context
?.
let
{
SwitchOutMdm
.
onExit
(
it
)
}
...
...
@@ -140,7 +162,7 @@ object WorkManager {
install
(
path
)
}
fun
removeForbidden
(
context
:
Context
){
fun
removeForbidden
(
context
:
Context
)
{
Prefs
.
setMdmInitializedWhenEnter
(
context
,
false
)
GlobalScope
.
launch
(
Dispatchers
.
IO
)
{
SwitchOutMdm
.
onExit
(
context
)
...
...
lib_common/src/main/java/com/secspace/lib/common/function/model/Encrypted.kt
0 → 100644
View file @
8e1d1d33
package
com.secspace.lib.common.function.model
data class
Encrypted
(
var
question1
:
String
,
var
answer1
:
String
,
var
question2
:
String
,
var
answer2
:
String
)
\ No newline at end of file
lib_common/src/main/java/com/secspace/lib/common/utils/JsonUtil.java
View file @
8e1d1d33
...
...
@@ -6,6 +6,8 @@ import android.util.ArrayMap;
import
com.google.gson.Gson
;
import
com.google.gson.reflect.TypeToken
;
import
java.lang.reflect.ParameterizedType
;
import
java.lang.reflect.Type
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -45,4 +47,22 @@ public class JsonUtil {
return
gson
.
fromJson
(
json
,
new
TypeToken
<
ArrayMap
>()
{
}.
getType
());
}
// public static <T>T json2Class(String json) {
// if (TextUtils.isEmpty(json)) {
// return null;
// }
// Gson gson = new Gson();
// Type type = ((ParameterizedType) T.class.getGenericSuperclass()).getActualTypeArguments()[0];
// return gson.fromJson(json, new TypeToken<T>() {
// }.getType());
// }
public
static
<
T
>
T
fromJson
(
String
result
,
Class
<
T
>
classOfT
)
{
if
(
result
==
null
)
{
return
null
;
}
Gson
gson
=
new
Gson
();
return
gson
.
fromJson
(
result
,
classOfT
);
}
}
lib_common/src/main/java/com/secspace/lib/common/utils/Prefs.java
View file @
8e1d1d33
...
...
@@ -16,14 +16,14 @@ public class Prefs {
public
static
final
String
SHOW_SYSTEM_APP_PKGS
=
"show_system_app_pkgs"
;
public
static
final
String
SHOW_USER_APP_PKGS
=
"show_user_app_pkgs"
;
public
static
final
String
AUTO_START_SELF
=
"auto_start_self"
;
public
static
final
String
IN_SPACE
=
"in_space"
;
public
static
final
String
ALLOW_NEW_APP
=
"allow_new_app"
;
public
static
final
String
WIFI_WHITE_LIST
=
"wifi_white_list"
;
public
static
final
String
IS_FIRST_INIT
=
"is_first_init"
;
public
static
final
String
LOGIN_PWD
=
"login_pwd"
;
public
static
final
String
PWD_PROTECTION_ANSWER_1
=
"pwd_protection_answer_1"
;
public
static
final
String
PWD_PROTECTION_ANSWER_2
=
"pwd_protection_answer_2"
;
public
static
final
String
AUTO_START_SELF
=
"auto_start_self"
;
public
static
final
String
IN_SPACE
=
"in_space"
;
public
static
final
String
ALLOW_NEW_APP
=
"allow_new_app"
;
public
static
final
String
WIFI_WHITE_LIST
=
"wifi_white_list"
;
public
static
final
String
IS_FIRST_INIT
=
"is_first_init"
;
public
static
final
String
LOGIN_PWD
=
"login_pwd"
;
public
static
final
String
PWD_PROTECTION_ANSWER_1
=
"pwd_protection_answer_1"
;
public
static
final
String
PWD_PROTECTION_ANSWER_2
=
"pwd_protection_answer_2"
;
public
static
final
String
PWD_PROTECTION_QUESTION_1
=
"pwd_protection_question_1"
;
public
static
final
String
PWD_PROTECTION_QUESTION_2
=
"pwd_protection_question_2"
;
public
static
final
String
OPEN_SILENCE_INSTALL_TOOL
=
"open_silence_install_tool"
;
...
...
@@ -32,240 +32,264 @@ public class Prefs {
public
static
final
String
LOCK_COUNT
=
"lock_count"
;
public
static
final
String
COVER_SECOND_INSTALL
=
"cover_second_install"
;
public
static
final
String
SP_PRIVACYPOLICYSTATE
=
"privacyPolicyState"
;
public
static
final
String
ENCRYPTED
=
"encrypted"
;
public
static
void
setCoverSecondInstall
(
Context
context
,
boolean
isCoverInstall
)
{
putBoolean
(
context
,
COVER_SECOND_INSTALL
,
isCoverInstall
);
public
static
void
setCoverSecondInstall
(
Context
context
,
boolean
isCoverInstall
)
{
putBoolean
(
context
,
COVER_SECOND_INSTALL
,
isCoverInstall
);
}
public
static
boolean
isCoverSecondInstall
(
Context
context
){
return
getBoolean
(
context
,
COVER_SECOND_INSTALL
,
true
);
public
static
boolean
isCoverSecondInstall
(
Context
context
)
{
return
getBoolean
(
context
,
COVER_SECOND_INSTALL
,
true
);
}
public
static
void
setLockCount
(
Context
context
,
int
count
)
{
putInt
(
context
,
LOCK_COUNT
,
count
);
public
static
void
setLockCount
(
Context
context
,
int
count
)
{
putInt
(
context
,
LOCK_COUNT
,
count
);
}
public
static
int
getLockCount
(
Context
context
){
return
getInt
(
context
,
LOCK_COUNT
,
0
);
public
static
int
getLockCount
(
Context
context
)
{
return
getInt
(
context
,
LOCK_COUNT
,
0
);
}
public
static
void
setLockTime
(
Context
context
,
long
time
)
{
putLong
(
context
,
LOCK_TIME
,
time
);
public
static
void
setLockTime
(
Context
context
,
long
time
)
{
putLong
(
context
,
LOCK_TIME
,
time
);
}
public
static
long
getLockTime
(
Context
context
){
return
getLong
(
context
,
LOCK_TIME
,
0L
);
public
static
long
getLockTime
(
Context
context
)
{
return
getLong
(
context
,
LOCK_TIME
,
0L
);
}
/**
* 设置imei是否可用
*
* @param context
* @param imeiCanUse
*/
public
static
void
setImeiCanUse
(
Context
context
,
boolean
imeiCanUse
)
{
putBoolean
(
context
,
IMEI_CAN_USE
,
imeiCanUse
);
public
static
void
setImeiCanUse
(
Context
context
,
boolean
imeiCanUse
)
{
putBoolean
(
context
,
IMEI_CAN_USE
,
imeiCanUse
);
}
/**
* 获取imei是否可用
*
* @param context
* @return
*/
public
static
boolean
isImeiCanUse
(
Context
context
){
return
getBoolean
(
context
,
IMEI_CAN_USE
,
false
);
public
static
boolean
isImeiCanUse
(
Context
context
)
{
return
getBoolean
(
context
,
IMEI_CAN_USE
,
false
);
}
/**
* 设置是否打开静默安装卸载工具
*
* @param context
* @param isOpen
*/
public
static
void
setOpenSilenceInstallTool
(
Context
context
,
boolean
isOpen
)
{
putBoolean
(
context
,
OPEN_SILENCE_INSTALL_TOOL
,
isOpen
);
public
static
void
setOpenSilenceInstallTool
(
Context
context
,
boolean
isOpen
)
{
putBoolean
(
context
,
OPEN_SILENCE_INSTALL_TOOL
,
isOpen
);
}
/**
* 获取是否打开静默安装卸载工具
*
* @param context
* @return
*/
public
static
boolean
isOpenSilenceInstallTool
(
Context
context
){
return
getBoolean
(
context
,
OPEN_SILENCE_INSTALL_TOOL
,
false
);
public
static
boolean
isOpenSilenceInstallTool
(
Context
context
)
{
return
getBoolean
(
context
,
OPEN_SILENCE_INSTALL_TOOL
,
false
);
}
/**
* 设置密保一问题
*
* @param context
* @param question1
*/
public
static
void
setPwdProtectionQuestion1
(
Context
context
,
String
question1
)
{
putString
(
context
,
PWD_PROTECTION_QUESTION_1
,
question1
);
public
static
void
setPwdProtectionQuestion1
(
Context
context
,
String
question1
)
{
putString
(
context
,
PWD_PROTECTION_QUESTION_1
,
question1
);
}
/**
* 获取密保1问题
*
* @param context
* @return
*/
public
static
String
getPwdProtectionQuestion1
(
Context
context
){
return
getString
(
context
,
PWD_PROTECTION_QUESTION_1
,
"厂商提供的初始演示激活码是多少?"
);
public
static
String
getPwdProtectionQuestion1
(
Context
context
)
{
return
getString
(
context
,
PWD_PROTECTION_QUESTION_1
,
"厂商提供的初始演示激活码是多少?"
);
}
/**
* 设置密保2问题
*
* @param context
* @param question2
*/
public
static
void
setPwdProtectionQuestion2
(
Context
context
,
String
question2
)
{
putString
(
context
,
PWD_PROTECTION_QUESTION_2
,
question2
);
public
static
void
setPwdProtectionQuestion2
(
Context
context
,
String
question2
)
{
putString
(
context
,
PWD_PROTECTION_QUESTION_2
,
question2
);
}
/**
* 获取密保2问题
*
* @param context
* @return
*/
public
static
String
getPwdProtectionQuestion2
(
Context
context
){
return
getString
(
context
,
PWD_PROTECTION_QUESTION_2
,
"厂商所处城区是在哪里?"
);
public
static
String
getPwdProtectionQuestion2
(
Context
context
)
{
return
getString
(
context
,
PWD_PROTECTION_QUESTION_2
,
"厂商所处城区是在哪里?"
);
}
/**
* 设置密保一答案
*
* @param context
* @param answer1
*/
public
static
void
setPwdProtectionAnswer1
(
Context
context
,
String
answer1
)
{
putString
(
context
,
PWD_PROTECTION_ANSWER_1
,
answer1
);
public
static
void
setPwdProtectionAnswer1
(
Context
context
,
String
answer1
)
{
putString
(
context
,
PWD_PROTECTION_ANSWER_1
,
answer1
);
}
/**
* 获取密保1答案
*
* @param context
* @return
*/
public
static
String
getPwdProtectionAnswer1
(
Context
context
){
return
getString
(
context
,
PWD_PROTECTION_ANSWER_1
,
"1908129SH9"
);
public
static
String
getPwdProtectionAnswer1
(
Context
context
)
{
return
getString
(
context
,
PWD_PROTECTION_ANSWER_1
,
"1908129SH9"
);
}
/**
* 获取密保2答案
*
* @param context
* @return
*/
public
static
String
getPwdProtectionAnswer2
(
Context
context
){
return
getString
(
context
,
PWD_PROTECTION_ANSWER_2
,
"天津市南开区"
);
public
static
String
getPwdProtectionAnswer2
(
Context
context
)
{
return
getString
(
context
,
PWD_PROTECTION_ANSWER_2
,
"天津市南开区"
);
}
/**
* 设置密保一答案
*
* @param context
* @param answer2
*/
public
static
void
setPwdProtectionAnswer2
(
Context
context
,
String
answer2
)
{
putString
(
context
,
PWD_PROTECTION_ANSWER_2
,
answer2
);
public
static
void
setPwdProtectionAnswer2
(
Context
context
,
String
answer2
)
{
putString
(
context
,
PWD_PROTECTION_ANSWER_2
,
answer2
);
}
/**
* 获取密码
*
* @param context
*/
public
static
String
getLoginPwd
(
Context
context
)
{
return
getString
(
context
,
LOGIN_PWD
,
""
);
public
static
String
getLoginPwd
(
Context
context
)
{
return
getString
(
context
,
LOGIN_PWD
,
""
);
}
/**
* 设置密码
*
* @param context
* @param pwd
*/
public
static
void
setLoginPwd
(
Context
context
,
String
pwd
)
{
putString
(
context
,
LOGIN_PWD
,
pwd
);
public
static
void
setLoginPwd
(
Context
context
,
String
pwd
)
{
putString
(
context
,
LOGIN_PWD
,
pwd
);
}
/**
* 设置是否首次进入
*
* @param context
* @param isFirstInit
*/
public
static
void
setIsFirstInit
(
Context
context
,
boolean
isFirstInit
)
{
putBoolean
(
context
,
IS_FIRST_INIT
,
isFirstInit
);
public
static
void
setIsFirstInit
(
Context
context
,
boolean
isFirstInit
)
{
putBoolean
(
context
,
IS_FIRST_INIT
,
isFirstInit
);
}
/**
*获取是否首次进入
* 获取是否首次进入
*
* @param context
*/
public
static
boolean
isFirstInit
(
Context
context
)
{
return
getBoolean
(
context
,
IS_FIRST_INIT
,
true
);
public
static
boolean
isFirstInit
(
Context
context
)
{
return
getBoolean
(
context
,
IS_FIRST_INIT
,
true
);
}
/**
* 设置wifi白名单列表
*
* @param context
* @param stringList
*/
public
static
void
setWifiWhiteList
(
Context
context
,
String
stringList
)
{
putString
(
context
,
WIFI_WHITE_LIST
,
stringList
);
public
static
void
setWifiWhiteList
(
Context
context
,
String
stringList
)
{
putString
(
context
,
WIFI_WHITE_LIST
,
stringList
);
}
public
static
String
getWifiWhiteList
(
Context
context
){
return
getString
(
context
,
WIFI_WHITE_LIST
,
""
);
public
static
String
getWifiWhiteList
(
Context
context
)
{
return
getString
(
context
,
WIFI_WHITE_LIST
,
""
);
}
/**
* 获取是否允许本身是否自启
*
* @param context
* @return
*/
public
static
boolean
isAutoStartSelf
(
Context
context
){
return
getBoolean
(
context
,
AUTO_START_SELF
,
true
);
public
static
boolean
isAutoStartSelf
(
Context
context
)
{
return
getBoolean
(
context
,
AUTO_START_SELF
,
true
);
}
/**
* 设置是否允许本身是否自启
*
* @param context
* @param isAutoStartSelf
*/
public
static
void
setAutoStartSelf
(
Context
context
,
boolean
isAutoStartSelf
)
{
putBoolean
(
context
,
AUTO_START_SELF
,
isAutoStartSelf
);
public
static
void
setAutoStartSelf
(
Context
context
,
boolean
isAutoStartSelf
)
{
putBoolean
(
context
,
AUTO_START_SELF
,
isAutoStartSelf
);
}
/**
* 是否允许添加新应用 默认不允许
*
* @param context
* @return
*/
public
static
boolean
isAllowNewApp
(
Context
context
){
return
getBoolean
(
context
,
ALLOW_NEW_APP
,
false
);
public
static
boolean
isAllowNewApp
(
Context
context
)
{
return
getBoolean
(
context
,
ALLOW_NEW_APP
,
false
);
}
/**
* 设置是否允许添加新应用
*
* @param context
* @param isAutoStartSelf
*/
public
static
void
setAllowNewApp
(
Context
context
,
boolean
isAutoStartSelf
)
{
putBoolean
(
context
,
ALLOW_NEW_APP
,
isAutoStartSelf
);
public
static
void
setAllowNewApp
(
Context
context
,
boolean
isAutoStartSelf
)
{
putBoolean
(
context
,
ALLOW_NEW_APP
,
isAutoStartSelf
);
}
/**
* 获取当前状态
*
* @param context
* @return
*/
public
static
boolean
isInSpace
(
Context
context
){
return
getBoolean
(
context
,
IN_SPACE
,
true
);
public
static
boolean
isInSpace
(
Context
context
)
{
return
getBoolean
(
context
,
IN_SPACE
,
true
);
}
/**
* 当前状态
*
* @param context
*/
public
static
void
setInSpace
(
Context
context
,
boolean
isInSpace
)
{
putBoolean
(
context
,
IN_SPACE
,
isInSpace
);
public
static
void
setInSpace
(
Context
context
,
boolean
isInSpace
)
{
putBoolean
(
context
,
IN_SPACE
,
isInSpace
);
}
/**
...
...
@@ -370,4 +394,12 @@ public class Prefs {
public
static
boolean
isPrivacyPolicyAccept
(
Context
ctx
)
{
return
(
boolean
)
SPUtil
.
getParam
(
ctx
,
SP_PRIVACYPOLICYSTATE
,
false
,
SP_FILE_SECSPACE_COMMON
);
}
public
static
void
setEncrypted
(
Context
ctx
,
String
encrypted
)
{
SPUtil
.
setParam
(
ctx
,
ENCRYPTED
,
encrypted
,
SP_FILE_SECSPACE_COMMON
);
}
public
static
String
getEncrypted
(
Context
ctx
)
{
return
(
String
)
SPUtil
.
getParam
(
ctx
,
ENCRYPTED
,
""
,
SP_FILE_SECSPACE_COMMON
);
}
}
lib_common/src/main/java/com/secspace/lib/common/utils/Utils.kt
0 → 100644
View file @
8e1d1d33
package
com.secspace.lib.common.utils
import
com.skr.activation.utils.DesUtil
fun
decrypt
(
strMi
:
String
):
String
{
return
DesUtil
.
decrypt
(
strMi
)
}
fun
encrypt
(
strMi
:
String
):
String
{
return
DesUtil
.
encrypt
(
strMi
)
}
\ No newline at end of file
lib_common/src/main/res/layout/dialogui_holder_alert.xml
View file @
8e1d1d33
...
...
@@ -18,8 +18,7 @@
android:paddingTop=
"12dp"
android:text=
""
android:textColor=
"@color/text_title_11"
android:textSize=
"@dimen/dialogui_title_txt_size"
android:textStyle=
"bold"
/>
android:textSize=
"@dimen/dialogui_title_txt_size"
/>
<LinearLayout
...
...
@@ -75,7 +74,21 @@
android:textCursorDrawable=
"@drawable/dialogui_shape_et_cursor"
android:textSize=
"@dimen/dialogui_input_txt_size"
/>
<TextView
android:id=
"@+id/tv_third"
android:layout_width=
"wrap_content"
android:layout_height=
"35dp"
android:layout_marginTop=
"-15dp"
android:layout_marginLeft=
"20dp"
android:layout_marginRight=
"30dp"
android:visibility=
"gone"
android:paddingLeft=
"5dp"
android:paddingRight=
"5dp"
android:text=
"忘记密码"
android:layout_gravity=
"center_vertical|right"
android:gravity=
"center"
android:textColor=
"@color/ios_btntext_blue"
android:textSize=
"@dimen/dialogui_input_txt_size"
/>
</LinearLayout>
<View
...
...
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