v0.8.2a: removed some redundant work in onCreate
This commit is contained in:
parent
cf22867666
commit
380faca85d
|
@ -50,37 +50,44 @@ public class AndroidGame extends AndroidApplication {
|
||||||
protected void onCreate (Bundle savedInstanceState) {
|
protected void onCreate (Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
instance = this;
|
//there are some things we only need to set up on first launch
|
||||||
|
if (instance == null) {
|
||||||
|
|
||||||
try {
|
instance = this;
|
||||||
Game.version = getPackageManager().getPackageInfo( getPackageName(), 0 ).versionName;
|
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
|
||||||
Game.version = "???";
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
Game.versionCode = getPackageManager().getPackageInfo( getPackageName(), 0 ).versionCode;
|
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
|
||||||
Game.versionCode = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (UpdateImpl.supportsUpdates()){
|
try {
|
||||||
Updates.service = UpdateImpl.getUpdateService();
|
Game.version = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
|
||||||
}
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
if (NewsImpl.supportsNews()){
|
Game.version = "???";
|
||||||
News.service = NewsImpl.getNewsService();
|
}
|
||||||
}
|
try {
|
||||||
|
Game.versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
|
||||||
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
|
Game.versionCode = 0;
|
||||||
|
}
|
||||||
|
|
||||||
FileUtils.setDefaultFileProperties( Files.FileType.Local, "" );
|
if (UpdateImpl.supportsUpdates()) {
|
||||||
|
Updates.service = UpdateImpl.getUpdateService();
|
||||||
|
}
|
||||||
|
if (NewsImpl.supportsNews()) {
|
||||||
|
News.service = NewsImpl.getNewsService();
|
||||||
|
}
|
||||||
|
|
||||||
// grab preferences directly using our instance first
|
FileUtils.setDefaultFileProperties(Files.FileType.Local, "");
|
||||||
// so that we don't need to rely on Gdx.app, which isn't initialized yet.
|
|
||||||
// Note that we use a different prefs name on android for legacy purposes,
|
// grab preferences directly using our instance first
|
||||||
// this is the default prefs filename given to an android app (.xml is automatically added to it)
|
// so that we don't need to rely on Gdx.app, which isn't initialized yet.
|
||||||
SPDSettings.set(instance.getPreferences("ShatteredPixelDungeon"));
|
// Note that we use a different prefs name on android for legacy purposes,
|
||||||
|
// this is the default prefs filename given to an android app (.xml is automatically added to it)
|
||||||
|
SPDSettings.set(instance.getPreferences("ShatteredPixelDungeon"));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
//set desired orientation (if it exists) before initializing the app.
|
//set desired orientation (if it exists) before initializing the app.
|
||||||
if (SPDSettings.landscape() != null) {
|
if (SPDSettings.landscape() != null) {
|
||||||
AndroidGame.instance.setRequestedOrientation( SPDSettings.landscape() ?
|
instance.setRequestedOrientation( SPDSettings.landscape() ?
|
||||||
ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE :
|
ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE :
|
||||||
ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT );
|
ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT );
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,6 +131,10 @@ public class SPDAction extends GameAction {
|
||||||
|
|
||||||
public static void loadBindings(){
|
public static void loadBindings(){
|
||||||
|
|
||||||
|
if (!KeyBindings.getAllBindings().isEmpty()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Bundle b = FileUtils.bundleFromFile(BINDINGS_FILE);
|
Bundle b = FileUtils.bundleFromFile(BINDINGS_FILE);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user