Search in sources :

Example 51 with Selection

use of com.android.documentsui.dirlist.MultiSelectManager.Selection in project android_frameworks_base by crdroidandroid.

the class MultiSelectManagerTest method testProvisionalSelection_IntersectsExistingProvisionalSelection.

public void testProvisionalSelection_IntersectsExistingProvisionalSelection() {
    Selection s = mManager.getSelection();
    SparseBooleanArray provisional = new SparseBooleanArray();
    provisional.append(1, true);
    provisional.append(2, true);
    s.setProvisionalSelection(getItemIds(provisional));
    provisional.clear();
    provisional.append(1, true);
    s.setProvisionalSelection(getItemIds(provisional));
    assertSelection(items.get(1));
}
Also used : Selection(com.android.documentsui.dirlist.MultiSelectManager.Selection) SparseBooleanArray(android.util.SparseBooleanArray)

Example 52 with Selection

use of com.android.documentsui.dirlist.MultiSelectManager.Selection in project android_frameworks_base by crdroidandroid.

the class MultiSelectManagerTest method assertSelected.

private void assertSelected(String... expected) {
    for (int i = 0; i < expected.length; i++) {
        Selection selection = mManager.getSelection();
        String err = String.format("Selection %s does not contain %s", selection, expected[i]);
        assertTrue(err, selection.contains(expected[i]));
    }
}
Also used : Selection(com.android.documentsui.dirlist.MultiSelectManager.Selection)

Example 53 with Selection

use of com.android.documentsui.dirlist.MultiSelectManager.Selection in project android_frameworks_base by crdroidandroid.

the class MultiSelectManager_SelectionTest method testEqualsOther.

public void testEqualsOther() {
    Selection other = new Selection();
    other.add(ids[0]);
    other.add(ids[1]);
    other.add(ids[2]);
    assertEquals(selection, other);
    assertEquals(selection.hashCode(), other.hashCode());
}
Also used : Selection(com.android.documentsui.dirlist.MultiSelectManager.Selection)

Example 54 with Selection

use of com.android.documentsui.dirlist.MultiSelectManager.Selection in project android_frameworks_base by crdroidandroid.

the class MultiSelectManager_SelectionTest method testIntersection_exclusive.

public void testIntersection_exclusive() {
    String[] ids0 = new String[] { "foo", "bar", "baz" };
    String[] ids1 = new String[] { "0", "1", "2" };
    Selection testSelection = new Selection();
    testSelection.add(ids0[0]);
    testSelection.add(ids0[1]);
    testSelection.add(ids0[2]);
    Set<String> set = Sets.newHashSet(ids1);
    testSelection.intersect(set);
    assertTrue(testSelection.isEmpty());
}
Also used : Selection(com.android.documentsui.dirlist.MultiSelectManager.Selection)

Example 55 with Selection

use of com.android.documentsui.dirlist.MultiSelectManager.Selection in project android_frameworks_base by crdroidandroid.

the class MultiSelectManager_SelectionTest method testIntersection_all.

public void testIntersection_all() {
    String[] ids0 = new String[] { "foo", "bar", "baz" };
    String[] ids1 = new String[] { "0", "baz", "1", "foo", "2", "bar" };
    Selection testSelection = new Selection();
    testSelection.add(ids0[0]);
    testSelection.add(ids0[1]);
    testSelection.add(ids0[2]);
    Selection control = new Selection();
    control.copyFrom(testSelection);
    testSelection.intersect(Sets.newHashSet(ids1));
    assertTrue(testSelection.equals(control));
}
Also used : Selection(com.android.documentsui.dirlist.MultiSelectManager.Selection)

Aggregations

Selection (com.android.documentsui.dirlist.MultiSelectManager.Selection)110 SparseBooleanArray (android.util.SparseBooleanArray)30 Bundle (android.os.Bundle)10 ActivityManager (android.app.ActivityManager)5 FragmentTransaction (android.app.FragmentTransaction)5 Context (android.content.Context)5 Point (android.graphics.Point)5 AccessibilityNodeInfoCompat (android.support.v4.view.accessibility.AccessibilityNodeInfoCompat)5 GridLayoutManager (android.support.v7.widget.GridLayoutManager)5 SpanSizeLookup (android.support.v7.widget.GridLayoutManager.SpanSizeLookup)5 RecyclerView (android.support.v7.widget.RecyclerView)5 Recycler (android.support.v7.widget.RecyclerView.Recycler)5 ViewHolder (android.support.v7.widget.RecyclerView.ViewHolder)5 View (android.view.View)5 ImageView (android.widget.ImageView)5 TextView (android.widget.TextView)5 DocumentClipper (com.android.documentsui.DocumentClipper)5 State (com.android.documentsui.State)5