From 7fb2de4bae3a2c7c7db9b9bff44f657b92bfc40e Mon Sep 17 00:00:00 2001 From: Peter Serwylo Date: Mon, 29 Dec 2014 20:00:35 +1100 Subject: [PATCH] Select F-Droid correctly during swap process. Fixes #141. Bug in the code which decides which apps to select for swapping. Due to the way in which Adapters and ListViews work together to provide "header" and "footer" functionalities for lists, there is a mismatch between the index in our original adapter, and the actual index on the list. It is up to us to maintain this correctly, which was not done, hence the off by one error. --- .../src/org/fdroid/fdroid/views/swap/SelectAppsFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/F-Droid/src/org/fdroid/fdroid/views/swap/SelectAppsFragment.java b/F-Droid/src/org/fdroid/fdroid/views/swap/SelectAppsFragment.java index 294606fad..a8ce50bde 100644 --- a/F-Droid/src/org/fdroid/fdroid/views/swap/SelectAppsFragment.java +++ b/F-Droid/src/org/fdroid/fdroid/views/swap/SelectAppsFragment.java @@ -198,7 +198,7 @@ public class SelectAppsFragment extends ThemeableListFragment Cursor c = ((Cursor) listView.getItemAtPosition(i + 1)); String packageName = c.getString(c.getColumnIndex(InstalledAppProvider.DataColumns.APP_ID)); if (TextUtils.equals(packageName, fdroid)) { - listView.setItemChecked(i, true); // always include FDroid + listView.setItemChecked(i + 1, true); // always include FDroid } else { for (String selected : FDroidApp.selectedApps) { if (TextUtils.equals(packageName, selected)) {