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
7808bffa
Commit
7808bffa
authored
Mar 21, 2020
by
Baoxy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 优化弹窗/增加激活失效提醒
parent
5c0a770c
Hide whitespace changes
Inline
Side-by-side
Showing
61 changed files
with
3200 additions
and
442 deletions
+3200
-442
Project.xml
.idea/codeStyles/Project.xml
+117
-0
build.gradle
Launcher3/build.gradle
+1
-0
App.java
Launcher3/src/com/android/launcher3/App.java
+2
-0
Launcher.java
Launcher3/src/com/android/launcher3/Launcher.java
+18
-38
ManagerAuthActivity.java
Launcher3/src/com/android/launcher3/ManagerAuthActivity.java
+32
-75
AdminSettingActivity.kt
...ndroid/launcher3/function/setting/AdminSettingActivity.kt
+12
-30
AppChooseActivity.kt
...m/android/launcher3/function/setting/AppChooseActivity.kt
+15
-12
BlankActivity.java
...er3/src/com/android/launcher3/settings/BlankActivity.java
+1
-1
LoadingDialog.java
...in/java/com/secspace/lib/common/dialog/LoadingDialog.java
+85
-0
AlertDialogHolder.java
...m/secspace/lib/common/dialog/other/AlertDialogHolder.java
+283
-0
Assignable.java
...java/com/secspace/lib/common/dialog/other/Assignable.java
+76
-0
BuildBean.java
.../java/com/secspace/lib/common/dialog/other/BuildBean.java
+255
-0
Buildable.java
.../java/com/secspace/lib/common/dialog/other/Buildable.java
+213
-0
DialogAssigner.java
.../com/secspace/lib/common/dialog/other/DialogAssigner.java
+174
-0
DialogConfig.java
...va/com/secspace/lib/common/dialog/other/DialogConfig.java
+62
-0
DialogUIItemListener.java
...ecspace/lib/common/dialog/other/DialogUIItemListener.java
+19
-0
DialogUIListener.java
...om/secspace/lib/common/dialog/other/DialogUIListener.java
+49
-0
DialogUIUtils.java
...a/com/secspace/lib/common/dialog/other/DialogUIUtils.java
+397
-0
Styleable.java
.../java/com/secspace/lib/common/dialog/other/Styleable.java
+49
-0
SuperHolder.java
...ava/com/secspace/lib/common/dialog/other/SuperHolder.java
+50
-0
ToolUtils.java
.../java/com/secspace/lib/common/dialog/other/ToolUtils.java
+243
-0
ActivationHelper.kt
...java/com/secspace/lib/common/function/ActivationHelper.kt
+6
-1
BuyCodeDialog.java
.../java/com/secspace/lib/common/function/BuyCodeDialog.java
+0
-101
BuyCodeDialog.kt
...in/java/com/secspace/lib/common/function/BuyCodeDialog.kt
+83
-0
DialogManager.java
.../java/com/secspace/lib/common/function/DialogManager.java
+0
-132
DialogManager.kt
...in/java/com/secspace/lib/common/function/DialogManager.kt
+133
-0
ExitService.kt
...main/java/com/secspace/lib/common/function/ExitService.kt
+3
-2
ISwitch.kt
...src/main/java/com/secspace/lib/common/function/ISwitch.kt
+44
-0
SwitchInMdm.kt
...main/java/com/secspace/lib/common/function/SwitchInMdm.kt
+5
-14
SwitchOutMdm.kt
...ain/java/com/secspace/lib/common/function/SwitchOutMdm.kt
+16
-22
WorkManager.kt
...main/java/com/secspace/lib/common/function/WorkManager.kt
+39
-14
dialogui_enter.xml
lib_common/src/main/res/anim/dialogui_enter.xml
+9
-0
dialogui_enter_center.xml
lib_common/src/main/res/anim/dialogui_enter_center.xml
+10
-0
dialogui_exit.xml
lib_common/src/main/res/anim/dialogui_exit.xml
+9
-0
dialogui_exit_center.xml
lib_common/src/main/res/anim/dialogui_exit_center.xml
+10
-0
dialogui_live_divider.xml
lib_common/src/main/res/drawable/dialogui_live_divider.xml
+10
-0
dialogui_rotate_mum.xml
lib_common/src/main/res/drawable/dialogui_rotate_mum.xml
+14
-0
dialogui_rotate_mum_light.xml
...ommon/src/main/res/drawable/dialogui_rotate_mum_light.xml
+14
-0
dialogui_selector_all.xml
lib_common/src/main/res/drawable/dialogui_selector_all.xml
+22
-0
dialogui_selector_all_bottom.xml
...on/src/main/res/drawable/dialogui_selector_all_bottom.xml
+25
-0
dialogui_selector_all_no.xml
...common/src/main/res/drawable/dialogui_selector_all_no.xml
+7
-0
dialogui_selector_all_top.xml
...ommon/src/main/res/drawable/dialogui_selector_all_top.xml
+24
-0
dialogui_selector_left_bottom.xml
...n/src/main/res/drawable/dialogui_selector_left_bottom.xml
+23
-0
dialogui_selector_right_bottom.xml
.../src/main/res/drawable/dialogui_selector_right_bottom.xml
+20
-0
dialogui_shape_et_bg.xml
lib_common/src/main/res/drawable/dialogui_shape_et_bg.xml
+11
-0
dialogui_shape_et_cursor.xml
...common/src/main/res/drawable/dialogui_shape_et_cursor.xml
+8
-0
dialogui_shape_gray_round_corner.xml
...rc/main/res/drawable/dialogui_shape_gray_round_corner.xml
+9
-0
dialogui_shape_gray_round_l_corner.xml
.../main/res/drawable/dialogui_shape_gray_round_l_corner.xml
+9
-0
dialogui_shape_progress.xml
lib_common/src/main/res/drawable/dialogui_shape_progress.xml
+21
-0
dialogui_shape_progress_light.xml
...n/src/main/res/drawable/dialogui_shape_progress_light.xml
+21
-0
dialogui_shape_wihte_round_corner.xml
...c/main/res/drawable/dialogui_shape_wihte_round_corner.xml
+9
-0
dialogui_spinner_mum.png
lib_common/src/main/res/drawable/dialogui_spinner_mum.png
+0
-0
dialogui_spinner_mum_light.png
...mmon/src/main/res/drawable/dialogui_spinner_mum_light.png
+0
-0
dialogui_wheel_val.xml
lib_common/src/main/res/drawable/dialogui_wheel_val.xml
+14
-0
dialog_message.xml
lib_common/src/main/res/layout/dialog_message.xml
+17
-0
dialogui_holder_alert.xml
lib_common/src/main/res/layout/dialogui_holder_alert.xml
+217
-0
dialogui_loading_horizontal.xml
...ommon/src/main/res/layout/dialogui_loading_horizontal.xml
+43
-0
dialogui_loading_vertical.xml
lib_common/src/main/res/layout/dialogui_loading_vertical.xml
+44
-0
dialogui_toast.xml
lib_common/src/main/res/layout/dialogui_toast.xml
+24
-0
strings.xml
lib_common/src/main/res/values/strings.xml
+1
-0
values.xml
lib_common/src/main/res/values/values.xml
+73
-0
No files found.
.idea/codeStyles/Project.xml
0 → 100644
View file @
7808bffa
<component
name=
"ProjectCodeStyleConfiguration"
>
<code_scheme
name=
"Project"
version=
"173"
>
<codeStyleSettings
language=
"XML"
>
<indentOptions>
<option
name=
"CONTINUATION_INDENT_SIZE"
value=
"4"
/>
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>
xmlns:android
</NAME>
<XML_ATTRIBUTE
/>
<XML_NAMESPACE>
^$
</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>
xmlns:.*
</NAME>
<XML_ATTRIBUTE
/>
<XML_NAMESPACE>
^$
</XML_NAMESPACE>
</AND>
</match>
<order>
BY_NAME
</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>
.*:id
</NAME>
<XML_ATTRIBUTE
/>
<XML_NAMESPACE>
http://schemas.android.com/apk/res/android
</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>
.*:name
</NAME>
<XML_ATTRIBUTE
/>
<XML_NAMESPACE>
http://schemas.android.com/apk/res/android
</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>
name
</NAME>
<XML_ATTRIBUTE
/>
<XML_NAMESPACE>
^$
</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>
style
</NAME>
<XML_ATTRIBUTE
/>
<XML_NAMESPACE>
^$
</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>
.*
</NAME>
<XML_ATTRIBUTE
/>
<XML_NAMESPACE>
^$
</XML_NAMESPACE>
</AND>
</match>
<order>
BY_NAME
</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>
.*
</NAME>
<XML_ATTRIBUTE
/>
<XML_NAMESPACE>
http://schemas.android.com/apk/res/android
</XML_NAMESPACE>
</AND>
</match>
<order>
ANDROID_ATTRIBUTE_ORDER
</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>
.*
</NAME>
<XML_ATTRIBUTE
/>
<XML_NAMESPACE>
.*
</XML_NAMESPACE>
</AND>
</match>
<order>
BY_NAME
</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
</code_scheme>
</component>
\ No newline at end of file
Launcher3/build.gradle
View file @
7808bffa
...
...
@@ -132,6 +132,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 'com.dou361.dialogui:jjdxm-dialogui:1.0.2'
}
...
...
Launcher3/src/com/android/launcher3/App.java
View file @
7808bffa
...
...
@@ -3,6 +3,7 @@ package com.android.launcher3;
import
android.app.Application
;
import
android.content.Context
;
import
com.secspace.lib.common.dialog.other.DialogUIUtils
;
import
com.secspace.lib.common.function.ActivationHelper
;
import
com.secspace.lib.common.update.CheckUpdateCore
;
import
com.secspace.lib.common.utils.DpmHelper
;
...
...
@@ -20,5 +21,6 @@ public class App extends Application {
}
ActivationHelper
.
INSTANCE
.
init
(
mApp
);
CheckUpdateCore
.
get
().
init
(
this
);
DialogUIUtils
.
init
(
mApp
);
}
}
Launcher3/src/com/android/launcher3/Launcher.java
View file @
7808bffa
...
...
@@ -157,6 +157,7 @@ import com.secspace.lib.common.event.ChangeWallPaperEvent;
import
com.secspace.lib.common.event.InitEvent
;
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.utils.ActivityHelper
;
import
com.secspace.lib.common.utils.DeviceUtil
;
...
...
@@ -3111,45 +3112,24 @@ public class Launcher extends BaseActivity
return
false
;
}
AlertDialog
mPwdDialog
;
private
void
showPwdDialog
()
{
if
(
mPwdDialog
==
null
)
{
final
EditText
editText
=
new
EditText
(
this
);
editText
.
setInputType
(
InputType
.
TYPE_CLASS_TEXT
|
InputType
.
TYPE_TEXT_VARIATION_PASSWORD
);
View
view
=
LayoutInflater
.
from
(
this
).
inflate
(
R
.
layout
.
item_ll
,
null
);
LinearLayout
ll
=
view
.
findViewById
(
R
.
id
.
item_ll
);
ll
.
addView
(
editText
);
mPwdDialog
=
new
AlertDialog
.
Builder
(
this
)
.
setTitle
(
"请输入密码"
)
.
setCancelable
(
false
)
.
setView
(
view
)
.
setNegativeButton
(
R
.
string
.
work_cancel
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
editText
.
setText
(
""
);
dialog
.
dismiss
();
}
})
.
setPositiveButton
(
R
.
string
.
work_sure
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
InputUtil
.
closeSoftInput
(
getApplicationContext
(),
editText
);
if
(
TextUtils
.
equals
(
editText
.
getText
().
toString
(),
Prefs
.
getLoginPwd
(
mAppContext
)))
{
IntentUtil
.
startExitService
(
mAppContext
);
}
else
{
ToastUtil
.
showLong
(
mAppContext
,
"密码错误!"
);
ErrorTimeHelper
.
getInstance
(
mAppContext
).
addErrorCount
();
}
editText
.
setText
(
""
);
dialog
.
dismiss
();
}
})
.
create
();
}
if
(!
mPwdDialog
.
isShowing
())
{
mPwdDialog
.
show
();
}
DialogManager
.
INSTANCE
.
showPwdDialog
(
this
,
"请输入密码"
,
new
DialogManager
.
PwdListener
(){
@Override
public
void
onPositive
(
View
view
)
{
InputUtil
.
closeSoftInput
(
getApplicationContext
(),
view
);
if
(
TextUtils
.
equals
(((
EditText
)
view
).
getText
().
toString
(),
Prefs
.
getLoginPwd
(
mAppContext
)))
{
IntentUtil
.
startExitService
(
mAppContext
);
}
else
{
ToastUtil
.
showLong
(
mAppContext
,
"密码错误!"
);
ErrorTimeHelper
.
getInstance
(
mAppContext
).
addErrorCount
();
}
}
@Override
public
void
onNegative
()
{
}
});
}
@Override
...
...
Launcher3/src/com/android/launcher3/ManagerAuthActivity.java
View file @
7808bffa
package
com
.
android
.
launcher3
;
import
android.app.AlertDialog
;
import
android.content.Context
;
import
android.os.Bundle
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.text.InputType
;
import
android.text.TextUtils
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.widget.EditText
;
import
android.widget.LinearLayout
;
import
com.android.launcher3.function.setting.AdminSettingActivity
;
import
com.android.launcher3.settings.ErrorTimeHelper
;
import
com.secspace.lib.common.function.DialogManager
;
import
com.secspace.lib.common.utils.InputUtil
;
import
com.secspace.lib.common.utils.Prefs
;
import
com.secspace.lib.common.utils.ToastUtil
;
...
...
@@ -24,7 +19,6 @@ import com.secspace.lib.common.utils.ToastUtil;
public
class
ManagerAuthActivity
extends
BaseActivity
{
protected
Context
mAppContext
;
AlertDialog
mPwdDialog
;
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
...
...
@@ -34,72 +28,35 @@ public class ManagerAuthActivity extends BaseActivity {
}
private
void
showPwdDialog
()
{
if
(
mPwdDialog
==
null
)
{
final
EditText
editText
=
new
EditText
(
this
);
editText
.
setInputType
(
InputType
.
TYPE_CLASS_TEXT
|
InputType
.
TYPE_TEXT_VARIATION_PASSWORD
);
// TextView textView = new TextView(this);
// textView.setText("验证密保");
// textView.setTextColor(getColor(R.color.activation_black));
// textView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
// textView.setWidth(LinearLayout.LayoutParams.MATCH_PARENT);
// textView.setWidth(LinearLayout.LayoutParams.WRAP_CONTENT);
// textView.setPadding(15, 15, 15, 15);
View
view
=
LayoutInflater
.
from
(
mAppContext
).
inflate
(
R
.
layout
.
item_ll
,
null
);
LinearLayout
ll
=
view
.
findViewById
(
R
.
id
.
item_ll
);
ll
.
addView
(
editText
);
// ll.addView(textView);
// textView.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// Intent intent = new Intent(ManagerAuthActivity.this, VerifyPwdProtectionActivity.class);
// intent.putExtra(FROM_WHERE, ManagerAuthActivity.class.getSimpleName());
// startActivity(intent);
// if (mPwdDialog != null && mPwdDialog.isShowing()) {
// InputUtil.closeSoftInput(getApplicationContext(), editText);
// mPwdDialog.dismiss();
// finish();
// }
// }
// });
mPwdDialog
=
new
AlertDialog
.
Builder
(
this
)
.
setTitle
(
"请输入密码"
)
.
setCancelable
(
false
)
.
setView
(
view
)
.
setNegativeButton
(
R
.
string
.
work_cancel
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
dialog
.
dismiss
();
finish
();
}
})
.
setPositiveButton
(
R
.
string
.
work_sure
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
InputUtil
.
closeSoftInput
(
getApplicationContext
(),
editText
);
boolean
canInputPwd
=
ErrorTimeHelper
.
getInstance
(
mAppContext
).
canInputPwd
();
if
(
canInputPwd
){
if
(
TextUtils
.
equals
(
editText
.
getText
().
toString
(),
Prefs
.
getLoginPwd
(
mAppContext
)))
{
ToastUtil
.
showLong
(
mAppContext
,
"密码正确!"
);
finish
();
ErrorTimeHelper
.
getInstance
(
mAppContext
).
resetLockTimeAndCount
();
Intent
intent
=
new
Intent
();
intent
.
setClass
(
mAppContext
,
AdminSettingActivity
.
class
);
startActivity
(
intent
);
}
else
{
ToastUtil
.
showLong
(
mAppContext
,
"密码错误!"
);
ErrorTimeHelper
.
getInstance
(
mAppContext
).
addErrorCount
();
finish
();
}
}
else
{
ToastUtil
.
showShort
(
mAppContext
,
"请在"
+
ErrorTimeHelper
.
getInstance
(
mAppContext
).
getCountDownTime
()+
"秒后重试"
);
finish
();
}
}
})
.
create
();
}
if
(!
mPwdDialog
.
isShowing
())
{
mPwdDialog
.
show
();
}
DialogManager
.
INSTANCE
.
showPwdDialog
(
this
,
"请输入密码"
,
new
DialogManager
.
PwdListener
(){
@Override
public
void
onPositive
(
View
view
)
{
EditText
editText
=
(
EditText
)
view
;
InputUtil
.
closeSoftInput
(
getApplicationContext
(),
editText
);
boolean
canInputPwd
=
ErrorTimeHelper
.
getInstance
(
mAppContext
).
canInputPwd
();
if
(
canInputPwd
){
if
(
TextUtils
.
equals
(
editText
.
getText
().
toString
(),
Prefs
.
getLoginPwd
(
mAppContext
)))
{
ToastUtil
.
showLong
(
mAppContext
,
"密码正确!"
);
finish
();
ErrorTimeHelper
.
getInstance
(
mAppContext
).
resetLockTimeAndCount
();
Intent
intent
=
new
Intent
();
intent
.
setClass
(
mAppContext
,
AdminSettingActivity
.
class
);
startActivity
(
intent
);
}
else
{
ToastUtil
.
showLong
(
mAppContext
,
"密码错误!"
);
ErrorTimeHelper
.
getInstance
(
mAppContext
).
addErrorCount
();
finish
();
}
}
else
{
ToastUtil
.
showShort
(
mAppContext
,
"请在"
+
ErrorTimeHelper
.
getInstance
(
mAppContext
).
getCountDownTime
()+
"秒后重试"
);
finish
();
}
}
@Override
public
void
onNegative
()
{
}
});
}
}
Launcher3/src/com/android/launcher3/function/setting/AdminSettingActivity.kt
View file @
7808bffa
package
com.android.launcher3.function.setting
import
android.app.Activity
import
android.app.AlertDialog
import
android.content.Context
import
android.content.Intent
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.View
import
android.widget.GridLayout
import
android.widget.LinearLayout
import
android.widget.TextView
import
com.android.launcher3.BaseActivity
import
com.android.launcher3.R
import
com.android.launcher3.mdm.DisableCompat
...
...
@@ -17,6 +13,7 @@ import com.qmuiteam.qmui.widget.grouplist.QMUICommonListItemView
import
com.qmuiteam.qmui.widget.grouplist.QMUIGroupListView
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
import
com.secspace.lib.common.utils.Prefs
import
com.secspace.lib.common.utils.ToastUtil
...
...
@@ -87,8 +84,8 @@ class AdminSettingActivity : BaseActivity() {
if
(
isChecked
)
showTipDialog
({
},
{
allowApp
?.
switch
?.
isChecked
=
false
},
getString
(
R
.
string
.
open_new_app_tip
))
}
QMUIGroupListView
.
newSection
(
this
)
.
addItemView
(
icon
)
{
startActivity
(
Intent
(
mContext
,
AppChooseActivity
::
class
.
java
))
}
.
addItemView
(
reinforce
)
{
ToastUtil
.
showShort
(
mContext
,
R
.
string
.
edu_toast_wait
)
}
.
addItemView
(
icon
)
{
startActivity
(
Intent
(
mContext
,
AppChooseActivity
::
class
.
java
))
}
.
addItemView
(
reinforce
)
{
ToastUtil
.
showShort
(
mContext
,
R
.
string
.
edu_toast_wait
)
}
.
addItemView
(
allowApp
)
{}
.
addItemView
(
pwdManager
)
{
startActivity
(
Intent
(
mContext
,
SettingPwdActivity
::
class
.
java
))
}
.
addItemView
(
uninstall
)
{
showTipDialog
({
uninstall
()
},
{
},
getString
(
R
.
string
.
edu_uninstall_tip
))
}
...
...
@@ -133,30 +130,15 @@ class AdminSettingActivity : BaseActivity() {
}
private
inline
fun
showTipDialog
(
crossinline
sure
:
()
->
Unit
,
crossinline
cancel
:
()
->
Unit
,
text
:
String
)
{
val
alertDialog
:
AlertDialog
val
textView
=
TextView
(
this
)
val
view
=
LayoutInflater
.
from
(
this
).
inflate
(
R
.
layout
.
item_ll
,
null
)
textView
.
text
=
text
val
ll
=
view
.
findViewById
<
LinearLayout
>(
R
.
id
.
item_ll
)
ll
.
addView
(
textView
)
alertDialog
=
AlertDialog
.
Builder
(
this
)
.
setTitle
(
getString
(
R
.
string
.
tip
))
.
setCancelable
(
false
)
.
setView
(
view
)
.
setNegativeButton
(
R
.
string
.
work_cancel
)
{
dialog
,
_
->
dialog
.
dismiss
()
cancel
()
}
.
setPositiveButton
(
R
.
string
.
work_sure
)
{
dialog
,
_
->
run
{
dialog
.
dismiss
()
sure
()
}
}
.
create
()
if
(!
alertDialog
.
isShowing
)
{
alertDialog
.
show
()
}
DialogManager
.
showMessageDialog
(
this
,
getString
(
R
.
string
.
tip
),
text
,
object
:
DialogManager
.
MessageListener
{
override
fun
onPositive
()
{
sure
()
}
override
fun
onNegative
()
{
cancel
()
}
})
}
companion
object
{
...
...
Launcher3/src/com/android/launcher3/function/setting/AppChooseActivity.kt
View file @
7808bffa
...
...
@@ -19,21 +19,16 @@ import com.android.launcher3.settings.AppChooseListAdapter
import
com.android.launcher3.settings.AppChooseListAdapter.SYSTEM_APP_FLAG
import
com.android.launcher3.settings.AppChooseListAdapter.USER_APP_FLAG
import
com.android.launcher3.settings.AppModel
import
com.android.launcher3.settings.BaseRecyclerViewAdapter
import
com.secspace.lib.common.dialog.SwitcherDialog
import
com.secspace.lib.common.dialog.LoadingDialog
import
com.secspace.lib.common.function.SwitchInMdm
import
com.secspace.lib.common.utils.IntentUtil
import
com.secspace.lib.common.utils.Prefs
import
kotlinx.android.synthetic.main.activity_app_manager.*
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.GlobalScope
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.withContext
import
kotlinx.coroutines.*
class
AppChooseActivity
:
BaseActivity
()
{
var
mAppInfoAdapterSystemApp
:
AppChooseListAdapter
?
=
null
var
mAppInfoAdapterUserApp
:
AppChooseListAdapter
?
=
null
var
job
:
Job
?
=
null
private
val
mSystemApps
:
MutableList
<
AppModel
>
=
ArrayList
()
private
val
mUserApps
:
MutableList
<
AppModel
>
=
ArrayList
()
private
lateinit
var
mContext
:
Context
...
...
@@ -49,7 +44,7 @@ class AppChooseActivity : BaseActivity() {
fun
initView
()
{
tv_setting_title
.
setText
(
R
.
string
.
edu_item_icon
)
SwitcherDialog
.
getInstance
(
this
).
show
(
"加载应用中"
,
"Loading
"
)
LoadingDialog
.
getInstance
(
this
).
show
(
"加载中
"
)
mAppInfoAdapterSystemApp
=
AppChooseListAdapter
(
SYSTEM_APP_FLAG
)
mAppInfoAdapterSystemApp
?.
setItemViewId
(
R
.
layout
.
item_app_choose_list
)
val
linearLayoutManager
=
LinearLayoutManager
(
this
,
VERTICAL
,
false
)
...
...
@@ -67,7 +62,7 @@ class AppChooseActivity : BaseActivity() {
}
private
fun
loadData
()
{
GlobalScope
.
launch
(
Dispatchers
.
IO
)
{
job
=
GlobalScope
.
launch
(
Dispatchers
.
IO
)
{
val
resolveInfos
:
List
<
ResolveInfo
>
=
packageManager
.
queryIntentActivities
(
Intent
(
Intent
.
ACTION_MAIN
).
addCategory
(
Intent
.
CATEGORY_LAUNCHER
),
0
)
val
apps
:
MutableList
<
ApplicationInfo
>
=
ArrayList
()
resolveInfos
.
forEach
{
...
...
@@ -95,16 +90,16 @@ class AppChooseActivity : BaseActivity() {
}
}
withContext
(
Dispatchers
.
Main
)
{
SwitcherDialog
.
getInstance
(
mContext
).
dismiss
(
"Loading"
)
LoadingDialog
.
getInstance
(
mContext
).
dismiss
(
)
mAppInfoAdapterUserApp
?.
readResult
(
mAppContext
)
mAppInfoAdapterSystemApp
?.
readResult
(
mAppContext
)
mAppInfoAdapterSystemApp
?.
notifyDataSetChanged
()
mAppInfoAdapterUserApp
?.
notifyDataSetChanged
()
}
}
fun
close
(
view
:
View
?)
{
job
?.
cancel
()
finish
()
}
...
...
@@ -118,8 +113,15 @@ class AppChooseActivity : BaseActivity() {
finish
()
}
R
.
id
.
btn_cancel
->
{
job
?.
cancel
()
finish
()
}
}
}
override
fun
onBackPressed
()
{
super
.
onBackPressed
()
job
?.
cancel
()
finish
()
}
}
\ No newline at end of file
Launcher3/src/com/android/launcher3/settings/BlankActivity.java
View file @
7808bffa
...
...
@@ -23,7 +23,7 @@ public class BlankActivity extends BaseActivity {
protected
void
onResume
()
{
super
.
onResume
();
if
(!
Prefs
.
isPrivacyPolicyAccept
(
this
))
{
DialogManager
.
getInstance
()
.
showPrivacyPolicyDialog
(
this
);
DialogManager
.
INSTANCE
.
showPrivacyPolicyDialog
(
this
);
return
;
}
IntentUtil
.
startEduLauncher
(
this
);
...
...
lib_common/src/main/java/com/secspace/lib/common/dialog/LoadingDialog.java
0 → 100644
View file @
7808bffa
package
com
.
secspace
.
lib
.
common
.
dialog
;
import
android.annotation.SuppressLint
;
import
android.app.Dialog
;
import
android.content.Context
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.os.Message
;
import
com.secspace.lib.common.dialog.other.DialogUIUtils
;
import
com.secspace.log.Log
;
/**
* Created by SKR-CYW on 2017/11/22.
*/
public
class
LoadingDialog
{
private
static
final
String
TAG
=
"SwitcherDialog"
;
@SuppressLint
(
"StaticFieldLeak"
)
private
static
LoadingDialog
INST
;
public
static
LoadingDialog
getInstance
(
Context
context
)
{
if
(
INST
==
null
)
{
synchronized
(
LoadingDialog
.
class
)
{
if
(
INST
==
null
)
{
INST
=
new
LoadingDialog
(
context
.
getApplicationContext
());
}
}
}
return
INST
;
}
private
Context
mContext
;
private
Dialog
mDialog
;
private
Handler
mHandler
;
private
static
final
int
TIMEOUT
=
1
;
private
LoadingDialog
(
Context
context
)
{
mContext
=
context
.
getApplicationContext
();
mHandler
=
new
Handler
(
Looper
.
getMainLooper
(),
new
Handler
.
Callback
()
{
@Override
public
boolean
handleMessage
(
Message
msg
)
{
switch
(
msg
.
what
)
{
case
TIMEOUT:
Log
.
d
(
TAG
,
"switch dialog timeout"
);
dismiss
();
return
true
;
default
:
return
false
;
}
}
});
}
public
void
show
(
String
text
)
{
if
(
mDialog
==
null
)
{
mDialog
=
DialogUIUtils
.
showLoading
(
mContext
,
text
,
true
,
false
,
false
,
true
).
show
();
}
if
(!
mDialog
.
isShowing
())
{
try
{
mDialog
.
show
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
mHandler
.
removeMessages
(
TIMEOUT
);
mHandler
.
sendEmptyMessageDelayed
(
TIMEOUT
,
10000
);
}
public
void
dismiss
()
{
mHandler
.
removeMessages
(
TIMEOUT
);
if
(
mDialog
!=
null
&&
mDialog
.
isShowing
())
{
try
{
DialogUIUtils
.
dismiss
(
mDialog
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
if
(
mDialog
!=
null
)
{
mDialog
=
null
;
}
}
}
\ No newline at end of file
lib_common/src/main/java/com/secspace/lib/common/dialog/other/AlertDialogHolder.java
0 → 100644
View file @
7808bffa
package
com
.
secspace
.
lib
.
common
.
dialog
.
other
;
import
android.content.Context
;
import
android.text.InputType
;
import
android.text.TextUtils
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.EditText
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
com.secspace.lib.common.R
;
/**
* ========================================
* <p>
* 版 权:dou361.com 版权所有 (C) 2015
* <p>
* 作 者:陈冠明
* <p>
* 个人网站:http://www.dou361.com
* <p>
* 版 本:1.0
* <p>
* 创建日期:2016/11/22 23:05
* <p>
* 描 述:复用的一个holder,alert弹出框
* <p>
* <p>
* 修订历史:
* <p>
* ========================================
*/
public
class
AlertDialogHolder
extends
SuperHolder
{
protected
TextView
tvTitle
;
public
TextView
tvMsg
;
public
EditText
et1
;
public
EditText
et2
;
protected
View
line
;
protected
Button
btn1
;
protected
View
lineBtn2
;
protected
Button
btn2
;
protected
View
lineBtn3
;
protected
Button
btn3
;
protected
LinearLayout
llContainerHorizontal
;
protected
Button
btn1Vertical
;
protected
View
lineBtn2Vertical
;
protected
Button
btn2Vertical
;
protected
View
lineBtn3Vertical
;
protected
Button
btn3Vertical
;
protected
LinearLayout
llContainerVertical
;
public
AlertDialogHolder
(
Context
context
)
{
super
(
context
);
}
@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
);
}
@Override
protected
int
setLayoutRes
()
{
return
R
.
layout
.
dialogui_holder_alert
;
}
@Override
public
void
assingDatasAndEvents
(
Context
context
,
final
BuildBean
bean
)
{
//style
tvMsg
.
setTextColor
(
ToolUtils
.
getColor
(
tvMsg
.
getContext
(),
bean
.
msgTxtColor
));
tvMsg
.
setTextSize
(
bean
.
msgTxtSize
);
tvTitle
.
setTextColor
(
ToolUtils
.
getColor
(
tvTitle
.
getContext
(),
bean
.
titleTxtColor
));
tvTitle
.
setTextSize
(
bean
.
titleTxtSize
);
btn3Vertical
.
setTextSize
(
bean
.
btnTxtSize
);
btn2Vertical
.
setTextSize
(
bean
.
btnTxtSize
);
btn1Vertical
.
setTextSize
(
bean
.
btnTxtSize
);
btn3
.
setTextSize
(
bean
.
btnTxtSize
);
btn2
.
setTextSize
(
bean
.
btnTxtSize
);
btn1
.
setTextSize
(
bean
.
btnTxtSize
);
btn1
.
setTextColor
(
ToolUtils
.
getColor
(
btn1
.
getContext
(),
bean
.
btn1Color
));
btn2
.
setTextColor
(
ToolUtils
.
getColor
(
btn1
.
getContext
(),
bean
.
btn2Color
));
btn3
.
setTextColor
(
ToolUtils
.
getColor
(
btn1
.
getContext
(),
bean
.
btn3Color
));
btn1Vertical
.
setTextColor
(
ToolUtils
.
getColor
(
btn1
.
getContext
(),
bean
.
btn1Color
));
btn2Vertical
.
setTextColor
(
ToolUtils
.
getColor
(
btn1
.
getContext
(),
bean
.
btn2Color
));
btn3Vertical
.
setTextColor
(
ToolUtils
.
getColor
(
btn1
.
getContext
(),
bean
.
btn3Color
));
//隐藏view
if
(
bean
.
isVertical
)
{
llContainerVertical
.
setVisibility
(
View
.
VISIBLE
);
llContainerHorizontal
.
setVisibility
(
View
.
GONE
);
}
else
{
llContainerVertical
.
setVisibility
(
View
.
GONE
);
llContainerHorizontal
.
setVisibility
(
View
.
VISIBLE
);
}
if
(
TextUtils
.
isEmpty
(
bean
.
title
))
{
tvTitle
.
setVisibility
(
View
.
GONE
);
}
else
{
tvTitle
.
setVisibility
(
View
.
VISIBLE
);
tvTitle
.
setText
(
bean
.
title
);
}
if
(
TextUtils
.
isEmpty
(
bean
.
msg
))
{
tvMsg
.
setVisibility
(
View
.
GONE
);
}
else
{
tvMsg
.
setVisibility
(
View
.
VISIBLE
);
tvMsg
.
setText
(
bean
.
msg
);
tvMsg
.
setTextColor
(
ToolUtils
.
getColor
(
tvMsg
.
getContext
(),
bean
.
msgTxtColor
));
tvMsg
.
setTextSize
(
bean
.
msgTxtSize
);
}
if
(
bean
.
isPassword
)
{
et1
.
setVisibility
(
View
.
VISIBLE
);
et2
.
setVisibility
(
View
.
GONE
);
et1
.
setTextColor
(
ToolUtils
.
getColor
(
et1
.
getContext
(),
bean
.
inputTxtColor
));
et1
.
setTextSize
(
bean
.
inputTxtSize
);
et1
.
setInputType
(
InputType
.
TYPE_CLASS_TEXT
|
InputType
.
TYPE_TEXT_VARIATION_PASSWORD
);
}
else
{
if
(
TextUtils
.
isEmpty
(
bean
.
hint1
))
{
et1
.
setVisibility
(
View
.
GONE
);
}
else
{
et1
.
setVisibility
(
View
.
VISIBLE
);
et1
.
setHint
(
bean
.
hint1
);
et1
.
setTextColor
(
ToolUtils
.
getColor
(
et1
.
getContext
(),
bean
.
inputTxtColor
));
et1
.
setTextSize
(
bean
.
inputTxtSize
);
}
if
(
TextUtils
.
isEmpty
(
bean
.
hint2
))
{
et2
.
setVisibility
(
View
.
GONE
);
}
else
{
et2
.
setVisibility
(
View
.
VISIBLE
);
et2
.
setHint
(
bean
.
hint2
);
et2
.
setTextColor
(
ToolUtils
.
getColor
(
et2
.
getContext
(),
bean
.
inputTxtColor
));
et2
.
setTextSize
(
bean
.
inputTxtSize
);
}
}
//按钮数量
if
(
TextUtils
.
isEmpty
(
bean
.
text3
))
{
if
(
bean
.
isVertical
)
{
btn3Vertical
.
setVisibility
(
View
.
GONE
);
lineBtn3Vertical
.
setVisibility
(
View
.
GONE
);
btn2Vertical
.
setBackgroundResource
(
R
.
drawable
.
dialogui_selector_all_bottom
);
}
else
{
btn3
.
setVisibility
(
View
.
GONE
);
lineBtn3
.
setVisibility
(
View
.
GONE
);
btn2
.
setBackgroundResource
(
R
.
drawable
.
dialogui_selector_right_bottom
);
}
}
else
{
if
(
bean
.
isVertical
)
{
btn3Vertical
.
setVisibility
(
View
.
VISIBLE
);
lineBtn3Vertical
.
setVisibility
(
View
.
VISIBLE
);
btn3Vertical
.
setText
(
bean
.
text3
);
}
else
{
btn3
.
setVisibility
(
View
.
VISIBLE
);
lineBtn3
.
setVisibility
(
View
.
VISIBLE
);
btn3
.
setText
(
bean
.
text3
);
}
}
if
(
TextUtils
.
isEmpty
(
bean
.
text2
))
{
if
(
bean
.
isVertical
)
{
btn2Vertical
.
setVisibility
(
View
.
GONE
);
lineBtn2Vertical
.
setVisibility
(
View
.
GONE
);
btn1Vertical
.
setBackgroundResource
(
R
.
drawable
.
dialogui_selector_all_bottom
);
}
else
{
btn2
.
setVisibility
(
View
.
GONE
);
lineBtn2
.
setVisibility
(
View
.
GONE
);
btn1
.
setBackgroundResource
(
R
.
drawable
.
dialogui_selector_right_bottom
);
}
}
else
{
if
(
bean
.
isVertical
)
{
btn2Vertical
.
setVisibility
(
View
.
VISIBLE
);
lineBtn2Vertical
.
setVisibility
(
View
.
VISIBLE
);
btn2Vertical
.
setText
(
bean
.
text2
);
}
else
{
btn2
.
setVisibility
(
View
.
VISIBLE
);
lineBtn2
.
setVisibility
(
View
.
VISIBLE
);
btn2
.
setText
(
bean
.
text2
);
}
}
if
(
TextUtils
.
isEmpty
(
bean
.
text1
))
{
line
.
setVisibility
(
View
.
GONE
);
llContainerHorizontal
.
setVisibility
(
View
.
GONE
);
llContainerVertical
.
setVisibility
(
View
.
GONE
);
}
else
{
if
(
bean
.
isVertical
)
{
btn1Vertical
.
setText
(
bean
.
text1
);
}
else
{
btn1
.
setText
(
bean
.
text1
);
}
}
//事件
if
(
bean
.
isVertical
)
{
btn1Vertical
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
DialogUIUtils
.
dismiss
(
bean
.
dialog
,
bean
.
alertDialog
);
bean
.
listener
.
onPositive
(
et1
);
bean
.
listener
.
onGetInput
(
et1
.
getText
().
toString
().
trim
(),
et2
.
getText
().
toString
().
trim
());
et1
.
setText
(
""
);
}
});
btn2Vertical
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
DialogUIUtils
.
dismiss
(
bean
.
dialog
,
bean
.
alertDialog
);
bean
.
listener
.
onNegative
();
et1
.
setText
(
""
);
}
});
btn3Vertical
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
DialogUIUtils
.
dismiss
(
bean
.
dialog
,
bean
.
alertDialog
);
bean
.
listener
.
onNeutral
();
}
});
}
else
{
btn1
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
DialogUIUtils
.
dismiss
(
bean
.
dialog
,
bean
.
alertDialog
);
bean
.
listener
.
onPositive
(
et1
);
bean
.
listener
.
onGetInput
(
et1
.
getText
().
toString
().
trim
(),
et2
.
getText
().
toString
().
trim
());
et1
.
setText
(
""
);
}
});
btn2
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
DialogUIUtils
.
dismiss
(
bean
.
dialog
,
bean
.
alertDialog
);
bean
.
listener
.
onNegative
();
et1
.
setText
(
""
);
}
});
btn3
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
DialogUIUtils
.
dismiss
(
bean
.
dialog
,
bean
.
alertDialog
);
bean
.
listener
.
onNeutral
();
}
});
}
}
}
lib_common/src/main/java/com/secspace/lib/common/dialog/other/Assignable.java
0 → 100644
View file @
7808bffa
package
com
.
secspace
.
lib
.
common
.
dialog
.
other
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.view.View
;
/**
* ========================================
* <p/>
* 版 权:dou361.com 版权所有 (C) 2015
* <p/>
* 作 者:陈冠明
* <p/>
* 个人网站:http://www.dou361.com
* <p/>
* 版 本:1.0
* <p/>
* 创建日期:2016/11/1 15:08
* <p/>
* 描 述:构建弹出框样式方法
* <p/>
* <p/>
* 修订历史:
* <p/>
* ========================================
*/
public
interface
Assignable
{
/**
* 加载框
*/
BuildBean
assignLoading
(
Context
context
,
CharSequence
msg
,
boolean
isVertical
,
boolean
cancleable
,
boolean
outsideTouchable
,
boolean
isWhiteBg
);
/**
* Md加载框
*/
BuildBean
assignMdLoading
(
Context
context
,
CharSequence
msg
,
boolean
isVertical
,
boolean
cancleable
,
boolean
outsideTouchable
,
boolean
isWhiteBg
);
/**
* md风格弹出框
*/
BuildBean
assignMdAlert
(
Activity
activity
,
CharSequence
title
,
CharSequence
msg
,
boolean
cancleable
,
boolean
outsideTouchable
,
final
DialogUIListener
listener
);
/**
* md风格多选框
*/
BuildBean
assignMdMultiChoose
(
Activity
context
,
CharSequence
title
,
final
CharSequence
[]
words
,
final
boolean
[]
checkedItems
,
boolean
cancleable
,
boolean
outsideTouchable
,
final
DialogUIListener
btnListener
);
/**
* 单选框
*/
BuildBean
assignSingleChoose
(
Activity
context
,
CharSequence
title
,
final
int
defaultChosen
,
final
CharSequence
[]
words
,
boolean
cancleable
,
boolean
outsideTouchable
,
final
DialogUIItemListener
listener
);
/**
* 提示弹出框
*/
BuildBean
assignAlert
(
Context
activity
,
CharSequence
title
,
CharSequence
msg
,
CharSequence
hint1
,
CharSequence
hint2
,
CharSequence
firstTxt
,
CharSequence
secondTxt
,
boolean
isVertical
,
boolean
cancleable
,
boolean
outsideTouchable
,
final
DialogUIListener
listener
);
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
assignCustomAlert
(
Context
context
,
View
contentView
,
int
gravity
,
boolean
cancleable
,
boolean
outsideTouchable
);
/**
* 自定义底部弹出框
*/
BuildBean
assignCustomBottomAlert
(
Context
context
,
View
contentView
,
boolean
cancleable
,
boolean
outsideTouchable
);
}
lib_common/src/main/java/com/secspace/lib/common/dialog/other/BuildBean.java
0 → 100644
View file @
7808bffa
package
com
.
secspace
.
lib
.
common
.
dialog
.
other
;
import
android.annotation.SuppressLint
;
import
android.app.Dialog
;
import
android.content.Context
;
import
android.support.annotation.ColorRes
;
import
android.support.annotation.Nullable
;
import
android.support.v7.app.AlertDialog
;
import
android.view.View
;
import
java.util.Map
;
/**
* ========================================
* <p/>
* 版 权:dou361.com 版权所有 (C) 2015
* <p/>
* 作 者:陈冠明
* <p/>
* 个人网站:http://www.dou361.com
* <p/>
* 版 本:1.0
* <p/>
* 创建日期:2016/11/1 15:31
* <p/>
* 描 述:弹出框实体类
* <p/>
* <p/>
* 修订历史:
* <p/>
* ========================================
*/
public
class
BuildBean
extends
Buildable
implements
Styleable
{
/**
* 上下文
*/
public
Context
mContext
;
/**
* 构建dialog的类型
*/
public
int
type
;
public
boolean
isPassword
=
false
;
public
boolean
isVertical
;
public
View
customView
;
public
int
gravity
;
public
int
dateType
;
public
long
date
;
public
String
dateTitle
;
public
int
tag
;
public
CharSequence
title
;
public
CharSequence
msg
;
public
CharSequence
text1
=
DialogConfig
.
dialogui_btnTxt1
;
public
CharSequence
text2
=
DialogConfig
.
dialogui_btnTxt2
;
public
CharSequence
text3
;
public
CharSequence
bottomTxt
=
DialogConfig
.
dialogui_bottomTxt
;
public
CharSequence
hint1
;
public
CharSequence
hint2
;
public
DialogUIListener
listener
;
public
DialogUIItemListener
itemListener
;
/**
* 是否是白色背景
*/
public
boolean
isWhiteBg
=
true
;
/**
* 是否可以取消
*/
public
boolean
cancelable
=
true
;
/**
* 面板外是否可以点击
*/
public
boolean
outsideTouchable
=
true
;
public
Dialog
dialog
;
public
AlertDialog
alertDialog
;
public
int
viewHeight
;
//各类对话框特有的参数
public
CharSequence
[]
wordsMd
;
public
int
defaultChosen
;
//
public
boolean
[]
checkedItems
;
//三个以下按钮,颜色按此顺序
@ColorRes
public
int
btn1Color
=
DialogConfig
.
iosBtnColor
;
@ColorRes
public
int
btn2Color
=
DialogConfig
.
iosBtnColor
;
@ColorRes
public
int
btn3Color
=
DialogConfig
.
iosBtnColor
;
@ColorRes
public
int
titleTxtColor
=
DialogConfig
.
titleTxtColor
;
@ColorRes
public
int
msgTxtColor
=
DialogConfig
.
msgTxtColor
;
@ColorRes
public
int
lvItemTxtColor
=
DialogConfig
.
lvItemTxtColor
;
@ColorRes
public
int
inputTxtColor
=
DialogConfig
.
inputTxtColor
;
public
Map
<
Integer
,
Integer
>
colorOfPosition
;
//listview 的item的特殊颜色:ColorRes
//字体大小
public
int
btnTxtSize
=
17
;
// in sp
public
int
titleTxtSize
=
14
;
public
int
msgTxtSize
=
14
;
public
int
itemTxtSize
=
14
;
public
int
inputTxtSize
=
14
;
@SuppressLint
(
"ResourceType"
)
@Override
public
BuildBean
setBtnColor
(
@ColorRes
int
btn1Color
,
@ColorRes
int
btn2Color
,
@ColorRes
int
btn3Color
)
{
if
(
btn1Color
>
0
)
this
.
btn1Color
=
btn1Color
;
if
(
btn2Color
>
0
)
this
.
btn2Color
=
btn2Color
;
if
(
btn3Color
>
0
)
this
.
btn3Color
=
btn3Color
;
return
this
;
}
@SuppressLint
(
"ResourceType"
)
@Override
public
BuildBean
setListItemColor
(
@ColorRes
int
lvItemTxtColor
,
Map
<
Integer
,
Integer
>
colorOfPosition
)
{
if
(
lvItemTxtColor
>
0
)
this
.
lvItemTxtColor
=
lvItemTxtColor
;
if
(
colorOfPosition
!=
null
&&
colorOfPosition
.
size
()
>
0
)
{
this
.
colorOfPosition
=
colorOfPosition
;
}
return
this
;
}
@SuppressLint
(
"ResourceType"
)
@Override
public
BuildBean
setTitleColor
(
@ColorRes
int
colorRes
)
{
if
(
colorRes
>
0
)
{
this
.
titleTxtColor
=
colorRes
;
}
return
this
;
}
@SuppressLint
(
"ResourceType"
)
@Override
public
BuildBean
setMsgColor
(
@ColorRes
int
colorRes
)
{
if
(
colorRes
>
0
)
{
this
.
msgTxtColor
=
colorRes
;
}
return
this
;
}
@SuppressLint
(
"ResourceType"
)
@Override
public
BuildBean
seInputColor
(
@ColorRes
int
colorRes
)
{
if
(
colorRes
>
0
)
{
this
.
inputTxtColor
=
colorRes
;
}
return
this
;
}
@Override
public
BuildBean
setTitleSize
(
int
sizeInSp
)
{
if
(
sizeInSp
>
0
&&
sizeInSp
<
30
)
{
this
.
titleTxtSize
=
sizeInSp
;
}
return
this
;
}
@Override
public
BuildBean
setMsgSize
(
int
sizeInSp
)
{
if
(
sizeInSp
>
0
&&
sizeInSp
<
30
)
{
this
.
msgTxtSize
=
sizeInSp
;
}
return
this
;
}
@Override
public
BuildBean
setBtnSize
(
int
sizeInSp
)
{
if
(
sizeInSp
>
0
&&
sizeInSp
<
30
)
{
this
.
btnTxtSize
=
sizeInSp
;
}
return
this
;
}
@Override
public
BuildBean
setLvItemSize
(
int
sizeInSp
)
{
if
(
sizeInSp
>
0
&&
sizeInSp
<
30
)
{
this
.
itemTxtSize
=
sizeInSp
;
}
return
this
;
}
@Override
public
BuildBean
setInputSize
(
int
sizeInSp
)
{
if
(
sizeInSp
>
0
&&
sizeInSp
<
30
)
{
this
.
inputTxtSize
=
sizeInSp
;
}
return
this
;
}
@Override
public
Dialog
show
()
{
buildByType
(
this
);
if
(
dialog
!=
null
&&
!
dialog
.
isShowing
())
{
ToolUtils
.
showDialog
(
dialog
);
return
dialog
;
}
else
if
(
alertDialog
!=
null
&&
!
alertDialog
.
isShowing
())
{
ToolUtils
.
showDialog
(
alertDialog
);
return
alertDialog
;
}
return
null
;
}
@Override
public
BuildBean
setBtnText
(
CharSequence
btn1Text
,
@Nullable
CharSequence
btn2Text
,
@Nullable
CharSequence
btn3Text
)
{
this
.
text1
=
btn1Text
;
this
.
text2
=
btn2Text
;
this
.
text3
=
btn3Text
;
return
this
;
}
@Override
public
BuildBean
setBtnText
(
CharSequence
positiveTxt
,
@Nullable
CharSequence
negtiveText
)
{
return
setBtnText
(
positiveTxt
,
negtiveText
,
""
);
}
@Override
public
BuildBean
setListener
(
DialogUIListener
listener
)
{
if
(
listener
!=
null
)
{
this
.
listener
=
listener
;
}
return
this
;
}
@Override
public
BuildBean
setCancelable
(
boolean
cancelable
,
boolean
outsideCancelable
)
{
this
.
cancelable
=
cancelable
;
this
.
outsideTouchable
=
outsideCancelable
;
return
this
;
}
}
lib_common/src/main/java/com/secspace/lib/common/dialog/other/Buildable.java
0 → 100644
View file @
7808bffa
package
com
.
secspace
.
lib
.
common
.
dialog
.
other
;
import
android.app.Dialog
;
import
android.content.DialogInterface
;
import
android.graphics.Color
;
import
android.support.design.widget.BottomSheetDialog
;
import
android.support.v7.app.AlertDialog
;
import
android.view.View
;
import
android.view.Window
;
import
android.widget.ProgressBar
;
import
android.widget.TextView
;
import
com.secspace.lib.common.R
;
/**
* ========================================
* <p/>
* 版 权:dou361.com 版权所有 (C) 2015
* <p/>
* 作 者:陈冠明
* <p/>
* 个人网站:http://www.dou361.com
* <p/>
* 版 本:1.0
* <p/>
* 创建日期:2016/11/1 16:15
* <p/>
* 描 述:
* <p/>
* <p/>
* 修订历史:
* <p/>
* ========================================
*/
public
class
Buildable
{
protected
static
int
singleChosen
;
protected
BuildBean
buildByType
(
BuildBean
bean
)
{
ToolUtils
.
fixContext
(
bean
);
switch
(
bean
.
type
)
{
case
DialogConfig
.
TYPE_LOADING
:
buildLoading
(
bean
);
break
;
case
DialogConfig
.
TYPE_MD_LOADING
:
buildMdLoading
(
bean
);
break
;
case
DialogConfig
.
TYPE_SINGLE_CHOOSE
:
buildSingleChoose
(
bean
);
break
;
case
DialogConfig
.
TYPE_MD_MULTI_CHOOSE
:
buildMdMultiChoose
(
bean
);
break
;
case
DialogConfig
.
TYPE_ALERT
:
buildAlert
(
bean
);
break
;
case
DialogConfig
.
TYPE_CUSTOM_ALERT
:
buildCustomAlert
(
bean
);
break
;
case
DialogConfig
.
TYPE_CUSTOM_BOTTOM_ALERT
:
buildCustomBottomAlert
(
bean
);
break
;
default
:
break
;
}
ToolUtils
.
setDialogStyle
(
bean
);
ToolUtils
.
setCancelable
(
bean
);
return
bean
;
}
protected
BuildBean
buildMdLoading
(
BuildBean
bean
)
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
bean
.
mContext
);
View
root
;
if
(
bean
.
isVertical
)
{
root
=
View
.
inflate
(
bean
.
mContext
,
R
.
layout
.
dialogui_loading_vertical
,
null
);
}
else
{
root
=
View
.
inflate
(
bean
.
mContext
,
R
.
layout
.
dialogui_loading_horizontal
,
null
);
}
View
llBg
=
(
View
)
root
.
findViewById
(
R
.
id
.
dialogui_ll_bg
);
ProgressBar
pbBg
=
(
ProgressBar
)
root
.
findViewById
(
R
.
id
.
pb_bg
);
TextView
tvMsg
=
(
TextView
)
root
.
findViewById
(
R
.
id
.
dialogui_tv_msg
);
tvMsg
.
setText
(
bean
.
msg
);
if
(
bean
.
isWhiteBg
)
{
llBg
.
setBackgroundResource
(
R
.
drawable
.
dialogui_shape_wihte_round_corner
);
pbBg
.
setIndeterminateDrawable
(
bean
.
mContext
.
getResources
().
getDrawable
(
R
.
drawable
.
dialogui_rotate_mum
));
tvMsg
.
setTextColor
(
bean
.
mContext
.
getResources
().
getColor
(
R
.
color
.
text_black
));
}
else
{
llBg
.
setBackgroundResource
(
R
.
drawable
.
dialogui_shape_gray_round_corner
);
pbBg
.
setIndeterminateDrawable
(
bean
.
mContext
.
getResources
().
getDrawable
(
R
.
drawable
.
dialogui_rotate_mum_light
));
tvMsg
.
setTextColor
(
Color
.
WHITE
);
}
builder
.
setView
(
root
);
AlertDialog
dialog
=
builder
.
create
();
bean
.
alertDialog
=
dialog
;
return
bean
;
}
protected
BuildBean
buildLoading
(
BuildBean
bean
)
{
Dialog
dialog
=
new
Dialog
(
bean
.
mContext
);
dialog
.
requestWindowFeature
(
Window
.
FEATURE_NO_TITLE
);
bean
.
dialog
=
dialog
;
View
root
;
if
(
bean
.
isVertical
)
{
root
=
View
.
inflate
(
bean
.
mContext
,
R
.
layout
.
dialogui_loading_vertical
,
null
);
}
else
{
root
=
View
.
inflate
(
bean
.
mContext
,
R
.
layout
.
dialogui_loading_horizontal
,
null
);
}
View
llBg
=
(
View
)
root
.
findViewById
(
R
.
id
.
dialogui_ll_bg
);
ProgressBar
pbBg
=
(
ProgressBar
)
root
.
findViewById
(
R
.
id
.
pb_bg
);
TextView
tvMsg
=
(
TextView
)
root
.
findViewById
(
R
.
id
.
dialogui_tv_msg
);
tvMsg
.
setText
(
bean
.
msg
);
if
(
bean
.
isWhiteBg
)
{
llBg
.
setBackgroundResource
(
R
.
drawable
.
dialogui_shape_wihte_round_corner
);
pbBg
.
setIndeterminateDrawable
(
bean
.
mContext
.
getResources
().
getDrawable
(
R
.
drawable
.
dialogui_rotate_mum
));
tvMsg
.
setTextColor
(
bean
.
mContext
.
getResources
().
getColor
(
R
.
color
.
text_black
));
}
else
{
llBg
.
setBackgroundResource
(
R
.
drawable
.
dialogui_shape_gray_round_corner
);
pbBg
.
setIndeterminateDrawable
(
bean
.
mContext
.
getResources
().
getDrawable
(
R
.
drawable
.
dialogui_rotate_mum_light
));
tvMsg
.
setTextColor
(
Color
.
WHITE
);
}
bean
.
dialog
.
setContentView
(
root
);
return
bean
;
}
protected
BuildBean
buildSingleChoose
(
final
BuildBean
bean
)
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
bean
.
mContext
);
singleChosen
=
bean
.
defaultChosen
;
builder
.
setTitle
(
bean
.
title
)
.
setSingleChoiceItems
(
bean
.
wordsMd
,
bean
.
defaultChosen
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
singleChosen
=
i
;
if
(
bean
.
itemListener
!=
null
)
{
bean
.
itemListener
.
onItemClick
(
bean
.
wordsMd
[
i
],
i
);
}
if
(
bean
.
listener
==
null
)
{
DialogUIUtils
.
dismiss
(
dialogInterface
);
}
}
});
AlertDialog
dialog
=
builder
.
create
();
bean
.
alertDialog
=
dialog
;
return
bean
;
}
protected
BuildBean
buildMdMultiChoose
(
final
BuildBean
bean
)
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
bean
.
mContext
);
builder
.
setTitle
(
bean
.
title
)
.
setCancelable
(
true
)
.
setPositiveButton
(
bean
.
text1
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
if
(
bean
.
listener
!=
null
)
{
DialogUIUtils
.
dismiss
(
dialogInterface
);
bean
.
listener
.
onPositive
();
bean
.
listener
.
onGetChoose
(
bean
.
checkedItems
);
}
}
})
.
setNegativeButton
(
bean
.
text2
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
if
(
bean
.
listener
!=
null
)
{
DialogUIUtils
.
dismiss
(
dialogInterface
);
bean
.
listener
.
onNegative
();
}
}
})
.
setMultiChoiceItems
(
bean
.
wordsMd
,
bean
.
checkedItems
,
new
DialogInterface
.
OnMultiChoiceClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
,
boolean
b
)
{
}
})
;
AlertDialog
dialog
=
builder
.
create
();
bean
.
alertDialog
=
dialog
;
return
bean
;
}
protected
BuildBean
buildAlert
(
BuildBean
bean
)
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
bean
.
mContext
);
AlertDialogHolder
holder
=
new
AlertDialogHolder
(
bean
.
mContext
);
builder
.
setView
(
holder
.
rootView
);
AlertDialog
dialog
=
builder
.
create
();
bean
.
alertDialog
=
dialog
;
holder
.
assingDatasAndEvents
(
bean
.
mContext
,
bean
);
return
bean
;
}
private
void
buildCustomAlert
(
BuildBean
bean
)
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
bean
.
mContext
);
builder
.
setView
(
bean
.
customView
);
AlertDialog
dialog
=
builder
.
create
();
bean
.
alertDialog
=
dialog
;
dialog
.
getWindow
().
getDecorView
().
setPadding
(
0
,
0
,
0
,
0
);
}
private
void
buildCustomBottomAlert
(
BuildBean
bean
)
{
BottomSheetDialog
dialog
=
new
BottomSheetDialog
(
bean
.
mContext
);
dialog
.
setContentView
(
bean
.
customView
);
bean
.
dialog
=
dialog
;
}
}
lib_common/src/main/java/com/secspace/lib/common/dialog/other/DialogAssigner.java
0 → 100644
View file @
7808bffa
package
com
.
secspace
.
lib
.
common
.
dialog
.
other
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.view.Gravity
;
import
android.view.View
;
/**
* Created by Administrator on 2016/10/9 0009.
*/
public
class
DialogAssigner
implements
Assignable
{
private
static
DialogAssigner
instance
;
private
DialogAssigner
()
{
}
public
static
DialogAssigner
getInstance
()
{
if
(
instance
==
null
)
{
instance
=
new
DialogAssigner
();
}
return
instance
;
}
@Override
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
;
bean
.
isVertical
=
isVertical
;
bean
.
isWhiteBg
=
isWhiteBg
;
bean
.
gravity
=
Gravity
.
CENTER
;
bean
.
cancelable
=
cancleable
;
bean
.
outsideTouchable
=
outsideTouchable
;
bean
.
type
=
DialogConfig
.
TYPE_LOADING
;
return
bean
;
}
@Override
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
;
bean
.
isVertical
=
isVertical
;
bean
.
isWhiteBg
=
isWhiteBg
;
bean
.
gravity
=
Gravity
.
CENTER
;
bean
.
cancelable
=
cancleable
;
bean
.
outsideTouchable
=
outsideTouchable
;
bean
.
type
=
DialogConfig
.
TYPE_MD_LOADING
;
return
bean
;
}
@Override
public
BuildBean
assignMdAlert
(
Activity
activity
,
CharSequence
title
,
CharSequence
msg
,
boolean
cancleable
,
boolean
outsideTouchable
,
DialogUIListener
listener
)
{
BuildBean
bean
=
new
BuildBean
();
bean
.
mContext
=
activity
;
bean
.
msg
=
msg
;
bean
.
title
=
title
;
bean
.
gravity
=
Gravity
.
CENTER
;
bean
.
cancelable
=
cancleable
;
bean
.
outsideTouchable
=
outsideTouchable
;
bean
.
listener
=
listener
;
bean
.
type
=
DialogConfig
.
TYPE_MD_ALERT
;
bean
.
btn1Color
=
DialogConfig
.
mdBtnColor
;
bean
.
btn2Color
=
DialogConfig
.
mdBtnColor
;
bean
.
btn3Color
=
DialogConfig
.
mdBtnColor
;
return
bean
;
}
@Override
public
BuildBean
assignSingleChoose
(
Activity
context
,
CharSequence
title
,
int
defaultChosen
,
CharSequence
[]
words
,
boolean
cancleable
,
boolean
outsideTouchable
,
DialogUIItemListener
listener
)
{
BuildBean
bean
=
new
BuildBean
();
bean
.
mContext
=
context
;
bean
.
title
=
title
;
bean
.
gravity
=
Gravity
.
CENTER
;
bean
.
cancelable
=
cancleable
;
bean
.
outsideTouchable
=
outsideTouchable
;
bean
.
itemListener
=
listener
;
bean
.
wordsMd
=
words
;
bean
.
type
=
DialogConfig
.
TYPE_SINGLE_CHOOSE
;
bean
.
defaultChosen
=
defaultChosen
;
bean
.
btn1Color
=
DialogConfig
.
mdBtnColor
;
bean
.
btn2Color
=
DialogConfig
.
mdBtnColor
;
bean
.
btn3Color
=
DialogConfig
.
mdBtnColor
;
return
bean
;
}
@Override
public
BuildBean
assignMdMultiChoose
(
Activity
context
,
CharSequence
title
,
CharSequence
[]
words
,
boolean
[]
checkedItems
,
boolean
cancleable
,
boolean
outsideTouchable
,
DialogUIListener
btnListener
)
{
BuildBean
bean
=
new
BuildBean
();
bean
.
mContext
=
context
;
bean
.
msg
=
title
;
bean
.
title
=
title
;
bean
.
gravity
=
Gravity
.
CENTER
;
bean
.
cancelable
=
cancleable
;
bean
.
outsideTouchable
=
outsideTouchable
;
bean
.
listener
=
btnListener
;
bean
.
wordsMd
=
words
;
bean
.
checkedItems
=
checkedItems
;
bean
.
type
=
DialogConfig
.
TYPE_MD_MULTI_CHOOSE
;
bean
.
btn1Color
=
DialogConfig
.
mdBtnColor
;
bean
.
btn2Color
=
DialogConfig
.
mdBtnColor
;
bean
.
btn3Color
=
DialogConfig
.
mdBtnColor
;
return
bean
;
}
@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
)
{
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
assignAlert
(
Context
activity
,
CharSequence
title
,
CharSequence
msg
,
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
;
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
;
return
bean
;
}
@Override
public
BuildBean
assignCustomAlert
(
Context
context
,
View
contentView
,
int
gravity
,
boolean
cancleable
,
boolean
outsideTouchable
)
{
BuildBean
bean
=
new
BuildBean
();
bean
.
mContext
=
context
;
bean
.
customView
=
contentView
;
bean
.
gravity
=
gravity
;
bean
.
cancelable
=
cancleable
;
bean
.
outsideTouchable
=
outsideTouchable
;
bean
.
type
=
DialogConfig
.
TYPE_CUSTOM_ALERT
;
return
bean
;
}
@Override
public
BuildBean
assignCustomBottomAlert
(
Context
context
,
View
contentView
,
boolean
cancleable
,
boolean
outsideTouchable
)
{
BuildBean
bean
=
new
BuildBean
();
bean
.
mContext
=
context
;
bean
.
customView
=
contentView
;
bean
.
gravity
=
Gravity
.
BOTTOM
;
bean
.
cancelable
=
cancleable
;
bean
.
outsideTouchable
=
outsideTouchable
;
bean
.
type
=
DialogConfig
.
TYPE_CUSTOM_BOTTOM_ALERT
;
return
bean
;
}
}
lib_common/src/main/java/com/secspace/lib/common/dialog/other/DialogConfig.java
0 → 100644
View file @
7808bffa
package
com
.
secspace
.
lib
.
common
.
dialog
.
other
;
import
android.support.annotation.ColorRes
;
import
com.secspace.lib.common.R
;
/**
* ========================================
* <p/>
* 版 权:dou361.com 版权所有 (C) 2015
* <p/>
* 作 者:陈冠明
* <p/>
* 个人网站:http://www.dou361.com
* <p/>
* 版 本:1.0
* <p/>
* 创建日期:2016/11/1 15:13
* <p/>
* 描 述:公共配置
* <p/>
* <p/>
* 修订历史:
* <p/>
* ========================================
*/
public
class
DialogConfig
{
@ColorRes
public
static
int
iosBtnColor
=
R
.
color
.
ios_btntext_blue
;
@ColorRes
public
static
int
lvItemTxtColor
=
R
.
color
.
text_item_33
;
@ColorRes
public
static
int
mdBtnColor
=
R
.
color
.
btn_alert
;
@ColorRes
public
static
int
titleTxtColor
=
R
.
color
.
text_title_11
;
@ColorRes
public
static
int
msgTxtColor
=
R
.
color
.
text_title_11
;
@ColorRes
public
static
int
inputTxtColor
=
R
.
color
.
text_input_44
;
public
static
CharSequence
dialogui_btnTxt1
=
"确定"
;
public
static
CharSequence
dialogui_btnTxt2
=
"取消"
;
public
static
CharSequence
dialogui_bottomTxt
=
"取消"
;
public
static
final
int
TYPE_LOADING
=
1
;
public
static
final
int
TYPE_MD_LOADING
=
2
;
public
static
final
int
TYPE_MD_ALERT
=
3
;
public
static
final
int
TYPE_MD_MULTI_CHOOSE
=
4
;
public
static
final
int
TYPE_SINGLE_CHOOSE
=
5
;
public
static
final
int
TYPE_ALERT
=
6
;
public
static
final
int
TYPE_SHEET
=
10
;
public
static
final
int
TYPE_BOTTOM_SHEET
=
14
;
public
static
final
int
TYPE_CUSTOM_ALERT
=
15
;
public
static
final
int
TYPE_CUSTOM_BOTTOM_ALERT
=
16
;
public
static
final
int
TYPE_DATEPICK
=
19
;
}
lib_common/src/main/java/com/secspace/lib/common/dialog/other/DialogUIItemListener.java
0 → 100644
View file @
7808bffa
package
com
.
secspace
.
lib
.
common
.
dialog
.
other
;
/**
* Created by Administrator on 2016/7/24.
*/
public
abstract
class
DialogUIItemListener
{
/**
* item点击事件
*/
public
abstract
void
onItemClick
(
CharSequence
text
,
int
position
);
/**
* 底部点击事件
*/
public
void
onBottomBtnClick
()
{
}
}
lib_common/src/main/java/com/secspace/lib/common/dialog/other/DialogUIListener.java
0 → 100644
View file @
7808bffa
package
com
.
secspace
.
lib
.
common
.
dialog
.
other
;
import
android.view.View
;
/**
* Created by Administrator on 2016/5/4 0004.
*/
public
abstract
class
DialogUIListener
{
/**
* 确定
*/
public
abstract
void
onPositive
();
/**
* 否定
*/
public
abstract
void
onNegative
();
public
void
onPositive
(
View
view
){
onPositive
();
}
/**
* 中立
*/
public
void
onNeutral
()
{
}
/**
* 取消
*/
public
void
onCancle
()
{
}
/**
* 获取输入内容
*/
public
void
onGetInput
(
CharSequence
input1
,
CharSequence
input2
)
{
}
/**
* 获取选择集合
*/
public
void
onGetChoose
(
boolean
[]
states
)
{
}
}
lib_common/src/main/java/com/secspace/lib/common/dialog/other/DialogUIUtils.java
0 → 100644
View file @
7808bffa
package
com
.
secspace
.
lib
.
common
.
dialog
.
other
;
import
android.app.Activity
;
import
android.app.Dialog
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.support.v7.app.AppCompatDialog
;
import
android.view.Gravity
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.widget.Toast
;
import
com.secspace.lib.common.R
;
/**
* ========================================
* <p>
* 版 权:dou361.com 版权所有 (C) 2015
* <p>
* 作 者:陈冠明
* <p>
* 个人网站:http://www.dou361.com
* <p>
* 版 本:1.0
* <p>
* 创建日期:2016/10/31 22:17
* <p>
* 描 述:一个对外UI管理容器工具类
* <p>
* <p>
* 修订历史:
* <p>
* ========================================
*/
public
class
DialogUIUtils
{
/**
* 全局上下文
*/
public
static
Context
appContext
;
/**
* 如果有使用到showTost...相关的方法使用之前需要初始化该方法
*/
public
static
void
init
(
Context
appContext
)
{
DialogUIUtils
.
appContext
=
appContext
;
}
/**
* 关闭弹出框
*/
public
static
void
dismiss
(
DialogInterface
...
dialogs
)
{
if
(
dialogs
!=
null
&&
dialogs
.
length
>
0
)
{
for
(
DialogInterface
dialog
:
dialogs
)
{
if
(
dialog
instanceof
Dialog
)
{
Dialog
dialog1
=
(
Dialog
)
dialog
;
if
(
dialog1
.
isShowing
())
{
dialog1
.
dismiss
();
}
}
else
if
(
dialog
instanceof
AppCompatDialog
)
{
AppCompatDialog
dialog2
=
(
AppCompatDialog
)
dialog
;
if
(
dialog2
.
isShowing
())
{
dialog2
.
dismiss
();
}
}
}
}
}
/**
* 关闭弹出框
*/
public
static
void
dismiss
(
BuildBean
buildBean
)
{
if
(
buildBean
!=
null
)
{
if
(
buildBean
.
dialog
!=
null
&&
buildBean
.
dialog
.
isShowing
())
{
buildBean
.
dialog
.
dismiss
();
}
if
(
buildBean
.
alertDialog
!=
null
&&
buildBean
.
alertDialog
.
isShowing
())
{
buildBean
.
alertDialog
.
dismiss
();
}
}
}
/**
* 关闭弹出框
*/
public
static
void
dismiss
(
Dialog
dialog
)
{
if
(
dialog
!=
null
&&
dialog
.
isShowing
())
{
dialog
.
dismiss
();
}
}
/**
* 加载框
*
* @param context 上下文
* @param msg 提示文本
* @param isVertical true为竖直方向false为水平方向
* @param cancleable true为可以取消false为不可取消
* @param outsideTouchable true为可以点击空白区域false为不可点击
* @param isWhiteBg true为白色背景false为灰色背景
*/
public
static
BuildBean
showLoading
(
Context
context
,
CharSequence
msg
,
boolean
isVertical
,
boolean
cancleable
,
boolean
outsideTouchable
,
boolean
isWhiteBg
)
{
return
DialogAssigner
.
getInstance
().
assignLoading
(
context
,
msg
,
isVertical
,
cancleable
,
outsideTouchable
,
isWhiteBg
);
}
/**
* md风格加载框
*
* @param context 上下文
* @param msg 提示文本
* @param isVertical true为竖直方向false为水平方向
* @param cancleable true为可以取消false为不可取消
* @param outsideTouchable true为可以点击空白区域false为不可点击
* @param isWhiteBg true为白色背景false为灰色背景
*/
public
static
BuildBean
showMdLoading
(
Context
context
,
CharSequence
msg
,
boolean
isVertical
,
boolean
cancleable
,
boolean
outsideTouchable
,
boolean
isWhiteBg
)
{
return
DialogAssigner
.
getInstance
().
assignMdLoading
(
context
,
msg
,
isVertical
,
cancleable
,
outsideTouchable
,
isWhiteBg
);
}
/***
* md风格弹出框 默认可取消可点击
*
* @param activity 所在activity
* @param title 标题 不传则无标题
* @param msg 消息
* @param listener 事件监听
* @return
*/
public
static
BuildBean
showMdAlert
(
Activity
activity
,
CharSequence
title
,
CharSequence
msg
,
DialogUIListener
listener
)
{
return
showMdAlert
(
activity
,
title
,
msg
,
true
,
true
,
listener
);
}
/***
* md风格弹出框
*
* @param activity 所在activity
* @param title 标题 不传则无标题
* @param msg 消息
* @param cancleable true为可以取消false为不可取消
* @param outsideTouchable true为可以点击空白区域false为不可点击
* @param listener 事件监听
* @return
*/
public
static
BuildBean
showMdAlert
(
Activity
activity
,
CharSequence
title
,
CharSequence
msg
,
boolean
cancleable
,
boolean
outsideTouchable
,
DialogUIListener
listener
)
{
return
DialogAssigner
.
getInstance
().
assignMdAlert
(
activity
,
title
,
msg
,
cancleable
,
outsideTouchable
,
listener
);
}
/**
* md风格多选框 默认可取消可点击
*
* @param activity 所在activity
* @param title 标题 不传则无标题
* @param words 消息数组
* @param checkedItems 默认选中项
* @param listener 事件监听
*/
public
static
BuildBean
showMdMultiChoose
(
Activity
activity
,
CharSequence
title
,
CharSequence
[]
words
,
boolean
[]
checkedItems
,
DialogUIListener
listener
)
{
return
showMdMultiChoose
(
activity
,
title
,
words
,
checkedItems
,
true
,
true
,
listener
);
}
/***
* md风格多选框
*
* @param activity 所在activity
* @param title 标题 不传则无标题
* @param words 消息数组
* @param checkedItems 默认选中项
* @param cancleable true为可以取消false为不可取消
* @param outsideTouchable true为可以点击空白区域false为不可点击
* @param listener 事件监听
* @return
*/
public
static
BuildBean
showMdMultiChoose
(
Activity
activity
,
CharSequence
title
,
CharSequence
[]
words
,
boolean
[]
checkedItems
,
boolean
cancleable
,
boolean
outsideTouchable
,
DialogUIListener
listener
)
{
return
DialogAssigner
.
getInstance
().
assignMdMultiChoose
(
activity
,
title
,
words
,
checkedItems
,
cancleable
,
outsideTouchable
,
listener
);
}
/**
* 单选框 默认可取消可点击
*
* @param activity 所在activity
* @param title 标题 不传则无标题
* @param defaultChosen 默认选中项
* @param words 消息数组
* @param listener 事件监听
*/
public
static
BuildBean
showSingleChoose
(
Activity
activity
,
CharSequence
title
,
int
defaultChosen
,
CharSequence
[]
words
,
DialogUIItemListener
listener
)
{
return
showSingleChoose
(
activity
,
title
,
defaultChosen
,
words
,
true
,
true
,
listener
);
}
/**
* 单选框
*
* @param activity 所在activity
* @param title 标题 不传则无标题
* @param defaultChosen 默认选中项
* @param words 消息数组
* @param cancleable true为可以取消false为不可取消
* @param outsideTouchable true为可以点击空白区域false为不可点击
* @param listener 事件监听
*/
public
static
BuildBean
showSingleChoose
(
Activity
activity
,
CharSequence
title
,
int
defaultChosen
,
CharSequence
[]
words
,
boolean
cancleable
,
boolean
outsideTouchable
,
DialogUIItemListener
listener
)
{
return
DialogAssigner
.
getInstance
().
assignSingleChoose
(
activity
,
title
,
defaultChosen
,
words
,
cancleable
,
outsideTouchable
,
listener
);
}
/**
* 提示弹出框
*
* @param activity 所在activity
* @param title 标题 不传则无标题
* @param cancleable true为可以取消false为不可取消
* @param outsideTouchable true为可以点击空白区域false为不可点击
* @param listener 事件监听
*/
public
static
BuildBean
showAlert
(
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
().
assignAlert
(
activity
,
title
,
msg
,
hint1
,
hint2
,
firstTxt
,
secondTxt
,
isVertical
,
cancleable
,
outsideTouchable
,
listener
);
}
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
);
}
/**
* 短时间中下位置显示。线程安全,可以在非UI线程调用。
*/
public
static
void
showToast
(
final
int
resId
)
{
showToast
(
ToolUtils
.
getString
(
appContext
,
resId
));
}
/**
* 短时间中下位置显示。
*/
public
static
void
showToast
(
final
String
str
)
{
showToast
(
str
,
Toast
.
LENGTH_SHORT
,
Gravity
.
BOTTOM
);
}
/**
* 长时间中下位置显示。
*/
public
static
void
showToastLong
(
final
int
resId
)
{
showToastLong
(
ToolUtils
.
getString
(
appContext
,
resId
));
}
/**
* 长时间中下位置显示。
*/
public
static
void
showToastLong
(
final
String
str
)
{
showToast
(
str
,
Toast
.
LENGTH_LONG
,
Gravity
.
BOTTOM
);
}
/**
* 短时间居中位置显示。
*/
public
static
void
showToastCenter
(
final
int
resId
)
{
showToastCenter
(
ToolUtils
.
getString
(
appContext
,
resId
));
}
/**
* 短时间居中位置显示。
*/
public
static
void
showToastCenter
(
final
String
str
)
{
showToast
(
str
,
Toast
.
LENGTH_SHORT
,
Gravity
.
CENTER
);
}
/**
* 长时间居中位置显示。
*/
public
static
void
showToastCenterLong
(
final
int
resId
)
{
showToastCenterLong
(
ToolUtils
.
getString
(
appContext
,
resId
));
}
/**
* 长时间居中位置显示。
*/
public
static
void
showToastCenterLong
(
final
String
str
)
{
showToast
(
str
,
Toast
.
LENGTH_LONG
,
Gravity
.
CENTER
);
}
/**
* 短时间居中位置显示。
*/
public
static
void
showToastTop
(
final
int
resId
)
{
showToastTop
(
ToolUtils
.
getString
(
appContext
,
resId
));
}
/**
* 短时间居中位置显示。
*/
public
static
void
showToastTop
(
final
String
str
)
{
showToast
(
str
,
Toast
.
LENGTH_SHORT
,
Gravity
.
TOP
);
}
/**
* 长时间居中位置显示。
*/
public
static
void
showToastTopLong
(
final
int
resId
)
{
showToastTopLong
(
ToolUtils
.
getString
(
appContext
,
resId
));
}
/**
* 长时间居中位置显示。
*/
public
static
void
showToastTopLong
(
final
String
str
)
{
showToast
(
str
,
Toast
.
LENGTH_LONG
,
Gravity
.
TOP
);
}
/**
* 只定义一个Toast
*/
private
static
Toast
mToast
;
private
static
Toast
mToastTop
;
private
static
Toast
mToastCenter
;
private
static
Toast
mToastBottom
;
/**
* 对toast的简易封装。线程不安全,不可以在非UI线程调用。
*/
private
static
void
showToast
(
String
str
,
int
showTime
,
int
gravity
)
{
if
(
appContext
==
null
)
{
throw
new
RuntimeException
(
"DialogUIUtils not initialized!"
);
}
if
(
gravity
==
Gravity
.
TOP
)
{
if
(
mToastTop
==
null
)
{
mToastTop
=
Toast
.
makeText
(
appContext
,
str
,
showTime
);
LayoutInflater
inflate
=
(
LayoutInflater
)
appContext
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
View
view
=
inflate
.
inflate
(
R
.
layout
.
dialogui_toast
,
null
);
mToastTop
.
setView
(
view
);
mToastTop
.
setGravity
(
gravity
,
0
,
appContext
.
getResources
().
getDimensionPixelSize
(
R
.
dimen
.
dialogui_toast_margin
));
}
mToast
=
mToastTop
;
mToast
.
setText
(
str
);
mToast
.
show
();
}
else
if
(
gravity
==
Gravity
.
CENTER
)
{
if
(
mToastCenter
==
null
)
{
mToastCenter
=
Toast
.
makeText
(
appContext
,
str
,
showTime
);
LayoutInflater
inflate
=
(
LayoutInflater
)
appContext
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
View
view
=
inflate
.
inflate
(
R
.
layout
.
dialogui_toast
,
null
);
mToastCenter
.
setView
(
view
);
mToastCenter
.
setGravity
(
gravity
,
0
,
0
);
}
mToast
=
mToastCenter
;
mToast
.
setText
(
str
);
mToast
.
show
();
}
else
if
(
gravity
==
Gravity
.
BOTTOM
)
{
if
(
mToastBottom
==
null
)
{
mToastBottom
=
Toast
.
makeText
(
appContext
,
str
,
showTime
);
LayoutInflater
inflate
=
(
LayoutInflater
)
appContext
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
View
view
=
inflate
.
inflate
(
R
.
layout
.
dialogui_toast
,
null
);
mToastBottom
.
setView
(
view
);
mToastBottom
.
setGravity
(
gravity
,
0
,
appContext
.
getResources
().
getDimensionPixelSize
(
R
.
dimen
.
dialogui_toast_margin
));
}
mToast
=
mToastBottom
;
mToast
.
setText
(
str
);
mToast
.
show
();
}
}
/**
* 只定义一个mBuildBean
*/
private
static
BuildBean
mBuildBean
;
/**
* 对mBuildBean的简易封装。线程不安全,不可以在非UI线程调用。
*/
public
static
void
showTie
(
Context
context
)
{
showTie
(
context
,
"加载中..."
);
}
/**
* 对mBuildBean的简易封装。线程不安全,不可以在非UI线程调用。
*/
public
static
void
showTie
(
Context
context
,
String
str
)
{
if
(
mBuildBean
!=
null
)
{
dismiss
(
mBuildBean
);
}
mBuildBean
=
showLoading
(
context
,
str
,
false
,
true
,
false
,
true
);
mBuildBean
.
show
();
}
/**
* 对mBuildBean的简易封装。线程不安全,不可以在非UI线程调用。
*/
public
static
void
dismssTie
()
{
dismiss
(
mBuildBean
);
}
}
lib_common/src/main/java/com/secspace/lib/common/dialog/other/Styleable.java
0 → 100644
View file @
7808bffa
package
com
.
secspace
.
lib
.
common
.
dialog
.
other
;
import
android.app.Dialog
;
import
android.support.annotation.ColorRes
;
import
android.support.annotation.Nullable
;
import
java.util.Map
;
/**
* Created by Administrator on 2016/10/10.
*/
public
interface
Styleable
{
BuildBean
setBtnColor
(
@ColorRes
int
btn1Color
,
@ColorRes
int
btn2Color
,
@ColorRes
int
btn3Color
);
BuildBean
setListItemColor
(
@ColorRes
int
lvItemTxtColor
,
Map
<
Integer
,
Integer
>
colorOfPosition
);
BuildBean
setTitleColor
(
@ColorRes
int
colorRes
);
BuildBean
setMsgColor
(
@ColorRes
int
colorRes
);
BuildBean
seInputColor
(
@ColorRes
int
colorRes
);
BuildBean
setTitleSize
(
int
sizeInSp
);
BuildBean
setMsgSize
(
int
sizeInSp
);
BuildBean
setBtnSize
(
int
sizeInSp
);
BuildBean
setLvItemSize
(
int
sizeInSp
);
BuildBean
setInputSize
(
int
sizeInSp
);
Dialog
show
();
//内容设置
BuildBean
setBtnText
(
CharSequence
btn1Text
,
@Nullable
CharSequence
btn2Text
,
@Nullable
CharSequence
btn3Text
);
BuildBean
setBtnText
(
CharSequence
positiveTxt
,
@Nullable
CharSequence
negtiveText
);
BuildBean
setListener
(
DialogUIListener
listener
);
BuildBean
setCancelable
(
boolean
cancelable
,
boolean
outsideCancelable
);
}
lib_common/src/main/java/com/secspace/lib/common/dialog/other/SuperHolder.java
0 → 100644
View file @
7808bffa
package
com
.
secspace
.
lib
.
common
.
dialog
.
other
;
import
android.content.Context
;
import
android.support.annotation.LayoutRes
;
import
android.view.View
;
/**
* ========================================
* <p/>
* 版 权:dou361.com 版权所有 (C) 2015
* <p/>
* 作 者:陈冠明
* <p/>
* 个人网站:http://www.dou361.com
* <p/>
* 版 本:1.0
* <p/>
* 创建日期:2016/11/28 11:54
* <p/>
* 描 述:holder
* <p/>
* <p/>
* 修订历史:
* <p/>
* ========================================
*/
public
abstract
class
SuperHolder
{
public
View
rootView
;
public
SuperHolder
(
Context
context
)
{
rootView
=
View
.
inflate
(
context
,
setLayoutRes
(),
null
);
findViews
();
}
protected
abstract
void
findViews
();
protected
abstract
@LayoutRes
int
setLayoutRes
();
/**
* 一般情况下,实现这个方法就足够了
*
* @param context
* @param bean
*/
public
abstract
void
assingDatasAndEvents
(
Context
context
,
BuildBean
bean
);
}
lib_common/src/main/java/com/secspace/lib/common/dialog/other/ToolUtils.java
0 → 100644
View file @
7808bffa
package
com
.
secspace
.
lib
.
common
.
dialog
.
other
;
import
android.app.Activity
;
import
android.app.Dialog
;
import
android.content.Context
;
import
android.graphics.Color
;
import
android.graphics.drawable.ColorDrawable
;
import
android.os.Build
;
import
android.support.v7.app.AlertDialog
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.Window
;
import
android.view.WindowManager
;
import
android.widget.Button
;
/**
* Created by Administrator on 2016/10/9 0009.
*/
public
class
ToolUtils
{
/**
* 统一显示
* 解决badtoken问题,一劳永逸
*
* @param dialog
*/
public
static
void
showDialog
(
Dialog
dialog
)
{
try
{
if
(
dialog
!=
null
)
{
dialog
.
show
();
}
}
catch
(
Exception
e
)
{
}
}
/**
* 混合上下文
*/
public
static
BuildBean
fixContext
(
BuildBean
bean
)
{
if
(
bean
.
mContext
==
null
)
{
bean
.
mContext
=
DialogUIUtils
.
appContext
;
}
else
if
(
bean
.
mContext
instanceof
Activity
)
{
Activity
activity
=
(
Activity
)
bean
.
mContext
;
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN_MR1
)
{
if
(
activity
.
isDestroyed
())
{
bean
.
mContext
=
DialogUIUtils
.
appContext
;
}
}
}
return
bean
;
}
public
static
BuildBean
setCancelable
(
BuildBean
bean
)
{
if
(
bean
.
alertDialog
!=
null
)
{
bean
.
alertDialog
.
setCancelable
(
bean
.
cancelable
);
bean
.
alertDialog
.
setCanceledOnTouchOutside
(
bean
.
outsideTouchable
);
}
else
if
(
bean
.
dialog
!=
null
)
{
bean
.
dialog
.
setCancelable
(
bean
.
cancelable
);
bean
.
dialog
.
setCanceledOnTouchOutside
(
bean
.
outsideTouchable
);
}
return
bean
;
}
public
static
void
setDialogStyle
(
BuildBean
bean
)
{
if
(
bean
.
alertDialog
!=
null
)
{
setMdBtnStytle
(
bean
);
}
else
{
setDialogStyle
(
bean
.
mContext
,
bean
.
dialog
,
bean
.
viewHeight
,
bean
);
}
}
/**
* 设置MD风格样式
*/
public
static
void
setMdBtnStytle
(
BuildBean
bean
)
{
Button
btnPositive
=
bean
.
alertDialog
.
getButton
(
AlertDialog
.
BUTTON_POSITIVE
);
Button
btnNegative
=
bean
.
alertDialog
.
getButton
(
AlertDialog
.
BUTTON_NEGATIVE
);
Button
btnNatural
=
bean
.
alertDialog
.
getButton
(
AlertDialog
.
BUTTON_NEUTRAL
);
if
(
btnPositive
!=
null
&&
btnNegative
!=
null
)
{
btnPositive
.
setTextSize
(
bean
.
btnTxtSize
);
btnNegative
.
setTextSize
(
bean
.
btnTxtSize
);
btnNatural
.
setTextSize
(
bean
.
btnTxtSize
);
if
(
bean
.
btn1Color
!=
0
)
btnPositive
.
setTextColor
(
getColor
(
null
,
bean
.
btn1Color
));
if
(
bean
.
btn2Color
!=
0
)
btnNegative
.
setTextColor
(
getColor
(
null
,
bean
.
btn2Color
));
if
(
bean
.
btn3Color
!=
0
)
btnNatural
.
setTextColor
(
getColor
(
null
,
bean
.
btn3Color
));
}
Window
window
=
bean
.
alertDialog
.
getWindow
();
window
.
setGravity
(
bean
.
gravity
);
}
public
static
void
setDialogStyle
(
Context
context
,
Dialog
dialog
,
int
measuredHeight
,
BuildBean
bean
)
{
if
(
dialog
==
null
)
{
return
;
}
Window
window
=
dialog
.
getWindow
();
window
.
setBackgroundDrawable
(
new
ColorDrawable
(
Color
.
TRANSPARENT
));
window
.
setGravity
(
bean
.
gravity
);
WindowManager
.
LayoutParams
wl
=
window
.
getAttributes
();
// 以下这两句是为了保证按钮可以水平满屏
int
width
=
((
WindowManager
)
context
.
getSystemService
(
Context
.
WINDOW_SERVICE
)).
getDefaultDisplay
().
getWidth
();
int
height
=
(
int
)
(((
WindowManager
)
context
.
getSystemService
(
Context
.
WINDOW_SERVICE
)).
getDefaultDisplay
().
getHeight
()
*
0.9
);
if
(
bean
.
type
!=
DialogConfig
.
TYPE_MD_LOADING
)
{
wl
.
width
=
(
int
)
(
width
*
0.94
);
// todo keycode to keep gap
}
else
{
wl
.
width
=
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
;
}
wl
.
height
=
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
;
//TODO 一般情况下为wrapcontent,最大值为height*0.9
if
(
measuredHeight
>
height
)
{
wl
.
height
=
height
;
}
if
(
context
instanceof
Activity
)
{
Activity
activity1
=
(
Activity
)
context
;
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN_MR1
)
{
if
(
activity1
.
isDestroyed
())
{
context
=
DialogUIUtils
.
appContext
;
}
}
}
else
{
wl
.
type
=
WindowManager
.
LayoutParams
.
TYPE_TOAST
;
//todo keycode to improve window level,同时要让它的后面半透明背景也拦截事件,不要传递到下面去
//todo 单例化,不然连续弹出两次,只能关掉第二次的
}
dialog
.
onWindowAttributesChanged
(
wl
);
}
/**
* 测量View
*/
public
static
void
measureView
(
View
child
)
{
ViewGroup
.
LayoutParams
p
=
child
.
getLayoutParams
();
if
(
p
==
null
)
{
p
=
new
ViewGroup
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
);
}
int
lpHeight
=
p
.
height
;
int
lpWidth
=
p
.
width
;
int
childHeightSpec
;
int
childWidthSpec
;
if
(
lpHeight
>
0
)
{
//如果Height是一个定值,那么我们测量的时候就使用这个定值
childHeightSpec
=
View
.
MeasureSpec
.
makeMeasureSpec
(
lpHeight
,
View
.
MeasureSpec
.
EXACTLY
);
}
else
{
// 否则,我们将mode设置为不指定,size设置为0
childHeightSpec
=
View
.
MeasureSpec
.
makeMeasureSpec
(
0
,
View
.
MeasureSpec
.
UNSPECIFIED
);
}
if
(
lpWidth
>
0
)
{
childWidthSpec
=
View
.
MeasureSpec
.
makeMeasureSpec
(
lpHeight
,
View
.
MeasureSpec
.
EXACTLY
);
}
else
{
childWidthSpec
=
View
.
MeasureSpec
.
makeMeasureSpec
(
0
,
View
.
MeasureSpec
.
UNSPECIFIED
);
}
child
.
measure
(
childWidthSpec
,
childHeightSpec
);
}
/**
* 测量高度
*
* @param root
* @param id height为0,weight为1的scrollview包裹的view的id,如果没有,传0或负数即可
* @return
*/
public
static
int
mesureHeight
(
View
root
,
int
id
)
{
measureView
(
root
);
int
height
=
root
.
getMeasuredHeight
();
int
heightExtra
=
0
;
if
(
id
>
0
)
{
View
view
=
root
.
findViewById
(
id
);
if
(
view
!=
null
)
{
measureView
(
view
);
heightExtra
=
view
.
getMeasuredHeight
();
}
}
return
height
+
heightExtra
;
}
/**
* 测量高度
*/
public
static
int
mesureHeight
(
View
root
,
View
...
subViews
)
{
measureView
(
root
);
int
height
=
root
.
getMeasuredHeight
();
int
heightExtra
=
0
;
if
(
subViews
!=
null
&&
subViews
.
length
>
0
)
{
for
(
View
view
:
subViews
)
{
measureView
(
view
);
heightExtra
+=
view
.
getMeasuredHeight
();
}
}
return
height
+
heightExtra
;
}
/**
* 获取资源颜色
*/
public
static
int
getColor
(
Context
context
,
int
colorRes
)
{
if
(
context
==
null
)
{
context
=
DialogUIUtils
.
appContext
;
}
return
context
.
getResources
().
getColor
(
colorRes
);
}
/**
* 获取文字
*/
public
static
String
getString
(
Context
context
,
int
resId
)
{
return
context
.
getResources
().
getString
(
resId
);
}
/**
* dip转换px
*/
public
static
int
dip2px
(
Context
context
,
int
dip
)
{
final
float
scale
=
context
.
getResources
().
getDisplayMetrics
().
density
;
return
(
int
)
(
dip
*
scale
+
0.5f
);
}
/**
* 获取屏幕宽度(像素)
*/
public
static
int
getScreenWidth
(
Context
context
)
{
WindowManager
windowManager
=
(
WindowManager
)
context
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
return
windowManager
.
getDefaultDisplay
().
getWidth
();
}
}
lib_common/src/main/java/com/secspace/lib/common/function/ActivationHelper.kt
View file @
7808bffa
...
...
@@ -8,6 +8,7 @@ import android.util.Log
import
com.secspace.lib.common.utils.ImeiUtil.uniqueId
import
com.skr.activation.api.ActivationApi
import
com.skr.activation.constant.Constant.*
import
com.skr.activation.network.linstener.CheckActiveStatusListener
import
com.skr.activation.network.linstener.CheckLocalActiveStatusListener
import
com.skr.activation.network.linstener.GetSystemTimeListener
import
com.skr.activation.utils.DesUtil
...
...
@@ -58,7 +59,7 @@ object ActivationHelper {
if
(
isProbation
)
{
listener
.
activated
()
}
else
{
DialogManager
.
getInstance
().
showBuyCodeDialog
(
context
)
DialogManager
.
showBuyCodeDialog
(
context
)
}
}
else
{
if
(
probation
(
context
))
{
...
...
@@ -75,6 +76,10 @@ object ActivationHelper {
})
}
fun
checkActivate
(
context
:
Context
,
listener
:
CheckActiveStatusListener
?)
{
ActivationApi
.
getInstance
().
checkActivateCodeStatus
(
context
.
packageName
,
listener
)
}
private
suspend
fun
getCurrentTimeByNet
():
Long
=
suspendCoroutine
{
cont
->
ActivationApi
.
getInstance
().
getSystemTime
(
object
:
GetSystemTimeListener
{
override
fun
onTime
(
p0
:
Long
)
{
...
...
lib_common/src/main/java/com/secspace/lib/common/function/BuyCodeDialog.java
deleted
100644 → 0
View file @
5c0a770c
package
com
.
secspace
.
lib
.
common
.
function
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.graphics.Color
;
import
android.text.Html
;
import
android.text.Spannable
;
import
android.text.SpannableStringBuilder
;
import
android.text.Spanned
;
import
android.text.method.LinkMovementMethod
;
import
android.text.style.ClickableSpan
;
import
android.text.style.URLSpan
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.Window
;
import
android.widget.Button
;
import
android.widget.TextView
;
import
com.secspace.lib.common.R
;
import
com.secspace.lib.common.utils.IntentUtil
;
import
com.secspace.lib.common.utils.Prefs
;
import
java.io.BufferedReader
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
public
class
BuyCodeDialog
implements
DialogInterface
.
OnDismissListener
,
View
.
OnClickListener
{
private
static
final
String
TAG
=
"BuyCodeDialog"
;
private
Activity
mActivity
;
private
Context
mContext
;
private
android
.
app
.
AlertDialog
mDialog
;
private
Button
btnAccept
;
private
View
layout
;
public
BuyCodeDialog
(
Activity
activity
)
{
this
.
mActivity
=
activity
;
mContext
=
activity
.
getApplicationContext
();
}
public
BuyCodeDialog
show
()
{
if
(
mDialog
==
null
)
{
initView
();
android
.
app
.
AlertDialog
.
Builder
builder
=
new
android
.
app
.
AlertDialog
.
Builder
(
mActivity
);
mDialog
=
builder
.
create
();
mDialog
.
setCancelable
(
false
);
Window
window
=
mDialog
.
getWindow
();
window
.
setBackgroundDrawableResource
(
R
.
drawable
.
dialog_corner_bg
);
mDialog
.
setView
(
layout
);
mDialog
.
show
();
}
if
(!
mDialog
.
isShowing
())
{
mDialog
.
show
();
}
return
this
;
}
private
void
initView
()
{
LayoutInflater
inflater
=
LayoutInflater
.
from
(
mActivity
);
layout
=
inflater
.
inflate
(
R
.
layout
.
buycode_layout
,
null
);
btnAccept
=
layout
.
findViewById
(
R
.
id
.
btn_accept
);
btnAccept
.
setOnClickListener
(
this
);
}
public
void
dismiss
()
{
if
(
mDialog
!=
null
&&
mDialog
.
isShowing
())
mDialog
.
dismiss
();
}
@Override
public
void
onDismiss
(
DialogInterface
dialog
)
{
mActivity
=
null
;
mDialog
=
null
;
}
@Override
public
void
onClick
(
View
v
)
{
if
(
v
.
getId
()
==
R
.
id
.
btn_accept
)
{
ActivationHelper
.
INSTANCE
.
active
(
mActivity
,
new
ActivationHelper
.
ActivationListener
()
{
@Override
public
void
activationFailed
()
{
}
@Override
public
void
activated
()
{
IntentUtil
.
startEduLauncher
(
mContext
);
}
},
true
);
Prefs
.
setMdmInitializedWhenEnter
(
mContext
,
false
);
SwitchOutMdm
.
INSTANCE
.
exit
(
mContext
);
dismiss
();
}
}
}
lib_common/src/main/java/com/secspace/lib/common/function/BuyCodeDialog.kt
0 → 100644
View file @
7808bffa
package
com.secspace.lib.common.function
import
android.app.Activity
import
android.app.AlertDialog
import
android.content.Context
import
android.content.DialogInterface
import
android.view.LayoutInflater
import
android.view.View
import
android.widget.Button
import
com.secspace.lib.common.R
import
com.secspace.lib.common.function.ActivationHelper.ActivationListener
import
com.secspace.lib.common.function.ActivationHelper.active
import
com.secspace.lib.common.utils.IntentUtil
import
com.secspace.lib.common.utils.Prefs
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.GlobalScope
import
kotlinx.coroutines.launch
class
BuyCodeDialog
(
activity
:
Activity
)
:
DialogInterface
.
OnDismissListener
,
View
.
OnClickListener
{
private
var
mActivity
:
Activity
?
private
val
mContext
:
Context
private
var
mDialog
:
AlertDialog
?
=
null
private
var
btnAccept
:
Button
?
=
null
private
var
layout
:
View
?
=
null
fun
show
():
BuyCodeDialog
{
if
(
mDialog
==
null
)
{
initView
()
val
builder
=
AlertDialog
.
Builder
(
mActivity
)
mDialog
=
builder
.
create
()
mDialog
?.
setCancelable
(
false
)
val
window
=
mDialog
?.
window
window
?.
setBackgroundDrawableResource
(
R
.
drawable
.
dialog_corner_bg
)
mDialog
?.
setView
(
layout
)
mDialog
?.
show
()
}
if
(!
mDialog
?.
isShowing
!!
)
{
mDialog
?.
show
()
}
return
this
}
private
fun
initView
()
{
val
inflater
=
LayoutInflater
.
from
(
mActivity
)
layout
=
inflater
.
inflate
(
R
.
layout
.
buycode_layout
,
null
)
btnAccept
=
layout
?.
findViewById
(
R
.
id
.
btn_accept
)
btnAccept
?.
setOnClickListener
(
this
)
}
fun
dismiss
()
{
if
(
mDialog
!=
null
&&
mDialog
!!
.
isShowing
)
mDialog
!!
.
dismiss
()
}
override
fun
onDismiss
(
dialog
:
DialogInterface
)
{
mActivity
=
null
mDialog
=
null
}
override
fun
onClick
(
v
:
View
)
{
if
(
v
.
id
==
R
.
id
.
btn_accept
)
{
active
(
mActivity
!!
,
object
:
ActivationListener
{
override
fun
activationFailed
()
{}
override
fun
activated
()
{
IntentUtil
.
startEduLauncher
(
mContext
)
}
},
true
)
dismiss
()
Prefs
.
setMdmInitializedWhenEnter
(
mContext
,
false
)
GlobalScope
.
launch
(
Dispatchers
.
IO
)
{
SwitchOutMdm
.
onInit
(
mContext
)
}
}
}
companion
object
{
private
const
val
TAG
=
"BuyCodeDialog"
}
init
{
mActivity
=
activity
mContext
=
activity
.
applicationContext
}
}
\ No newline at end of file
lib_common/src/main/java/com/secspace/lib/common/function/DialogManager.java
deleted
100644 → 0
View file @
5c0a770c
package
com
.
secspace
.
lib
.
common
.
function
;
import
android.annotation.SuppressLint
;
import
android.app.Activity
;
import
android.content.ComponentName
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.res.Resources
;
import
com.secspace.lib.common.R
;
import
com.secspace.lib.common.dialog.DotRotateDialog
;
import
com.secspace.lib.common.dialog.OptimizeDialog
;
import
com.secspace.lib.common.dialog.SecSpaceUpdateDialog
;
import
com.secspace.lib.common.dialog.SimpleDialog
;
import
com.secspace.lib.common.dialog.SwitcherDialog
;
import
com.secspace.lib.common.env.BlackandWhiteList
;
import
com.secspace.lib.common.event.ExitEvent
;
import
com.secspace.lib.common.event.ResetPwdEvent
;
import
com.secspace.lib.common.utils.DpmHelper
;
import
com.secspace.lib.common.utils.PkgManager
;
import
com.secspace.lib.common.utils.Prefs
;
import
com.secspace.lib.common.utils.ToastUtil
;
import
com.secspace.mdmengine.api.manager.MdmFactoryManager
;
import
org.greenrobot.eventbus.EventBus
;
import
static
com
.
secspace
.
lib
.
common
.
env
.
Packages
.
CompSecSpace
.
CLASSNAME_DPM_ADMIN
;
import
static
com
.
secspace
.
lib
.
common
.
env
.
Packages
.
PkgSecSpace
.
PACKAGENAME_MIDDLEWARE
;
/**
* Created by cyw_m on 2018/4/6.
*/
@SuppressLint
(
"StaticFieldLeak"
)
public
class
DialogManager
{
private
static
DialogManager
mInstance
=
null
;
private
SimpleDialog
mSimpleDialog
;
private
DotRotateDialog
mDotRotateDialog
;
private
OptimizeDialog
mOptimizeDialog
;
private
SecSpaceUpdateDialog
mPresetAppUpdateDialog
;
private
DialogManager
()
{
}
public
static
DialogManager
getInstance
()
{
if
(
mInstance
==
null
)
{
synchronized
(
DialogManager
.
class
)
{
if
(
mInstance
==
null
)
{
mInstance
=
new
DialogManager
();
}
}
}
return
mInstance
;
}
/**
* 安装中间件弹窗
*/
public
void
showInstallMiddleWare
(
Activity
activity
)
{
final
Context
context
=
activity
.
getApplication
();
mSimpleDialog
=
new
SimpleDialog
(
activity
).
show
(
context
.
getResources
().
getString
(
R
.
string
.
common_remind
)
,
context
.
getResources
().
getString
(
R
.
string
.
common_need_install_middleware
)
,
false
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
WorkManager
.
INSTANCE
.
installMiddleWare
(
context
);
dialog
.
dismiss
();
}
}
,
null
);
}
public
void
showMiddleWareDeviceOwnerConfirmDialog
(
Activity
activity
)
{
if
(
DpmOwnerHelper
.
INSTANCE
.
isSettingDeviceOwner
())
{
return
;
}
final
Context
context
=
activity
.
getApplicationContext
();
dismissSimpleDialog
();
mSimpleDialog
=
new
SimpleDialog
(
activity
).
show
(
activity
.
getResources
().
getString
(
R
.
string
.
common_remind
)
,
activity
.
getResources
().
getString
(
R
.
string
.
work_confirm_device_owner
)
,
false
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
DpmOwnerHelper
.
INSTANCE
.
disableAccountsAndRemoveProfileUsers
(
context
);
SwitcherDialog
.
getInstance
(
context
).
show
(
context
.
getString
(
R
.
string
.
work_del_account
),
"Clear Account"
);
dialog
.
dismiss
();
}
}
,
null
);
}
public
void
showRemoveUserConfirmDialog
(
Activity
activity
)
{
mSimpleDialog
=
new
SimpleDialog
(
activity
).
show
(
activity
.
getResources
().
getString
(
R
.
string
.
common_remind
)
,
activity
.
getResources
().
getString
(
R
.
string
.
work_remove_user_confirm_device_owner
)
,
false
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
DpmOwnerHelper
.
INSTANCE
.
removeOtherUsers
();
}
}
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
EventBus
.
getDefault
().
post
(
new
ExitEvent
());
}
}
);
}
/**
* 关闭普通dialog
*/
public
void
dismissSimpleDialog
()
{
if
(
mSimpleDialog
!=
null
)
{
mSimpleDialog
.
dismiss
();
}
}
public
void
showPrivacyPolicyDialog
(
Activity
activity
)
{
new
PrivacyPolicyDialog
(
activity
).
show
();
}
public
void
showBuyCodeDialog
(
Activity
activity
)
{
new
BuyCodeDialog
(
activity
).
show
();
}
}
lib_common/src/main/java/com/secspace/lib/common/function/DialogManager.kt
0 → 100644
View file @
7808bffa
package
com.secspace.lib.common.function
import
android.annotation.SuppressLint
import
android.app.Activity
import
android.content.Context
import
android.content.DialogInterface
import
android.view.View
import
com.secspace.lib.common.R
import
com.secspace.lib.common.dialog.SimpleDialog
import
com.secspace.lib.common.dialog.SwitcherDialog
import
com.secspace.lib.common.dialog.other.DialogUIListener
import
com.secspace.lib.common.dialog.other.DialogUIUtils
import
com.secspace.lib.common.event.ExitEvent
import
com.secspace.lib.common.function.DpmOwnerHelper.disableAccountsAndRemoveProfileUsers
import
com.secspace.lib.common.function.DpmOwnerHelper.isSettingDeviceOwner
import
com.secspace.lib.common.function.DpmOwnerHelper.removeOtherUsers
import
com.secspace.lib.common.function.WorkManager.installMiddleWare
import
org.greenrobot.eventbus.EventBus
/**
* Created by cyw_m on 2018/4/6.
*/
@SuppressLint
(
"StaticFieldLeak"
)
object
DialogManager
{
private
var
mSimpleDialog
:
SimpleDialog
?
=
null
/**
* 安装中间件弹窗
*/
fun
showInstallMiddleWare
(
activity
:
Activity
)
{
val
context
:
Context
=
activity
.
application
mSimpleDialog
=
SimpleDialog
(
activity
).
show
(
context
.
resources
.
getString
(
R
.
string
.
common_remind
)
,
context
.
resources
.
getString
(
R
.
string
.
common_need_install_middleware
)
,
false
,
DialogInterface
.
OnClickListener
{
dialog
,
which
->
installMiddleWare
(
context
)
dialog
.
dismiss
()
}
,
null
)
}
fun
showMiddleWareDeviceOwnerConfirmDialog
(
activity
:
Activity
)
{
if
(
isSettingDeviceOwner
)
{
return
}
val
context
=
activity
.
applicationContext
dismissSimpleDialog
()
mSimpleDialog
=
SimpleDialog
(
activity
).
show
(
activity
.
resources
.
getString
(
R
.
string
.
common_remind
)
,
activity
.
resources
.
getString
(
R
.
string
.
work_confirm_device_owner
)
,
false
,
DialogInterface
.
OnClickListener
{
dialog
,
which
->
disableAccountsAndRemoveProfileUsers
(
context
)
SwitcherDialog
.
getInstance
(
context
).
show
(
context
.
getString
(
R
.
string
.
work_del_account
),
"Clear Account"
)
dialog
.
dismiss
()
}
,
null
)
}
fun
showRemoveUserConfirmDialog
(
activity
:
Activity
)
{
mSimpleDialog
=
SimpleDialog
(
activity
).
show
(
activity
.
resources
.
getString
(
R
.
string
.
common_remind
)
,
activity
.
resources
.
getString
(
R
.
string
.
work_remove_user_confirm_device_owner
)
,
false
,
{
dialog
,
which
->
removeOtherUsers
()
}
)
{
dialog
,
which
->
EventBus
.
getDefault
().
post
(
ExitEvent
())
}
}
/**
* 关闭普通dialog
*/
fun
dismissSimpleDialog
()
{
if
(
mSimpleDialog
!=
null
)
{
mSimpleDialog
!!
.
dismiss
()
}
}
fun
showPrivacyPolicyDialog
(
activity
:
Activity
?)
{
PrivacyPolicyDialog
(
activity
).
show
()
}
fun
showBuyCodeDialog
(
activity
:
Activity
?)
{
BuyCodeDialog
(
activity
!!
).
show
()
}
fun
showMessageDialog
(
activity
:
Activity
?,
title
:
String
?,
content
:
String
?,
listener
:
MessageListener
)
{
DialogUIUtils
.
showAlert
(
activity
,
title
,
content
,
""
,
""
,
"确定"
,
"取消"
,
false
,
false
,
false
,
object
:
DialogUIListener
()
{
override
fun
onPositive
()
{
listener
.
onPositive
()
}
override
fun
onNegative
()
{
listener
.
onNegative
()
}
}).
show
()
}
fun
showMessageDialogBySure
(
activity
:
Activity
?,
title
:
String
?,
content
:
String
?,
listener
:
MessageListener
)
{
DialogUIUtils
.
showAlert
(
activity
,
title
,
content
,
""
,
""
,
"确定"
,
""
,
false
,
false
,
false
,
object
:
DialogUIListener
()
{
override
fun
onPositive
()
{
listener
.
onPositive
()
}
override
fun
onNegative
()
{
listener
.
onNegative
()
}
}).
show
()
}
fun
showPwdDialog
(
activity
:
Activity
?,
title
:
String
?,
listener
:
PwdListener
)
{
val
buildBean
=
DialogUIUtils
.
showAlertPassword
(
activity
,
title
,
""
,
""
,
""
,
"确定"
,
"取消"
,
false
,
false
,
false
,
object
:
DialogUIListener
()
{
override
fun
onPositive
(
view
:
View
)
{
listener
.
onPositive
(
view
)
}
override
fun
onPositive
()
{}
override
fun
onNegative
()
{
listener
.
onNegative
()
}
})
buildBean
.
show
()
}
interface
MessageListener
{
fun
onPositive
()
fun
onNegative
()
}
interface
PwdListener
{
fun
onPositive
(
view
:
View
?)
fun
onNegative
()
}
}
\ No newline at end of file
lib_common/src/main/java/com/secspace/lib/common/function/ExitService.kt
View file @
7808bffa
...
...
@@ -5,6 +5,7 @@ import android.content.Context
import
android.content.Intent
import
android.os.IBinder
import
android.util.Log
import
com.secspace.lib.common.dialog.LoadingDialog
import
com.secspace.lib.common.dialog.SwitcherDialog
import
com.secspace.lib.common.utils.IntentUtil
import
com.secspace.lib.common.utils.Prefs
...
...
@@ -26,7 +27,7 @@ class ExitService : Service() {
if
(
outing
)
return
super
.
onStartCommand
(
intent
,
flags
,
startId
)
outing
=
true
SwitcherDialog
.
getInstance
(
mAppContext
).
show
(
null
,
"Exit
"
)
LoadingDialog
.
getInstance
(
mAppContext
).
show
(
"切换中
"
)
GlobalScope
.
launch
(
Dispatchers
.
IO
)
{
Prefs
.
setMdmInitializedWhenEnter
(
mAppContext
,
false
)
...
...
@@ -34,7 +35,7 @@ class ExitService : Service() {
delay
(
1500
)
withContext
(
Dispatchers
.
Main
)
{
IntentUtil
.
startSystemLauncher
(
mAppContext
)
SwitcherDialog
.
getInstance
(
mAppContext
).
dismiss
(
"Exit"
)
LoadingDialog
.
getInstance
(
mAppContext
).
dismiss
(
)
outing
=
false
Log
.
d
(
TAG
,
"exit end"
)
}
...
...
lib_common/src/main/java/com/secspace/lib/common/function/ISwitch.kt
0 → 100644
View file @
7808bffa
package
com.secspace.lib.common.function
import
android.content.Context
import
com.secspace.lib.common.dialog.LoadingDialog
import
com.secspace.lib.common.env.Packages
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.withContext
import
java.util.ArrayList
abstract
class
ISwitch
{
private
suspend
fun
initStart
(
context
:
Context
)
=
withContext
(
Dispatchers
.
Main
)
{
LoadingDialog
.
getInstance
(
context
).
show
(
"切换中"
)
}
private
suspend
fun
initEnd
(
context
:
Context
)
=
withContext
(
Dispatchers
.
Main
)
{
LoadingDialog
.
getInstance
(
context
).
dismiss
()
}
suspend
fun
onInit
(
context
:
Context
)
{
initStart
(
context
)
init
(
context
)
initEnd
(
context
)
}
suspend
fun
onExit
(
context
:
Context
){
init
(
context
)
}
protected
abstract
suspend
fun
init
(
context
:
Context
)
protected
fun
getPersistentList
(
context
:
Context
):
List
<
String
?>?
{
var
list
:
MutableList
<
String
?>?
=
null
if
(
list
==
null
)
{
list
=
ArrayList
()
}
if
(
list
.
size
>
0
)
{
list
.
clear
()
}
list
.
add
(
context
.
packageName
)
list
.
add
(
Packages
.
PkgSecSpace
.
PACKAGENAME_MIDDLEWARE
)
return
list
}
}
\ No newline at end of file
lib_common/src/main/java/com/secspace/lib/common/function/SwitchInMdm.kt
View file @
7808bffa
...
...
@@ -8,6 +8,7 @@ import android.content.pm.PackageManager
import
android.content.pm.ResolveInfo
import
android.os.Build.VERSION_CODES
import
android.util.Log
import
com.secspace.lib.common.dialog.LoadingDialog
import
com.secspace.lib.common.env.Packages.PkgSecSpace
import
com.secspace.lib.common.utils.*
import
com.secspace.lib.common.utils.Package.ComponentNames.COMPONENT_UPDATE_SYSTEM
...
...
@@ -16,12 +17,13 @@ import com.secspace.mdmengine.api.manager.MdmFactoryManager
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.GlobalScope
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.withContext
import
java.util.*
object
SwitchInMdm
{
object
SwitchInMdm
:
ISwitch
()
{
private
var
context
:
Context
?
=
null
private
val
TAG
=
"SwitchInMdm"
fun
init
(
context
:
Context
)
{
override
suspend
fun
init
(
context
:
Context
)
{
this
.
context
=
context
MdmUtils
.
setDefaultLauncher
(
context
)
...
...
@@ -110,18 +112,7 @@ object SwitchInMdm {
DisableCompat
.
enableComponent
(
context
,
EnterprisePrivacySettingsActivity
)
}
private
fun
getPersistentList
(
context
:
Context
):
List
<
String
?>?
{
var
list
:
MutableList
<
String
?>?
=
null
if
(
list
==
null
)
{
list
=
ArrayList
()
}
if
(
list
.
size
>
0
)
{
list
.
clear
()
}
list
.
add
(
context
.
packageName
)
list
.
add
(
PkgSecSpace
.
PACKAGENAME_MIDDLEWARE
)
return
list
}
private
fun
clearProcesses
()
{
val
dam
=
MdmFactoryManager
.
getInstance
().
deviceApplicationManager
...
...
lib_common/src/main/java/com/secspace/lib/common/function/SwitchOutMdm.kt
View file @
7808bffa
...
...
@@ -7,6 +7,7 @@ import android.content.pm.PackageInfo
import
android.content.pm.PackageManager
import
android.content.pm.ResolveInfo
import
android.util.Log
import
com.secspace.lib.common.arouter.libwork.IWorkApi
import
com.secspace.lib.common.env.Packages.PkgSecSpace
import
com.secspace.lib.common.utils.DisableCompat
import
com.secspace.lib.common.utils.DpmHelper
...
...
@@ -20,21 +21,16 @@ import kotlinx.coroutines.GlobalScope
import
kotlinx.coroutines.launch
import
java.util.*
object
SwitchOutMdm
{
object
SwitchOutMdm
:
ISwitch
()
{
private
var
context
:
Context
?
=
null
private
val
TAG
=
"SwitchOutMdm"
fun
exit
(
context
:
Context
)
{
this
.
context
=
context
MdmUtils
.
clearDefaultLauncher
(
context
)
recover
()
removeDisallowedRunningApp
(
context
)
clearProcesses
()
killBackgroundApplication
()
}
private
fun
removeDisallowedRunningApp
(
context
:
Context
){
val
mdmFactoryManager
=
DpmHelper
.
getInstance
(
context
).
getmMdmFactoryManager
()
private
fun
removeDisallowedRunningApp
(){
val
mdmFactoryManager
=
MdmFactoryManager
.
getInstance
()
val
list
=
mdmFactoryManager
.
deviceApplicationManager
.
disallowedRunningApp
mdmFactoryManager
.
deviceApplicationManager
.
removeDisallowedRunningApp
(
list
)
Log
.
e
(
TAG
,
"remove:${list}"
)
...
...
@@ -57,19 +53,6 @@ object SwitchOutMdm {
DisableCompat
.
enableComponent
(
context
,
EnterprisePrivacySettingsActivity
)
}
private
fun
getPersistentList
(
context
:
Context
):
List
<
String
?>?
{
var
list
:
MutableList
<
String
?>?
=
null
if
(
list
==
null
)
{
list
=
ArrayList
()
}
if
(
list
.
size
>
0
)
{
list
.
clear
()
}
list
.
add
(
context
.
packageName
)
list
.
add
(
PkgSecSpace
.
PACKAGENAME_MIDDLEWARE
)
return
list
}
private
fun
clearProcesses
()
{
val
dam
=
MdmFactoryManager
.
getInstance
().
deviceApplicationManager
//clear task
...
...
@@ -131,4 +114,14 @@ object SwitchOutMdm {
MdmFactoryManager
.
getInstance
().
deviceApplicationManager
.
forceStopPackage
(
name
)
}
}
override
suspend
fun
init
(
context
:
Context
)
{
this
.
context
=
context
MdmFactoryManager
.
getInstance
().
deviceApplicationManager
.
removePersistentApp
(
getPersistentList
(
context
))
recover
()
MdmUtils
.
clearDefaultLauncher
(
context
)
removeDisallowedRunningApp
()
clearProcesses
()
killBackgroundApplication
()
}
}
\ No newline at end of file
lib_common/src/main/java/com/secspace/lib/common/function/WorkManager.kt
View file @
7808bffa
package
com.secspace.lib.common.function
import
android.annotation.TargetApi
import
android.app.Activity
import
android.content.Context
import
android.content.pm.PackageManager
...
...
@@ -8,12 +7,13 @@ import android.os.Build
import
android.os.Handler
import
android.os.Looper
import
android.os.SystemClock
import
com.secspace.lib.common.env.Packages
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.SwitchInMdm.init
import
com.secspace.lib.common.utils.*
import
com.secspace.log.Log
import
com.secspace.mdmengine.api.manager.MdmFactoryManager
import
com.skr.activation.network.linstener.CheckActiveStatusListener
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.GlobalScope
import
kotlinx.coroutines.launch
...
...
@@ -36,7 +36,7 @@ object WorkManager{
mEnterTime
=
SystemClock
.
uptimeMillis
()
//检查中间件是否是最新的
if
(!
DpmHelper
.
getInstance
(
mContext
).
isMiddlewareLatest
)
{
DialogManager
.
getInstance
().
showInstallMiddleWare
(
launcher
)
DialogManager
.
showInstallMiddleWare
(
launcher
)
return
}
...
...
@@ -53,9 +53,11 @@ object WorkManager{
mHandler
.
postDelayed
(
{
enter
(
launcher
)
},
2000
)
return
}
LoadingDialog
.
getInstance
(
launcher
).
show
(
"切换中"
)
GlobalScope
.
launch
(
Dispatchers
.
IO
)
{
i
nit
(
launcher
)
SwitchInMdm
.
onI
nit
(
launcher
)
checkLocalUpdateFile
()
//检查本地更新文件
ActivationHelper
.
checkActivate
(
launcher
,
EduCheckActiveStatusListener
(
launcher
))
}
isChecksCompleted
=
true
Prefs
.
setMdmInitializedWhenEnter
(
mContext
,
true
)
...
...
@@ -63,7 +65,7 @@ object WorkManager{
fun
exit
(
context
:
Context
?){
GlobalScope
.
launch
(
Dispatchers
.
IO
)
{
context
?.
let
{
SwitchOutMdm
.
e
xit
(
it
)
}
context
?.
let
{
SwitchOutMdm
.
onE
xit
(
it
)
}
}
}
...
...
@@ -138,13 +140,35 @@ object WorkManager{
install
(
path
)
}
/**
* 安装增强件
*/
fun
installMdmEnhance
(
silent
:
Boolean
)
{
val
path
=
pathFromAssets
(
SEnvironment
.
getMdmEnhanceNameForAssets
())
FileUtil
.
copyFileFromAssets
(
mContext
,
(
SEnvironment
.
getOuterDirForAssets
()
+
File
.
separator
+
SEnvironment
.
getMdmEnhanceNameForAssets
()),
path
)
install
(
path
)
internal
class
EduCheckActiveStatusListener
(
var
activity
:
Activity
)
:
CheckActiveStatusListener
{
override
fun
needActivate
()
{
Log
.
i
(
TAG
,
"activedFailed: "
)
DialogManager
.
showMessageDialogBySure
(
activity
,
activity
.
getString
(
R
.
string
.
common_remind
),
activity
.
getString
(
R
.
string
.
dialog_tip_activate_lose
),
object
:
DialogManager
.
MessageListener
{
override
fun
onPositive
()
{
IntentUtil
.
startExitService
(
activity
)
}
override
fun
onNegative
()
{
}
})
}
override
fun
trialCodeWillPastDue
()
{
Log
.
i
(
TAG
,
"trialCodeWillPastDue: "
)
}
override
fun
hasActived
()
{
Log
.
i
(
TAG
,
"hasActived: "
)
}
override
fun
serverError
()
{
Log
.
i
(
TAG
,
"serverError: "
)
}
override
fun
onError
(
throwable
:
Throwable
)
{
Log
.
i
(
TAG
,
"onError: "
)
}
}
}
\ No newline at end of file
lib_common/src/main/res/anim/dialogui_enter.xml
0 → 100644
View file @
7808bffa
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<translate
android:fromYDelta=
"100%p"
android:duration=
"400"
/>
</set>
\ No newline at end of file
lib_common/src/main/res/anim/dialogui_enter_center.xml
0 → 100644
View file @
7808bffa
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<alpha
android:fromAlpha=
"1"
android:toAlpha=
"0"
android:duration=
"600"
/>
</set>
\ No newline at end of file
lib_common/src/main/res/anim/dialogui_exit.xml
0 → 100644
View file @
7808bffa
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<translate
android:toYDelta=
"100%p"
android:duration=
"400"
/>
</set>
\ No newline at end of file
lib_common/src/main/res/anim/dialogui_exit_center.xml
0 → 100644
View file @
7808bffa
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<alpha
android:fromAlpha=
"0"
android:toAlpha=
"1"
android:duration=
"600"
/>
</set>
\ No newline at end of file
lib_common/src/main/res/drawable/dialogui_live_divider.xml
0 → 100644
View file @
7808bffa
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<size
android:width=
"1dp"
android:height=
"1dp"
/>
<solid
android:color=
"#eaeaea"
/>
</shape>
\ No newline at end of file
lib_common/src/main/res/drawable/dialogui_rotate_mum.xml
0 → 100644
View file @
7808bffa
<?xml version="1.0" encoding="utf-8"?>
<rotate
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:pivotX=
"50%"
android:pivotY=
"50%"
android:fromDegrees=
"0"
android:toDegrees=
"360"
android:interpolator=
"@android:anim/accelerate_decelerate_interpolator"
>
<bitmap
android:antialias=
"true"
android:filter=
"true"
android:src=
"@drawable/dialogui_spinner_mum"
/>
</rotate>
\ No newline at end of file
lib_common/src/main/res/drawable/dialogui_rotate_mum_light.xml
0 → 100644
View file @
7808bffa
<?xml version="1.0" encoding="utf-8"?>
<rotate
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:pivotX=
"50%"
android:pivotY=
"50%"
android:fromDegrees=
"0"
android:toDegrees=
"360"
android:interpolator=
"@android:anim/accelerate_decelerate_interpolator"
>
<bitmap
android:antialias=
"true"
android:filter=
"true"
android:src=
"@drawable/dialogui_spinner_mum_light"
/>
</rotate>
\ No newline at end of file
lib_common/src/main/res/drawable/dialogui_selector_all.xml
0 → 100644
View file @
7808bffa
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:state_pressed=
"true"
>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<corners
android:radius=
"@dimen/dialogui_round_corner_radius"
/>
<solid
android:color=
"@color/dialogui_btn_pressed"
/>
</shape>
</item>
<item>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<corners
android:radius=
"@dimen/dialogui_round_corner_radius"
/>
<solid
android:color=
"@android:color/white"
/>
</shape>
</item>
</selector>
\ No newline at end of file
lib_common/src/main/res/drawable/dialogui_selector_all_bottom.xml
0 → 100644
View file @
7808bffa
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:state_pressed=
"true"
>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<corners
android:bottomLeftRadius=
"@dimen/dialogui_round_corner_radius"
android:bottomRightRadius=
"@dimen/dialogui_round_corner_radius"
/>
<solid
android:color=
"@color/dialogui_btn_pressed"
/>
</shape>
</item>
<item>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<corners
android:bottomLeftRadius=
"@dimen/dialogui_round_corner_radius"
android:bottomRightRadius=
"@dimen/dialogui_round_corner_radius"
/>
<solid
android:color=
"@android:color/white"
/>
</shape>
</item>
</selector>
\ No newline at end of file
lib_common/src/main/res/drawable/dialogui_selector_all_no.xml
0 → 100644
View file @
7808bffa
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"@color/dialogui_btn_pressed"
android:state_pressed=
"true"
/>
<item
android:drawable=
"@android:color/white"
/>
</selector>
\ No newline at end of file
lib_common/src/main/res/drawable/dialogui_selector_all_top.xml
0 → 100644
View file @
7808bffa
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:state_pressed=
"true"
>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<corners
android:topLeftRadius=
"@dimen/dialogui_round_corner_radius"
android:topRightRadius=
"@dimen/dialogui_round_corner_radius"
/>
<solid
android:color=
"@color/dialogui_btn_pressed"
/>
</shape>
</item>
<item>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<corners
android:topLeftRadius=
"@dimen/dialogui_round_corner_radius"
android:topRightRadius=
"@dimen/dialogui_round_corner_radius"
/>
<solid
android:color=
"@android:color/white"
/>
</shape>
</item>
</selector>
\ No newline at end of file
lib_common/src/main/res/drawable/dialogui_selector_left_bottom.xml
0 → 100644
View file @
7808bffa
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:state_pressed=
"true"
>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<corners
android:bottomLeftRadius=
"@dimen/dialogui_round_corner_radius"
/>
<solid
android:color=
"@color/dialogui_btn_pressed"
/>
</shape>
</item>
<item>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<corners
android:bottomLeftRadius=
"@dimen/dialogui_round_corner_radius"
/>
<solid
android:color=
"@android:color/white"
/>
</shape>
</item>
</selector>
\ No newline at end of file
lib_common/src/main/res/drawable/dialogui_selector_right_bottom.xml
0 → 100644
View file @
7808bffa
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:state_pressed=
"true"
>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<corners
android:bottomRightRadius=
"@dimen/dialogui_round_corner_radius"
/>
<solid
android:color=
"@color/dialogui_btn_pressed"
/>
</shape>
</item>
<item>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<corners
android:bottomRightRadius=
"@dimen/dialogui_round_corner_radius"
/>
<solid
android:color=
"@android:color/white"
/>
</shape>
</item>
</selector>
\ No newline at end of file
lib_common/src/main/res/drawable/dialogui_shape_et_bg.xml
0 → 100644
View file @
7808bffa
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"#ffffff"
/>
<corners
android:radius=
"2dp"
/>
<stroke
android:width=
"1dp"
android:color=
"@color/line_dd"
/>
</shape>
\ No newline at end of file
lib_common/src/main/res/drawable/dialogui_shape_et_cursor.xml
0 → 100644
View file @
7808bffa
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<size
android:width=
"1dp"
/>
<solid
android:color=
"@color/ios_btntext_blue"
/>
</shape>
\ No newline at end of file
lib_common/src/main/res/drawable/dialogui_shape_gray_round_corner.xml
0 → 100644
View file @
7808bffa
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<corners
android:radius=
"@dimen/dialogui_round_corner_radius"
/>
<solid
android:color=
"#66000000"
/>
</shape>
\ No newline at end of file
lib_common/src/main/res/drawable/dialogui_shape_gray_round_l_corner.xml
0 → 100644
View file @
7808bffa
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<corners
android:radius=
"@dimen/dialogui_l_round_corner_radius"
/>
<solid
android:color=
"#99000000"
/>
</shape>
\ No newline at end of file
lib_common/src/main/res/drawable/dialogui_shape_progress.xml
0 → 100644
View file @
7808bffa
<?xml version="1.0" encoding="utf-8"?>
<rotate
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:fromDegrees=
"0"
android:pivotX=
"50%"
android:pivotY=
"50%"
android:toDegrees=
"360"
>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:innerRadiusRatio=
"4"
android:shape=
"ring"
android:thicknessRatio=
"15"
android:useLevel=
"false"
>
<gradient
android:endColor=
"#BFBFBF"
android:startColor=
"#FFFFFF"
android:type=
"sweep"
>
</gradient>
</shape>
</rotate>
\ No newline at end of file
lib_common/src/main/res/drawable/dialogui_shape_progress_light.xml
0 → 100644
View file @
7808bffa
<?xml version="1.0" encoding="utf-8"?>
<rotate
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:fromDegrees=
"0"
android:pivotX=
"50%"
android:pivotY=
"50%"
android:toDegrees=
"360"
>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:innerRadiusRatio=
"4"
android:shape=
"ring"
android:thicknessRatio=
"15"
android:useLevel=
"false"
>
<gradient
android:endColor=
"#414042"
android:startColor=
"#a3a3a3"
android:type=
"sweep"
>
</gradient>
</shape>
</rotate>
\ No newline at end of file
lib_common/src/main/res/drawable/dialogui_shape_wihte_round_corner.xml
0 → 100644
View file @
7808bffa
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<corners
android:radius=
"@dimen/dialogui_round_corner_radius"
/>
<solid
android:color=
"@android:color/white"
/>
</shape>
\ No newline at end of file
lib_common/src/main/res/drawable/dialogui_spinner_mum.png
0 → 100644
View file @
7808bffa
4.85 KB
lib_common/src/main/res/drawable/dialogui_spinner_mum_light.png
0 → 100644
View file @
7808bffa
4.85 KB
lib_common/src/main/res/drawable/dialogui_wheel_val.xml
0 → 100644
View file @
7808bffa
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<gradient
android:angle=
"270"
android:endColor=
"#7066CCFF"
android:startColor=
"#7066CCFF"
/>
<corners
android:topLeftRadius=
"0dip"
android:topRightRadius=
"0dip"
android:bottomLeftRadius=
"0dip"
android:bottomRightRadius=
"0dip"
/>
</shape>
lib_common/src/main/res/layout/dialog_message.xml
0 → 100644
View file @
7808bffa
<?xml version="1.0" encoding="utf-8"?>
<TextView
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:id=
"@+id/tv_message_message"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"15dp"
android:layout_marginTop=
"10dp"
android:layout_marginEnd=
"15dp"
android:layout_marginBottom=
"10dp"
android:gravity=
"center"
android:lineSpacingExtra=
"4dp"
android:textColor=
"#333333"
android:textSize=
"14sp"
tools:text=
"内容"
/>
\ No newline at end of file
lib_common/src/main/res/layout/dialogui_holder_alert.xml
0 → 100644
View file @
7808bffa
<?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=
"wrap_content"
android:background=
"@drawable/dialogui_shape_wihte_round_corner"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/dialogui_tv_title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:gravity=
"center"
android:maxLines=
"3"
android:paddingLeft=
"40dp"
android:paddingRight=
"40dp"
android:paddingTop=
"12dp"
android:text=
""
android:textColor=
"@color/text_title_11"
android:textSize=
"@dimen/dialogui_title_txt_size"
android:textStyle=
"bold"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:paddingTop=
"12dp"
>
<TextView
android:id=
"@+id/dialogui_tv_msg"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:minHeight=
"60dp"
android:paddingBottom=
"15dp"
android:paddingLeft=
"30dp"
android:paddingRight=
"30dp"
android:paddingTop=
"5dp"
android:text=
""
android:textColor=
"@color/text_msg_33"
android:textSize=
"@dimen/dialogui_msg_txt_size"
/>
<EditText
android:id=
"@+id/et_1"
android:layout_width=
"match_parent"
android:layout_height=
"35dp"
android:layout_marginBottom=
"15dp"
android:layout_marginLeft=
"20dp"
android:layout_marginRight=
"20dp"
android:layout_marginTop=
"5dp"
android:background=
"@drawable/dialogui_shape_et_bg"
android:cursorVisible=
"true"
android:maxLines=
"1"
android:paddingLeft=
"5dp"
android:paddingRight=
"5dp"
android:textColor=
"@color/text_input_44"
android:textCursorDrawable=
"@drawable/dialogui_shape_et_cursor"
android:textSize=
"@dimen/dialogui_input_txt_size"
/>
<EditText
android:id=
"@+id/et_2"
android:layout_width=
"match_parent"
android:layout_height=
"35dp"
android:layout_marginBottom=
"15dp"
android:layout_marginLeft=
"20dp"
android:layout_marginRight=
"20dp"
android:background=
"@drawable/dialogui_shape_et_bg"
android:cursorVisible=
"true"
android:maxLines=
"1"
android:paddingLeft=
"5dp"
android:paddingRight=
"5dp"
android:textColor=
"@color/text_input_44"
android:textCursorDrawable=
"@drawable/dialogui_shape_et_cursor"
android:textSize=
"@dimen/dialogui_input_txt_size"
/>
</LinearLayout>
<View
android:id=
"@+id/line"
android:layout_width=
"match_parent"
android:layout_height=
"1px"
android:background=
"@color/line_dd"
/>
<LinearLayout
android:id=
"@+id/ll_container_horizontal"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:minHeight=
"48dp"
android:orientation=
"horizontal"
>
<Button
android:id=
"@+id/btn_1"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"@drawable/dialogui_selector_left_bottom"
android:gravity=
"center"
android:padding=
"5dp"
android:text=
"1"
android:textColor=
"@color/ios_btntext_blue"
android:textSize=
"@dimen/dialogui_btn_txt_size"
/>
<View
android:id=
"@+id/line_btn2"
android:layout_width=
"1px"
android:layout_height=
"match_parent"
android:background=
"@color/line_dd"
/>
<Button
android:id=
"@+id/btn_2"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"@drawable/dialogui_selector_all_no"
android:gravity=
"center"
android:minHeight=
"48dp"
android:padding=
"5dp"
android:text=
"2"
android:textColor=
"@color/ios_btntext_blue"
android:textSize=
"@dimen/dialogui_btn_txt_size"
/>
<View
android:id=
"@+id/line_btn3"
android:layout_width=
"1px"
android:layout_height=
"match_parent"
android:background=
"@color/line_dd"
/>
<Button
android:id=
"@+id/btn_3"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"@drawable/dialogui_selector_right_bottom"
android:gravity=
"center"
android:minHeight=
"48dp"
android:padding=
"5dp"
android:text=
"3"
android:textColor=
"@color/ios_btntext_blue"
android:textSize=
"@dimen/dialogui_btn_txt_size"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_container_vertical"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:minHeight=
"48dp"
android:orientation=
"vertical"
android:visibility=
"gone"
>
<Button
android:id=
"@+id/btn_1_vertical"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:background=
"@drawable/dialogui_selector_all_no"
android:gravity=
"center"
android:minHeight=
"48dp"
android:padding=
"5dp"
android:text=
"1"
android:textColor=
"@color/ios_btntext_blue"
android:textSize=
"@dimen/dialogui_btn_txt_size"
/>
<View
android:id=
"@+id/line_btn2_vertical"
android:layout_width=
"match_parent"
android:layout_height=
"1px"
android:background=
"@color/line_dd"
/>
<Button
android:id=
"@+id/btn_2_vertical"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:background=
"@drawable/dialogui_selector_all_no"
android:gravity=
"center"
android:minHeight=
"48dp"
android:padding=
"5dp"
android:text=
"2"
android:textColor=
"@color/ios_btntext_blue"
android:textSize=
"@dimen/dialogui_btn_txt_size"
/>
<View
android:id=
"@+id/line_btn3_vertical"
android:layout_width=
"match_parent"
android:layout_height=
"1px"
android:background=
"@color/line_dd"
/>
<Button
android:id=
"@+id/btn_3_vertical"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:background=
"@drawable/dialogui_selector_all_bottom"
android:gravity=
"center"
android:minHeight=
"48dp"
android:padding=
"5dp"
android:text=
"3"
android:textColor=
"@color/ios_btntext_blue"
android:textSize=
"@dimen/dialogui_btn_txt_size"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
lib_common/src/main/res/layout/dialogui_loading_horizontal.xml
0 → 100644
View file @
7808bffa
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
>
<LinearLayout
android:id=
"@+id/dialogui_ll_bg"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:background=
"@drawable/dialogui_shape_wihte_round_corner"
android:baselineAligned=
"false"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
android:paddingBottom=
"14dip"
android:paddingLeft=
"8dip"
android:paddingRight=
"8dip"
android:paddingTop=
"14dip"
>
<ProgressBar
android:id=
"@+id/pb_bg"
android:layout_width=
"32dp"
android:layout_height=
"32dp"
android:layout_marginRight=
"8dp"
android:indeterminate=
"true"
android:indeterminateDrawable=
"@drawable/dialogui_shape_progress"
android:indeterminateDuration=
"1200"
android:max=
"10000"
/>
<TextView
android:id=
"@+id/dialogui_tv_msg"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:ellipsize=
"end"
android:maxLines=
"1"
android:maxWidth=
"@dimen/dialogui_max_with"
android:text=
""
android:textColor=
"#222222"
android:textSize=
"@dimen/dialogui_msg_txt_size"
/>
</LinearLayout>
</FrameLayout>
\ No newline at end of file
lib_common/src/main/res/layout/dialogui_loading_vertical.xml
0 → 100644
View file @
7808bffa
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<LinearLayout
android:id=
"@+id/dialogui_ll_bg"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:background=
"@drawable/dialogui_shape_wihte_round_corner"
android:gravity=
"center"
android:minHeight=
"120dp"
android:minWidth=
"120dp"
android:orientation=
"vertical"
>
<ProgressBar
android:id=
"@+id/pb_bg"
android:layout_width=
"32dp"
android:layout_height=
"32dp"
android:layout_gravity=
"center_horizontal"
android:indeterminateDrawable=
"@drawable/dialogui_rotate_mum_light"
android:indeterminateDuration=
"1200"
/>
<TextView
android:id=
"@+id/dialogui_tv_msg"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerHorizontal=
"true"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"10dp"
android:ellipsize=
"end"
android:maxLines=
"1"
android:maxWidth=
"300dp"
android:paddingLeft=
"20dp"
android:paddingRight=
"20dp"
android:text=
"加载中..."
android:textColor=
"@color/text_black"
/>
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
lib_common/src/main/res/layout/dialogui_toast.xml
0 → 100644
View file @
7808bffa
<?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:background=
"@drawable/dialogui_shape_gray_round_l_corner"
android:orientation=
"vertical"
>
<TextView
android:id=
"@android:id/message"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_weight=
"1"
android:layout_margin=
"@dimen/dialogui_margin_smid"
android:fontFamily=
"sans-serif-condensed"
android:shadowColor=
"#BB000000"
android:shadowRadius=
"2.75"
android:textColor=
"#ffffffff"
android:textSize=
"13sp"
android:textStyle=
"normal"
/>
</LinearLayout>
\ No newline at end of file
lib_common/src/main/res/values/strings.xml
View file @
7808bffa
...
...
@@ -38,4 +38,5 @@
<string
name=
"exit_btn"
>
退出
</string>
<string
name=
"btn_input_code"
>
输入激活码
</string>
<string
name=
"dialog_tip_activate_lose"
>
您的激活已失效,如有疑问请致电4008265936
</string>
</resources>
lib_common/src/main/res/values/values.xml
0 → 100644
View file @
7808bffa
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color
name=
"bg_white"
>
#ffffff
</color>
<color
name=
"btn_alert"
>
#222222
</color>
<color
name=
"color_text_black"
>
#4c4c4c
</color>
<color
name=
"color_tie_bg"
>
#efeff4
</color>
<color
name=
"color_tie_normal"
>
#ffffff
</color>
<color
name=
"color_tie_select"
>
#efeff4
</color>
<color
name=
"datepick_surance_blue"
>
#3598da
</color>
<color
name=
"dialogui_btn_normal"
>
#ffffff
</color>
<color
name=
"dialogui_btn_pressed"
>
#eeeeee
</color>
<color
name=
"ios_btntext_blue"
>
#007aff
</color>
<color
name=
"line_dd"
>
#dddddd
</color>
<color
name=
"text_black"
>
#333333
</color>
<color
name=
"text_black_light"
>
#666666
</color>
<color
name=
"text_gray"
>
#999999
</color>
<color
name=
"text_gray_light"
>
#B3B3B3
</color>
<color
name=
"text_input_44"
>
#444444
</color>
<color
name=
"text_item_33"
>
#333333
</color>
<color
name=
"text_msg_33"
>
#333333
</color>
<color
name=
"text_title_11"
>
#111111
</color>
<dimen
name=
"dialogui_btn_txt_size"
>
14sp
</dimen>
<dimen
name=
"dialogui_height_mid"
>
48dp
</dimen>
<dimen
name=
"dialogui_input_txt_size"
>
14sp
</dimen>
<dimen
name=
"dialogui_item_txt_size"
>
14sp
</dimen>
<dimen
name=
"dialogui_l_round_corner_radius"
>
10dp
</dimen>
<dimen
name=
"dialogui_line_with"
>
1dp
</dimen>
<dimen
name=
"dialogui_margin_mid"
>
16dp
</dimen>
<dimen
name=
"dialogui_margin_small"
>
8dp
</dimen>
<dimen
name=
"dialogui_margin_smid"
>
14dp
</dimen>
<dimen
name=
"dialogui_max_with"
>
360dp
</dimen>
<dimen
name=
"dialogui_msg_txt_size"
>
14sp
</dimen>
<dimen
name=
"dialogui_round_corner_radius"
>
5dp
</dimen>
<dimen
name=
"dialogui_title_txt_size"
>
17sp
</dimen>
<dimen
name=
"dialogui_toast_margin"
>
64dp
</dimen>
<style
name=
"dialogui_bottom_style"
parent=
"android:Animation"
>
<item
name=
"@android:windowEnterAnimation"
>
@anim/dialogui_enter
</item>
//进入时的动画
<item
name=
"@android:windowExitAnimation"
>
@anim/dialogui_exit
</item>
//退出时的动画
</style>
<style
name=
"dialogui_center_style"
parent=
"android:Animation"
>
<item
name=
"@android:windowEnterAnimation"
>
@anim/dialogui_enter_center
</item>
</style>
<style
name=
"dialogui_datepick_FontStyleNormalLightBlackMiddle"
parent=
"@android:style/TextAppearance"
>
<item
name=
"android:textStyle"
>
normal
</item>
<item
name=
"android:textColor"
>
#ff333333
</item>
<item
name=
"android:textSize"
>
16sp
</item>
</style>
<style
name=
"dialogui_datepick_dialog_untran"
parent=
"dialogui_datepick_tran"
>
<item
name=
"android:backgroundDimEnabled"
>
true
</item>
</style>
<style
name=
"dialogui_datepick_fontstyle_normal_blackmiddle"
parent=
"@android:style/TextAppearance"
>
<item
name=
"android:textStyle"
>
normal
</item>
<item
name=
"android:textColor"
>
#000000
</item>
<item
name=
"android:textSize"
>
14sp
</item>
</style>
<style
name=
"dialogui_datepick_fontstyle_normal_bluemiddle"
parent=
"@android:style/TextAppearance"
>
<item
name=
"android:textStyle"
>
normal
</item>
<item
name=
"android:textColor"
>
@color/datepick_surance_blue
</item>
<item
name=
"android:textSize"
>
14sp
</item>
</style>
<style
name=
"dialogui_datepick_tran"
parent=
"android:style/Theme.Dialog"
>
<item
name=
"android:windowFrame"
>
@null
</item>
<item
name=
"android:windowNoTitle"
>
true
</item>
<item
name=
"android:windowBackground"
>
@android:color/transparent
</item>
<item
name=
"android:windowIsFloating"
>
true
</item>
<item
name=
"android:windowContentOverlay"
>
@null
</item>
<item
name=
"android:windowIsTranslucent"
>
true
</item>
<item
name=
"android:backgroundDimEnabled"
>
false
</item>
<item
name=
"android:backgroundDimAmount"
>
0.4
</item>
</style>
</resources>
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