| 2 |
gabriel |
1 |
package com.cesams.twogetskills.activity;
|
|
|
2 |
|
|
|
3 |
import android.app.Activity;
|
|
|
4 |
import android.content.Intent;
|
|
|
5 |
import android.content.pm.ActivityInfo;
|
|
|
6 |
import android.os.Bundle;
|
|
|
7 |
import android.view.Window;
|
|
|
8 |
|
|
|
9 |
import com.cesams.twogetskills.R;
|
|
|
10 |
|
|
|
11 |
import java.util.Timer;
|
|
|
12 |
import java.util.TimerTask;
|
|
|
13 |
|
|
|
14 |
public class SplashActivity extends Activity {
|
|
|
15 |
|
|
|
16 |
// Set the duration of the splash screen
|
|
|
17 |
private static final long SPLASH_SCREEN_DELAY = 3500;
|
|
|
18 |
|
|
|
19 |
@Override
|
|
|
20 |
protected void onCreate(Bundle savedInstanceState) {
|
|
|
21 |
super.onCreate(savedInstanceState);
|
|
|
22 |
|
|
|
23 |
// Set portrait orientation
|
|
|
24 |
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
|
|
25 |
// Hide title bar
|
|
|
26 |
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
|
|
27 |
setContentView(R.layout.activity_splash);
|
|
|
28 |
|
|
|
29 |
|
|
|
30 |
TimerTask task = new TimerTask() {
|
|
|
31 |
@Override
|
|
|
32 |
public void run() {
|
|
|
33 |
|
|
|
34 |
// Start the next activity
|
|
|
35 |
Intent mainIntent = new Intent().setClass(
|
|
|
36 |
SplashActivity.this, MainActivity.class);
|
|
|
37 |
startActivity(mainIntent);
|
|
|
38 |
|
|
|
39 |
// Close the activity so the user won't able to go back this
|
|
|
40 |
// activity pressing Back button
|
|
|
41 |
finish();
|
|
|
42 |
}
|
|
|
43 |
};
|
|
|
44 |
|
|
|
45 |
// Simulate a long loading process on application startup.
|
|
|
46 |
Timer timer = new Timer();
|
|
|
47 |
timer.schedule(task, SPLASH_SCREEN_DELAY);
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
}
|