Ready for release

This commit is contained in:
topjohnwu 2016-09-29 23:24:31 +08:00
parent 692b993eee
commit e4cba70008
30 changed files with 541 additions and 414 deletions

View File

@ -2,13 +2,13 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "com.topjohnwu.magisk"
minSdkVersion 21
targetSdkVersion 24
versionCode 4
versionCode 5
versionName "2.0"
jackOptions {
enabled true
@ -32,9 +32,9 @@ repositories {
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:recyclerview-v7:24.2.0'
compile 'com.android.support:cardview-v7:24.2.0'
compile 'com.android.support:design:24.2.0'
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.github.d8ahazard:BroadcastTileSupportUpdate:master'
compile 'com.getkeepsafe.taptargetview:taptargetview:1.2.0'
compile 'com.jakewharton:butterknife:8.4.0'

View File

@ -29,7 +29,9 @@ import butterknife.ButterKnife;
public class AboutActivity extends AppCompatActivity {
private static final String SOURCE_CODE_URL = "https://github.com/topjohnwu/MagiskManager";
private static final String XDA_THREAD = "http://forum.xda-developers.com/android/software/mod-magisk-v1-universal-systemless-t3432382";
private static final String XDA_THREAD = "http://forum.xda-developers.com/showthread.php?t=3432382";
private static final String DONATION_URL = "http://topjohnwu.github.io/donate";
private AlertDialog.Builder builder;
@BindView(R.id.toolbar) Toolbar toolbar;
@ -39,6 +41,7 @@ public class AboutActivity extends AppCompatActivity {
@BindView(R.id.app_translators) RowItem appTranslators;
@BindView(R.id.app_source_code) RowItem appSourceCode;
@BindView(R.id.support_thread) RowItem supportThread;
@BindView(R.id.donation) RowItem donation;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
@ -139,6 +142,9 @@ public class AboutActivity extends AppCompatActivity {
supportThread.removeSummary();
supportThread.setOnClickListener(view -> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(XDA_THREAD))));
donation.removeSummary();
donation.setOnClickListener(view -> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(DONATION_URL))));
setFloating();
}

View File

@ -90,10 +90,7 @@ public class LogFragment extends Fragment {
reloadErrorLog();
return true;
case R.id.menu_send:
try {
send();
} catch (NullPointerException ignored) {
}
send();
return true;
case R.id.menu_save:
save();
@ -117,11 +114,23 @@ public class LogFragment extends Fragment {
}
private void send() {
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(save()));
sendIntent.setType("application/html");
startActivity(Intent.createChooser(sendIntent, getResources().getString(R.string.menuSend)));
new SaveLog() {
@Override
protected void onPostExecute(Boolean bool) {
super.onPostExecute(bool);
if (bool) {
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(targetFile));
sendIntent.setType("application/html");
startActivity(Intent.createChooser(sendIntent, getResources().getString(R.string.menuSend)));
} else {
Toast.makeText(getActivity(), getString(R.string.logs_save_failed), Toast.LENGTH_LONG).show();
}
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
}
@Override
@ -138,45 +147,66 @@ public class LogFragment extends Fragment {
}
}
@SuppressLint("DefaultLocale")
private File save() {
if (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0);
private void save() {
new SaveLog(){
@Override
protected void onPostExecute(Boolean bool) {
super.onPostExecute(bool);
if (bool) {
Toast.makeText(getActivity(), targetFile.toString(), Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getActivity(), getString(R.string.logs_save_failed), Toast.LENGTH_LONG).show();
}
}
return null;
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
}
if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
Snackbar.make(txtLog, R.string.sdcard_not_writable, Snackbar.LENGTH_LONG).show();
return null;
}
private class SaveLog extends AsyncTask<Void, Void, Boolean> {
Calendar now = Calendar.getInstance();
String filename = String.format(
"magisk_%s_%04d%02d%02d_%02d%02d%02d.log", "error",
now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1,
now.get(Calendar.DAY_OF_MONTH), now.get(Calendar.HOUR_OF_DAY),
now.get(Calendar.MINUTE), now.get(Calendar.SECOND));
File targetFile;
File dir = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Magisk/");
dir.mkdir();
File targetFile = new File(dir, filename);
List<String> in = Utils.readFile(MAGISK_LOG);
try {
FileWriter out = new FileWriter(targetFile);
for (String line : in) {
out.write(line + "\n");
@SuppressLint("DefaultLocale")
@Override
protected Boolean doInBackground(Void... voids) {
if (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0);
}
return false;
}
out.close();
Toast.makeText(getActivity(), targetFile.toString(), Toast.LENGTH_LONG).show();
return targetFile;
} catch (IOException e) {
Toast.makeText(getActivity(), getResources().getString(R.string.logs_save_failed) + "\n" + e.getMessage(), Toast.LENGTH_LONG).show();
return null;
if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
return false;
}
Calendar now = Calendar.getInstance();
String filename = String.format(
"magisk_%s_%04d%02d%02d_%02d%02d%02d.log", "error",
now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1,
now.get(Calendar.DAY_OF_MONTH), now.get(Calendar.HOUR_OF_DAY),
now.get(Calendar.MINUTE), now.get(Calendar.SECOND));
targetFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/MagiskManager/" + filename);
if ((!targetFile.getParentFile().exists() && !targetFile.getParentFile().mkdirs()) || (targetFile.exists() && !targetFile.delete())) {
return false;
}
List<String> in = Utils.readFile(MAGISK_LOG);
try {
FileWriter out = new FileWriter(targetFile);
for (String line : in) {
out.write(line + "\n");
}
out.close();
return true;
} catch (IOException e) {
e.printStackTrace();
return false;
}
}
}

View File

