WMSApplication.java
1.75 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
69
70
package com.huaheng.mmsrf;
import android.app.Application;
import android.content.Context;
import com.huaheng.mmsrf.BuildConfig;
import com.huaheng.mmsrf.service.WebClient;
import com.huaheng.mmsrf.util.CrashHandler;
import com.huaheng.mmsrf.util.SpeechUtil;
import org.xutils.x;
public class WMSApplication extends Application {
    private static Context mContext;
    private static WMSApplication 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 WMSApplication getInstance() {
        if(instance == null) {
            instance = new WMSApplication();
        }
        return instance;
    }
    public  void initData() {
        mContext = this;
        x.Ext.init(this);
        x.Ext.setDebug(BuildConfig.DEBUG); // 是否输出debug日志, 开启debug会影响性能.
        com.huaheng.mmsrf.util.CrashHandler.getInstance().init(this);
        com.huaheng.mmsrf.util.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) {
        WMSApplication.token = token;
    }
    public static boolean isBluetoothConnect() {
        return bluetoothConnect;
    }
    public static void setBluetoothConnect(boolean bluetoothConnect) {
        WMSApplication.bluetoothConnect = bluetoothConnect;
    }
}