List of usage examples for android.util SparseBooleanArray SparseBooleanArray
public SparseBooleanArray(int initialCapacity)
From source file:Main.java
/** * Method to avoid a bug on pre ICS//from w ww .j av a2 s . com * * @see https://code.google.com/p/android/issues/detail?id=27112 */ public static SparseBooleanArray copySparseBooleanArray(SparseBooleanArray sba) { SparseBooleanArray out = new SparseBooleanArray(sba.size()); for (int i = 0; i < sba.size(); i++) { out.append(sba.keyAt(i), sba.valueAt(i)); } return out; }
From source file:com.hippo.widget.recyclerview.EasyRecyclerView.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 w w.jav 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(0); } if (mCheckedIdStates == null && mAdapter != null && mAdapter.hasStableIds()) { mCheckedIdStates = new LongSparseArray<>(0); } // Modal multi-choice mode only has choices when the mode is active. Clear them. if (mChoiceMode == CHOICE_MODE_MULTIPLE_MODAL) { clearChoices(); setLongClickable(true); } else if (mChoiceMode == CHOICE_MODE_MULTIPLE_CUSTOM) { if (mTempCheckStates == null) { mTempCheckStates = new SparseBooleanArray(0); } clearChoices(); } } }
From source file:com.glview.widget.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. * * @param choiceMode One of {@link #CHOICE_MODE_NONE}, {@link #CHOICE_MODE_SINGLE}, or * {@link #CHOICE_MODE_MULTIPLE}//w w w . j a v a2s. co m */ public void setChoiceMode(int choiceMode) { mChoiceMode = choiceMode; if (mChoiceMode != CHOICE_MODE_NONE) { if (mCheckStates == null) { mCheckStates = new SparseBooleanArray(0); } if (mCheckedIdStates == null && mAdapter != null && mAdapter.hasStableIds()) { mCheckedIdStates = new LongSparseArray<Integer>(0); } // 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
/** * 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./*from w ww . j ava 2 s . c o m*/ * * @param choiceMode * One of {@link #CHOICE_MODE_NONE} or * {@link #CHOICE_MODE_SINGLE} */ public void setChoiceMode(int choiceMode) { if (choiceMode != CHOICE_MODE_NONE && choiceMode != CHOICE_MODE_SINGLE) { throw new IllegalArgumentException("This view currently only supports no or single choice mode."); } mChoiceMode = choiceMode; if (mChoiceMode != CHOICE_MODE_NONE) { if (mCheckStates == null) { mCheckStates = new SparseBooleanArray(0); } if (mCheckedIdStates == null && mAdapter != null && mAdapter.hasStableIds()) { mCheckedIdStates = new LongSparseArray<Integer>(0); } } }