AppConfig.java
1.96 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package com.studymachine.www.other;
import com.studymachine.www.BuildConfig;
/**
* desc : App 配置管理类
*/
public final class AppConfig {
private static String hostUrl=BuildConfig.HOST_URL;
private static String webHostUrl=BuildConfig.WEB_HOST_URL;
/**
* 密码正则
*/
public static String getPasswordReg() {
return "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,12}$";
}
/**
* 当前是否为调试模式
*/
public static boolean isDebug() {
return BuildConfig.DEBUG;
}
/**
* 获取当前构建的模式
*/
public static String getBuildType() {
return BuildConfig.BUILD_TYPE;
}
/**
* 当前是否要开启日志打印功能
*/
public static boolean isLogEnable() {
return BuildConfig.LOG_ENABLE;
}
/**
* 获取当前应用的包名
*/
public static String getPackageName() {
return BuildConfig.APPLICATION_ID;
}
/**
* 获取当前应用的版本名
*/
public static String getVersionName() {
return BuildConfig.VERSION_NAME;
}
/**
* 获取当前应用的版本码
*/
public static int getVersionCode() {
return BuildConfig.VERSION_CODE;
}
/**
* 获取 Bugly Id
*/
public static String getBuglyId() {
return BuildConfig.BUGLY_ID;
}
/**
* 获取服务器主机地址
*/
public static String getHostUrl() {
return hostUrl;
}
public static void setHostUrl(String hostUrl) {
AppConfig.hostUrl = hostUrl;
}
/**
* 获取oss服务器主机地址
*/
public static String getImagerHostUrl() {
return BuildConfig.IMAGER_HOST_URL;
}
/**
* 获取web主机地址
*/
public static String getWebHostUrl() {
return webHostUrl;
}
public static void setWebHostUrl(String webHostUrl) {
AppConfig.webHostUrl = webHostUrl;
}
}