use of com.android.documentsui.dirlist.MultiSelectManager.Selection in project platform_frameworks_base by android.
the class MultiSelectManager_SelectionTest method testIntersection_empty1.
public void testIntersection_empty1() {
Selection testSelection = new Selection();
testSelection.intersect(Sets.newHashSet("foo"));
assertTrue(testSelection.isEmpty());
}
use of com.android.documentsui.dirlist.MultiSelectManager.Selection in project platform_frameworks_base by android.
the class MultiSelectManager_SelectionTest method testIntersection_subset.
public void testIntersection_subset() {
String[] ids0 = new String[] { "foo", "bar", "baz" };
String[] ids1 = new String[] { "0", "baz", "1", "foo", "2" };
Selection testSelection = new Selection();
testSelection.add(ids0[0]);
testSelection.add(ids0[1]);
testSelection.add(ids0[2]);
testSelection.intersect(Sets.newHashSet(ids1));
assertTrue(testSelection.contains("foo"));
assertFalse(testSelection.contains("bar"));
assertTrue(testSelection.contains("baz"));
}
use of com.android.documentsui.dirlist.MultiSelectManager.Selection in project platform_frameworks_base by android.
the class DirectoryFragment method create.
public static void create(FragmentManager fm, int type, RootInfo root, DocumentInfo doc, String query, int anim) {
final Bundle args = new Bundle();
args.putInt(Shared.EXTRA_TYPE, type);
args.putParcelable(Shared.EXTRA_ROOT, root);
args.putParcelable(Shared.EXTRA_DOC, doc);
args.putString(Shared.EXTRA_QUERY, query);
args.putParcelable(Shared.EXTRA_SELECTION, new Selection());
final FragmentTransaction ft = fm.beginTransaction();
AnimationView.setupAnimations(ft, anim, args);
final DirectoryFragment fragment = new DirectoryFragment();
fragment.setArguments(args);
ft.replace(getFragmentId(), fragment);
ft.commitAllowingStateLoss();
}
use of com.android.documentsui.dirlist.MultiSelectManager.Selection in project platform_frameworks_base by android.
the class ModelTest method positionToSelection.
private Selection positionToSelection(int... positions) {
String[] ids = model.getModelIds();
Selection s = new Selection();
// Construct a selection of the given positions.
for (int p : positions) {
s.add(ids[p]);
}
return s;
}
use of com.android.documentsui.dirlist.MultiSelectManager.Selection in project platform_frameworks_base by android.
the class DirectoryFragment method copySelectedToClipboard.
public void copySelectedToClipboard() {
Metrics.logUserAction(getContext(), Metrics.USER_ACTION_COPY_CLIPBOARD);
Selection selection = mSelectionManager.getSelection(new Selection());
if (!selection.isEmpty()) {
copySelectionToClipboard(selection);
mSelectionManager.clearSelection();
}
}
Aggregations