14
14
* Email:crazycodeboy@gmail.com
15
15
*/
16
16
public class SplashScreen {
17
- private static int NULL_ID = 0 ;
18
17
private static Dialog mSplashDialog ;
19
18
private static WeakReference <Activity > mActivity ;
20
19
21
20
/**
22
21
* 打开启动屏
23
22
*/
24
- public static void show (final Activity activity , final boolean fullScreen , final int themeResId ) {
23
+ public static void show (final Activity activity , final int themeResId ) {
25
24
if (activity == null ) return ;
26
25
mActivity = new WeakReference <Activity >(activity );
27
26
activity .runOnUiThread (new Runnable () {
28
27
@ Override
29
28
public void run () {
30
29
if (!activity .isFinishing ()) {
31
-
32
- mSplashDialog = new Dialog (
33
- activity ,
34
- themeResId != NULL_ID ? themeResId
35
- : fullScreen ? R .style .SplashScreen_Fullscreen
36
- : R .style .SplashScreen_SplashTheme
37
- );
30
+ mSplashDialog = new Dialog (activity , themeResId );
38
31
mSplashDialog .setContentView (R .layout .launch_screen );
39
32
mSplashDialog .setCancelable (false );
40
33
@@ -50,7 +43,9 @@ public void run() {
50
43
* 打开启动屏
51
44
*/
52
45
public static void show (final Activity activity , final boolean fullScreen ) {
53
- show (activity , fullScreen , 0 );
46
+ int resourceId = fullScreen ? R .style .SplashScreen_Fullscreen : R .style .SplashScreen_SplashTheme ;
47
+
48
+ show (activity , resourceId );
54
49
}
55
50
56
51
/**
0 commit comments