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


Java SparseIntArray.get方法代码示例

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


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

示例1: 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

示例2: 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

示例3: getTagDefinitionsForTagId

import android.util.SparseIntArray; //导入方法依赖的package包/类
protected int[] getTagDefinitionsForTagId( short tagId ) {
	int[] ifds = IfdData.getIfds();
	int[] defs = new int[ifds.length];
	int counter = 0;
	SparseIntArray infos = getTagInfo();
	for( int i : ifds ) {
		int def = defineTag( i, tagId );
		if( infos.get( def ) != DEFINITION_NULL ) {
			defs[counter++] = def;
		}
	}
	if( counter == 0 ) {
		return null;
	}

	return Arrays.copyOfRange( defs, 0, counter );
}
 
开发者ID:tateisu,项目名称:SubwayTooter,代码行数:18,代码来源:ExifInterface.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: getTargetInfo

import android.util.SparseIntArray; //导入方法依赖的package包/类
private TargetInfo getTargetInfo(){
	mBgdBInfo.setTrain_date(mCurrMInfo.getStart_time());
	mBgdBInfo.setFrom_station(mCurrMInfo
			.getFrom_station_telecode());
	mBgdBInfo.setTo_station(mCurrMInfo.getTo_station_telecode());
	mBgdBInfo.setPurpose_codes(mCurrMInfo.getPurpose_codes());
	A6Info<List<QueryLeftNewInfo>> a6Info = A6Util.queryTickets(mBgdBInfo);
	if (a6Info == null || a6Info.getData() == null){
		return null;
	}
	for (QueryLeftNewInfo qlnInfo : a6Info.getDataObject()) {
		QueryLeftNewDTOInfo qlndInfo = qlnInfo
				.getQueryLeftNewDTO();
		int trainIndex = mCurrMInfo.getLstTrainNames().indexOf(qlndInfo.getStation_train_code());
		if (trainIndex != -1 && mCurrMInfo.getSelectedTrainsNames()[trainIndex]){
			SeatHelper sHelper = new SeatHelper(qlndInfo);
			SparseIntArray saNums = sHelper
					.getSeatReferenceNums();
			int num = mCurrMInfo.getLstPNativeIndexes().size();
			for (int i = 0; i < mCurrMInfo.getLstSeatTypes()
					.size(); i++) {
				Integer seatType = mCurrMInfo.getLstSeatTypes()
						.get(i);
				Integer seatNum = saNums.get(seatType);
				if (seatNum != null && (seatNum >= num)) {
					TargetInfo tInfo = new TargetInfo();
					tInfo.setQlnInfo(qlnInfo);
					tInfo.setSeatHelper(sHelper);
					tInfo.setSeatType(seatType);
					tInfo.setNum(num);
					return tInfo;
				}
			}
		}
	}
	return null;
}
 
开发者ID:SShineTeam,项目名称:Huochexing12306,代码行数:38,代码来源:BgdService2.java

示例6: getInactive

import android.util.SparseIntArray; //导入方法依赖的package包/类
public static int getInactive(SparseIntArray status) {
    if (status == null) {
        return 0;
    } else {
        return status.get(PROCESS_STATE_INACTIVE, 0);
    }
}
 
开发者ID:brevent,项目名称:Brevent,代码行数:8,代码来源:BreventResponse.java

示例7: getForPosition

