Search in sources :

Example 46 with Selection

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

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();
    }
}
Also used : Selection(com.android.documentsui.dirlist.MultiSelectManager.Selection)

Example 47 with Selection

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

the class MultiSelectManagerTest method testProvisionalSelection_Replace.

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

Example 48 with Selection

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

the class MultiSelectManagerTest method testProvisionalSelection_Apply.

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

Example 49 with Selection

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

the class MultiSelectManagerTest method testProvisionalSelection_Cancel.

public void testProvisionalSelection_Cancel() {
    mManager.toggleSelection(items.get(1));
    mManager.toggleSelection(items.get(2));
    Selection s = mManager.getSelection();
    SparseBooleanArray provisional = new SparseBooleanArray();
    provisional.append(3, true);
    provisional.append(4, true);
    s.setProvisionalSelection(getItemIds(provisional));
    s.cancelProvisionalSelection();
    // Original selection should remain.
    assertSelection(items.get(1), items.get(2));
}
Also used : Selection(com.android.documentsui.dirlist.MultiSelectManager.Selection) SparseBooleanArray(android.util.SparseBooleanArray)

Example 50 with Selection

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

the class MultiSelectManagerTest method testProvisionalSelection_IntersectsAppliedSelection.

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

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