| | |
| | | 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; |
| | |
| | | // 妫?祴瀛楃涓叉槸鍚︾鍚堢敤鎴峰悕 |
| | | 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; |
| | | } |
| | | |
| | |
| | | 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; |
| | | } |
| | | |
| | | // 鍒ゆ柇瀛楃涓叉槸鍚︿负閭 |
| | |
| | | |
| | | 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) { |
| | |
| | | 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) { |
| | |
| | | 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) { |
| | |
| | | // 判断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 =""; |