Search in sources :

Example 86 with SparseBooleanArray

use of android.util.SparseBooleanArray 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 87 with SparseBooleanArray

use of android.util.SparseBooleanArray 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 88 with SparseBooleanArray

use of android.util.SparseBooleanArray 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)

Example 89 with SparseBooleanArray

use of android.util.SparseBooleanArray 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 90 with SparseBooleanArray

use of android.util.SparseBooleanArray in project android_frameworks_base by crdroidandroid.

the class TaskPersister method loadPersistedTaskIdsForUser.

@NonNull
SparseBooleanArray loadPersistedTaskIdsForUser(int userId) {
    if (mTaskIdsInFile.get(userId) != null) {
        return mTaskIdsInFile.get(userId).clone();
    }
    final SparseBooleanArray persistedTaskIds = new SparseBooleanArray();
    synchronized (mIoLock) {
        BufferedReader reader = null;
        String line;
        try {
            reader = new BufferedReader(new FileReader(getUserPersistedTaskIdsFile(userId)));
            while ((line = reader.readLine()) != null) {
                for (String taskIdString : line.split("\\s+")) {
                    int id = Integer.parseInt(taskIdString);
                    persistedTaskIds.put(id, true);
                }
            }
        } catch (FileNotFoundException e) {
        // File doesn't exist. Ignore.
        } catch (Exception e) {
            Slog.e(TAG, "Error while reading taskIds file for user " + userId, e);
        } finally {
            IoUtils.closeQuietly(reader);
        }
    }
    mTaskIdsInFile.put(userId, persistedTaskIds);
    return persistedTaskIds.clone();
}
Also used : SparseBooleanArray(android.util.SparseBooleanArray) BufferedReader(java.io.BufferedReader) FileNotFoundException(java.io.FileNotFoundException) FileReader(java.io.FileReader) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) XmlPullParserException(org.xmlpull.v1.XmlPullParserException) NonNull(android.annotation.NonNull)

Aggregations

SparseBooleanArray (android.util.SparseBooleanArray)283 ArrayList (java.util.ArrayList)43 View (android.view.View)32 Selection (com.android.documentsui.dirlist.MultiSelectManager.Selection)30 Point (android.graphics.Point)28 ViewGroup (android.view.ViewGroup)20 ListView (android.widget.ListView)15 HashMap (java.util.HashMap)15 Paint (android.graphics.Paint)13 Intent (android.content.Intent)11 Map (java.util.Map)11 File (java.io.File)10 SparseArray (android.util.SparseArray)8 SuppressLint (android.annotation.SuppressLint)7 SparseIntArray (android.util.SparseIntArray)7 AdapterView (android.widget.AdapterView)7 Cursor (android.database.Cursor)6 ActionMenuChildView (com.actionbarsherlock.internal.view.menu.ActionMenuView.ActionMenuChildView)6 IndentingPrintWriter (com.android.internal.util.IndentingPrintWriter)6 List (java.util.List)6