当前位置: 首页>>代码示例>>Java>>正文


Java SparseIntArray.append方法代码示例

本文整理汇总了Java中android.util.SparseIntArray.append方法的典型用法代码示例。如果您正苦于以下问题:Java SparseIntArray.append方法的具体用法?Java SparseIntArray.append怎么用?Java SparseIntArray.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.util.SparseIntArray的用法示例。


在下文中一共展示了SparseIntArray.append方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setItemPosition

import android.util.SparseIntArray; //导入方法依赖的package包/类
/**
 * Sets the {@link #mItemPosition} instance variable with the current mapping of
 * row id to cursor position.
 */
private void setItemPosition() {
    if (mCursor == null || mCursor.isClosed()) {
        mItemPosition = null;
        return;
    }

    SparseIntArray itemPosition = new SparseIntArray(mCursor.getCount());

    mCursor.moveToPosition(-1);
    while (mCursor.moveToNext()) {
        final int rowId = mCursor.getString(mRowIDColumn).hashCode();
        final int position = mCursor.getPosition();

        itemPosition.append(rowId, position);
    }
    mItemPosition = itemPosition;
}
 
开发者ID:YuntaoWei,项目名称:PictureShow,代码行数:22,代码来源:BaseCursorPagerAdapter.java

示例2: makeBucketSizeArray

import android.util.SparseIntArray; //导入方法依赖的package包/类
private static SparseIntArray makeBucketSizeArray(int... params) {
  Preconditions.checkArgument(params.length % 2 == 0);
  final SparseIntArray bucketSizes = new SparseIntArray();
  for (int i = 0; i < params.length; i += 2) {
    bucketSizes.append(params[i], params[i + 1]);
  }
  return bucketSizes;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:BasePoolTest.java

示例3: readSparseIntArray

import android.util.SparseIntArray; //导入方法依赖的package包/类
@NonNull
private static SparseIntArray readSparseIntArray(Parcel in) {
    int size = in.readInt();
    if (size < 0) {
        return new SparseIntArray(0);
    }
    SparseIntArray array = new SparseIntArray(size);
    for (int i = 0; i < size; ++i) {
        array.append(in.readInt(), in.readInt());
    }
    return array;
}
 
开发者ID:brevent,项目名称:Brevent,代码行数:13,代码来源:ParcelUtils.java

示例4: fillMaxMinArrays

import android.util.SparseIntArray; //导入方法依赖的package包/类
/**
 * Populates the max and min arrays for a given set of draw commands.  Also populates a mapping of
 * react tags to their index position in the command array.
 *
 * This should never be called from the UI thread, as the reason it exists is to do work off the
 * UI thread.
 *
 * @param commands The draw commands that will eventually be mounted.
 * @param maxBottom At each index i, the maximum bottom value of all draw commands at or below i.
 * @param minTop At each index i, the minimum top value of all draw commands at or below i.
 * @param drawViewIndexMap Mapping of ids to index position within the draw command array.
 */
public static void fillMaxMinArrays(
    DrawCommand[] commands,
    float[] maxBottom,
    float[] minTop,
    SparseIntArray drawViewIndexMap) {
  float last = 0;
  // Loop through the DrawCommands, keeping track of the maximum we've seen if we only iterated
  // through items up to this position.
  for (int i = 0; i < commands.length; i++) {
    if (commands[i] instanceof DrawView) {
      DrawView drawView = (DrawView) commands[i];
      // These will generally be roughly sorted by id, so try to insert at the end if possible.
      drawViewIndexMap.append(drawView.reactTag, i);
      last = Math.max(last, drawView.mLogicalBottom);
    } else {
      last = Math.max(last, commands[i].getBottom());
    }
    maxBottom[i] = last;
  }
  // Intentionally leave last as it was, since it's at the maximum bottom position we've seen so
  // far, we can use it again.

  // Loop through backwards, keeping track of the minimum we've seen at this position.
  for (int i = commands.length - 1; i >= 0; i--) {
    if (commands[i] instanceof DrawView) {
      last = Math.min(last, ((DrawView) commands[i]).mLogicalTop);
    } else {
      last = Math.min(last, commands[i].getTop());
    }
    minTop[i] = last;
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:45,代码来源:VerticalDrawCommandManager.java

示例5: fillMaxMinArrays

import android.util.SparseIntArray; //导入方法依赖的package包/类
/**
 * Populates the max and min arrays for a given set of draw commands.  Also populates a mapping of
 * react tags to their index position in the command array.
 *
 * This should never be called from the UI thread, as the reason it exists is to do work off the
 * UI thread.
 *
 * @param commands The draw commands that will eventually be mounted.
 * @param maxRight At each index i, the maximum right value of all draw commands at or below i.
 * @param minLeft At each index i, the minimum left value of all draw commands at or below i.
 * @param drawViewIndexMap Mapping of ids to index position within the draw command array.
 */
public static void fillMaxMinArrays(
    DrawCommand[] commands,
    float[] maxRight,
    float[] minLeft,
    SparseIntArray drawViewIndexMap) {
  float last = 0;
  // Loop through the DrawCommands, keeping track of the maximum we've seen if we only iterated
  // through items up to this position.
  for (int i = 0; i < commands.length; i++) {
    if (commands[i] instanceof DrawView) {
      DrawView drawView = (DrawView) commands[i];
      // These will generally be roughly sorted by id, so try to insert at the end if possible.
      drawViewIndexMap.append(drawView.reactTag, i);
      last = Math.max(last, drawView.mLogicalRight);
    } else {
      last = Math.max(last, commands[i].getRight());
    }
    maxRight[i] = last;
  }
  // Intentionally leave last as it was, since it's at the maximum bottom position we've seen so
  // far, we can use it again.

  // Loop through backwards, keeping track of the minimum we've seen at this position.
  for (int i = commands.length - 1; i >= 0; i--) {
    if (commands[i] instanceof DrawView) {
      last = Math.min(last, ((DrawView) commands[i]).mLogicalLeft);
    } else {
      last = Math.min(last, commands[i].getLeft());
    }
    minLeft[i] = last;
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:45,代码来源:HorizontalDrawCommandManager.java


注:本文中的android.util.SparseIntArray.append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。