From 09c540c8966538dba0f063c93619491786a9faa0 Mon Sep 17 00:00:00 2001 From: shagr4th Date: Sat, 28 Jan 2017 18:21:51 +0100 Subject: [PATCH] Small fixes --- app/src/main/java/org/ab/x48/AssetUtil.java | 2 +- app/src/main/java/org/ab/x48/X48.java | 22 ++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/org/ab/x48/AssetUtil.java b/app/src/main/java/org/ab/x48/AssetUtil.java index fd9fad4..3ee05eb 100644 --- a/app/src/main/java/org/ab/x48/AssetUtil.java +++ b/app/src/main/java/org/ab/x48/AssetUtil.java @@ -15,7 +15,7 @@ public class AssetUtil { public static boolean copyAsset(Context context, AssetManager am, boolean force) { File newDir = getSDDir(context); File sd = Environment.getExternalStorageDirectory(); - if (sd != null && sd.exists() && sd.isDirectory() && newDir.exists() && newDir.isDirectory()) { + if (sd != null && sd.exists() && sd.isDirectory() && newDir != null && newDir.exists() && newDir.isDirectory()) { File hpDir = new File(sd, ".hp48"); if (hpDir.exists()) { File allFiles [] = hpDir.listFiles(); diff --git a/app/src/main/java/org/ab/x48/X48.java b/app/src/main/java/org/ab/x48/X48.java index 6281dff..33e0c52 100644 --- a/app/src/main/java/org/ab/x48/X48.java +++ b/app/src/main/java/org/ab/x48/X48.java @@ -138,20 +138,11 @@ public class X48 extends Activity { else setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);*/ bitmapSkin = mPrefs.getBoolean("bitmapskin", false); - mainView.backBuffer = null; - mainView.needFlip = true; - String port1 = mPrefs.getString("port1", "0"); + String port1 = mPrefs.getString("port1", "0"); managePort(1, port1); String port2 = mPrefs.getString("port2", "0"); managePort(2, port2); saveonExit = mPrefs.getBoolean("saveOnExit", false); - if (mainView != null) { - mainView.setHapticFeedbackEnabled(mPrefs.getBoolean("haptic", true)); - mainView.setFullWidth(mPrefs.getBoolean("large_width", false)); - mainView.setScaleControls(mPrefs.getBoolean("scale_buttons", false)); - mainView.setKeybLite(mPrefs.getBoolean("keybLite", false)); - mainView.setSound(mPrefs.getBoolean("sound", false)); - } if (mPrefs.getBoolean("fullScreen", false)) { getWindow().addFlags(LayoutParams.FLAG_FULLSCREEN); getWindow().clearFlags(LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); @@ -159,7 +150,16 @@ public class X48 extends Activity { getWindow().addFlags(LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); getWindow().clearFlags(LayoutParams.FLAG_FULLSCREEN); } - mainView.requestLayout(); + if (mainView != null) { + mainView.backBuffer = null; + mainView.needFlip = true; + mainView.setHapticFeedbackEnabled(mPrefs.getBoolean("haptic", true)); + mainView.setFullWidth(mPrefs.getBoolean("large_width", false)); + mainView.setScaleControls(mPrefs.getBoolean("scale_buttons", false)); + mainView.setKeybLite(mPrefs.getBoolean("keybLite", false)); + mainView.setSound(mPrefs.getBoolean("sound", false)); + mainView.requestLayout(); + } } public void changeKeybLite() {