Don't remove apps from scope list if it's filtered
This commit is contained in:
parent
d2ea64d10a
commit
4069effea8
|
|
@ -47,7 +47,7 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.ViewHolder> impl
|
|||
protected AppListActivity activity;
|
||||
protected List<PackageInfo> fullList, showList;
|
||||
private final DateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
|
||||
public List<String> checkedList;
|
||||
private List<String> checkedList;
|
||||
private final PackageManager pm;
|
||||
private final ApplicationFilter filter;
|
||||
private final SharedPreferences preferences;
|
||||
|
|
|
|||
|
|
@ -139,10 +139,10 @@ public class AppHelper {
|
|||
});
|
||||
appMenu.show();
|
||||
}
|
||||
|
||||
|
||||
public static boolean onOptionsItemSelected(MenuItem item, SharedPreferences preferences) {
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == R.id.item_sort_by_name) {
|
||||
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) {
|
||||
|
|
@ -167,9 +167,9 @@ public class AppHelper {
|
|||
item.setChecked(true);
|
||||
preferences.edit().putInt("list_sort", 7).apply();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static Comparator<PackageInfo> getAppListComparator(int sort, PackageManager pm) {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
package io.github.lsposed.manager.adapters;
|
||||
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.util.Log;
|
||||
import android.widget.CompoundButton;
|
||||
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.github.lsposed.manager.R;
|
||||
|
|
@ -28,7 +25,6 @@ public class ScopeAdapter extends AppAdapter {
|
|||
masterSwitch.setOnCheckedChangedListener(new MasterSwitch.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(boolean checked) {
|
||||
Log.e("Test", checked + "");
|
||||
enabled = checked;
|
||||
ModuleUtil.getInstance().setModuleEnabled(modulePackageName, enabled);
|
||||
notifyDataSetChanged();
|
||||
|
|
@ -39,13 +35,7 @@ public class ScopeAdapter extends AppAdapter {
|
|||
@Override
|
||||
public List<String> generateCheckedList() {
|
||||
AppHelper.makeSurePath();
|
||||
List<String> scopeList = AppHelper.getScopeList(modulePackageName);
|
||||
List<String> list = new ArrayList<>();
|
||||
for (PackageInfo info : fullList) {
|
||||
list.add(info.packageName);
|
||||
}
|
||||
scopeList.retainAll(list);
|
||||
checkedList = scopeList;
|
||||
checkedList = AppHelper.getScopeList(modulePackageName);
|
||||
enabled = ModuleUtil.getInstance().isModuleEnabled(modulePackageName);
|
||||
activity.runOnUiThread(() -> masterSwitch.setChecked(enabled));
|
||||
return checkedList;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import com.google.android.material.snackbar.Snackbar;
|
|||
|
||||
import io.github.lsposed.manager.R;
|
||||
import io.github.lsposed.manager.adapters.AppAdapter;
|
||||
import io.github.lsposed.manager.adapters.AppHelper;
|
||||
import io.github.lsposed.manager.adapters.ScopeAdapter;
|
||||
import io.github.lsposed.manager.adapters.WhiteListAdapter;
|
||||
import io.github.lsposed.manager.databinding.ActivityAppListBinding;
|
||||
|
|
@ -120,7 +121,7 @@ public class AppListActivity extends BaseActivity {
|
|||
@Override
|
||||
public void onBackPressed() {
|
||||
if (searchView.isIconified()) {
|
||||
if (binding.masterSwitch.isChecked() && appAdapter.checkedList.isEmpty()) {
|
||||
if (binding.masterSwitch.isChecked() && AppHelper.getScopeList(modulePackageName).isEmpty()) {
|
||||
new MaterialAlertDialogBuilder(this)
|
||||
.setMessage(R.string.no_scope_selected)
|
||||
.setPositiveButton(android.R.string.cancel, null)
|
||||
|
|
|
|||
Loading…
Reference in New Issue