Example usage for android.util SparseBooleanArray SparseBooleanArray

List of usage examples for android.util SparseBooleanArray SparseBooleanArray

Introduction

In this page you can find the example usage for android.util SparseBooleanArray SparseBooleanArray.

Prototype

public SparseBooleanArray() 

Source Link

Document

Creates a new SparseBooleanArray containing no mappings.

Usage

From source file:es.ugr.swad.swadroid.modules.tests.TestsMake.java

private SparseBooleanArray getCheckedItemPositions(LinearLayout parent) {
    SparseBooleanArray checkedItems = new SparseBooleanArray();
    int childCount = parent.getChildCount();
    CheckableLinearLayout tv;/*from ww w  .  j a  v  a  2  s.co  m*/

    for (int i = 0; i < childCount; i++) {
        tv = (CheckableLinearLayout) parent.getChildAt(i);
        checkedItems.append(i, tv.isChecked());
    }

    return checkedItems;
}

From source file:com.datarita.ultimatecamera.turu.views.TwoWayView.java

public void setChoiceMode(ChoiceMode choiceMode) {
    mChoiceMode = choiceMode;/*from   w  ww. jav  a  2 s .co m*/

    if (mChoiceMode.compareTo(ChoiceMode.NONE) != 0) {
        if (mCheckStates == null) {
            mCheckStates = new SparseBooleanArray();
        }

        if (mCheckedIdStates == null && mAdapter != null && mAdapter.hasStableIds()) {
            mCheckedIdStates = new LongSparseArray<Integer>();
        }
    }
}

From source file:com.aliasapps.seq.scroller.TwoWayView.java

/**
 * Defines the choice behavior for the List. By default, Lists do not have any choice behavior
 * ({@link #CHOICE_MODE_NONE}). By setting the choiceMode to {@link #CHOICE_MODE_SINGLE}, the
 * List allows up to one item to  be in a chosen state. By setting the choiceMode to
 * {@link #CHOICE_MODE_MULTIPLE}, the list allows any number of items to be chosen.
 *
 * @param choiceMode One of {@link #CHOICE_MODE_NONE}, {@link #CHOICE_MODE_SINGLE}, or
 * {@link #CHOICE_MODE_MULTIPLE}//ww w  .  j  a  v  a 2  s  . com
 */
public void setChoiceMode(ChoiceMode choiceMode) {
    mChoiceMode = choiceMode;

    if (mChoiceMode.compareTo(ChoiceMode.NONE) != 0) {
        if (mCheckStates == null) {
            mCheckStates = new SparseBooleanArray();
        }

        if (mCheckedIdStates == null && mAdapter != null && mAdapter.hasStableIds()) {
            mCheckedIdStates = new LongSparseArray<Integer>();
        }
    }
}

From source file:com.yktx.check.listview.TwoWayView.java

/**
 * Defines the choice behavior for the List. By default, Lists do not have any choice behavior
 * ({@link #CHOICE_MODE_NONE}). By setting the choiceMode to {@link #CHOICE_MODE_SINGLE}, the
 * List allows up to one item to  be in a chosen state. By setting the choiceMode to
 * {@link #CHOICE_MODE_MULTIPLE}, the list allows any number of items to be chosen.
 *
 * @param choiceMode One of {@link #CHOICE_MODE_NONE}, {@link #CHOICE_MODE_SINGLE}, or
 * {@link #CHOICE_MODE_MULTIPLE}// w w w . j a v  a 2  s. co m
 */
@SuppressLint("NewApi")
public void setChoiceMode(ChoiceMode choiceMode) {
    mChoiceMode = choiceMode;

    if (mChoiceMode.compareTo(ChoiceMode.NONE) != 0) {
        if (mCheckStates == null) {
            mCheckStates = new SparseBooleanArray();
        }

        if (mCheckedIdStates == null && mAdapter != null && mAdapter.hasStableIds()) {
            mCheckedIdStates = new LongSparseArray<Integer>();
        }
    }
}

From source file:com.artifex.mupdflib.TwoWayView.java

/**
 * Defines the choice behavior for the List. By default, Lists do not have any choice behavior
 * ({@link ChoiceMode#NONE}). By setting the choiceMode to {@link ChoiceMode#SINGLE}, the
 * List allows up to one item to  be in a chosen state. By setting the choiceMode to
 * {@link ChoiceMode#MULTIPLE}, the list allows any number of items to be chosen.
 *
 * @param choiceMode One of {@link ChoiceMode#NONE}, {@link ChoiceMode#SINGLE}, or
 * {@link ChoiceMode#MULTIPLE}//from   w w  w . j  a v a 2 s  .  c om
 */
public void setChoiceMode(ChoiceMode choiceMode) {
    mChoiceMode = choiceMode;

    if (mChoiceMode != ChoiceMode.NONE) {
        if (mCheckStates == null) {
            mCheckStates = new SparseBooleanArray();
        }

        if (mCheckedIdStates == null && mAdapter != null && mAdapter.hasStableIds()) {
            mCheckedIdStates = new LongSparseArray<Integer>();
        }
    }
}

From source file:com.huewu.pla.lib.internal.PLAListView.java

