Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix iOS Java version validation #218

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/main/java/gdx/liftoff/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,10 @@ public static boolean validateUserProjectData() {
return false;
}

if (UserData.platforms.contains("ios") && !"7".equals(UserData.javaVersion) && !"8".equals(UserData.javaVersion)) {
return false;
}

return true;
}

Expand Down
6 changes: 6 additions & 0 deletions src/main/java/gdx/liftoff/ui/panels/PathsPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ private void updateDeleteProjectPathButton() {
}

public void updateError() {
if (UserData.platforms.contains("ios") && !"7".equals(UserData.javaVersion) && !"8".equals(UserData.javaVersion)) {
errorLabel.restart(prop.getProperty("iosWrongJavaVersion"));
errorLabel.skipToTheEnd();
return;
}

if (UserData.projectPath == null || UserData.projectPath.isEmpty()) {
errorLabel.restart(prop.getProperty("nullDirectory"));
errorLabel.skipToTheEnd();
Expand Down
13 changes: 9 additions & 4 deletions src/main/java/gdx/liftoff/ui/panels/SettingsPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.ray3k.stripe.PopTable;
import com.ray3k.stripe.PopTable.TableShowHideListener;
import gdx.liftoff.ui.UserData;
import gdx.liftoff.ui.dialogs.FullscreenDialog;
import gdx.liftoff.ui.dialogs.GradleDialog;

import static gdx.liftoff.Main.*;
Expand Down Expand Up @@ -40,14 +41,18 @@ public void populate(boolean fullscreen) {
onChange(libgdxTextField, () -> UserData.libgdxVersion = libgdxTextField.getText());

//java version
if(UserData.platforms.contains("ios") && !"7".equals(UserData.javaVersion))
UserData.javaVersion = "8";
TextField javaTextField = addField(prop.getProperty("javaVersion"),
prop.getProperty("javaVersionTip"), UserData.javaVersion, table);
onChange(javaTextField, () -> {
if(UserData.platforms.contains("ios") && !"7".equals(javaTextField.getText()))
javaTextField.setText("8");
UserData.javaVersion = javaTextField.getText();
if (FullscreenDialog.fullscreenDialog != null) {
FullscreenDialog.fullscreenDialog.updatePathsError();
FullscreenDialog.fullscreenDialog.updateGenerateButtons();
}
if (root.settingsTable != null) {
root.settingsTable.updateError();
root.settingsTable.updateGenerateButton();
}
});

//application version
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/ui-data/nls.properties
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,7 @@ notEmpty={SICK=0.35;0.4}{GRADIENT=FIREBRICK;SCARLET;1.1;7.0}%s name cannot be em
nameNotValid={SICK=0.35;0.4}{GRADIENT=FIREBRICK;SCARLET;1.1;7.0}Project name must contain at least one alphanumeric char, and cannot contain a colon ( : ).{ENDGRADIENT}{ENDSICK}
classNotValid={SICK=0.35;0.4}{GRADIENT=FIREBRICK;SCARLET;1.1;7.0}Main class name is not a valid Java identifier.{ENDGRADIENT}{ENDSICK}
packageNotValid={SICK=0.35;0.4}{GRADIENT=FIREBRICK;SCARLET;1.1;7.0}Package name is not a valid Java package, or lacks a dot ( . ).{ENDGRADIENT}{ENDSICK}
iosWrongJavaVersion={SICK=0.35;0.4}{GRADIENT=FIREBRICK;SCARLET;1.1;7.0}Java version must be 7 or 8 for iOS compatibility.{ENDGRADIENT}{ENDSICK}
nullDirectory={SICK=0.35;0.4}{GRADIENT=FIREBRICK;SCARLET;1.1;7.0}A project path must be selected.{ENDGRADIENT}{ENDSICK}
notDirectory={SICK=0.35;0.4}{GRADIENT=FIREBRICK;SCARLET;1.1;7.0}Selected destination is not a directory.{ENDGRADIENT}{ENDSICK}
sdkNullDirectory={SICK=0.35;0.4}{GRADIENT=FIREBRICK;SCARLET;1.1;7.0}An Android SDK path must be selected for Android projects.{ENDGRADIENT}{ENDSICK}
Expand Down
Loading