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"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.sf.openrocket" android:versionCode="1"
android:versionName="1.0">
package="net.sf.openrocket"
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.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:debuggable="true" android:icon="@drawable/or_launcher"
android:killAfterRestore="true" android:label="@string/app_name"
android:name=".android.Application">
<activity android:name=".android.Main">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<application
android:debuggable="true"
android:icon="@drawable/or_launcher"
android:killAfterRestore="true"
android:label="@string/app_name"
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" />
</intent-filter>
</activity>
<activity android:label="@string/app_name" android:name=".android.rocket.OpenRocketViewer">
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<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
application. The first intent-filter (with mimeType wildcard) convinces the
file browser to associate the correct launcher icon. the second intent-filter
is actually invoked when a file is selected. -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
is actually invoked when a file is selected.
-->
<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="*/*"
android:pathPattern=".*\\.ork" android:scheme="file" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\\.ork"
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"
android:scheme="file" />
</intent-filter>
</activity>
<activity android:name=".android.PreferencesActivity">
<intent-filter>
<action android:name="net.sf.openrocket.android.PreferencesActivity" />
<data
android:host="*"
android:pathPattern=".*\\.ork"
android:scheme="file" />
</intent-filter>
</activity>
<activity android:name=".android.PreferencesActivity" >
<intent-filter >
<action android:name="net.sf.openrocket.android.PreferencesActivity" />
<category android:name="android.intent.category.PREFERENCE" />
</intent-filter>
</activity>
<activity android:label="@string/MotorListTitle"
android:name=".android.motor.MotorHierarchicalBrowser" />
<activity android:name=".android.motor.MotorDetails" />
<activity android:label="@string/MotorListTitle"
android:name=".android.thrustcurve.TCQueryActivity" />
<activity android:name=".android.simulation.SimulationViewer" />
<activity android:name=".android.simulation.GraphicalActivity" />
</application>
<category android:name="android.intent.category.PREFERENCE" />
</intent-filter>
</activity>
<activity
android:label="@string/MotorListTitle"
android:name=".android.motor.MotorHierarchicalBrowser" />
<activity android:name=".android.motor.MotorDetails" />
<activity
android:label="@string/MotorListTitle"
android:name=".android.thrustcurve.TCQueryActivity" />
<activity android:name=".android.simulation.SimulationViewer" />
<activity android:name=".android.simulation.GraphicalActivity" />
</application>
</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"?>
<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_height="fill_parent"
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
android:id="@+id/openrocket"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="Welcome to OpenRocket" />
<Button
<ImageView
android:id="@+id/rocketglobe"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:onClick="pickOrkFiles"
android:text="View ork file" />
android:layout_below="@id/openrocket"
android:src="@drawable/rocketglobe" />
<Button
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:onClick="browseMotors"
android:text="View motors" />
android:layout_below="@id/rocketglobe"
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.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.ImageView;
import android.view.Window;
public class Main extends Activity {
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. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
splash = (ImageView) findViewById(R.id.splashscreen);
Message msg = new Message();
msg.what = STOPSPLASH;
splashHandler.sendMessageDelayed(msg, SPLASHTIME);
}
/* (non-Javadoc)