import android.util.SparseIntArray; //导入方法依赖的package包/类
private static int getForPosition(SparseIntArray positions, Integer key) {
	return positions.get(key);
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:4,代码来源:Filter.java

示例8: updateHistogramCounter

import android.util.SparseIntArray; //导入方法依赖的package包/类
private static int updateHistogramCounter(final SparseIntArray histogram, final int key) {
    final int index = histogram.indexOfKey(key);
    final int count = (index >= 0 ? histogram.get(key) : 0) + 1;
    histogram.put(key, count);
    return count;
}
 
开发者ID:rkkr,项目名称:simple-keyboard,代码行数:7,代码来源:KeyboardParams.java

示例9: fetchFromSparseArray

import android.util.SparseIntArray; //导入方法依赖的package包/类
static int fetchFromSparseArray(@Nullable SparseIntArray array, int position, int fallback) {
  return array == null ? fallback :
         array.get(position, array.get(Spacing.ALL));
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:5,代码来源:BorderUtil.java

示例10: isStandby

import android.util.SparseIntArray; //导入方法依赖的package包/类
public static boolean isStandby(SparseIntArray status) {
    return status != null && status.get(PROCESS_STATE_IDLE, 0) != 0;
}
 
开发者ID:brevent,项目名称:Brevent,代码行数:4,代码来源:BreventResponse.java

示例11: isAudio

import android.util.SparseIntArray; //导入方法依赖的package包/类
public static boolean isAudio(SparseIntArray status) {
    return status != null && status.get(PROCESS_STATE_AUDIO, 0) != 0;
}
 
开发者ID:brevent,项目名称:Brevent,代码行数:4,代码来源:BreventResponse.java

示例12: isAudioPaused

import android.util.SparseIntArray; //导入方法依赖的package包/类
public static boolean isAudioPaused(SparseIntArray status) {
    return status != null && status.get(PROCESS_STATE_AUDIO_PAUSED, 0) != 0;
}
 
开发者ID:brevent,项目名称:Brevent,代码行数:4,代码来源:BreventResponse.java

示例13: isPersistent

import android.util.SparseIntArray; //导入方法依赖的package包/类
public static boolean isPersistent(SparseIntArray status) {
    return status != null && status.get(PROCESS_STATE_PERSISTENT, 0) != 0;
}
 
开发者ID:brevent,项目名称:Brevent,代码行数:4,代码来源:BreventResponse.java

示例14: updateAppsStatus

import android.util.SparseIntArray; //导入方法依赖的package包/类
private boolean updateAppsStatus() {
    BreventActivity activity = getActivity();
    if (activity == null) {
        return false;
    }
    boolean changed = mChanged;
    SparseIntArray counter = new SparseIntArray();
    for (AppsInfo appsInfo : mNext) {
        if (appsInfo.isPackage()) {
            int status = activity.getStatus(appsInfo.packageName);
            if (appsInfo.status != status) {
                appsInfo.status = status;
                appsInfo.updated = true;
                if (!changed) {
                    changed = true;
                }
            }
            int oldValue = counter.get(status, 0);
            counter.put(status, oldValue + 1);
        }
    }
    if (!changed) {
        return false;
    }
    mChanged = false;
    mHandler.sendEmptyMessage(AppsItemHandler.MSG_STOP_UPDATE);
    Iterator<AppsInfo> it = mNext.iterator();
    while (it.hasNext()) {
        if (!it.next().isPackage()) {
            it.remove();
        }
    }
    int size = counter.size();
    for (int i = 0; i < size; ++i) {
        mNext.add(new AppsInfo(counter.keyAt(i), String.valueOf(counter.valueAt(i))));
    }
    Collections.sort(mNext, getSortMethod());
    if (mAppsInfo.isEmpty()) {
        mAppsInfo.addAll(mNext);
        notifyItemRangeInserted(0, mNext.size());
    } else {
        DiffUtil.DiffResult result = DiffUtil.calculateDiff(new DiffCallback(mAppsInfo, mNext));
        mAppsInfo.clear();
        mAppsInfo.addAll(mNext);
        result.dispatchUpdatesTo(this);
    }
    return true;
}
 
开发者ID:brevent,项目名称:Brevent,代码行数:49,代码来源:AppsItemAdapter.java

示例15: setTagDefinition

import android.util.SparseIntArray; //导入方法依赖的package包/类
/**
 * Creates a new tag definition in this ExifInterface object for a given TID
 * and default IFD. Creating a definition with the same TID and default IFD
 * as a previous definition will override it.
 *
 * @param tagId                 the TID for the tag.
 * @param defaultIfd            the default IFD for the tag.
 * @param tagType               the type of the tag (see {@link ExifTag#getDataType()}).
 * @param defaultComponentCount the number of elements of this tag's type in
 *                              the tags value.
 * @param allowedIfds           the IFD's this tag is allowed to be put in.
 * @return the defined tag constant (e.g. {@link #TAG_IMAGE_WIDTH}) or
 * {@link #TAG_NULL} if the definition could not be made.
 */
@SuppressWarnings( "unused" )
public int setTagDefinition(
		short tagId, int defaultIfd, short tagType, short defaultComponentCount, int[] allowedIfds ) {
	if( sBannedDefines.contains( tagId ) ) {
		return TAG_NULL;
	}
	if( ExifTag.isValidType( tagType ) && ExifTag.isValidIfd( defaultIfd ) ) {
		int tagDef = defineTag( defaultIfd, tagId );
		if( tagDef == TAG_NULL ) {
			return TAG_NULL;
		}
		int[] otherDefs = getTagDefinitionsForTagId( tagId );
		SparseIntArray infos = getTagInfo();
		// Make sure defaultIfd is in allowedIfds
		boolean defaultCheck = false;
		for( int i : allowedIfds ) {
			if( defaultIfd == i ) {
				defaultCheck = true;
			}
			if( ! ExifTag.isValidIfd( i ) ) {
				return TAG_NULL;
			}
		}
		if( ! defaultCheck ) {
			return TAG_NULL;
		}

		int ifdFlags = getFlagsFromAllowedIfds( allowedIfds );
		// Make sure no identical tags can exist in allowedIfds
		if( otherDefs != null ) {
			for( int def : otherDefs ) {
				int tagInfo = infos.get( def );
				int allowedFlags = getAllowedIfdFlagsFromInfo( tagInfo );
				if( ( ifdFlags & allowedFlags ) != 0 ) {
					return TAG_NULL;
				}
			}
		}
		getTagInfo().put( tagDef, ifdFlags << 24 | ( tagType << 16 ) | defaultComponentCount );
		return tagDef;
	}
	return TAG_NULL;
}
 
开发者ID:tateisu,项目名称:SubwayTooter,代码行数:58,代码来源:ExifInterface.java


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