mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-03 09:29:38 +01:00
Fixed the android editor, now it can open projects again. Also smaller codestyle fixes.
This commit is contained in:
parent
f30076a9f5
commit
42a9dc5e8d
@ -70,8 +70,8 @@ open class PandemoniumEditor : FullScreenPandemoniumApp() {
|
||||
override fun onCreate(savedInstanceState : Bundle?) {
|
||||
PermissionsUtil.requestManifestPermissions(this);
|
||||
|
||||
//String[]
|
||||
val params = getIntent().getStringArrayExtra(COMMAND_LINE_PARAMS);
|
||||
val params : Array<String>? = getIntent().getStringArrayExtra(COMMAND_LINE_PARAMS);
|
||||
|
||||
updateCommandLineParams(params);
|
||||
|
||||
if (BuildConfig.BUILD_TYPE == "dev" && WAIT_FOR_DEBUGGER) {
|
||||
@ -95,14 +95,15 @@ open class PandemoniumEditor : FullScreenPandemoniumApp() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun getCommandLine() = commandLineParams
|
||||
|
||||
override fun onNewPandemoniumInstanceRequested(args: Array<String>) {
|
||||
// Parse the arguments to figure out which activity to start.
|
||||
var targetClass: Class<*> = PandemoniumGame::class.java
|
||||
|
||||
// Whether we should launch the new godot instance in an adjacent window
|
||||
// https://developer.android.com/reference/android/content/Intent#FLAG_ACTIVITY_LAUNCH_ADJACENT
|
||||
var launchAdjacent =
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && (isInMultiWindowMode || isLargeScreen)
|
||||
var launchAdjacent = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && (isInMultiWindowMode || isLargeScreen)
|
||||
|
||||
for (arg in args) {
|
||||
if (EDITOR_ARG == arg) {
|
||||
@ -119,12 +120,12 @@ open class PandemoniumEditor : FullScreenPandemoniumApp() {
|
||||
}
|
||||
|
||||
// Launch a new activity
|
||||
val newInstance = Intent(this, targetClass)
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
.putExtra(COMMAND_LINE_PARAMS, args)
|
||||
val newInstance = Intent(this, targetClass).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK).putExtra(COMMAND_LINE_PARAMS, args)
|
||||
|
||||
if (launchAdjacent) {
|
||||
newInstance.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT)
|
||||
}
|
||||
|
||||
startActivity(newInstance)
|
||||
}
|
||||
|
||||
|
@ -59,16 +59,13 @@ public abstract class FullScreenPandemoniumApp extends FragmentActivity implemen
|
||||
setContentView(R.layout.pandemonium_app_layout);
|
||||
|
||||
Fragment currentFragment = getSupportFragmentManager().findFragmentById(R.id.pandemonium_fragment_container);
|
||||
|
||||
if (currentFragment instanceof Pandemonium) {
|
||||
Log.v(TAG, "Reusing existing Pandemonium fragment instance.");
|
||||
pandemoniumFragment = (Pandemonium)currentFragment;
|
||||
} else {
|
||||
Log.v(TAG, "Creating new Pandemonium fragment instance.");
|
||||
pandemoniumFragment = initPandemoniumInstance();
|
||||
if (pandemoniumFragment == null) {
|
||||
throw new IllegalStateException("Pandemonium instance must be non-null.");
|
||||
}
|
||||
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.pandemonium_fragment_container, pandemoniumFragment).setPrimaryNavigationFragment(pandemoniumFragment).commitNowAllowingStateLoss();
|
||||
}
|
||||
}
|
||||
|
@ -510,6 +510,7 @@ public class Pandemonium extends Fragment implements SensorEventListener, IDownl
|
||||
protected String[] getCommandLine() {
|
||||
String[] original = parseCommandLine();
|
||||
String[] updated;
|
||||
|
||||
List<String> hostCommandLine = pandemoniumHost != null ? pandemoniumHost.getCommandLine() : null;
|
||||
if (hostCommandLine == null || hostCommandLine.isEmpty()) {
|
||||
updated = original;
|
||||
@ -519,6 +520,7 @@ public class Pandemonium extends Fragment implements SensorEventListener, IDownl
|
||||
updated[original.length + i] = hostCommandLine.get(i);
|
||||
}
|
||||
}
|
||||
|
||||
return updated;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user