mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
fix NPE and update keyboard visibility
This commit is contained in:
@@ -159,7 +159,6 @@ public class Forge implements ApplicationListener {
|
|||||||
public void create() {
|
public void create() {
|
||||||
//install our error handler
|
//install our error handler
|
||||||
ExceptionHandler.registerErrorHandling();
|
ExceptionHandler.registerErrorHandling();
|
||||||
FThreads.invokeInEdtLater(() -> getDeviceAdapter().closeSplashScreen());
|
|
||||||
|
|
||||||
GuiBase.setIsAndroid(Gdx.app.getType() == Application.ApplicationType.Android);
|
GuiBase.setIsAndroid(Gdx.app.getType() == Application.ApplicationType.Android);
|
||||||
|
|
||||||
@@ -258,6 +257,8 @@ public class Forge implements ApplicationListener {
|
|||||||
/* call preloadExtendedArt here, if we put it above we will *
|
/* call preloadExtendedArt here, if we put it above we will *
|
||||||
* get error: No OpenGL context found in the current thread. */
|
* get error: No OpenGL context found in the current thread. */
|
||||||
preloadExtendedArt();
|
preloadExtendedArt();
|
||||||
|
// should be after create method but try to close this at a later time.
|
||||||
|
getDeviceAdapter().closeSplashScreen();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
//see if app or assets need updating
|
//see if app or assets need updating
|
||||||
@@ -1092,7 +1093,7 @@ public class Forge implements ApplicationListener {
|
|||||||
System.out.println(message);
|
System.out.println(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void startKeyInput(KeyInputAdapter adapter, boolean numeric) {
|
public static void startKeyInput(KeyInputAdapter adapter) {
|
||||||
if (keyInputAdapter == adapter) {
|
if (keyInputAdapter == adapter) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1100,7 +1101,9 @@ public class Forge implements ApplicationListener {
|
|||||||
keyInputAdapter.onInputEnd(); //make sure previous adapter is ended
|
keyInputAdapter.onInputEnd(); //make sure previous adapter is ended
|
||||||
}
|
}
|
||||||
keyInputAdapter = adapter;
|
keyInputAdapter = adapter;
|
||||||
Gdx.input.setOnscreenKeyboardVisible(true, numeric ? Input.OnscreenKeyboardType.NumberPad : Input.OnscreenKeyboardType.Default);
|
}
|
||||||
|
public static void setOnScreenKeyboard(boolean val, boolean numeric) {
|
||||||
|
Gdx.input.setOnscreenKeyboardVisible(val, numeric ? Input.OnscreenKeyboardType.NumberPad : Input.OnscreenKeyboardType.Default);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean endKeyInput() {
|
public static boolean endKeyInput() {
|
||||||
|
|||||||
@@ -676,7 +676,7 @@ public class CardImageRenderer {
|
|||||||
if (cv == null || isFaceDown)
|
if (cv == null || isFaceDown)
|
||||||
cv = card;
|
cv = card;
|
||||||
CardStateView csv = cv.getState(true);
|
CardStateView csv = cv.getState(true);
|
||||||
text = cv.getText(csv, needTranslation ? CardTranslation.getTranslationTexts(csv) : null);
|
text = cv.getText(csv, needTranslation && csv != null ? CardTranslation.getTranslationTexts(csv) : null);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
text = !card.isSplitCard() ?
|
text = !card.isSplitCard() ?
|
||||||
|
|||||||
@@ -234,6 +234,7 @@ public class FTextField extends FDisplayObject implements ITextField {
|
|||||||
|
|
||||||
public boolean startEdit() {
|
public boolean startEdit() {
|
||||||
if (readOnly) { return false; }
|
if (readOnly) { return false; }
|
||||||
|
Forge.setOnScreenKeyboard(true, isNumeric);
|
||||||
if (isEditing) { return true; } //do nothing if already editing
|
if (isEditing) { return true; } //do nothing if already editing
|
||||||
|
|
||||||
selStart = 0; //select all before starting input
|
selStart = 0; //select all before starting input
|
||||||
@@ -345,7 +346,7 @@ public class FTextField extends FDisplayObject implements ITextField {
|
|||||||
public void onInputEnd() {
|
public void onInputEnd() {
|
||||||
endEdit();
|
endEdit();
|
||||||
}
|
}
|
||||||
}, isNumeric);
|
});
|
||||||
isEditing = true;
|
isEditing = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user