@Override public void writeToParcel(Parcel out, int flags) { out.writeParcelable(superState, flags); out.writeInt(prevFirstVisiblePosition); out.writeInt(prevFirstVisibleChildHeight); out.writeInt(prevScrolledChildrenHeight); out.writeInt(prevScrollY); out.writeInt(scrollY); final int numOfChildren = childrenHeights == null ? 0 : childrenHeights.size(); out.writeInt(numOfChildren); if (0 < numOfChildren) { for (int i = 0; i < numOfChildren; i++) { out.writeInt(childrenHeights.keyAt(i)); out.writeInt(childrenHeights.valueAt(i)); } } }
@Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeInt(prevFirstVisiblePosition); out.writeInt(prevFirstVisibleChildHeight); out.writeInt(prevScrolledChildrenHeight); out.writeInt(prevScrollY); out.writeInt(scrollY); final int numOfChildren = childrenHeights == null ? 0 : childrenHeights.size(); out.writeInt(numOfChildren); if (0 < numOfChildren) { for (int i = 0; i < numOfChildren; i++) { out.writeInt(childrenHeights.keyAt(i)); out.writeInt(childrenHeights.valueAt(i)); } } }
@Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeInt(prevFirstVisiblePosition); out.writeInt(prevFirstVisibleChildHeight); out.writeInt(prevScrolledChildrenHeight); out.writeInt(prevScrollY); out.writeInt(scrollY); final int numOfChildren = childrenHeights == null ? 0 : childrenHeights.size(); out.writeInt(numOfChildren); if (0 < numOfChildren) { for (int i = 0; i < numOfChildren; i++) { out.writeInt(childrenHeights.keyAt(i)); out.writeInt(childrenHeights.valueAt(i)); } } }
/** Notify the {@link OnLoadCompleteListener}, if present, that the given resource was loaded. */ public void notifyResourceLoaded(int resId, boolean success) { boolean soundIsKnown = false; for (int resIdx = 0; resIdx < idToRes.size(); ++resIdx) { if (idToRes.valueAt(resIdx) == resId) { if (listener != null) { listener.onLoadComplete(realObject, idToRes.keyAt(resIdx), success ? 0 : 1); } soundIsKnown = true; } } if (!soundIsKnown) { throw new IllegalArgumentException("Unknown sound. You need to call load() first"); } }
private void incrementExpandMapAfter(int position, int direction) { SparseIntArray newExpandMap = new SparseIntArray(); for (int i=0; i<expandMap.size(); i++) { int index = expandMap.keyAt(i); newExpandMap.put(index < position ? index : index + direction, 1); } expandMap = newExpandMap; }
mFacing = INTERNAL_FACINGS.keyAt(i); return true;
s.append("detail 统计次数 "); for (int i = 0; i < sparseIntArray.size(); i++) { s.append("size:" + sparseIntArray.keyAt(i) + "->time:" + sparseIntArray.valueAt(i) + " ");
mFacing = INTERNAL_FACINGS.keyAt(i); return true;
int trackId = trackIdToPidScratch.keyAt(i); int trackPid = trackIdToPidScratch.valueAt(i); trackIds.put(trackId, true);
@Override public int getGroupClickStatus(int groupPosition) { if (groupStatusMap.keyAt(groupPosition) >= 0) { return groupStatusMap.get(groupPosition); } else { return 0; } } }
@Override public void writeToParcel(Parcel dest, int flags) { final int size = mMonstersAndPercents.size(); dest.writeInt(size); for (int i = 0; i < size; i++) { dest.writeInt(mMonstersAndPercents.keyAt(i)); dest.writeInt(mMonstersAndPercents.valueAt(i)); } }
private void drawProjection(Canvas canvas) { mPath.reset(); int x = mLocalPaths.keyAt(mLocalPaths.size() - 2); int y = mLocalPaths.valueAt(mLocalPaths.size() - 2); mPath.moveTo(x, y); mPath.lineTo(canvas.getWidth(), mProjectUp ? 0 : canvas.getHeight()); canvas.drawPath(mPath, mDottedPaint); }
private int queryIndex(int id) { for (int i = 0; i < ids.size(); i++) { if (ids.valueAt(i) == id) { return ids.keyAt(i); } } return 0; }
/** * 设置选中项 * * @param selectedPosition */ public void setCheckedPosition(int selectedPosition) { if (selectedPosition >= 0 && selectedPosition <= switchCount) { mCurrentPosition = selectedPosition; if (mSparseIds != null) check(mSparseIds.get(mSparseIds.keyAt(selectedPosition))); } }
public static boolean isIPInChina(int ip) { boolean found = false; for (int i = 0; i < MaskDict.size(); i++) { int mask = MaskDict.keyAt(i); int networkIP = ip & mask; int mask2 = ChinaIpMaskDict.get(networkIP); if (mask2 == mask) { found = true; break; } } return found; }
private int findFullSpanCountByPosition(int position) { if (mFullSpanRecorder == null) { return 0; } int size = mFullSpanRecorder.size(); for (int i = size - 1; i >= 0; i--) { int target = mFullSpanRecorder.keyAt(i); if (target < position) { //look up last full span position and get the full span count return mFullSpanRecorder.valueAt(i); } } return 0; // if non return zero }
public SparseIntArrayParcelable(SparseIntArray sparseIntArray) { for (int i = 0; i < sparseIntArray.size(); i++) { this.put(sparseIntArray.keyAt(i), sparseIntArray.valueAt(i)); } }
private void incrementExpandMapAfter(int position, int direction) { SparseIntArray newExpandMap = new SparseIntArray(); for (int i=0; i<expandMap.size(); i++) { int index = expandMap.keyAt(i); newExpandMap.put(index < position ? index : index + direction, 1); } expandMap = newExpandMap; }
/** * Records information about grouping in the list. * Should be called by the overridden {@link #addGroups} method. */ public void addGroup(int cursorPosition, int groupSize) { int lastIndex = mGroupMetadata.size() - 1; if (lastIndex < 0 || cursorPosition <= mGroupMetadata.keyAt(lastIndex)) { mGroupMetadata.put(cursorPosition, groupSize); } else { // Optimization to avoid binary search if adding groups in ascending cursor position. mGroupMetadata.append(cursorPosition, groupSize); } }