mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-01-24 04:34:56 +00:00
Show release notes on first launch/upgrade
- Include a menu item to re-show the release notes - Upgrade migration sets new Color TV video mode
This commit is contained in:
parent
3a35404fa3
commit
d3432fb3d8
2
Android/.idea/misc.xml
generated
2
Android/.idea/misc.xml
generated
@ -25,7 +25,7 @@
|
||||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
@ -1 +1 @@
|
||||
app/build/intermediates/manifests/full/debug/AndroidManifest.xml
|
||||
app/build/intermediates/merged_manifests/debug/processDebugManifest/merged/AndroidManifest.xml
|
@ -14,9 +14,12 @@ package org.deadc0de.apple2ix;
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.AssetManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.StrictMode;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
@ -25,6 +28,11 @@ import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.InterruptedIOException;
|
||||
import java.io.Reader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
@ -152,16 +160,14 @@ public class Apple2Activity extends Activity implements Apple2DiskChooserActivit
|
||||
boolean extperm = true;
|
||||
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
// On Marshmallow+ specifically ask for permission to read/write storage
|
||||
String readPermission = Manifest.permission.READ_EXTERNAL_STORAGE;
|
||||
String writePermission = Manifest.permission.WRITE_EXTERNAL_STORAGE;
|
||||
int hasReadPermission = checkSelfPermission(readPermission);
|
||||
int hasWritePermission = checkSelfPermission(writePermission);
|
||||
int hasReadPermission = checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE);
|
||||
int hasWritePermission = checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
ArrayList<String> permissions = new ArrayList<String>();
|
||||
if (hasReadPermission != PackageManager.PERMISSION_GRANTED) {
|
||||
permissions.add(readPermission);
|
||||
permissions.add(Manifest.permission.READ_EXTERNAL_STORAGE);
|
||||
}
|
||||
if (hasWritePermission != PackageManager.PERMISSION_GRANTED) {
|
||||
permissions.add(writePermission);
|
||||
permissions.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
}
|
||||
if (!permissions.isEmpty()) {
|
||||
extperm = false;
|
||||
@ -179,9 +185,20 @@ public class Apple2Activity extends Activity implements Apple2DiskChooserActivit
|
||||
Apple2Utils.exposeAPKAssets(Apple2Activity.this);
|
||||
if (externalStoragePermission) {
|
||||
Apple2Utils.exposeAPKAssetsToExternal(Apple2Activity.this);
|
||||
Log.d(TAG, "Finished first time copying #1...");
|
||||
|
||||
if (!(boolean)Apple2Preferences.getJSONPref(Apple2Preferences.PREF_DOMAIN_INTERFACE, Apple2Preferences.PREF_RELEASE_NOTES, false)) {
|
||||
Runnable myRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
showReleaseNotes();
|
||||
}
|
||||
};
|
||||
new Handler(Apple2Activity.this.getMainLooper()).post(myRunnable);
|
||||
}
|
||||
}
|
||||
|
||||
mSplashScreen.setDismissable(true);
|
||||
Log.d(TAG, "Finished first time copying...");
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
@ -215,10 +232,15 @@ public class Apple2Activity extends Activity implements Apple2DiskChooserActivit
|
||||
// perform migration(s) and assets exposure now
|
||||
Apple2Utils.migrateToExternalStorage(Apple2Activity.this);
|
||||
Apple2Utils.exposeAPKAssetsToExternal(Apple2Activity.this);
|
||||
Log.d(TAG, "Finished first time copying #2...");
|
||||
} // else ... we keep nagging on app startup ...
|
||||
} else {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
}
|
||||
|
||||
if (!(boolean)Apple2Preferences.getJSONPref(Apple2Preferences.PREF_DOMAIN_INTERFACE, Apple2Preferences.PREF_RELEASE_NOTES, false)) {
|
||||
showReleaseNotes();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -363,6 +385,59 @@ public class Apple2Activity extends Activity implements Apple2DiskChooserActivit
|
||||
}
|
||||
}
|
||||
|
||||
public void showReleaseNotes() {
|
||||
|
||||
Apple2Preferences.setJSONPref(Apple2Preferences.PREF_DOMAIN_INTERFACE, Apple2Preferences.PREF_RELEASE_NOTES, true);
|
||||
Apple2Preferences.save(this);
|
||||
|
||||
String releaseNotes = "";
|
||||
final int maxAttempts = 5;
|
||||
int attempts = 0;
|
||||
do {
|
||||
InputStream is = null;
|
||||
try {
|
||||
AssetManager assetManager = getAssets();
|
||||
is = assetManager.open("release_notes.txt");
|
||||
|
||||
final int bufferSize = 4096;
|
||||
final char[] buffer = new char[bufferSize];
|
||||
final StringBuilder out = new StringBuilder();
|
||||
Reader in = new InputStreamReader(is, "UTF-8");
|
||||
while (true) {
|
||||
int siz = in.read(buffer, 0, buffer.length);
|
||||
if (siz < 0) {
|
||||
break;
|
||||
}
|
||||
out.append(buffer, 0, siz);
|
||||
}
|
||||
releaseNotes = out.toString();
|
||||
break;
|
||||
} catch (InterruptedIOException e) {
|
||||
/* EINTR, EAGAIN */
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "OOPS could not load release_notes.txt!", e);
|
||||
} finally {
|
||||
if (is != null) {
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
// NOOP
|
||||
}
|
||||
}
|
||||
}
|
||||
++attempts;
|
||||
} while (attempts < maxAttempts);
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(Apple2Activity.this).setIcon(R.drawable.ic_launcher).setCancelable(false).setTitle(R.string.release_notes).setMessage(releaseNotes).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
AlertDialog dialog = builder.create();
|
||||
registerAndShowDialog(dialog);
|
||||
}
|
||||
|
||||
public Apple2MainMenu getMainMenu() {
|
||||
return mMainMenu;
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ public class Apple2Preferences {
|
||||
public final static String PREF_DEVICE_HEIGHT = "deviceHeight";
|
||||
public final static String PREF_DEVICE_WIDTH = "deviceWidth";
|
||||
public final static String PREF_EMULATOR_VERSION = "emulatorVersion";
|
||||
public final static String PREF_RELEASE_NOTES = "shownReleaseNotes";
|
||||
|
||||
// JSON preferences
|
||||
private static JSONObject sSettings = null;
|
||||
@ -174,6 +175,13 @@ public class Apple2Preferences {
|
||||
|
||||
Log.v(TAG, "Triggering migration to Apple2ix version : " + BuildConfig.VERSION_NAME);
|
||||
setJSONPref(PREF_DOMAIN_INTERFACE, PREF_EMULATOR_VERSION, BuildConfig.VERSION_CODE);
|
||||
setJSONPref(PREF_DOMAIN_INTERFACE, PREF_RELEASE_NOTES, false);
|
||||
|
||||
if (versionCode < 22) {
|
||||
// force upgrade to defaults here ...
|
||||
setJSONPref(Apple2VideoSettingsMenu.SETTINGS.SHOW_HALF_SCANLINES, Apple2VideoSettingsMenu.SETTINGS.SHOW_HALF_SCANLINES.getPrefDefault());
|
||||
setJSONPref(Apple2VideoSettingsMenu.SETTINGS.COLOR_MODE_CONFIGURE, Apple2VideoSettingsMenu.SETTINGS.COLOR_MODE_CONFIGURE.getPrefDefault());
|
||||
}
|
||||
|
||||
Apple2Utils.migrateToExternalStorage(activity);
|
||||
if (BuildConfig.VERSION_CODE >= 17) {
|
||||
|
@ -283,6 +283,22 @@ public class Apple2SettingsMenu extends Apple2AbstractMenu {
|
||||
return convertView;
|
||||
}
|
||||
},
|
||||
RELEASE_NOTES {
|
||||
@Override
|
||||
public final String getTitle(Apple2Activity activity) {
|
||||
return activity.getResources().getString(R.string.release_notes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getSummary(Apple2Activity activity) {
|
||||
return activity.getResources().getString(R.string.release_notes_summary);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleSelection(Apple2Activity activity, final Apple2AbstractMenu settingsMenu, boolean isChecked) {
|
||||
activity.showReleaseNotes();
|
||||
}
|
||||
},
|
||||
ABOUT {
|
||||
@Override
|
||||
public final String getTitle(Apple2Activity activity) {
|
||||
|
@ -132,7 +132,7 @@
|
||||
<string name="mockingboard_disabled_title">Mockingboard deaktiviert</string>
|
||||
<string name="mockingboard_disabled_mesg">Mockingboard konnte nicht aktiviert werden</string>
|
||||
<string name="mockingboard_enable">Aktiviere Mockingboard</string>
|
||||
<string name="mockingboard_enable_summary">Revision C in Slot 4/5 (evtl. wird ein Restart benötigt)</string>
|
||||
<string name="mockingboard_enable_summary">Revision C in Slot 4/5 (evtl. wird ein Restart benötigt) (may consume extra battery)</string>
|
||||
<string name="mockingboard_volume">Mockingboard Lautstärke</string>
|
||||
<string name="mockingboard_volume_summary">Einstellen der Mockingboard Lautstärke</string>
|
||||
<string name="no">Nein</string>
|
||||
@ -199,5 +199,7 @@
|
||||
<string name="disk_fast_operation">Disk fast loading (EXPERIMENTAL)</string>
|
||||
<string name="disk_fast_operation_summary">Quickly load disk images (may negatively affect device battery life)</string>
|
||||
<string name="show_half_scanlines_summary">Renders pixel vertical divisions</string>
|
||||
<string name="release_notes">Release notes</string>
|
||||
<string name="release_notes_summary">View notes for this release</string>
|
||||
|
||||
</resources>
|
||||
|
@ -130,7 +130,7 @@
|
||||
<string name="mockingboard_disabled_title">Mockingboard desactivado</string>
|
||||
<string name="mockingboard_disabled_mesg">Mockingboard no pudo ser habilitado</string>
|
||||
<string name="mockingboard_enable">Activar Mockingboard</string>
|
||||
<string name="mockingboard_enable_summary">Revisión C en la ranura 4/5 puede requerir reinicio</string>
|
||||
<string name="mockingboard_enable_summary">Revisión C en Slot 4/5 (puede requerir reinicio) (may consume extra battery)</string>
|
||||
<string name="mockingboard_volume">Volumen de Mockingboard</string>
|
||||
<string name="mockingboard_volume_summary">Adjustar el volumen del Mockingboard</string>
|
||||
<string name="no">No</string>
|
||||
@ -199,5 +199,7 @@
|
||||
<string name="disk_fast_operation">Disk fast loading (EXPERIMENTAL)</string>
|
||||
<string name="disk_fast_operation_summary">Quickly load disk images (may negatively affect device battery life)</string>
|
||||
<string name="show_half_scanlines_summary">Renders pixel vertical divisions</string>
|
||||
<string name="release_notes">Release notes</string>
|
||||
<string name="release_notes_summary">View notes for this release</string>
|
||||
|
||||
</resources>
|
||||
|
@ -130,7 +130,7 @@
|
||||
<string name="mockingboard_disabled_title">Mockingboard désactivé</string>
|
||||
<string name="mockingboard_disabled_mesg">Le Mockingboard ne peut être activé</string>
|
||||
<string name="mockingboard_enable">Activer le Mockingboard</string>
|
||||
<string name="mockingboard_enable_summary">Révision C dans Slot 4/5 (redémarrage possible)</string>
|
||||
<string name="mockingboard_enable_summary">Révision C dans Slot 4/5 (redémarrage possible) (may consume extra battery)</string>
|
||||
<string name="mockingboard_volume">Volume du Mockingboard</string>
|
||||
<string name="mockingboard_volume_summary">Placer le volume du Mockingboard</string>
|
||||
<string name="no">Non</string>
|
||||
@ -199,5 +199,7 @@
|
||||
<string name="disk_fast_operation">Disk fast loading (EXPERIMENTAL)</string>
|
||||
<string name="disk_fast_operation_summary">Quickly load disk images (may negatively affect device battery life)</string>
|
||||
<string name="show_half_scanlines_summary">Renders pixel vertical divisions</string>
|
||||
<string name="release_notes">Release notes</string>
|
||||
<string name="release_notes_summary">View notes for this release</string>
|
||||
|
||||
</resources>
|
||||
|
@ -138,7 +138,7 @@
|
||||
<string name="mockingboard_disabled_title">Mockingboard disabled</string>
|
||||
<string name="mockingboard_disabled_mesg">Mockingboard could not be enabled</string>
|
||||
<string name="mockingboard_enable">Enable Mockingboard</string>
|
||||
<string name="mockingboard_enable_summary">Revision C in Slot 4/5 (may require restart)</string>
|
||||
<string name="mockingboard_enable_summary">Revision C in Slot 4/5 (may require restart) (may consume extra battery)</string>
|
||||
<string name="mockingboard_volume">Mockingboard volume</string>
|
||||
<string name="mockingboard_volume_summary">Set the Mockingboard volume</string>
|
||||
<string name="mode_landscape">Landscape</string>
|
||||
@ -199,5 +199,7 @@
|
||||
<string name="disk_fast_operation">Disk fast loading (EXPERIMENTAL)</string>
|
||||
<string name="disk_fast_operation_summary">Quickly load disk images (may negatively affect device battery life)</string>
|
||||
<string name="show_half_scanlines_summary">Renders pixel vertical divisions</string>
|
||||
<string name="release_notes">Release notes</string>
|
||||
<string name="release_notes_summary">View notes for this release</string>
|
||||
|
||||
</resources>
|
||||
|
18
Android/assets/release_notes.txt
Normal file
18
Android/assets/release_notes.txt
Normal file
@ -0,0 +1,18 @@
|
||||
Apple2ix (a2ix) 2.0.0-Android Release Notes
|
||||
|
||||
TL;DR : new video mode settings!
|
||||
|
||||
CHANGES:
|
||||
|
||||
- Implemented a more conformant video scanner. This improves emulation fidelity for programs that implement custom video modes (e.g., custom split screen between text & graphics).
|
||||
|
||||
- New NTSC video display modes including "Color monitor", "Monochrome TV", and "Color TV" modes. Also support "Green screen" monochrome video. Thanks to the AppleWin project and Bill Simms for these modes.
|
||||
|
||||
- New preference to enable/disable half-scanline video effects.
|
||||
|
||||
- EXPERIMENTAL: New preference to enable/disable fast disk image loading. This may cause audio glitches or other instability. Use at your own risk!
|
||||
|
||||
MORE INFO:
|
||||
|
||||
- https://deadc0de.org/apple2ix/android
|
||||
|
Loading…
x
Reference in New Issue
Block a user