/**
 * Defines the choice behavior for the List. By default, Lists do not have
 * any choice behavior ({@link #CHOICE_MODE_NONE}). By setting the
 * choiceMode to {@link #CHOICE_MODE_SINGLE}, the List allows up to one item
 * to be in a chosen state. By setting the choiceMode to
 * {@link #CHOICE_MODE_MULTIPLE}, the list allows any number of items to be
 * chosen./*w  ww  .  ja  v  a 2  s.c  om*/
 * 
 * @param choiceMode One of {@link #CHOICE_MODE_NONE},
 *            {@link #CHOICE_MODE_SINGLE}, or {@link #CHOICE_MODE_MULTIPLE}
 */
public void setChoiceMode(final int choiceMode) {
    mChoiceMode = choiceMode;
    if (mChoiceMode != CHOICE_MODE_NONE) {
        if (mCheckStates == null) {
            mCheckStates = new SparseBooleanArray();
        }
        if (mCheckedIdStates == null && mAdapter != null && mAdapter.hasStableIds()) {
            mCheckedIdStates = new LongSparseArray<Boolean>();
        }
    }
}

From source file:com.common.widget.hzlib.AbsHorizontalListView.java

/**
 * Defines the choice behavior for the List. By default, Lists do not have any choice behavior
 * ({@link #CHOICE_MODE_NONE}). By setting the choiceMode to {@link #CHOICE_MODE_SINGLE}, the
 * List allows up to one item to  be in a chosen state. By setting the choiceMode to
 * {@link #CHOICE_MODE_MULTIPLE}, the list allows any number of items to be chosen.
 *
 * @param choiceMode One of {@link #CHOICE_MODE_NONE}, {@link #CHOICE_MODE_SINGLE}, or
 * {@link #CHOICE_MODE_MULTIPLE}//from w  ww . j a  v  a 2  s .  co m
 */
public void setChoiceMode(int choiceMode) {
    mChoiceMode = choiceMode;

    if (mChoiceMode != CHOICE_MODE_NONE) {
        if (mCheckStates == null) {
            mCheckStates = new SparseBooleanArray();
        }
        if (mCheckedIdStates == null && mAdapter != null && mAdapter.hasStableIds()) {
            mCheckedIdStates = new LongSparseArray<Integer>();
        }
        // Modal multi-choice mode only has choices when the mode is active. Clear them.
        if (mChoiceMode == CHOICE_MODE_MULTIPLE_MODAL) {
            clearChoices();
            setLongClickable(true);
        }
    }
}

From source file:com.example.libwidgettv.bak.AbsListView.java

/**
 * Defines the choice behavior for the List. By default, Lists do not have
 * any choice behavior ({@link #CHOICE_MODE_NONE}). By setting the
 * choiceMode to {@link #CHOICE_MODE_SINGLE}, the List allows up to one item
 * to be in a chosen state. By setting the choiceMode to
 * {@link #CHOICE_MODE_MULTIPLE}, the list allows any number of items to be
 * chosen./*from  w w  w.  j  a v a 2  s  . c  om*/
 * 
 * @param choiceMode
 *            One of {@link #CHOICE_MODE_NONE}, {@link #CHOICE_MODE_SINGLE},
 *            or {@link #CHOICE_MODE_MULTIPLE}
 */
public void setChoiceMode(int choiceMode) {
    mChoiceMode = choiceMode;
    if (mChoiceActionMode != null) {
        mChoiceActionMode.finish();
        mChoiceActionMode = null;
    }
    if (mChoiceMode != CHOICE_MODE_NONE) {
        if (mCheckStates == null) {
            mCheckStates = new SparseBooleanArray();
        }
        if (mCheckedIdStates == null && mAdapter != null && mAdapter.hasStableIds()) {
            mCheckedIdStates = new LongSparseArray<Integer>();
        }
        // Modal multi-choice mode only has choices when the mode is active.
        // Clear them.
        if (mChoiceMode == CHOICE_MODE_MULTIPLE_MODAL) {
            clearChoices();
            setLongClickable(true);
        }
    }
}

From source file:com.appunite.list.AbsHorizontalListView.java

/**
 * Defines the choice behavior for the List. By default, Lists do not have any choice behavior
 * ({@link #CHOICE_MODE_NONE}). By setting the choiceMode to {@link #CHOICE_MODE_SINGLE}, the
 * List allows up to one item to  be in a chosen state. By setting the choiceMode to
 * {@link #CHOICE_MODE_MULTIPLE}, the list allows any number of items to be chosen.
 *
 * @param choiceMode One of {@link #CHOICE_MODE_NONE}, {@link #CHOICE_MODE_SINGLE}, or
 * {@link #CHOICE_MODE_MULTIPLE}/*from   www .  ja v a  2  s .  c o  m*/
 */
public void setChoiceMode(int choiceMode) {
    mChoiceMode = choiceMode;
    if (mChoiceActionMode != null) {
        mChoiceActionMode.finish();
        mChoiceActionMode = null;
    }
    if (mChoiceMode != CHOICE_MODE_NONE) {
        if (mCheckStates == null) {
            mCheckStates = new SparseBooleanArray();
        }
        if (mCheckedIdStates == null && mAdapter != null && mAdapter.hasStableIds()) {
            mCheckedIdStates = new LongSparseArray<Integer>();
        }
        // Modal multi-choice mode only has choices when the mode is active. Clear them.
        if (mChoiceMode == CHOICE_MODE_MULTIPLE_MODAL) {
            clearChoices();
            setLongClickable(true);
        }
    }
}

From source file:com.huewu.pla.lib.internal.PLA_ListView.java

@TargetApi(14)
private SparseBooleanArray cloneCheckStates() {
    if (mCheckStates == null) {
        return null;
    }//from   w w  w.  ja v  a  2 s . com

    SparseBooleanArray checkedStates;
    if (Build.VERSION.SDK_INT >= 14) {
        checkedStates = mCheckStates.clone();
    } else {
        checkedStates = new SparseBooleanArray();

        for (int i = 0, len = mCheckStates.size(); i < len; ++i) {
            checkedStates.put(mCheckStates.keyAt(i), mCheckStates.valueAt(i));
        }
    }
    return checkedStates;
}