Skip to content

Commit 7be1981

Browse files
committed
see 11/13 log
1 parent 6d99bd5 commit 7be1981

File tree

4 files changed

+29
-15
lines changed

4 files changed

+29
-15
lines changed

README-CN.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
为方便查找,已进行大致归类,其目录如下所示:
55
> - **Activity相关→[ActivityUtils.java][activity.java]**
66
```
7-
isActivityExists : 判断是否存在Activity
8-
launchActivity : 打开Activity
9-
getLauncherActivity: 获取launcher activity
7+
isActivityExists : 判断是否存在Activity
8+
launchActivity : 打开Activity
9+
getLauncherActivity : 获取launcheractivity
1010
```
1111

1212
> - **App相关→[AppUtils.java][app.java]**
@@ -110,16 +110,16 @@ init : 初始化
110110

111111
> - **设备相关→[DeviceUtils.java][device.java]**
112112
```
113-
isDeviceRoot : 判断设备是否root
114-
getSDKVersion : 获取设备系统版本号
115-
getAndroidID : 获取设备AndroidID
116-
getMacAddress : 获取设备MAC地址
117-
getManufacturer : 获取设备厂商
118-
getModel : 获取设备型号
119-
shutdown : 关机
120-
reboot : 重启
121-
reboot2Recovery : 重启到recovery
122-
reboot2Bootloader : 重启到bootloader
113+
isDeviceRoot : 判断设备是否root
114+
getSDKVersion : 获取设备系统版本号
115+
getAndroidID : 获取设备AndroidID
116+
getMacAddress : 获取设备MAC地址
117+
getManufacturer : 获取设备厂商
118+
getModel : 获取设备型号
119+
shutdown : 关机
120+
reboot : 重启
121+
reboot2Recovery : 重启到recovery
122+
reboot2Bootloader : 重启到bootloader
123123
```
124124

125125
> - **判空相关→[EmptyUtils.java][empty.java][Test][empty.test]**
@@ -286,6 +286,7 @@ isPhone : 判断设备是否是手机
286286
getIMEI : 获取IMIE码
287287
getIMSI : 获取IMSI码
288288
getPhoneType : 获取移动终端类型
289+
isSimCardReady : 判断是否存在sim卡
289290
getSimOperatorName, getSimOperatorByMnc : 获取Sim卡运营商名称
290291
getPhoneStatus : 获取手机状态信息
291292
dial : 跳至拨号界面

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Directory is shown below:
66
```
77
isActivityExists
88
launchActivity
9+
getLauncherActivity
910
```
1011

1112
> - **About App→[AppUtils.java][app.java]**
@@ -117,6 +118,8 @@ getManufacturer
117118
getModel
118119
shutdown
119120
reboot
121+
reboot2Recovery
122+
reboot2Bootloader
120123
```
121124

122125
> - **About Empty→[EmptyUtils.java][empty.java][Test][empty.test]**
@@ -283,6 +286,7 @@ isPhone
283286
getIMEI
284287
getIMSI
285288
getPhoneType
289+
isSimCardReady
286290
getSimOperatorName, getSimOperatorByMnc
287291
getPhoneStatus
288292
dial

app/src/main/java/com/blankj/androidutilcode/activities/PhoneActivity.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
import android.app.Activity;
44
import android.os.Bundle;
55
import android.view.View;
6-
import android.widget.Button;
76
import android.widget.TextView;
87

98
import com.blankj.androidutilcode.R;
10-
import com.blankj.utilcode.utils.AppUtils;
119
import com.blankj.utilcode.utils.PhoneUtils;
1210

1311
public class PhoneActivity extends Activity implements
@@ -29,6 +27,7 @@ protected void onCreate(Bundle savedInstanceState) {
2927
"\ngetIMEI: " + PhoneUtils.getIMEI(this) +
3028
"\ngetIMSI: " + PhoneUtils.getIMSI(this) +
3129
"\ngetPhoneType: " + PhoneUtils.getPhoneType(this) +
30+
"\nisSimCardReady: " + PhoneUtils.isSimCardReady(this) +
3231
"\ngetSimOperatorName: " + PhoneUtils.getSimOperatorName(this) +
3332
"\ngetSimOperatorByMnc: " + PhoneUtils.getSimOperatorByMnc(this) +
3433
"\n获取手机状态信息: " + PhoneUtils.getPhoneStatus(this)

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,16 @@ public static int getPhoneType(Context context) {
9090
return tm != null ? tm.getPhoneType() : -1;
9191
}
9292

93+
/**
94+
* 判断sim卡是否准备好
95+
*
96+
* @return {@code true}: 是<br>{@code false}: 否
97+
*/
98+
public static boolean isSimCardReady(Context context) {
99+
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
100+
return tm != null && tm.getSimState() == TelephonyManager.SIM_STATE_READY;
101+
}
102+
93103
/**
94104
* 获取Sim卡运营商名称
95105
* <p>中国移动、如中国联通、中国电信</p>

0 commit comments

Comments
 (0)