Skip to content

Commit f96b66b

Browse files
committed
see 10/12 log
1 parent 5266fb0 commit f96b66b

File tree

8 files changed

+49
-35
lines changed

8 files changed

+49
-35
lines changed

README-CN.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@
205205
> - 点击屏幕空白区域隐藏软键盘(注释萌萌哒) *clickBlankArea2HideSoftInput0*
206206
> - 动态显示软键盘 *showSoftInput*
207207
> - 切换键盘显示与否状态 *toggleSoftInput*
208+
> - 判断键盘是否显示 *isShowSoftInput*
208209
209210
> - **日志相关→[LogUtils.java][log.java][Test][log.test]**
210211
> - 初始化函数 *init*
@@ -376,7 +377,7 @@
376377
***
377378
Gradle:
378379
``` groovy
379-
compile 'com.blankj:utilcode:1.2.2'
380+
compile 'com.blankj:utilcode:1.3.0'
380381
```
381382

382383
### Proguard

utilcode/src/main/java/com/blankj/utilcode/utils/AppUtils.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,8 @@ public static String getAppSignatureSHA1(Context context) {
386386
* 获取应用签名的的SHA1值
387387
* <p>可据此判断高德,百度地图key是否正确</p>
388388
*
389-
* @param context 上下文
389+
* @param context 上下文
390+
* @param packageName 包名
390391
* @return 应用签名的SHA1字符串, 比如:53:FD:54:DC:19:0F:11:AC:B5:22:9E:F1:1A:68:88:1B:8B:E8:54:42
391392
*/
392393
public static String getAppSignatureSHA1(Context context, String packageName) {
@@ -442,7 +443,8 @@ public static boolean isAppForeground(Context context) {
442443
* <p>需添加权限 {@code <uses-permission android:name="android.permission.GET_TASKS"/>}</p>
443444
* <p>并且必须是系统应用该方法才有效</p>
444445
*
445-
* @param context 上下文
446+
* @param context 上下文
447+
* @param packageName 包名
446448
* @return {@code true}: 是<br>{@code false}: 否
447449
*/
448450
public static boolean isAppForeground(Context context, String packageName) {
@@ -569,7 +571,8 @@ public static AppInfo getAppInfo(Context context) {
569571
* 获取App信息
570572
* <p>AppInfo(名称,图标,包名,版本号,版本Code,是否系统应用)</p>
571573
*
572-
* @param context 上下文
574+
* @param context 上下文
575+
* @param packageName 包名
573576
* @return 当前应用的AppInfo
574577
*/
575578
public static AppInfo getAppInfo(Context context, String packageName) {
@@ -629,6 +632,7 @@ public static List<AppInfo> getAppsInfo(Context context) {
629632
*
630633
* @param context 上下文
631634
* @param dirPaths 目录路径
635+
* @return {@code true}: 成功<br>{@code false}: 失败
632636
*/
633637
public static boolean cleanAppData(Context context, String... dirPaths) {
634638
File[] dirs = new File[dirPaths.length];
@@ -644,6 +648,7 @@ public static boolean cleanAppData(Context context, String... dirPaths) {
644648
*
645649
* @param context 上下文
646650
* @param dirs 目录
651+
* @return {@code true}: 成功<br>{@code false}: 失败
647652
*/
648653
public static boolean cleanAppData(Context context, File... dirs) {
649654
boolean isSuccess = CleanUtils.cleanInternalCache(context);

utilcode/src/main/java/com/blankj/utilcode/utils/CleanUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public static boolean cleanInternalSP(Context context) {
7676

7777
/**
7878
* 清除外部缓存
79-
* <p>/storage/emulated/0/android/data/com.xxx.xxx/cache<p/>
79+
* <p>/storage/emulated/0/android/data/com.xxx.xxx/cache</p>
8080
*
8181
* @param context 上下文
8282
* @return {@code true}: 清除成功<br>{@code false}: 清除失败

utilcode/src/main/java/com/blankj/utilcode/utils/DeviceUtils.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ public static boolean isRoot() {
3535

3636
/**
3737
* 获取设备系统版本号
38+
*
39+
* @return 设备系统版本号
3840
*/
3941
public static int getSDKVersion() {
4042
return android.os.Build.VERSION.SDK_INT;

utilcode/src/main/java/com/blankj/utilcode/utils/EncryptUtils.java

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ private static byte[] hashTemplate(byte[] data, String algorithm) {
344344
* HmacMD5加密
345345
*
346346
* @param data 明文字符串
347+
* @param key 秘钥
347348
* @return 16进制密文
348349
*/
349350
public static String encryptHmacMD5ToString(String data, String key) {
@@ -354,6 +355,7 @@ public static String encryptHmacMD5ToString(String data, String key) {
354355
* HmacMD5加密
355356
*
356357
* @param data 明文字节数组
358+
* @param key 秘钥
357359
* @return 16进制密文
358360
*/
359361
public static String encryptHmacMD5ToString(byte[] data, byte[] key) {
@@ -364,6 +366,7 @@ public static String encryptHmacMD5ToString(byte[] data, byte[] key) {
364366
* HmacMD5加密
365367
*
366368
* @param data 明文字节数组
369+
* @param key 秘钥
367370
* @return 密文字节数组
368371
*/
369372
public static byte[] encryptHmacMD5(byte[] data, byte[] key) {
@@ -374,6 +377,7 @@ public static byte[] encryptHmacMD5(byte[] data, byte[] key) {
374377
* HmacSHA1加密
375378
*
376379
* @param data 明文字符串
380+
* @param key 秘钥
377381
* @return 16进制密文
378382
*/
379383
public static String encryptHmacSHA1ToString(String data, String key) {
@@ -384,6 +388,7 @@ public static String encryptHmacSHA1ToString(String data, String key) {
384388
* HmacSHA1加密
385389
*
386390
* @param data 明文字节数组
391+
* @param key 秘钥
387392
* @return 16进制密文
388393
*/
389394
public static String encryptHmacSHA1ToString(byte[] data, byte[] key) {
@@ -394,6 +399,7 @@ public static String encryptHmacSHA1ToString(byte[] data, byte[] key) {
394399
* HmacSHA1加密
395400
*
396401
* @param data 明文字节数组
402+
* @param key 秘钥
397403
* @return 密文字节数组
398404
*/
399405
public static byte[] encryptHmacSHA1(byte[] data, byte[] key) {
@@ -404,6 +410,7 @@ public static byte[] encryptHmacSHA1(byte[] data, byte[] key) {
404410
* HmacSHA224加密
405411
*
406412
* @param data 明文字符串
413+
* @param key 秘钥
407414
* @return 16进制密文
408415
*/
409416
public static String encryptHmacSHA224ToString(String data, String key) {
@@ -414,6 +421,7 @@ public static String encryptHmacSHA224ToString(String data, String key) {
414421
* HmacSHA224加密
415422
*
416423
* @param data 明文字节数组
424+
* @param key 秘钥
417425
* @return 16进制密文
418426
*/
419427
public static String encryptHmacSHA224ToString(byte[] data, byte[] key) {
@@ -424,6 +432,7 @@ public static String encryptHmacSHA224ToString(byte[] data, byte[] key) {
424432
* HmacSHA224加密
425433
*
426434
* @param data 明文字节数组
435+
* @param key 秘钥
427436
* @return 密文字节数组
428437
*/
429438
public static byte[] encryptHmacSHA224(byte[] data, byte[] key) {
@@ -434,6 +443,7 @@ public static byte[] encryptHmacSHA224(byte[] data, byte[] key) {
434443
* HmacSHA256加密
435444
*
436445
* @param data 明文字符串
446+
* @param key 秘钥
437447
* @return 16进制密文
438448
*/
439449
public static String encryptHmacSHA256ToString(String data, String key) {
@@ -444,6 +454,7 @@ public static String encryptHmacSHA256ToString(String data, String key) {
444454
* HmacSHA256加密
445455
*
446456
* @param data 明文字节数组
457+
* @param key 秘钥
447458
* @return 16进制密文
448459
*/
449460
public static String encryptHmacSHA256ToString(byte[] data, byte[] key) {
@@ -454,6 +465,7 @@ public static String encryptHmacSHA256ToString(byte[] data, byte[] key) {
454465
* HmacSHA256加密
455466
*
456467
* @param data 明文字节数组
468+
* @param key 秘钥
457469
* @return 密文字节数组
458470
*/
459471
public static byte[] encryptHmacSHA256(byte[] data, byte[] key) {
@@ -464,6 +476,7 @@ public static byte[] encryptHmacSHA256(byte[] data, byte[] key) {
464476
* HmacSHA384加密
465477
*
466478
* @param data 明文字符串
479+
* @param key 秘钥
467480
* @return 16进制密文
468481
*/
469482
public static String encryptHmacSHA384ToString(String data, String key) {
@@ -474,6 +487,7 @@ public static String encryptHmacSHA384ToString(String data, String key) {
474487
* HmacSHA384加密
475488
*
476489
* @param data 明文字节数组
490+
* @param key 秘钥
477491
* @return 16进制密文
478492
*/
479493
public static String encryptHmacSHA384ToString(byte[] data, byte[] key) {
@@ -484,6 +498,7 @@ public static String encryptHmacSHA384ToString(byte[] data, byte[] key) {
484498
* HmacSHA384加密
485499
*
486500
* @param data 明文字节数组
501+
* @param key 秘钥
487502
* @return 密文字节数组
488503
*/
489504
public static byte[] encryptHmacSHA384(byte[] data, byte[] key) {
@@ -494,6 +509,7 @@ public static byte[] encryptHmacSHA384(byte[] data, byte[] key) {
494509
* HmacSHA512加密
495510
*
496511
* @param data 明文字符串
512+
* @param key 秘钥
497513
* @return 16进制密文
498514
*/
499515
public static String encryptHmacSHA512ToString(String data, String key) {
@@ -504,6 +520,7 @@ public static String encryptHmacSHA512ToString(String data, String key) {
504520
* HmacSHA512加密
505521
*
506522
* @param data 明文字节数组
523+
* @param key 秘钥
507524
* @return 16进制密文
508525
*/
509526
public static String encryptHmacSHA512ToString(byte[] data, byte[] key) {
@@ -514,6 +531,7 @@ public static String encryptHmacSHA512ToString(byte[] data, byte[] key) {
514531
* HmacSHA512加密
515532
*
516533
* @param data 明文字节数组
534+
* @param key 秘钥
517535
* @return 密文字节数组
518536
*/
519537
public static byte[] encryptHmacSHA512(byte[] data, byte[] key) {
@@ -529,16 +547,16 @@ public static byte[] encryptHmacSHA512(byte[] data, byte[] key) {
529547
* @return 密文字节数组
530548
*/
531549
private static byte[] hmacTemplate(byte[] data, byte[] key, String algorithm) {
532-
if(data == null || data.length ==0 || key == null || key.length ==0) return null;
533-
try {
534-
SecretKeySpec secretKey = new SecretKeySpec(key, algorithm);
535-
Mac mac = Mac.getInstance(algorithm);
536-
mac.init(secretKey);
537-
return mac.doFinal(data);
538-
} catch (InvalidKeyException | NoSuchAlgorithmException e) {
539-
e.printStackTrace();
540-
return null;
541-
}
550+
if (data == null || data.length == 0 || key == null || key.length == 0) return null;
551+
try {
552+
SecretKeySpec secretKey = new SecretKeySpec(key, algorithm);
553+
Mac mac = Mac.getInstance(algorithm);
554+
mac.init(secretKey);
555+
return mac.doFinal(data);
556+
} catch (InvalidKeyException | NoSuchAlgorithmException e) {
557+
e.printStackTrace();
558+
return null;
559+
}
542560
}
543561

544562
/************************ DES加密相关 ***********************/
@@ -782,7 +800,7 @@ public static byte[] decryptAES(byte[] data, byte[] key) {
782800
* @return 密文或者明文,适用于DES,3DES,AES
783801
*/
784802
public static byte[] desTemplate(byte[] data, byte[] key, String algorithm, String transformation, boolean isEncrypt) {
785-
if(data == null || data.length == 0 || key == null || key.length == 0) return null;
803+
if (data == null || data.length == 0 || key == null || key.length == 0) return null;
786804
try {
787805
SecretKeySpec keySpec = new SecretKeySpec(key, algorithm);
788806
Cipher cipher = Cipher.getInstance(transformation);

utilcode/src/main/java/com/blankj/utilcode/utils/IntentUtils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ public static Intent getComponentIntent(String packageName, String className) {
157157
*
158158
* @param packageName 包名
159159
* @param className 全类名
160+
* @param bundle bundle
160161
* @return intent
161162
*/
162163
public static Intent getComponentIntent(String packageName, String className, Bundle bundle) {

utilcode/src/main/java/com/blankj/utilcode/utils/KeyboardUtils.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -118,18 +118,6 @@ private void hideKeyboard(IBinder token) {
118118
*/
119119
}
120120

121-
/**
122-
* 显示键盘
123-
*
124-
* @param view
125-
* @return
126-
*/
127-
public static boolean showSoftInput(View view) {
128-
InputMethodManager imm = (InputMethodManager) view.getContext()
129-
.getSystemService(Context.INPUT_METHOD_SERVICE);
130-
return imm.showSoftInput(view, InputMethodManager.SHOW_FORCED);
131-
}
132-
133121
/**
134122
* 动态显示软键盘
135123
*
@@ -140,9 +128,9 @@ public static void showSoftInput(Context context, EditText edit) {
140128
edit.setFocusable(true);
141129
edit.setFocusableInTouchMode(true);
142130
edit.requestFocus();
143-
InputMethodManager inputManager = (InputMethodManager) context
131+
InputMethodManager imm = (InputMethodManager) context
144132
.getSystemService(Context.INPUT_METHOD_SERVICE);
145-
inputManager.showSoftInput(edit, 0);
133+
imm.showSoftInput(edit, 0);
146134
}
147135

148136
/**

utilcode/src/main/java/com/blankj/utilcode/utils/SizeUtils.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,16 @@ public static float applyDimension(int unit, float value, DisplayMetrics metrics
9999
* 在onCreate()即可强行获取View的尺寸
100100
* <p>需回调onGetSizeListener接口,在onGetSize中获取view宽高</p>
101101
* <p>用法示例如下所示</p>
102-
* <pre>{@code
102+
* <pre>
103103
* SizeUtils.forceGetViewSize(view, new SizeUtils.onGetSizeListener() {
104-
* @ Override
104+
* Override
105105
* public void onGetSize(View view) {
106106
* view.getWidth();
107107
* }
108108
* });
109-
* }
110109
* </pre>
111-
*
112-
* @param view 视图
110+
* @param view 视图
111+
* @param listener 监听器
113112
*/
114113
public static void forceGetViewSize(final View view, final onGetSizeListener listener) {
115114
view.post(new Runnable() {

0 commit comments

Comments
 (0)