| 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;
|
| 21 |
gabriel |
6 |
import android.graphics.drawable.AnimationDrawable;
|
| 2 |
gabriel |
7 |
import android.os.Bundle;
|
|
|
8 |
import android.view.Window;
|
| 21 |
gabriel |
9 |
import android.widget.ImageView;
|
| 2 |
gabriel |
10 |
|
|
|
11 |
import com.cesams.twogetskills.R;
|
|
|
12 |
|
|
|
13 |
import java.util.Timer;
|
|
|
14 |
import java.util.TimerTask;
|
|
|
15 |
|
| 21 |
gabriel |
16 |
|
|
|
17 |
|
| 2 |
gabriel |
18 |
public class SplashActivity extends Activity {
|
|
|
19 |
|
|
|
20 |
// Set the duration of the splash screen
|
|
|
21 |
private static final long SPLASH_SCREEN_DELAY = 3500;
|
| 21 |
gabriel |
22 |
AnimationDrawable rocketAnimation;
|
| 2 |
gabriel |
23 |
|
|
|
24 |
@Override
|
|
|
25 |
protected void onCreate(Bundle savedInstanceState) {
|
|
|
26 |
super.onCreate(savedInstanceState);
|
|
|
27 |
|
|
|
28 |
// Set portrait orientation
|
|
|
29 |
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
|
|
30 |
// Hide title bar
|
|
|
31 |
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
|
|
32 |
setContentView(R.layout.activity_splash);
|
|
|
33 |
|
| 21 |
gabriel |
34 |
ImageView rocketImage = (ImageView) findViewById(R.id.imageView4);
|
|
|
35 |
rocketImage.setBackgroundResource(R.drawable.animationsplash);
|
|
|
36 |
rocketAnimation = (AnimationDrawable) rocketImage.getBackground();
|
|
|
37 |
rocketAnimation.start();
|
| 2 |
gabriel |
38 |
|
|
|
39 |
TimerTask task = new TimerTask() {
|
|
|
40 |
@Override
|
|
|
41 |
public void run() {
|
|
|
42 |
|
|
|
43 |
// Start the next activity
|
|
|
44 |
Intent mainIntent = new Intent().setClass(
|
|
|
45 |
SplashActivity.this, MainActivity.class);
|
|
|
46 |
startActivity(mainIntent);
|
|
|
47 |
|
|
|
48 |
// Close the activity so the user won't able to go back this
|
|
|
49 |
// activity pressing Back button
|
|
|
50 |
finish();
|
|
|
51 |
}
|
|
|
52 |
};
|
|
|
53 |
|
|
|
54 |
// Simulate a long loading process on application startup.
|
|
|
55 |
Timer timer = new Timer();
|
|
|
56 |
timer.schedule(task, SPLASH_SCREEN_DELAY);
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
}
|