Browse Source

Don't mark torrent files as selected with only a simple list item click; a long click is neccesary.

pull/82/head
Eric Kok 11 years ago
parent
commit
ca77d84ca8
  1. 7
      core/src/org/transdroid/core/gui/DetailsFragment.java
  2. 2
      core/src/org/transdroid/core/gui/TorrentsFragment.java

7
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.Click;
import org.androidannotations.annotations.EFragment; import org.androidannotations.annotations.EFragment;
import org.androidannotations.annotations.InstanceState; import org.androidannotations.annotations.InstanceState;
import org.androidannotations.annotations.ItemClick;
import org.androidannotations.annotations.OptionsItem; import org.androidannotations.annotations.OptionsItem;
import org.androidannotations.annotations.OptionsMenu; import org.androidannotations.annotations.OptionsMenu;
import org.androidannotations.annotations.ViewById; import org.androidannotations.annotations.ViewById;
@ -243,6 +244,11 @@ public class DetailsFragment extends SherlockFragment implements OnTrackersUpdat
clear(); clear();
} }
@ItemClick(resName = "details_list")
protected void detailsListClicked(int position) {
detailsList.setItemChecked(position, false);
}
@Override @Override
public void onPrepareOptionsMenu(Menu menu) { public void onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu); super.onPrepareOptionsMenu(menu);
@ -397,6 +403,7 @@ public class DetailsFragment extends SherlockFragment implements OnTrackersUpdat
List<TorrentFile> checked = new ArrayList<TorrentFile>(); List<TorrentFile> checked = new ArrayList<TorrentFile>();
for (int i = 0; i < detailsList.getCheckedItemPositions().size(); i++) { for (int i = 0; i < detailsList.getCheckedItemPositions().size(); i++) {
if (detailsList.getCheckedItemPositions().valueAt(i) if (detailsList.getCheckedItemPositions().valueAt(i)
&& i < detailsList.getAdapter().getCount()
&& detailsList.getAdapter().getItem(detailsList.getCheckedItemPositions().keyAt(i)) instanceof TorrentFile) && detailsList.getAdapter().getItem(detailsList.getCheckedItemPositions().keyAt(i)) instanceof TorrentFile)
checked.add((TorrentFile) detailsList.getAdapter().getItem( checked.add((TorrentFile) detailsList.getAdapter().getItem(
detailsList.getCheckedItemPositions().keyAt(i))); detailsList.getCheckedItemPositions().keyAt(i)));

2
core/src/org/transdroid/core/gui/TorrentsFragment.java

@ -269,7 +269,7 @@ public class TorrentsFragment extends SherlockFragment implements OnLabelPickedL
// Get checked torrents // Get checked torrents
ArrayList<Torrent> checked = new ArrayList<Torrent>(); ArrayList<Torrent> checked = new ArrayList<Torrent>();
for (int i = 0; i < torrentsList.getCheckedItemPositions().size(); i++) { 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( checked.add((Torrent) torrentsList.getAdapter().getItem(
torrentsList.getCheckedItemPositions().keyAt(i))); torrentsList.getCheckedItemPositions().keyAt(i)));
} }

Loading…
Cancel
Save