Various small improvements
This commit is contained in:
parent
c9217a419a
commit
3c33f7d294
@ -1,13 +1,13 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 24
|
||||
buildToolsVersion "24.0.2"
|
||||
compileSdkVersion 25
|
||||
buildToolsVersion "25.0.1"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.topjohnwu.magisk"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 24
|
||||
targetSdkVersion 25
|
||||
versionCode 7
|
||||
versionName "2.5"
|
||||
jackOptions {
|
||||
@ -19,8 +19,13 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
incremental false
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
@ -44,11 +49,10 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||
compile 'com.android.support:recyclerview-v7:24.2.1'
|
||||
compile 'com.android.support:cardview-v7:24.2.1'
|
||||
compile 'com.android.support:design:24.2.1'
|
||||
compile 'com.android.support:recyclerview-v7:25.0.1'
|
||||
compile 'com.android.support:cardview-v7:25.0.1'
|
||||
compile 'com.android.support:design:25.0.1'
|
||||
compile 'com.jakewharton:butterknife:8.4.0'
|
||||
compile 'com.github.michalis-vitos:aFileChooser:master'
|
||||
compile 'com.google.code.gson:gson:2.8.0'
|
||||
compile 'com.github.clans:fab:1.6.4'
|
||||
compile 'com.madgag.spongycastle:core:1.54.0.0'
|
||||
|
26
app/proguard-rules.pro
vendored
26
app/proguard-rules.pro
vendored
@ -15,3 +15,29 @@
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Gson uses generic type information stored in a class file when working with fields. Proguard
|
||||
# removes such information by default, so configure it to keep all of it.
|
||||
-keepattributes Signature
|
||||
|
||||
# For using GSON @Expose annotation
|
||||
-keepattributes *Annotation*
|
||||
|
||||
# Gson specific classes
|
||||
-keep class sun.misc.Unsafe { *; }
|
||||
-keep class com.google.gson.** { *; }
|
||||
|
||||
# Application classes that will be serialized/deserialized over Gson
|
||||
-keep class com.topjohnwu.magisk.module.** { *; }
|
||||
-keep class com.topjohnwu.magisk.utils.ModuleHelper$ValueSortedMap { *; }
|
||||
|
||||
# Prevent proguard from stripping interface information from TypeAdapterFactory,
|
||||
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
|
||||
-keep class * implements com.google.gson.TypeAdapterFactory
|
||||
-keep class * implements com.google.gson.JsonSerializer
|
||||
-keep class * implements com.google.gson.JsonDeserializer
|
||||
|
||||
-keep class android.support.v7.internal.** { *; }
|
||||
-keep interface android.support.v7.internal.** { *; }
|
||||
-keep class android.support.v7.** { *; }
|
||||
-keep interface android.support.v7.** { *; }
|
||||
|
@ -4,8 +4,6 @@
|
||||
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-sdk tools:overrideLibrary="com.kcoppock.broadcasttilesupport" />
|
||||
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
@ -36,33 +34,6 @@
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.ipaulpro.afilechooser.FileChooserActivity"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:icon="@drawable/ic_chooser"
|
||||
android:label="@string/choose_file">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.GET_CONTENT" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.OPENABLE" />
|
||||
|
||||
<data android:mimeType="*/*" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<provider
|
||||
android:name="com.ianhanniballake.localstorage.LocalStorageProvider"
|
||||
android:authorities="com.topjohnwu.magisk.documents"
|
||||
android:enabled="@bool/use_provider"
|
||||
android:exported="true"
|
||||
android:grantUriPermissions="true"
|
||||
android:permission="android.permission.MANAGE_DOCUMENTS">
|
||||
<intent-filter>
|
||||
<action android:name="android.content.action.DOCUMENTS_PROVIDER" />
|
||||
</intent-filter>
|
||||
</provider>
|
||||
|
||||
<activity
|
||||
android:name=".AboutActivity"
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.topjohnwu.magisk;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
@ -15,7 +16,6 @@ import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.github.clans.fab.FloatingActionButton;
|
||||
import com.ipaulpro.afilechooser.utils.FileUtils;
|
||||
import com.topjohnwu.magisk.adapters.ModulesAdapter;
|
||||
import com.topjohnwu.magisk.module.Module;
|
||||
import com.topjohnwu.magisk.utils.Async;
|
||||
@ -48,10 +48,9 @@ public class ModulesFragment extends Fragment {
|
||||
ButterKnife.bind(this, mView);
|
||||
|
||||
fabio.setOnClickListener(v -> {
|
||||
Intent getContentIntent = FileUtils.createGetContentIntent(null);
|
||||
getContentIntent.setType("application/zip");
|
||||
Intent fileIntent = Intent.createChooser(getContentIntent, "Select a file");
|
||||
startActivityForResult(fileIntent, FETCH_ZIP_CODE);
|
||||
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||
intent.setType("application/zip");
|
||||
startActivityForResult(intent, FETCH_ZIP_CODE);
|
||||
});
|
||||
|
||||
prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||
@ -80,7 +79,7 @@ public class ModulesFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (data != null) {
|
||||
if (requestCode == FETCH_ZIP_CODE && resultCode == Activity.RESULT_OK && data != null) {
|
||||
// Get the URI of the selected file
|
||||
final Uri uri = data.getData();
|
||||
new Async.FlashZIP(getActivity(), uri).exec();
|
||||
|
@ -69,23 +69,24 @@ public class SettingsActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
public static class SettingsFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
public static class SettingsFragment extends PreferenceFragment
|
||||
implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
||||
private ListPreference themePreference;
|
||||
private SharedPreferences prefs;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.app_settings);
|
||||
PreferenceManager.setDefaultValues(getActivity(), R.xml.app_settings, false);
|
||||
prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||
|
||||
themePreference = (ListPreference) findPreference("theme");
|
||||
CheckBoxPreference busyboxPreference = (CheckBoxPreference) findPreference("busybox");
|
||||
CheckBoxPreference magiskhidePreference = (CheckBoxPreference) findPreference("magiskhide");
|
||||
CheckBoxPreference hostsPreference = (CheckBoxPreference) findPreference("hosts");
|
||||
|
||||
PreferenceManager.getDefaultSharedPreferences(getActivity()).registerOnSharedPreferenceChangeListener(this);
|
||||
|
||||
themePreference.setSummary(themePreference.getValue());
|
||||
|
||||
if (MagiskFragment.magiskVersion < 9) {
|
||||
@ -103,23 +104,23 @@ public class SettingsActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
PreferenceManager.getDefaultSharedPreferences(getActivity()).registerOnSharedPreferenceChangeListener(this);
|
||||
prefs.registerOnSharedPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
PreferenceManager.getDefaultSharedPreferences(getActivity()).unregisterOnSharedPreferenceChangeListener(this);
|
||||
prefs.unregisterOnSharedPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
|
||||
Logger.dev("Settings: Prefs change " + key);
|
||||
boolean checked;
|
||||
|
||||
switch (key) {
|
||||
case "theme":
|
||||
String theme = sharedPreferences.getString(key, "");
|
||||
String theme = prefs.getString(key, "");
|
||||
|
||||
themePreference.setSummary(theme);
|
||||
if (theme.equals("Dark")) {
|
||||
@ -133,7 +134,7 @@ public class SettingsActivity extends AppCompatActivity {
|
||||
startActivity(intent);
|
||||
break;
|
||||
case "magiskhide":
|
||||
checked = sharedPreferences.getBoolean("magiskhide", false);
|
||||
checked = prefs.getBoolean("magiskhide", false);
|
||||
if (checked) {
|
||||
new Async.RootTask<Void, Void, Void>() {
|
||||
@Override
|
||||
@ -151,9 +152,10 @@ public class SettingsActivity extends AppCompatActivity {
|
||||
}
|
||||
}.exec();
|
||||
}
|
||||
Toast.makeText(getActivity(), R.string.settings_reboot_toast, Toast.LENGTH_LONG).show();
|
||||
break;
|
||||
case "busybox":
|
||||
checked = sharedPreferences.getBoolean("busybox", false);
|
||||
checked = prefs.getBoolean("busybox", false);
|
||||
if (checked) {
|
||||
new Async.RootTask<Void, Void, Void>() {
|
||||
@Override
|
||||
@ -174,7 +176,7 @@ public class SettingsActivity extends AppCompatActivity {
|
||||
Toast.makeText(getActivity(), R.string.settings_reboot_toast, Toast.LENGTH_LONG).show();
|
||||
break;
|
||||
case "hosts":
|
||||
checked = sharedPreferences.getBoolean("hosts", false);
|
||||
checked = prefs.getBoolean("hosts", false);
|
||||
if (checked) {
|
||||
new Async.RootTask<Void, Void, Void>() {
|
||||
@Override
|
||||
@ -195,10 +197,10 @@ public class SettingsActivity extends AppCompatActivity {
|
||||
Toast.makeText(getActivity(), R.string.settings_reboot_toast, Toast.LENGTH_LONG).show();
|
||||
break;
|
||||
case "developer_logging":
|
||||
Logger.devLog = sharedPreferences.getBoolean("developer_logging", false);
|
||||
Logger.devLog = prefs.getBoolean("developer_logging", false);
|
||||
break;
|
||||
case "shell_logging":
|
||||
Logger.logShell = sharedPreferences.getBoolean("shell_logging", false);
|
||||
Logger.logShell = prefs.getBoolean("shell_logging", false);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ public class ModuleHelper {
|
||||
}
|
||||
|
||||
// Making a request to url and getting response
|
||||
jsonString = WebRequest.makeWebServiceCall(context.getString(R.string.url_main) + Utils.getToken(), WebRequest.GET);
|
||||
jsonString = WebRequest.makeWebServiceCall(context.getString(R.string.url_main, Utils.getToken()), WebRequest.GET);
|
||||
|
||||
if (jsonString != null && !jsonString.isEmpty()) {
|
||||
// Have internet access
|
||||
|
@ -79,9 +79,6 @@
|
||||
<string name="no_magisk_msg">Wollen Sie Magisk herunterladen und installieren?</string>
|
||||
|
||||
<!--URL Templates-->
|
||||
<string name="url_main">https://api.github.com/orgs/Magisk-Modules-Repo/repos?access_token=</string>
|
||||
<string name="file_url">https://raw.githubusercontent.com/Magisk-Modules-Repo/%1$s/master/%2$s</string>
|
||||
<string name="zip_url">https://github.com/Magisk-Modules-Repo/%1$s/archive/master.zip</string>
|
||||
|
||||
<!--Settings Fragment -->
|
||||
<string name="settings_general_category">Allgemein</string>
|
||||
|
@ -81,9 +81,6 @@
|
||||
<string name="no_magisk_msg">¿Deseas descargar e instalar Magisk?</string>
|
||||
|
||||
<!--URL Templates-->
|
||||
<string name="url_main">https://api.github.com/orgs/Magisk-Modules-Repo/repos?access_token=</string>
|
||||
<string name="file_url">https://raw.githubusercontent.com/Magisk-Modules-Repo/%1$s/master/%2$s</string>
|
||||
<string name="zip_url">https://github.com/Magisk-Modules-Repo/%1$s/archive/master.zip</string>
|
||||
|
||||
<!--Settings Activity -->
|
||||
<string name="settings_general_category">General</string>
|
||||
|
@ -79,9 +79,6 @@
|
||||
<string name="no_magisk_msg">Vuoi scaricare ed installare Magisk?</string>
|
||||
|
||||
<!--URL Templates-->
|
||||
<string name="url_main">https://api.github.com/orgs/Magisk-Modules-Repo/repos?access_token=</string>
|
||||
<string name="file_url">https://raw.githubusercontent.com/Magisk-Modules-Repo/%1$s/master/%2$s</string>
|
||||
<string name="zip_url">https://github.com/Magisk-Modules-Repo/%1$s/archive/master.zip</string>
|
||||
|
||||
<!--Settings Fragment -->
|
||||
<string name="settings_general_category">Generali</string>
|
||||
|
@ -79,9 +79,6 @@
|
||||
<string name="no_magisk_msg">Wilt u Magisk downloaden en installeren?</string>
|
||||
|
||||
<!--URL Templates-->
|
||||
<string name="url_main">https://api.github.com/orgs/Magisk-Modules-Repo/repos?access_token=</string>
|
||||
<string name="file_url">https://raw.githubusercontent.com/Magisk-Modules-Repo/%1$s/master/%2$s</string>
|
||||
<string name="zip_url">https://github.com/Magisk-Modules-Repo/%1$s/archive/master.zip</string>
|
||||
|
||||
<!--Settings Fragment -->
|
||||
<string name="settings_general_category">Algemeen</string>
|
||||
@ -97,6 +94,7 @@
|
||||
<string name="settings_shell_logging_summary">Schakel dit in om alle shell commands en output te loggen</string>
|
||||
<string name="settings_magiskhide_title">Magisk verbergen</string>
|
||||
<string name="settings_magiskhide_summary">Reboot om de instellingen toe te passen</string>
|
||||
<string name="zip_install_unzip_zip_msg"></string>
|
||||
|
||||
<!-- Strings related to Settings -->
|
||||
|
||||
|
@ -77,9 +77,6 @@
|
||||
<string name="no_magisk_msg">Você quer baixar e instalar o Magisk?</string>
|
||||
|
||||
<!--URL Templates-->
|
||||
<string name="url_main">https://api.github.com/orgs/Magisk-Modules-Repo/repos?access_token=</string>
|
||||
<string name="file_url">https://raw.githubusercontent.com/Magisk-Modules-Repo/%1$s/master/%2$s</string>
|
||||
<string name="zip_url">https://github.com/Magisk-Modules-Repo/%1$s/archive/master.zip</string>
|
||||
|
||||
<!--Settings Fragment -->
|
||||
<string name="settings_general_category">Geral</string>
|
||||
|
@ -86,9 +86,9 @@
|
||||
<string name="no_magisk_msg">Do you want to download and install Magisk?</string>
|
||||
|
||||
<!--URL Templates-->
|
||||
<string name="url_main">https://api.github.com/orgs/Magisk-Modules-Repo/repos?access_token=</string>
|
||||
<string name="file_url">https://raw.githubusercontent.com/Magisk-Modules-Repo/%1$s/master/%2$s</string>
|
||||
<string name="zip_url">https://github.com/Magisk-Modules-Repo/%1$s/archive/master.zip</string>
|
||||
<string name="url_main" translatable="false">https://api.github.com/orgs/Magisk-Modules-Repo/repos?access_token=%1$s</string>
|
||||
<string name="file_url" translatable="false">https://raw.githubusercontent.com/Magisk-Modules-Repo/%1$s/master/%2$s</string>
|
||||
<string name="zip_url" translatable="false">https://github.com/Magisk-Modules-Repo/%1$s/archive/master.zip</string>
|
||||
|
||||
<!--Settings Activity -->
|
||||
<string name="settings_general_category">General</string>
|
||||
|
Loading…
Reference in New Issue
Block a user