WMSApplication.java
1.88 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
71
72
73
74
75
76
77
78
79
80
81
82
package com.lijinji.part;
import android.app.Application;
import android.content.Context;
import com.lijinji.part.util.CrashHandler;
import com.lijinji.part.util.SoundUtils;
import com.lijinji.part.util.SpeechUtil;
import org.xutils.x;
public class WMSApplication extends Application {
private static String cookie;
// greenDao
// private DaoMaster.DevOpenHelper mHelper;
// private SQLiteDatabase db;
// private DaoMaster mDaoMaster;
// private DaoSession mDaoSession;
private static Context mContext;
private static WMSApplication instance;
@Override
public void onCreate() {
super.onCreate();
initData();
}
public static WMSApplication getInstance() {
if(instance == null) {
instance = new WMSApplication();
}
return instance;
}
public void initData() {
mContext = this;
SoundUtils.getInstance(this);
setupDataBase();
CrashHandler.getInstance().init(this);
x.Ext.init(this);
x.Ext.setDebug(BuildConfig.DEBUG); // 是否输出debug日志, 开启debug会影响性能.
SpeechUtil.getInstance(mContext).initSpeech();
}
public static String getOkhttpCookie() {
return cookie;
}
public static void setOkhttpCookie(String result) {
cookie = result;
}
/**
* 初始化数据库
*/
private void setupDataBase() {
// mHelper = new DaoMaster.DevOpenHelper(this, "WMSApplication", null);
// db = mHelper.getWritableDatabase();
// mDaoMaster = new DaoMaster(db);
// mDaoSession = mDaoMaster.newSession();
// WMSLog.d("setupDataBase");
}
// public DaoSession getDaoSession() {
// return mDaoSession;
// }
//
// public SQLiteDatabase getDb() {
// return db;
// }
public static Context getContext() {
return mContext;
}
}