Project

General

Profile

Download (1.88 KB) Statistics
| Branch: | Revision:

sokoban / distorted-sokoban / src / main / java / org / distorted / sokoban / SokobanSplash.java @ 1f6d1786

1
package org.distorted.sokoban;
2

    
3
import android.app.Activity;
4
import android.content.Intent;
5
import android.os.Bundle;
6
import android.util.Log;
7

    
8
import com.google.firebase.analytics.FirebaseAnalytics;
9
import com.google.firebase.inappmessaging.FirebaseInAppMessaging;
10

    
11
import org.distorted.messaging.SokobanInAppMessanging;
12

    
13
///////////////////////////////////////////////////////////////////
14

    
15
public class SokobanSplash extends Activity
16
{
17
	private int sleepTime=2000;
18

    
19
  private class SplashThread extends Thread
20
    {
21
    private boolean bootup=true;
22
		
23
		public void run() 
24
		  {
25
			int milis=0;
26
			
27
			while(bootup)
28
			  {
29
				try
30
				  {
31
					milis+=100;
32
					Thread.sleep(100);
33
				  }
34
				catch( InterruptedException ex) { }
35
			  }
36
			
37
			if( milis<sleepTime )
38
			  {
39
				try
40
				  {
41
					Thread.sleep(sleepTime-milis);
42
				  }
43
				catch( InterruptedException ex) { }
44
			  }
45

    
46
			finish();
47
			Intent mainInt = new Intent( getApplicationContext(), SokobanActivity.class);
48
			startActivity(mainInt);
49
		  }
50
		public void bootupReady()
51
		{
52
			bootup=false;
53
		}
54
    };
55
    
56
///////////////////////////////////////////////////////////////////
57
	
58
  public void onCreate(Bundle savedInstanceState)
59
    {
60
    super.onCreate(savedInstanceState);
61
  	setContentView(R.layout.splash);
62
    sleepTime=2000;
63
    }
64

    
65
///////////////////////////////////////////////////////////////////
66

    
67
  public void onStart()
68
    {
69
    super.onStart();
70
    	
71
    SplashThread splashThread = new SplashThread();
72
    splashThread.start();
73
    	
74
    SokobanLevels.init(this);
75
    SokobanLevels sl = SokobanLevels.getInstance();
76
        
77
    SokobanCanvas.init(this);
78
    SokobanCanvas.setActivity(this);
79
    	
80
    SokobanDatabase.init(this);
81
    SokobanTimer.init();
82
    SokobanCanvas.setLevels(sl);
83
    SokobanRecords.setLevels(sl);
84

    
85
    splashThread.bootupReady();
86
    }
87

    
88
///////////////////////////////////////////////////////////////////
89
// end of file
90
}
(11-11/12)