Let users know why blacklist PoGO and AP...
This commit is contained in:
parent
d9597549fd
commit
d30397e9c0
@ -29,13 +29,6 @@ import butterknife.Unbinder;
|
|||||||
|
|
||||||
public class MagiskHideFragment extends Fragment implements CallbackHandler.EventListener {
|
public class MagiskHideFragment extends Fragment implements CallbackHandler.EventListener {
|
||||||
|
|
||||||
public static final List<String> HIDEBLACKLIST = Arrays.asList(
|
|
||||||
"android",
|
|
||||||
"com.topjohnwu.magisk",
|
|
||||||
"com.google.android.gms",
|
|
||||||
"com.google.android.apps.walletnfcrel",
|
|
||||||
"com.nianticlabs.pokemongo"
|
|
||||||
);
|
|
||||||
private Unbinder unbinder;
|
private Unbinder unbinder;
|
||||||
@BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout;
|
@BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout;
|
||||||
@BindView(R.id.recyclerView) RecyclerView recyclerView;
|
@BindView(R.id.recyclerView) RecyclerView recyclerView;
|
||||||
|
@ -2,6 +2,7 @@ package com.topjohnwu.magisk.adapters;
|
|||||||
|
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.support.design.widget.Snackbar;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -16,6 +17,7 @@ import com.topjohnwu.magisk.utils.Async;
|
|||||||
import com.topjohnwu.magisk.utils.Utils;
|
import com.topjohnwu.magisk.utils.Utils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -24,6 +26,17 @@ import butterknife.ButterKnife;
|
|||||||
|
|
||||||
public class ApplicationAdapter extends RecyclerView.Adapter<ApplicationAdapter.ViewHolder> {
|
public class ApplicationAdapter extends RecyclerView.Adapter<ApplicationAdapter.ViewHolder> {
|
||||||
|
|
||||||
|
public static final List<String> BLACKLIST = Arrays.asList(
|
||||||
|
"android",
|
||||||
|
"com.topjohnwu.magisk",
|
||||||
|
"com.google.android.gms"
|
||||||
|
);
|
||||||
|
|
||||||
|
private static final List<String> SNLIST = Arrays.asList(
|
||||||
|
"com.google.android.apps.walletnfcrel",
|
||||||
|
"com.nianticlabs.pokemongo"
|
||||||
|
);
|
||||||
|
|
||||||
private List<ApplicationInfo> mOriginalList, mList;
|
private List<ApplicationInfo> mOriginalList, mList;
|
||||||
private List<String> mHideList;
|
private List<String> mHideList;
|
||||||
private PackageManager packageManager;
|
private PackageManager packageManager;
|
||||||
@ -33,6 +46,7 @@ public class ApplicationAdapter extends RecyclerView.Adapter<ApplicationAdapter.
|
|||||||
mOriginalList = mList = Collections.emptyList();
|
mOriginalList = mList = Collections.emptyList();
|
||||||
mHideList = Collections.emptyList();
|
mHideList = Collections.emptyList();
|
||||||
this.packageManager = packageManager;
|
this.packageManager = packageManager;
|
||||||
|
filter = new ApplicationFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLists(List<ApplicationInfo> listApps, List<String> hideList) {
|
public void setLists(List<ApplicationInfo> listApps, List<String> hideList) {
|
||||||
@ -55,17 +69,28 @@ public class ApplicationAdapter extends RecyclerView.Adapter<ApplicationAdapter.
|
|||||||
holder.appName.setText(info.loadLabel(packageManager));
|
holder.appName.setText(info.loadLabel(packageManager));
|
||||||
holder.appPackage.setText(info.packageName);
|
holder.appPackage.setText(info.packageName);
|
||||||
|
|
||||||
|
// Remove all listeners
|
||||||
|
holder.itemView.setOnClickListener(null);
|
||||||
holder.checkBox.setOnCheckedChangeListener(null);
|
holder.checkBox.setOnCheckedChangeListener(null);
|
||||||
holder.checkBox.setChecked(mHideList.contains(info.packageName));
|
|
||||||
holder.checkBox.setOnCheckedChangeListener((v, isChecked) -> {
|
if (SNLIST.contains(info.packageName)) {
|
||||||
if (isChecked) {
|
holder.checkBox.setChecked(true);
|
||||||
new Async.MagiskHide().add(info.packageName);
|
holder.checkBox.setEnabled(false);
|
||||||
mHideList.add(info.packageName);
|
holder.itemView.setOnClickListener(v ->
|
||||||
} else {
|
Snackbar.make(holder.itemView, R.string.safetyNet_hide_notice, Snackbar.LENGTH_LONG).show());
|
||||||
new Async.MagiskHide().rm(info.packageName);
|
} else {
|
||||||
mHideList.remove(info.packageName);
|
holder.checkBox.setEnabled(true);
|
||||||
}
|
holder.checkBox.setChecked(mHideList.contains(info.packageName));
|
||||||
});
|
holder.checkBox.setOnCheckedChangeListener((v, isChecked) -> {
|
||||||
|
if (isChecked) {
|
||||||
|
new Async.MagiskHide().add(info.packageName);
|
||||||
|
mHideList.add(info.packageName);
|
||||||
|
} else {
|
||||||
|
new Async.MagiskHide().rm(info.packageName);
|
||||||
|
mHideList.remove(info.packageName);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -74,9 +99,6 @@ public class ApplicationAdapter extends RecyclerView.Adapter<ApplicationAdapter.
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void filter(String constraint) {
|
public void filter(String constraint) {
|
||||||
if (filter == null) {
|
|
||||||
filter = new ApplicationFilter();
|
|
||||||
}
|
|
||||||
filter.filter(constraint);
|
filter.filter(constraint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ import android.widget.Toast;
|
|||||||
import com.topjohnwu.magisk.Global;
|
import com.topjohnwu.magisk.Global;
|
||||||
import com.topjohnwu.magisk.MagiskHideFragment;
|
import com.topjohnwu.magisk.MagiskHideFragment;
|
||||||
import com.topjohnwu.magisk.R;
|
import com.topjohnwu.magisk.R;
|
||||||
|
import com.topjohnwu.magisk.adapters.ApplicationAdapter;
|
||||||
import com.topjohnwu.magisk.module.ModuleHelper;
|
import com.topjohnwu.magisk.module.ModuleHelper;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
@ -127,7 +128,7 @@ public class Async {
|
|||||||
List<ApplicationInfo> listApps = pm.getInstalledApplications(PackageManager.GET_META_DATA);
|
List<ApplicationInfo> listApps = pm.getInstalledApplications(PackageManager.GET_META_DATA);
|
||||||
for (Iterator<ApplicationInfo> i = listApps.iterator(); i.hasNext(); ) {
|
for (Iterator<ApplicationInfo> i = listApps.iterator(); i.hasNext(); ) {
|
||||||
ApplicationInfo info = i.next();
|
ApplicationInfo info = i.next();
|
||||||
if (MagiskHideFragment.HIDEBLACKLIST.contains(info.packageName) || !info.enabled)
|
if (ApplicationAdapter.BLACKLIST.contains(info.packageName) || !info.enabled)
|
||||||
i.remove();
|
i.remove();
|
||||||
}
|
}
|
||||||
Collections.sort(listApps, (a, b) -> a.loadLabel(pm).toString().toLowerCase()
|
Collections.sort(listApps, (a, b) -> a.loadLabel(pm).toString().toLowerCase()
|
||||||
|
@ -113,6 +113,7 @@
|
|||||||
<string name="settings_reboot_toast">Reboot to apply settings</string>
|
<string name="settings_reboot_toast">Reboot to apply settings</string>
|
||||||
<string name="check_release_notes">Check release notes</string>
|
<string name="check_release_notes">Check release notes</string>
|
||||||
<string name="repo_cache_cleared">Repo cache cleared</string>
|
<string name="repo_cache_cleared">Repo cache cleared</string>
|
||||||
|
<string name="safetyNet_hide_notice">This app uses SafetyNet\nAlready handled by MagiskHide by default</string>
|
||||||
|
|
||||||
<!--URL Templates-->
|
<!--URL Templates-->
|
||||||
<string name="url_main" translatable="false">https://api.github.com/orgs/Magisk-Modules-Repo/repos</string>
|
<string name="url_main" translatable="false">https://api.github.com/orgs/Magisk-Modules-Repo/repos</string>
|
||||||
@ -153,8 +154,6 @@
|
|||||||
<string name="settings_shell_logging_title">Enable shell command debug logging</string>
|
<string name="settings_shell_logging_title">Enable shell command debug logging</string>
|
||||||
<string name="settings_shell_logging_summary">Check this to enable logging all shell commands and its output</string>
|
<string name="settings_shell_logging_summary">Check this to enable logging all shell commands and its output</string>
|
||||||
|
|
||||||
<!-- Themes -->
|
|
||||||
|
|
||||||
<!--Superuser-->
|
<!--Superuser-->
|
||||||
<string name="su_request_title">Superuser Request</string>
|
<string name="su_request_title">Superuser Request</string>
|
||||||
<string name="deny_with_str">Deny%1$s</string>
|
<string name="deny_with_str">Deny%1$s</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user