Skip to content

Commit e0bb663

Browse files
committed
Reboot choose
1 parent c85cb8a commit e0bb663

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

app/src/main/java/ru/nikita/adb/FastbootActivity.java

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package ru.nikita.adb;
22

3-
import java.util.HashMap;
4-
import java.util.Iterator;
53
import java.util.List;
64
import java.util.ArrayList;
75
import android.os.Bundle;
@@ -11,7 +9,9 @@
119
import android.widget.ArrayAdapter;
1210
import android.widget.Toast;
1311
import android.app.Activity;
12+
import android.app.AlertDialog;
1413
import android.content.Intent;
14+
import android.content.DialogInterface;
1515
import android.hardware.usb.UsbManager;
1616
import android.hardware.usb.UsbDevice;
1717
import ru.nikita.adb.FastbootVariablesListActivity;
@@ -78,8 +78,23 @@ public void deviceInfoAll(View view){
7878
}
7979
public void reboot(View view){
8080
try {
81-
if(getSelectedDevice().openConnection(this))
82-
getSelectedDevice().reboot();
81+
if(getSelectedDevice().openConnection(this)) {
82+
AlertDialog.Builder b = new AlertDialog.Builder(this);
83+
b.setTitle(R.string.reboot);
84+
final String[] items = {
85+
"",
86+
"bootloader",
87+
"recovery",
88+
};
89+
b.setItems(R.array.fastboot_reboot, new DialogInterface.OnClickListener() {
90+
@Override
91+
public void onClick(DialogInterface dialog, int which){
92+
dialog.dismiss();
93+
getSelectedDevice().reboot(items[which]);
94+
}
95+
});
96+
b.show();
97+
}
8398
} catch(FastbootException e) {
8499
e.showToast(this);
85100
}

app/src/main/java/ru/nikita/adb/FastbootDevice.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ private String readOnce() {
8686
return response;
8787
}
8888

89-
public void reboot() {
90-
write("reboot");
89+
public void reboot(String target) {
90+
write("reboot-" + target);
9191
readOnce();
9292
}
9393

0 commit comments

Comments
 (0)