Some backlog
This commit is contained in:
parent
a15aa70c32
commit
a798ff264d
4 changed files with 61 additions and 12 deletions
|
@ -12,7 +12,7 @@ import android.util.Log;
|
|||
|
||||
public class AssetUtil {
|
||||
|
||||
public static void copyAsset(Context context, AssetManager am, boolean force) {
|
||||
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()) {
|
||||
|
@ -31,7 +31,7 @@ public class AssetUtil {
|
|||
hpDir.delete();
|
||||
}
|
||||
}
|
||||
copyAsset(am, newDir, force);
|
||||
return copyAsset(am, newDir, force);
|
||||
}
|
||||
|
||||
public static File getSDDir(Context context) {
|
||||
|
@ -44,7 +44,8 @@ public class AssetUtil {
|
|||
}
|
||||
}
|
||||
|
||||
private static void copyAsset(AssetManager am, File rep, boolean force) {
|
||||
private static boolean copyAsset(AssetManager am, File rep, boolean force) {
|
||||
boolean existingInstall = false;
|
||||
try {
|
||||
String assets[] = am.list( "" );
|
||||
for( int i = 0 ; i < assets.length ; i++ ) {
|
||||
|
@ -66,6 +67,7 @@ public class AssetUtil {
|
|||
//boolean SKUNK = assets[i].equals("SKUNK");
|
||||
if (hp48 || rom || ram || hp48s || roms || rams) {
|
||||
File fout = new File(rep, assets[i]);
|
||||
existingInstall |= fout.exists();
|
||||
if (!fout.exists() || fout.length() == 0 || (required > 0 && fout.length() != required) || force) {
|
||||
Log.i("x48", "Overwriting " + assets[i]);
|
||||
FileOutputStream out = new FileOutputStream(fout);
|
||||
|
@ -83,6 +85,7 @@ public class AssetUtil {
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return existingInstall;
|
||||
}
|
||||
|
||||
public static boolean isFilesReady(Context context) {
|
||||
|
|
|
@ -53,6 +53,12 @@ public class Settings extends PreferenceActivity {
|
|||
savePref.setSummary(R.string.saveonexit_msgbox_value);
|
||||
inlinePrefCat.addPreference(savePref);
|
||||
|
||||
/*CheckBoxPreference blockOrientation = new CheckBoxPreference(this);
|
||||
blockOrientation.setKey("blockOrientation");
|
||||
blockOrientation.setTitle(R.string.blockorientation_msgbox);
|
||||
blockOrientation.setSummary(R.string.blockorientation_msgboxvalue);
|
||||
inlinePrefCat.addPreference(blockOrientation);*/
|
||||
|
||||
CheckBoxPreference keybLitePref = new CheckBoxPreference(this);
|
||||
keybLitePref.setKey("keybLite");
|
||||
keybLitePref.setTitle(R.string.show_lite_keyb);
|
||||
|
|
|
@ -36,17 +36,24 @@ public class X48 extends Activity {
|
|||
|
||||
private static EmulatorThread thread;
|
||||
|
||||
private static boolean errorLib;
|
||||
|
||||
// http://www.hpcalc.org/hp48/pc/emulators/gxrom-r.zip
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Log.i("x48", "starting activity");
|
||||
AssetUtil.copyAsset(this, getResources().getAssets(), false);
|
||||
readyToGo() ;
|
||||
if (errorLib) {
|
||||
showDialog(DIALOG_LIB_KO);
|
||||
return;
|
||||
}
|
||||
//Log.i("x48", "starting activity");
|
||||
boolean firstLaunch = !AssetUtil.copyAsset(this, getResources().getAssets(), false);
|
||||
|
||||
readyToGo() ;
|
||||
if (!AssetUtil.isFilesReady(this)) {
|
||||
showDialog(DIALOG_ROM_KO);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,6 +96,10 @@ public class X48 extends Activity {
|
|||
|
||||
public void checkPrefs() {
|
||||
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
/*if (mPrefs.getBoolean("blockOrientation", false))
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
|
||||
else
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);*/
|
||||
bitmapSkin = mPrefs.getBoolean("bitmapskin", false);
|
||||
mainView.backBuffer = null;
|
||||
mainView.needFlip = true;
|
||||
|
@ -160,7 +171,11 @@ public class X48 extends Activity {
|
|||
}
|
||||
|
||||
static {
|
||||
System.loadLibrary("droid48");
|
||||
try {
|
||||
System.loadLibrary("droid48");
|
||||
} catch (java.lang.UnsatisfiedLinkError e) {
|
||||
errorLib = true;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void onResume() {
|
||||
|
@ -178,6 +193,9 @@ public class X48 extends Activity {
|
|||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
super.onCreateOptionsMenu(menu);
|
||||
|
||||
if (mainView == null)
|
||||
return true;
|
||||
|
||||
// We are going to create two menus. Note that we assign them
|
||||
// unique integer IDs, labels from our string resources, and
|
||||
// given them shortcuts.
|
||||
|
@ -243,6 +261,7 @@ public class X48 extends Activity {
|
|||
private static final int DIALOG_ROM_KO = 3;
|
||||
private static final int DIALOG_RAM_KO = 4;
|
||||
private static final int DIALOG_RAM_OK = 5;
|
||||
private static final int DIALOG_LIB_KO = 6;
|
||||
|
||||
@Override
|
||||
protected Dialog onCreateDialog(int id) {
|
||||
|
@ -301,6 +320,17 @@ public class X48 extends Activity {
|
|||
}
|
||||
})
|
||||
.create();
|
||||
case DIALOG_LIB_KO: return new AlertDialog.Builder(X48.this)
|
||||
.setIcon(R.drawable.alert_dialog_icon)
|
||||
.setTitle(R.string.help)
|
||||
.setMessage(R.string.lib_ko)
|
||||
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
|
||||
onDestroy();
|
||||
}
|
||||
})
|
||||
.create();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -8,14 +8,14 @@
|
|||
<string name="button_quit">Quit</string>
|
||||
<string name="reset_memory">Reset memory and quit</string>
|
||||
<string name="help">Help</string>
|
||||
<string name="ok">Ok</string>
|
||||
<string name="ok">OK</string>
|
||||
<string name="prog_ok">The program/object has been put on the stack.\nNow, some HP knowledge is necessary:\n\n- if this is a library, push 0, then STO and shut down (right shift + on) / restart (on) the calculator: the program will be available in the Library (shift right + 2) menu.\n\n- If this is a regular object (dir, external, etc.), push a name between quotes on the stack (for example, \'prog\'), then push STO: the prog will be available in the VAR menu</string>
|
||||
<string name="prog_ko">This program cannot be loaded.\nMake sure it\'s a valid one and you have enough memory to load it</string>
|
||||
<string name="rom_ko">Rom files not found! This shouldn\'t happen :\\. Quitting now...</string>
|
||||
<string name="rom_ko">Rom files not found! This shouldn\'t happen :\\. Quitting now…</string>
|
||||
<string name="general_preferences">General settings</string>
|
||||
<string name="display_preferences">Display settings</string>
|
||||
<string name="misc_preferences">Misc settings</string>
|
||||
|
||||
<string name="lib_ko">Application cannot be started due to a native library error. Please try to redownload and reinstall the app</string>
|
||||
<string name="choose_contrast">Contrast</string>
|
||||
<string name="choose_contrast_value">Select the contrast</string>
|
||||
<string name="choose_backkey">Back key behavior</string>
|
||||
|
@ -54,10 +54,20 @@
|
|||
<string name="disableLite">Disable minimal controls</string>
|
||||
<string name="disableLite_summary">Prevents lite controls to show up when touching LCD</string>
|
||||
<string name="sound">Enable sound</string>
|
||||
<string name="sound_summary">EXPERIMENTAL: system beeps ok, so far</string>
|
||||
<string name="sound_summary">EXPERIMENTAL: System beeps OK, so far</string>
|
||||
<string name="hp48s">HP48 S</string>
|
||||
<string name="hp48s_summary">Emulate an HP48S (Need App Restart !)</string>
|
||||
<string name="bitmapSkin">HP48 Bitmap Skin</string>
|
||||
<string name="bitmapSkin_summary">Restore the previous bitmap skin (48G mode only !)</string>
|
||||
<string name="show_menu">Touch the screen to show system options</string>
|
||||
<string name="information">Information</string>
|
||||
<string name="appreciation">Now you can show your appreciation for Droid48\nThank you !</string>
|
||||
<string name="dismissforever">Dismiss forever</string>
|
||||
<string name="donate">Donate</string>
|
||||
<string name="donate_explain">If you like Droid48, you can show your appreciation here with a donation ! Thank you very much !</string>
|
||||
<string name="thanks">Thanks for the donation !</string>
|
||||
<string name="pleasewait">Connecting to billing system, please wait…</string>
|
||||
<string name="blockorientation_msgbox">Lock portrait mode</string>
|
||||
<string name="blockorientation_msgboxvalue">Prevent Droid48 to switch in landscape mode</string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue