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


Java LongSparseArray.keyAt方法代码示例

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


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

示例1: getCheckedItemIds

import android.util.LongSparseArray; //导入方法依赖的package包/类
/**
 * 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 id of each checked item in the
 *         list.
 */
public long[] getCheckedItemIds() {
	if (mChoiceMode == AbsListView.CHOICE_MODE_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;
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:25,代码来源:AbsHListView.java

示例2: read

import android.util.LongSparseArray; //导入方法依赖的package包/类
@Override
public LongSparseArray<T> read(JsonReader jsonReader) throws IOException {
    if (jsonReader.peek() == JsonToken.NULL) {
        jsonReader.nextNull();
        return null;
    }
    LongSparseArray<Object> temp = gson.fromJson(jsonReader, typeOfLongSparseArrayOfObject);
    LongSparseArray<T> result = new LongSparseArray<>(temp.size());
    long key;
    JsonElement tElement;
    for (int i = 0, size = temp.size(); i < size; ++i) {
        key = temp.keyAt(i);
        tElement = gson.toJsonTree(temp.get(key));
        result.put(key, (T) JSONUtils.jsonToSimpleObject(tElement.toString(), typeOfT));
    }
    return result;
}
 
开发者ID:MessageOnTap,项目名称:MessageOnTap_API,代码行数:18,代码来源:LongSparseArrayTypeAdapter.java

示例3: getCheckedItemIds

import android.util.LongSparseArray; //导入方法依赖的package包/类
/**
 * Returns the set of checked items ids. The result is only valid if the
 * choice mode has not been set to {@link AbsListView#CHOICE_MODE_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 == AbsListView.CHOICE_MODE_NONE || mCheckedIdStates == 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;
}
 
开发者ID:mobvoi,项目名称:ticdesign,代码行数:24,代码来源:TrackSelectionAdapterWrapper.java

示例4: CcDrawableCache

import android.util.LongSparseArray; //导入方法依赖的package包/类
public CcDrawableCache(Context context, LongSparseArray<Drawable.ConstantState> cache) {
    mResources = context.getApplicationContext().getResources();
    mPackageName = context.getApplicationContext().getPackageName();

    if (cache != null) {
        mCheckDependenciesKeys = new HashSet<>(cache.size());

        int N = cache.size();
        for (int i = 0; i < N; i++) {
            long key = cache.keyAt(i);
            mCheckDependenciesKeys.add(key);
            put(key, cache.valueAt(i));
        }
    } else {
        mCheckDependenciesKeys = new HashSet<>(0);
    }
}
 
开发者ID:Leao,项目名称:CodeColors,代码行数:18,代码来源:CcDrawableCache.java

示例5: CcColorCache

import android.util.LongSparseArray; //导入方法依赖的package包/类
public CcColorCache(Context context, LongSparseArray cache) {
    mResources = context.getApplicationContext().getResources();
    mPackageName = context.getApplicationContext().getPackageName();

    if (cache != null) {
        mCheckDependenciesKeys = new HashSet<>(cache.size());

        int N = cache.size();
        for (int i = 0; i < N; i++) {
            long key = cache.keyAt(i);
            mCheckDependenciesKeys.add(key);
            put(key, cache.valueAt(i));
        }
    } else {
        mCheckDependenciesKeys = new HashSet<>(0);
    }
}
 
开发者ID:Leao,项目名称:CodeColors,代码行数:18,代码来源:CcColorCache.java

示例6: getCheckedItemIds

import android.util.LongSparseArray; //导入方法依赖的package包/类
/**
 * 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 id 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;
}
 
开发者ID:CodePath-MAF,项目名称:AndroidClient,代码行数:25,代码来源:TwoWayView.java

示例7: keys

import android.util.LongSparseArray; //导入方法依赖的package包/类
private static Object keys(SparseArray<?> a, SparseBooleanArray b, SparseIntArray c,
                           SparseLongArray d, LongSparseArray<?> e) {
    int size = size(a, b, c, d, e);
    int[] ints = a != null || b != null || c != null || d != null ? new int[size] : null;
    long[] longs = e != null ? new long[size] : null;
    for (int i = 0; i < size; i++) {
        if (ints != null) {
            ints[i] = a != null ? a.keyAt(i)
                    : b != null ? b.keyAt(i) : c != null ? c.keyAt(i) : d.keyAt(i);
        } else if (longs != null) {
            longs[i] = e.keyAt(i);
        }
    }
    return ints != null ? ints : longs;
}
 
开发者ID:pushbit,项目名称:sprockets-android,代码行数:16,代码来源:SparseArrays.java


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