Refactor, cleanup, backstack works

This commit is contained in:
d8ahazard 2016-09-23 16:22:11 -05:00
parent 3706b53e65
commit 3de13a4d9e
25 changed files with 242 additions and 138 deletions

View File

@ -32,9 +32,9 @@ repositories {
dependencies { dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs') compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:recyclerview-v7:24.2.0' compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:cardview-v7:24.2.0' compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.android.support:design:24.2.0' compile 'com.android.support:design:24.2.1'
compile 'com.github.d8ahazard:BroadcastTileSupportUpdate:master' compile 'com.github.d8ahazard:BroadcastTileSupportUpdate:master'
compile 'com.jakewharton:butterknife:8.4.0' compile 'com.jakewharton:butterknife:8.4.0'
compile 'com.github.michalis-vitos:aFileChooser:master' compile 'com.github.michalis-vitos:aFileChooser:master'

View File

@ -119,6 +119,8 @@ public class AboutActivity extends AppCompatActivity {
setFloating(); setFloating();
} }
public void setFloating() { public void setFloating() {
boolean isTablet = getResources().getBoolean(R.bool.isTablet); boolean isTablet = getResources().getBoolean(R.bool.isTablet);
if (isTablet) { if (isTablet) {
@ -137,6 +139,9 @@ public class AboutActivity extends AppCompatActivity {
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
setTitle("About");
getWindow().setStatusBarColor(getResources().getColor(R.color.primary_dark)); getWindow().setStatusBarColor(getResources().getColor(R.color.primary_dark));
} }
} }

View File

@ -10,7 +10,6 @@ import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.util.Log;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -47,12 +46,28 @@ public class AutoRootFragment extends ListFragment {
} }
view.setPadding(horizontalMargin, actionBarHeight, horizontalMargin, verticalMargin); view.setPadding(horizontalMargin, actionBarHeight, horizontalMargin, verticalMargin);
return view; return view;
} }
@Override @Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) { public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
}
@Override
public void onResume() {
super.onResume();
initializeElements();
super.onResume();
getActivity().setTitle("Auto-toggle");
}
private void initializeElements() {
listView = getListView(); listView = getListView();
packageManager = getActivity().getPackageManager(); packageManager = getActivity().getPackageManager();
prefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
@ -68,13 +83,6 @@ public class AutoRootFragment extends ListFragment {
new LoadApplications().execute(); new LoadApplications().execute();
} }
@Override
public void onResume() {
super.onResume();
new LoadApplications().execute();
}
@Override @Override
public void onListItemClick(ListView l, View v, int position, long id) { public void onListItemClick(ListView l, View v, int position, long id) {
Logger.dh("Click"); Logger.dh("Click");
@ -128,7 +136,6 @@ public class AutoRootFragment extends ListFragment {
public class CustomComparator implements Comparator<ApplicationInfo> { public class CustomComparator implements Comparator<ApplicationInfo> {
@Override @Override
public int compare(ApplicationInfo o1, ApplicationInfo o2) { public int compare(ApplicationInfo o1, ApplicationInfo o2) {
packageManager = getActivity().getPackageManager();
return o1.loadLabel(packageManager).toString().compareToIgnoreCase(o2.loadLabel(packageManager).toString()); return o1.loadLabel(packageManager).toString().compareToIgnoreCase(o2.loadLabel(packageManager).toString());
} }
} }
@ -140,7 +147,7 @@ public class AutoRootFragment extends ListFragment {
protected Void doInBackground(Void... params) { protected Void doInBackground(Void... params) {
applist = checkForLaunchIntent(packageManager.getInstalledApplications(PackageManager.GET_META_DATA)); applist = checkForLaunchIntent(packageManager.getInstalledApplications(PackageManager.GET_META_DATA));
listadaptor = new ApplicationAdapter(getActivity(), listadaptor = new ApplicationAdapter(getActivity(),
R.layout.app_list_row, applist); R.layout.list_item_app, applist);
return null; return null;
} }

View File

@ -56,6 +56,12 @@ public class LogFragment extends Fragment {
setHasOptionsMenu(true); setHasOptionsMenu(true);
} }
@Override
public void onResume() {
super.onResume();
getActivity().setTitle("Log");
}
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.log_fragment, container, false); View view = inflater.inflate(R.layout.log_fragment, container, false);

View File

@ -64,6 +64,12 @@ public class MagiskFragment extends Fragment {
return v; return v;
} }
@Override
public void onResume() {
super.onResume();
getActivity().setTitle("Magisk");
}
private class updateUI extends AsyncTask<Void, Void, Void> { private class updateUI extends AsyncTask<Void, Void, Void> {
@Override @Override

View File

@ -1,11 +1,13 @@
package com.topjohnwu.magisk; package com.topjohnwu.magisk;
import android.app.Fragment; import android.app.Fragment;
import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar; import android.support.design.widget.Snackbar;
import android.support.v4.widget.SwipeRefreshLayout; import android.support.v4.widget.SwipeRefreshLayout;
@ -16,6 +18,7 @@ import android.view.ViewGroup;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.TextView; import android.widget.TextView;
import com.ipaulpro.afilechooser.utils.FileUtils;
import com.topjohnwu.magisk.module.Module; import com.topjohnwu.magisk.module.Module;
import com.topjohnwu.magisk.utils.Async; import com.topjohnwu.magisk.utils.Async;
@ -29,9 +32,11 @@ public class ModulesFragment extends Fragment {
@BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout; @BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout;
@BindView(R.id.recyclerView) RecyclerView recyclerView; @BindView(R.id.recyclerView) RecyclerView recyclerView;
@BindView(R.id.empty_rv) TextView emptyTv; @BindView(R.id.empty_rv) TextView emptyTv;
private static final int FETCH_ZIP_CODE = 2;
private SharedPreferences prefs; private SharedPreferences prefs;
public static List<Module> listModules = new ArrayList<>(); public static List<Module> listModules = new ArrayList<>();
@BindView(R.id.fab)
FloatingActionButton fabio;
@Nullable @Nullable
@Override @Override
@ -40,7 +45,14 @@ public class ModulesFragment extends Fragment {
ButterKnife.bind(this, viewMain); ButterKnife.bind(this, viewMain);
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);
});
prefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
mSwipeRefreshLayout.setOnRefreshListener(() -> { mSwipeRefreshLayout.setOnRefreshListener(() -> {
@ -64,6 +76,12 @@ public class ModulesFragment extends Fragment {
return viewMain; return viewMain;
} }
@Override
public void onResume() {
super.onResume();
getActivity().setTitle("Modules");
}
private class updateUI extends AsyncTask<Void, Void, Void> { private class updateUI extends AsyncTask<Void, Void, Void> {
@Override @Override

View File

@ -1,11 +1,11 @@
package com.topjohnwu.magisk; package com.topjohnwu.magisk;
import android.app.Fragment;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout; import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
@ -59,7 +59,7 @@ public class ReposFragment extends Fragment {
swipeRefreshLayout.setOnRefreshListener(() -> { swipeRefreshLayout.setOnRefreshListener(() -> {
this.LoadRepo(true); this.LoadRepo(true);
ignoreAlertUpdate = false; ignoreAlertUpdate = false;
prefs.edit().putBoolean("ignoreUpdateAlerts",false).apply(); prefs.edit().putBoolean("ignoreUpdateAlerts", false).apply();
}); });
LoadRepo(false); LoadRepo(false);
@ -76,6 +76,7 @@ public class ReposFragment extends Fragment {
return view; return view;
} }
@Override @Override
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
@ -98,7 +99,7 @@ public class ReposFragment extends Fragment {
super.onAttachFragment(childFragment); super.onAttachFragment(childFragment);
} }
private void LoadRepo (boolean doReload) { private void LoadRepo(boolean doReload) {
RepoHelper.TaskDelegate taskDelegate = result -> { RepoHelper.TaskDelegate taskDelegate = result -> {
if (result.equals("Complete")) { if (result.equals("Complete")) {
Log.d("Magisk", "ReposFragment, got delegate"); Log.d("Magisk", "ReposFragment, got delegate");
@ -111,7 +112,7 @@ public class ReposFragment extends Fragment {
} }
}; };
Log.d("Magisk","ReposFragment, LoadRepo called"); Log.d("Magisk", "ReposFragment, LoadRepo called");
new Async.LoadRepos(getActivity()); new Async.LoadRepos(getActivity());
} }
@ -158,17 +159,18 @@ public class ReposFragment extends Fragment {
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
LoadRepo(false); LoadRepo(false);
getActivity().setTitle("Magisk");
} }
protected List<Repo> listRepos() { protected List<Repo> listRepos() {
return mListRepos; return mListRepos;
} }
private void UpdateUI() { private void UpdateUI() {
Log.d("Magisk","ReposFragment: UpdateUI Called, size is " + listRepos().size()); Log.d("Magisk", "ReposFragment: UpdateUI Called, size is " + listRepos().size());
if (listRepos().size() == 0) { if (listRepos().size() == 0) {
emptyTv.setVisibility(View.VISIBLE); emptyTv.setVisibility(View.VISIBLE);
@ -187,9 +189,4 @@ public class ReposFragment extends Fragment {
} }
} }

View File

@ -95,7 +95,7 @@ public class RootFragment extends Fragment implements Receiver {
view = inflater.inflate(R.layout.root_fragment, container, false); view = inflater.inflate(R.layout.root_fragment, container, false);
ButterKnife.bind(this, view); ButterKnife.bind(this, view);
prefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
autoRootStatus = prefs.getBoolean("autoRootEnable", false); autoRootStatus = Utils.autoToggleEnabled(getActivity());
if (autoRootStatus) { if (autoRootStatus) {
if (!Utils.hasServicePermission(getActivity())) { if (!Utils.hasServicePermission(getActivity())) {
@ -114,7 +114,7 @@ public class RootFragment extends Fragment implements Receiver {
autoRootToggle.setOnClickListener(toggle -> { autoRootToggle.setOnClickListener(toggle -> {
if (!Utils.hasServicePermission(getActivity())) { if (!Utils.hasServicePermission(getActivity())) {
Intent intent = new Intent(android.provider.Settings.ACTION_ACCESSIBILITY_SETTINGS); Intent intent = new Intent(android.provider.Settings.ACTION_ACCESSIBILITY_SETTINGS);
Toast.makeText(getActivity(),"Please enable accessibility access for Magisk's auto-toggle feature to work.", Toast.LENGTH_LONG).show(); Toast.makeText(getActivity(), "Please enable accessibility access for Magisk's auto-toggle feature to work.", Toast.LENGTH_LONG).show();
startActivityForResult(intent, 100); startActivityForResult(intent, 100);
} else { } else {
ToggleAutoRoot(autoRootToggle.isChecked()); ToggleAutoRoot(autoRootToggle.isChecked());
@ -155,7 +155,7 @@ public class RootFragment extends Fragment implements Receiver {
ToggleAutoRoot(true); ToggleAutoRoot(true);
} else { } else {
autoRootToggle.setChecked(false); autoRootToggle.setChecked(false);
Snackbar.make(view, "Auto-root disabled, permissions required.", Snackbar.LENGTH_LONG).show(); Snackbar.make(view, getActivity().getString(R.string.auto_toggle) + " disabled, permissions required.", Snackbar.LENGTH_LONG).show();
} }
} else if (requestCode == 420) { } else if (requestCode == 420) {
@ -166,9 +166,7 @@ public class RootFragment extends Fragment implements Receiver {
private void ToggleAutoRoot(boolean toggleState) { private void ToggleAutoRoot(boolean toggleState) {
autoRootStatus = toggleState; autoRootStatus = toggleState;
SharedPreferences.Editor editor = prefs.edit(); Utils.toggleAutoRoot(toggleState, getActivity());
editor.putBoolean("autoRootEnable", (toggleState));
editor.apply();
if (toggleState) { if (toggleState) {
Intent myIntent = new Intent(getActivity(), MonitorService.class); Intent myIntent = new Intent(getActivity(), MonitorService.class);
getActivity().startService(myIntent); getActivity().startService(myIntent);
@ -191,6 +189,8 @@ public class RootFragment extends Fragment implements Receiver {
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
getActivity().setTitle("Root");
new updateUI().execute(); new updateUI().execute();
} }
@ -206,7 +206,7 @@ public class RootFragment extends Fragment implements Receiver {
// Make sure static block invoked // Make sure static block invoked
Shell.rootAccess(); Shell.rootAccess();
// Set up Tile on UI Refresh // Set up Tile on UI Refresh
if (PrefHelper.CheckBool("enable_quicktile",getActivity())) { if (PrefHelper.CheckBool("enable_quicktile", getActivity())) {
Utils.SetupQuickSettingsTile(getActivity()); Utils.SetupQuickSettingsTile(getActivity());
} }
return null; return null;

View File

@ -1,16 +1,13 @@
package com.topjohnwu.magisk; package com.topjohnwu.magisk;
import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.preference.CheckBoxPreference; import android.preference.CheckBoxPreference;
import android.preference.Preference; import android.preference.Preference;
import android.preference.PreferenceFragment; import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Toast;
import com.topjohnwu.magisk.utils.Utils; import com.topjohnwu.magisk.utils.Utils;
@ -33,6 +30,12 @@ public class SettingsFragment extends PreferenceFragment {
addPreferencesFromResource(R.xml.uisettings); addPreferencesFromResource(R.xml.uisettings);
} }
@Override
public void onResume() {
super.onResume();
getActivity().setTitle("Settings");
}
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState); View view = super.onCreateView(inflater, container, savedInstanceState);

View File

@ -2,6 +2,8 @@ package com.topjohnwu.magisk;
import android.Manifest; import android.Manifest;
import android.app.Fragment; import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
@ -13,9 +15,7 @@ import android.preference.PreferenceManager;
import android.support.annotation.IdRes; import android.support.annotation.IdRes;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.design.widget.NavigationView; import android.support.design.widget.NavigationView;
import android.support.v4.app.ActivityCompat; import android.support.v4.app.ActivityCompat;
import android.app.FragmentTransaction;
import android.support.v4.view.GravityCompat; import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout; import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.ActionBarDrawerToggle;
@ -25,8 +25,9 @@ import android.view.MenuItem;
import android.view.View; import android.view.View;
import com.topjohnwu.magisk.module.RepoHelper; import com.topjohnwu.magisk.module.RepoHelper;
import com.topjohnwu.magisk.utils.Async;
import com.topjohnwu.magisk.services.MonitorService; import com.topjohnwu.magisk.services.MonitorService;
import com.topjohnwu.magisk.utils.Async;
import com.topjohnwu.magisk.utils.Logger;
import com.topjohnwu.magisk.utils.Utils; import com.topjohnwu.magisk.utils.Utils;
import butterknife.BindView; import butterknife.BindView;
@ -37,6 +38,7 @@ public class WelcomeActivity extends AppCompatActivity implements NavigationView
private static final String SELECTED_ITEM_ID = "SELECTED_ITEM_ID"; private static final String SELECTED_ITEM_ID = "SELECTED_ITEM_ID";
private final Handler mDrawerHandler = new Handler(); private final Handler mDrawerHandler = new Handler();
private String currentTitle;
@BindView(R.id.toolbar) @BindView(R.id.toolbar)
Toolbar toolbar; Toolbar toolbar;
@ -54,17 +56,16 @@ public class WelcomeActivity extends AppCompatActivity implements NavigationView
setContentView(R.layout.activity_welcome); setContentView(R.layout.activity_welcome);
ButterKnife.bind(this); ButterKnife.bind(this);
// Startups // Startups
PreferenceManager.setDefaultValues(this, R.xml.defaultpref, false); PreferenceManager.setDefaultValues(this, R.xml.defaultpref, false);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
if (prefs.contains("autoRootEnable")) { if (Utils.autoToggleEnabled(getApplicationContext())) {
if (prefs.getBoolean("autoRootEnable",false)) {
if (!Utils.isMyServiceRunning(MonitorService.class, getApplicationContext())) { if (!Utils.isMyServiceRunning(MonitorService.class, getApplicationContext())) {
Intent myIntent = new Intent(getApplication(), MonitorService.class); Intent myIntent = new Intent(getApplication(), MonitorService.class);
getApplication().startService(myIntent); getApplication().startService(myIntent);
} }
} }
}
Utils.SetupQuickSettingsTile(getApplicationContext()); Utils.SetupQuickSettingsTile(getApplicationContext());
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED if (ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED
@ -73,6 +74,8 @@ public class WelcomeActivity extends AppCompatActivity implements NavigationView
} }
Utils.init(this); Utils.init(this);
new Async.CheckUpdates(this).execute(); new Async.CheckUpdates(this).execute();
RepoHelper.TaskDelegate delegate = result -> { RepoHelper.TaskDelegate delegate = result -> {
@ -114,6 +117,7 @@ public class WelcomeActivity extends AppCompatActivity implements NavigationView
} }
} }
@Override @Override
protected void onDestroy() { protected void onDestroy() {
super.onDestroy(); super.onDestroy();
@ -129,13 +133,25 @@ public class WelcomeActivity extends AppCompatActivity implements NavigationView
@Override @Override
public void onBackPressed() { public void onBackPressed() {
if (drawer.isDrawerOpen(GravityCompat.START)) { if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START); drawer.closeDrawer(GravityCompat.START);
} else { } else {
int backStackEntryCount = getFragmentManager().getBackStackEntryCount();
Logger.dh("Welcomeactivity: Entrycount is " + backStackEntryCount);
if(backStackEntryCount>=2) {
super.onBackPressed(); super.onBackPressed();
} else {
finish();
} }
} }
}
@Override @Override
public boolean onNavigationItemSelected(@NonNull final MenuItem menuItem) { public boolean onNavigationItemSelected(@NonNull final MenuItem menuItem) {
mSelectedId = menuItem.getItemId(); mSelectedId = menuItem.getItemId();
@ -146,7 +162,11 @@ public class WelcomeActivity extends AppCompatActivity implements NavigationView
return true; return true;
} }
@Override
protected void onResume() {
super.onResume();
setTitle(currentTitle);
}
public void navigate(final int itemId) { public void navigate(final int itemId) {
Fragment navFragment = null; Fragment navFragment = null;
@ -163,7 +183,7 @@ public class WelcomeActivity extends AppCompatActivity implements NavigationView
navFragment = new RootFragment(); navFragment = new RootFragment();
break; break;
case R.id.autoroot: case R.id.autoroot:
setTitle(R.string.auto_root); setTitle(R.string.auto_toggle);
tag = "ic_autoroot"; tag = "ic_autoroot";
navFragment = new AutoRootFragment(); navFragment = new AutoRootFragment();
break; break;
@ -193,12 +213,15 @@ public class WelcomeActivity extends AppCompatActivity implements NavigationView
} }
if (navFragment != null) { if (navFragment != null) {
FragmentTransaction transaction = getFragmentManager().beginTransaction(); FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.setCustomAnimations(android.R.animator.fade_in, android.R.animator.fade_out); transaction.setCustomAnimations(android.R.animator.fade_in, android.R.animator.fade_out);
try { try {
toolbar.setElevation(navFragment instanceof ModulesFragment ? 0 : 10); toolbar.setElevation(navFragment instanceof ModulesFragment ? 0 : 10);
currentTitle = getTitle().toString();
transaction.replace(R.id.content_frame, navFragment, tag).commit(); transaction.replace(R.id.content_frame, navFragment, tag).addToBackStack(currentTitle).commit();
} catch (IllegalStateException ignored) { } catch (IllegalStateException ignored) {
} }
} }

View File

@ -21,7 +21,7 @@ public final class PrivateBroadcastReceiver extends BroadcastReceiver {
final String action = intent.getAction(); final String action = intent.getAction();
Log.d("Magisk","Broadcast Receiver, Made it this far! We're trying to " + action); Log.d("Magisk","Broadcast Receiver, Made it this far! We're trying to " + action);
if (ACTION_AUTOROOT.equals(action)) { if (ACTION_AUTOROOT.equals(action)) {
Utils.toggleAutoRoot(!Utils.autoRootEnabled(context),context); Utils.toggleAutoRoot(!Utils.autoToggleEnabled(context),context);
} }
if (ACTION_ENABLEROOT.equals(action)) { if (ACTION_ENABLEROOT.equals(action)) {
Utils.toggleAutoRoot(false, context); Utils.toggleAutoRoot(false, context);

View File

@ -25,7 +25,7 @@ import com.topjohnwu.magisk.utils.Utils;
import java.util.Set; import java.util.Set;
public class MonitorService extends AccessibilityService { public class MonitorService extends AccessibilityService {
private static final String TAG = "Magisk"; private static final String TAG = "MonitorService";
private Boolean disableroot; private Boolean disableroot;
@Override @Override
@ -70,10 +70,8 @@ public class MonitorService extends AccessibilityService {
if (isActivity) { if (isActivity) {
Logger.dh("MonitorService: CurrentActivity: " + componentName.getPackageName()); Logger.dh("MonitorService: CurrentActivity: " + componentName.getPackageName());
String mPackage = componentName.getPackageName(); String mPackage = componentName.getPackageName();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
if (prefs.getBoolean("autoRootEnable", false)) { if (Utils.autoToggleEnabled(getApplicationContext())) {
Set<String> setBlackList = prefs.getStringSet("auto_blacklist", null); Set<String> setBlackList = prefs.getStringSet("auto_blacklist", null);
if (setBlackList != null) { if (setBlackList != null) {
@ -153,7 +151,7 @@ public class MonitorService extends AccessibilityService {
new NotificationCompat.Builder(getApplicationContext()) new NotificationCompat.Builder(getApplicationContext())
.setSmallIcon(disableroot ? R.drawable.ic_stat_notification_autoroot_off : R.drawable.ic_stat_notification_autoroot_on) .setSmallIcon(disableroot ? R.drawable.ic_stat_notification_autoroot_off : R.drawable.ic_stat_notification_autoroot_on)
.setContentIntent(pendingIntent) .setContentIntent(pendingIntent)
.setContentTitle("Auto-root status changed") .setContentTitle(getApplicationContext().getString(R.string.auto_toggle) + " status changed")
.setContentText(rootMessage); .setContentText(rootMessage);
int mNotificationId = 1; int mNotificationId = 1;
mNotifyMgr.notify(mNotificationId, mBuilder.build()); mNotifyMgr.notify(mNotificationId, mBuilder.build());

View File

@ -7,15 +7,11 @@ import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.IBinder; import android.os.IBinder;
import android.service.quicksettings.Tile;
import com.kcoppock.broadcasttilesupport.BroadcastTileIntentBuilder; import com.kcoppock.broadcasttilesupport.BroadcastTileIntentBuilder;
import com.topjohnwu.magisk.utils.Shell;
import com.topjohnwu.magisk.R; import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.utils.Utils; import com.topjohnwu.magisk.utils.Utils;
import java.util.List;
public class TileServiceCompat extends Service { public class TileServiceCompat extends Service {
private static BroadcastReceiver clickTileReceiver; private static BroadcastReceiver clickTileReceiver;
@ -46,7 +42,7 @@ public class TileServiceCompat extends Service {
@Override @Override
public int onStartCommand(Intent intent, int flags, int startId) { public int onStartCommand(Intent intent, int flags, int startId) {
root = Utils.rootEnabled(); root = Utils.rootEnabled();
autoRoot = Utils.autoRootEnabled(getApplicationContext()); autoRoot = Utils.autoToggleEnabled(getApplicationContext());
updateTile(); updateTile();
return super.onStartCommand(intent, flags, startId); return super.onStartCommand(intent, flags, startId);
} }
@ -80,7 +76,7 @@ public class TileServiceCompat extends Service {
private void onLongClick() { private void onLongClick() {
Intent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); Intent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
sendBroadcast(it); sendBroadcast(it);
Utils.toggleAutoRoot(!Utils.autoRootEnabled(getApplicationContext()),getApplicationContext()); Utils.toggleAutoRoot(!Utils.autoToggleEnabled(getApplicationContext()),getApplicationContext());
} }
public static boolean openApp(Context context, String packageName) { public static boolean openApp(Context context, String packageName) {
@ -99,7 +95,7 @@ public class TileServiceCompat extends Service {
private void updateTile() { private void updateTile() {
BroadcastTileIntentBuilder broadcastTileIntentBuilder = new BroadcastTileIntentBuilder(this, TILE_ID); BroadcastTileIntentBuilder broadcastTileIntentBuilder = new BroadcastTileIntentBuilder(this, TILE_ID);
if (autoRoot) { if (autoRoot) {
broadcastTileIntentBuilder.setLabel("Auto-root"); broadcastTileIntentBuilder.setLabel(getApplicationContext().getString(R.string.auto_toggle));
broadcastTileIntentBuilder.setIconResource(R.drawable.ic_autoroot_white); broadcastTileIntentBuilder.setIconResource(R.drawable.ic_autoroot_white);
} else { } else {

View File

@ -42,12 +42,12 @@ public class TileServiceNewApi extends android.service.quicksettings.TileService
Icon iconRoot = Icon.createWithResource(getApplicationContext(), R.drawable.root); Icon iconRoot = Icon.createWithResource(getApplicationContext(), R.drawable.root);
Icon iconAuto = Icon.createWithResource(getApplicationContext(), R.drawable.ic_autoroot); Icon iconAuto = Icon.createWithResource(getApplicationContext(), R.drawable.ic_autoroot);
Tile tile = this.getQsTile(); Tile tile = this.getQsTile();
boolean autoRootStatus = Utils.autoRootEnabled(getApplicationContext()); boolean autoRootStatus = Utils.autoToggleEnabled(getApplicationContext());
boolean rootStatus = Utils.rootEnabled(); boolean rootStatus = Utils.rootEnabled();
int rootsStatus = Utils.CheckRootsState(getApplicationContext()); int rootsStatus = Utils.CheckRootsState(getApplicationContext());
Log.d("Magisk", "QST: Auto and root are " + autoRootStatus + " and " + rootStatus + Utils.CheckRootsState(getApplicationContext())); Log.d("Magisk", "QST: Auto and root are " + autoRootStatus + " and " + rootStatus + Utils.CheckRootsState(getApplicationContext()));
if (rootsStatus == 2) { if (rootsStatus == 2) {
tile.setLabel("Auto-root"); tile.setLabel(getApplicationContext().getString(R.string.auto_toggle));
tile.setIcon(iconAuto); tile.setIcon(iconAuto);
tile.setState(Tile.STATE_ACTIVE); tile.setState(Tile.STATE_ACTIVE);

View File

@ -55,7 +55,7 @@ public class ApplicationAdapter extends ArrayAdapter<ApplicationInfo> {
if (null == view) { if (null == view) {
LayoutInflater layoutInflater = (LayoutInflater) context LayoutInflater layoutInflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE); .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = layoutInflater.inflate(R.layout.app_list_row, null); view = layoutInflater.inflate(R.layout.list_item_app, null);
} }
ApplicationInfo applicationInfo = appsList.get(position); ApplicationInfo applicationInfo = appsList.get(position);
@ -81,7 +81,7 @@ public class ApplicationAdapter extends ArrayAdapter<ApplicationInfo> {
if (null == view) { if (null == view) {
LayoutInflater layoutInflater = (LayoutInflater) context LayoutInflater layoutInflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE); .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = layoutInflater.inflate(R.layout.app_list_row, null); view = layoutInflater.inflate(R.layout.list_item_app, null);
} }
ApplicationInfo applicationInfo = appsList.get(position); ApplicationInfo applicationInfo = appsList.get(position);
if (null != applicationInfo) { if (null != applicationInfo) {

View File

@ -97,9 +97,9 @@ public class Utils {
return Boolean.parseBoolean(ret.get(0)); return Boolean.parseBoolean(ret.get(0));
} }
public static boolean autoRootEnabled(Context context) { public static boolean autoToggleEnabled(Context context) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
Log.d("Magisk", "AutoRootEnableCheck is " + preferences.getBoolean("autoRootEnable", false)); Logger.dh("Utils: AutoRootEnableCheck is " + preferences.getBoolean("autoRootEnable", false));
return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("autoRootEnable", false); return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("autoRootEnable", false);
} }
@ -232,7 +232,7 @@ public class Utils {
int mIcon; int mIcon;
switch (mRootsState) { switch (mRootsState) {
case 2: case 2:
mLabelString = "Auto-root"; mLabelString = mContext.getString(R.string.auto_toggle);
mIcon = mAutoRootIcon; mIcon = mAutoRootIcon;
intent = autoBroadcast; intent = autoBroadcast;
break; break;
@ -360,7 +360,7 @@ public class Utils {
// 0 for root disabled, 1 for root enabled (no auto), 2 for auto-root // 0 for root disabled, 1 for root enabled (no auto), 2 for auto-root
public static int CheckRootsState(Context mContext) { public static int CheckRootsState(Context mContext) {
if (autoRootEnabled(mContext)) { if (autoToggleEnabled(mContext)) {
return 2; return 2;
} else { } else {
if (rootEnabled()) { if (rootEnabled()) {

View File

@ -6,9 +6,9 @@
<ListView android:id="@android:id/list" <ListView android:id="@android:id/list"
android:divider="@android:color/transparent" android:divider="@android:color/transparent"
android:dividerHeight="5.0sp" android:dividerHeight="@dimen/card_divider_space"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_margin="15dp"/> android:layout_margin="6dp"/>
</LinearLayout> </LinearLayout>

View File

@ -2,29 +2,29 @@
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto" xmlns:card_view="http://schemas.android.com/apk/res-auto"
style="@style/Base.CardView"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginBottom="3dip" android:layout_marginBottom="@dimen/card_vertical_margin"
android:layout_marginLeft="8dip" android:layout_marginStart="@dimen/card_horizontal_margin"
android:layout_marginRight="8dip" android:layout_marginEnd="@dimen/card_horizontal_margin"
android:layout_marginTop="3dip" android:layout_marginTop="@dimen/card_vertical_margin"
android:background="?android:attr/selectableItemBackground" android:background="?android:attr/selectableItemBackground"
card_view:cardCornerRadius="2dp" android:minHeight="?android:attr/listPreferredItemHeight"
card_view:cardElevation="2dp"> card_view:cardCornerRadius="@dimen/card_corner_radius"
card_view:cardElevation="@dimen/card_elevation">
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:padding="10dp"> android:padding="@dimen/card_layout_padding">
<ImageView xmlns:android="http://schemas.android.com/apk/res/android" <ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/app_icon" android:id="@+id/app_icon"
android:layout_width="50dp" android:layout_width="@dimen/card_appicon_size"
android:layout_height="50dp" android:layout_height="@dimen/card_appicon_size"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:scaleType="centerCrop"/> android:scaleType="centerCrop"/>
@ -34,7 +34,7 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical" android:orientation="vertical"
android:paddingEnd="50dp" android:paddingEnd="@dimen/card_appicon_size"
android:paddingStart="65dp" android:paddingStart="65dp"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:layout_alignBottom="@+id/app_icon" android:layout_alignBottom="@+id/app_icon"

View File

@ -5,24 +5,25 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginBottom="3dip" android:layout_marginBottom="@dimen/card_vertical_margin"
android:layout_marginLeft="8dip" android:layout_marginStart="@dimen/card_horizontal_margin"
android:layout_marginRight="8dip" android:layout_marginEnd="@dimen/card_horizontal_margin"
android:layout_marginTop="3dip" android:layout_marginTop="@dimen/card_vertical_margin"
android:background="?android:attr/selectableItemBackground" android:background="?android:attr/selectableItemBackground"
android:minHeight="?android:attr/listPreferredItemHeight" android:minHeight="?android:attr/listPreferredItemHeight"
card_view:cardCornerRadius="2dp" card_view:cardCornerRadius="@dimen/card_corner_radius"
card_view:cardElevation="2dp"> card_view:cardElevation="@dimen/card_elevation">
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="10dp" android:minHeight="?android:attr/listPreferredItemHeight"
android:padding="@dimen/card_layout_padding"
android:layout_gravity="center_vertical"> android:layout_gravity="center_vertical">
<TextView <TextView
android:id="@+id/title" android:id="@+id/title"
android:layout_width="300dip" android:layout_width="@dimen/card_textview_width"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
@ -56,7 +57,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:focusable="false" android:focusable="false"
android:gravity="center" android:gravity="center"
android:padding="3dp" android:padding="@dimen/checkbox_padding"
android:src="@drawable/ic_menu_overflow_material" android:src="@drawable/ic_menu_overflow_material"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
@ -67,7 +68,7 @@
android:layout_marginBottom="0dp" android:layout_marginBottom="0dp"
android:focusable="false" android:focusable="false"
android:gravity="center" android:gravity="center"
android:padding="3dp" android:padding="@dimen/checkbox_padding"
android:src="@drawable/ic_delete" android:src="@drawable/ic_delete"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
@ -87,7 +88,7 @@
<!--/>--> <!--/>-->
<TextView <TextView
android:id="@+id/description" android:id="@+id/description"
android:layout_width="300dip" android:layout_width="@dimen/card_textview_width"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_below="@id/version_name" android:layout_below="@id/version_name"
@ -112,7 +113,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_below="@id/description" android:layout_below="@id/description"
android:minHeight="100dp" android:minHeight="@dimen/min_rowheight"
android:orientation="vertical" android:orientation="vertical"
> >
@ -147,8 +148,8 @@
android:id="@+id/changeLog" android:id="@+id/changeLog"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="10dp" android:layout_marginEnd="@dimen/card_imageview_margin"
android:layout_marginStart="10dp" android:layout_marginStart="@dimen/card_imageview_margin"
android:backgroundTint="@color/icon_grey" android:backgroundTint="@color/icon_grey"
android:background="@drawable/ic_changelog" /> android:background="@drawable/ic_changelog" />
@ -156,8 +157,8 @@
android:id="@+id/authorLink" android:id="@+id/authorLink"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="10dp" android:layout_marginEnd="@dimen/card_imageview_margin"
android:layout_marginStart="10dp" android:layout_marginStart="@dimen/card_imageview_margin"
android:backgroundTint="@color/icon_grey" android:backgroundTint="@color/icon_grey"
android:background="@drawable/ic_author" /> android:background="@drawable/ic_author" />
@ -165,8 +166,8 @@
android:id="@+id/supportLink" android:id="@+id/supportLink"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="10dp" android:layout_marginEnd="@dimen/card_imageview_margin"
android:layout_marginStart="10dp" android:layout_marginStart="@dimen/card_imageview_margin"
android:backgroundTint="@color/icon_grey" android:backgroundTint="@color/icon_grey"
android:background="@drawable/ic_support" /> android:background="@drawable/ic_support" />

View File

@ -5,18 +5,21 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_margin="8dp" android:layout_marginBottom="@dimen/card_vertical_margin"
android:layout_marginStart="@dimen/card_horizontal_margin"
android:layout_marginEnd="@dimen/card_horizontal_margin"
android:layout_marginTop="@dimen/card_vertical_margin"
android:background="?android:attr/selectableItemBackground" android:background="?android:attr/selectableItemBackground"
android:minHeight="?android:attr/listPreferredItemHeight" android:minHeight="?android:attr/listPreferredItemHeight"
card_view:cardCornerRadius="2dp" card_view:cardCornerRadius="@dimen/card_corner_radius"
card_view:cardElevation="2dp"> card_view:cardElevation="@dimen/card_elevation">
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight" android:minHeight="?android:attr/listPreferredItemHeight"
android:padding="10dp"> android:padding="@dimen/card_layout_padding">
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -26,7 +29,7 @@
<TextView <TextView
android:id="@+id/title" android:id="@+id/title"
android:layout_width="300dip" android:layout_width="@dimen/card_textview_width"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="false" android:singleLine="false"
android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium"
@ -119,24 +122,24 @@
android:id="@+id/changeLog" android:id="@+id/changeLog"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="10dp" android:layout_marginEnd="@dimen/card_imageview_margin"
android:layout_marginEnd="10dp" android:layout_marginStart="@dimen/card_imageview_margin"
android:backgroundTint="@color/icon_grey" android:backgroundTint="@color/icon_grey"
android:background="@drawable/ic_changelog"/> android:background="@drawable/ic_changelog"/>
<ImageView <ImageView
android:id="@+id/authorLink" android:id="@+id/authorLink"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="10dp" android:layout_marginEnd="@dimen/card_imageview_margin"
android:layout_marginEnd="10dp" android:layout_marginStart="@dimen/card_imageview_margin"
android:backgroundTint="@color/icon_grey" android:backgroundTint="@color/icon_grey"
android:background="@drawable/ic_author"/> android:background="@drawable/ic_author"/>
<ImageView <ImageView
android:id="@+id/supportLink" android:id="@+id/supportLink"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="10dp" android:layout_marginEnd="@dimen/card_imageview_margin"
android:layout_marginEnd="10dp" android:layout_marginStart="@dimen/card_imageview_margin"
android:backgroundTint="@color/icon_grey" android:backgroundTint="@color/icon_grey"
android:background="@drawable/ic_support"/> android:background="@drawable/ic_support"/>
@ -156,8 +159,8 @@
android:focusable="false" android:focusable="false"
android:visibility="gone" android:visibility="gone"
android:gravity="end" android:gravity="end"
android:layout_marginStart="10dp" android:layout_marginEnd="@dimen/card_imageview_margin"
android:layout_marginEnd="10dp" android:layout_marginStart="@dimen/card_imageview_margin"
/> />
</RelativeLayout> </RelativeLayout>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SwipeRefreshLayout <android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/swipeRefreshLayout" android:id="@+id/swipeRefreshLayout"
@ -8,13 +9,23 @@
android:layout_marginTop="?attr/actionBarSize" android:layout_marginTop="?attr/actionBarSize"
android:orientation="vertical"> android:orientation="vertical">
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/llayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="?attr/actionBarSize"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView" android:id="@+id/recyclerView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:clipToPadding="false" android:clipToPadding="false"
android:dividerHeight="@dimen/card_divider_space"
android:paddingBottom="60dip" android:paddingBottom="60dip"
app:layoutManager="android.support.v7.widget.LinearLayoutManager"/> app:layoutManager="android.support.v7.widget.LinearLayoutManager" />
<TextView <TextView
android:id="@+id/empty_rv" android:id="@+id/empty_rv"
@ -26,6 +37,22 @@
android:text="@string/no_modules_found" android:text="@string/no_modules_found"
android:textSize="20sp" android:textSize="20sp"
android:textStyle="italic" android:textStyle="italic"
android:visibility="gone"/> android:visibility="gone" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_margin="16dp"
android:baselineAlignBottom="false"
android:clickable="true"
android:src="@drawable/ic_add"
app:layout_anchorGravity="bottom|center_horizontal"
app:layout_anchor="@+id/empty_rv"
android:layout_gravity="top|center_horizontal" />
</android.support.design.widget.CoordinatorLayout>
</android.support.v4.widget.SwipeRefreshLayout> </android.support.v4.widget.SwipeRefreshLayout>

View File

@ -11,6 +11,7 @@
android:id="@+id/recyclerView" android:id="@+id/recyclerView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:dividerHeight="@dimen/card_divider_space"
app:layoutManager="android.support.v7.widget.LinearLayoutManager"/> app:layoutManager="android.support.v7.widget.LinearLayoutManager"/>
<TextView <TextView

View File

@ -18,7 +18,7 @@
<item <item
android:id="@+id/autoroot" android:id="@+id/autoroot"
android:icon="@drawable/ic_autoroot" android:icon="@drawable/ic_autoroot"
android:title="@string/auto_root"/> android:title="@string/auto_toggle"/>
<item <item
android:id="@+id/modules" android:id="@+id/modules"

View File

@ -3,4 +3,14 @@
<dimen name="floating_height">650dp</dimen> <dimen name="floating_height">650dp</dimen>
<dimen name="floating_width">500dp</dimen> <dimen name="floating_width">500dp</dimen>
<dimen name="min_rowheight">100dp</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>
<dimen name="card_corner_radius">2dp</dimen>
<dimen name="card_elevation">2dp</dimen>
<dimen name="card_layout_padding">10dp</dimen>
<dimen name="card_textview_width">300dip</dimen>
<dimen name="checkbox_padding">3dp</dimen>
<dimen name="card_imageview_margin">10dp</dimen>
<dimen name="card_appicon_size">50dp</dimen>
</resources> </resources>

View File

@ -121,4 +121,7 @@
<string name="settings_development_category">Development</string> <string name="settings_development_category">Development</string>
<string name="settings_hide_root_notification_summary">When checked, auto-root notifications will not be displayed.</string> <string name="settings_hide_root_notification_summary">When checked, auto-root notifications will not be displayed.</string>
<string name="settings_hide_root_notification_title">Hide auto-root notifications</string> <string name="settings_hide_root_notification_title">Hide auto-root notifications</string>
<!--General Use -->
<string name="auto_toggle">Auto-toggle</string>
</resources> </resources>