@ -152,7 +152,7 @@ public class MagiskFragment extends Fragment {
private void updateUI() {
String theme = PreferenceManager.getDefaultSharedPreferences(getActivity()).getString("theme", "");
if (theme.equals("Dark")) {
builder = new AlertDialog.Builder(getActivity(),R.style.AlertDialog_dh);
builder = new AlertDialog.Builder(getActivity(), R.style.AlertDialog_dh);
} else {
builder = new AlertDialog.Builder(getActivity());
}
@ -190,11 +190,28 @@ public class MagiskFragment extends Fragment {
"Magisk-v" + String.valueOf(remoteMagiskVersion) + ".zip"))
.setNegativeButton(R.string.no_thanks, null)
.show());
} else {
magiskCheckUpdatesContainer.setBackgroundColor(colorOK);
magiskCheckUpdatesIcon.setImageResource(R.drawable.ic_check_circle);
magiskCheckUpdatesStatus.setText(getString(R.string.up_to_date, getString(R.string.magisk)));
magiskCheckUpdatesStatus.setTextColor(colorOK);
magiskUpdateView.setOnClickListener(view -> builder
.setTitle(getString(R.string.repo_install_title, getString(R.string.magisk)))
.setMessage(getString(R.string.repo_install_msg, "Magisk-v" + String.valueOf(remoteMagiskVersion)))
.setCancelable(true)
.setPositiveButton(R.string.download_install, (dialogInterface, i) -> Utils.downloadAndReceive(
getActivity(),
new DownloadReceiver() {
@Override
public void task(Uri uri) {
new Async.FlashZIP(mContext, uri).executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
}
},
magiskLink,
"Magisk-v" + String.valueOf(remoteMagiskVersion) + ".zip"))
.setNegativeButton(R.string.no_thanks, null)
.show());
}
if (remoteAppVersionCode > BuildConfig.VERSION_CODE) {

View File

@ -35,12 +35,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
private final Handler mDrawerHandler = new Handler();
private String currentTitle;
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.drawer_layout)
DrawerLayout drawer;
@BindView(R.id.nav_view)
NavigationView navigationView;
@BindView(R.id.toolbar) Toolbar toolbar;
@BindView(R.id.drawer_layout) DrawerLayout drawer;
@BindView(R.id.nav_view) NavigationView navigationView;
@IdRes
private int mSelectedId = R.id.magisk;

View File

