diff --git a/res/values/strings.xml b/res/values/strings.xml
index b65709d23..41d12eef6 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -116,6 +116,7 @@
Share
Install
Uninstall
+ Ignore Updates
Website
Issues
Source Code
diff --git a/src/org/fdroid/fdroid/AppDetails.java b/src/org/fdroid/fdroid/AppDetails.java
index d89b980d4..fce61639c 100644
--- a/src/org/fdroid/fdroid/AppDetails.java
+++ b/src/org/fdroid/fdroid/AppDetails.java
@@ -158,15 +158,16 @@ public class AppDetails extends ListActivity {
private static final int INSTALL = Menu.FIRST;
private static final int UNINSTALL = Menu.FIRST + 1;
- private static final int WEBSITE = Menu.FIRST + 2;
- private static final int ISSUES = Menu.FIRST + 3;
- private static final int SOURCE = Menu.FIRST + 4;
- private static final int MARKET = Menu.FIRST + 5;
- private static final int BITCOIN = Menu.FIRST + 6;
- private static final int FLATTR = Menu.FIRST + 7;
- private static final int DONATE = Menu.FIRST + 8;
- private static final int LAUNCH = Menu.FIRST + 9;
- private static final int SHARE = Menu.FIRST + 10;
+ private static final int IGNORE = Menu.FIRST + 2;
+ private static final int WEBSITE = Menu.FIRST + 3;
+ private static final int ISSUES = Menu.FIRST + 4;
+ private static final int SOURCE = Menu.FIRST + 5;
+ private static final int MARKET = Menu.FIRST + 6;
+ private static final int BITCOIN = Menu.FIRST + 7;
+ private static final int FLATTR = Menu.FIRST + 8;
+ private static final int DONATE = Menu.FIRST + 9;
+ private static final int LAUNCH = Menu.FIRST + 10;
+ private static final int SHARE = Menu.FIRST + 11;
private DB.App app;
private int app_currentvercode;
@@ -175,6 +176,7 @@ public class AppDetails extends ListActivity {
private PackageManager mPm;
private DownloadHandler downloadHandler;
private boolean stateRetained;
+ private boolean ignoreToggled;
LinearLayout headerView;
View infoView;
@@ -244,6 +246,8 @@ public class AppDetails extends ListActivity {
pref_permissions = prefs.getBoolean("showPermissions", false);
pref_incompatible = prefs.getBoolean("showIncompatible", false);
+ ignoreToggled = false;
+
startViews();
}
@@ -607,36 +611,42 @@ public class AppDetails extends ListActivity {
MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
}
}
+
MenuItemCompat.setShowAsAction(menu.add(
Menu.NONE, SHARE, 1, R.string.menu_share)
.setIcon(android.R.drawable.ic_menu_share),
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM |
MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
+ menu.add(Menu.NONE, IGNORE, 2, R.string.menu_ignore)
+ .setIcon(android.R.drawable.ic_menu_add)
+ .setCheckable(true)
+ .setChecked(app.ignoreUpdates);
+
if (app.detail_webURL.length() > 0) {
- menu.add(Menu.NONE, WEBSITE, 2, R.string.menu_website).setIcon(
+ menu.add(Menu.NONE, WEBSITE, 3, R.string.menu_website).setIcon(
android.R.drawable.ic_menu_view);
}
if (app.detail_trackerURL.length() > 0) {
- menu.add(Menu.NONE, ISSUES, 3, R.string.menu_issues).setIcon(
+ menu.add(Menu.NONE, ISSUES, 4, R.string.menu_issues).setIcon(
android.R.drawable.ic_menu_view);
}
if (app.detail_sourceURL.length() > 0) {
- menu.add(Menu.NONE, SOURCE, 4, R.string.menu_source).setIcon(
+ menu.add(Menu.NONE, SOURCE, 5, R.string.menu_source).setIcon(
android.R.drawable.ic_menu_view);
}
- menu.add(Menu.NONE, MARKET, 5, R.string.menu_market).setIcon(
+ menu.add(Menu.NONE, MARKET, 6, R.string.menu_market).setIcon(
android.R.drawable.ic_menu_view);
if (app.detail_bitcoinAddr != null) {
- menu.add(Menu.NONE, BITCOIN, 6, R.string.menu_bitcoin).setIcon(
+ menu.add(Menu.NONE, BITCOIN, 7, R.string.menu_bitcoin).setIcon(
android.R.drawable.ic_menu_view);
}
if (app.detail_flattrID != null) {
- menu.add(Menu.NONE, FLATTR, 7, R.string.menu_flattr).setIcon(
+ menu.add(Menu.NONE, FLATTR, 8, R.string.menu_flattr).setIcon(
android.R.drawable.ic_menu_view);
}
if (app.detail_donateURL != null) {
- menu.add(Menu.NONE, DONATE, 8, R.string.menu_donate).setIcon(
+ menu.add(Menu.NONE, DONATE, 9, R.string.menu_donate).setIcon(
android.R.drawable.ic_menu_view);
}
@@ -678,6 +688,12 @@ public class AppDetails extends ListActivity {
removeApk(app.id);
return true;
+ case IGNORE:
+ app.ignoreUpdates ^= true;
+ item.setChecked(app.ignoreUpdates);
+ ignoreToggled ^= true;
+ return true;
+
case WEBSITE:
tryOpenUri(app.detail_webURL);
return true;
@@ -950,4 +966,17 @@ public class AppDetails extends ListActivity {
}
}
+ @Override
+ public void finish() {
+ if (ignoreToggled) {
+ try {
+ DB db = DB.getDB();
+ db.toggleIgnoreUpdates(app.id);
+ } finally {
+ DB.releaseDB();
+ }
+ }
+ super.finish();
+ }
+
}
diff --git a/src/org/fdroid/fdroid/AppListManager.java b/src/org/fdroid/fdroid/AppListManager.java
index 53fe35707..c83b6e01e 100644
--- a/src/org/fdroid/fdroid/AppListManager.java
+++ b/src/org/fdroid/fdroid/AppListManager.java
@@ -207,7 +207,8 @@ public class AppListManager {
}
if (app.installedVersion != null) {
installedApps.addItem(app);
- if (app.hasUpdates && (showIncompatible || app.compatible))
+ if (!app.ignoreUpdates && app.hasUpdates &&
+ (showIncompatible || app.compatible))
canUpgradeApps.addItem(app);
}
}
diff --git a/src/org/fdroid/fdroid/DB.java b/src/org/fdroid/fdroid/DB.java
index 25560fc4c..7e19e5078 100644
--- a/src/org/fdroid/fdroid/DB.java
+++ b/src/org/fdroid/fdroid/DB.java
@@ -98,7 +98,7 @@ public class DB {
+ "bitcoinAddr string," + "flattrID string,"
+ "requirements string," + "category string," + "added string,"
+ "lastUpdated string," + "compatible int not null,"
- + "primary key(id));";
+ + "ignoreUpdates int not null," + "primary key(id));";
public static class App implements Comparable {
@@ -123,6 +123,7 @@ public class DB {
apks = new ArrayList();
detail_Populated = false;
compatible = false;
+ ignoreUpdates = false;
}
// True when all the detail fields are populated, False otherwise.
@@ -188,6 +189,10 @@ public class DB {
// field for this - we make the decision on the fly in getApps().
public boolean hasUpdates;
+ // True if updates should not show up in the Updates tab for this
+ // application
+ public boolean ignoreUpdates;
+
// The name of the version that would be updated to.
public String updateVersion;
@@ -414,7 +419,7 @@ public class DB {
public String lastetag; // last etag we updated from, null forces update
}
- private final int DBVersion = 23;
+ private final int DBVersion = 24;
private static void createAppApk(SQLiteDatabase db) {
db.execSQL(CREATE_TABLE_APP);
@@ -611,7 +616,7 @@ public class DB {
List apps = getAppsBasic(true);
int count = 0;
for (App app : apps) {
- if (app.hasUpdates)
+ if (!app.ignoreUpdates && app.hasUpdates)
count++;
}
return count;
@@ -753,7 +758,7 @@ public class DB {
String cols[] = new String[] { "antiFeatures", "requirements",
"id", "name", "summary", "icon", "license", "category",
"curVersion", "curVercode", "added", "lastUpdated",
- "compatible" };
+ "compatible", "ignoreUpdates" };
c = db.query(TABLE_APP, cols, null, null, null, null, null);
c.moveToFirst();
while (!c.isAfterLast()) {
@@ -777,6 +782,7 @@ public class DB {
.length() == 0) ? null : mDateFormat
.parse(sLastUpdated);
app.compatible = c.getInt(12) == 1;
+ app.ignoreUpdates = c.getInt(13) == 1;
app.hasUpdates = false;
if (getinstalledinfo && systemApks.containsKey(app.id)) {
@@ -1085,7 +1091,7 @@ public class DB {
int count = 0;
for (App app : updateApps) {
- if (app.hasUpdates)
+ if (!app.ignoreUpdates && app.hasUpdates)
count++;
}
return count;
@@ -1236,6 +1242,7 @@ public class DB {
values.put("antiFeatures", CommaSeparatedList.str(upapp.antiFeatures));
values.put("requirements", CommaSeparatedList.str(upapp.requirements));
values.put("compatible", upapp.compatible ? 1 : 0);
+ values.put("ignoreUpdates", upapp.ignoreUpdates ? 1 : 0);
if (oldapp != null) {
db.update(TABLE_APP, values, "id = ?", new String[] { oldapp.id });
} else {
@@ -1341,6 +1348,12 @@ public class DB {
new String[] { address });
}
+ public void toggleIgnoreUpdates(String appid) {
+ db.execSQL("update " + TABLE_APP
+ + " set ignoreUpdates=1-ignoreUpdates where id = ?",
+ new String[] { appid });
+ }
+
public void updateRepoByAddress(Repo repo) {
ContentValues values = new ContentValues();
values.put("name", repo.name);