Update naming convention as per review. Add antifeatures list length check to filter anti-feature apps.
This commit is contained in:
parent
1e95f57ef8
commit
632eeff611
@ -32,7 +32,7 @@ public class AppFilter {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (app.antiFeatures != null && Preferences.get().filterAppsWithAntiFeatures()) {
|
||||
if (app.antiFeatures != null && app.antiFeatures.length > 0 && Preferences.get().filterAppsWithAntiFeatures()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -49,7 +49,7 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
|
||||
public static final String PREF_UPD_NOTIFY = "updateNotify";
|
||||
public static final String PREF_UPD_HISTORY = "updateHistoryDays";
|
||||
public static final String PREF_ROOTED = "rooted";
|
||||
public static final String PREF_ANTI_FEATURE_APPS = "hideAntiFeatureApps";
|
||||
public static final String PREF_HIDE_ANTI_FEATURE_APPS = "hideAntiFeatureApps";
|
||||
public static final String PREF_INCOMP_VER = "incompatibleVersions";
|
||||
public static final String PREF_THEME = "theme";
|
||||
public static final String PREF_IGN_TOUCH = "ignoreTouchscreen";
|
||||
@ -69,7 +69,7 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
|
||||
public static final String PREF_POST_PRIVILEGED_INSTALL = "postPrivilegedInstall";
|
||||
|
||||
private static final boolean DEFAULT_ROOTED = true;
|
||||
private static final boolean DEFAULT_ANTI_FEATURE_APPS = false;
|
||||
private static final boolean DEFAULT_HIDE_ANTI_FEATURE_APPS = false;
|
||||
private static final int DEFAULT_UPD_HISTORY = 14;
|
||||
private static final boolean DEFAULT_PRIVILEGED_INSTALLER = true;
|
||||
//private static final boolean DEFAULT_LOCAL_REPO_BONJOUR = true;
|
||||
@ -94,7 +94,7 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
|
||||
}
|
||||
|
||||
private boolean filterAppsRequiringRoot = DEFAULT_ROOTED;
|
||||
private boolean filterAppsWithAntiFeatures = DEFAULT_ANTI_FEATURE_APPS;
|
||||
private boolean filterAppsWithAntiFeatures = DEFAULT_HIDE_ANTI_FEATURE_APPS;
|
||||
|
||||
private final Map<String, Boolean> initialized = new HashMap<>();
|
||||
|
||||
@ -308,12 +308,12 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
|
||||
* This is cached as it is called several times inside the AppListAdapter.
|
||||
* Providing it here means the shared preferences file only needs to be
|
||||
* read once, and we will keep our copy up to date by listening to changes
|
||||
* in PREF_ANTI_FEATURE_APPS.
|
||||
* in PREF_HIDE_ANTI_FEATURE_APPS.
|
||||
*/
|
||||
public boolean filterAppsWithAntiFeatures() {
|
||||
if (!isInitialized(PREF_ANTI_FEATURE_APPS)) {
|
||||
initialize(PREF_ANTI_FEATURE_APPS);
|
||||
filterAppsWithAntiFeatures = preferences.getBoolean(PREF_ANTI_FEATURE_APPS, DEFAULT_ANTI_FEATURE_APPS);
|
||||
if (!isInitialized(PREF_HIDE_ANTI_FEATURE_APPS)) {
|
||||
initialize(PREF_HIDE_ANTI_FEATURE_APPS);
|
||||
filterAppsWithAntiFeatures = preferences.getBoolean(PREF_HIDE_ANTI_FEATURE_APPS, DEFAULT_HIDE_ANTI_FEATURE_APPS);
|
||||
}
|
||||
return filterAppsWithAntiFeatures;
|
||||
}
|
||||
@ -353,7 +353,7 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
|
||||
listener.onPreferenceChange();
|
||||
}
|
||||
break;
|
||||
case PREF_ANTI_FEATURE_APPS:
|
||||
case PREF_HIDE_ANTI_FEATURE_APPS:
|
||||
for (ChangeListener listener : filterAppsRequiringAntiFeaturesListeners) {
|
||||
listener.onPreferenceChange();
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public class PreferencesFragment extends PreferenceFragment
|
||||
Preferences.PREF_UPD_NOTIFY,
|
||||
Preferences.PREF_UPD_HISTORY,
|
||||
Preferences.PREF_ROOTED,
|
||||
Preferences.PREF_ANTI_FEATURE_APPS,
|
||||
Preferences.PREF_HIDE_ANTI_FEATURE_APPS,
|
||||
Preferences.PREF_INCOMP_VER,
|
||||
Preferences.PREF_THEME,
|
||||
Preferences.PREF_IGN_TOUCH,
|
||||
@ -124,8 +124,8 @@ public class PreferencesFragment extends PreferenceFragment
|
||||
checkSummary(key, R.string.rooted_on);
|
||||
break;
|
||||
|
||||
case Preferences.PREF_ANTI_FEATURE_APPS:
|
||||
checkSummary(key, R.string.anti_feature_apps_on);
|
||||
case Preferences.PREF_HIDE_ANTI_FEATURE_APPS:
|
||||
checkSummary(key, R.string.hide_anti_feature_apps_on);
|
||||
break;
|
||||
|
||||
case Preferences.PREF_IGN_TOUCH:
|
||||
|
@ -148,8 +148,8 @@
|
||||
<string name="show_incompat_versions_on">Show app versions incompatible with the device</string>
|
||||
<string name="rooted">Ignore root</string>
|
||||
<string name="rooted_on">Do not grey out apps requiring root privileges</string>
|
||||
<string name="anti_feature_apps">Grey out anti-feature apps</string>
|
||||
<string name="anti_feature_apps_on">Grey out apps requiring anti-features</string>
|
||||
<string name="hide_anti_feature_apps">Grey out anti-feature apps</string>
|
||||
<string name="hide_anti_feature_apps_on">Grey out apps requiring anti-features</string>
|
||||
<string name="ignoreTouch">Ignore touchscreen</string>
|
||||
<string name="ignoreTouch_on">Always include apps that require touchscreen</string>
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
<CheckBoxPreference android:title="@string/rooted"
|
||||
android:defaultValue="true"
|
||||
android:key="rooted" />
|
||||
<CheckBoxPreference android:title="@string/anti_feature_apps"
|
||||
<CheckBoxPreference android:title="@string/hide_anti_feature_apps"
|
||||
android:defaultValue="false"
|
||||
android:key="hideAntiFeatureApps" />
|
||||
<CheckBoxPreference android:title="@string/ignoreTouch"
|
||||
|
Loading…
x
Reference in New Issue
Block a user