Always keep incompatible apps in the DB
Show them under the following circumstances: 1) If showIncompatible is true, show all incompatible apps/apks always 2) Installed tab, Searches and direct links will always show incompatible apps, but NOT apks TODO: onResume should repopulate all lists. And it seems to, lists are reloaded. But the updates don't take effect and so restart is required for a change in showIncompatible to take effect.
This commit is contained in:
parent
19583c2b75
commit
4109bb270d
@ -243,6 +243,7 @@ public class AppDetails extends ListActivity {
|
|||||||
|
|
||||||
private boolean pref_expert;
|
private boolean pref_expert;
|
||||||
private boolean pref_permissions;
|
private boolean pref_permissions;
|
||||||
|
private boolean pref_incompatible;
|
||||||
private boolean resetRequired;
|
private boolean resetRequired;
|
||||||
|
|
||||||
// The signature of the installed version.
|
// The signature of the installed version.
|
||||||
@ -263,6 +264,7 @@ public class AppDetails extends ListActivity {
|
|||||||
.getDefaultSharedPreferences(getBaseContext());
|
.getDefaultSharedPreferences(getBaseContext());
|
||||||
pref_expert = prefs.getBoolean("expert", false);
|
pref_expert = prefs.getBoolean("expert", false);
|
||||||
pref_permissions = prefs.getBoolean("showPermissions", false);
|
pref_permissions = prefs.getBoolean("showPermissions", false);
|
||||||
|
pref_incompatible = prefs.getBoolean("showIncompatible", false);
|
||||||
updateViews();
|
updateViews();
|
||||||
|
|
||||||
MenuManager.create(this).invalidateOptionsMenu();
|
MenuManager.create(this).invalidateOptionsMenu();
|
||||||
@ -375,7 +377,8 @@ public class AppDetails extends ListActivity {
|
|||||||
// Populate the list...
|
// Populate the list...
|
||||||
ApkListAdapter la = (ApkListAdapter) getListAdapter();
|
ApkListAdapter la = (ApkListAdapter) getListAdapter();
|
||||||
for (DB.Apk apk : app.apks)
|
for (DB.Apk apk : app.apks)
|
||||||
la.addItem(apk);
|
if (pref_incompatible || apk.compatible)
|
||||||
|
la.addItem(apk);
|
||||||
la.notifyDataSetChanged();
|
la.notifyDataSetChanged();
|
||||||
|
|
||||||
// Insert the 'infoView' (which contains the summary, various odds and
|
// Insert the 'infoView' (which contains the summary, various odds and
|
||||||
|
@ -178,6 +178,9 @@ public class AppListManager {
|
|||||||
private boolean updateApps() {
|
private boolean updateApps() {
|
||||||
|
|
||||||
allApps = ((FDroidApp)fdroidActivity.getApplication()).getApps();
|
allApps = ((FDroidApp)fdroidActivity.getApplication()).getApps();
|
||||||
|
SharedPreferences prefs = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(fdroidActivity.getBaseContext());
|
||||||
|
boolean showIncompatible = prefs.getBoolean("showIncompatible", false);
|
||||||
|
|
||||||
if (allApps.isEmpty()) {
|
if (allApps.isEmpty()) {
|
||||||
// If its the first time we've run the app, this should update
|
// If its the first time we've run the app, this should update
|
||||||
@ -197,11 +200,14 @@ public class AppListManager {
|
|||||||
|
|
||||||
// Add it to the list(s). Always to installed and updates, but
|
// Add it to the list(s). Always to installed and updates, but
|
||||||
// only to available if it's not filtered.
|
// only to available if it's not filtered.
|
||||||
if (!isFiltered && isInCategory)
|
if (!isFiltered && isInCategory) {
|
||||||
availApps.add(app);
|
if (showIncompatible || app.compatible) {
|
||||||
|
availApps.add(app);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (app.installedVersion != null) {
|
if (app.installedVersion != null) {
|
||||||
installedApps.addItem(app);
|
installedApps.addItem(app);
|
||||||
if (app.hasUpdates)
|
if (app.hasUpdates && (showIncompatible || app.compatible))
|
||||||
canUpgradeApps.addItem(app);
|
canUpgradeApps.addItem(app);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1153,27 +1153,15 @@ public class DB {
|
|||||||
if (compatChecker == null)
|
if (compatChecker == null)
|
||||||
compatChecker = Apk.CompatibilityChecker.getChecker(mContext);
|
compatChecker = Apk.CompatibilityChecker.getChecker(mContext);
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager
|
|
||||||
.getDefaultSharedPreferences(mContext);
|
|
||||||
boolean prefCompat = prefs.getBoolean("showIncompatible", false);
|
|
||||||
|
|
||||||
// See if it's compatible (by which we mean if it has at least one
|
// See if it's compatible (by which we mean if it has at least one
|
||||||
// compatible apk - if it's not, leave it out)
|
// compatible apk)
|
||||||
// Also keep a list of which were compatible, because they're the
|
upapp.compatible = false;
|
||||||
// only ones we'll add, unless the showIncompatible preference is set.
|
|
||||||
List<Apk> compatibleapks = new ArrayList<Apk>();
|
|
||||||
for (Apk apk : upapp.apks) {
|
for (Apk apk : upapp.apks) {
|
||||||
if (compatChecker.isCompatible(apk)) {
|
if (compatChecker.isCompatible(apk)) {
|
||||||
apk.compatible = true;
|
apk.compatible = true;
|
||||||
compatibleapks.add(apk);
|
upapp.compatible = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (compatibleapks.size() > 0)
|
|
||||||
upapp.compatible = true;
|
|
||||||
if (prefCompat)
|
|
||||||
compatibleapks = upapp.apks;
|
|
||||||
if (compatibleapks.size() == 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for (App app : updateApps) {
|
for (App app : updateApps) {
|
||||||
@ -1181,7 +1169,7 @@ public class DB {
|
|||||||
updateApp(app, upapp);
|
updateApp(app, upapp);
|
||||||
app.updated = true;
|
app.updated = true;
|
||||||
found = true;
|
found = true;
|
||||||
for (Apk upapk : compatibleapks) {
|
for (Apk upapk : upapp.apks) {
|
||||||
boolean afound = false;
|
boolean afound = false;
|
||||||
for (Apk apk : app.apks) {
|
for (Apk apk : app.apks) {
|
||||||
if (apk.vercode == upapk.vercode) {
|
if (apk.vercode == upapk.vercode) {
|
||||||
@ -1206,7 +1194,7 @@ public class DB {
|
|||||||
if (!found) {
|
if (!found) {
|
||||||
// It's a brand new application...
|
// It's a brand new application...
|
||||||
updateApp(null, upapp);
|
updateApp(null, upapp);
|
||||||
for (Apk upapk : compatibleapks) {
|
for (Apk upapk : upapp.apks) {
|
||||||
updateApkIfDifferent(null, upapk);
|
updateApkIfDifferent(null, upapk);
|
||||||
upapk.updated = true;
|
upapk.updated = true;
|
||||||
}
|
}
|
||||||
|
@ -255,8 +255,6 @@ public class FDroid extends FragmentActivity {
|
|||||||
finish();
|
finish();
|
||||||
overridePendingTransition(0, 0);
|
overridePendingTransition(0, 0);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} else {
|
|
||||||
repopulateViews();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -35,7 +35,6 @@ public class PreferencesActivity extends PreferenceActivity implements
|
|||||||
|
|
||||||
|
|
||||||
private boolean ignoreTouchscreenChanged = false;
|
private boolean ignoreTouchscreenChanged = false;
|
||||||
private boolean showIncompatibleChanged = false;
|
|
||||||
private boolean lightThemeChanged = false;
|
private boolean lightThemeChanged = false;
|
||||||
|
|
||||||
Intent ret;
|
Intent ret;
|
||||||
@ -51,7 +50,7 @@ public class PreferencesActivity extends PreferenceActivity implements
|
|||||||
ActionBarCompat.create(this).setDisplayHomeAsUpEnabled(true);
|
ActionBarCompat.create(this).setDisplayHomeAsUpEnabled(true);
|
||||||
addPreferencesFromResource(R.xml.preferences);
|
addPreferencesFromResource(R.xml.preferences);
|
||||||
for (String prefkey : new String[] { "ignoreTouchscreen",
|
for (String prefkey : new String[] { "ignoreTouchscreen",
|
||||||
"showIncompatible", "lightTheme" }) {
|
"lightTheme" }) {
|
||||||
Preference pref = findPreference(prefkey);
|
Preference pref = findPreference(prefkey);
|
||||||
pref.setOnPreferenceClickListener(this);
|
pref.setOnPreferenceClickListener(this);
|
||||||
}
|
}
|
||||||
@ -63,14 +62,12 @@ public class PreferencesActivity extends PreferenceActivity implements
|
|||||||
String key = preference.getKey();
|
String key = preference.getKey();
|
||||||
if (key.equals("ignoreTouchscreen"))
|
if (key.equals("ignoreTouchscreen"))
|
||||||
ignoreTouchscreenChanged ^= true;
|
ignoreTouchscreenChanged ^= true;
|
||||||
else if (key.equals("showIncompatible"))
|
|
||||||
showIncompatibleChanged ^= true;
|
|
||||||
else
|
else
|
||||||
lightThemeChanged ^= true;
|
lightThemeChanged ^= true;
|
||||||
|
|
||||||
if (lightThemeChanged)
|
if (lightThemeChanged)
|
||||||
ret.putExtra("restart", true);
|
ret.putExtra("restart", true);
|
||||||
else if (ignoreTouchscreenChanged || showIncompatibleChanged)
|
else if (ignoreTouchscreenChanged)
|
||||||
ret.putExtra("update", true);
|
ret.putExtra("update", true);
|
||||||
|
|
||||||
setResult(RESULT_OK, ret);
|
setResult(RESULT_OK, ret);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user