MESApplication.java
1.62 KB
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
62
63
64
65
66
67
68
package com.huaheng.mes;
import android.app.Application;
import android.content.Context;
import com.huaheng.mes.util.CrashHandler;
import com.huaheng.mes.util.SpeechUtil;
import org.xutils.x;
public class MESApplication extends Application {
private static Context mContext;
private static MESApplication instance;
private static String cookie;
private static String token = "";
public static boolean bluetoothConnect = false;
@Override
public void onCreate() {
super.onCreate();
mContext = this;
initData();
}
public static MESApplication getInstance() {
if(instance == null) {
instance = new MESApplication();
}
return instance;
}
public void initData() {
mContext = this;
x.Ext.init(this);
x.Ext.setDebug(BuildConfig.DEBUG); // 是否输出debug日志, 开启debug会影响性能.
CrashHandler.getInstance().init(this);
SpeechUtil.getInstance(mContext).initSpeech();
}
public static Context getContext() {
return mContext;
}
public static String getOkhttpCookie() {
return cookie;
}
public static void setOkhttpCookie(String result) {
cookie = result;
}
public static String getToken() {
return token;
}
public static void setToken(String token) {
MESApplication.token = token;
}
public static boolean isBluetoothConnect() {
return bluetoothConnect;
}
public static void setBluetoothConnect(boolean bluetoothConnect) {
MESApplication.bluetoothConnect = bluetoothConnect;
}
}