Add App.toUpdate as the filter result of App.hasUpdates (fixes #372)
This commit is contained in:
parent
458f163f7e
commit
78ba64c2ec
@ -583,7 +583,7 @@ public class AppDetails extends ListActivity {
|
|||||||
if (app == null)
|
if (app == null)
|
||||||
return true;
|
return true;
|
||||||
DB.Apk curver = app.getCurrentVersion();
|
DB.Apk curver = app.getCurrentVersion();
|
||||||
if (app.hasUpdates == true) {
|
if (app.toUpdate) {
|
||||||
MenuItemCompat.setShowAsAction(menu.add(
|
MenuItemCompat.setShowAsAction(menu.add(
|
||||||
Menu.NONE, INSTALL, 0, R.string.menu_update)
|
Menu.NONE, INSTALL, 0, R.string.menu_update)
|
||||||
.setIcon(R.drawable.ic_menu_refresh),
|
.setIcon(R.drawable.ic_menu_refresh),
|
||||||
|
@ -203,8 +203,7 @@ public class AppListManager {
|
|||||||
}
|
}
|
||||||
if (app.installedVersion != null) {
|
if (app.installedVersion != null) {
|
||||||
installedApps.addItem(app);
|
installedApps.addItem(app);
|
||||||
if (!app.ignoreUpdates && app.hasUpdates && !app.filtered
|
if (app.toUpdate)
|
||||||
&& (showIncompatible || app.compatible))
|
|
||||||
canUpgradeApps.addItem(app);
|
canUpgradeApps.addItem(app);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,6 +116,7 @@ public class DB {
|
|||||||
antiFeatures = null;
|
antiFeatures = null;
|
||||||
requirements = null;
|
requirements = null;
|
||||||
hasUpdates = false;
|
hasUpdates = false;
|
||||||
|
toUpdate = false;
|
||||||
updated = false;
|
updated = false;
|
||||||
added = null;
|
added = null;
|
||||||
lastUpdated = null;
|
lastUpdated = null;
|
||||||
@ -189,11 +190,14 @@ public class DB {
|
|||||||
// permission (set in the Settings page)
|
// permission (set in the Settings page)
|
||||||
public boolean filtered;
|
public boolean filtered;
|
||||||
|
|
||||||
// True if there are new versions (apks) that the user hasn't
|
// True if there are new versions (apks) available, regardless of
|
||||||
// explicitly ignored. (We're currently not using the database
|
// any filtering
|
||||||
// field for this - we make the decision on the fly in getApps().
|
|
||||||
public boolean hasUpdates;
|
public boolean hasUpdates;
|
||||||
|
|
||||||
|
// True if there are new versions (apks) available and the user wants
|
||||||
|
// to be notified about them
|
||||||
|
public boolean toUpdate;
|
||||||
|
|
||||||
// True if updates should not show up in the Updates tab for this
|
// True if updates should not show up in the Updates tab for this
|
||||||
// application
|
// application
|
||||||
public boolean ignoreUpdates;
|
public boolean ignoreUpdates;
|
||||||
|
@ -54,6 +54,7 @@ public class FDroidApp extends Application {
|
|||||||
// because the install intent says it's finished when it hasn't.
|
// because the install intent says it's finished when it hasn't.
|
||||||
SharedPreferences prefs = PreferenceManager
|
SharedPreferences prefs = PreferenceManager
|
||||||
.getDefaultSharedPreferences(getBaseContext());
|
.getDefaultSharedPreferences(getBaseContext());
|
||||||
|
showIncompatible = prefs.getBoolean("showIncompatible", false);
|
||||||
if (!prefs.getBoolean("cacheDownloaded", false)) {
|
if (!prefs.getBoolean("cacheDownloaded", false)) {
|
||||||
|
|
||||||
File local_path = DB.getDataPath(this);
|
File local_path = DB.getDataPath(this);
|
||||||
@ -100,6 +101,8 @@ public class FDroidApp extends Application {
|
|||||||
// Global list of all known applications.
|
// Global list of all known applications.
|
||||||
private List<DB.App> apps;
|
private List<DB.App> apps;
|
||||||
|
|
||||||
|
private boolean showIncompatible;
|
||||||
|
|
||||||
// Set when something has changed (database or installed apps) so we know
|
// Set when something has changed (database or installed apps) so we know
|
||||||
// we should invalidate the apps.
|
// we should invalidate the apps.
|
||||||
private volatile boolean appsAllInvalid = false;
|
private volatile boolean appsAllInvalid = false;
|
||||||
@ -195,6 +198,12 @@ public class FDroidApp extends Application {
|
|||||||
AppFilter appFilter = new AppFilter(ctx);
|
AppFilter appFilter = new AppFilter(ctx);
|
||||||
for (DB.App app : apps) {
|
for (DB.App app : apps) {
|
||||||
app.filtered = appFilter.filter(app);
|
app.filtered = appFilter.filter(app);
|
||||||
|
|
||||||
|
app.toUpdate = (
|
||||||
|
!app.ignoreUpdates
|
||||||
|
&& app.hasUpdates
|
||||||
|
&& !app.filtered
|
||||||
|
&& (showIncompatible || app.compatible));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
public int getNumUpdates(List<DB.App> apps) {
|
public int getNumUpdates(List<DB.App> apps) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (DB.App app : apps) {
|
for (DB.App app : apps) {
|
||||||
if (!app.ignoreUpdates && app.hasUpdates)
|
if (!app.toUpdate)
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
|
@ -94,7 +94,7 @@ abstract public class AppListAdapter extends BaseAdapter {
|
|||||||
iconInstalled.setImageResource(R.drawable.ic_cab_done_holo_dark);
|
iconInstalled.setImageResource(R.drawable.ic_cab_done_holo_dark);
|
||||||
iconUpdates.setImageResource(R.drawable.ic_menu_refresh);
|
iconUpdates.setImageResource(R.drawable.ic_menu_refresh);
|
||||||
|
|
||||||
if (app.hasUpdates && showStatusUpdate()) {
|
if (app.toUpdate && showStatusUpdate()) {
|
||||||
iconUpdates.setVisibility(View.VISIBLE);
|
iconUpdates.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
iconUpdates.setVisibility(View.GONE);
|
iconUpdates.setVisibility(View.GONE);
|
||||||
@ -152,7 +152,7 @@ abstract public class AppListAdapter extends BaseAdapter {
|
|||||||
StringBuilder version = new StringBuilder();
|
StringBuilder version = new StringBuilder();
|
||||||
if (app.installedVersion != null) {
|
if (app.installedVersion != null) {
|
||||||
version.append(app.installedVersion);
|
version.append(app.installedVersion);
|
||||||
if (app.hasUpdates) {
|
if (app.toUpdate) {
|
||||||
version.append(" -> ");
|
version.append(" -> ");
|
||||||
version.append(app.updateVersion);
|
version.append(app.updateVersion);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user