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


Java SparseIntArray类代码示例

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


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

示例1: setSpecialInterval

import android.util.SparseIntArray; //导入依赖的package包/类
public void setSpecialInterval(JSONObject jsonObject) {
    if (jsonObject != null) {
        this.mSpecialInterval = new SparseIntArray();
        Iterator<String> itr = jsonObject.keys();
        while (itr.hasNext()) {
            String key = itr.next();
            try {
                int index = Integer.parseInt(key);
                int value = jsonObject.optInt(key);
                if (value > 0) {
                    this.mSpecialInterval.put(index, value);
                }
            } catch (NumberFormatException e) {
            }
        }
    }
}
 
开发者ID:alibaba,项目名称:Tangram-Android,代码行数:18,代码来源:BannerCell.java

示例2: onCheckedChanged

import android.util.SparseIntArray; //导入依赖的package包/类
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    if (buttonView == loopCheckBox) {
        ultraViewPager.setInfiniteLoop(isChecked);
    }
    if (buttonView == autoScrollCheckBox) {
        if (isChecked) {
            SparseIntArray special = new SparseIntArray();
            special.put(0, 5000);
            special.put(1, 1500);
            ultraViewPager.setAutoScroll(2000, special);
        }
        else
            ultraViewPager.disableAutoScroll();
    }
}
 
开发者ID:alibaba,项目名称:UltraViewPager,代码行数:17,代码来源:PagerActivity.java

示例3: getExpanded

import android.util.SparseIntArray; //导入依赖的package包/类
/**
 * returns the expanded items this contains position and the count of items
 * which are expanded by this position
 *
 * @return the expanded items
 */
