Skip to content

Commit 9520028

Browse files
committed
Initial commit
1 parent 17611b0 commit 9520028

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1232
-0
lines changed

.gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/libraries
5+
/.idea/modules.xml
6+
/.idea/workspace.xml
7+
.DS_Store
8+
/build
9+
/captures
10+
.externalNativeBuild

.idea/caches/build_file_checksums.ser

535 Bytes
Binary file not shown.

.idea/codeStyles/Project.xml

+29
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

+18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+34
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 28
5+
defaultConfig {
6+
applicationId "com.example.angelo.elitescripts"
7+
minSdkVersion 24
8+
targetSdkVersion 28
9+
versionCode 1
10+
versionName "1.0"
11+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12+
}
13+
buildTypes {
14+
release {
15+
minifyEnabled false
16+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17+
}
18+
}
19+
}
20+
21+
dependencies {
22+
implementation fileTree(dir: 'libs', include: ['*.jar'])
23+
implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
24+
implementation 'com.jaredrummler:android-shell:1.0.0'
25+
implementation 'com.android.support:design:28.0.0-rc01'
26+
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
27+
testImplementation 'junit:junit:4.12'
28+
androidTestImplementation 'com.android.support.test:runner:1.0.2'
29+
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
30+
}

app/proguard-rules.pro

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.example.angelo.elitescripts;
2+
3+
import android.content.Context;
4+
import android.support.test.InstrumentationRegistry;
5+
import android.support.test.runner.AndroidJUnit4;
6+
7+
import org.junit.Test;
8+
import org.junit.runner.RunWith;
9+
10+
import static org.junit.Assert.*;
11+
12+
/**
13+
* Instrumented test, which will execute on an Android device.
14+
*
15+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
16+
*/
17+
@RunWith(AndroidJUnit4.class)
18+
public class ExampleInstrumentedTest {
19+
@Test
20+
public void useAppContext() {
21+
// Context of the app under test.
22+
Context appContext = InstrumentationRegistry.getTargetContext();
23+
24+
assertEquals("com.example.angelo.elitescripts", appContext.getPackageName());
25+
}
26+
}

app/src/main/AndroidManifest.xml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.example.angelo.elitescripts">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:supportsRtl="true"
11+
android:theme="@style/AppTheme">
12+
<activity android:name=".MainActivity">
13+
<intent-filter>
14+
<action android:name="android.intent.action.MAIN" />
15+
16+
<category android:name="android.intent.category.LAUNCHER" />
17+
</intent-filter>
18+
</activity>
19+
<activity android:name=".InfoActivity">
20+
</activity>
21+
<service
22+
android:name=".MyChTileService"
23+
android:label="@string/ch"
24+
android:icon="@drawable/ch_icon"
25+
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
26+
<intent-filter>
27+
<action android:name="android.service.quicksettings.action.QS_TILE" />
28+
</intent-filter>
29+
</service>
30+
<service
31+
android:name=".MySlkTileService"
32+
android:label="@string/slk"
33+
android:icon="@drawable/slk_icon"
34+
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
35+
<intent-filter>
36+
<action android:name="android.service.quicksettings.action.QS_TILE" />
37+
</intent-filter>
38+
</service>
39+
<service
40+
android:name=".MyUTileService"
41+
android:label="@string/U"
42+
android:icon="@drawable/u_icon"
43+
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
44+
<intent-filter>
45+
<action android:name="android.service.quicksettings.action.QS_TILE" />
46+
</intent-filter>
47+
</service>
48+
</application>
49+
50+
51+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.example.angelo.elitescripts;
2+
3+
import android.support.v7.app.AppCompatActivity;
4+
import android.os.Bundle;
5+
6+
public class InfoActivity extends AppCompatActivity {
7+
8+
@Override
9+
protected void onCreate(Bundle savedInstanceState) {
10+
super.onCreate(savedInstanceState);
11+
setContentView(R.layout.activity_info);
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
package com.example.angelo.elitescripts;
2+
3+
import android.content.Intent;
4+
import android.support.design.widget.FloatingActionButton;
5+
import android.support.design.widget.Snackbar;
6+
import android.support.v7.app.AppCompatActivity;
7+
import android.os.Bundle;
8+
import android.support.v7.widget.Toolbar;
9+
import android.util.Log;
10+
import android.view.View;
11+
import android.widget.Button;
12+
import android.widget.Toast;
13+
14+
import com.jaredrummler.android.shell.CommandResult;
15+
import com.jaredrummler.android.shell.Shell;
16+
17+
import java.io.IOException;
18+
19+
public class MainActivity extends AppCompatActivity {
20+
21+
public boolean isChWorking;
22+
public boolean isSlkWorking;
23+
public boolean isUWorking;
24+
25+
26+
@Override
27+
protected void onCreate(Bundle savedInstanceState) {
28+
super.onCreate(savedInstanceState);
29+
setContentView(R.layout.app_bar_main);
30+
try {
31+
Runtime.getRuntime().exec("su");
32+
} catch (IOException e) {
33+
}
34+
35+
final Button chButton = (Button) findViewById(R.id.chbutton);
36+
37+
chButton.setOnClickListener(new View.OnClickListener() {
38+
39+
@Override
40+
public void onClick(View view) {
41+
ch();
42+
43+
}
44+
});
45+
46+
Button slkButton = (Button) findViewById(R.id.slkbutton);
47+
48+
slkButton.setOnClickListener(new View.OnClickListener() {
49+
@Override
50+
public void onClick(View view) {
51+
52+
slk();
53+
}
54+
});
55+
56+
Button uButton = (Button) findViewById(R.id.ubutton);
57+
58+
uButton.setOnClickListener(new View.OnClickListener() {
59+
@Override
60+
public void onClick(View v) {
61+
u();
62+
}
63+
});
64+
65+
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
66+
fab.setOnClickListener(new View.OnClickListener() {
67+
@Override
68+
public void onClick(View v) {
69+
Intent intent = new Intent(MainActivity.this, InfoActivity.class);
70+
startActivity(intent);
71+
}
72+
});
73+
74+
}
75+
76+
public void ch(){
77+
CommandResult result = Shell.SU.run("sh ./system/refined/ch.sh");
78+
if (result.isSuccessful()){
79+
Log.v("EliteScripts", "ch script is working!");
80+
isChWorking = true;
81+
isSlkWorking = false;
82+
isUWorking = false;
83+
}else{
84+
Log.v("EliteScripts", "Oops, ch script is not working");
85+
isChWorking = false;
86+
}
87+
}
88+
89+
public void slk(){
90+
CommandResult result = Shell.SU.run("sh ./system/refined/slk.sh");
91+
if (result.isSuccessful()){
92+
Log.v("EliteScripts", "slk script is working!");
93+
isSlkWorking = true;
94+
isChWorking = false;
95+
isUWorking = false;
96+
}else{
97+
Log.v("EliteScripts", "Oops, slk scripts is not working");
98+
isSlkWorking = false;
99+
}
100+
}
101+
102+
public void u() {
103+
CommandResult result = Shell.SU.run("sh ./system/refined/u.sh");
104+
if (result.isSuccessful()){
105+
Log.v("EliteScripts", "u script is working!");
106+
isUWorking = true;
107+
isSlkWorking = false;
108+
isChWorking = false;
109+
}else{
110+
Log.v("EliteScripts", "Oops, u script is not working");
111+
isUWorking = false;
112+
}
113+
114+
}
115+
}

0 commit comments

Comments
 (0)