Browse Source

Only allow multi select on file rows in details adapter.

pull/11/head
Eric Kok 12 years ago
parent
commit
ac5cfd5493
  1. 1
      core/src/org/transdroid/core/gui/lists/DetailsAdapter.java
  2. 10
      core/src/org/transdroid/core/gui/lists/SimpleListItemAdapter.java
  3. 4
      core/src/org/transdroid/core/gui/navigation/SelectionManagerMode.java

1
core/src/org/transdroid/core/gui/lists/DetailsAdapter.java

@ -36,6 +36,7 @@ public class DetailsAdapter extends MergeAdapter {
// Torrent details header // Torrent details header
torrentDetailsView = TorrentDetailsView_.build(context); torrentDetailsView = TorrentDetailsView_.build(context);
torrentDetailsViewAdapter = new ViewHolderAdapter(torrentDetailsView); torrentDetailsViewAdapter = new ViewHolderAdapter(torrentDetailsView);
torrentDetailsViewAdapter.setViewEnabled(false);
torrentDetailsViewAdapter.setViewVisibility(View.GONE); torrentDetailsViewAdapter.setViewVisibility(View.GONE);
addAdapter(torrentDetailsViewAdapter); addAdapter(torrentDetailsViewAdapter);

10
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 * Wraps a simple string of strings into a list of SimpleStringItem to add as data to a
* {@link SimpleListItemAdapter} * {@link SimpleListItemAdapter}
* @param errorStrings A list of string * @param strings A list of string
* @return A list of SimpleStringItem objects representing the input strings * @return A list of SimpleStringItem objects representing the input strings
*/ */
public static List<SimpleStringItem> wrapStringsList(List<String> errorStrings) { public static List<SimpleStringItem> wrapStringsList(List<String> strings) {
ArrayList<SimpleStringItem> errors = new ArrayList<SimpleStringItem>(); ArrayList<SimpleStringItem> errors = new ArrayList<SimpleStringItem>();
if (errorStrings != null) { if (strings != null) {
for (String errorString : errorStrings) { for (String string : strings) {
errors.add(new SimpleStringItem(errorString)); errors.add(new SimpleStringItem(string));
} }
} }
return errors; return errors;

4
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) { public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {
int checkedCount = 0; int checkedCount = 0;
for (int i = 0; i < managedList.getCheckedItemPositions().size(); i++) { 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++; checkedCount++;
} }
((SelectionModificationSpinner) mode.getCustomView()).updateTitle(managedList.getContext().getResources() ((SelectionModificationSpinner) mode.getCustomView()).updateTitle(managedList.getContext().getResources()

Loading…
Cancel
Save