@ -67,7 +67,6 @@ public class ModulesAdapter extends RecyclerView.Adapter<ModulesAdapter.ViewHold
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
final Module module = mList.get(position);
Log.d("Magisk", "ModulesAdapter: Trying set up bindview from list pos " + position + " and " + module.getName());
if (module.isCache()) {
holder.title.setText("[Cache] " + module.getName());
} else {

View File

@ -61,7 +61,7 @@ public class ModulesFragment extends Fragment {
mSwipeRefreshLayout.setOnRefreshListener(() -> {
recyclerView.setVisibility(View.GONE);
prefs.edit().putBoolean("module_done", false).apply();
new Async.LoadModules(getActivity()).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
new Async.LoadModules(getActivity()).executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
});
if (prefs.getBoolean("module_done", false)) {

View File

@ -4,9 +4,12 @@ import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.AsyncTask;
import android.preference.PreferenceManager;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.RecyclerView;
import android.util.DisplayMetrics;
import android.util.Log;
@ -39,6 +42,7 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
private final List<Repo> mList;
private View mView;
private Context context;
private AlertDialog.Builder builder;
public ReposAdapter(List<Repo> list) {
mList = list;
@ -49,6 +53,14 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
mView = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_repo, parent, false);
ButterKnife.bind(this, mView);
context = parent.getContext();
String theme = PreferenceManager.getDefaultSharedPreferences(context).getString("theme", "");
if (theme.equals("Dark")) {
builder = new AlertDialog.Builder(context,R.style.AlertDialog_dh);
} else {
builder = new AlertDialog.Builder(context);
}
return new ViewHolder(mView);
}
@ -75,44 +87,51 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
View.OnClickListener listener = view -> {
if (view.getId() == holder.updateImage.getId()) {
Utils.downloadAndReceive(
context,
new DownloadReceiver(repo.getName() + "-" + repo.getVersion()) {
@Override
public void task(Uri uri) {
new Async.FlashZIP(context, uri, mName) {
String fullname = repo.getName() + "-" + repo.getVersion();
builder
.setTitle(context.getString(R.string.repo_install_title, repo.getName()))
.setMessage(context.getString(R.string.repo_install_msg, fullname))
.setCancelable(true)
.setPositiveButton(R.string.download_install, (dialogInterface, i) -> Utils.downloadAndReceive(
context,
new DownloadReceiver(fullname) {
@Override
protected void preProcessing() throws Throwable {
super.preProcessing();
new File(mUri.getPath()).delete();
Shell.su(
"cd " + mFile.getParent(),
"mkdir git",
"unzip -o install.zip -d git",
"mv git/* install",
"cd install",
"rm -rf system/placeholder",
"chmod 644 $(find . -type f)",
"chmod 755 $(find . -type d)",
"rm -rf ../install.zip ../git",
"zip -r ../install.zip *",
"rm -rf ../install"
);
public void task(Uri uri) {
new Async.FlashZIP(context, uri, mName) {
@Override
protected void preProcessing() throws Throwable {
super.preProcessing();
new File(mUri.getPath()).delete();
Shell.su(
"cd " + mFile.getParent(),
"mkdir git",
"unzip -o install.zip -d git",
"mv git/* install",
"cd install",
"rm -rf system/placeholder",
"chmod 644 $(find . -type f)",
"chmod 755 $(find . -type d)",
"rm -rf ../install.zip ../git",
"zip -r ../install.zip *",
"rm -rf ../install"
);
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
}
},
repo.getZipUrl(),
repo.getId().replace(" ", "") + ".zip");
},
repo.getZipUrl(),
repo.getId().replace(" ", "") + ".zip"))
.setNegativeButton(R.string.no_thanks, null)
.show();
}
if ((view.getId() == holder.changeLog.getId()) && (!repo.getLogUrl().equals(""))) {
new WebWindow("Changelog", repo.getLogUrl(), context);
new WebWindow(context.getString(R.string.changelog), repo.getLogUrl(), context);
}
if ((view.getId() == holder.authorLink.getId()) && (!repo.getSupportUrl().equals(""))) {
new WebWindow("Donate", repo.getDonateUrl(), context);
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(repo.getDonateUrl())));
}
if ((view.getId() == holder.supportLink.getId()) && (!repo.getSupportUrl().equals(""))) {
new WebWindow("Support", repo.getSupportUrl(), context);
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(repo.getSupportUrl())));
}
};

View File

@ -89,6 +89,8 @@ public class RootFragment extends Fragment {
ta3.recycle();
autoRootStatus = Utils.autoToggleEnabled(getActivity());
prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
if (autoRootStatus) {
if (!Utils.hasServicePermission(getActivity())) {
autoRootStatus = false;
@ -96,9 +98,18 @@ public class RootFragment extends Fragment {
}
rootToggle.setEnabled(!autoRootStatus);
autoRootToggle.setChecked(autoRootStatus);
new updateUI().executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
updateUI();
rootToggle.setOnClickListener(toggle -> Utils.toggleRoot(((CompoundButton) toggle).isChecked(), getActivity()));
rootToggle.setOnClickListener(toggle -> {
new AsyncTask<Boolean, Void, Void>() {
@Override
protected Void doInBackground(Boolean... bools) {
Utils.toggleRoot(bools[0], getActivity());
return null;
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR, ((CompoundButton) toggle).isChecked());
});
autoRootToggle.setOnClickListener(toggle -> {
if (!Utils.hasServicePermission(getActivity())) {
@ -106,7 +117,7 @@ public class RootFragment extends Fragment {
Toast.makeText(getActivity(), "Please enable accessibility access for Magisk's auto-toggle feature to work.", Toast.LENGTH_LONG).show();
startActivityForResult(intent, 100);
} else {
ToggleAutoRoot(autoRootToggle.isChecked());
toggleAutoRoot(autoRootToggle.isChecked());
}
}
@ -114,19 +125,45 @@ public class RootFragment extends Fragment {
);
selinuxToggle.setOnClickListener(toggle -> {
Shell.su(((CompoundButton) toggle).isChecked() ? "setenforce 1" : "setenforce 0");
new updateUI().executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
new AsyncTask<Boolean, Void, Void>() {
@Override
protected Void doInBackground(Boolean... bools) {
Shell.su(bools[0] ? "setenforce 1" : "setenforce 0");
return null;
}
@Override
protected void onPostExecute(Void v) {
super.onPostExecute(v);
updateUI();
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR, ((CompoundButton) toggle).isChecked());
});
return view;
}
@Override
public void onResume() {
super.onResume();
getActivity().setTitle(R.string.root);
listener = (pref, key) -> {
if ((key.contains("autoRootEnable")) || (key.equals("root"))) {
Logger.dev("RootFragmnet, keychange detected for " + key);
//new updateUI().execute();
updateUI();
}
};
prefs.registerOnSharedPreferenceChangeListener(listener);
updateUI();
}
@Override
public void onDestroy() {
super.onDestroy();
if (null != listener) {
prefs.unregisterOnSharedPreferenceChangeListener(listener);
}
prefs.unregisterOnSharedPreferenceChangeListener(listener);
}
@Override
@ -135,7 +172,7 @@ public class RootFragment extends Fragment {
Log.d("Magisk", "Got result: " + requestCode + " and " + resultCode);
if (requestCode == 100) {
if (Utils.hasServicePermission(getActivity())) {
ToggleAutoRoot(true);
toggleAutoRoot(true);
Snackbar.make(view, getActivity().getString(R.string.auto_toggle) + " has been enabled.", Snackbar.LENGTH_LONG).show();
} else {
@ -146,7 +183,7 @@ public class RootFragment extends Fragment {
}
}
private void ToggleAutoRoot(boolean toggleState) {
private void toggleAutoRoot(boolean toggleState) {
autoRootStatus = toggleState;
Utils.toggleAutoRoot(toggleState, getActivity());
if (toggleState) {
@ -166,155 +203,119 @@ public class RootFragment extends Fragment {
}
@Override
public void onResume() {
super.onResume();
getActivity().setTitle("Root");
prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
listener = (prefs1, key) -> {
private void updateUI() {
autoRootToggle.setChecked(autoRootStatus);
progressBar.setVisibility(View.GONE);
rootStatusView.setVisibility(View.VISIBLE);
safetynetStatusView.setVisibility(View.VISIBLE);
selinuxStatusView.setVisibility(View.VISIBLE);
if ((key.contains("autoRootEnable")) | (key.equals("root"))) {
Logger.dev("RootFragmnet, keychange detected for " + key);
new updateUI().execute();
}
};
prefs.registerOnSharedPreferenceChangeListener(listener);
new updateUI().execute();
}
public class updateUI extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... voids) {
// Make sure static block invoked
Shell.rootAccess();
// Set up Tile on UI Refresh
if (PreferenceManager.getDefaultSharedPreferences(getActivity()).getBoolean("enable_quicktile", false)) {
Utils.SetupQuickSettingsTile(getActivity());
}
autoRootStatus = Utils.autoToggleEnabled(getActivity());
return null;
if (Shell.rootAccess()) {
rootToggleView.setVisibility(View.VISIBLE);
autoRootToggleView.setVisibility(View.VISIBLE);
selinuxToggleView.setVisibility(View.VISIBLE);
}
@Override
protected void onPostExecute(Void v) {
super.onPostExecute(v);
autoRootToggle.setChecked(autoRootStatus);
progressBar.setVisibility(View.GONE);
rootStatusView.setVisibility(View.VISIBLE);
safetynetStatusView.setVisibility(View.VISIBLE);
selinuxStatusView.setVisibility(View.VISIBLE);
List<String> selinux = Shell.sh("getenforce");
if (Shell.rootAccess()) {
rootToggleView.setVisibility(View.VISIBLE);
autoRootToggleView.setVisibility(View.VISIBLE);
selinuxToggleView.setVisibility(View.VISIBLE);
}
if (selinux.isEmpty()) {
selinuxStatusContainer.setBackgroundColor(colorNeutral);
selinuxStatusIcon.setImageResource(statusUnknown);
List<String> selinux = Shell.sh("getenforce");
selinuxStatus.setText(R.string.selinux_error_info);
selinuxStatus.setTextColor(colorNeutral);
selinuxToggle.setChecked(false);
} else if (selinux.get(0).equals("Enforcing")) {
selinuxStatusContainer.setBackgroundColor(colorOK);
selinuxStatusIcon.setImageResource(statusOK);
if (selinux.isEmpty()) {
selinuxStatusContainer.setBackgroundColor(colorNeutral);
selinuxStatusIcon.setImageResource(statusUnknown);
selinuxStatus.setText(R.string.selinux_enforcing_info);
selinuxStatus.setTextColor(colorOK);
selinuxToggle.setChecked(true);
} else {
selinuxStatusContainer.setBackgroundColor(colorFail);
selinuxStatusIcon.setImageResource(statusError);
selinuxStatus.setText(R.string.selinux_error_info);
selinuxStatus.setTextColor(colorNeutral);
selinuxToggle.setChecked(false);
} else if (selinux.get(0).equals("Enforcing")) {
selinuxStatusContainer.setBackgroundColor(colorOK);
selinuxStatusIcon.setImageResource(statusOK);
selinuxStatus.setText(R.string.selinux_permissive_info);
selinuxStatus.setTextColor(colorFail);
selinuxToggle.setChecked(false);
}
selinuxStatus.setText(R.string.selinux_enforcing_info);
selinuxStatus.setTextColor(colorOK);
selinuxToggle.setChecked(true);
} else {
selinuxStatusContainer.setBackgroundColor(colorFail);
selinuxStatusIcon.setImageResource(statusError);
if (new File("/system/framework/twframework.jar").exists()) {
selinuxStatus.append("\n" + getString(R.string.selinux_samsung_info));
}
selinuxStatus.setText(R.string.selinux_permissive_info);
selinuxStatus.setTextColor(colorFail);
selinuxToggle.setChecked(false);
}
if (new File("/system/framework/twframework.jar").exists()) {
selinuxStatus.append("\n" + getString(R.string.selinux_samsung_info));
}
switch (Shell.rootStatus) {
case -1:
// Root Error
rootStatusContainer.setBackgroundColor(colorFail);
rootStatusIcon.setImageResource(statusUnknown);
rootStatus.setTextColor(colorNeutral);
rootStatus.setText(R.string.root_error);
rootToggle.setChecked(false);
safetyNetStatusIcon.setImageResource(statusUnknown);
safetyNetStatus.setText(R.string.root_error_info);
break;
case 0:
// Not rooted
switch (Shell.rootStatus) {
case -1:
// Root Error
rootStatusContainer.setBackgroundColor(colorFail);
rootStatusIcon.setImageResource(statusUnknown);
rootStatus.setTextColor(colorNeutral);
rootStatus.setText(R.string.root_error);
rootToggle.setChecked(false);
safetyNetStatusIcon.setImageResource(statusUnknown);
safetyNetStatus.setText(R.string.root_error_info);
break;
case 0:
// Not rooted
rootStatusContainer.setBackgroundColor(colorOK);
rootStatusIcon.setImageResource(statusOK);
rootStatus.setTextColor(colorOK);
rootStatus.setText(R.string.root_none);
rootToggle.setChecked(false);
safetyNetStatusIcon.setImageResource(statusOK);
safetyNetStatus.setText(R.string.root_none_info);
break;
case 1:
// Proper root
if (autoRootStatus) {
rootStatusContainer.setBackgroundColor(colorOK);
rootStatusIcon.setImageResource(statusOK);
rootStatusIcon.setImageResource(statusAuto);
rootStatusIcon.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP);
rootStatus.setTextColor(colorOK);
rootStatus.setText(R.string.root_none);
rootToggle.setChecked(false);
rootStatus.setText(R.string.root_auto_unmounted);
rootToggle.setEnabled(false);
autoRootToggle.setChecked(true);
safetyNetStatusIcon.setImageResource(statusOK);
safetyNetStatus.setText(R.string.root_none_info);
safetyNetStatus.setText(R.string.root_auto_unmounted_info);
break;
case 1:
// Proper root
if (autoRootStatus) {
rootStatusContainer.setBackgroundColor(colorOK);
rootStatusIcon.setImageResource(statusAuto);
rootStatusIcon.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP);
rootStatus.setTextColor(colorOK);
rootStatus.setText(R.string.root_auto_unmounted);
rootToggle.setEnabled(false);
autoRootToggle.setChecked(true);
safetyNetStatusIcon.setImageResource(statusOK);
safetyNetStatus.setText(R.string.root_auto_unmounted_info);
} else {
rootToggle.setEnabled(true);
if (Utils.rootEnabled()) {
// Mounted
rootStatusContainer.setBackgroundColor(colorWarn);
rootStatusIcon.setImageResource(statusError);
rootStatus.setTextColor(colorWarn);
rootStatus.setText(R.string.root_enabled);
rootToggle.setChecked(true);
safetyNetStatusIcon.setImageResource(statusError);
safetyNetStatus.setText(R.string.root_enabled_info);
break;
} else {
rootToggle.setEnabled(true);
if (Utils.rootEnabled()) {
// Mounted
rootStatusContainer.setBackgroundColor(colorWarn);
rootStatusIcon.setImageResource(statusError);
rootStatus.setTextColor(colorWarn);
rootStatus.setText(R.string.root_enabled);
rootToggle.setChecked(true);
safetyNetStatusIcon.setImageResource(statusError);
safetyNetStatus.setText(R.string.root_enabled_info);
break;
} else {
// Disabled
rootStatusContainer.setBackgroundColor(colorOK);
rootStatusIcon.setImageResource(statusOK);
rootStatus.setTextColor(colorOK);
rootStatus.setText(R.string.root_disabled);
rootToggle.setChecked(false);
safetyNetStatusIcon.setImageResource(statusOK);
safetyNetStatus.setText(R.string.root_disabled_info);
break;
}
// Disabled
rootStatusContainer.setBackgroundColor(colorOK);
rootStatusIcon.setImageResource(statusOK);
rootStatus.setTextColor(colorOK);
rootStatus.setText(R.string.root_disabled);
rootToggle.setChecked(false);
safetyNetStatusIcon.setImageResource(statusOK);
safetyNetStatus.setText(R.string.root_disabled_info);
break;
}
case 2:
// Improper root
rootStatusContainer.setBackgroundColor(colorFail);
rootStatusIcon.setImageResource(statusError);
rootStatus.setTextColor(colorFail);
rootStatus.setText(R.string.root_system);
rootToggle.setChecked(true);
safetyNetStatusIcon.setImageResource(statusError);
safetyNetStatus.setText(R.string.root_system_info);
autoRootToggleView.setVisibility(View.GONE);
rootToggleView.setVisibility(View.GONE);
selinuxToggleView.setVisibility(View.GONE);
break;
}
}
case 2:
// Improper root
rootStatusContainer.setBackgroundColor(colorFail);
rootStatusIcon.setImageResource(statusError);
rootStatus.setTextColor(colorFail);
rootStatus.setText(R.string.root_system);
rootToggle.setChecked(true);
safetyNetStatusIcon.setImageResource(statusError);
safetyNetStatus.setText(R.string.root_system_info);
autoRootToggleView.setVisibility(View.GONE);
rootToggleView.setVisibility(View.GONE);
selinuxToggleView.setVisibility(View.GONE);
break;
}
}

View File

@ -2,6 +2,7 @@ package com.topjohnwu.magisk;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
@ -12,19 +13,18 @@ import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import com.topjohnwu.magisk.utils.Async;
import com.topjohnwu.magisk.utils.Logger;
import com.topjohnwu.magisk.utils.Utils;
import butterknife.ButterKnife;
public class SettingsFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
private CheckBoxPreference quickTilePreference;
private CheckBoxPreference quickTilePreference, busyboxPreference;
private ListPreference themePreference;
public SettingsFragment() {
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -50,9 +50,10 @@ public class SettingsFragment extends PreferenceFragment implements SharedPrefer
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState);
ButterKnife.bind(this, view);
quickTilePreference = (CheckBoxPreference) findPreference("enable_quicktile");
themePreference = (ListPreference) findPreference("theme");
busyboxPreference = (CheckBoxPreference) findPreference("busybox");
quickTilePreference = (CheckBoxPreference) findPreference("enable_quicktile") ;
busyboxPreference.setChecked(Utils.commandExists("unzip"));
PreferenceManager.getDefaultSharedPreferences(getActivity()).registerOnSharedPreferenceChangeListener(this);
CheckBoxPreference keepRootOffPreference = (CheckBoxPreference) findPreference("keep_root_off");
CheckBoxPreference hideRootNotificationPreference = (CheckBoxPreference) findPreference("hide_root_notification");
@ -67,21 +68,6 @@ public class SettingsFragment extends PreferenceFragment implements SharedPrefer
hideRootNotificationPreference.setEnabled(true);
}
Preference.OnPreferenceClickListener preferenceClickListener = preference -> {
if (preference == quickTilePreference) {
boolean isChecked = quickTilePreference.isChecked();
if (isChecked) {
Utils.installTile(getActivity());
} else {
Utils.uninstallTile(getActivity());
}
}
return false;
};
quickTilePreference.setOnPreferenceClickListener(preferenceClickListener);
// calculate margins
int horizontalMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, getResources().getDisplayMetrics());
int verticalMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, getResources().getDisplayMetrics());
@ -118,6 +104,44 @@ public class SettingsFragment extends PreferenceFragment implements SharedPrefer
Logger.dev("SettingsFragment: theme is " + pref);
} else if (key.equals("enable_quicktile")) {
boolean checked = sharedPreferences.getBoolean("enable_quicktile", false);
if (checked) {
new AsyncTask<Void, Void, Boolean> () {
@Override
protected Boolean doInBackground(Void... voids) {
return Utils.installTile(getActivity());
}
@Override
protected void onPostExecute(Boolean result) {
super.onPostExecute(result);
if (result) {
Toast.makeText(getActivity(), "Tile installed", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getActivity(), "Tile installation error", Toast.LENGTH_SHORT).show();
}
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
} else {
new AsyncTask<Void, Void, Boolean> () {
@Override
protected Boolean doInBackground(Void... voids) {
return Utils.uninstallTile(getActivity());
}
@Override
protected void onPostExecute(Boolean result) {
super.onPostExecute(result);
if (result) {
Toast.makeText(getActivity(), "Tile uninstalled", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getActivity(), "Tile uninstallation error", Toast.LENGTH_SHORT).show();
}
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
}
} else if (key.equals("busybox")) {
boolean checked = sharedPreferences.getBoolean("busybox", false);
new Async.LinkBusyBox(checked).executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
}
}

View File

@ -19,7 +19,6 @@ public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SharedPreferences defaultPrefs = PreferenceManager.getDefaultSharedPreferences(getApplication());
if (defaultPrefs.getString("theme","").equals("Dark")) {
@ -35,8 +34,8 @@ public class SplashActivity extends AppCompatActivity {
set.add("com.google.android.gms");
set.add("com.google.commerce.tapandpay");
editor.putStringSet("auto_blacklist", set);
editor.putBoolean("autoRootEnable",false);
editor.putBoolean("root",Utils.rootEnabled());
editor.putBoolean("autoRootEnable", false);
editor.putBoolean("root", Utils.rootEnabled());
editor.apply();
}
@ -56,7 +55,7 @@ public class SplashActivity extends AppCompatActivity {
}
// Set up quick settings tile
Utils.SetupQuickSettingsTile(getApplicationContext());
Utils.setupQuickSettingsTile(getApplicationContext());
// Initialize
Utils.init(this);

View File

@ -1,5 +1,7 @@
package com.topjohnwu.magisk.module;
import android.os.AsyncTask;
import com.topjohnwu.magisk.utils.Logger;
import com.topjohnwu.magisk.utils.ModuleHelper;
import com.topjohnwu.magisk.utils.Utils;
@ -34,11 +36,23 @@ public class Module extends BaseModule {
}
public void createDisableFile() {
mEnable = !Utils.createFile(mDisableFile);
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... voids) {
mEnable = !Utils.createFile(mDisableFile);
return null;
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
}
public void removeDisableFile() {
mEnable = Utils.removeFile(mDisableFile);
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... voids) {
mEnable = Utils.removeFile(mDisableFile);
return null;
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
}
public boolean isEnabled() {
@ -46,11 +60,23 @@ public class Module extends BaseModule {
}
public void createRemoveFile() {
mRemove = Utils.createFile(mRemoveFile);
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... voids) {
mRemove = Utils.createFile(mRemoveFile);
return null;
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
}
public void deleteRemoveFile() {
mRemove = !Utils.removeFile(mRemoveFile);
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... voids) {
mRemove = !Utils.removeFile(mRemoveFile);
return null;
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
}
public boolean willBeRemoved() {

View File

@ -19,7 +19,7 @@ public class AutoStartReceiver extends BroadcastReceiver {
Utils.toggleRoot(false, context);
}
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("enable_quicktile", false)) {
Utils.SetupQuickSettingsTile(context);
Utils.setupQuickSettingsTile(context);
}

View File

@ -32,6 +32,6 @@ public final class PrivateBroadcastReceiver extends BroadcastReceiver {
Utils.toggleRoot(false, context);
}
Utils.SetupQuickSettingsTile(context);
Utils.setupQuickSettingsTile(context);
}
}

View File

@ -46,16 +46,18 @@ public class Async {
String busybox = mContext.getApplicationInfo().dataDir + "/lib/libbusybox.so";
String zip = mContext.getApplicationInfo().dataDir + "/lib/libzip.so";
if (Shell.rootAccess()) {
if (!Utils.commandExists("unzip") || !Utils.commandExists("zip") || !Utils.itemExist(toolPath)) {
if (!Utils.itemExist(toolPath)) {
Shell.sh(
"rm -rf " + toolPath,
"mkdir " + toolPath,
"chmod 755 " + toolPath,
"ln -s " + busybox + " " + toolPath + "/busybox",
"for tool in $(" + toolPath + "/busybox --list); do",
"ln -s " + busybox + " " + toolPath + "/$tool",
"cd " + toolPath,
"ln -s " + busybox + " busybox",
"for tool in $(./busybox --list); do",
"ln -s " + busybox + " $tool",
"done",
"ln -s " + zip + " " + toolPath + "/zip"
"rm -f su sh",
"ln -s " + zip + " zip"
);
}
}
@ -165,15 +167,18 @@ public class Async {
mContext = context;
mUri = uri;
Cursor c = mContext.getContentResolver().query(uri, null, null, null, null);
int nameIndex = c.getColumnIndex(OpenableColumns.DISPLAY_NAME);
c.moveToFirst();
if (nameIndex != -1) {
mName = c.getString(nameIndex);
} else {
if (c != null) {
int nameIndex = c.getColumnIndex(OpenableColumns.DISPLAY_NAME);
c.moveToFirst();
if (nameIndex != -1) {
mName = c.getString(nameIndex);
}
c.close();
}
if (mName == null) {
int idx = uri.getPath().lastIndexOf('/');
mName = uri.getPath().substring(idx + 1);
}
c.close();
copyToSD = false;
}
@ -296,6 +301,10 @@ public class Async {
}
protected void done() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext);
prefs.edit().putBoolean("module_done", false).apply();
new LoadModules(mContext).executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
AlertDialog.Builder builder;
String theme = PreferenceManager.getDefaultSharedPreferences(mContext).getString("theme", "");
if (theme.equals("Dark")) {
@ -306,9 +315,31 @@ public class Async {
builder
.setTitle(R.string.reboot_title)
.setMessage(R.string.reboot_msg)
.setPositiveButton(R.string.reboot, (dialogInterface1, i) -> Shell.su("sh -c reboot"))
.setPositiveButton(R.string.reboot, (dialogInterface1, i) -> Shell.sh("su -c reboot"))
.setNegativeButton(R.string.no_thanks, null)
.show();
}
}
public static class LinkBusyBox extends AsyncTask<Void, Void, Void> {
private boolean link;
public LinkBusyBox(boolean b) {
link = b;
}
@Override
protected Void doInBackground(Void... voids) {
if (link) {
Shell.su(
"rm -rf /magisk/.core/busybox",
"ln -s /data/busybox /magisk/.core/busybox"
);
} else {
Shell.su("rm -rf /magisk/.core/busybox");
}
return null;
}
}
}

View File

@ -23,7 +23,6 @@ import android.widget.Toast;
import com.kcoppock.broadcasttilesupport.BroadcastTileIntentBuilder;
import com.topjohnwu.magisk.MagiskFragment;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.module.BaseModule;
import com.topjohnwu.magisk.receivers.DownloadReceiver;
import com.topjohnwu.magisk.receivers.PrivateBroadcastReceiver;
import com.topjohnwu.magisk.services.MonitorService;
@ -36,7 +35,6 @@ import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
import java.util.Arrays;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
@ -63,7 +61,7 @@ public class Utils {
MagiskFragment.magiskVersion = Integer.parseInt(ret.get(0));
}
String toolPath = context.getApplicationInfo().dataDir + "/tools";
Shell.su("PATH=$PATH:" + toolPath);
Shell.su("PATH=" + toolPath + ":$PATH");
}
public static boolean itemExist(String path) {
@ -113,7 +111,7 @@ public class Utils {
Shell.su("rm -rf /magisk/.core/bin", "setprop magisk.root 0");
}
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("enable_quicktile", false)) {
SetupQuickSettingsTile(context);
setupQuickSettingsTile(context);
}
PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean("root", b).apply();
}
@ -140,7 +138,7 @@ public class Utils {
}
}
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("enable_quicktile", false)) {
SetupQuickSettingsTile(context);
setupQuickSettingsTile(context);
}
}
@ -174,7 +172,7 @@ public class Utils {
}
if ((!file.getParentFile().exists() && !file.getParentFile().mkdirs()) || (file.exists() && !file.delete())) {
Toast.makeText(context, R.string.toast_error_makedir, Toast.LENGTH_LONG).show();
Toast.makeText(context, R.string.permissionNotGranted, Toast.LENGTH_LONG).show();
}
DownloadManager downloadManager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
@ -208,7 +206,7 @@ public class Utils {
return secret;
}
public static void SetupQuickSettingsTile(Context mContext) {
public static void setupQuickSettingsTile(Context mContext) {
Logger.dev("Utils: SetupQuickSettings called");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Logger.dev("Utils: Starting N quick settings service");
@ -266,7 +264,7 @@ public class Utils {
}
}
public static void installTile(Context context) {
public static boolean installTile(Context context) {
String qsTileId;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
qsTileId = "custom(com.topjohnwu.magisk/.services.TileServiceNewApi)";
@ -281,8 +279,7 @@ public class Utils {
if (tiles.size() > 1) {
for (String tile : tiles) {
if (tile.equals(qsTileId)) {
Toast.makeText(context, "Tile already installed", Toast.LENGTH_SHORT).show();
return;
return true;
}
}
@ -290,17 +287,16 @@ public class Utils {
String newTiles = TextUtils.join(",", tiles);
Logger.dev("Utils: NewtilesString is " + newTiles);
Shell.su("settings put secure sysui_qs_tiles \"" + newTiles + "\"");
Toast.makeText(context, "Tile installed", Toast.LENGTH_SHORT).show();
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.M) {
Utils.refreshService(context);
}
return;
return true;
}
}
Toast.makeText(context, "Tile installation error", Toast.LENGTH_SHORT).show();
return false;
}
public static void uninstallTile(Context context) {
public static boolean uninstallTile(Context context) {
String qsTileId;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
@ -323,17 +319,15 @@ public class Utils {
if (isPresent) {
String newTiles = TextUtils.join(",", tiles);
Shell.su("settings put secure sysui_qs_tiles \"" + newTiles + "\"");
Toast.makeText(context, "Tile uninstalled", Toast.LENGTH_SHORT).show();
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.M) {
Utils.refreshService(context);
}
return;
}
Toast.makeText(context, "Tile already uninstalled", Toast.LENGTH_SHORT).show();
return true;
}
}
Toast.makeText(context, "Tile uninstallation error", Toast.LENGTH_SHORT).show();
return false;
}
private static void refreshService(Context context) {

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator">
<alpha
android:duration="250"
android:fromAlpha="0.1"
android:toAlpha="1.0"/>
</set>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator">
<alpha
android:duration="250"
android:fromAlpha="1.0"
android:toAlpha="0.1"/>
</set>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#757575"
android:pathData="M11.8,10.9c-2.27,-0.59 -3,-1.2 -3,-2.15 0,-1.09 1.01,-1.85 2.7,-1.85 1.78,0 2.44,0.85 2.5,2.1h2.21c-0.07,-1.72 -1.12,-3.3 -3.21,-3.81V3h-3v2.16c-1.94,0.42 -3.5,1.68 -3.5,3.61 0,2.31 1.91,3.46 4.7,4.13 2.5,0.6 3,1.48 3,2.41 0,0.69 -0.49,1.79 -2.7,1.79 -2.06,0 -2.87,-0.92 -2.98,-2.1h-2.2c0.12,2.19 1.76,3.42 3.68,3.83V21h3v-2.15c1.95,-0.37 3.5,-1.5 3.5,-3.55 0,-2.84 -2.43,-3.81 -4.7,-4.4z"/>
</vector>

View File

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M9,16.2L4.8,12l-1.4,1.4L9,19 21,7l-1.4,-1.4L9,16.2z"/>
</vector>

View File

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#757575"
android:pathData="M12,16.5l4,-4h-3v-9h-2v9L8,12.5l4,4zM21,3.5h-6v1.99h6v14.03L3,19.52L3,5.49h6L9,3.5L3,3.5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h18c1.1,0 2,-0.9 2,-2v-14c0,-1.1 -0.9,-2 -2,-2z"/>
</vector>

View File

@ -104,12 +104,27 @@
style="?attr/cardStyle"
app:cardUseCompatPadding="true">
<com.topjohnwu.magisk.RowItem
android:id="@+id/support_thread"
android:layout_width="match_parent"
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
app:icon="@drawable/ic_xda"
app:text="@string/support_thread"/>
android:layout_marginBottom="8dp"
android:orientation="vertical">
<com.topjohnwu.magisk.RowItem
android:id="@+id/support_thread"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:icon="@drawable/ic_xda"
app:text="@string/support_thread"/>
<com.topjohnwu.magisk.RowItem
android:id="@+id/donation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:icon="@drawable/ic_attach_money"
app:text="@string/donation"/>
</LinearLayout>
</android.support.v7.widget.CardView>

View File

@ -1,19 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="@dimen/card_vertical_margin"
android:layout_marginEnd="@dimen/card_horizontal_margin"
android:layout_marginStart="@dimen/card_horizontal_margin"
android:layout_marginTop="@dimen/card_vertical_margin"
style="?attr/cardStyle"
android:minHeight="?android:attr/listPreferredItemHeight"
card_view:cardCornerRadius="@dimen/card_corner_radius"
card_view:cardElevation="@dimen/card_elevation">
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="@dimen/card_vertical_margin"
android:layout_marginEnd="@dimen/card_horizontal_margin"
android:layout_marginStart="@dimen/card_horizontal_margin"
android:layout_marginTop="@dimen/card_vertical_margin"
style="?attr/cardStyle"
android:minHeight="?android:attr/listPreferredItemHeight"
card_view:cardCornerRadius="@dimen/card_corner_radius"
card_view:cardElevation="@dimen/card_elevation">
<RelativeLayout
android:layout_width="match_parent"
@ -21,13 +21,13 @@
android:layout_gravity="center_vertical"
android:padding="@dimen/card_layout_padding">
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/app_icon"
android:layout_width="@dimen/card_appicon_size"
android:layout_height="@dimen/card_appicon_size"
android:layout_centerVertical="true"
android:scaleType="centerCrop"/>
<ImageView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/app_icon"
android:layout_width="@dimen/card_appicon_size"
android:layout_height="@dimen/card_appicon_size"
android:layout_centerVertical="true"
android:scaleType="centerCrop"/>
<LinearLayout
android:id="@+id/textLayout"
@ -77,8 +77,8 @@
android:clickable="false"
android:focusable="false"
android:gravity="center"
android:src="@drawable/ic_menu_overflow_material"
/>
android:src="@drawable/ic_menu_overflow_material"/>
</LinearLayout>
</RelativeLayout>

View File

@ -10,15 +10,7 @@
android:icon="@drawable/magisk"
android:title="@string/magisk"/>
<item
android:id="@+id/root"
android:icon="@drawable/root"
android:title="@string/root"/>
<item
android:id="@+id/autoroot"
android:icon="@drawable/ic_autoroot"
android:title="@string/auto_toggle"/>
<item
android:id="@+id/modules"
@ -30,6 +22,27 @@
android:icon="@drawable/ic_cloud_download"
android:title="@string/downloads"/>
</group>
<group
android:checkableBehavior="single">
<item
android:id="@+id/root"
android:icon="@drawable/root"
android:title="@string/root"/>
<item
android:id="@+id/autoroot"
android:icon="@drawable/ic_autoroot"
android:title="@string/auto_toggle"/>
</group>
<group
android:id="@+id/option_items"
android:checkableBehavior="single">
<item
android:id="@+id/log"
android:icon="@drawable/ic_bug_report"
@ -42,15 +55,9 @@
</group>
<group
android:id="@+id/option_items"
android:checkableBehavior="none">
<item
android:id="@+id/app_about"
android:icon="@drawable/ic_info_outline"
android:title="@string/about"/>
</group>
<item
android:id="@+id/app_about"
android:icon="@drawable/ic_info_outline"
android:title="@string/about"/>
</menu>

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/force_reload"
android:icon="@drawable/ic_refresh"
android:title="@string/menuReload"
app:showAsAction="always"/>
</menu>

View File

@ -4,27 +4,21 @@
<color name="primary">#009688</color>
<color name="primary_dark">#00796B</color>
<color name="accent">#FFC107</color>
<color name="primary_text">#212121</color>
<color name="icons">#FFFFFF</color>
<color name="icon_grey">#757575</color>
<color name="red500">#F44336</color>
<color name="green500">#4CAF50</color>
<color name="blue500">#2196F3</color>
<color name="grey500">#9E9E9E</color>
<color name="yellow500">#FFC107</color>
<color name="dh_primary">#3F51B5</color>
<color name="dh_primary_dark">#303F9F</color>
<color name="dh_primary_light">#C5CAE9</color>
<color name="dh_accent">#448AFF</color>
<color name="dh_primary_text">#dedede</color>
<color name="dh_secondary_text">#8A8A8A</color>
<color name="dh_icons">#dedede</color>
<color name="dh_divider">#313131</color>
<color name="dh_alertWarn">#FF9800</color>
<color name="dh_alertOk">@color/dh_accent</color>
<color name="dh_alertNeutral">@color/dh_primary_light</color>
<color name="dh_alertFail">@color/red500</color>

View File

@ -2,7 +2,6 @@
<resources>
<dimen name="floating_height">650dp</dimen>
<dimen name="floating_width">500dp</dimen>
<dimen name="min_rowheight">100dp</dimen>
<dimen name="card_divider_space">5sp</dimen>
<dimen name="card_horizontal_margin">8dip</dimen>
<dimen name="card_vertical_margin">3dip</dimen>

View File

@ -24,7 +24,6 @@
<!--Root Fragment-->
<string name="root_toggle">Root Toggle</string>
<string name="auto_root">Auto Root</string>
<string name="selinux_toggle">SELinux Toggle</string>
<string name="root_error">Root Error</string>
@ -48,7 +47,6 @@
<!--Module Fragment-->
<string name="no_info_provided">(No info provided)</string>
<string name="no_modules_found">No modules found</string>
<string name="module_not_installed">Module is not installed</string>
<string name="update_file_created">Module will be updated at next reboot</string>
<string name="remove_file_created">Module will be removed at next reboot</string>
<string name="remove_file_deleted">Module will not be removed at next reboot</string>
@ -60,6 +58,7 @@
<string name="update_available">Update Available</string>
<string name="installed">Installed</string>
<string name="not_installed">Not Installed</string>
<string name="changelog">Changelog</string>
<!--Log Fragment-->
<string name="menuSaveToSd">Save to SD</string>
@ -80,6 +79,7 @@
<string name="translators"/>
<string name="app_version">App\'s version</string>
<string name="app_source_code">Source code</string>
<string name="donation">Donation</string>
<string name="app_translators">App\'s translators</string>
<string name="support_thread">Support thread</string>
@ -90,6 +90,8 @@
<string name="accessibility_service_description">Accessibility service required for Magisk auto-unroot feature</string>
<string name="update_title">%1$s Update!</string>
<string name="update_msg">New version v%2$s of %1$s is available!\nChangelog:\n%3$s</string>
<string name="repo_install_title">Install %1$s</string>
<string name="repo_install_msg">Do you want to install %1$s ?</string>
<string name="download_install">Download and install</string>
<string name="download_file_error">Error downloading file</string>
<string name="install_error">Installation error!</string>
@ -102,10 +104,6 @@
<string name="zip_install_progress_msg">"Installing %1$s …"</string>
<string name="no_magisk_title">No Magisk Installed!</string>
<string name="no_magisk_msg">Do you want to download and install Magisk?</string>
<string name="root_method_title">Choose a root method</string>
<string name="phh">phh\'s superuser</string>
<string name="supersu">SuperSU</string>
<string name="root_system_msg">It seems that you have incompatible root installed\nDo you want to install Magisk compatible root now?</string>
<!--URL Templates-->
<string name="url_main">https://api.github.com/orgs/Magisk-Modules-Repo/repos?access_token=</string>
@ -113,20 +111,24 @@
<string name="zip_url">https://github.com/Magisk-Modules-Repo/%1$s/archive/master.zip</string>
<!--Settings Fragment -->
<string name="settings_general_category">General</string>
<string name="settings_theme_title">Theme</string>
<string name="settings_theme_summary">Select a theme</string>
<string name="settings_busybox_title">Enable BusyBox</string>
<string name="settings_busybox_summary">Make Magisk\'s built-in BusyBox be visible in PATH</string>
<string name="settings_quicksettings_category">Quick Settings</string>
<string name="settings_enable_quicktile_title">Enable Quicksettings Tile</string>
<string name="settings_enable_quicktile_summary">Click here to enable or disable the quick settings tile.</string>
<string name="settings_root_category">Root</string>
<string name="settings_keep_root_off_summary">Disable root unless otherwise enabled by auto-toggle or toggle.</string>
<string name="settings_keep_root_off_title">Keep root turned off</string>
<string name="settings_developer_logging_title">Enable advanced debug logging</string>
<string name="settings_developer_logging_summary">Check this to enable more verbose logging.</string>
<string name="settings_root_category">Root</string>
<string name="settings_development_category">Development</string>
<string name="settings_hide_root_notification_summary">When checked, auto-toggle notifications will not be displayed.</string>
<string name="settings_hide_root_notification_title">Hide auto-toggle notifications</string>
<!--General Use -->
<string name="toast_error_makedir">Error creating directory, could not download file.</string>
<string name="toast_error_removing_files">Error removing old files, cancelled.</string>
<string name="settings_general_title">General</string>
<string name="settings_development_category">Development</string>
<string name="settings_developer_logging_title">Enable advanced debug logging</string>
<string name="settings_developer_logging_summary">Check this to enable more verbose logging.</string>
</resources>

View File

@ -17,14 +17,6 @@
<item name="ColorNeutral">@color/grey500</item>
</style>
<style name="AppTheme.Toolbar" parent="ThemeOverlay.AppCompat.Light">
<item name="colorPrimary">@color/primary</item>
<item name="android:elevation">4dp</item>
<item name="android:textColorPrimary">@color/primary_text</item>
<item name="android:textColorSecondary">@color/primary_text</item> <!-- force -->
<item name="actionMenuTextColor">@color/icons</item>
</style>
<style name="AppTheme.dh" parent="ThemeOverlay.AppCompat.Dark">
<item name="colorPrimary">@color/dh_primary</item>
<item name="colorPrimaryDark">@color/dh_primary_dark</item>

View File

@ -2,16 +2,24 @@
android:layout_marginTop="?attr/actionBarSize"
xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:title="@string/settings_general_title">
android:title="@string/settings_general_category">
<ListPreference
android:key="theme"
android:title="Theme"
android:summary="Select a theme"
android:title="@string/settings_theme_title"
android:summary="@string/settings_theme_summary"
android:defaultValue="Default"
android:entries="@array/themes"
android:entryValues="@array/themes"/>
<CheckBoxPreference
android:key="busybox"
android:defaultValue="false"
android:title="@string/settings_busybox_title"
android:summary="@string/settings_busybox_summary" />
</PreferenceCategory>
<PreferenceCategory
android:title="@string/settings_quicksettings_category">
@ -22,8 +30,10 @@
android:summary="@string/settings_enable_quicktile_summary" />
</PreferenceCategory>
<PreferenceCategory
android:title="@string/settings_root_category">
<CheckBoxPreference
android:key="keep_root_off"
android:defaultValue="false"
@ -37,6 +47,7 @@
android:summary="@string/settings_hide_root_notification_summary" />
</PreferenceCategory>
<PreferenceCategory
android:title="@string/settings_development_category">