Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fastdevelop
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
高超
fastdevelop
Commits
6ae24f86
Commit
6ae24f86
authored
Mar 05, 2020
by
gao.chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码整理
parent
dbd4a432
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
98 additions
and
25 deletions
+98
-25
app/src/main/java/com/mayi/demo/page/BaseStartActivity.java
+1
-1
app/src/main/java/com/mayi/demo/page/UserManager.kt
+24
-24
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BaseDialogFragment.java
+66
-0
fastDevelop/src/main/res/values/styles.xml
+7
-0
No files found.
app/src/main/java/com/mayi/demo/page/BaseStartActivity.java
View file @
6ae24f86
...
@@ -40,7 +40,7 @@ public abstract class BaseStartActivity<T extends BaseActivity, T1 extends BaseA
...
@@ -40,7 +40,7 @@ public abstract class BaseStartActivity<T extends BaseActivity, T1 extends BaseA
gotoActivityAndFinish
(
getLoginActivity
());
gotoActivityAndFinish
(
getLoginActivity
());
}
else
{
}
else
{
// 有本地缓存 免登录 直接到首页
// 有本地缓存 免登录 直接到首页
UserManager
.
getUserInfo
();
UserManager
.
INSTANCE
.
getUserInfo
();
gotoActivityAndFinish
(
getMainActivity
());
gotoActivityAndFinish
(
getMainActivity
());
}
}
}
}
...
...
app/src/main/java/com/mayi/demo/page/UserManager.
java
→
app/src/main/java/com/mayi/demo/page/UserManager.
kt
View file @
6ae24f86
package
com
.
mayi
.
demo
.
page
;
package
com.mayi.demo.page
import
android.text.TextUtils
;
import
android.text.TextUtils
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
import
com.mayi.fastdevelop.comnon.Key
;
import
com.mayi.fastdevelop.comnon.Key
import
com.mayi.fastdevelop.util.SpUtil
;
import
com.mayi.fastdevelop.util.SpUtil
public
class
UserManager
{
object
UserManager
{
private
static
UserInfo
userInfo
;
private
var
userInfo
:
UserInfo
?
=
null
/**
/**
* 获取本地的用户信息
* 获取本地的用户信息
*
*
* @return 用户信息
* @return 用户信息
*/
*/
public
static
UserInfo
getUserInfo
()
{
fun
getUserInfo
():
UserInfo
?
{
if
(
userInfo
==
null
)
{
if
(
userInfo
==
null
)
{
synchronized
(
UserManager
.
class
)
{
synchronized
(
UserManager
::
class
.
java
)
{
if
(
userInfo
==
null
)
{
if
(
userInfo
==
null
)
{
String
s
=
SpUtil
.
get
(
Key
.
USER_INFO
,
""
);
val
s
=
SpUtil
.
get
(
Key
.
USER_INFO
,
""
)
if
(!
TextUtils
.
isEmpty
(
s
))
{
if
(!
TextUtils
.
isEmpty
(
s
))
{
userInfo
=
JSON
.
parseObject
(
s
,
UserInfo
.
class
);
userInfo
=
JSON
.
parseObject
(
s
,
UserInfo
::
class
.
java
)
}
}
}
}
}
}
}
}
return
userInfo
;
return
userInfo
}
}
/**
/**
...
@@ -34,11 +34,11 @@ public class UserManager {
...
@@ -34,11 +34,11 @@ public class UserManager {
*
*
* @param json
* @param json
*/
*/
public
static
void
setUserInfo
(
String
json
)
{
fun
setUserInfo
(
json
:
String
)
{
if
(!
TextUtils
.
isEmpty
(
json
))
{
if
(!
TextUtils
.
isEmpty
(
json
))
{
synchronized
(
UserManager
.
class
)
{
synchronized
(
UserManager
::
class
.
java
)
{
SpUtil
.
set
(
Key
.
USER_INFO
,
json
)
;
SpUtil
.
set
(
Key
.
USER_INFO
,
json
)
userInfo
=
JSON
.
parseObject
(
json
,
UserInfo
.
class
);
userInfo
=
JSON
.
parseObject
(
json
,
UserInfo
::
class
.
java
)
}
}
}
}
}
}
...
@@ -48,11 +48,11 @@ public class UserManager {
...
@@ -48,11 +48,11 @@ public class UserManager {
*
*
* @param userInfo
* @param userInfo
*/
*/
public
static
void
setUserInfo
(
UserInfo
userInfo
)
{
fun
setUserInfo
(
userInfo
:
UserInfo
?
)
{
if
(
userInfo
!=
null
)
{
if
(
userInfo
!=
null
)
{
synchronized
(
UserManager
.
class
)
{
synchronized
(
UserManager
::
class
.
java
)
{
SpUtil
.
set
(
Key
.
USER_INFO
,
JSON
.
toJSONString
(
userInfo
))
;
SpUtil
.
set
(
Key
.
USER_INFO
,
JSON
.
toJSONString
(
userInfo
))
UserManager
.
userInfo
=
userInfo
;
UserManager
.
userInfo
=
userInfo
}
}
}
}
}
}
...
@@ -60,10 +60,10 @@ public class UserManager {
...
@@ -60,10 +60,10 @@ public class UserManager {
/**
/**
* 清除用户信息
* 清除用户信息
*/
*/
public
static
void
clearUserInfo
()
{
fun
clearUserInfo
()
{
synchronized
(
UserManager
.
class
)
{
synchronized
(
UserManager
::
class
.
java
)
{
SpUtil
.
set
(
Key
.
USER_INFO
,
null
)
;
SpUtil
.
set
(
Key
.
USER_INFO
,
null
)
userInfo
=
null
;
userInfo
=
null
}
}
}
}
}
}
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BaseDialogFragment.java
0 → 100644
View file @
6ae24f86
package
com
.
mayi
.
fastdevelop
.
base
;
import
android.app.Dialog
;
import
android.os.Bundle
;
import
androidx.annotation.Nullable
;
import
androidx.fragment.app.DialogFragment
;
import
com.mayi.fastdevelop.R
;
import
com.mayi.fastdevelop.util.LogUtils
;
import
com.mayi.fastdevelop.util.ToastUtil
;
import
com.mayi.fastdevelop.view.LoadingDialog
;
public
class
BaseDialogFragment
extends
DialogFragment
{
private
String
TAG
=
getClass
().
getSimpleName
();
public
void
logI
(
String
msg
)
{
LogUtils
.
i
(
TAG
+
" "
+
msg
);
}
public
void
showToast
(
String
msg
)
{
ToastUtil
.
show
(
getContext
(),
msg
);
}
private
Dialog
dialog
;
public
void
showLoading
()
{
if
(
dialog
==
null
)
{
dialog
=
LoadingDialog
.
init
(
getContext
()).
setCanTouchOutsideCancel
(
true
).
show
();
}
else
{
dialog
.
setCanceledOnTouchOutside
(
true
);
dialog
.
setCancelable
(
true
);
dialog
.
show
();
}
}
public
void
showLoading
(
boolean
canTouchOutsideCancel
)
{
if
(
dialog
==
null
)
{
dialog
=
LoadingDialog
.
init
(
getContext
()).
setCanTouchOutsideCancel
(
canTouchOutsideCancel
).
show
();
}
else
{
dialog
.
setCanceledOnTouchOutside
(
canTouchOutsideCancel
);
dialog
.
setCancelable
(
canTouchOutsideCancel
);
dialog
.
show
();
}
}
public
void
dismssLoading
()
{
if
(
dialog
!=
null
)
{
dialog
.
dismiss
();
}
}
@Override
public
void
onDestroyView
()
{
dismssLoading
();
super
.
onDestroyView
();
}
@Override
public
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setStyle
(
STYLE_NORMAL
,
R
.
style
.
Dialog_FullScreen
);
}
}
fastDevelop/src/main/res/values/styles.xml
View file @
6ae24f86
<resources>
<resources>
<style
name=
"Dialog.FullScreen"
parent=
"Theme.AppCompat.Dialog"
>
<item
name=
"android:windowNoTitle"
>
true
</item>
<item
name=
"android:windowBackground"
>
@color/transparent
</item>
<item
name=
"android:windowIsFloating"
>
false
</item>
</style>
<style
name=
"AppThemeLaunch"
parent=
"AppTheme"
>
<style
name=
"AppThemeLaunch"
parent=
"AppTheme"
>
<item
name=
"android:windowBackground"
>
@mipmap/bg_launch
</item>
<item
name=
"android:windowBackground"
>
@mipmap/bg_launch
</item>
<item
name=
"android:windowFullscreen"
>
false
</item>
<item
name=
"android:windowFullscreen"
>
false
</item>
<item
name=
"android:windowNoTitle"
>
true
</item>
<item
name=
"android:windowNoTitle"
>
true
</item>
<item
name=
"android:windowActionBar"
>
false
</item>
<item
name=
"android:windowActionBar"
>
false
</item>
<item
name=
"windowActionBar"
>
false
</item>
<item
name=
"windowNoTitle"
>
true
</item>
</style>
</style>
<!-- Base application theme. -->
<!-- Base application theme. -->
...
...
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