public SparseIntArray getExpanded() {
    if (mPositionBasedStateManagement) {
        return mExpanded;
    } else {
        SparseIntArray expandedItems = new SparseIntArray();
        Item item;
        for (int i = 0, size = getItemCount(); i < size; i++) {
            item = getItem(i);
            if (item instanceof IExpandable && ((IExpandable) item).isExpanded()) {
                expandedItems.put(i, ((IExpandable) item).getSubItems().size());
            }
        }
        return expandedItems;
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:FastAdapter.java

示例4: getTagDefinitionForTag

import android.util.SparseIntArray; //导入依赖的package包/类
protected int getTagDefinitionForTag( short tagId, short type, int count, int ifd ) {
	int[] defs = getTagDefinitionsForTagId( tagId );
	if( defs == null ) {
		return TAG_NULL;
	}
	SparseIntArray infos = getTagInfo();
	int ret = TAG_NULL;
	for( int i : defs ) {
		int info = infos.get( i );
		short def_type = getTypeFromInfo( info );
		int def_count = getComponentCountFromInfo( info );
		int[] def_ifds = getAllowedIfdsFromInfo( info );
		boolean valid_ifd = false;
		for( int j : def_ifds ) {
			if( j == ifd ) {
				valid_ifd = true;
				break;
			}
		}
		if( valid_ifd && type == def_type && ( count == def_count || def_count == ExifTag.SIZE_UNDEFINED ) ) {
			ret = i;
			break;
		}
	}
	return ret;
}
 
开发者ID:tateisu,项目名称:SubwayTooter,代码行数:27,代码来源:ExifInterface.java

示例5: onStart

import android.util.SparseIntArray; //导入依赖的package包/类
@Override
public void onStart() {
    super.onStart();
    initView();

    mFaces = new FaceResult[MAX_FACE_COUNT];
    mPreviousFaces = new FaceResult[MAX_FACE_COUNT];
    mDetectedFaces = new FaceDetector.Face[MAX_FACE_COUNT];
    for (int i = 0; i < MAX_FACE_COUNT; i++) {
        mFaces[i] = new FaceResult();
        mPreviousFaces[i] = new FaceResult();
    }
    mFacesCountMap = new SparseIntArray();

    presenter = new SignInPresenter(this,getContext());
    presenter.start();
}
 
开发者ID:lazyparser,项目名称:xbot_head,代码行数:18,代码来源:SignInFragment.java

示例6: PoolParams

import android.util.SparseIntArray; //导入依赖的package包/类
/**
 * Set up pool params
 * @param maxSizeSoftCap soft cap on max size of the pool
 * @param maxSizeHardCap hard cap on max size of the pool
 * @param bucketSizes (optional) bucket sizes and lengths for the pool
 * @param minBucketSize min bucket size for the pool
 * @param maxBucketSize max bucket size for the pool
 * @param maxNumThreads the maximum number of threads in th epool, or -1 if the pool doesn't care
 */
public PoolParams(
    int maxSizeSoftCap,
    int maxSizeHardCap,
    @Nullable SparseIntArray bucketSizes,
    int minBucketSize,
    int maxBucketSize,
    int maxNumThreads) {
  Preconditions.checkState(maxSizeSoftCap >= 0 && maxSizeHardCap >= maxSizeSoftCap);
  this.maxSizeSoftCap = maxSizeSoftCap;
  this.maxSizeHardCap = maxSizeHardCap;
  this.bucketSizes = bucketSizes;
  this.minBucketSize = minBucketSize;
  this.maxBucketSize = maxBucketSize;
  this.maxNumThreads = maxNumThreads;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:PoolParams.java

示例7: get

import android.util.SparseIntArray; //导入依赖的package包/类
public static PoolParams get() {
  SparseIntArray DEFAULT_BUCKETS = new SparseIntArray();
  DEFAULT_BUCKETS.put(1 * ByteConstants.KB, SMALL_BUCKET_LENGTH);
  DEFAULT_BUCKETS.put(2 * ByteConstants.KB, SMALL_BUCKET_LENGTH);
  DEFAULT_BUCKETS.put(4 * ByteConstants.KB, SMALL_BUCKET_LENGTH);
  DEFAULT_BUCKETS.put(8 * ByteConstants.KB, SMALL_BUCKET_LENGTH);
  DEFAULT_BUCKETS.put(16 * ByteConstants.KB, SMALL_BUCKET_LENGTH);
  DEFAULT_BUCKETS.put(32 * ByteConstants.KB, SMALL_BUCKET_LENGTH);
  DEFAULT_BUCKETS.put(64 * ByteConstants.KB, SMALL_BUCKET_LENGTH);
  DEFAULT_BUCKETS.put(128 * ByteConstants.KB, SMALL_BUCKET_LENGTH);
  DEFAULT_BUCKETS.put(256 * ByteConstants.KB, LARGE_BUCKET_LENGTH);
  DEFAULT_BUCKETS.put(512 * ByteConstants.KB, LARGE_BUCKET_LENGTH);
  DEFAULT_BUCKETS.put(1024 * ByteConstants.KB, LARGE_BUCKET_LENGTH);
  return new PoolParams(
      getMaxSizeSoftCap(),
      getMaxSizeHardCap(),
      DEFAULT_BUCKETS);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:DefaultNativeMemoryChunkPoolParams.java

示例8: BasePool

import android.util.SparseIntArray; //导入依赖的package包/类
/**
 * Creates a new instance of the pool.
 * @param poolParams pool parameters
 * @param poolStatsTracker
 */
public BasePool(
    MemoryTrimmableRegistry memoryTrimmableRegistry,
    PoolParams poolParams,
    PoolStatsTracker poolStatsTracker) {
  mMemoryTrimmableRegistry = Preconditions.checkNotNull(memoryTrimmableRegistry);
  mPoolParams = Preconditions.checkNotNull(poolParams);
  mPoolStatsTracker = Preconditions.checkNotNull(poolStatsTracker);

  // initialize the buckets
  mBuckets = new SparseArray<Bucket<V>>();
  initBuckets(new SparseIntArray(0));

  mInUseValues = Sets.newIdentityHashSet();

  mFree = new Counter();
  mUsed = new Counter();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:BasePool.java

示例9: initBuckets

import android.util.SparseIntArray; //导入依赖的package包/类
/**
 * Initialize the list of buckets. Get the bucket sizes (and bucket lengths) from the bucket
 * sizes provider
 * @param inUseCounts map of current buckets and their in use counts
 */
private synchronized void initBuckets(SparseIntArray inUseCounts) {
  Preconditions.checkNotNull(inUseCounts);

  // clear out all the buckets
  mBuckets.clear();

  // create the new buckets
  final SparseIntArray bucketSizes = mPoolParams.bucketSizes;
  if (bucketSizes != null) {
    for (int i = 0; i < bucketSizes.size(); ++i) {
      final int bucketSize = bucketSizes.keyAt(i);
      final int maxLength = bucketSizes.valueAt(i);
      int bucketInUseCount = inUseCounts.get(bucketSize, 0);
      mBuckets.put(
          bucketSize,
          new Bucket<V>(
              getSizeInBytes(bucketSize),
              maxLength,
              bucketInUseCount));
    }
    mAllowNewBuckets = false;
  } else {
    mAllowNewBuckets = true;
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:31,代码来源:BasePool.java

示例10: setup

import android.util.SparseIntArray; //导入依赖的package包/类
@Before
public void setup() {
  SparseIntArray buckets = new SparseIntArray();
  for (int i = MIN_BUFFER_SIZE; i <= MAX_BUFFER_SIZE; i*=2) {
    buckets.put(i, 3);
  }
  mPool = new FlexByteArrayPool(
      mock(MemoryTrimmableRegistry.class),
      new PoolParams(
          Integer.MAX_VALUE,
          Integer.MAX_VALUE,
          buckets,
          MIN_BUFFER_SIZE,
          MAX_BUFFER_SIZE,
          1));
  mDelegatePool = mPool.mDelegatePool;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:FlexByteArrayPoolTest.java

示例11: UpdateClippingMountState

import android.util.SparseIntArray; //导入依赖的package包/类
private UpdateClippingMountState(
    int reactTag,
    @Nullable DrawCommand[] drawCommands,
    SparseIntArray drawViewIndexMap,
    float[] commandMaxBot,
    float[] commandMinTop,
    @Nullable AttachDetachListener[] listeners,
    @Nullable NodeRegion[] nodeRegions,
    float[] regionMaxBot,
    float[] regionMinTop,
    boolean willMountViews) {
  mReactTag = reactTag;
  mDrawCommands = drawCommands;
  mDrawViewIndexMap = drawViewIndexMap;
  mCommandMaxBot = commandMaxBot;
  mCommandMinTop = commandMinTop;
  mAttachDetachListeners = listeners;
  mNodeRegions = nodeRegions;
  mRegionMaxBot = regionMaxBot;
  mRegionMinTop = regionMinTop;
  mWillMountViews = willMountViews;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:23,代码来源:FlatUIViewOperationQueue.java

示例12: buildInflateRules

import android.util.SparseIntArray; //导入依赖的package包/类
/**
     * Build inflate rules.
     *
     * @param v
     * @param array ID map of which Key as skin id and value as mapped id.
     */
    protected void buildInflateRules(View v, SparseIntArray array) {
        ViewGroup.LayoutParams lp = v.getLayoutParams();
        if (lp == null) {
            return;
        }
        if (lp instanceof RelativeLayout.LayoutParams) {
            int[] rules = ((RelativeLayout.LayoutParams) lp).getRules();
            if (rules == null) {
                return;
            }
            int size = rules.length;
            int mapRule = -1;
            for (int i = 0; i < size; i++) {
                //Key as skin id and value as mapped id.
                if (rules[i] > 0 && (mapRule = array.get(rules[i])) > 0) {
//                    Log.i(TAG, "Rules[" + i + "]: Mapped from: " + rules[i] + "  to  " +mapRule);
                    rules[i] = mapRule;
                }
            }
        }
    }
 
开发者ID:Zeal27,项目名称:SkinFramework,代码行数:28,代码来源:SkinResource.java

示例13: getMaxAnswersId

import android.util.SparseIntArray; //导入依赖的package包/类
private int getMaxAnswersId() {
  int max = 0;
  int id = 0;

  SparseIntArray answers = new SparseIntArray();
  for (QA qa : socTest.getQa()) {
    int answer = qa.getAnswer();
    answers.put(answer, answers.get(answer, 0) + 1);
  }

  for (int i = 0; i < answers.size(); i++) {
    if (max < answers.valueAt(i)) {
      max = answers.valueAt(i);
      id = answers.keyAt(i);
    }
  }

  return id;
}
 
开发者ID:Komdosh,项目名称:SocEltech,代码行数:20,代码来源:TestViewActivity.java

示例14: TsExtractor

import android.util.SparseIntArray; //导入依赖的package包/类
/**
 * @param mode Mode for the extractor. One of {@link #MODE_MULTI_PMT}, {@link #MODE_SINGLE_PMT}
 *     and {@link #MODE_HLS}.
 * @param timestampAdjuster A timestamp adjuster for offsetting and scaling sample timestamps.
 * @param payloadReaderFactory Factory for injecting a custom set of payload readers.
 */
public TsExtractor(@Mode int mode, TimestampAdjuster timestampAdjuster,
    TsPayloadReader.Factory payloadReaderFactory) {
  this.payloadReaderFactory = Assertions.checkNotNull(payloadReaderFactory);
  this.mode = mode;
  if (mode == MODE_SINGLE_PMT || mode == MODE_HLS) {
    timestampAdjusters = Collections.singletonList(timestampAdjuster);
  } else {
    timestampAdjusters = new ArrayList<>();
    timestampAdjusters.add(timestampAdjuster);
  }
  tsPacketBuffer = new ParsableByteArray(BUFFER_SIZE);
  tsScratch = new ParsableBitArray(new byte[3]);
  trackIds = new SparseBooleanArray();
  tsPayloadReaders = new SparseArray<>();
  continuityCounters = new SparseIntArray();
  resetPayloadReaders();
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:24,代码来源:TsExtractor.java

示例15: getSections

import android.util.SparseIntArray; //导入依赖的package包/类
@Override
public Object[] getSections() {
    positionOfSection = new SparseIntArray();
    sectionOfPosition = new SparseIntArray();
    int count = getCount();
    list = new ArrayList<String>();
    list.add(getContext().getString(R.string.search_header));
    positionOfSection.put(0, 0);
    sectionOfPosition.put(0, 0);
    for (int i = 1; i < count; i++) {

        String letter = getItem(i).getInitialLetter();
        int section = list.size() - 1;
        if (list.get(section) != null && !list.get(section).equals(letter)) {
            list.add(letter);
            section++;
            positionOfSection.put(section, i);
        }
        sectionOfPosition.put(i, section);
    }
    return list.toArray(new String[list.size()]);
}
 
开发者ID:Vicent9920,项目名称:FanChat,代码行数:23,代码来源:EaseContactAdapter.java


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