Skip to content

Commit

Permalink
Add splash screen
Browse files Browse the repository at this point in the history
  • Loading branch information
axelson committed Dec 9, 2011
1 parent ba50a11 commit d8782ee
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 17 deletions.
38 changes: 21 additions & 17 deletions AndroidManifest.xml
@@ -1,22 +1,26 @@
<?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="org.hicapacity.techhui" package="org.hicapacity.techhui" android:versionCode="2"
android:versionCode="2" android:versionName="0.3">
android:versionName="0.3"> <uses-sdk android:minSdkVersion="8" />
<uses-sdk android:minSdkVersion="8" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.INTERNET" />


<application android:icon="@drawable/icon" android:label="@string/app_name"> <application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".TechHuiActivity" <activity android:name=".TechHuiActivity" android:label="@string/app_name">
android:label="@string/app_name"> <intent-filter>
<intent-filter> <action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" /> </intent-filter>
</intent-filter> </activity>
</activity> <activity android:name=".ConferenceActivity"></activity>
<activity android:name=".ConferenceActivity"></activity> <activity android:name=".CommunityActivity"></activity>
<activity android:name=".CommunityActivity"></activity> <activity android:name=".WebScheduleActivity"></activity>
<activity android:name=".WebScheduleActivity"></activity> <activity android:name=".NewSplashScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>


</application> </application>
</manifest> </manifest>
Binary file added res/drawable-hdpi/splash.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-ldpi/splash.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-mdpi/splash.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions res/layout/splash.xml
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/SplashImageView"
android:scaleType="fitXY"
android:src="@drawable/splash"
>
</ImageView>
</LinearLayout>
70 changes: 70 additions & 0 deletions src/org/hicapacity/techhui/NewSplashScreen.java
@@ -0,0 +1,70 @@
package org.hicapacity.techhui;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;

public class NewSplashScreen extends Activity {

/**
* The thread to process splash screen events
*/
private Thread mSplashThread;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

// Splash screen view
setContentView(R.layout.splash);

ImageView timeView = (ImageView) this.findViewById(R.id.SplashImageView);
timeView.setScaleType(ScaleType.FIT_XY);

final NewSplashScreen sPlashScreen = this;

// imgview.setScaleType(ScaleType.FIT_XY);

// The thread to wait for splash screen events
mSplashThread = new Thread() {
@Override
public void run() {
try {
synchronized (this) {
// Wait given period of time or exit on touch
wait(1000);
}
}
catch (InterruptedException ex) {
}

finish();

// Run next activity
Intent intent = new Intent();
intent.setClass(sPlashScreen, TechHuiActivity.class);
startActivity(intent);
stop();
}
};

mSplashThread.start();
}

/**
* Processes splash screen touch events
*/
@Override
public boolean onTouchEvent(MotionEvent evt) {
if (evt.getAction() == MotionEvent.ACTION_DOWN) {
synchronized (mSplashThread) {
mSplashThread.notifyAll();
}
}
return true;
}
}

0 comments on commit d8782ee

Please sign in to comment.