Move list sorting to menus
This commit is contained in:
parent
49629ed1a7
commit
da2c53ebd0
|
|
@ -167,8 +167,8 @@ public class App extends Application implements Application.ActivityLifecycleCal
|
||||||
if (pref.getBoolean("hook_modules", true)) {
|
if (pref.getBoolean("hook_modules", true)) {
|
||||||
Collection<ModuleUtil.InstalledModule> installedModules = ModuleUtil.getInstance().getModules().values();
|
Collection<ModuleUtil.InstalledModule> installedModules = ModuleUtil.getInstance().getModules().values();
|
||||||
for (ModuleUtil.InstalledModule info : installedModules) {
|
for (ModuleUtil.InstalledModule info : installedModules) {
|
||||||
if (!AppHelper.FORCE_WHITE_LIST_MODULE.contains(info.packageName)) {
|
if (!AppHelper.forceWhiteList.contains(info.packageName)) {
|
||||||
AppHelper.FORCE_WHITE_LIST_MODULE.add(info.packageName);
|
AppHelper.forceWhiteList.add(info.packageName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.d(TAG, "ApplicationList: Force add modules to list");
|
Log.d(TAG, "ApplicationList: Force add modules to list");
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package org.meowcat.edxposed.manager.adapters;
|
package org.meowcat.edxposed.manager.adapters;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
|
@ -8,6 +10,9 @@ import android.graphics.drawable.Drawable;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
|
|
@ -49,9 +54,11 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.ViewHolder> impl
|
||||||
private final PackageManager pm;
|
private final PackageManager pm;
|
||||||
private final ApplicationFilter filter;
|
private final ApplicationFilter filter;
|
||||||
private Comparator<ApplicationInfo> cmp;
|
private Comparator<ApplicationInfo> cmp;
|
||||||
|
private final SharedPreferences preferences;
|
||||||
|
|
||||||
AppAdapter(Context context) {
|
AppAdapter(Context context) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
|
preferences = App.getPreferences();
|
||||||
fullList = showList = Collections.emptyList();
|
fullList = showList = Collections.emptyList();
|
||||||
checkedList = Collections.emptyList();
|
checkedList = Collections.emptyList();
|
||||||
filter = new ApplicationFilter();
|
filter = new ApplicationFilter();
|
||||||
|
|
@ -93,11 +100,15 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.ViewHolder> impl
|
||||||
if (info.packageName.equals(((ScopeAdapter) this).modulePackageName)) {
|
if (info.packageName.equals(((ScopeAdapter) this).modulePackageName)) {
|
||||||
rmList.add(info);
|
rmList.add(info);
|
||||||
}
|
}
|
||||||
} else if (!App.getPreferences().getBoolean("show_modules", true)) {
|
}
|
||||||
if (info.metaData != null && info.metaData.containsKey("xposedmodule") || AppHelper.FORCE_WHITE_LIST_MODULE.contains(info.packageName)) {
|
if (!preferences.getBoolean("show_modules", true)) {
|
||||||
|
if (info.metaData != null && info.metaData.containsKey("xposedmodule") || AppHelper.forceWhiteList.contains(info.packageName)) {
|
||||||
rmList.add(info);
|
rmList.add(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!preferences.getBoolean("show_system_apps", true) && (info.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
|
||||||
|
rmList.add(info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (rmList.size() > 0) {
|
if (rmList.size() > 0) {
|
||||||
fullList.removeAll(rmList);
|
fullList.removeAll(rmList);
|
||||||
|
|
@ -121,7 +132,7 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.ViewHolder> impl
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sortApps() {
|
private void sortApps() {
|
||||||
switch (App.getPreferences().getInt("list_sort", 0)) {
|
switch (preferences.getInt("list_sort", 0)) {
|
||||||
case 7:
|
case 7:
|
||||||
cmp = Collections.reverseOrder((ApplicationInfo a, ApplicationInfo b) -> {
|
cmp = Collections.reverseOrder((ApplicationInfo a, ApplicationInfo b) -> {
|
||||||
try {
|
try {
|
||||||
|
|
@ -190,6 +201,79 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.ViewHolder> impl
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||||
|
@SuppressLint("NonConstantResourceId")
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
int itemId = item.getItemId();
|
||||||
|
if (itemId == R.id.item_show_system) {
|
||||||
|
item.setChecked(!item.isChecked());
|
||||||
|
preferences.edit().putBoolean("show_system_apps", item.isChecked()).apply();
|
||||||
|
} else if (itemId == R.id.item_show_modules) {
|
||||||
|
item.setChecked(!item.isChecked());
|
||||||
|
preferences.edit().putBoolean("show_modules", item.isChecked()).apply();
|
||||||
|
} else if (itemId == R.id.item_sort_by_name) {
|
||||||
|
item.setChecked(true);
|
||||||
|
preferences.edit().putInt("list_sort", 0).apply();
|
||||||
|
} else if (itemId == R.id.item_sort_by_name_reverse) {
|
||||||
|
item.setChecked(true);
|
||||||
|
preferences.edit().putInt("list_sort", 1).apply();
|
||||||
|
} else if (itemId == R.id.item_sort_by_package_name) {
|
||||||
|
item.setChecked(true);
|
||||||
|
preferences.edit().putInt("list_sort", 2).apply();
|
||||||
|
} else if (itemId == R.id.item_sort_by_package_name_reverse) {
|
||||||
|
item.setChecked(true);
|
||||||
|
preferences.edit().putInt("list_sort", 3).apply();
|
||||||
|
} else if (itemId == R.id.item_sort_by_install_time) {
|
||||||
|
item.setChecked(true);
|
||||||
|
preferences.edit().putInt("list_sort", 4).apply();
|
||||||
|
} else if (itemId == R.id.item_sort_by_install_time_reverse) {
|
||||||
|
item.setChecked(true);
|
||||||
|
preferences.edit().putInt("list_sort", 5).apply();
|
||||||
|
} else if (itemId == R.id.item_sort_by_update_time) {
|
||||||
|
item.setChecked(true);
|
||||||
|
preferences.edit().putInt("list_sort", 6).apply();
|
||||||
|
} else if (itemId == R.id.item_sort_by_update_time_reverse) {
|
||||||
|
item.setChecked(true);
|
||||||
|
preferences.edit().putInt("list_sort", 7).apply();
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
refresh();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||||
|
inflater.inflate(R.menu.menu_app_list, menu);
|
||||||
|
menu.findItem(R.id.item_show_modules).setChecked(preferences.getBoolean("show_modules", true));
|
||||||
|
menu.findItem(R.id.item_show_system).setChecked(preferences.getBoolean("show_system_apps", true));
|
||||||
|
switch (preferences.getInt("list_sort", 0)) {
|
||||||
|
case 7:
|
||||||
|
menu.findItem(R.id.item_sort_by_update_time_reverse).setChecked(true);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
menu.findItem(R.id.item_sort_by_update_time).setChecked(true);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
menu.findItem(R.id.item_sort_by_install_time_reverse).setChecked(true);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
menu.findItem(R.id.item_sort_by_install_time).setChecked(true);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
menu.findItem(R.id.item_sort_by_package_name_reverse).setChecked(true);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
menu.findItem(R.id.item_sort_by_package_name).setChecked(true);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
menu.findItem(R.id.item_sort_by_name_reverse).setChecked(true);
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
menu.findItem(R.id.item_sort_by_name).setChecked(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||||
ApplicationInfo info = showList.get(position);
|
ApplicationInfo info = showList.get(position);
|
||||||
|
|
@ -255,6 +339,7 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.ViewHolder> impl
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
|
//noinspection deprecation
|
||||||
AsyncTask.THREAD_POOL_EXECUTOR.execute(this::loadApps);
|
AsyncTask.THREAD_POOL_EXECUTOR.execute(this::loadApps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ import androidx.appcompat.widget.PopupMenu;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
import org.meowcat.edxposed.manager.App;
|
import org.meowcat.edxposed.manager.App;
|
||||||
import org.meowcat.edxposed.manager.BuildConfig;
|
|
||||||
import org.meowcat.edxposed.manager.Constants;
|
import org.meowcat.edxposed.manager.Constants;
|
||||||
import org.meowcat.edxposed.manager.R;
|
import org.meowcat.edxposed.manager.R;
|
||||||
import org.meowcat.edxposed.manager.util.CompileUtil;
|
import org.meowcat.edxposed.manager.util.CompileUtil;
|
||||||
|
|
@ -30,7 +29,6 @@ import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
@ -45,8 +43,7 @@ public class AppHelper {
|
||||||
private static final String SCOPE_LIST_PATH = "conf/%s.conf";
|
private static final String SCOPE_LIST_PATH = "conf/%s.conf";
|
||||||
private static final String WHITE_LIST_MODE = "conf/usewhitelist";
|
private static final String WHITE_LIST_MODE = "conf/usewhitelist";
|
||||||
|
|
||||||
private static final List<String> FORCE_WHITE_LIST = new ArrayList<>(Collections.singletonList(BuildConfig.APPLICATION_ID));
|
public static List<String> forceWhiteList = new ArrayList<>();
|
||||||
public static List<String> FORCE_WHITE_LIST_MODULE = new ArrayList<>(FORCE_WHITE_LIST);
|
|
||||||
|
|
||||||
private static final HashMap<String, List<String>> scopeList = new HashMap<>();
|
private static final HashMap<String, List<String>> scopeList = new HashMap<>();
|
||||||
|
|
||||||
|
|
@ -64,7 +61,7 @@ public class AppHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean addBlackList(String packageName) {
|
private static boolean addBlackList(String packageName) {
|
||||||
if (FORCE_WHITE_LIST_MODULE.contains(packageName)) {
|
if (forceWhiteList.contains(packageName)) {
|
||||||
removeBlackList(packageName);
|
removeBlackList(packageName);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -72,7 +69,7 @@ public class AppHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean removeWhiteList(String packageName) {
|
private static boolean removeWhiteList(String packageName) {
|
||||||
if (FORCE_WHITE_LIST_MODULE.contains(packageName)) {
|
if (forceWhiteList.contains(packageName)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return whiteListFileName(packageName, false);
|
return whiteListFileName(packageName, false);
|
||||||
|
|
@ -94,7 +91,7 @@ public class AppHelper {
|
||||||
s.add(file1.getName());
|
s.add(file1.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (String pn : FORCE_WHITE_LIST_MODULE) {
|
for (String pn : forceWhiteList) {
|
||||||
if (s.contains(pn)) {
|
if (s.contains(pn)) {
|
||||||
s.remove(pn);
|
s.remove(pn);
|
||||||
removeBlackList(pn);
|
removeBlackList(pn);
|
||||||
|
|
@ -107,13 +104,13 @@ public class AppHelper {
|
||||||
File file = new File(BASE_PATH + WHITE_LIST_PATH);
|
File file = new File(BASE_PATH + WHITE_LIST_PATH);
|
||||||
File[] files = file.listFiles();
|
File[] files = file.listFiles();
|
||||||
if (files == null) {
|
if (files == null) {
|
||||||
return FORCE_WHITE_LIST_MODULE;
|
return forceWhiteList;
|
||||||
}
|
}
|
||||||
List<String> result = new ArrayList<>();
|
List<String> result = new ArrayList<>();
|
||||||
for (File file1 : files) {
|
for (File file1 : files) {
|
||||||
result.add(file1.getName());
|
result.add(file1.getName());
|
||||||
}
|
}
|
||||||
for (String pn : FORCE_WHITE_LIST_MODULE) {
|
for (String pn : forceWhiteList) {
|
||||||
if (!result.contains(pn)) {
|
if (!result.contains(pn)) {
|
||||||
result.add(pn);
|
result.add(pn);
|
||||||
addWhiteList(pn);
|
addWhiteList(pn);
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ public class BlackListAdapter extends AppAdapter {
|
||||||
if (App.getPreferences().getBoolean("hook_modules", true)) {
|
if (App.getPreferences().getBoolean("hook_modules", true)) {
|
||||||
Collection<ModuleUtil.InstalledModule> installedModules = ModuleUtil.getInstance().getModules().values();
|
Collection<ModuleUtil.InstalledModule> installedModules = ModuleUtil.getInstance().getModules().values();
|
||||||
for (ModuleUtil.InstalledModule info : installedModules) {
|
for (ModuleUtil.InstalledModule info : installedModules) {
|
||||||
AppHelper.FORCE_WHITE_LIST_MODULE.add(info.packageName);
|
AppHelper.forceWhiteList.add(info.packageName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AppHelper.makeSurePath();
|
AppHelper.makeSurePath();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package org.meowcat.edxposed.manager.ui.activity;
|
package org.meowcat.edxposed.manager.ui.activity;
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package org.meowcat.edxposed.manager.ui.activity;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
|
|
@ -42,6 +43,7 @@ public class BaseActivity extends AppCompatActivity {
|
||||||
private static final String THEME_DEFAULT = "DEFAULT";
|
private static final String THEME_DEFAULT = "DEFAULT";
|
||||||
private static final String THEME_BLACK = "BLACK";
|
private static final String THEME_BLACK = "BLACK";
|
||||||
private String theme;
|
private String theme;
|
||||||
|
protected SharedPreferences preferences;
|
||||||
|
|
||||||
public static boolean isBlackNightTheme() {
|
public static boolean isBlackNightTheme() {
|
||||||
return App.getPreferences().getBoolean("black_dark_theme", false) || App.getPreferences().getBoolean("md2", false);
|
return App.getPreferences().getBoolean("black_dark_theme", false) || App.getPreferences().getBoolean("md2", false);
|
||||||
|
|
@ -113,6 +115,7 @@ public class BaseActivity extends AppCompatActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
preferences = App.getPreferences();
|
||||||
AppCompatDelegate.setDefaultNightMode(App.getPreferences().getInt("theme", -1));
|
AppCompatDelegate.setDefaultNightMode(App.getPreferences().getInt("theme", -1));
|
||||||
theme = getTheme(this) + getCustomTheme() + App.getPreferences().getBoolean("md2", false);
|
theme = getTheme(this) + getCustomTheme() + App.getPreferences().getBoolean("md2", false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import android.content.pm.ApplicationInfo;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
@ -81,9 +82,17 @@ public class BlackListActivity extends BaseActivity implements AppAdapter.Callba
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||||
|
if (!appAdapter.onOptionsItemSelected(item)) {
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(@NonNull Menu menu) {
|
public boolean onCreateOptionsMenu(@NonNull Menu menu) {
|
||||||
getMenuInflater().inflate(R.menu.menu_app_list, menu);
|
appAdapter.onCreateOptionsMenu(menu, getMenuInflater());
|
||||||
searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
|
searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
|
||||||
searchView.setOnQueryTextListener(searchListener);
|
searchView.setOnQueryTextListener(searchListener);
|
||||||
return super.onCreateOptionsMenu(menu);
|
return super.onCreateOptionsMenu(menu);
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import android.content.pm.ApplicationInfo;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
@ -66,7 +67,7 @@ public class ModuleScopeActivity extends BaseActivity implements AppAdapter.Call
|
||||||
fastScrollerBuilder.build();
|
fastScrollerBuilder.build();
|
||||||
appAdapter.setCallback(this);
|
appAdapter.setCallback(this);
|
||||||
handler.postDelayed(runnable, 300);
|
handler.postDelayed(runnable, 300);
|
||||||
binding.swipeRefreshLayout.setOnRefreshListener(() -> appAdapter.refresh());
|
binding.swipeRefreshLayout.setOnRefreshListener(appAdapter::refresh);
|
||||||
|
|
||||||
searchListener = new SearchView.OnQueryTextListener() {
|
searchListener = new SearchView.OnQueryTextListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -83,14 +84,38 @@ public class ModuleScopeActivity extends BaseActivity implements AppAdapter.Call
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||||
|
if (!appAdapter.onOptionsItemSelected(item)) {
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(@NonNull Menu menu) {
|
public boolean onCreateOptionsMenu(@NonNull Menu menu) {
|
||||||
getMenuInflater().inflate(R.menu.menu_app_list, menu);
|
appAdapter.onCreateOptionsMenu(menu, getMenuInflater());
|
||||||
searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
|
searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
|
||||||
searchView.setOnQueryTextListener(searchListener);
|
searchView.setOnQueryTextListener(searchListener);
|
||||||
return super.onCreateOptionsMenu(menu);
|
return super.onCreateOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
changeTitle(isWhiteListMode());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void changeTitle(boolean isWhiteListMode) {
|
||||||
|
setTitle(isWhiteListMode ? R.string.title_white_list : R.string.title_black_list);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isWhiteListMode() {
|
||||||
|
return AppHelper.isWhiteListMode();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDataReady() {
|
public void onDataReady() {
|
||||||
handler.removeCallbacks(runnable);
|
handler.removeCallbacks(runnable);
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (App.getPreferences().getInt("list_sort", 0)) {
|
switch (preferences.getInt("list_sort", 0)) {
|
||||||
case 7:
|
case 7:
|
||||||
cmp = Collections.reverseOrder((ApplicationInfo a, ApplicationInfo b) -> {
|
cmp = Collections.reverseOrder((ApplicationInfo a, ApplicationInfo b) -> {
|
||||||
try {
|
try {
|
||||||
|
|
@ -197,7 +197,7 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
|
||||||
binding.recyclerView.setAdapter(adapter);
|
binding.recyclerView.setAdapter(adapter);
|
||||||
binding.recyclerView.setLayoutManager(new LinearLayoutManagerFix(this));
|
binding.recyclerView.setLayoutManager(new LinearLayoutManagerFix(this));
|
||||||
FastScrollerBuilder fastScrollerBuilder = new FastScrollerBuilder(binding.recyclerView);
|
FastScrollerBuilder fastScrollerBuilder = new FastScrollerBuilder(binding.recyclerView);
|
||||||
if (!App.getPreferences().getBoolean("md2", false)) {
|
if (!preferences.getBoolean("md2", false)) {
|
||||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(this,
|
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(this,
|
||||||
DividerItemDecoration.VERTICAL);
|
DividerItemDecoration.VERTICAL);
|
||||||
binding.recyclerView.addItemDecoration(dividerItemDecoration);
|
binding.recyclerView.addItemDecoration(dividerItemDecoration);
|
||||||
|
|
@ -279,24 +279,14 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}/* else if (requestCode == 44) {
|
|
||||||
if (data != null) {
|
|
||||||
Uri uri = data.getData();
|
|
||||||
if (uri != null) {
|
|
||||||
try {
|
|
||||||
importModules(uri);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||||
Intent intent;
|
Intent intent;
|
||||||
int itemId = item.getItemId();
|
int itemId = item.getItemId();
|
||||||
|
boolean reload = false;
|
||||||
if (itemId == R.id.export_enabled_modules) {
|
if (itemId == R.id.export_enabled_modules) {
|
||||||
if (ModuleUtil.getInstance().getEnabledModules().isEmpty()) {
|
if (ModuleUtil.getInstance().getEnabledModules().isEmpty()) {
|
||||||
Snackbar.make(binding.snackbar, R.string.no_enabled_modules, Snackbar.LENGTH_SHORT).show();
|
Snackbar.make(binding.snackbar, R.string.no_enabled_modules, Snackbar.LENGTH_SHORT).show();
|
||||||
|
|
@ -321,12 +311,42 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
|
||||||
intent.putExtra(Intent.EXTRA_TITLE, "installed_modules.list");
|
intent.putExtra(Intent.EXTRA_TITLE, "installed_modules.list");
|
||||||
startActivityForResult(intent, 43);
|
startActivityForResult(intent, 43);
|
||||||
return true;
|
return true;
|
||||||
} else if (itemId == R.id.import_installed_modules || itemId == R.id.import_enabled_modules) {
|
} else if (itemId == R.id.item_sort_by_name) {
|
||||||
intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
item.setChecked(true);
|
||||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
preferences.edit().putInt("list_sort", 0).apply();
|
||||||
intent.setType("*/*");
|
reload = true;
|
||||||
startActivityForResult(intent, 44);
|
} else if (itemId == R.id.item_sort_by_name_reverse) {
|
||||||
return true;
|
item.setChecked(true);
|
||||||
|
preferences.edit().putInt("list_sort", 1).apply();
|
||||||
|
reload = true;
|
||||||
|
} else if (itemId == R.id.item_sort_by_package_name) {
|
||||||
|
item.setChecked(true);
|
||||||
|
preferences.edit().putInt("list_sort", 2).apply();
|
||||||
|
reload = true;
|
||||||
|
} else if (itemId == R.id.item_sort_by_package_name_reverse) {
|
||||||
|
item.setChecked(true);
|
||||||
|
preferences.edit().putInt("list_sort", 3).apply();
|
||||||
|
reload = true;
|
||||||
|
} else if (itemId == R.id.item_sort_by_install_time) {
|
||||||
|
item.setChecked(true);
|
||||||
|
preferences.edit().putInt("list_sort", 4).apply();
|
||||||
|
reload = true;
|
||||||
|
} else if (itemId == R.id.item_sort_by_install_time_reverse) {
|
||||||
|
item.setChecked(true);
|
||||||
|
preferences.edit().putInt("list_sort", 5).apply();
|
||||||
|
reload = true;
|
||||||
|
} else if (itemId == R.id.item_sort_by_update_time) {
|
||||||
|
item.setChecked(true);
|
||||||
|
preferences.edit().putInt("list_sort", 6).apply();
|
||||||
|
reload = true;
|
||||||
|
} else if (itemId == R.id.item_sort_by_update_time_reverse) {
|
||||||
|
item.setChecked(true);
|
||||||
|
preferences.edit().putInt("list_sort", 7).apply();
|
||||||
|
reload = true;
|
||||||
|
}
|
||||||
|
if (reload) {
|
||||||
|
moduleUtil.updateModulesList(false, null);
|
||||||
|
reloadModules.run();
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
@ -593,31 +613,31 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
|
||||||
TextView warningText = holder.warningText;
|
TextView warningText = holder.warningText;
|
||||||
|
|
||||||
if (item.minVersion == 0) {
|
if (item.minVersion == 0) {
|
||||||
if (!App.getPreferences().getBoolean("skip_xposedminversion_check", false)) {
|
if (!preferences.getBoolean("skip_xposedminversion_check", false)) {
|
||||||
mSwitch.setEnabled(false);
|
mSwitch.setEnabled(false);
|
||||||
}
|
}
|
||||||
warningText.setText(getString(R.string.no_min_version_specified));
|
warningText.setText(getString(R.string.no_min_version_specified));
|
||||||
warningText.setVisibility(View.VISIBLE);
|
warningText.setVisibility(View.VISIBLE);
|
||||||
} else if (installedXposedVersion > 0 && item.minVersion > installedXposedVersion) {
|
} else if (installedXposedVersion > 0 && item.minVersion > installedXposedVersion) {
|
||||||
if (!App.getPreferences().getBoolean("skip_xposedminversion_check", false)) {
|
if (!preferences.getBoolean("skip_xposedminversion_check", false)) {
|
||||||
mSwitch.setEnabled(false);
|
mSwitch.setEnabled(false);
|
||||||
}
|
}
|
||||||
warningText.setText(String.format(getString(R.string.warning_xposed_min_version), item.minVersion));
|
warningText.setText(String.format(getString(R.string.warning_xposed_min_version), item.minVersion));
|
||||||
warningText.setVisibility(View.VISIBLE);
|
warningText.setVisibility(View.VISIBLE);
|
||||||
} else if (item.minVersion < ModuleUtil.MIN_MODULE_VERSION) {
|
} else if (item.minVersion < ModuleUtil.MIN_MODULE_VERSION) {
|
||||||
if (!App.getPreferences().getBoolean("skip_xposedminversion_check", false)) {
|
if (!preferences.getBoolean("skip_xposedminversion_check", false)) {
|
||||||
mSwitch.setEnabled(false);
|
mSwitch.setEnabled(false);
|
||||||
}
|
}
|
||||||
warningText.setText(String.format(getString(R.string.warning_min_version_too_low), item.minVersion, ModuleUtil.MIN_MODULE_VERSION));
|
warningText.setText(String.format(getString(R.string.warning_min_version_too_low), item.minVersion, ModuleUtil.MIN_MODULE_VERSION));
|
||||||
warningText.setVisibility(View.VISIBLE);
|
warningText.setVisibility(View.VISIBLE);
|
||||||
} else if (item.isInstalledOnExternalStorage()) {
|
} else if (item.isInstalledOnExternalStorage()) {
|
||||||
if (!App.getPreferences().getBoolean("skip_xposedminversion_check", false)) {
|
if (!preferences.getBoolean("skip_xposedminversion_check", false)) {
|
||||||
mSwitch.setEnabled(false);
|
mSwitch.setEnabled(false);
|
||||||
}
|
}
|
||||||
warningText.setText(getString(R.string.warning_installed_on_external_storage));
|
warningText.setText(getString(R.string.warning_installed_on_external_storage));
|
||||||
warningText.setVisibility(View.VISIBLE);
|
warningText.setVisibility(View.VISIBLE);
|
||||||
} else if (installedXposedVersion == 0 || (installedXposedVersion == -1)) {
|
} else if (installedXposedVersion == 0 || (installedXposedVersion == -1)) {
|
||||||
if (!App.getPreferences().getBoolean("skip_xposedminversion_check", false)) {
|
if (!preferences.getBoolean("skip_xposedminversion_check", false)) {
|
||||||
mSwitch.setEnabled(false);
|
mSwitch.setEnabled(false);
|
||||||
}
|
}
|
||||||
warningText.setText(getString(R.string.not_installed_no_lollipop));
|
warningText.setText(getString(R.string.not_installed_no_lollipop));
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,67 @@
|
||||||
android:id="@+id/menu_search"
|
android:id="@+id/menu_search"
|
||||||
android:title="@string/menuSearch"
|
android:title="@string/menuSearch"
|
||||||
app:actionViewClass="androidx.appcompat.widget.SearchView"
|
app:actionViewClass="androidx.appcompat.widget.SearchView"
|
||||||
app:showAsAction="always" />
|
app:showAsAction="ifRoom" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/item_show_system"
|
||||||
|
android:checkable="true"
|
||||||
|
android:checked="true"
|
||||||
|
android:title="@string/menu_show_system_apps" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/item_show_modules"
|
||||||
|
android:checkable="true"
|
||||||
|
android:checked="true"
|
||||||
|
android:title="@string/menu_show_modules" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/item_list_sort"
|
||||||
|
android:title="@string/list_sort"
|
||||||
|
app:showAsAction="never">
|
||||||
|
<menu>
|
||||||
|
<group android:checkableBehavior="single">
|
||||||
|
<item
|
||||||
|
android:id="@+id/item_sort_by_name"
|
||||||
|
android:checked="true"
|
||||||
|
android:title="@string/sort_by_name" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/item_sort_by_name_reverse"
|
||||||
|
android:title="@string/sort_by_name_reverse" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/item_sort_by_package_name"
|
||||||
|
android:title="@string/sort_by_package_name" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/item_sort_by_package_name_reverse"
|
||||||
|
android:title="@string/sort_by_package_name_reverse" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/item_sort_by_install_time"
|
||||||
|
android:title="@string/sort_by_install_time" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/item_sort_by_install_time_reverse"
|
||||||
|
android:title="@string/sort_by_install_time_reverse" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/item_sort_by_update_time"
|
||||||
|
android:title="@string/sort_by_update_time" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/item_sort_by_update_time_reverse"
|
||||||
|
android:title="@string/sort_by_update_time_reverse" />
|
||||||
|
</group>
|
||||||
|
</menu>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_optimize"
|
||||||
|
android:title="@string/menu_optimize"
|
||||||
|
app:showAsAction="never">
|
||||||
|
<menu>
|
||||||
|
<group>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/dexopt_all"
|
android:id="@+id/dexopt_all"
|
||||||
android:title="@string/dexopt_now"
|
android:title="@string/dexopt_now"
|
||||||
|
|
@ -16,6 +76,9 @@
|
||||||
android:id="@+id/speed_all"
|
android:id="@+id/speed_all"
|
||||||
android:title="@string/speed_now"
|
android:title="@string/speed_now"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
|
</group>
|
||||||
|
</menu>
|
||||||
|
</item>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:title="@string/reboot"
|
android:title="@string/reboot"
|
||||||
|
|
|
||||||
|
|
@ -24,17 +24,43 @@
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:title="@string/import_"
|
android:id="@+id/item_list_sort"
|
||||||
|
android:title="@string/list_sort"
|
||||||
app:showAsAction="never">
|
app:showAsAction="never">
|
||||||
<menu>
|
<menu>
|
||||||
|
<group android:checkableBehavior="single">
|
||||||
<item
|
<item
|
||||||
android:id="@+id/import_enabled_modules"
|
android:id="@+id/item_sort_by_name"
|
||||||
android:title="@string/import_enabled_modules"
|
android:checked="true"
|
||||||
app:showAsAction="never" />
|
android:title="@string/sort_by_name" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/import_installed_modules"
|
android:id="@+id/item_sort_by_name_reverse"
|
||||||
android:title="@string/import_installed_modules"
|
android:title="@string/sort_by_name_reverse" />
|
||||||
app:showAsAction="never" />
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/item_sort_by_package_name"
|
||||||
|
android:title="@string/sort_by_package_name" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/item_sort_by_package_name_reverse"
|
||||||
|
android:title="@string/sort_by_package_name_reverse" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/item_sort_by_install_time"
|
||||||
|
android:title="@string/sort_by_install_time" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/item_sort_by_install_time_reverse"
|
||||||
|
android:title="@string/sort_by_install_time_reverse" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/item_sort_by_update_time"
|
||||||
|
android:title="@string/sort_by_update_time" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/item_sort_by_update_time_reverse"
|
||||||
|
android:title="@string/sort_by_update_time_reverse" />
|
||||||
|
</group>
|
||||||
</menu>
|
</menu>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -316,4 +316,7 @@
|
||||||
<string name="settings_enable_resources">启用资源钩子</string>
|
<string name="settings_enable_resources">启用资源钩子</string>
|
||||||
<string name="settings_enable_resources_summary"><b>警告: </b> 资源钩子已被弃用</string>
|
<string name="settings_enable_resources_summary"><b>警告: </b> 资源钩子已被弃用</string>
|
||||||
<string name="settings_variant">变体</string>
|
<string name="settings_variant">变体</string>
|
||||||
|
<string name="menu_optimize">优化…</string>
|
||||||
|
<string name="menu_show_system_apps">系统应用</string>
|
||||||
|
<string name="menu_show_modules">模块</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
|
|
@ -345,4 +345,7 @@
|
||||||
<string name="enable_scope">Enable scope</string>
|
<string name="enable_scope">Enable scope</string>
|
||||||
<string name="scope_not_supported">The version of LSPosed you installed does not support module scope, download new version?</string>
|
<string name="scope_not_supported">The version of LSPosed you installed does not support module scope, download new version?</string>
|
||||||
<string name="settings_variant">Variant</string>
|
<string name="settings_variant">Variant</string>
|
||||||
|
<string name="menu_optimize">Optimize</string>
|
||||||
|
<string name="menu_show_system_apps">System apps</string>
|
||||||
|
<string name="menu_show_modules">Modules</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
|
|
@ -11,22 +11,6 @@
|
||||||
android:summary="@string/skip_xposedminversion_check_summ"
|
android:summary="@string/skip_xposedminversion_check_summ"
|
||||||
android:title="@string/skip_xposedminversion_check"
|
android:title="@string/skip_xposedminversion_check"
|
||||||
app:iconSpaceReserved="false" />
|
app:iconSpaceReserved="false" />
|
||||||
|
|
||||||
<SwitchPreferenceCompat
|
|
||||||
android:defaultValue="true"
|
|
||||||
android:key="show_modules"
|
|
||||||
android:summary="@string/show_modules_summary"
|
|
||||||
android:title="@string/show_modules"
|
|
||||||
app:iconSpaceReserved="false" />
|
|
||||||
|
|
||||||
<org.meowcat.edxposed.manager.ui.widget.IntegerListPreference
|
|
||||||
android:defaultValue="0"
|
|
||||||
android:entries="@array/list_sort_texts"
|
|
||||||
android:entryValues="@array/list_sort_values"
|
|
||||||
android:key="list_sort"
|
|
||||||
android:summary="%s"
|
|
||||||
android:title="@string/list_sort"
|
|
||||||
app:iconSpaceReserved="false" />
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:title="@string/settings_group_theme"
|
android:title="@string/settings_group_theme"
|
||||||
|
|
@ -68,7 +52,7 @@
|
||||||
android:title="@string/pure_black_dark_theme"
|
android:title="@string/pure_black_dark_theme"
|
||||||
app:iconSpaceReserved="false" />
|
app:iconSpaceReserved="false" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<!-- <PreferenceCategory
|
<!-- <PreferenceCategory
|
||||||
android:title="@string/settings_group_download"
|
android:title="@string/settings_group_download"
|
||||||
app:iconSpaceReserved="false">
|
app:iconSpaceReserved="false">
|
||||||
|
|
||||||
|
|
@ -109,7 +93,7 @@
|
||||||
app:iconSpaceReserved="false" />
|
app:iconSpaceReserved="false" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
-->
|
-->
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="group_framework"
|
android:key="group_framework"
|
||||||
android:title="@string/settings_group_framework"
|
android:title="@string/settings_group_framework"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue