Get rid of timed splash and display a better welcome screen.

This commit is contained in:
Kevin Ruland 2012-01-09 19:00:19 +00:00
parent 89c0af59be
commit 41daafa8e3
5 changed files with 135 additions and 90 deletions

View File

@ -1,62 +1,80 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.sf.openrocket" android:versionCode="1" package="net.sf.openrocket"
android:versionName="1.0"> android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" /> <uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="8" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<application android:debuggable="true" android:icon="@drawable/or_launcher" <application
android:killAfterRestore="true" android:label="@string/app_name" android:debuggable="true"
android:name=".android.Application"> android:icon="@drawable/or_launcher"
<activity android:name=".android.Main"> android:killAfterRestore="true"
<intent-filter> android:label="@string/app_name"
<action android:name="android.intent.action.MAIN" /> android:name=".android.Application" >
<activity
android:name=".android.Main"
android:theme="@android:style/Theme.Black.NoTitleBar" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:label="@string/app_name" android:name=".android.rocket.OpenRocketViewer"> <activity
android:label="@string/app_name"
android:name=".android.rocket.OpenRocketViewer" >
<!-- I don't understand why I need to have two different intent filters. <!--
I don't understand why I need to have two different intent filters.
Combining the <data> elements into a single field did not result in a working Combining the <data> elements into a single field did not result in a working
application. The first intent-filter (with mimeType wildcard) convinces the application. The first intent-filter (with mimeType wildcard) convinces the
file browser to associate the correct launcher icon. the second intent-filter file browser to associate the correct launcher icon. the second intent-filter
is actually invoked when a file is selected. --> is actually invoked when a file is selected.
<intent-filter> -->
<action android:name="android.intent.action.VIEW" /> <intent-filter >
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<data android:host="*" android:mimeType="*/*" <data
android:pathPattern=".*\\.ork" android:scheme="file" /> android:host="*"
</intent-filter> android:mimeType="*/*"
<intent-filter> android:pathPattern=".*\\.ork"
<action android:name="android.intent.action.VIEW" /> android:scheme="file" />
</intent-filter>
<intent-filter >
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<data android:host="*" android:pathPattern=".*\\.ork" <data
android:scheme="file" /> android:host="*"
</intent-filter> android:pathPattern=".*\\.ork"
</activity> android:scheme="file" />
<activity android:name=".android.PreferencesActivity"> </intent-filter>
<intent-filter> </activity>
<action android:name="net.sf.openrocket.android.PreferencesActivity" /> <activity android:name=".android.PreferencesActivity" >
<intent-filter >
<action android:name="net.sf.openrocket.android.PreferencesActivity" />
<category android:name="android.intent.category.PREFERENCE" /> <category android:name="android.intent.category.PREFERENCE" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:label="@string/MotorListTitle" <activity
android:name=".android.motor.MotorHierarchicalBrowser" /> android:label="@string/MotorListTitle"
<activity android:name=".android.motor.MotorDetails" /> android:name=".android.motor.MotorHierarchicalBrowser" />
<activity android:label="@string/MotorListTitle" <activity android:name=".android.motor.MotorDetails" />
android:name=".android.thrustcurve.TCQueryActivity" /> <activity
<activity android:name=".android.simulation.SimulationViewer" /> android:label="@string/MotorListTitle"
<activity android:name=".android.simulation.GraphicalActivity" /> android:name=".android.thrustcurve.TCQueryActivity" />
<activity android:name=".android.simulation.SimulationViewer" />
</application> <activity android:name=".android.simulation.GraphicalActivity" />
</application>
</manifest> </manifest>

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/rocketglobe" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:text="Welcome to OpenRocket" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:orientation="horizontal" >
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:onClick="pickOrkFiles"
android:text="View ork file" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:onClick="browseMotors"
android:text="View motors" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -1,31 +1,40 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical" > android:orientation="vertical" >
<ImageView
android:id="@+id/splashscreen"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:src="@drawable/splashscreen" />
<TextView <TextView
android:id="@+id/openrocket"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="Welcome to OpenRocket" /> android:text="Welcome to OpenRocket" />
<Button <ImageView
android:id="@+id/rocketglobe"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:onClick="pickOrkFiles" android:layout_below="@id/openrocket"
android:text="View ork file" /> android:src="@drawable/rocketglobe" />
<Button <LinearLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:onClick="browseMotors" android:layout_below="@id/rocketglobe"
android:text="View motors" /> android:gravity="center_horizontal" >
</LinearLayout> <Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="pickOrkFiles"
android:text="View ork file" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="browseMotors"
android:text="View motors" />
</LinearLayout>
</RelativeLayout>

View File

@ -6,47 +6,18 @@ import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.view.Window;
public class Main extends Activity { public class Main extends Activity {
private static final int PICK_ORK_FILE_RESULT = 1; private static final int PICK_ORK_FILE_RESULT = 1;
private static final int STOPSPLASH = 0;
//time in milliseconds
private static final long SPLASHTIME = 3000;
private ImageView splash;
//handler for splash screen
private Handler splashHandler = new Handler() {
/* (non-Javadoc)
* @see android.os.Handler#handleMessage(android.os.Message)
*/
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case STOPSPLASH:
//remove SplashScreen from view
splash.setVisibility(View.GONE);
break;
}
super.handleMessage(msg);
}
};
/** Called when the activity is first created. */ /** Called when the activity is first created. */
@Override @Override
public void onCreate(Bundle icicle) { public void onCreate(Bundle icicle) {
super.onCreate(icicle); super.onCreate(icicle);
setContentView(R.layout.main); setContentView(R.layout.main);
splash = (ImageView) findViewById(R.id.splashscreen);
Message msg = new Message();
msg.what = STOPSPLASH;
splashHandler.sendMessageDelayed(msg, SPLASHTIME);
} }
/* (non-Javadoc) /* (non-Javadoc)