diff --git a/changeAppSettings.sh b/changeAppSettings.sh index 27c94c996..8f22ee92b 100755 --- a/changeAppSettings.sh +++ b/changeAppSettings.sh @@ -571,7 +571,11 @@ ReadmeText1="" while true; do read var if [ -n "$var" ] ; then - ReadmeText1="$ReadmeText1^$var" + if [ -n "$ReadmeText1" ] ; then + ReadmeText1="$ReadmeText1^$var" + else + ReadmeText1="$var" + fi else break fi @@ -958,7 +962,7 @@ cat project/src/Globals.java | \ sed "s/public static int AppMinimumRAM = .*;/public static int AppMinimumRAM = $AppMinimumRAM;/" | \ sed "s/public static Settings.Menu HiddenMenuOptions .*;/public static Settings.Menu HiddenMenuOptions [] = { $HiddenMenuOptions1 };/" | \ sed "s@public static Settings.Menu FirstStartMenuOptions .*;@public static Settings.Menu FirstStartMenuOptions [] = { $FirstStartMenuOptions };@" | \ - sed "s%public static String ReadmeText = .*%public static String ReadmeText = \"$ReadmeText\".replace(\"^\",\"\\\n\");%" | \ + sed "s%public static String ReadmeText = .*%public static String ReadmeText = \"$ReadmeText\";%" | \ sed "s%public static String CommandLine = .*%public static String CommandLine = \"$AppCmdline\";%" | \ sed "s/public static String AdmobPublisherId = .*/public static String AdmobPublisherId = \"$AdmobPublisherId\";/" | \ sed "s/public static String AdmobTestDeviceId = .*/public static String AdmobTestDeviceId = \"$AdmobTestDeviceId\";/" | \ diff --git a/project/java/Settings.java b/project/java/Settings.java index 98be7065e..1d5b84919 100644 --- a/project/java/Settings.java +++ b/project/java/Settings.java @@ -54,6 +54,7 @@ import android.graphics.BitmapFactory; import android.graphics.Bitmap; import android.widget.TextView; import android.widget.EditText; +import android.widget.ScrollView; import android.text.Editable; import android.text.SpannedString; import android.content.Intent; @@ -304,14 +305,7 @@ class Settings System.out.println("libSDL: old cfg version " + cfgVersion + ", our version " + p.getApplicationVersion() + " and we need to clean up config file"); // Delete settings file, and restart the application settingsFile.close(); - ObjectOutputStream out = new ObjectOutputStream(p.openFileOutput( SettingsFileName, p.MODE_WORLD_READABLE )); - out.writeInt(-1); - out.close(); - new File( p.getFilesDir() + "/" + SettingsFileName ).delete(); - PendingIntent intent = PendingIntent.getActivity(p, 0, new Intent(p.getIntent()), p.getIntent().getFlags()); - AlarmManager mgr = (AlarmManager) p.getSystemService(Context.ALARM_SERVICE); - mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 1000, intent); - System.exit(0); + DeleteSdlConfigOnUpgradeAndRestart(p); } } @@ -323,7 +317,14 @@ class Settings } catch( FileNotFoundException e ) { } catch( SecurityException e ) { - } catch ( IOException e ) {}; + } catch ( IOException e ) { + DeleteFilesOnUpgrade(); + if( Globals.ResetSdlConfigForThisVersion ) + { + System.out.println("libSDL: old cfg version unknown or too old, our version " + p.getApplicationVersion() + " and we need to clean up config file"); + DeleteSdlConfigOnUpgradeAndRestart(p); + } + }; if( Globals.DataDir.length() == 0 ) { @@ -2376,6 +2377,49 @@ class Settings } } + static class ShowReadme extends Menu + { + String title(final MainActivity p) + { + return "Readme"; + } + boolean enabled() + { + return true; + } + void run (final MainActivity p) + { + String readmes[] = Globals.ReadmeText.split("\\^"); + String lang = new String(Locale.getDefault().getLanguage()) + ":"; + String readme = readmes[0]; + for( String r: readmes ) + { + if( r.startsWith(lang) ) + readme = r; + } + TextView text = new TextView(p); + text.setMaxLines(1000); + text.setText(readme); + text.setLayoutParams(new ViewGroup.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.FILL_PARENT)); + AlertDialog.Builder builder = new AlertDialog.Builder(p); + ScrollView scroll = new ScrollView(p); + scroll.addView(text); + builder.setView(scroll); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + } + + // =============================================================================================== + public static boolean deleteRecursively(File dir) { if (dir.isDirectory()) { @@ -2400,6 +2444,21 @@ class Settings deleteRecursively(f); } } + public static void DeleteSdlConfigOnUpgradeAndRestart(final MainActivity p) + { + try { + ObjectOutputStream out = new ObjectOutputStream(p.openFileOutput( SettingsFileName, p.MODE_WORLD_READABLE )); + out.writeInt(-1); + out.close(); + } catch( FileNotFoundException e ) { + } catch ( IOException e ) { } + new File( p.getFilesDir() + "/" + SettingsFileName ).delete(); + PendingIntent intent = PendingIntent.getActivity(p, 0, new Intent(p.getIntent()), p.getIntent().getFlags()); + AlarmManager mgr = (AlarmManager) p.getSystemService(Context.ALARM_SERVICE); + mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 1000, intent); + System.exit(0); + } + // =============================================================================================== diff --git a/project/jni/application/prefclub/AndroidData/prefclub.zip b/project/jni/application/prefclub/AndroidData/prefclub.zip new file mode 100644 index 000000000..ffa2e6d60 Binary files /dev/null and b/project/jni/application/prefclub/AndroidData/prefclub.zip differ