Added bug report, Fixeded en name
This commit is contained in:
0
app/src/main/assets/sample_wechat_scan.js
Normal file
0
app/src/main/assets/sample_wechat_scan.js
Normal file
@@ -0,0 +1,8 @@
|
||||
package android.bug;
|
||||
|
||||
/**
|
||||
* Created by Stardust on 2017/2/13.
|
||||
*/
|
||||
|
||||
public class WrapContentLinearLayoutManager {
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.stardust.scriptdroid;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.widget.EditText;
|
||||
|
||||
import com.heinrichreimersoftware.androidissuereporter.IssueReporterActivity;
|
||||
import com.heinrichreimersoftware.androidissuereporter.model.github.GithubTarget;
|
||||
import com.stardust.scriptdroid.R;
|
||||
|
||||
/**
|
||||
* Created by Stardust on 2017/2/13.
|
||||
*/
|
||||
|
||||
public class IssueReportActivity extends IssueReporterActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
handleIntent();
|
||||
findViewById(com.heinrichreimersoftware.androidissuereporter.R.id.air_optionAnonymous).performClick();
|
||||
((EditText) findViewById(R.id.air_inputTitle)).setText(R.string.text_bug_report);
|
||||
Toolbar toolbar = (Toolbar) this.findViewById(com.heinrichreimersoftware.androidissuereporter.R.id.air_toolbar);
|
||||
toolbar.setTitle(R.string.text_report_bug);
|
||||
}
|
||||
|
||||
private void handleIntent() {
|
||||
final String errorDetail = getIntent().getStringExtra("error");
|
||||
((EditText) findViewById(R.id.air_inputDescription)).setText(errorDetail);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GithubTarget getTarget() {
|
||||
return new GithubTarget("hyb1996", "NoRootScriptDroid");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getGuestToken() {
|
||||
return "7860bbb3897c8b2bb29a49a0820dd626bd638b1c";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.stardust.scriptdroid;
|
||||
package com.stardust.scriptdroid.file;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.stardust.scriptdroid.App;
|
||||
import com.stardust.scriptdroid.Pref;
|
||||
import com.stardust.scriptdroid.R;
|
||||
import com.stardust.scriptdroid.droid.script.file.ScriptFile;
|
||||
import com.stardust.scriptdroid.droid.script.file.ScriptFileList;
|
||||
import com.stardust.scriptdroid.droid.script.file.SharedPrefScriptFileList;
|
||||
import com.stardust.scriptdroid.file.FileUtils;
|
||||
import com.stardust.util.MapEntries;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -13,19 +15,20 @@ import java.util.Map;
|
||||
/**
|
||||
* Created by Stardust on 2017/1/30.
|
||||
*/
|
||||
public class NonUiInitializer {
|
||||
public class SampleFileTool {
|
||||
|
||||
private static final Map<String, Integer> SAMPLES = new MapEntries<String, Integer>()
|
||||
.entry("sample_open_wechat_moment.js", R.string.text_sample_open_what_moment)
|
||||
.entry("sample_alipay_scan.js", R.string.text_sample_alipay_scan)
|
||||
.entry("sample_wechat_scan.js", R.string.text_sample_wechat_scan)
|
||||
.entry("sample_open_running_services.js", R.string.text_sample_open_running_services)
|
||||
.entry("sample_qq_hongbao.js", R.string.text_sample_qq_hongbao)
|
||||
.entry("sample_simple_calculator.js", R.string.text_sample_simple_calculator)
|
||||
.entry("sample_force_qq_chat.js", R.string.text_sample_for_qq_chat)
|
||||
.map();
|
||||
|
||||
private static NonUiInitializer instance = new NonUiInitializer();
|
||||
private static SampleFileTool instance = new SampleFileTool();
|
||||
|
||||
public static NonUiInitializer getInstance() {
|
||||
public static SampleFileTool getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@@ -33,10 +36,6 @@ public class NonUiInitializer {
|
||||
return App.getApp();
|
||||
}
|
||||
|
||||
public void init() {
|
||||
|
||||
}
|
||||
|
||||
public void copySampleScriptFileIfNeeded() {
|
||||
if (!Pref.def().getBoolean(Pref.SAMPLE_SCRIPTS_COPIED, false)) {
|
||||
copySampleScriptFile();
|
||||
@@ -58,7 +57,7 @@ public class NonUiInitializer {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (failCount > 0) {
|
||||
if (failCount < SAMPLES.size()) {
|
||||
Pref.def().edit().putBoolean(Pref.SAMPLE_SCRIPTS_COPIED, true).apply();
|
||||
}
|
||||
return failCount;
|
||||
115
app/src/main/java/com/stardust/scriptdroid/tool/Shell.java
Normal file
115
app/src/main/java/com/stardust/scriptdroid/tool/Shell.java
Normal file
@@ -0,0 +1,115 @@
|
||||
package com.stardust.scriptdroid.tool;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
/**
|
||||
* Created by Stardust on 2017/1/20.
|
||||
*
|
||||
* 来自网络~~
|
||||
*/
|
||||
|
||||
public class Shell {
|
||||
|
||||
|
||||
private static final String TAG = "Shell";
|
||||
|
||||
private final static String COMMAND_SU = "su";
|
||||
private final static String COMMAND_SH = "sh";
|
||||
private final static String COMMAND_EXIT = "exit\n";
|
||||
private final static String COMMAND_LINE_END = "\n";
|
||||
|
||||
/**
|
||||
* Command执行结果
|
||||
*
|
||||
* @author Mountain
|
||||
*/
|
||||
public static class CommandResult {
|
||||
public int result = -1;
|
||||
public String errorMsg;
|
||||
public String successMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行命令—单条
|
||||
*
|
||||
* @param command
|
||||
* @param isRoot
|
||||
* @return
|
||||
*/
|
||||
public static CommandResult execCommand(String command, boolean isRoot) {
|
||||
String[] commands = {command};
|
||||
return execCommand(commands, isRoot);
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行命令-多条
|
||||
*
|
||||
* @param commands
|
||||
* @param isRoot
|
||||
* @return
|
||||
*/
|
||||
public static CommandResult execCommand(String[] commands, boolean isRoot) {
|
||||
CommandResult commandResult = new CommandResult();
|
||||
if (commands == null || commands.length == 0) return commandResult;
|
||||
Process process = null;
|
||||
DataOutputStream os = null;
|
||||
BufferedReader successResult = null;
|
||||
BufferedReader errorResult = null;
|
||||
StringBuilder successMsg = null;
|
||||
StringBuilder errorMsg = null;
|
||||
try {
|
||||
process = Runtime.getRuntime().exec(isRoot ? COMMAND_SU : COMMAND_SH);
|
||||
os = new DataOutputStream(process.getOutputStream());
|
||||
for (String command : commands) {
|
||||
if (command != null) {
|
||||
os.write(command.getBytes());
|
||||
os.writeBytes(COMMAND_LINE_END);
|
||||
os.flush();
|
||||
}
|
||||
}
|
||||
os.writeBytes(COMMAND_EXIT);
|
||||
os.flush();
|
||||
commandResult.result = process.waitFor();
|
||||
//获取错误信息
|
||||
successMsg = new StringBuilder();
|
||||
errorMsg = new StringBuilder();
|
||||
successResult = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||
errorResult = new BufferedReader(new InputStreamReader(process.getErrorStream()));
|
||||
String s;
|
||||
while ((s = successResult.readLine()) != null) successMsg.append(s);
|
||||
while ((s = errorResult.readLine()) != null) errorMsg.append(s);
|
||||
commandResult.successMsg = successMsg.toString();
|
||||
commandResult.errorMsg = errorMsg.toString();
|
||||
Log.i(TAG, commandResult.result + " | " + commandResult.successMsg
|
||||
+ " | " + commandResult.errorMsg);
|
||||
} catch (Exception e) {
|
||||
String errmsg = e.getMessage();
|
||||
if (errmsg != null) {
|
||||
Log.e(TAG, errmsg);
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
if (os != null) os.close();
|
||||
if (successResult != null) successResult.close();
|
||||
if (errorResult != null) errorResult.close();
|
||||
} catch (IOException e) {
|
||||
String errmsg = e.getMessage();
|
||||
if (errmsg != null) {
|
||||
Log.e(TAG, errmsg);
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (process != null) process.destroy();
|
||||
}
|
||||
return commandResult;
|
||||
}
|
||||
|
||||
}
|
||||
BIN
app/src/main/res/drawable/ic_add_file_white.png
Normal file
BIN
app/src/main/res/drawable/ic_add_file_white.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
BIN
app/src/main/res/drawable/ic_folder_open_outline_white.png
Normal file
BIN
app/src/main/res/drawable/ic_folder_open_outline_white.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.9 KiB |
3
app/src/main/res/values-en/strings.xml
Normal file
3
app/src/main/res/values-en/strings.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user