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 {
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.jakewharton:butterknife:8.4.0'
compile 'com.github.michalis-vitos:aFileChooser:master'

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,11 +1,11 @@
package com.topjohnwu.magisk;
import android.app.Fragment;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import android.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.RecyclerView;
@ -59,7 +59,7 @@ public class ReposFragment extends Fragment {
swipeRefreshLayout.setOnRefreshListener(() -> {
this.LoadRepo(true);
ignoreAlertUpdate = false;
prefs.edit().putBoolean("ignoreUpdateAlerts",false).apply();
prefs.edit().putBoolean("ignoreUpdateAlerts", false).apply();
});
LoadRepo(false);
@ -76,6 +76,7 @@ public class ReposFragment extends Fragment {
return view;
}
@Override
public void onStart() {
super.onStart();
@ -98,7 +99,7 @@ public class ReposFragment extends Fragment {
super.onAttachFragment(childFragment);
}
private void LoadRepo (boolean doReload) {
private void LoadRepo(boolean doReload) {
RepoHelper.TaskDelegate taskDelegate = result -> {
if (result.equals("Complete")) {
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());
}
@ -158,17 +159,18 @@ public class ReposFragment extends Fragment {
public void onResume() {
super.onResume();
LoadRepo(false);
getActivity().setTitle("Magisk");
}
protected List<Repo> listRepos() {
return mListRepos;
}
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) {
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);
ButterKnife.bind(this, view);
prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
autoRootStatus = prefs.getBoolean("autoRootEnable", false);
autoRootStatus = Utils.autoToggleEnabled(getActivity());
if (autoRootStatus) {
if (!Utils.hasServicePermission(getActivity())) {
@ -114,7 +114,7 @@ public class RootFragment extends Fragment implements Receiver {
autoRootToggle.setOnClickListener(toggle -> {
if (!Utils.hasServicePermission(getActivity())) {
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);
} else {
ToggleAutoRoot(autoRootToggle.isChecked());
@ -155,7 +155,7 @@ public class RootFragment extends Fragment implements Receiver {
ToggleAutoRoot(true);
} else {
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) {
@ -166,9 +166,7 @@ public class RootFragment extends Fragment implements Receiver {
private void ToggleAutoRoot(boolean toggleState) {
autoRootStatus = toggleState;
SharedPreferences.Editor editor = prefs.edit();
editor.putBoolean("autoRootEnable", (toggleState));
editor.apply();
Utils.toggleAutoRoot(toggleState, getActivity());
if (toggleState) {
Intent myIntent = new Intent(getActivity(), MonitorService.class);
getActivity().startService(myIntent);
@ -191,6 +189,8 @@ public class RootFragment extends Fragment implements Receiver {
@Override
public void onResume() {
super.onResume();
getActivity().setTitle("Root");
new updateUI().execute();
}
@ -206,7 +206,7 @@ public class RootFragment extends Fragment implements Receiver {
// Make sure static block invoked
Shell.rootAccess();
// Set up Tile on UI Refresh
if (PrefHelper.CheckBool("enable_quicktile",getActivity())) {
if (PrefHelper.CheckBool("enable_quicktile", getActivity())) {
Utils.SetupQuickSettingsTile(getActivity());
}
return null;

View File

@ -1,16 +1,13 @@
package com.topjohnwu.magisk;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
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.Utils;
@ -33,6 +30,12 @@ public class SettingsFragment extends PreferenceFragment {
addPreferencesFromResource(R.xml.uisettings);
}
@Override
public void onResume() {
super.onResume();
getActivity().setTitle("Settings");
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState);
@ -55,11 +58,11 @@ public class SettingsFragment extends PreferenceFragment {
Preference.OnPreferenceClickListener preferenceClickListener = preference -> {
if (preference == quickTilePreference) {
boolean isChecked = quickTilePreference.isChecked();
if (isChecked) {
Utils.installTile(getActivity());
} else {
Utils.uninstallTile(getActivity());
}
if (isChecked) {
Utils.installTile(getActivity());
} else {
Utils.uninstallTile(getActivity());
}
}
if (preference == devLogPreference) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -55,7 +55,7 @@ public class ApplicationAdapter extends ArrayAdapter<ApplicationInfo> {
if (null == view) {
LayoutInflater layoutInflater = (LayoutInflater) context
.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);
@ -81,7 +81,7 @@ public class ApplicationAdapter extends ArrayAdapter<ApplicationInfo> {
if (null == view) {
LayoutInflater layoutInflater = (LayoutInflater) context
.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);
if (null != applicationInfo) {

View File

@ -97,9 +97,9 @@ public class Utils {
return Boolean.parseBoolean(ret.get(0));
}
public static boolean autoRootEnabled(Context context) {
public static boolean autoToggleEnabled(Context 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);
}
@ -232,7 +232,7 @@ public class Utils {
int mIcon;
switch (mRootsState) {
case 2:
mLabelString = "Auto-root";
mLabelString = mContext.getString(R.string.auto_toggle);
mIcon = mAutoRootIcon;
intent = autoBroadcast;
break;
@ -360,7 +360,7 @@ public class Utils {
// 0 for root disabled, 1 for root enabled (no auto), 2 for auto-root
public static int CheckRootsState(Context mContext) {
if (autoRootEnabled(mContext)) {
if (autoToggleEnabled(mContext)) {
return 2;
} else {
if (rootEnabled()) {

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/swipeRefreshLayout"
@ -8,24 +9,50 @@
android:layout_marginTop="?attr/actionBarSize"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingBottom="60dip"
app:layoutManager="android.support.v7.widget.LinearLayoutManager"/>
<TextView
android:id="@+id/empty_rv"
<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="match_parent"
android:layout_gravity="center"
android:fontFamily="sans-serif-light"
android:gravity="center"
android:text="@string/no_modules_found"
android:textSize="20sp"
android:textStyle="italic"
android:visibility="gone"/>
android:layout_height="wrap_content"
android:layout_marginTop="?attr/actionBarSize"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:dividerHeight="@dimen/card_divider_space"
android:paddingBottom="60dip"
app:layoutManager="android.support.v7.widget.LinearLayoutManager" />
<TextView
android:id="@+id/empty_rv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:fontFamily="sans-serif-light"
android:gravity="center"
android:text="@string/no_modules_found"
android:textSize="20sp"
android:textStyle="italic"
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>

View File

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

View File

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

View File

@ -3,4 +3,14 @@
<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>
<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>

View File

@ -121,4 +121,7 @@
<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_title">Hide auto-root notifications</string>
<!--General Use -->
<string name="auto_toggle">Auto-toggle</string>
</resources>