From 6d99bd5853a079b3494c9a7b3f4561807568c279 Mon Sep 17 00:00:00 2001 From: Blankj <625783482@qq.com> Date: Sun, 13 Nov 2016 12:01:27 +0800 Subject: [PATCH] see 11/12 log --- README-CN.md | 3 +++ .../activities/ActivityActivity.java | 8 +++---- .../activities/DeviceActivity.java | 6 +++++ app/src/main/res/layout/activity_device.xml | 16 +++++++++++++ app/src/main/res/values/string.xml | 2 ++ update_log.md | 1 + .../blankj/utilcode/utils/ActivityUtils.java | 23 +++++++++++++++++++ .../blankj/utilcode/utils/DeviceUtils.java | 16 +++++++++++++ .../blankj/utilcode/utils/EncryptUtils.java | 6 ++--- 9 files changed, 73 insertions(+), 8 deletions(-) diff --git a/README-CN.md b/README-CN.md index 015c0bd3c3..d16e2b88a1 100644 --- a/README-CN.md +++ b/README-CN.md @@ -6,6 +6,7 @@ ``` isActivityExists : 判断是否存在Activity launchActivity : 打开Activity +getLauncherActivity: 获取launcher activity ``` > - **App相关→[AppUtils.java][app.java]** @@ -117,6 +118,8 @@ getManufacturer : 获取设备厂商 getModel : 获取设备型号 shutdown : 关机 reboot : 重启 +reboot2Recovery : 重启到recovery +reboot2Bootloader : 重启到bootloader ``` > - **判空相关→[EmptyUtils.java][empty.java]→[Test][empty.test]** diff --git a/app/src/main/java/com/blankj/androidutilcode/activities/ActivityActivity.java b/app/src/main/java/com/blankj/androidutilcode/activities/ActivityActivity.java index 2fad9e8d5a..cd5bf08fa5 100644 --- a/app/src/main/java/com/blankj/androidutilcode/activities/ActivityActivity.java +++ b/app/src/main/java/com/blankj/androidutilcode/activities/ActivityActivity.java @@ -7,9 +7,6 @@ import com.blankj.androidutilcode.R; import com.blankj.utilcode.utils.ActivityUtils; -import com.blankj.utilcode.utils.DeviceUtils; -import com.blankj.utilcode.utils.IntentUtils; -import com.blankj.utilcode.utils.ShellUtils; /** *
@@ -38,8 +35,9 @@ protected void onCreate(Bundle savedInstanceState) {
 
         findViewById(R.id.btn_launch_image_activity).setOnClickListener(this);
 
-        boolean isExists = ActivityUtils.isActivityExists(this, packageName, className);
-        tvAboutActivity.setText(String.format("Is ImageActivity Exists: %b", isExists));
+        tvAboutActivity.setText("Is ImageActivity Exists: " + ActivityUtils.isActivityExists(this, packageName, className) +
+                "\ngetLauncherActivity: " + ActivityUtils.getLauncherActivity(this, packageName)
+        );
     }
 
     @Override
diff --git a/app/src/main/java/com/blankj/androidutilcode/activities/DeviceActivity.java b/app/src/main/java/com/blankj/androidutilcode/activities/DeviceActivity.java
index 5460e7df19..649d1a7660 100644
--- a/app/src/main/java/com/blankj/androidutilcode/activities/DeviceActivity.java
+++ b/app/src/main/java/com/blankj/androidutilcode/activities/DeviceActivity.java
@@ -29,6 +29,8 @@ protected void onCreate(Bundle savedInstanceState) {
 
         findViewById(R.id.btn_shutdown).setOnClickListener(this);
         findViewById(R.id.btn_reboot).setOnClickListener(this);
+        findViewById(R.id.btn_reboot_to_recovery).setOnClickListener(this);
+        findViewById(R.id.btn_reboot_to_bootloader).setOnClickListener(this);
 
         tvAboutDevice.setText("isRoot: " + DeviceUtils.isDeviceRoot() +
                 "\ngetSDKVersion: " + DeviceUtils.getSDKVersion() +
@@ -47,6 +49,10 @@ public void onClick(View view) {
                 break;
             case R.id.btn_reboot:
                 DeviceUtils.reboot();
+            case R.id.btn_reboot_to_recovery:
+                DeviceUtils.reboot2Recovery();
+            case R.id.btn_reboot_to_bootloader:
+                DeviceUtils.reboot2Bootloader();
                 break;
         }
     }
diff --git a/app/src/main/res/layout/activity_device.xml b/app/src/main/res/layout/activity_device.xml
index 7b8290e819..75ddf08e27 100644
--- a/app/src/main/res/layout/activity_device.xml
+++ b/app/src/main/res/layout/activity_device.xml
@@ -28,6 +28,22 @@
             android:text="@string/device.reboot"
             />
 
+