UI improvements, cleanup
This commit is contained in:
parent
56f10e238b
commit
0f103d5853
@ -10,7 +10,6 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CheckBox;
|
||||
|
||||
import com.topjohnwu.magisk.R;
|
||||
import com.topjohnwu.magisk.module.Module;
|
||||
import com.topjohnwu.magisk.rv.ItemClickListener;
|
||||
import com.topjohnwu.magisk.rv.ModulesAdapter;
|
||||
@ -33,6 +32,7 @@ public abstract class BaseModuleFragment extends Fragment {
|
||||
recyclerView.setAdapter(new ModulesAdapter(listModules(), new ItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(View view, int position) {
|
||||
// On Checkbox change listener
|
||||
CheckBox chbox = (CheckBox) view;
|
||||
|
||||
if (!chbox.isChecked()) {
|
||||
@ -46,9 +46,19 @@ public abstract class BaseModuleFragment extends Fragment {
|
||||
}, new ItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(View view, int position) {
|
||||
// On delete button click listener
|
||||
|
||||
listModules().get(position).createRemoveFile();
|
||||
Snackbar.make(view, R.string.remove_file_created, Snackbar.LENGTH_SHORT).show();
|
||||
}
|
||||
}, new ItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(View view, int position) {
|
||||
// On undelete button click listener
|
||||
|
||||
listModules().get(position).deleteRemoveFile();
|
||||
Snackbar.make(view, R.string.remove_file_deleted, Snackbar.LENGTH_SHORT).show();
|
||||
}
|
||||
}));
|
||||
return view;
|
||||
}
|
||||
|
@ -141,8 +141,7 @@ public class ModulesFragment extends Fragment {
|
||||
private class TabsAdapter extends FragmentPagerAdapter {
|
||||
|
||||
String[] tabTitles = new String[]{
|
||||
"Modules", "Cache Modules"
|
||||
// TODO stringify
|
||||
getString(R.string.modules), getString(R.string.cache_modules)
|
||||
};
|
||||
|
||||
public TabsAdapter(FragmentManager fm) {
|
||||
|
@ -1,7 +0,0 @@
|
||||
package com.topjohnwu.magisk;
|
||||
|
||||
import android.support.v4.app.Fragment;
|
||||
|
||||
public class RootFragment extends Fragment {
|
||||
|
||||
}
|
@ -122,10 +122,6 @@ public class WelcomeActivity extends AppCompatActivity implements NavigationView
|
||||
setTitle(R.string.magisk);
|
||||
navFragment = new MagiskFragment();
|
||||
break;
|
||||
case R.id.root:
|
||||
setTitle(R.string.root);
|
||||
navFragment = new RootFragment();
|
||||
break;
|
||||
case R.id.modules:
|
||||
setTitle(R.string.modules);
|
||||
navFragment = new ModulesFragment();
|
||||
|
@ -23,11 +23,13 @@ public class ModulesAdapter extends RecyclerView.Adapter<ModulesAdapter.ViewHold
|
||||
private final List<Module> mList;
|
||||
private final ItemClickListener chboxListener;
|
||||
private final ItemClickListener deleteBtnListener;
|
||||
private final ItemClickListener unDeleteBtnListener;
|
||||
|
||||
public ModulesAdapter(List<Module> list, ItemClickListener chboxListener, ItemClickListener deleteBtnListener) {
|
||||
public ModulesAdapter(List<Module> list, ItemClickListener chboxListener, ItemClickListener deleteBtnListener, ItemClickListener undeleteBtnListener) {
|
||||
this.mList = list;
|
||||
this.chboxListener = chboxListener;
|
||||
this.deleteBtnListener = deleteBtnListener;
|
||||
this.unDeleteBtnListener = undeleteBtnListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -56,21 +58,27 @@ public class ModulesAdapter extends RecyclerView.Adapter<ModulesAdapter.ViewHold
|
||||
holder.delete.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (module.willBeRemoved()) {
|
||||
unDeleteBtnListener.onItemClick(holder.delete, holder.getAdapterPosition());
|
||||
} else {
|
||||
deleteBtnListener.onItemClick(holder.delete, holder.getAdapterPosition());
|
||||
holder.warning.setVisibility(module.willBeRemoved() ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
});
|
||||
holder.delete.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View view) {
|
||||
module.deleteRemoveFile();
|
||||
holder.warning.setVisibility(module.willBeRemoved() ? View.VISIBLE : View.GONE);
|
||||
|
||||
return true;
|
||||
updateDeleteButton(holder, module);
|
||||
}
|
||||
});
|
||||
|
||||
updateDeleteButton(holder, module);
|
||||
}
|
||||
|
||||
private void updateDeleteButton(ViewHolder holder, Module module) {
|
||||
holder.warning.setVisibility(module.willBeRemoved() ? View.VISIBLE : View.GONE);
|
||||
|
||||
if (module.willBeRemoved()) {
|
||||
holder.delete.setImageResource(R.drawable.ic_undelete);
|
||||
} else {
|
||||
holder.delete.setImageResource(R.drawable.ic_delete);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
9
app/src/main/res/drawable/ic_undelete.xml
Normal file
9
app/src/main/res/drawable/ic_undelete.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="#757575"
|
||||
android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2L18,7L6,7v12zM8.46,11.88l1.41,-1.41L12,12.59l2.12,-2.12 1.41,1.41L13.41,14l2.12,2.12 -1.41,1.41L12,15.41l-2.12,2.12 -1.41,-1.41L10.59,14l-2.13,-2.12zM15.5,4l-1,-1h-5l-1,1L5,4v2h14L19,4z"/>
|
||||
</vector>
|
@ -1,9 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="24">
|
||||
<path
|
||||
android:fillColor="#000"
|
||||
android:pathData="M3,5A2,2 0 0,1 5,3H19A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5C3.89,21 3,20.1 3,19V5M7,18H9L9.35,16H13.35L13,18H15L15.35,16H17.35L17.71,14H15.71L16.41,10H18.41L18.76,8H16.76L17.12,6H15.12L14.76,8H10.76L11.12,6H9.12L8.76,8H6.76L6.41,10H8.41L7.71,14H5.71L5.35,16H7.35L7,18M10.41,10H14.41L13.71,14H9.71L10.41,10Z"/>
|
||||
</vector>
|
@ -1,16 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout android:id="@+id/container"
|
||||
<ScrollView android:id="@+id/svLog"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="?attr/actionBarSize">
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/svLog"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<HorizontalScrollView
|
||||
android:id="@+id/hsvLog"
|
||||
android:layout_width="match_parent"
|
||||
@ -39,5 +34,3 @@
|
||||
</HorizontalScrollView>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</RelativeLayout>
|
@ -1,123 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="?attr/actionBarSize"
|
||||
android:focusableInTouchMode="true">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/magisk_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/magisk_label"
|
||||
android:textSize="20sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/magisk_version"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/magisk_label"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_toEndOf="@+id/magisk_label"
|
||||
android:text="@string/unavailable"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/root_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_below="@+id/magisk_label"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/root_label"
|
||||
android:textSize="20sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/root_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/root_label"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_toEndOf="@+id/root_label"
|
||||
android:text="@string/unavailable"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/selinux_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_below="@+id/root_label"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/selinux_label"
|
||||
android:textSize="20sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/selinux_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/selinux_label"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_toEndOf="@+id/selinux_label"
|
||||
android:text="@string/unavailable"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/safety_net"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_below="@+id/selinux_label"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/unavailable"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/permissive"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_below="@+id/safety_net"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/unavailable"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/root_toggle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_below="@+id/permissive"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:checked="false"
|
||||
android:switchPadding="20dp"
|
||||
android:text="@string/root_toggle"
|
||||
android:textSize="20sp"/>
|
||||
|
||||
<Switch
|
||||
android:id="@+id/selinux_toggle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_below="@+id/root_toggle"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:checked="false"
|
||||
android:switchPadding="20dp"
|
||||
android:text="@string/selinux_toggle"
|
||||
android:textSize="20sp"/>
|
||||
|
||||
</RelativeLayout>
|
@ -8,11 +8,6 @@
|
||||
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/modules"
|
||||
android:icon="@drawable/ic_extension"
|
||||
|
@ -3,12 +3,9 @@
|
||||
|
||||
<color name="primary">#009688</color>
|
||||
<color name="primary_dark">#00796B</color>
|
||||
<color name="primary_light">#B2DFDB</color>
|
||||
<color name="accent">#FFC107</color>
|
||||
<color name="primary_text">#212121</color>
|
||||
<color name="secondary_text">#757575</color>
|
||||
<color name="icons">#FFFFFF</color>
|
||||
<color name="divider">#BDBDBD</color>
|
||||
|
||||
<color name="red500">#F44336</color>
|
||||
<color name="green500">#4CAF50</color>
|
||||
|
@ -6,28 +6,20 @@
|
||||
<string name="root_unmounted_info">Safety Net (Android Pay) should work, but no root temporarily</string>
|
||||
<string name="selinux_enforcing_info">SELinux is enforced</string>
|
||||
<string name="selinux_permissive_info">SELinux is permissive\nOnly turn off SELinux if necessary!</string>
|
||||
<string name="unavailable">(unavailable)</string>
|
||||
<string name="magisk_label">Boot Version:</string>
|
||||
<string name="root_label">Root Status:</string>
|
||||
<string name="selinux_label">SeLinux is %s</string>
|
||||
<string name="root_toggle">Root Toggle</string>
|
||||
<string name="selinux_toggle">SeLinux Toggle</string>
|
||||
<string name="root_system">Improperly Installed</string>
|
||||
<string name="root_system_info">Root improperly installed. Safety Net (Android Pay) will NOT work, and impossible to toggle</string>
|
||||
<string name="root_none">Not Rooted</string>
|
||||
<string name="root_none_info">Safety Net (Android Pay) should work</string>
|
||||
<string name="magisk_version">Magisk v%1$s</string>
|
||||
<string name="magisk_version">Installed Magisk v%1$s</string>
|
||||
<string name="selinux_samsung">Samsung do not support switching SELinux status!</string>
|
||||
<string name="loading">Loading…</string>
|
||||
|
||||
<string name="navigation_drawer_open">Open navigation drawer</string>
|
||||
<string name="navigation_drawer_close">Close navigation drawer</string>
|
||||
|
||||
<string name="root">Root</string>
|
||||
<string name="modules">Modules</string>
|
||||
<string name="log">Log</string>
|
||||
<string name="remove">Remove</string>
|
||||
<string name="disable">Disable</string>
|
||||
<string name="no_root_access">No root access, functionality limited</string>
|
||||
<string name="remove_file_created">Module will be removed at next reboot</string>
|
||||
<string name="disable_file_created">Module will be disabled at next reboot</string>
|
||||
@ -43,5 +35,7 @@
|
||||
<string name="permissionNotGranted">This feature will not work without permission to write external storage.</string>
|
||||
<string name="disable_file_removed">Module will be enabled at next reboot</string>
|
||||
<string name="magisk">Magisk</string>
|
||||
<string name="remove_file_deleted">Module will not be removed at next reboot</string>
|
||||
<string name="cache_modules">Cache modules</string>
|
||||
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user