package com.jqyd.manager;
import com.jqyd.app.MyApp;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.Window;
import android.view.WindowManager;
public class Load extends Activity{
private boolean _active=true;
private int _splashTime=2000;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
Log.e("Load", "onCreate");
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
super.onCreate(savedInstanceState);
MyApp myapp = (MyApp) this.getApplication();
if(myapp.getIslogin()){
this.finish();
}else{
setContentView(R.layout.load);
this.setTitle("久其管家");
Thread splashTread = new Thread() {
@Override
public void run() {
try {
int waited = 0;
while(_active && (waited < _splashTime)) {
sleep(100);
if(_active) {
waited += 100;
}
}
} catch(InterruptedException e) {
// do nothing
} finally {
finish();
// 启动主应用
startActivity(new Intent(Load.this,Login.class));
//stop();
}
}
};
splashTread.start();
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
// TODO Auto-generated method stub
if (event.getAction() == MotionEvent.ACTION_DOWN) {
_active = false;
}
return true;
}
@Override
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
Log.e("Load", "onDestroy");
}
}