From ac5cfd54934b8abf21e6a2aa07f0d03c2bd75d2f Mon Sep 17 00:00:00 2001 From: Eric Kok Date: Fri, 28 Jun 2013 11:45:01 +0200 Subject: [PATCH] Only allow multi select on file rows in details adapter. --- .../org/transdroid/core/gui/lists/DetailsAdapter.java | 1 + .../core/gui/lists/SimpleListItemAdapter.java | 10 +++++----- .../core/gui/navigation/SelectionManagerMode.java | 4 +++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/core/src/org/transdroid/core/gui/lists/DetailsAdapter.java b/core/src/org/transdroid/core/gui/lists/DetailsAdapter.java index 500c8144..fcb8d41d 100644 --- a/core/src/org/transdroid/core/gui/lists/DetailsAdapter.java +++ b/core/src/org/transdroid/core/gui/lists/DetailsAdapter.java @@ -36,6 +36,7 @@ public class DetailsAdapter extends MergeAdapter { // Torrent details header torrentDetailsView = TorrentDetailsView_.build(context); torrentDetailsViewAdapter = new ViewHolderAdapter(torrentDetailsView); + torrentDetailsViewAdapter.setViewEnabled(false); torrentDetailsViewAdapter.setViewVisibility(View.GONE); addAdapter(torrentDetailsViewAdapter); diff --git a/core/src/org/transdroid/core/gui/lists/SimpleListItemAdapter.java b/core/src/org/transdroid/core/gui/lists/SimpleListItemAdapter.java index 38251bc9..66843a73 100644 --- a/core/src/org/transdroid/core/gui/lists/SimpleListItemAdapter.java +++ b/core/src/org/transdroid/core/gui/lists/SimpleListItemAdapter.java @@ -69,14 +69,14 @@ public class SimpleListItemAdapter extends BaseAdapter { /** * Wraps a simple string of strings into a list of SimpleStringItem to add as data to a * {@link SimpleListItemAdapter} - * @param errorStrings A list of string + * @param strings A list of string * @return A list of SimpleStringItem objects representing the input strings */ - public static List wrapStringsList(List errorStrings) { + public static List wrapStringsList(List strings) { ArrayList errors = new ArrayList(); - if (errorStrings != null) { - for (String errorString : errorStrings) { - errors.add(new SimpleStringItem(errorString)); + if (strings != null) { + for (String string : strings) { + errors.add(new SimpleStringItem(string)); } } return errors; diff --git a/core/src/org/transdroid/core/gui/navigation/SelectionManagerMode.java b/core/src/org/transdroid/core/gui/navigation/SelectionManagerMode.java index 5cdd1e66..3468bd23 100644 --- a/core/src/org/transdroid/core/gui/navigation/SelectionManagerMode.java +++ b/core/src/org/transdroid/core/gui/navigation/SelectionManagerMode.java @@ -64,7 +64,9 @@ public class SelectionManagerMode implements MultiChoiceModeListenerCompat, OnMo public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) { int checkedCount = 0; for (int i = 0; i < managedList.getCheckedItemPositions().size(); i++) { - if (managedList.getCheckedItemPositions().valueAt(i)) + if (managedList.getCheckedItemPositions().valueAt(i) + && (onlyCheckClass == null || onlyCheckClass.isInstance(managedList.getItemAtPosition(managedList + .getCheckedItemPositions().keyAt(i))))) checkedCount++; } ((SelectionModificationSpinner) mode.getCustomView()).updateTitle(managedList.getContext().getResources()