From ca77d84ca8d9fc1f5d1836c196cf4666f7e343a6 Mon Sep 17 00:00:00 2001 From: Eric Kok Date: Fri, 15 Nov 2013 14:57:18 +0100 Subject: [PATCH] Don't mark torrent files as selected with only a simple list item click; a long click is neccesary. --- core/src/org/transdroid/core/gui/DetailsFragment.java | 7 +++++++ core/src/org/transdroid/core/gui/TorrentsFragment.java | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/core/src/org/transdroid/core/gui/DetailsFragment.java b/core/src/org/transdroid/core/gui/DetailsFragment.java index 33cca123..569042f6 100644 --- a/core/src/org/transdroid/core/gui/DetailsFragment.java +++ b/core/src/org/transdroid/core/gui/DetailsFragment.java @@ -24,6 +24,7 @@ import org.androidannotations.annotations.AfterViews; import org.androidannotations.annotations.Click; import org.androidannotations.annotations.EFragment; import org.androidannotations.annotations.InstanceState; +import org.androidannotations.annotations.ItemClick; import org.androidannotations.annotations.OptionsItem; import org.androidannotations.annotations.OptionsMenu; import org.androidannotations.annotations.ViewById; @@ -243,6 +244,11 @@ public class DetailsFragment extends SherlockFragment implements OnTrackersUpdat clear(); } + @ItemClick(resName = "details_list") + protected void detailsListClicked(int position) { + detailsList.setItemChecked(position, false); + } + @Override public void onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); @@ -397,6 +403,7 @@ public class DetailsFragment extends SherlockFragment implements OnTrackersUpdat List checked = new ArrayList(); for (int i = 0; i < detailsList.getCheckedItemPositions().size(); i++) { if (detailsList.getCheckedItemPositions().valueAt(i) + && i < detailsList.getAdapter().getCount() && detailsList.getAdapter().getItem(detailsList.getCheckedItemPositions().keyAt(i)) instanceof TorrentFile) checked.add((TorrentFile) detailsList.getAdapter().getItem( detailsList.getCheckedItemPositions().keyAt(i))); diff --git a/core/src/org/transdroid/core/gui/TorrentsFragment.java b/core/src/org/transdroid/core/gui/TorrentsFragment.java index 2508e81f..c84bdadc 100644 --- a/core/src/org/transdroid/core/gui/TorrentsFragment.java +++ b/core/src/org/transdroid/core/gui/TorrentsFragment.java @@ -269,7 +269,7 @@ public class TorrentsFragment extends SherlockFragment implements OnLabelPickedL // Get checked torrents ArrayList checked = new ArrayList(); for (int i = 0; i < torrentsList.getCheckedItemPositions().size(); i++) { - if (torrentsList.getCheckedItemPositions().valueAt(i)) + if (torrentsList.getCheckedItemPositions().valueAt(i) && i < torrentsList.getAdapter().getCount()) checked.add((Torrent) torrentsList.getAdapter().getItem( torrentsList.getCheckedItemPositions().keyAt(i))); }