Skip to content
Snippets Groups Projects
Commit 8a5c6a0a authored by Maxime Graulich's avatar Maxime Graulich
Browse files

Add a splash screen for Android

parent 119e2d64
No related branches found
No related tags found
No related merge requests found
...@@ -7,8 +7,7 @@ ...@@ -7,8 +7,7 @@
<uses-feature android:glEsVersion="0x00010000" android:required="true"></uses-feature> <uses-feature android:glEsVersion="0x00010000" android:required="true"></uses-feature>
<uses-sdk <uses-sdk
android:minSdkVersion="14" android:minSdkVersion="14" />
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application <application
...@@ -19,7 +18,7 @@ ...@@ -19,7 +18,7 @@
android:allowBackup="true" android:allowBackup="true"
> >
<activity <activity
android:name=".MainActivity" android:name=".SplashScreen"
android:label="@string/title_activity_main" > android:label="@string/title_activity_main" >
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
...@@ -33,6 +32,9 @@ ...@@ -33,6 +32,9 @@
<data android:scheme="file" android:host="*" android:pathPattern=".*\\.pro" android:mimeType="*/*" /> <data android:scheme="file" android:host="*" android:pathPattern=".*\\.pro" android:mimeType="*/*" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main" />
</application> </application>
</manifest> </manifest>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView android:id="@+id/splashImage"
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/app_name"
android:src="@drawable/ic_launcher" />
<TextView android:id="@+id/splashTitle"
android:layout_below="@id/splashImage"
android:layout_width="fill_parent"
android:gravity="center"
android:layout_height="wrap_content"
android:text="ONELAB for Android"
android:textSize="24dp"
android:textStyle="bold"/>
</RelativeLayout>
\ No newline at end of file
...@@ -100,7 +100,7 @@ public class MainActivity extends Activity { ...@@ -100,7 +100,7 @@ public class MainActivity extends Activity {
modelList = new Models(); modelList = new Models();
getModels(); getModels();
loadNative(); loadNative();
if(intent.getAction().equals(Intent.ACTION_VIEW)) { if(intent != null && intent.getAction() != null && intent.getAction().equals(Intent.ACTION_VIEW)) {
String tmp = intent.getData().getPath(); String tmp = intent.getData().getPath();
gmsh.load(tmp); gmsh.load(tmp);
} }
......
package org.geuz.onelab;
import android.app.Activity;
import android.content.Intent;
import android.os.Handler;
import android.os.Message;
public class SplashScreen extends Activity{
private static final int SPLASHTIME = 1000; // duration for the splash screen in milliseconds
private static final int STOPSPLASH = 0;
private static final int EXITAPP = 1;
private final Handler handler = new Handler()
{
public void handleMessage(Message msg) {
switch (msg.what) {
case STOPSPLASH:
final Intent intent = new Intent(SplashScreen.this, MainActivity.class);
startActivity(intent);
finish();
break;
case EXITAPP:
finish();
break;
default:
break;
}
};
};
protected void onCreate(android.os.Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
final Message msg = new Message();
msg.what = STOPSPLASH;
handler.sendMessageDelayed(msg, SPLASHTIME);
};
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment