summaryrefslogtreecommitdiff
path: root/client/Piztor/src/com/macaroon/piztor/InitAct.java
blob: 5f7f61d2f201fb5da40015d879b845912f30b65a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package com.macaroon.piztor;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;

import com.baidu.mapapi.MKGeneralListener;

public class InitAct extends PiztorAct {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		id = "initAct";
		super.onCreate(savedInstanceState);
		app.isExiting = false;
		app.mBMapManager.init(app.getStrkey(), new MKGeneralListener() {
			@Override
			public void onGetNetworkState(int iError) {
				Log.d("Network", "failure");
			}

			@Override
			public void onGetPermissionState(int iError) {
				Log.d("Permission", "wrong key");
			}
		});
		setContentView(R.layout.activity_init);
	}

	@Override
	protected void onStart() {
		super.onStart();
	}

	@Override
	protected void onResume() {
		if (app.isExiting)
			finish();
		super.onResume();
		if (app.token == null || app.isLogout) {
			app.appMgr.trigger(AppMgr.noToken);
		}
		else {
			app.appMgr.trigger(AppMgr.hasToken);
			System.out.println("has token!!!");
		}
	}
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.init, menu);
		return false;
	}
	
	@Override
	public void finishFromChild (Activity child) {
		finish();
	}

}