|
|
@ -34,7 +34,7 @@ public class SplashContext { |
|
|
|
private static final String GUEST = getRandomUser(); |
|
|
|
private static final String GUEST = getRandomUser(); |
|
|
|
|
|
|
|
|
|
|
|
private ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); |
|
|
|
private ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); |
|
|
|
|
|
|
|
|
|
|
|
private Listener<String> listener; |
|
|
|
private Listener<String> listener; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -43,7 +43,7 @@ public class SplashContext { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private SplashContext() { |
|
|
|
private SplashContext() { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -57,18 +57,18 @@ public class SplashContext { |
|
|
|
* 展示启动动画 |
|
|
|
* 展示启动动画 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void show() { |
|
|
|
public void show() { |
|
|
|
|
|
|
|
splashStrategy.show(); |
|
|
|
//监听
|
|
|
|
//监听
|
|
|
|
initListener(); |
|
|
|
initListener(); |
|
|
|
splashStrategy.show(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 隐藏启动动画 |
|
|
|
* 隐藏启动动画 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void hide() { |
|
|
|
public void hide() { |
|
|
|
|
|
|
|
splashStrategy.hide(); |
|
|
|
//取消监听
|
|
|
|
//取消监听
|
|
|
|
EventDispatcher.stopListen(listener); |
|
|
|
EventDispatcher.stopListen(listener); |
|
|
|
splashStrategy.hide(); |
|
|
|
|
|
|
|
// 窗口关闭后取消定时获取模块信息的timer
|
|
|
|
// 窗口关闭后取消定时获取模块信息的timer
|
|
|
|
scheduler.shutdown(); |
|
|
|
scheduler.shutdown(); |
|
|
|
// 一次性
|
|
|
|
// 一次性
|
|
|
@ -83,19 +83,18 @@ public class SplashContext { |
|
|
|
updateModuleLog(moduleID.isEmpty() ? StringUtils.EMPTY : moduleID + loading[loadingIndex % 3]); |
|
|
|
updateModuleLog(moduleID.isEmpty() ? StringUtils.EMPTY : moduleID + loading[loadingIndex % 3]); |
|
|
|
} |
|
|
|
} |
|
|
|
}, 0, 300, TimeUnit.MILLISECONDS); |
|
|
|
}, 0, 300, TimeUnit.MILLISECONDS); |
|
|
|
|
|
|
|
|
|
|
|
listener = new Listener<String>() { |
|
|
|
listener = new Listener<String>() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void on(Event event, String i18n) { |
|
|
|
public void on(Event event, String i18n) { |
|
|
|
|
|
|
|
showThanks(); |
|
|
|
moduleID = i18n; |
|
|
|
moduleID = i18n; |
|
|
|
loadingIndex++; |
|
|
|
loadingIndex++; |
|
|
|
updateModuleLog(moduleID.isEmpty() ? StringUtils.EMPTY : moduleID + loading[loadingIndex % 3]); |
|
|
|
updateModuleLog(moduleID.isEmpty() ? StringUtils.EMPTY : moduleID + loading[loadingIndex % 3]); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
EventDispatcher.listen(ModuleEvent.MajorModuleStarting, listener); |
|
|
|
EventDispatcher.listen(ModuleEvent.MajorModuleStarting, listener); |
|
|
|
showThanks(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void updateModuleLog(String text) { |
|
|
|
private void updateModuleLog(String text) { |
|
|
|