Browse Source

Merge pull request #113 in DESIGN/design from ~VITO/c-design:feature/10.0 to feature/10.0

* commit '3e22fd854ea0a01a11a24cd2fad994b3707e66d7':
  REPORT-8393 换新动画
master
superman 6 years ago
parent
commit
fc2df10acc
  1. BIN
      designer-realize/src/com/fr/design/images/splash_10.gif
  2. 3
      designer-realize/src/com/fr/start/SplashContext.java
  3. 6
      designer-realize/src/com/fr/start/fx/SplashFxWindow.java
  4. 12
      designer-realize/src/com/fr/start/jni/SplashMac.java

BIN
designer-realize/src/com/fr/design/images/splash_10.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 MiB

After

Width:  |  Height:  |  Size: 21 MiB

3
designer-realize/src/com/fr/start/SplashContext.java

@ -23,6 +23,9 @@ import java.util.concurrent.TimeUnit;
*/ */
public class SplashContext { public class SplashContext {
public static final String SPLASH_PATH = "/com/fr/design/images/splash_10.gif";
public static final String SPLASH_CACHE_NAME = "splash_10.gif";
private static final SplashContext SPLASH_CONTEXT = new SplashContext(); private static final SplashContext SPLASH_CONTEXT = new SplashContext();
private SplashStrategy splashStrategy; private SplashStrategy splashStrategy;

6
designer-realize/src/com/fr/start/fx/SplashFxWindow.java

@ -3,6 +3,7 @@ package com.fr.start.fx;
import com.bulenkov.iconloader.util.JBUI; import com.bulenkov.iconloader.util.JBUI;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.fr.start.SplashContext;
import javafx.application.Application; import javafx.application.Application;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.scene.Scene; import javafx.scene.Scene;
@ -37,9 +38,8 @@ public class SplashFxWindow extends Application {
private static final int WINDOW_WIDTH = 640; private static final int WINDOW_WIDTH = 640;
private static final int WINDOW_HEIGHT = 360; private static final int WINDOW_HEIGHT = 360;
private static final int FONT = 12; private static final int FONT = 12;
private static final int FRAME_COUNT = 254; private static final int FRAME_COUNT = 315;
private static final String THINKS_COLOR = "#82b1ce"; private static final String THINKS_COLOR = "#82b1ce";
private static final String SPLASH_PATH = "/com/fr/design/images/splash_10.gif";
private static final CountDownLatch LATCH = new CountDownLatch(1); private static final CountDownLatch LATCH = new CountDownLatch(1);
private static SplashFxWindow app = null; private static SplashFxWindow app = null;
@ -78,7 +78,7 @@ public class SplashFxWindow extends Application {
public void start(Stage primaryStage) { public void start(Stage primaryStage) {
AnchorPane root = new AnchorPane(); AnchorPane root = new AnchorPane();
primaryStage.initStyle(StageStyle.TRANSPARENT); primaryStage.initStyle(StageStyle.TRANSPARENT);
Image image = new FastGifImage(SPLASH_PATH, FRAME_COUNT, WINDOW_WIDTH, WINDOW_HEIGHT); Image image = new FastGifImage(SplashContext.SPLASH_PATH, FRAME_COUNT, WINDOW_WIDTH, WINDOW_HEIGHT);
ImageView gif = new ImageView(image); ImageView gif = new ImageView(image);

12
designer-realize/src/com/fr/start/jni/SplashMac.java

@ -22,8 +22,6 @@ import java.io.InputStream;
*/ */
public class SplashMac implements SplashStrategy { public class SplashMac implements SplashStrategy {
private static final String SPLASH_CACHE_NAME = "splash_10.gif";
private static final String SPLASH_PATH = "/com/fr/design/images/splash_10.gif";
private SplashJNI jni; private SplashJNI jni;
@ -38,12 +36,12 @@ public class SplashMac implements SplashStrategy {
*/ */
private static String loadResFromJar() { private static String loadResFromJar() {
File tempLib = null; File tempLib = null;
try (InputStream inputStream = SplashContext.class.getResourceAsStream(SplashMac.SPLASH_PATH)) { try (InputStream inputStream = SplashContext.class.getResourceAsStream(SplashContext.SPLASH_PATH)) {
if (inputStream == null) { if (inputStream == null) {
FRContext.getLogger().error("Unable to copy " + SplashMac.SPLASH_PATH + " from jar file."); FRContext.getLogger().error("Unable to copy " + SplashContext.SPLASH_PATH + " from jar file.");
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }
tempLib = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), SPLASH_CACHE_NAME)); tempLib = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), SplashContext.SPLASH_CACHE_NAME));
byte[] buffer = new byte[1024]; byte[] buffer = new byte[1024];
int read = -1; int read = -1;
try (FileOutputStream fileOutputStream = new FileOutputStream(tempLib)) { try (FileOutputStream fileOutputStream = new FileOutputStream(tempLib)) {
@ -57,14 +55,14 @@ public class SplashMac implements SplashStrategy {
tempLib.deleteOnExit(); tempLib.deleteOnExit();
} }
// 直接抛异常 // 直接抛异常
throw new RuntimeException("Unable to copy " + SplashMac.SPLASH_PATH + " from jar file."); throw new RuntimeException("Unable to copy " + SplashContext.SPLASH_PATH + " from jar file.");
} }
} }
@Override @Override
public void show() { public void show() {
if (jni != null) { if (jni != null) {
File splash = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), SPLASH_CACHE_NAME)); File splash = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), SplashContext.SPLASH_CACHE_NAME));
String path = splash.exists() ? splash.getAbsolutePath() : loadResFromJar(); String path = splash.exists() ? splash.getAbsolutePath() : loadResFromJar();
jni.show(path); jni.show(path);
} }

Loading…
Cancel
Save