v3.5.0
116
.idea/codeStyles/Project.xml
generated
Normal file
@@ -0,0 +1,116 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<codeStyleSettings language="XML">
|
||||
<indentOptions>
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
</indentOptions>
|
||||
<arrangement>
|
||||
<rules>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>xmlns:android</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>xmlns:.*</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:id</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:name</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>name</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>style</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>ANDROID_ATTRIBUTE_ORDER</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>.*</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
</rules>
|
||||
</arrangement>
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
||||
6
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
1
app/.gitignore
vendored
Executable file
@@ -0,0 +1 @@
|
||||
/build
|
||||
25
app/build.gradle
Executable file
@@ -0,0 +1,25 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
defaultConfig {
|
||||
applicationId "Simplicity.LT.Tools"
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 29
|
||||
versionCode 1
|
||||
versionName '3.5.0'
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
buildToolsVersion = '29.0.2'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation files('libs/sdk.jar')
|
||||
implementation 'com.android.support:appcompat-v7:28.0.0'
|
||||
}
|
||||
BIN
app/libs/sdk.jar
Executable file
21
app/proguard-rules.pro
vendored
Executable file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
1
app/release/output.json
Executable file
@@ -0,0 +1 @@
|
||||
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"3.5.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
|
||||
24
app/src/main/AndroidManifest.xml
Executable file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:sharedUserId="android.uid.system"
|
||||
package="Simplicity.LT.Tools">
|
||||
|
||||
<application
|
||||
android:process="com.android.settings"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
tools:ignore="GoogleAppIndexingWarning">
|
||||
<activity android:name=".MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".WifiActivity" android:label="@string/wifi"/>
|
||||
<activity android:name=".LiteActivity"/>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
426
app/src/main/java/Simplicity/LT/Tools/LiteActivity.java
Executable file
@@ -0,0 +1,426 @@
|
||||
package Simplicity.LT.Tools;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.text.SpannableString;
|
||||
import android.text.method.DigitsKeyListener;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import miui.R;
|
||||
import miui.app.AlertDialog;
|
||||
import miui.preference.PreferenceActivity;
|
||||
|
||||
public class LiteActivity extends PreferenceActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(R.style.Theme_Light_Settings);super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(Simplicity.LT.Tools.R.xml.lite);
|
||||
CheckRoot();mount();setsummary();
|
||||
}
|
||||
|
||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, android.preference.Preference preference) {
|
||||
if (preference.getKey().equals("cust")) {
|
||||
final EditText dpi = new EditText(LiteActivity.this);
|
||||
SpannableString s = new SpannableString("请输入一个包名");
|
||||
dpi.setHint(s);
|
||||
new android.app.AlertDialog.Builder(LiteActivity.this)
|
||||
.setTitle("自定义冻结")
|
||||
.setView(dpi)
|
||||
.setCancelable(true)
|
||||
.setPositiveButton("冻结", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(dpi.getWindowToken(), 0);
|
||||
String input = dpi.getText().toString();
|
||||
dpi.setText("");
|
||||
if (input.length() > 0) {
|
||||
try {
|
||||
Toast.makeText(getApplicationContext(), "冻结应用: " + input, Toast.LENGTH_SHORT).show();
|
||||
String disable = "pm disable " + input;
|
||||
ShellUtils.execCommand(disable, true);
|
||||
} catch (NumberFormatException e) {
|
||||
Toast.makeText(LiteActivity.this, "出错了", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(LiteActivity.this, "输入为空", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
})
|
||||
.setNegativeButton("解冻", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(dpi.getWindowToken(), 0);
|
||||
String input = dpi.getText().toString();
|
||||
dpi.setText("");
|
||||
if (input.length() > 0) {
|
||||
try {
|
||||
Toast.makeText(getApplicationContext(), "解冻应用: " + input, Toast.LENGTH_SHORT).show();
|
||||
String disable = "pm enable " + input;
|
||||
ShellUtils.execCommand(disable, true);
|
||||
} catch (NumberFormatException e) {
|
||||
Toast.makeText(LiteActivity.this, "出错了", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(LiteActivity.this, "输入为空", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
if (preference.getKey().equals("player")) {
|
||||
if ((!new File("/data/system/Simplicity/data/player").exists())) {
|
||||
String[] cmd = new String[]{"pm disable com.miui.player", "echo true >/data/system/Simplicity/data/player"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
} else {
|
||||
String[] cmd = new String[]{"pm enable com.miui.player", "rm -rf /data/system/Simplicity/data/player"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
}
|
||||
}
|
||||
if (preference.getKey().equals("notes")) {
|
||||
|
||||
if ((!new File("/data/system/Simplicity/data/notes").exists())) {
|
||||
String[] cmd = new String[]{"pm disable com.miui.notes", "echo true >/data/system/Simplicity/data/notes"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
} else {
|
||||
String[] cmd = new String[]{"pm enable com.miui.notes", "rm -rf /data/system/Simplicity/data/notes"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
}
|
||||
}
|
||||
if (preference.getKey().equals("email")) {
|
||||
|
||||
if ((!new File("/data/system/Simplicity/data/email").exists())) {
|
||||
String[] cmd = new String[]{"pm disable com.android.email", "echo true >/data/system/Simplicity/data/email"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
} else {
|
||||
String[] cmd = new String[]{"pm enable com.android.email", "rm -rf /data/system/Simplicity/data/email"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
}
|
||||
}
|
||||
if (preference.getKey().equals("calculator")) {
|
||||
|
||||
if ((!new File("/data/system/Simplicity/data/calculator").exists())) {
|
||||
String[] cmd = new String[]{"pm disable com.miui.calculator", "echo true >/data/system/Simplicity/data/calculator"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
} else {
|
||||
String[] cmd = new String[]{"pm enable com.miui.calculator", "rm -rf /data/system/Simplicity/data/calculator"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
}
|
||||
}
|
||||
if (preference.getKey().equals("virtualsim")) {
|
||||
|
||||
if ((!new File("/data/system/Simplicity/data/virtualsim").exists())) {
|
||||
String[] cmd = new String[]{"pm disable com.miui.virtualsim", "echo true >/data/system/Simplicity/data/virtualsim"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
} else {
|
||||
String[] cmd = new String[]{"pm enable com.miui.virtualsim", "rm -rf /data/system/Simplicity/data/virtualsim"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
}
|
||||
}
|
||||
if (preference.getKey().equals("weather2")) {
|
||||
|
||||
if ((!new File("/data/system/Simplicity/data/weather2").exists())) {
|
||||
String[] cmd = new String[]{"pm disable com.miui.weather2", "echo true >/data/system/Simplicity/data/weather2"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
} else {
|
||||
String[] cmd = new String[]{"pm enable com.miui.weather2", "rm -rf /data/system/Simplicity/data/weather2"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
}
|
||||
}
|
||||
if (preference.getKey().equals("remotecontroller")) {
|
||||
|
||||
if ((!new File("/data/system/Simplicity/data/remotecontroller").exists())) {
|
||||
String[] cmd = new String[]{"pm disable com.duokan.phone.remotecontroller", "echo true >/data/system/Simplicity/data/remotecontroller"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
} else {
|
||||
String[] cmd = new String[]{"pm enable com.duokan.phone.remotecontroller", "rm -rf /data/system/Simplicity/data/remotecontroller"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
}
|
||||
}
|
||||
if (preference.getKey().equals("shop")) {
|
||||
|
||||
if ((!new File("/data/system/Simplicity/data/shop").exists())) {
|
||||
String[] cmd = new String[]{"pm disable com.xiaomi.shop", "echo true >/data/system/Simplicity/data/shop"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
} else {
|
||||
String[] cmd = new String[]{"pm enable com.xiaomi.shop", "rm -rf /data/system/Simplicity/data/shop"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
}
|
||||
}
|
||||
if (preference.getKey().equals("compass")) {
|
||||
|
||||
if ((!new File("/data/system/Simplicity/data/compass").exists())) {
|
||||
String[] cmd = new String[]{"pm disable com.miui.compass", "echo true >/data/system/Simplicity/data/compass"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
} else {
|
||||
String[] cmd = new String[]{"pm enable com.miui.compass", "rm -rf /data/system/Simplicity/data/compass"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
}
|
||||
}
|
||||
if (preference.getKey().equals("browser")) {
|
||||
|
||||
if ((!new File("/data/system/Simplicity/data/browser").exists())) {
|
||||
String[] cmd = new String[]{"pm disable com.android.browser", "echo true >/data/system/Simplicity/data/browser"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
} else {
|
||||
String[] cmd = new String[]{"pm enable com.android.browser", "rm -rf /data/system/Simplicity/data/browser"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
}
|
||||
}
|
||||
if (preference.getKey().equals("soundrecorder")) {
|
||||
|
||||
if ((!new File("/data/system/Simplicity/data/soundrecorder").exists())) {
|
||||
String[] cmd = new String[]{"pm disable com.android.soundrecorder", "echo true >/data/system/Simplicity/data/soundrecorder"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
} else {
|
||||
String[] cmd = new String[]{"pm enable com.android.soundrecorder", "rm -rf /data/system/Simplicity/data/soundrecorder"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
}
|
||||
}
|
||||
if (preference.getKey().equals("calendar")) {
|
||||
|
||||
if ((!new File("/data/system/Simplicity/data/calendar").exists())) {
|
||||
String[] cmd = new String[]{"pm disable com.android.calendar", "echo true >/data/system/Simplicity/data/calendar"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
} else {
|
||||
String[] cmd = new String[]{"pm enable com.android.calendar", "rm -rf /data/system/Simplicity/data/calendar"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
}
|
||||
}
|
||||
if (preference.getKey().equals("updater")) {
|
||||
|
||||
if ((!new File("/data/system/Simplicity/data/updater").exists())) {
|
||||
String[] cmd = new String[]{"pm disable com.android.updater", "echo true >/data/system/Simplicity/data/updater"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
} else {
|
||||
String[] cmd = new String[]{"pm enable com.android.updater", "rm -rf /data/system/Simplicity/data/updater"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
}
|
||||
}
|
||||
if (preference.getKey().equals("bugreport")) {
|
||||
|
||||
if ((!new File("/data/system/Simplicity/data/bugreport").exists())) {
|
||||
String[] cmd = new String[]{"pm disable com.miui.bugreport", "echo true >/data/system/Simplicity/data/bugreport"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
} else {
|
||||
String[] cmd = new String[]{"pm enable com.miui.bugreport", "rm -rf /data/system/Simplicity/data/bugreport"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
}
|
||||
}
|
||||
if (preference.getKey().equals("wallet")) {
|
||||
|
||||
if ((!new File("/data/system/Simplicity/data/wallet").exists())) {
|
||||
String[] cmd = new String[]{"pm disable com.mipay.wallet", "echo true >/data/system/Simplicity/data/wallet"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
} else {
|
||||
String[] cmd = new String[]{"pm enable com.mipay.wallet", "rm -rf /data/system/Simplicity/data/wallet"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
}
|
||||
}
|
||||
if (preference.getKey().equals("video")) {
|
||||
|
||||
if ((!new File("/data/system/Simplicity/data/video").exists())) {
|
||||
String[] cmd = new String[]{"pm disable com.miui.video", "echo true >/data/system/Simplicity/data/video"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
} else {
|
||||
String[] cmd = new String[]{"pm enable com.miui.video", "rm -rf /data/system/Simplicity/data/video"} ;
|
||||
ShellUtils.execCommand(cmd, true);
|
||||
setsummary();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void setsummary() {
|
||||
CheckBoxPreference notes = (CheckBoxPreference) findPreference("notes");
|
||||
CheckBoxPreference email = (CheckBoxPreference) findPreference("email");
|
||||
CheckBoxPreference calculator = (CheckBoxPreference) findPreference("calculator");
|
||||
CheckBoxPreference virtualsim = (CheckBoxPreference) findPreference("virtualsim");
|
||||
CheckBoxPreference weather2 = (CheckBoxPreference) findPreference("weather2");
|
||||
CheckBoxPreference remotecontroller = (CheckBoxPreference) findPreference("remotecontroller");
|
||||
CheckBoxPreference shop = (CheckBoxPreference) findPreference("shop");
|
||||
CheckBoxPreference compass = (CheckBoxPreference) findPreference("compass");
|
||||
CheckBoxPreference browser = (CheckBoxPreference) findPreference("browser");
|
||||
CheckBoxPreference soundrecorder = (CheckBoxPreference) findPreference("soundrecorder");
|
||||
CheckBoxPreference calendar = (CheckBoxPreference) findPreference("calendar");
|
||||
CheckBoxPreference updater = (CheckBoxPreference) findPreference("updater");
|
||||
CheckBoxPreference bugreport = (CheckBoxPreference) findPreference("bugreport");
|
||||
CheckBoxPreference wallet = (CheckBoxPreference) findPreference("wallet");
|
||||
CheckBoxPreference video = (CheckBoxPreference) findPreference("video");
|
||||
CheckBoxPreference player = (CheckBoxPreference) findPreference("player");
|
||||
|
||||
findPreference("switch").setTitle("冻结开关");
|
||||
player.setTitle("音乐");
|
||||
updater.setTitle("系统更新");
|
||||
bugreport.setTitle("用户反馈");
|
||||
browser.setTitle("浏览器");
|
||||
soundrecorder.setTitle("录音机");
|
||||
shop.setTitle("小米商城");
|
||||
remotecontroller.setTitle("万能遥控");
|
||||
notes.setTitle("便签");
|
||||
email.setTitle("电子邮件");
|
||||
calculator.setTitle("计算器");
|
||||
calendar.setTitle("日历");
|
||||
compass.setTitle("指南针");
|
||||
video.setTitle("视频");
|
||||
virtualsim.setTitle("全球上网");
|
||||
wallet.setTitle("小米钱包");
|
||||
weather2.setTitle("天气");
|
||||
|
||||
findPreference("diy").setTitle("自定义冻结");
|
||||
findPreference("cust").setTitle("输入包名");
|
||||
|
||||
if ((new File("/data/system/Simplicity/data/notes").exists())) {
|
||||
notes.setChecked(true);
|
||||
} else {
|
||||
notes.setChecked(false);
|
||||
}
|
||||
if ((new File("/data/system/Simplicity/data/email").exists())) {
|
||||
email.setChecked(true);
|
||||
} else {
|
||||
email.setChecked(false);
|
||||
}
|
||||
if ((new File("/data/system/Simplicity/data/calculator").exists())) {
|
||||
calculator.setChecked(true);
|
||||
} else {
|
||||
calculator.setChecked(false);
|
||||
}
|
||||
if ((new File("/data/system/Simplicity/data/calendar").exists())) {
|
||||
calendar.setChecked(true);
|
||||
} else {
|
||||
calendar.setChecked(false);
|
||||
}
|
||||
if ((new File("/data/system/Simplicity/data/compass").exists())) {
|
||||
compass.setChecked(true);
|
||||
} else {
|
||||
compass.setChecked(false);
|
||||
}
|
||||
if ((new File("/data/system/Simplicity/data/video").exists())) {
|
||||
video.setChecked(true);
|
||||
} else {
|
||||
video.setChecked(false);
|
||||
}
|
||||
if ((new File("/data/system/Simplicity/data/virtualsim").exists())) {
|
||||
virtualsim.setChecked(true);
|
||||
} else {
|
||||
virtualsim.setChecked(false);
|
||||
}
|
||||
if ((new File("/data/system/Simplicity/data/wallet").exists())) {
|
||||
wallet.setChecked(true);
|
||||
} else {
|
||||
wallet.setChecked(false);
|
||||
}
|
||||
if ((new File("/data/system/Simplicity/data/weather2").exists())) {
|
||||
weather2.setChecked(true);
|
||||
} else {
|
||||
weather2.setChecked(false);
|
||||
}
|
||||
if ((new File("/data/system/Simplicity/data/remotecontroller").exists())) {
|
||||
remotecontroller.setChecked(true);
|
||||
} else {
|
||||
remotecontroller.setChecked(false);
|
||||
}
|
||||
if ((new File("/data/system/Simplicity/data/shop").exists())) {
|
||||
shop.setChecked(true);
|
||||
} else {
|
||||
shop.setChecked(false);
|
||||
}
|
||||
if ((new File("/data/system/Simplicity/data/soundrecorder").exists())) {
|
||||
soundrecorder.setChecked(true);
|
||||
} else {
|
||||
soundrecorder.setChecked(false);
|
||||
}
|
||||
if ((new File("/data/system/Simplicity/data/browser").exists())) {
|
||||
browser.setChecked(true);
|
||||
} else {
|
||||
browser.setChecked(false);
|
||||
}
|
||||
if ((new File("/data/system/Simplicity/data/bugreport").exists())) {
|
||||
bugreport.setChecked(true);
|
||||
} else {
|
||||
bugreport.setChecked(false);
|
||||
}
|
||||
if ((new File("/data/system/Simplicity/data/updater").exists())) {
|
||||
updater.setChecked(true);
|
||||
} else {
|
||||
updater.setChecked(false);
|
||||
}
|
||||
if ((new File("/data/system/Simplicity/data/player").exists())) {
|
||||
player.setChecked(true);
|
||||
} else {
|
||||
player.setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckRoot() {
|
||||
if ((!new File("/tmp/rooted").exists())) {
|
||||
String[] commands = new String[]{"mount -o rw,remount /", "mount -o rw,remount /system", "mount -o rw,remount /vendor", "mount -o rw,remount /vendor/etc", "mount -o rw,remount /system/vendor/etc", "mount -o rw,remount /system/system", "mount -o rw,remount /system/etc", "mount -o rw,remount /system_root/system", "echo test >/system/test", "echo test >/test", "chmod -R 0777 /system/test", "chmod -R 0777 /test", "sync"};
|
||||
ShellUtils.execCommand(commands, true);
|
||||
if ((!new File("/system/test").exists()) || (!new File("/test").exists())) {
|
||||
AlertDialog.Builder dialog = new AlertDialog.
|
||||
Builder(LiteActivity.this);
|
||||
dialog.setTitle("提示");
|
||||
dialog.setMessage("无法获取系统读写权限,请ROOT你的设备!");
|
||||
dialog.setCancelable(false);
|
||||
dialog.setPositiveButton("退出", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
} else {
|
||||
String[] command = new String[]{"mount -o rw,remount /", "mount -o rw,remount /system", "mount -o rw,remount /vendor", "mount -o rw,remount /vendor/etc", "mount -o rw,remount /system/vendor/etc", "mount -o rw,remount /system/system", "mount -o rw,remount /system/etc", "mount -o rw,remount /system_root/system", "mkdir /tmp", "chmod -R 777 /tmp", "echo 1 >/tmp/rooted", "chmod -R 0777 /tmp/rooted", "rm -rf /system/test", "rm -rf /test", "sync"};
|
||||
ShellUtils.execCommand(command, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void mount() {
|
||||
String[] command = new String[]{"mount -o rw,remount /", "mount -o rw,remount /system", "mount -o rw,remount /vendor", "mount -o rw,remount /vendor/etc", "mount -o rw,remount /system/vendor/etc", "mount -o rw,remount /system/system", "mount -o rw,remount /system/etc", "mount -o rw,remount /system_root/system"};
|
||||
ShellUtils.execCommand(command, true);
|
||||
if ((!new File("/system/bin/chmod777").exists())) {
|
||||
String[] commands = new String[]{"mount -o rw,remount /", "mount -o rw,remount /system", "mount -o rw,remount /vendor", "mount -o rw,remount /vendor/etc", "mount -o rw,remount /system/vendor/etc", "mount -o rw,remount /system/system", "mount -o rw,remount /system/etc", "mount -o rw,remount /system_root/system", "mkdir /tmp", "chmod -R 0777 /tmp", "chmod -R 777 /system/res", "chmod -R 777 /system/tools", "echo chmod777 >/system/bin/chmod777", "sync"};
|
||||
ShellUtils.execCommand(commands, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
2821
app/src/main/java/Simplicity/LT/Tools/MainActivity.java
Executable file
217
app/src/main/java/Simplicity/LT/Tools/ReadFile.java
Executable file
@@ -0,0 +1,217 @@
|
||||
package Simplicity.LT.Tools;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.wifi.WifiInfo;
|
||||
import android.net.wifi.WifiManager;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class ReadFile {
|
||||
|
||||
ArrayList<Map<String, String>> list = new ArrayList<Map<String, String>>();
|
||||
|
||||
public ReadFile(String path) throws IOException {
|
||||
String s = "";
|
||||
DataOutputStream os = null;
|
||||
BufferedReader br = null;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec("su");
|
||||
os = new DataOutputStream(p.getOutputStream());
|
||||
os.writeBytes("cat " + path + "\n");
|
||||
os.writeBytes("exit\n");
|
||||
os.flush();
|
||||
br = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
s += line.trim() + "\n";
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (os != null) {
|
||||
os.close();
|
||||
}
|
||||
if (br != null) {
|
||||
br.close();
|
||||
}
|
||||
}
|
||||
pattern(s);
|
||||
}
|
||||
|
||||
|
||||
private void pattern(String s) {
|
||||
//if (android.os.Build.VERSION.SDK_INT >= 26) {
|
||||
Pattern pattern = Pattern.compile("<Network>\\n([\\s\\S]+?)\\n\\</Network>");
|
||||
Matcher matcher = pattern.matcher(s);
|
||||
while (matcher.find()) {
|
||||
addOreo(matcher.group(), matcher.start(), matcher.end());
|
||||
}
|
||||
//} else {
|
||||
Pattern pattern1 = Pattern.compile("network=\\{\\n([\\s\\S]+?)\\n\\}");
|
||||
Matcher matcher1 = pattern1.matcher(s);
|
||||
while (matcher1.find()) {
|
||||
add(matcher1.group(), matcher1.start(), matcher1.end());
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
private void add(String content, int s, int e) {
|
||||
HashMap<String, String> map = new HashMap<String, String>();
|
||||
map.put("view", content);
|
||||
map.put("pos",s + "," + e);
|
||||
content = content.substring(9, content.length() - 2);
|
||||
String[] list = content.split("\\n");
|
||||
String x, y;
|
||||
for (String info : list) {
|
||||
int index = info.indexOf("=");
|
||||
if (index > -1) {
|
||||
x = info.substring(0, index);
|
||||
y = info.substring(index + 1);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
if ("ssid".equals(x)) {
|
||||
if (y.charAt(0) == '"') {
|
||||
y = y.substring(1, y.length() - 1);
|
||||
} else {
|
||||
y = toUTF8(y);
|
||||
}
|
||||
} else if ("psk".equals(x)) {
|
||||
y = y.substring(1, y.length() - 1);
|
||||
}
|
||||
if (y == null) {
|
||||
continue;
|
||||
}
|
||||
map.put(x, y);
|
||||
}
|
||||
this.list.add(map);
|
||||
}
|
||||
|
||||
|
||||
private void addOreo(String content, int s, int e) {
|
||||
HashMap<String, String> map = new HashMap<String, String>();
|
||||
map.put("pos",s + "," + e);
|
||||
String[] list = content.split("\\n");
|
||||
String x;
|
||||
for (String info : list) {
|
||||
if (info.contains("name=\"SSID\">")) {
|
||||
x = getSubUtilSimple(info, "name=\"SSID\">"(.*?)"");
|
||||
map.put("ssid",x);
|
||||
} else if (info.contains("name=\"PreSharedKey\"")) {
|
||||
if (!info.contains("null")) {
|
||||
x = getSubUtilSimple(info, "name=\"PreSharedKey\">"(.*?)"");
|
||||
map.put("psk", x);
|
||||
}
|
||||
}
|
||||
}
|
||||
map.put("view", content);
|
||||
this.list.add(map);
|
||||
}
|
||||
|
||||
public ArrayList<Map<String, String>> getList(Context context) {
|
||||
ArrayList<Map<String, String>> m = new ArrayList<Map<String, String>>();
|
||||
for (Map<String, String> map : this.list) {
|
||||
if (map.containsKey("ssid") && map.containsKey("psk")) {
|
||||
m.add(map);
|
||||
}
|
||||
}
|
||||
return this.sorting(m, context);
|
||||
}
|
||||
|
||||
private ArrayList<Map<String, String>> sorting(ArrayList<Map<String, String>> lv, Context context) {
|
||||
if (lv.size() < 1) {
|
||||
return lv;
|
||||
}
|
||||
|
||||
Collections.sort(lv, new sort(getCurrentSSID(context)));
|
||||
|
||||
return lv;
|
||||
}
|
||||
|
||||
private String getCurrentSSID(Context context) {
|
||||
try {
|
||||
WifiManager mWifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
|
||||
if (!mWifi.isWifiEnabled()) {
|
||||
return "";
|
||||
}
|
||||
WifiInfo wifiInfo = mWifi.getConnectionInfo();
|
||||
String ssid = wifiInfo.getSSID();
|
||||
|
||||
if (ssid.charAt(0) == '"') {
|
||||
ssid = ssid.substring(1, ssid.length() - 1);
|
||||
} else {
|
||||
ssid = toUTF8(ssid);
|
||||
}
|
||||
|
||||
return ssid;
|
||||
} catch (Exception e) {
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private static String toUTF8(String s) {
|
||||
if (s == null || s.equals("")) {
|
||||
return null;
|
||||
}
|
||||
s = s.toUpperCase();
|
||||
int total = s.length() / 2;
|
||||
int pos = 0;
|
||||
byte[] buffer = new byte[total];
|
||||
for (int i = 0; i < total; i++) {
|
||||
int start = i * 2;
|
||||
buffer[i] = (byte) Integer.parseInt(s.substring(start, start + 2), 16);
|
||||
pos++;
|
||||
}
|
||||
return new String(buffer, 0, pos, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
public static String getSubUtilSimple(String soap, String rgex){
|
||||
Pattern pattern = Pattern.compile(rgex);
|
||||
Matcher m = pattern.matcher(soap);
|
||||
while(m.find()){
|
||||
return m.group(1);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class sort implements Comparator<Map<String, String>> {
|
||||
|
||||
private String currentSSID;
|
||||
|
||||
public sort(String currentSSID) {
|
||||
this.currentSSID = currentSSID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(Map<String, String> t1, Map<String, String> t2) {
|
||||
String s1 = t1.get("ssid");
|
||||
String s2 = t2.get("ssid");
|
||||
|
||||
if (s1.equals(s2)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (s1.equals(currentSSID)) {
|
||||
return -1;
|
||||
}
|
||||
if (s2.equals(currentSSID)) {
|
||||
return 1;
|
||||
}
|
||||
return s1.compareToIgnoreCase(s2);
|
||||
}
|
||||
}
|
||||
|
||||
204
app/src/main/java/Simplicity/LT/Tools/ShellUtils.java
Executable file
@@ -0,0 +1,204 @@
|
||||
package Simplicity.LT.Tools;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.List;
|
||||
|
||||
public class ShellUtils {
|
||||
|
||||
public static final String COMMAND_SU = "su";
|
||||
public static final String COMMAND_SH = "sh";
|
||||
public static final String COMMAND_EXIT = "exit\n";
|
||||
public static final String COMMAND_LINE_END = "\n";
|
||||
|
||||
private ShellUtils() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
/**
|
||||
* check whether has root permission
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static boolean checkRootPermission() {
|
||||
return execCommand("echo root", true, false).result == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* execute shell command, default return result msg
|
||||
*
|
||||
* @param command command
|
||||
* @param isRoot whether need to run with root
|
||||
* @return
|
||||
* @see ShellUtils#execCommand(String[], boolean, boolean)
|
||||
*/
|
||||
public static CommandResult execCommand(String command, boolean isRoot) {
|
||||
return execCommand(new String[] {command}, isRoot, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* execute shell commands, default return result msg
|
||||
*
|
||||
* @param commands command activity_wifi
|
||||
* @param isRoot whether need to run with root
|
||||
* @return
|
||||
* @see ShellUtils#execCommand(String[], boolean, boolean)
|
||||
*/
|
||||
public static CommandResult execCommand(List<String> commands, boolean isRoot) {
|
||||
return execCommand(commands == null ? null : commands.toArray(new String[] {}), isRoot, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* execute shell commands, default return result msg
|
||||
*
|
||||
* @param commands command array
|
||||
* @param isRoot whether need to run with root
|
||||
* @return
|
||||
* @see ShellUtils#execCommand(String[], boolean, boolean)
|
||||
*/
|
||||
public static CommandResult execCommand(String[] commands, boolean isRoot) {
|
||||
return execCommand(commands, isRoot, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* execute shell command
|
||||
*
|
||||
* @param command command
|
||||
* @param isRoot whether need to run with root
|
||||
* @param isNeedResultMsg whether need result msg
|
||||
* @return
|
||||
* @see ShellUtils#execCommand(String[], boolean, boolean)
|
||||
*/
|
||||
public static CommandResult execCommand(String command, boolean isRoot, boolean isNeedResultMsg) {
|
||||
return execCommand(new String[] {command}, isRoot, isNeedResultMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
* execute shell commands
|
||||
*
|
||||
* @param commands command activity_wifi
|
||||
* @param isRoot whether need to run with root
|
||||
* @param isNeedResultMsg whether need result msg
|
||||
* @return
|
||||
* @see ShellUtils#execCommand(String[], boolean, boolean)
|
||||
*/
|
||||
public static CommandResult execCommand(List<String> commands, boolean isRoot, boolean isNeedResultMsg) {
|
||||
return execCommand(commands == null ? null : commands.toArray(new String[] {}), isRoot, isNeedResultMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
* execute shell commands
|
||||
*
|
||||
* @param commands command array
|
||||
* @param isRoot whether need to run with root
|
||||
* @param isNeedResultMsg whether need result msg
|
||||
* @return <ul>
|
||||
* <li>if isNeedResultMsg is false, {@link CommandResult#successMsg} is null and
|
||||
* {@link CommandResult#errorMsg} is null.</li>
|
||||
* <li>if {@link CommandResult#result} is -1, there maybe some excepiton.</li>
|
||||
* </ul>
|
||||
*/
|
||||
public static CommandResult execCommand(String[] commands, boolean isRoot, boolean isNeedResultMsg) {
|
||||
int result = -1;
|
||||
if (commands == null || commands.length == 0) {
|
||||
return new CommandResult(result, null, null);
|
||||
}
|
||||
|
||||
Process process = null;
|
||||
BufferedReader successResult = null;
|
||||
BufferedReader errorResult = null;
|
||||
StringBuilder successMsg = null;
|
||||
StringBuilder errorMsg = null;
|
||||
|
||||
DataOutputStream os = null;
|
||||
try {
|
||||
process = Runtime.getRuntime().exec(isRoot ? COMMAND_SU : COMMAND_SH);
|
||||
os = new DataOutputStream(process.getOutputStream());
|
||||
for (String command : commands) {
|
||||
if (command == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// donnot use os.writeBytes(commmand), avoid chinese charset error
|
||||
os.write(command.getBytes());
|
||||
os.writeBytes(COMMAND_LINE_END);
|
||||
os.flush();
|
||||
}
|
||||
os.writeBytes(COMMAND_EXIT);
|
||||
os.flush();
|
||||
|
||||
result = process.waitFor();
|
||||
// get command result
|
||||
if (isNeedResultMsg) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (os != null) {
|
||||
os.close();
|
||||
}
|
||||
if (successResult != null) {
|
||||
successResult.close();
|
||||
}
|
||||
if (errorResult != null) {
|
||||
errorResult.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (process != null) {
|
||||
process.destroy();
|
||||
}
|
||||
}
|
||||
return new CommandResult(result, successMsg == null ? null : successMsg.toString(), errorMsg == null ? null
|
||||
: errorMsg.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* result of command
|
||||
* <ul>
|
||||
* <li>{@link CommandResult#result} means result of command, 0 means normal, else means error, same to excute in
|
||||
* linux shell</li>
|
||||
* <li>{@link CommandResult#successMsg} means success message of command result</li>
|
||||
* <li>{@link CommandResult#errorMsg} means error message of command result</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author <main href="http://www.trinea.cn" target="_blank">Trinea</main> 2013-5-16
|
||||
*/
|
||||
public static class CommandResult {
|
||||
|
||||
/** result of command **/
|
||||
public int result;
|
||||
/** success message of command result **/
|
||||
public String successMsg;
|
||||
/** error message of command result **/
|
||||
public String errorMsg;
|
||||
|
||||
public CommandResult(int result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public CommandResult(int result, String successMsg, String errorMsg) {
|
||||
this.result = result;
|
||||
this.successMsg = successMsg;
|
||||
this.errorMsg = errorMsg;
|
||||
}
|
||||
}
|
||||
}
|
||||
189
app/src/main/java/Simplicity/LT/Tools/SystemProperties.java
Executable file
@@ -0,0 +1,189 @@
|
||||
package Simplicity.LT.Tools;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import dalvik.system.DexFile;
|
||||
|
||||
public class SystemProperties {
|
||||
/**
|
||||
* 根据给定Key获取值.
|
||||
*
|
||||
* @return 如果不存在该key则返回空字符串
|
||||
*/
|
||||
public static String get(Context context, String key) throws IllegalArgumentException {
|
||||
String ret = "";
|
||||
try {
|
||||
ClassLoader cl = context.getClassLoader();
|
||||
@SuppressWarnings("rawtypes")
|
||||
Class SystemProperties = cl.loadClass("android.os.SystemProperties");
|
||||
//参数类型
|
||||
@SuppressWarnings("rawtypes")
|
||||
Class[] paramTypes = new Class[1];
|
||||
paramTypes[0] = String.class;
|
||||
Method get = SystemProperties.getMethod("get", paramTypes);
|
||||
//参数
|
||||
Object[] params = new Object[1];
|
||||
params[0] = key;
|
||||
ret = (String) get.invoke(SystemProperties, params);
|
||||
} catch (IllegalArgumentException iAE) {
|
||||
throw iAE;
|
||||
} catch (Exception e) {
|
||||
ret = "";
|
||||
//TODO
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static String get(Context context, String key, String def) throws IllegalArgumentException {
|
||||
String ret = def;
|
||||
try {
|
||||
ClassLoader cl = context.getClassLoader();
|
||||
@SuppressWarnings("rawtypes")
|
||||
Class SystemProperties = cl.loadClass("android.os.SystemProperties");
|
||||
//参数类型
|
||||
@SuppressWarnings("rawtypes")
|
||||
Class[] paramTypes = new Class[2];
|
||||
paramTypes[0] = String.class;
|
||||
paramTypes[1] = String.class;
|
||||
Method get = SystemProperties.getMethod("get", paramTypes);
|
||||
//参数
|
||||
Object[] params = new Object[2];
|
||||
params[0] = key;
|
||||
params[1] = def;
|
||||
ret = (String) get.invoke(SystemProperties, params);
|
||||
} catch (IllegalArgumentException iAE) {
|
||||
throw iAE;
|
||||
} catch (Exception e) {
|
||||
ret = def;
|
||||
//TODO
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
public static Integer getInt(Context context, String key, int def) throws IllegalArgumentException {
|
||||
Integer ret = def;
|
||||
try {
|
||||
ClassLoader cl = context.getClassLoader();
|
||||
@SuppressWarnings("rawtypes")
|
||||
Class SystemProperties = cl.loadClass("android.os.SystemProperties");
|
||||
//参数类型
|
||||
@SuppressWarnings("rawtypes")
|
||||
Class[] paramTypes = new Class[2];
|
||||
paramTypes[0] = String.class;
|
||||
paramTypes[1] = int.class;
|
||||
Method getInt = SystemProperties.getMethod("getInt", paramTypes);
|
||||
//参数
|
||||
Object[] params = new Object[2];
|
||||
params[0] = key;
|
||||
params[1] = new Integer(def);
|
||||
ret = (Integer) getInt.invoke(SystemProperties, params);
|
||||
} catch (IllegalArgumentException iAE) {
|
||||
throw iAE;
|
||||
} catch (Exception e) {
|
||||
ret = def;
|
||||
//TODO
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据给定的key返回long类型值.
|
||||
*
|
||||
* @param key 要查询的key
|
||||
* @param def 默认返回值
|
||||
* @return 返回一个long类型的值, 如果没有发现则返回默认值
|
||||
|
||||
*/
|
||||
public static Long getLong(Context context, String key, long def) throws IllegalArgumentException {
|
||||
Long ret = def;
|
||||
try {
|
||||
ClassLoader cl = context.getClassLoader();
|
||||
@SuppressWarnings("rawtypes")
|
||||
Class SystemProperties = cl.loadClass("android.os.SystemProperties");
|
||||
//参数类型
|
||||
@SuppressWarnings("rawtypes")
|
||||
Class[] paramTypes = new Class[2];
|
||||
paramTypes[0] = String.class;
|
||||
paramTypes[1] = long.class;
|
||||
Method getLong = SystemProperties.getMethod("getLong", paramTypes);
|
||||
//参数
|
||||
Object[] params = new Object[2];
|
||||
params[0] = key;
|
||||
params[1] = new Long(def);
|
||||
ret = (Long) getLong.invoke(SystemProperties, params);
|
||||
} catch (IllegalArgumentException iAE) {
|
||||
throw iAE;
|
||||
} catch (Exception e) {
|
||||
ret = def;
|
||||
//TODO
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据给定的key返回boolean类型值.
|
||||
* 如果值为 'n', 'no', '0', 'false' or 'off' 返回false.
|
||||
* 如果值为'y', 'yes', '1', 'true' or 'on' 返回true.
|
||||
* 如果key不存在, 或者是其它的值, 则返回默认值.
|
||||
*
|
||||
|
||||
*/
|
||||
public static Boolean getBoolean(Context context, String key, boolean def) throws IllegalArgumentException {
|
||||
Boolean ret = def;
|
||||
try {
|
||||
ClassLoader cl = context.getClassLoader();
|
||||
@SuppressWarnings("rawtypes")
|
||||
Class SystemProperties = cl.loadClass("android.os.SystemProperties");
|
||||
//参数类型
|
||||
@SuppressWarnings("rawtypes")
|
||||
Class[] paramTypes = new Class[2];
|
||||
paramTypes[0] = String.class;
|
||||
paramTypes[1] = boolean.class;
|
||||
Method getBoolean = SystemProperties.getMethod("getBoolean", paramTypes);
|
||||
//参数
|
||||
Object[] params = new Object[2];
|
||||
params[0] = key;
|
||||
params[1] = new Boolean(def);
|
||||
ret = (Boolean) getBoolean.invoke(SystemProperties, params);
|
||||
} catch (IllegalArgumentException iAE) {
|
||||
throw iAE;
|
||||
} catch (Exception e) {
|
||||
ret = def;
|
||||
//TODO
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
public static void set(Context context, String key, String val) throws IllegalArgumentException {
|
||||
try {
|
||||
@SuppressWarnings("unused")
|
||||
DexFile df = new DexFile(new File("/system/app/Settings.apk"));
|
||||
@SuppressWarnings("unused")
|
||||
ClassLoader cl = context.getClassLoader();
|
||||
@SuppressWarnings("rawtypes")
|
||||
Class SystemProperties = Class.forName("android.os.SystemProperties");
|
||||
//参数类型
|
||||
@SuppressWarnings("rawtypes")
|
||||
Class[] paramTypes = new Class[2];
|
||||
paramTypes[0] = String.class;
|
||||
paramTypes[1] = String.class;
|
||||
Method set = SystemProperties.getMethod("set", paramTypes);
|
||||
//参数
|
||||
Object[] params = new Object[2];
|
||||
params[0] = key;
|
||||
params[1] = val;
|
||||
set.invoke(SystemProperties, params);
|
||||
} catch (IllegalArgumentException iAE) {
|
||||
throw iAE;
|
||||
} catch (Exception e) {
|
||||
//TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
59
app/src/main/java/Simplicity/LT/Tools/WiFiAdapter.java
Executable file
@@ -0,0 +1,59 @@
|
||||
package Simplicity.LT.Tools;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
public class WiFiAdapter extends BaseAdapter {
|
||||
private Context context;
|
||||
ArrayList<Map<String, String>> mainList;
|
||||
public WiFiAdapter(Context context, ArrayList<Map<String, String>> list) {
|
||||
super();
|
||||
this.context = context;
|
||||
this.mainList = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mainList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View view, ViewGroup parent) {
|
||||
ViewHolder holder;
|
||||
Map<String, String> m = mainList.get(position);
|
||||
if (view != null) {
|
||||
holder = (ViewHolder) view.getTag();
|
||||
} else {
|
||||
view = View.inflate(context, R.layout.wifi_info, null);
|
||||
holder = new ViewHolder();
|
||||
holder.ssid = view.findViewById(R.id.ssid);
|
||||
holder.password = view.findViewById(R.id.password);
|
||||
view.setTag(holder);
|
||||
}
|
||||
holder.ssid.setText(m.get("ssid"));
|
||||
holder.password.setText(m.get("psk"));
|
||||
return view;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
public TextView ssid;
|
||||
public TextView password;
|
||||
}
|
||||
|
||||
}
|
||||
94
app/src/main/java/Simplicity/LT/Tools/WifiActivity.java
Executable file
@@ -0,0 +1,94 @@
|
||||
package Simplicity.LT.Tools;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import miui.app.Activity;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
public class WifiActivity extends Activity {
|
||||
ArrayList<Map<String, String>> mainList;
|
||||
Context context = this;
|
||||
String sPath;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(miui.R.style.Theme_Light_Settings);
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_wifi);
|
||||
Intent intent = getIntent();
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
intent.putExtra("path", "/data/misc/wifi/WifiConfigStore.xml");
|
||||
} else {
|
||||
intent.putExtra("path", "/data/misc/wifi/wpa_supplicant.conf");
|
||||
}
|
||||
if(Intent.ACTION_VIEW.equals(getIntent().getAction())) {
|
||||
sPath = intent.getDataString().substring(8);
|
||||
if(sPath.contains("%20")) {
|
||||
finish();
|
||||
System.exit(0);
|
||||
} else {
|
||||
mainList = get(sPath);
|
||||
}
|
||||
} else {
|
||||
Bundle bundle = intent.getExtras();
|
||||
sPath = bundle.getString("path");
|
||||
mainList = get(sPath);
|
||||
}
|
||||
onWork();
|
||||
}
|
||||
|
||||
private void onWork() {
|
||||
if (mainList == null) {
|
||||
Toast.makeText(WifiActivity.this, "未发现密码", Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
if (mainList.size() == 0) {
|
||||
Toast.makeText(WifiActivity.this, "未发现密码", Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
doWork();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void doWork() {
|
||||
ListView lv = findViewById(R.id.WIFI);
|
||||
lv.setAdapter(new WiFiAdapter(this, mainList));
|
||||
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {
|
||||
final ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
cm.setPrimaryClip(ClipData.newPlainText(null, mainList.get(position).get("psk")));
|
||||
Toast.makeText(WifiActivity.this, "已复制密码到剪切板", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public ArrayList<Map<String, String>> get(String path) {
|
||||
try {
|
||||
ReadFile file = new ReadFile(path);
|
||||
return file.getList(this.context);
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(this, "ReadFile:" + e.getMessage(), Toast.LENGTH_LONG).show();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if(item.getItemId() == android.R.id.home){
|
||||
onBackPressed();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
34
app/src/main/res/drawable-v24/ic_launcher_foreground.xml
Executable file
@@ -0,0 +1,34 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="78.5885"
|
||||
android:endY="90.9159"
|
||||
android:startX="48.7653"
|
||||
android:startY="61.0927"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
||||
170
app/src/main/res/drawable/ic_launcher_background.xml
Executable file
@@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#008577"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
||||
7
app/src/main/res/layout/activity_wifi.xml
Executable file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ListView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/WIFI"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp" />
|
||||
19
app/src/main/res/layout/wifi_info.xml
Executable file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:minHeight="?android:attr/actionBarSize"
|
||||
android:paddingLeft="8dp">
|
||||
<TextView
|
||||
android:id="@+id/ssid"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"/>
|
||||
<TextView
|
||||
android:id="@+id/password"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
|
||||
5
app/src/main/res/menu/menu.xml
Executable file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@+id/about" android:title="关于"/>
|
||||
|
||||
</menu>
|
||||
5
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Executable file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
5
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Executable file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Executable file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Executable file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Executable file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Executable file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Executable file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Executable file
|
After Width: | Height: | Size: 6.7 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Executable file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Executable file
|
After Width: | Height: | Size: 10 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Executable file
|
After Width: | Height: | Size: 8.9 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Executable file
|
After Width: | Height: | Size: 15 KiB |
125
app/src/main/res/values/array.xml
Executable file
@@ -0,0 +1,125 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string-array name="gjcq">gjcq
|
||||
<item>正常重启</item>
|
||||
<item>Recovery</item>
|
||||
<item>FastBoot</item>
|
||||
<item>重启系统UI</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="gjcq_values">gjcq_values
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="xtdh">xtdh
|
||||
<item>官方默认</item>
|
||||
<item>极速残影</item>
|
||||
<item>滑入滑出</item>
|
||||
<item>3D特效</item>
|
||||
<item>抖动特效</item>
|
||||
<item>DX8特效</item>
|
||||
<item>飞来飞去</item>
|
||||
<item>匿名特效</item>
|
||||
<item>飘来飘去</item>
|
||||
<item>超炫特效</item>
|
||||
<item>翻转特效</item>
|
||||
<item>上中下特效</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="xtdh_values">xtdh_values
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
<item>5</item>
|
||||
<item>6</item>
|
||||
<item>7</item>
|
||||
<item>8</item>
|
||||
<item>9</item>
|
||||
<item>10</item>
|
||||
<item>11</item>
|
||||
<item>12</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="model">model
|
||||
<item>官方默认</item>
|
||||
<item>小米9</item>
|
||||
<item>小米8</item>
|
||||
<item>小米 MIX3</item>
|
||||
<item>小米 MIX2S</item>
|
||||
|
||||
</string-array>
|
||||
|
||||
<string-array name="model_values">model_values
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
<item>5</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="sjys">sjys
|
||||
<item>默认样式</item>
|
||||
<item>星期 时间</item>
|
||||
<item>农历 时间</item>
|
||||
<item>年-月-日 星期 时间</item>
|
||||
<item>农历 年-月-日 星期 时间</item>
|
||||
<item>农历 星期 时间</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="sjys_values">sjys_values
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
<item>5</item>
|
||||
<item>6</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="tqbj">tqbj
|
||||
<item>状态栏图标上方(横屏不完美,不限DPI)</item>
|
||||
<item>状态栏图标左侧(横屏完美,需小DPI)</item>
|
||||
<item>关闭状态栏天气</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="tqbj_values">tqbj_values
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="sim">sim
|
||||
<item>全部显示</item>
|
||||
<item>仅隐藏SIM卡1</item>
|
||||
<item>仅隐藏SIM卡2</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="sim_values">sim_values
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="xmqh">xmqh
|
||||
<item>官方</item>
|
||||
<item>官方+显秒</item>
|
||||
<item>居中+左侧网速</item>
|
||||
<item>居中+左侧网速+显秒</item>
|
||||
<item>居中+右侧网速</item>
|
||||
<item>居中+右侧网速+显秒</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="xmqh_values">xmqh_values
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
<item>5</item>
|
||||
<item>6</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
||||
22
app/src/main/res/values/strings.xml
Executable file
@@ -0,0 +1,22 @@
|
||||
<resources>
|
||||
<string name="app_name">Simplicity Tools</string>
|
||||
<string name="author">关于</string>
|
||||
<string name="wifi">WIFI密码</string>
|
||||
<string name="ztl">状态栏</string>
|
||||
<string name="other">其他功能</string>
|
||||
<string name="zm">桌面(某些主题不兼容)</string>
|
||||
<string name="ksct">快速磁贴(某些主题不兼容)</string>
|
||||
<string name="xs">显示</string>
|
||||
<string name="syxgn">实验性功能</string>
|
||||
<string name="xt">系统</string>
|
||||
<string name="hy">黑域</string>
|
||||
<string name="jj">捷径</string>
|
||||
<string name="dc">电池</string>
|
||||
<string name="yydj">应用冻结</string>
|
||||
<string name="djkg">冻结开关</string>
|
||||
<string name="tgfw">LittleTurtle网络科技 提供技术支持</string>
|
||||
<string name="sy">声音</string>
|
||||
<string name="about">关于</string>
|
||||
<string name="exit">退出</string>
|
||||
<string name="suoping">锁屏</string>
|
||||
</resources>
|
||||
42
app/src/main/res/xml/lite.xml
Executable file
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen android:title="@string/yydj"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<PreferenceCategory android:key="diy">
|
||||
<PreferenceScreen
|
||||
android:key="cust" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:key="switch" >
|
||||
<CheckBoxPreference
|
||||
android:key="updater" />
|
||||
<CheckBoxPreference
|
||||
android:key="bugreport" />
|
||||
<CheckBoxPreference
|
||||
android:key="wallet" />
|
||||
<CheckBoxPreference
|
||||
android:key="email"/>
|
||||
<CheckBoxPreference
|
||||
android:key="virtualsim" />
|
||||
<CheckBoxPreference
|
||||
android:key="remotecontroller" />
|
||||
<CheckBoxPreference
|
||||
android:key="shop" />
|
||||
<CheckBoxPreference
|
||||
android:key="compass" />
|
||||
<CheckBoxPreference
|
||||
android:key="calculator" />
|
||||
<CheckBoxPreference
|
||||
android:key="browser" />
|
||||
<CheckBoxPreference
|
||||
android:key="soundrecorder" />
|
||||
<CheckBoxPreference
|
||||
android:key="calendar" />
|
||||
<CheckBoxPreference
|
||||
android:key="video" />
|
||||
<CheckBoxPreference
|
||||
android:key="player" />
|
||||
<CheckBoxPreference
|
||||
android:key="notes"/>
|
||||
<CheckBoxPreference
|
||||
android:key="weather2" />
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
189
app/src/main/res/xml/miui.xml
Executable file
@@ -0,0 +1,189 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen android:title="@string/app_name"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<PreferenceScreen
|
||||
android:key="syxz" />
|
||||
|
||||
<PreferenceCategory android:title="@string/hy" />
|
||||
<CheckBoxPreference
|
||||
android:key="hykg" />
|
||||
<PreferenceScreen
|
||||
android:key="glhy" />
|
||||
|
||||
<PreferenceCategory android:title="@string/ztl" />
|
||||
<ListPreference
|
||||
android:title="显秒&布局切换"
|
||||
android:defaultValue="1"
|
||||
android:entries="@array/xmqh"
|
||||
android:entryValues="@array/xmqh_values"
|
||||
android:key="xmqh" />
|
||||
<ListPreference
|
||||
android:title="时钟格式-预设"
|
||||
android:defaultValue="1"
|
||||
android:entries="@array/sjys"
|
||||
android:entryValues="@array/sjys_values"
|
||||
android:key="sjys" />
|
||||
<PreferenceScreen
|
||||
android:key="szgs_12h" />
|
||||
<PreferenceScreen
|
||||
android:key="szgs_24h" />
|
||||
<ListPreference
|
||||
android:title="选择天气布局"
|
||||
android:defaultValue="1"
|
||||
android:entries="@array/tqbj"
|
||||
android:entryValues="@array/tqbj_values"
|
||||
android:key="tqbj" />
|
||||
<PreferenceScreen
|
||||
android:key="tqdx" />
|
||||
<PreferenceScreen
|
||||
android:key="ztlszdx" />
|
||||
<PreferenceScreen
|
||||
android:key="xlszdx" />
|
||||
<PreferenceScreen
|
||||
android:key="szsbj" />
|
||||
<CheckBoxPreference
|
||||
android:key="ycnz"/>
|
||||
<CheckBoxPreference
|
||||
android:key="ycly"/>
|
||||
<CheckBoxPreference
|
||||
android:key="ycej"/>
|
||||
<CheckBoxPreference
|
||||
android:key="ycyl"/>
|
||||
<CheckBoxPreference
|
||||
android:key="ycfx"/>
|
||||
<CheckBoxPreference
|
||||
android:key="ycdw"/>
|
||||
<CheckBoxPreference
|
||||
android:key="ychd"/>
|
||||
<PreferenceScreen
|
||||
android:key="dcys" />
|
||||
<ListPreference
|
||||
android:title="选择隐藏SIM卡图标"
|
||||
android:defaultValue="1"
|
||||
android:entries="@array/sim"
|
||||
android:entryValues="@array/sim_values"
|
||||
android:key="sim" />
|
||||
|
||||
|
||||
|
||||
<PreferenceCategory android:title="@string/zm" />
|
||||
<CheckBoxPreference
|
||||
android:key="ycmz"/>
|
||||
<CheckBoxPreference
|
||||
android:key="ycdl"/>
|
||||
<PreferenceScreen
|
||||
android:key="zmbj_x" />
|
||||
<PreferenceScreen
|
||||
android:key="tbdx" />
|
||||
<PreferenceScreen
|
||||
android:key="zmbj_y" />
|
||||
<PreferenceScreen
|
||||
android:key="wjj" />
|
||||
|
||||
|
||||
|
||||
<PreferenceCategory android:title="@string/ksct" />
|
||||
<PreferenceScreen
|
||||
android:key="ksct" />
|
||||
<PreferenceScreen
|
||||
android:key="ctbj_x" />
|
||||
<PreferenceScreen
|
||||
android:key="ctbj_y" />
|
||||
|
||||
<PreferenceCategory android:title="@string/suoping" />
|
||||
<CheckBoxPreference
|
||||
android:key="xptq" />
|
||||
|
||||
|
||||
<PreferenceCategory android:title="@string/xs" />
|
||||
<PreferenceScreen
|
||||
android:key="pmmd" />
|
||||
<ListPreference
|
||||
android:title="选择系统动画"
|
||||
android:defaultValue="1"
|
||||
android:entries="@array/xtdh"
|
||||
android:entryValues="@array/xtdh_values"
|
||||
android:key="xtdh" />
|
||||
<PreferenceScreen
|
||||
android:key="cksd" />
|
||||
<PreferenceScreen
|
||||
android:key="dhsf" />
|
||||
<PreferenceScreen
|
||||
android:key="scsf" />
|
||||
<PreferenceScreen
|
||||
android:key="xfss" />
|
||||
|
||||
<PreferenceCategory android:title="@string/other" />
|
||||
<CheckBoxPreference
|
||||
android:key="ggpb" />
|
||||
<CheckBoxPreference
|
||||
android:key="hide" />
|
||||
<PreferenceScreen
|
||||
android:key="wifi" />
|
||||
<CheckBoxPreference
|
||||
android:key="ycmg" />
|
||||
|
||||
|
||||
|
||||
<PreferenceCategory android:title="@string/xt" />
|
||||
<ListPreference
|
||||
android:title="选择重启方式"
|
||||
android:defaultValue="1"
|
||||
android:entries="@array/gjcq"
|
||||
android:entryValues="@array/gjcq_values"
|
||||
android:key="gjcq" />
|
||||
<CheckBoxPreference
|
||||
android:key="yysd" />
|
||||
<PreferenceScreen
|
||||
android:key="yydj" />
|
||||
<PreferenceScreen
|
||||
android:key="yjjj" />
|
||||
|
||||
|
||||
<PreferenceCategory android:title="@string/syxgn" />
|
||||
<PreferenceScreen
|
||||
android:key="wk" />
|
||||
|
||||
|
||||
<PreferenceCategory android:title="@string/dc" />
|
||||
<CheckBoxPreference
|
||||
android:key="jzcd" />
|
||||
<PreferenceScreen
|
||||
android:key="dlwz" />
|
||||
<PreferenceScreen
|
||||
android:key="dcjz" />
|
||||
|
||||
|
||||
<PreferenceCategory android:title="@string/sy" />
|
||||
<CheckBoxPreference
|
||||
android:key="dylj" />
|
||||
<CheckBoxPreference
|
||||
android:key="dydk" />
|
||||
<CheckBoxPreference
|
||||
android:key="ddl" />
|
||||
|
||||
<PreferenceCategory android:title="@string/jj" />
|
||||
<PreferenceScreen
|
||||
android:key="tzrz" />
|
||||
<PreferenceScreen
|
||||
android:key="hdqx" />
|
||||
|
||||
|
||||
<PreferenceCategory android:title="@string/author" />
|
||||
<PreferenceScreen
|
||||
android:key="ca" />
|
||||
<PreferenceScreen
|
||||
android:key="qqq" />
|
||||
<PreferenceScreen
|
||||
android:key="gw" />
|
||||
<PreferenceScreen
|
||||
android:key="wx" />
|
||||
<PreferenceScreen
|
||||
android:key="jz" />
|
||||
<PreferenceScreen
|
||||
android:key="bbh"
|
||||
android:summary="3.5.0"/>
|
||||
|
||||
<PreferenceCategory android:title="@string/tgfw" />
|
||||
</PreferenceScreen>
|
||||
27
build.gradle
Executable file
@@ -0,0 +1,27 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.5.0'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
15
gradle.properties
Executable file
@@ -0,0 +1,15 @@
|
||||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx1536m
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Executable file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Executable file
@@ -0,0 +1,6 @@
|
||||
#Tue Aug 27 04:35:44 CST 2019
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip
|
||||
172
gradlew
vendored
Executable file
@@ -0,0 +1,172 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
84
gradlew.bat
vendored
Executable file
@@ -0,0 +1,84 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
1
settings.gradle
Executable file
@@ -0,0 +1 @@
|
||||
include ':app'
|
||||