From c0269fcfa876b9c5cf309b2006462b4d09c5ef95 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 28 七月 2021 18:09:02 +0800 Subject: [PATCH] 包名及目录修改 --- APPUpdate/src/com/ysh/wpc/appupdate/util/StringUtils.java | 51 ++++++++++++++++----------------------------------- 1 files changed, 16 insertions(+), 35 deletions(-) diff --git a/APPUpdate/src/com/ysh/wpc/appupdate/util/StringUtils.java b/APPUpdate/src/com/ysh/wpc/appupdate/util/StringUtils.java index c3f8d4e..c06d691 100644 --- a/APPUpdate/src/com/ysh/wpc/appupdate/util/StringUtils.java +++ b/APPUpdate/src/com/ysh/wpc/appupdate/util/StringUtils.java @@ -13,7 +13,7 @@ import android.content.Context; import android.content.pm.PackageManager; import android.os.Build; -import android.support.v4.content.ContextCompat; +import androidx.core.content.ContextCompat; import android.telephony.TelephonyManager; import android.text.Spannable; import android.text.SpannableStringBuilder; @@ -60,11 +60,7 @@ // 濡�?绁寸�涙顑佹稉鍙夋Ц閸氾妇顑侀崥鍫㈡暏閹村嘲鎮� public static boolean checkingMsg(int len) { boolean isValid = true; - if (5 < len && len < 21) { - isValid = false; - } else { - isValid = true; - } + isValid = 5 >= len || len >= 21; return isValid; } @@ -91,21 +87,15 @@ public static boolean isDouble(String value) { try { Double.parseDouble(value); - if (value.contains(".")) - return true; - return false; - } catch (NumberFormatException e) { + return value.contains("."); + } catch (NumberFormatException e) { return false; } } // 濡�?绁寸�涙顑佹稉鍙夋Ц閸氾缚璐熸稉顓熸瀮鐎涙顑� public static boolean isChinesrChar(String str) { - if (str.length() < str.getBytes().length) { - return true; - } else { - return false; - } + return str.length() < str.getBytes().length; } // 閸掋倖鏌囩�涙顑佹稉鍙夋Ц閸氾缚璐熼柇顔绢唸 @@ -293,25 +283,19 @@ int i = fileName.lastIndexOf("."); - String end = fileName.substring(i, fileName.length()); + String end = fileName.substring(i); return System.currentTimeMillis() + end; } public static boolean isTrimEmpty(String text) { - if (text == null || text.trim().length() == 0) { - return true; - } - return false; - } + return text == null || text.trim().length() == 0; + } public static boolean isNullOrEmpty(String text) { - if (text == null || text.length() == 0 || text.equals("null")) { - return true; - } - return false; - } + return text == null || text.length() == 0 || text.equals("null"); + } public static String itrim(String beginTimeDis) { if (beginTimeDis != null) { @@ -381,7 +365,7 @@ return m.find(); } - private static final char HEX_DIGITS[] = { '0', '1', '2', '3', '4', '5', + private static final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; private static String toHexString(byte[] b) { @@ -403,7 +387,7 @@ MessageDigest digest = java.security.MessageDigest .getInstance("MD5"); digest.update(s.getBytes()); - byte messageDigest[] = digest.digest(); + byte[] messageDigest = digest.digest(); return toHexString(messageDigest); } catch (NoSuchAlgorithmException e) { @@ -423,20 +407,17 @@ // 鍒ゆ柇List鏄惁涓虹┖ public static boolean listIsNullOrEmpty(List<String> list) { - if (list == null || list.size() == 0) - return true; - else - return false; + return list == null || list.size() == 0; } // 鑾峰彇鎵嬫満鍨嬪彿 public static String PeopleModel() { Build bd = new Build(); - String model = bd.MODEL; + String model = Build.MODEL; return model; - }; + } - public static String PeopleDeviceId(Context context) { + public static String PeopleDeviceId(Context context) { TelephonyManager tm = (TelephonyManager) context .getSystemService(Context.TELEPHONY_SERVICE); String deviceid =""; -- Gitblit v1.8.0