|
2 | 2 | ***
|
3 | 3 | 为方便查找,已进行大致归类,其目录如下所示:
|
4 | 4 | > - [App相关][app.md]→[AppUtils.java][app.java]
|
5 |
| -> - 安装指定路径下的Apk *installApp* |
6 |
| -> - 卸载指定包名的App *uninstallApp* |
7 |
| -> - 获取当前App信息 *getAppInfo* |
8 |
| -> - 获取所有已安装App信息 *getAllAppsInfo* |
9 |
| -> - 根据包名判断App是否安装 *isInstallApp* |
10 |
| -> - 打开指定包名的App *openAppByPackageName* |
11 |
| -> - 打开指定包名的App应用信息界面 *openAppInfo* |
12 |
| -> - 可用来做App信息分享 *shareAppInfo* |
13 |
| -> - 判断当前App处于前台还是后台 *isApplicationBackground* |
| 5 | +> - 安装指定路径下的Apk *installApp* |
| 6 | +> - 卸载指定包名的App *uninstallApp* |
| 7 | +> - 获取当前App信息 *getAppInfo* |
| 8 | +> - 获取所有已安装App信息 *getAllAppsInfo* |
| 9 | +> - 根据包名判断App是否安装 *isInstallApp* |
| 10 | +> - 打开指定包名的App *openAppByPackageName* |
| 11 | +> - 打开指定包名的App应用信息界面 *openAppInfo* |
| 12 | +> - 可用来做App信息分享 *shareAppInfo* |
| 13 | +> - 判断当前App处于前台还是后台 *isApplicationBackground* |
14 | 14 |
|
15 | 15 | > - [设备相关][device.md]→[DeviceUtils.java][device.java]
|
16 |
| -> - 获取设备MAC地址 *getMacAddress* |
17 |
| -> - 获取设备厂商,如Xiaomi *getManufacturer* |
18 |
| -> - 获取设备型号,如MI2SC *getModel* |
19 |
| -> - 获取设备SD卡是否可用 *isSDCardEnable* |
20 |
| -> - 获取设备SD卡路径 *getSDCardPath* |
| 16 | +> - 获取设备MAC地址 *getMacAddress* |
| 17 | +> - 获取设备厂商,如Xiaomi *getManufacturer* |
| 18 | +> - 获取设备型号,如MI2SC *getModel* |
| 19 | +> - 获取设备SD卡是否可用 *isSDCardEnable* |
| 20 | +> - 获取设备SD卡路径 *getSDCardPath* |
21 | 21 |
|
22 | 22 | > - [编码解码相关][encode.md]→[EncodeUtils.java][encode.java]
|
23 |
| -> - 以UTF-8编码字符串 *encodeUTF8* |
24 |
| -> - 字符编码 *encode* |
25 |
| -> - 以UTF-8解码字符串 *decodeUTF8* |
26 |
| -> - 字符解码 *decode* |
| 23 | +> - 以UTF-8编码字符串 *encodeUTF8* |
| 24 | +> - 字符编码 *encode* |
| 25 | +> - 以UTF-8解码字符串 *decodeUTF8* |
| 26 | +> - 字符解码 *decode* |
27 | 27 |
|
28 | 28 | > - [加解密相关][encrypt.md]→[EncryptUtils.java][encrypt.java]
|
29 |
| -> - MD5加密 *getMD5* *encryptMD5* *getMD5File* |
30 |
| -> - SHA加密 *getSHA* *encryptSHA* |
| 29 | +> - MD5加密 *getMD5* *encryptMD5* *getMD5File* |
| 30 | +> - SHA加密 *getSHA* *encryptSHA* |
31 | 31 |
|
32 | 32 | > - [键盘相关][keyboard.md]→[KeyboardUtils.java][keyboard.java]
|
33 |
| -> - 避免输入法面板遮挡 |
34 |
| -> - 动态隐藏软键盘 *hideSoftInput* |
35 |
| -> - 点击屏幕空白区域隐藏软键盘(注释萌萌哒) *clickBlankArea2HideSoftInput0* |
36 |
| -> - 动态显示软键盘 *showSoftInput* |
37 |
| -> - 切换键盘显示与否状态 *toggleSoftInput* |
| 33 | +> - 避免输入法面板遮挡 |
| 34 | +> - 动态隐藏软键盘 *hideSoftInput* |
| 35 | +> - 点击屏幕空白区域隐藏软键盘(注释萌萌哒) *clickBlankArea2HideSoftInput0* |
| 36 | +> - 动态显示软键盘 *showSoftInput* |
| 37 | +> - 切换键盘显示与否状态 *toggleSoftInput* |
38 | 38 |
|
39 | 39 | > - [网络相关][network.md]→[NetworkUtils.java][network.java]
|
40 |
| -> - 打开网络设置界面 *openWirelessSettings* |
41 |
| -> - 判断网络是否可用 *isAvailable* |
42 |
| -> - 判断网络是否连接 *isConnected* |
43 |
| -> - 判断网络是否是4G *is4G* |
44 |
| -> - 判断wifi是否连接状态 *isWifiConnected* |
45 |
| -> - 获取移动网络运营商名称 *getNetworkOperatorName* |
46 |
| -> - 获取移动终端类型 *getPhoneType* |
47 |
| -> - 获取当前的网络类型(WIFI,2G,3G,4G) *getNetWorkType* *getNetWorkTypeName* |
| 40 | +> - 打开网络设置界面 *openWirelessSettings* |
| 41 | +> - 判断网络是否可用 *isAvailable* |
| 42 | +> - 判断网络是否连接 *isConnected* |
| 43 | +> - 判断网络是否是4G *is4G* |
| 44 | +> - 判断wifi是否连接状态 *isWifiConnected* |
| 45 | +> - 获取移动网络运营商名称 *getNetworkOperatorName* |
| 46 | +> - 获取移动终端类型 *getPhoneType* |
| 47 | +> - 获取当前的网络类型(WIFI,2G,3G,4G) *getNetWorkType* *getNetWorkTypeName* |
48 | 48 |
|
49 | 49 | > - [手机相关][phone.md]→[PhoneUtils.java][phone.java]
|
50 |
| -> - 判断设备是否是手机 *isPhone* |
51 |
| -> - 获取手机的IMIE *getDeviceIMEI* |
52 |
| -> - 获取手机状态信息 *getPhoneStatus* |
53 |
| -> - 跳至填充好phoneNumber的拨号界面 *dial* |
54 |
| -> - 拨打phoneNumber *call* |
55 |
| -> - 发送短信 *sendSms* |
56 |
| -> - 获取手机联系人 *getAllContactInfo* |
57 |
| -> - 打开手机联系人界面点击联系人后便获取该号码(注释萌萌哒) *getContantNum* |
58 |
| -> - 获取手机短信并保存到xml中 *getAllSMS* |
| 50 | +> - 判断设备是否是手机 *isPhone* |
| 51 | +> - 获取手机的IMIE *getDeviceIMEI* |
| 52 | +> - 获取手机状态信息 *getPhoneStatus* |
| 53 | +> - 跳至填充好phoneNumber的拨号界面 *dial* |
| 54 | +> - 拨打phoneNumber *call* |
| 55 | +> - 发送短信 *sendSms* |
| 56 | +> - 获取手机联系人 *getAllContactInfo* |
| 57 | +> - 打开手机联系人界面点击联系人后便获取该号码(注释萌萌哒) *getContantNum* |
| 58 | +> - 获取手机短信并保存到xml中 *getAllSMS* |
59 | 59 |
|
60 | 60 | > - [正则相关][regular.md]→[RegularUtils.java][regular.java]
|
61 |
| -> - 正则工具类 |
| 61 | +> - 正则工具类 |
62 | 62 |
|
63 | 63 | > - [屏幕相关][screen.md]→[ScreenUtils.java][screen.java]
|
64 |
| -> - 获取手机分辨率 *getDeviceWidth*、*getDeviceHeight* |
65 |
| -> - 设置透明状态栏(api >= 19方可使用) *setTransparentStatusBar* |
66 |
| -> - 隐藏状态栏(注释萌萌哒) *hideStatusBar* |
67 |
| -> - 获取状态栏高度 *getStatusBarHeight* |
68 |
| -> - 判断状态栏是否存在 *isStatusBarExists* |
69 |
| -> - 获取ActionBar高度 *getActionBarHeight* |
70 |
| -> - 显示通知栏 *showNotificationBar* |
71 |
| -> - 隐藏通知栏 *hideNotificationBar* |
72 |
| -> - 设置屏幕为横屏(注释萌萌哒) *setLandscape* |
73 |
| -> - 获取屏幕截图 *snapShotWithStatusBar*、*snapShotWithoutStatusBar* |
74 |
| -> - 判断是否锁屏 *isScreenLock* |
| 64 | +> - 获取手机分辨率 *getDeviceWidth*、*getDeviceHeight* |
| 65 | +> - 设置透明状态栏(api >= 19方可使用) *setTransparentStatusBar* |
| 66 | +> - 隐藏状态栏(注释萌萌哒) *hideStatusBar* |
| 67 | +> - 获取状态栏高度 *getStatusBarHeight* |
| 68 | +> - 判断状态栏是否存在 *isStatusBarExists* |
| 69 | +> - 获取ActionBar高度 *getActionBarHeight* |
| 70 | +> - 显示通知栏 *showNotificationBar* |
| 71 | +> - 隐藏通知栏 *hideNotificationBar* |
| 72 | +> - 设置屏幕为横屏(注释萌萌哒) *setLandscape* |
| 73 | +> - 获取屏幕截图 *snapShotWithStatusBar*、*snapShotWithoutStatusBar* |
| 74 | +> - 判断是否锁屏 *isScreenLock* |
75 | 75 |
|
76 | 76 | > - [Shell相关][shell.md]→[ShellUtils.java][shell.java]
|
77 |
| -> - 判断设备是否root *isRoot* |
78 |
| -> - 是否是在root下执行命令 *execCmd* |
| 77 | +> - 判断设备是否root *isRoot* |
| 78 | +> - 是否是在root下执行命令 *execCmd* |
79 | 79 |
|
80 | 80 | > - [尺寸相关][size.md]→[SizeUtils.java][size.java]
|
81 |
| -> - dp与px转换 *dp2px*、*px2dp* |
82 |
| -> - sp与px转换 *sp2px*、*px2sp* |
83 |
| -> - 各种单位转换 *applyDimension* |
84 |
| -> - 在onCreate()即可强行获取View的尺寸 *forceGetViewSize* |
85 |
| -> - ListView中提前测量View尺寸(注释萌萌哒) *measureView* |
| 81 | +> - dp与px转换 *dp2px*、*px2dp* |
| 82 | +> - sp与px转换 *sp2px*、*px2sp* |
| 83 | +> - 各种单位转换 *applyDimension* |
| 84 | +> - 在onCreate()即可强行获取View的尺寸 *forceGetViewSize* |
| 85 | +> - ListView中提前测量View尺寸(注释萌萌哒) *measureView* |
86 | 86 |
|
87 | 87 | > - [SP相关][sp.md]→[SPUtils.java][sp.java]
|
88 |
| -> - SP中写入String类型value *putString* |
89 |
| -> - SP中读取String *getString* |
90 |
| -> - SP中写入int类型value *putInt* |
91 |
| -> - SP中读取int *getInt* |
92 |
| -> - SP中写入long类型value *putLong* |
93 |
| -> - SP中读取long *getLong* |
94 |
| -> - SP中写入float类型value *putFloat* |
95 |
| -> - SP中读取float *getFloat* |
96 |
| -> - SP中写入boolean类型value *putBoolean* |
97 |
| -> - SP中读取boolean *getBoolean* |
98 |
| -
|
99 |
| -> - [时间相关][time.md]→[TimeUtils.java][time.java] |
100 |
| -> - 将时间戳转为时间字符串 *milliseconds2String* |
101 |
| -> - 将时间字符串转为时间戳 *string2Milliseconds* |
102 |
| -> - 将时间字符串转为Date类型 *string2Date* |
103 |
| -> - 将Date类型转为时间字符串 *date2String* |
104 |
| -> - 将Date类型转为时间戳 *date2Milliseconds* |
105 |
| -> - 将时间戳转为Date类型 *milliseconds2Date* |
106 |
| -> - 毫秒时间戳单位转换(单位:unit) *milliseconds2Unit* |
107 |
| -> - 获取两个时间差(单位:unit) *getIntervalTime* |
108 |
| -> - 获取当前时间 *getCurTimeMills* *getCurTimeString* *getCurTimeDate* |
109 |
| -> - 获取与当前时间的差(单位:unit) *getIntervalByNow* |
110 |
| -> - 判断闰年 *isLeapYear* |
| 88 | +> - SP中写入String类型value *putString* |
| 89 | +> - SP中读取String *getString* |
| 90 | +> - SP中写入int类型value *putInt* |
| 91 | +> - SP中读取int *getInt* |
| 92 | +> - SP中写入long类型value *putLong* |
| 93 | +> - SP中读取long *getLong* |
| 94 | +> - SP中写入float类型value *putFloat* |
| 95 | +> - SP中读取float *getFloat* |
| 96 | +> - SP中写入boolean类型value *putBoolean* |
| 97 | +> - SP中读取boolean *getBoolean* |
| 98 | +
|
| 99 | +> [时间相关][time.md]→[TimeUtils.java][time.java] |
| 100 | +> - 将时间戳转为时间字符串 *milliseconds2String* |
| 101 | +> - 将时间字符串转为时间戳 *string2Milliseconds* |
| 102 | +> - 将时间字符串转为Date类型 *string2Date* |
| 103 | +> - 将Date类型转为时间字符串 *date2String* |
| 104 | +> - 将Date类型转为时间戳 *date2Milliseconds* |
| 105 | +> - 将时间戳转为Date类型 *milliseconds2Date* |
| 106 | +> - 毫秒时间戳单位转换(单位:unit) *milliseconds2Unit* |
| 107 | +> - 获取两个时间差(单位:unit) *getIntervalTime* |
| 108 | +> - 获取当前时间 *getCurTimeMills* *getCurTimeString* *getCurTimeDate* |
| 109 | +> - 获取与当前时间的差(单位:unit) *getIntervalByNow* |
| 110 | +> - 判断闰年 *isLeapYear* |
111 | 111 |
|
112 | 112 | > - [未归类][unclassified.md]→[UnclassifiedUtils.java][unclassified.java]
|
113 |
| -> - 获取服务是否开启 *isRunningService* |
| 113 | +> - 获取服务是否开启 *isRunningService* |
114 | 114 | > - [更新Log][update_log.md]
|
115 | 115 |
|
116 | 116 | ***
|
|
119 | 119 |
|
120 | 120 | ### Download
|
121 | 121 | ***
|
122 |
| -Gradle:(还没过审核) |
| 122 | +Gradle: |
123 | 123 | ``` groovy
|
124 | 124 | compile 'com.blankj:utilcode:1.0'
|
125 | 125 | ```
|
126 | 126 |
|
127 | 127 | ### Proguard
|
128 | 128 | ***
|
129 |
| -``` xml |
| 129 | +``` |
130 | 130 | -keep class com.blankj.utilcode.** { *; }
|
131 | 131 | -keepclassmembers class com.blankj.utilcode.** { *; }
|
132 | 132 | -dontwarn com.blankj.utilcode.**
|
133 | 133 | ```
|
134 | 134 |
|
135 | 135 | ### License
|
136 | 136 | ***
|
137 |
| - Copyright 2016 Blankj |
138 |
| - |
139 |
| - Licensed under the Apache License, Version 2.0 (the "License"); |
140 |
| - you may not use this file except in compliance with the License. |
141 |
| - You may obtain a copy of the License at |
142 |
| - |
143 |
| - http://www.apache.org/licenses/LICENSE-2.0 |
| 137 | +``` |
| 138 | +Copyright 2016 Blankj |
144 | 139 |
|
145 |
| - Unless required by applicable law or agreed to in writing, software |
146 |
| - distributed under the License is distributed on an "AS IS" BASIS, |
147 |
| - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
148 |
| - See the License for the specific language governing permissions and |
149 |
| - limitations under the License. |
| 140 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 141 | +you may not use this file except in compliance with the License. |
| 142 | +You may obtain a copy of the License at |
150 | 143 |
|
| 144 | + http://www.apache.org/licenses/LICENSE-2.0 |
151 | 145 |
|
| 146 | +Unless required by applicable law or agreed to in writing, software |
| 147 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 148 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 149 | +See the License for the specific language governing permissions and |
| 150 | +limitations under the License. |
| 151 | +``` |
152 | 152 |
|
153 | 153 | [app.md]: https://github.com/Blankj/AndroidUtilCode/blob/master/md/about_app.md
|
154 | 154 | [app.java]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/src/main/java/com/blankj/utilcode/utils/AppUtils.java
|
|
0 commit comments