From dc4ac58a43783a00ba3b0d010dc69a77ee5633ac Mon Sep 17 00:00:00 2001 From: Eric Kok Date: Fri, 15 Nov 2013 14:29:40 +0100 Subject: [PATCH] Remove any selection on the torrents list when opening the details fragment. Fixes #33. --- core/src/org/transdroid/core/gui/TorrentsFragment.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/src/org/transdroid/core/gui/TorrentsFragment.java b/core/src/org/transdroid/core/gui/TorrentsFragment.java index 4d929556..2508e81f 100644 --- a/core/src/org/transdroid/core/gui/TorrentsFragment.java +++ b/core/src/org/transdroid/core/gui/TorrentsFragment.java @@ -169,6 +169,7 @@ public class TorrentsFragment extends SherlockFragment implements OnLabelPickedL this.currentTextFilter = null; this.currentNavigationFilter = null; } + clearCheckedStates(); applyAllFilters(); } @@ -351,6 +352,8 @@ public class TorrentsFragment extends SherlockFragment implements OnLabelPickedL @ItemClick(resName = "torrent_list") protected void torrentsListClicked(Torrent torrent) { + clearCheckedStates(); + // Show the torrent details fragment ((TorrentsActivity) getActivity()).openDetails(torrent); } @@ -361,6 +364,13 @@ public class TorrentsFragment extends SherlockFragment implements OnLabelPickedL } } + private void clearCheckedStates() { + // Remove any selection the user has made first + for (int i = 0; i < torrentsList.getAdapter().getCount(); i++) { + torrentsList.setItemChecked(i, false); + } + } + /** * Updates the shown screen depending on whether we have a connection (so torrents can be shown) or not (in case we * need to show a message suggesting help). This should only ever be called on the UI thread.