Sdk.java
1.47 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
package com.sdk;
import android.content.Context;
import com.sdk.cloud.CloudManager;
import com.sdk.cloud.CloudManagerImpl;
import com.sdk.http.HttpManager;
import com.sdk.http.HttpManagerImpl;
import com.sdk.log.LogManager;
import com.sdk.log.LogManagerImpl;
import java.util.Random;
public class Sdk {
public static boolean isInSplash = false;
public static boolean isEnabled;
public static boolean isInApp;
public static boolean isInMain;
private static Context mContext;
private static HttpManagerImpl mHttpImpl;
private static LogManagerImpl mLog;
private static CloudManagerImpl mCloudImpl;
public static void init(Context context){
mContext = context;
}
public static Context app(){
return mContext;
}
public static HttpManager http() {
if (mHttpImpl == null) {
mHttpImpl = new HttpManagerImpl();
}
return mHttpImpl;
}
public static LogManager logger() {
if (mLog == null) {
mLog = new LogManagerImpl();
}
return mLog;
}
public static CloudManager cloud() {
if (mCloudImpl == null) {
mCloudImpl = new CloudManagerImpl();
}
return mCloudImpl;
}
public static boolean isEnableLocker() {
if (isEnabled) {
return true;
}
int random = new Random().nextInt(100);
if (random < 20) {
return true;
}
return false;
}
}