mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
Rename forge.view to forge.app
Alter external storage location
This commit is contained in:
41
forge-gui-android/src/forge/app/Main.java
Normal file
41
forge-gui-android/src/forge/app/Main.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package forge.app;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.backends.android.AndroidApplication;
|
||||
|
||||
import forge.Forge;
|
||||
|
||||
public class Main extends AndroidApplication {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
//setup portrait orientation
|
||||
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
if (Build.VERSION.SDK_INT > 8) { //use dual-side portrait mode if supported
|
||||
this.setRequestedOrientation(7);
|
||||
}
|
||||
|
||||
//establish assets directory
|
||||
if (!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
|
||||
Gdx.app.error("Forge", "Can't access external storage");
|
||||
Gdx.app.exit();
|
||||
return;
|
||||
}
|
||||
File assetsDir = new File(Environment.getExternalStorageDirectory() + "/Forge");
|
||||
if (!assetsDir.exists() && !assetsDir.mkdirs()) {
|
||||
Gdx.app.error("Forge", "Can't access external storage");
|
||||
Gdx.app.exit();
|
||||
return;
|
||||
}
|
||||
|
||||
initialize(new Forge(getClipboard(), assetsDir.getAbsolutePath() + "/"), false);
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package forge.view;
|
||||
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.badlogic.gdx.backends.android.AndroidApplication;
|
||||
|
||||
import forge.Forge;
|
||||
|
||||
public class Main extends AndroidApplication {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
//setup portrait orientation
|
||||
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
if (Build.VERSION.SDK_INT > 8) { //use dual-side portrait mode if supported
|
||||
this.setRequestedOrientation(7);
|
||||
}
|
||||
|
||||
initialize(new Forge(getClipboard(), getExternalFilesDir(null).getAbsolutePath()), false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user