/** * Checks if filter with the same name (ignoring case) already exists. */ private boolean sameNameFilterExists(String name) { LongSparseArray<Filter> filters = FiltersClient.INSTANCE.getByNameIgnoreCase(getContext(), name); if (isEditingExistingFilter()) { long id = getArguments().getLong(ARG_ID); for (int i = 0; i < filters.size(); i++) { long filterId = filters.keyAt(i); Filter filter = filters.get(filterId); // Ignore currently edited filter if (name.equalsIgnoreCase(filter.getName()) && id != filterId) { return true; } } return false; } else { // New filter return filters.size() > 0; } }
@Override protected void addContacts(List<Contact> contacts, LongSparseArray<ContactNumber> singleContactNumbers) { // prepare returning arguments - data of the chosen contacts ArrayList<String> names = new ArrayList<>(); ArrayList<String> numbers = new ArrayList<>(); ArrayList<Integer> types = new ArrayList<>(); for (Contact contact : contacts) { ContactNumber contactNumber = singleContactNumbers.get(contact.id); if (contactNumber != null) { // add single number of the contact names.add(contact.name); numbers.add(contactNumber.number); types.add(contactNumber.type); } else { // all numbers of the contact for (ContactNumber _contactNumber : contact.numbers) { names.add(contact.name); numbers.add(_contactNumber.number); types.add(_contactNumber.type); } } } // return arguments Intent intent = new Intent(); intent.putStringArrayListExtra(CONTACT_NAMES, names); intent.putStringArrayListExtra(CONTACT_NUMBERS, numbers); intent.putIntegerArrayListExtra(CONTACT_NUMBER_TYPES, types); getActivity().setResult(Activity.RESULT_OK, intent); getActivity().finish(); }
@Override public Set<? extends Cluster<T>> getClusters(double zoom) { long numCells = (long) Math.ceil(256 * Math.pow(2, zoom) / GRID_SIZE); SphericalMercatorProjection proj = new SphericalMercatorProjection(numCells); HashSet<Cluster<T>> clusters = new HashSet<>(); LongSparseArray<StaticCluster<T>> sparseArray = new LongSparseArray<StaticCluster<T>>(); synchronized (mItems) { for (T item : mItems) { Point p = proj.toPoint(item.getPosition()); long coord = getCoord(numCells, p.x, p.y); StaticCluster<T> cluster = sparseArray.get(coord); if (cluster == null) { cluster = new StaticCluster<T>(proj.toLatLng(new Point(Math.floor(p.x) + .5, Math.floor(p.y) + .5))); sparseArray.put(coord, cluster); clusters.add(cluster); } cluster.add(item); } } return clusters; }
@Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle bundle = this.getArguments(); if (bundle != null) { selecting = bundle.getBoolean("select", false); selectedLabelId = bundle.getLong("selected_label_id", -1L); } else { selecting = false; } if(savedInstanceState != null) { selectedLabelId = savedInstanceState.getLong("selected_label_id", -1L); selectedIds = savedInstanceState.getParcelable("myLongSparseBooleanArray"); } if (selectedIds == null){ selectedIds = new LongSparseArray<>(); } setHasOptionsMenu(true); }
private static void parsePrecomps( @Nullable JSONArray assetsJson, LottieComposition composition) { if (assetsJson == null) { return; } int length = assetsJson.length(); for (int i = 0; i < length; i++) { JSONObject assetJson = assetsJson.optJSONObject(i); JSONArray layersJson = assetJson.optJSONArray("layers"); if (layersJson == null) { continue; } List<Layer> layers = new ArrayList<>(layersJson.length()); LongSparseArray<Layer> layerMap = new LongSparseArray<>(); for (int j = 0; j < layersJson.length(); j++) { Layer layer = Layer.Factory.newInstance(layersJson.optJSONObject(j), composition); layerMap.put(layer.getId(), layer); layers.add(layer); } String id = assetJson.optString("id"); composition.precomps.put(id, layers); } }
@TargetApi(11) public void setChoiceMode(int choiceMode) { this.mChoiceMode = choiceMode; if (VERSION.SDK_INT >= 11 && this.mChoiceActionMode != null) { if (VERSION.SDK_INT >= 11) { ((ActionMode) this.mChoiceActionMode).finish(); } this.mChoiceActionMode = null; } if (this.mChoiceMode != 0) { if (this.mCheckStates == null) { this.mCheckStates = new SparseArrayCompat(); } if (this.mCheckedIdStates == null && this.mAdapter != null && this.mAdapter.hasStableIds()) { this.mCheckedIdStates = new LongSparseArray(); } if (VERSION.SDK_INT >= 11 && this.mChoiceMode == 3) { clearChoices(); setLongClickable(true); } } }
private Drawable getCachedDelegateDrawable(@NonNull Context context, long key) { Drawable drawable = null; synchronized (this.mDelegateDrawableCacheLock) { LongSparseArray<WeakReference<ConstantState>> cache = (LongSparseArray) this.mDelegateDrawableCaches.get(context); if (cache == null) { } else { WeakReference<ConstantState> wr = (WeakReference) cache.get(key); if (wr != null) { ConstantState entry = (ConstantState) wr.get(); if (entry != null) { drawable = entry.newDrawable(context.getResources()); } else { cache.delete(key); } } } } return drawable; }
private Drawable getCachedDrawable(@NonNull final Context context, final long key) { synchronized (mDrawableCacheLock) { final LongSparseArray<WeakReference<ConstantState>> cache = mDrawableCaches.get(context); if (cache == null) { return null; } final WeakReference<ConstantState> wr = cache.get(key); if (wr != null) { // We have the key, and the secret ConstantState entry = wr.get(); if (entry != null) { return entry.newDrawable(context.getResources()); } else { // Our entry has been purged cache.delete(key); } } } return null; }
private boolean addDrawableToCache(@NonNull final Context context, final long key, @NonNull final Drawable drawable) { final ConstantState cs = drawable.getConstantState(); if (cs != null) { synchronized (mDrawableCacheLock) { LongSparseArray<WeakReference<ConstantState>> cache = mDrawableCaches.get(context); if (cache == null) { cache = new LongSparseArray<>(); mDrawableCaches.put(context, cache); } cache.put(key, new WeakReference<ConstantState>(cs)); } return true; } return false; }
/** * Create a new instance. * * @param aContext * the context to use for accessing the content provider etc * @param aPolicyProvider * the download policy provider to use * @param aStatusUpdater * the download status updater to use */ public BasicDownloader(final Context aContext, final DownloadPolicyProvider aPolicyProvider, final DownloadStatusUpdater aStatusUpdater) { Log.d(LOG_TAG, "BasicDownloader()"); downloader = Executors.newFixedThreadPool(MAX_DOWNLOAD_THREADS, new MinPriorityThreadFactory(this.getClass() .getSimpleName())); context = aContext; statusUpdater = aStatusUpdater; policyProvider = aPolicyProvider; runningDownloads = new LongSparseArray<>(); wifiLocks = new LongSparseArray<>(); final WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); int wifiMode = WifiManager.WIFI_MODE_FULL; if (android.os.Build.VERSION.SDK_INT >= ANDROID_SDK_VERSION_12) { wifiMode = WifiManager.WIFI_MODE_FULL_HIGH_PERF; } wifiLock = wifiManager.createWifiLock(wifiMode, this.getClass().getSimpleName()); startReadingQueueFromContentProvider(); }
private void showStoreLatestApps(StoreLatestApps card, int position) { Map<View, Long> apps = new HashMap<>(); LongSparseArray<String> appsPackages = new LongSparseArray<>(); appsContainer.removeAllViews(); View latestAppView; ImageView latestAppIcon; TextView latestAppName; for (App latestApp : card.getApps()) { latestAppView = inflater.inflate(R.layout.social_timeline_latest_app, appsContainer, false); latestAppIcon = (ImageView) latestAppView.findViewById(R.id.social_timeline_latest_app_icon); latestAppName = (TextView) latestAppView.findViewById(R.id.social_timeline_latest_app_name); ImageLoader.with(itemView.getContext()) .load(latestApp.getIcon(), latestAppIcon); latestAppName.setText(latestApp.getName()); appsContainer.addView(latestAppView); apps.put(latestAppView, latestApp.getId()); appsPackages.put(latestApp.getId(), latestApp.getPackageName()); } setStoreLatestAppsListeners(card, apps, appsPackages, position); }
private void showStoreLatestApps(SocialStore card, int position) { Map<View, Long> apps = new HashMap<>(); LongSparseArray<String> appsPackages = new LongSparseArray<>(); appsContainer.removeAllViews(); View latestAppView; ImageView latestAppIcon; TextView latestAppName; for (App latestApp : card.getApps()) { latestAppView = inflater.inflate(R.layout.social_timeline_latest_app, appsContainer, false); latestAppIcon = (ImageView) latestAppView.findViewById(R.id.social_timeline_latest_app_icon); latestAppName = (TextView) latestAppView.findViewById(R.id.social_timeline_latest_app_name); ImageLoader.with(itemView.getContext()) .load(latestApp.getIcon(), latestAppIcon); latestAppName.setText(latestApp.getName()); appsContainer.addView(latestAppView); apps.put(latestAppView, latestApp.getId()); appsPackages.put(latestApp.getId(), latestApp.getPackageName()); } setStoreLatestAppsListeners(card, apps, appsPackages, position); }
private void showStoreLatestApps(AggregatedStore card) { Map<View, Long> apps = new HashMap<>(); LongSparseArray<String> appsPackages = new LongSparseArray<>(); appsContainer.removeAllViews(); View latestAppView; ImageView latestAppIcon; TextView latestAppName; for (App latestApp : card.getApps()) { latestAppView = inflater.inflate(R.layout.social_timeline_latest_app, appsContainer, false); latestAppIcon = (ImageView) latestAppView.findViewById(R.id.social_timeline_latest_app_icon); latestAppName = (TextView) latestAppView.findViewById(R.id.social_timeline_latest_app_name); ImageLoader.with(itemView.getContext()) .load(latestApp.getIcon(), latestAppIcon); latestAppName.setText(latestApp.getName()); appsContainer.addView(latestAppView); apps.put(latestAppView, latestApp.getId()); appsPackages.put(latestApp.getId(), latestApp.getPackageName()); } setStoreLatestAppsListeners(card, apps, appsPackages); }
/** * Returns map of <reminder_id, reminder_object> * * @param eventId * @return */ private LongSparseArray<DbCalendarReminderSensor> getExistingReminders(long eventId) { long deviceId = PreferenceProvider.getInstance(context).getCurrentDeviceId(); List<DbCalendarReminderSensor> list = daoProvider .getCalendarReminderSensorDao() .getAllByEventId(eventId, deviceId); LongSparseArray<DbCalendarReminderSensor> map = new LongSparseArray<>(list.size()); for (DbCalendarReminderSensor reminder : list) { map.put(reminder.getReminderId(), reminder); } return map; }
private static void parseLayers(JsonReader reader, LottieComposition composition, List<Layer> layers, LongSparseArray<Layer> layerMap) throws IOException { int imageCount = 0; reader.beginArray(); while (reader.hasNext()) { Layer layer = LayerParser.parse(reader, composition); if (layer.getLayerType() == Layer.LayerType.Image) { imageCount++; } layers.add(layer); layerMap.put(layer.getId(), layer); if (imageCount > 4) { L.warn("You have " + imageCount + " images. Lottie should primarily be " + "used with shapes. If you are using Adobe Illustrator, convert the Illustrator layers" + " to shape layers."); } } reader.endArray(); }
public void init(Rect bounds, float startFrame, float endFrame, float frameRate, int majorVersion, int minorVersion, int patchVersion, List<Layer> layers, LongSparseArray<Layer> layerMap, Map<String, List<Layer>> precomps, Map<String, LottieImageAsset> images, SparseArrayCompat<FontCharacter> characters, Map<String, Font> fonts) { this.bounds = bounds; this.startFrame = startFrame; this.endFrame = endFrame; this.frameRate = frameRate; this.majorVersion = majorVersion; this.minorVersion = minorVersion; this.patchVersion = patchVersion; this.layers = layers; this.layerMap = layerMap; this.precomps = precomps; this.images = images; this.characters = characters; this.fonts = fonts; }
private LongSparseArray<Double> convertToSparseArray(JSONArray array) { double multiplier = getMultiplier(array); LongSparseArray<Double> sparse = new LongSparseArray<>(); for (Integer index = 0; index < array.length(); index++) { try { JSONObject o = array.getJSONObject(index); long tas = getShitfTimeSecs((int) o.getLong("timeAsSeconds")); Double value = o.getDouble("value") * multiplier; sparse.put(tas, value); } catch (JSONException e) { log.error("Unhandled exception", e); } } // check if start is at 0 (midnight) // and add last value before midnight if not if (sparse.keyAt(0) != 0) { sparse.put(0, sparse.valueAt(sparse.size() - 1)); } return sparse; }
private String getValuesList(LongSparseArray<Double> array, LongSparseArray<Double> array2, DecimalFormat format, String units) { String retValue = ""; for (Integer index = 0; index < array.size(); index++) { retValue += format_HH_MM((int) array.keyAt(index)); retValue += " "; retValue += format.format(array.valueAt(index)); if (array2 != null) { retValue += " - "; retValue += format.format(array2.valueAt(index)); } retValue += " " + units; if (index + 1 < array.size()) retValue += "\n"; } return retValue; }
@Subscribe public void onNewProfile(EventNewBasalProfile ev) { if (MainApp.getConfigBuilder() == null) return; // app still initializing Profile profile = MainApp.getConfigBuilder().getProfile(); if (profile == null) return; // app still initializing dia = profile.getDia(); if (ev == null) { // on init no need of reset return; } synchronized (dataLock) { log.debug("Invalidating cached data because of new profile. IOB: " + iobTable.size() + " Autosens: " + autosensDataTable.size() + " records"); iobTable = new LongSparseArray<>(); autosensDataTable = new LongSparseArray<>(); } sHandler.post(new Runnable() { @Override public void run() { calculateSensitivityData(); } }); }
@Subscribe public void onStatusEvent(EventPreferenceChange ev) { if (ev.isChanged(R.string.key_openapsama_autosens_period) || ev.isChanged(R.string.key_age) || ev.isChanged(R.string.key_absorption_maxtime) ) { synchronized (dataLock) { log.debug("Invalidating cached data because of preference change. IOB: " + iobTable.size() + " Autosens: " + autosensDataTable.size() + " records"); iobTable = new LongSparseArray<>(); autosensDataTable = new LongSparseArray<>(); } sHandler.post(new Runnable() { @Override public void run() { calculateSensitivityData(); } }); } }
@Override public Set<? extends Cluster<T>> getClusters(double zoom) { long numCells = (long) Math.ceil(256 * Math.pow(2, zoom) / GRID_SIZE); SphericalMercatorProjection proj = new SphericalMercatorProjection(numCells); HashSet<Cluster<T>> clusters = new HashSet<Cluster<T>>(); LongSparseArray<StaticCluster<T>> sparseArray = new LongSparseArray<StaticCluster<T>>(); synchronized (mItems) { for (T item : mItems) { Point p = proj.toPoint(item.getPosition()); long coord = getCoord(numCells, p.x, p.y); StaticCluster<T> cluster = sparseArray.get(coord); if (cluster == null) { cluster = new StaticCluster<T>(proj.toLatLng(new Point(Math.floor(p.x) + .5, Math.floor(p.y) + .5))); sparseArray.put(coord, cluster); clusters.add(cluster); } cluster.add(item); } } return clusters; }
/** * Returns the set of checked items ids. The result is only valid if the * choice mode has not been set to {@link ChoiceMode#NONE} and the adapter * has stable IDs. ({@link ListAdapter#hasStableIds()} == {@code true}) * * @return A new array which contains the id of each checked item in the * list. */ public long[] getCheckedItemIds() { if (mChoiceMode == ChoiceMode.NONE || mCheckedIdStates == null || mAdapter == null) { return new long[0]; } final LongSparseArray<Integer> idStates = mCheckedIdStates; final int count = idStates.size(); final long[] ids = new long[count]; for (int i = 0; i < count; i++) { ids[i] = idStates.keyAt(i); } return ids; }
/** * Constructor called from {@link #CREATOR} */ private SavedState(Parcel in) { super(in); selectedId = in.readLong(); firstId = in.readLong(); viewStart = in.readInt(); position = in.readInt(); size = in.readInt(); checkedItemCount = in.readInt(); checkState = in.readSparseBooleanArray(); final int N = in.readInt(); if (N > 0) { checkIdState = new LongSparseArray<Integer>(); for (int i = 0; i < N; i++) { final long key = in.readLong(); final int value = in.readInt(); checkIdState.put(key, value); } } }
private void setOverriddenTargets(long[] paramArrayOfLong) { PreferenceFile.SharedPreference localSharedPreference = FinskyPreferences.targetOverrideList.get(this.mAccountName); if ((paramArrayOfLong == null) || (paramArrayOfLong.length == 0)) { localSharedPreference.remove(); this.mOverriddenTargets = null; } for (;;) { return; localSharedPreference.put(Utils.commaPackLongs(paramArrayOfLong)); this.mOverriddenTargets = new LongSparseArray(paramArrayOfLong.length); int i = paramArrayOfLong.length; for (int j = 0; j < i; j++) { long l = paramArrayOfLong[j]; this.mOverriddenTargets.append(l, null); } } }
final void removeViewHolder(RecyclerView.ViewHolder paramViewHolder) { for (int i = -1 + this.mOldChangedHolders.size();; i--) { if (i >= 0) { if (paramViewHolder != this.mOldChangedHolders.valueAt(i)) { continue; } LongSparseArray localLongSparseArray = this.mOldChangedHolders; if (localLongSparseArray.mValues[i] != LongSparseArray.DELETED) { localLongSparseArray.mValues[i] = LongSparseArray.DELETED; localLongSparseArray.mGarbage = true; } } InfoRecord localInfoRecord = (InfoRecord)this.mLayoutHolderMap.remove(paramViewHolder); if (localInfoRecord != null) { InfoRecord.recycle(localInfoRecord); } return; } }
/** * This constructor is for working with cache. * * If contact was in cache we won't resolve contact * but will get directly from cache. * * @param context Context in order to use resolve some contact parts. (Like contact) * @param cursor cursor to get data from. * @param contactCache so save or retrieve contact without querying... */ public Conversation(Context context,Cursor cursor,LongSparseArray<ArrayList<Contact>> contactCache){ this.recipientIds = cursor.getString(cursor.getColumnIndex(RECIPIENT_IDS)); this.lastMessage = cursor.getString(cursor.getColumnIndex(LAST_MESSAGE)); this.date = new Date(cursor.getLong(cursor.getColumnIndex(DATE))); this.messageRead = cursor.getInt(cursor.getColumnIndex(IS_READ)) == 1; this.id = cursor.getLong(cursor.getColumnIndex(THREAD_ID)); ArrayList<Contact> cached= contactCache.get(id,null); if(cached == null){ this.contacts = resolveContacts(context,recipientIds); // save in cache contactCache.append(id,contacts); }else{ this.contacts = cached; } }
@Override public ArrayList<Conversation> loadInBackground() { ArrayList<Conversation> conversations = new ArrayList<>(); if(mContactCache == null) mContactCache = new LongSparseArray<>(); Cursor cursor = getContext().getContentResolver().query(uri, null, null, null, "date desc"); if (cursor != null) { cursor.getCount(); while(cursor.moveToNext()){ int numMsg = cursor.getInt(cursor.getColumnIndex(Constants.MSG_COUNT)); if(numMsg <= 0) continue; // we don't need empty conversations Conversation conversation = new Conversation(getContext(),cursor,mContactCache); conversations.add(conversation); } cursor.close(); } return conversations; }
public static synchronized void loadSendMsgBeansToMap(ContentResolver resolver, long mid, long uid, LongSparseArray<MsgBean> mapSend, long targetOrderNum, int count) { checkUIDs(mid, uid); if (targetOrderNum < 0) targetOrderNum = ContentHelper.getMaxOrderNumSendOrReceived(resolver, mid, uid) - count; Cursor cursorSend = ContentHelper.MSG_SEND.getCursorOrderNumDesc(resolver, mid, uid); if (cursorSend != null) { while (cursorSend.moveToNext()) { long orderNum = cursorSend.getLong(cursorSend.getColumnIndex(MSG.DbColumns.MsgSend._ORDER_NUM)); if (orderNum <= targetOrderNum) { break; } long id = cursorSend.getLong(cursorSend.getColumnIndex(MSG.DbColumns.MsgSend._ID)); int ctype = cursorSend.getInt(cursorSend.getColumnIndex(MSG.DbColumns.MsgSend._TYPE_CONTENT)); String content = cursorSend.getString(cursorSend.getColumnIndex(MSG.DbColumns.MsgSend._CONTENT)); int arriveState = cursorSend.getInt(cursorSend.getColumnIndex(MSG.DbColumns.MsgSend._ARRIVE_STATE)); MsgBean bean = new MsgBean(id, MsgBean.TYPE_ME, ctype, content, orderNum, 0, arriveState); bean.timeSend = cursorSend.getLong(cursorSend.getColumnIndex(MSG.DbColumns.MsgSend._TIME_LOCAL)); mapSend.put(bean.id, bean); } cursorSend.close(); } }
public static synchronized void loadReceivedMsgBeansToMap(ContentResolver resolver, long mid, long uid, LongSparseArray<MsgBean> mapReceived, long targetOrderNum, int count) { checkUIDs(mid, uid); if (targetOrderNum < 0) targetOrderNum = ContentHelper.getMaxOrderNumSendOrReceived(resolver, mid, uid) - count; Cursor cursorReceived = ContentHelper.MSG_RECEIVED.getCursorOrderNumDesc(resolver, mid, uid); if (cursorReceived != null) { while (cursorReceived.moveToNext()) { long orderNum = cursorReceived.getLong(cursorReceived.getColumnIndex(MSG.DbColumns.MsgReceived._ORDER_NUM)); if (orderNum <= targetOrderNum) { break; } long id = cursorReceived.getLong(cursorReceived.getColumnIndex(MSG.DbColumns.MsgReceived._ID)); int ctype = cursorReceived.getInt(cursorReceived.getColumnIndex(MSG.DbColumns.MsgReceived._TYPE_CONTENT)); String content = cursorReceived.getString(cursorReceived.getColumnIndex(MSG.DbColumns.MsgReceived._CONTENT)); int timeLength = cursorReceived.getInt(cursorReceived.getColumnIndex(MSG.DbColumns.MsgReceived._TIME_LENGTH)); int readTimes = cursorReceived.getInt(cursorReceived.getColumnIndex(MSG.DbColumns.MsgReceived._READ_TIMES)); MsgBean bean = new MsgBean(id, MsgBean.TYPE_OTHER, ctype, content, orderNum, timeLength); bean.timeSend = cursorReceived.getLong(cursorReceived.getColumnIndex(MSG.DbColumns.MsgReceived._TIME_SEND)); bean.readTimes = readTimes; mapReceived.put(bean.id, bean); } cursorReceived.close(); } }
private short findMidPoint(short v1, short v2, short vCount, LongSparseArray<Short> vertexCache) { float x = (vertices[v1 * 3] + vertices[v2 * 3]) / 2f; float y = (vertices[v1 * 3 + 1] + vertices[v2 * 3 + 1]) / 2f; float z = (vertices[v1 * 3 + 2] + vertices[v2 * 3 + 2]) / 2f; short tmp; if (v1 > v2) { tmp = v1; v1 = v2; v2 = tmp; } Short index = vertexCache.get((long) v1 << 32 | (long) v2); if (index == null) { addVertex(x, y, z, vCount); vertexCache.put((long) v1 << 32 | (long) v2, vCount); index = vCount; } return index; }
/** * Returns the set of checked items ids. The result is only valid if the * choice mode has not been set to {@link #CHOICE_MODE_NONE} and the adapter * has stable IDs. ({@link ListAdapter#hasStableIds()} == {@code true}) * * @return A new array which contains the myId of each checked item in the * list. */ public long[] getCheckedItemIds() { if ( mChoiceMode.compareTo( ChoiceMode.NONE ) == 0 || mCheckedIdStates == null || mAdapter == null ) { return new long[0]; } final LongSparseArray<Integer> idStates = mCheckedIdStates; final int count = idStates.size(); final long[] ids = new long[count]; for ( int i = 0; i < count; i++ ) { ids[i] = idStates.keyAt( i ); } return ids; }
/** * 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} */ 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>(); } } }