Added configurable readme section to ChangeAppsettings.sh that will be shown when data is downloading

This commit is contained in:
pelya
2010-07-07 18:36:57 +03:00
parent 8895adf61e
commit 87265514cb
7 changed files with 33 additions and 15 deletions

View File

@@ -5,3 +5,4 @@ AppDataDownloadUrl="http://sites.google.com/site/xpelyax/Home/alienblaster110_da
DownloadToSdcard=n
SdlVideoResize=a
NeedDepthBuffer=n
ReadmeText='^Use accelerometer to navigate menus and control ship^Press "Menu" to select menu and for secondary fire^Press "Call" or touch screen for primary fire^Press "Volume Up/Down" to cycle through weapons'

View File

@@ -45,6 +45,23 @@ if [ -n "$var" ] ; then
NeedDepthBuffer="$var"
fi
echo -n "\nHere you may type some short readme text that will be shown when app data is downloaded."
echo -n "\nCurrent text:\n"
echo -n "`echo $ReadmeText | tr '^' '\\n'`"
echo -n "\n\nNew text (empty line to finish):\n\n"
ReadmeText1=""
while true; do
read var
if [ -n "$var" ] ; then
ReadmeText1="$ReadmeText1^$var"
else
break
fi
done
if [ -n "$ReadmeText1" ] ; then
ReadmeText="$ReadmeText1"
fi
echo
cat /dev/null > AppSettings.cfg
@@ -55,6 +72,7 @@ echo AppDataDownloadUrl=\"$AppDataDownloadUrl\" >> AppSettings.cfg
echo DownloadToSdcard=$DownloadToSdcard >> AppSettings.cfg
echo SdlVideoResize=$SdlVideoResize >> AppSettings.cfg
echo NeedDepthBuffer=$NeedDepthBuffer >> AppSettings.cfg
echo ReadmeText=\'$ReadmeText\' >> AppSettings.cfg
AppShortName=`echo $AppName | sed 's/ //g'`
DataPath="/data/data/$AppFullName/files"
@@ -82,6 +100,9 @@ if [ "$NeedDepthBuffer" = "y" ] ; then
else
NeedDepthBuffer=false
fi
echo ReadmeText1 "$ReadmeText"
ReadmeText="`echo $ReadmeText | sed 's/\"/\\\\\\\\\"/g' | sed 's/[&%]//g'`"
echo ReadmeText2 "$ReadmeText"
echo Patching project/AndroidManifest.xml
cat project/AndroidManifest.xml | \
@@ -103,7 +124,8 @@ cat project/src/Globals.java | \
sed "s/public static String ApplicationName = .*;/public static String ApplicationName = \"$AppShortName\";/" | \
sed "s^public static String DataDownloadUrl = \".*\";^public static String DataDownloadUrl = \"$AppDataDownloadUrl1\";^" | \
sed "s/public static boolean DownloadToSdcard = .*;/public static boolean DownloadToSdcard = $DownloadToSdcard1;/" | \
sed "s/public static boolean NeedDepthBuffer = .*;/public static boolean NeedDepthBuffer = $NeedDepthBuffer;/" > \
sed "s/public static boolean NeedDepthBuffer = .*;/public static boolean NeedDepthBuffer = $NeedDepthBuffer;/" | \
sed "s%public static String ReadmeText = .*%public static String ReadmeText = \"$ReadmeText\".replace(\"^\",\"\\\n\");%" > \
project/src/Globals.java.1
mv -f project/src/Globals.java.1 project/src/Globals.java

View File

@@ -4,7 +4,6 @@
android:versionCode="1"
android:versionName="1.0">
<application android:label="@string/app_name"
android:debuggable="true"
>
<activity android:name=".MainActivity"
android:label="@string/app_name"

View File

@@ -18,8 +18,6 @@ import android.widget.TextView;
// Accelerometer code partially ripped from http://karanar.net/
class AccelerometerReader implements SensorListener {
private long timekeeper;
private float [] v;
private SensorManager _manager = null;
@@ -29,7 +27,6 @@ class AccelerometerReader implements SensorListener {
_manager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
if( _manager != null )
{
timekeeper = android.os.SystemClock.uptimeMillis();
int mask = 0;
//mask |= SensorManager.SENSOR_ORIENTATION;
mask |= SensorManager.SENSOR_ACCELEROMETER;
@@ -45,8 +42,6 @@ class AccelerometerReader implements SensorListener {
}
public synchronized void onSensorChanged(int sensor, float[] values) {
//if (android.os.SystemClock.uptimeMillis() < timekeeper + 20) return;
timekeeper = android.os.SystemClock.uptimeMillis();
if (sensor == SensorManager.SENSOR_ACCELEROMETER) {
if( values.length >= 1 )
@@ -61,7 +56,6 @@ class AccelerometerReader implements SensorListener {
}
public synchronized void onAccuracyChanged(int i, int i1) {
/* @todo implement method */
}
public synchronized float[] readAccelerometer()

View File

@@ -104,7 +104,7 @@ class DataDownloader extends Thread
public String text;
public void run()
{
Status.setText(text);
Status.setText(text + "\n" + Globals.ReadmeText);
}
}
Callback cb = new Callback();

View File

@@ -21,6 +21,9 @@ class Globals {
// Set this value to true if you're planning to render 3D using OpenGL - it eats some GFX resources, so disabled for 2D
public static boolean NeedDepthBuffer = false;
// Readme text to be shown on download page
public static String ReadmeText = "^Use accelerometer to navigate menus and control ship^Press \"Menu\" to select menu and for secondary fire^Press \"Call\" or touch screen for primary fire^Press \"Volume Up/Down\" to cycle through weapons".replace("^","\n");
}
class LoadLibrary {

View File

@@ -52,16 +52,15 @@ internal flash on Android is very limited.
If you'll add new libs - add them to project/jni/, copy Android.mk from existing lib, and
add libname to project/jni/<yourapp>/Android.mk
To debug your application launch Android 2.2 emulator or connect Android 2.2 device,
go to "project" directory and launch command
To debug your application add tag 'android:debuggable="true"' to 'application' element in AndroidManifest.xml,
recmpile and reinstall your app to Android 2.2 emulator or Android 2.2 device, go to "project" dir and launch command
ndk-gdb --verbose --start --force
then when it fails enter command
target remote:5039
(then answer "y")
Note that it's extremely buggy (I've succeeded to launch debug session twice from 20 tries),
you may wish to add "sleep(30);" at the beginning of main() so your app won't crash before debugger attached.
target remote:5039 (then it will fail again)
Note that it's extremely buggy, and I had no any success in debugging my app with ndk-gdb.
So it's best to debug with code like:
__android_log_print(ANDROID_LOG_INFO, "My App", "We somehow reached execution point #224");
and then watching "adb logcat" output.
Known bugs: