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


Java LongSparseArray.keyAt方法代码示例

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


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

示例1: sameNameFilterExists

import android.support.v4.util.LongSparseArray; //导入方法依赖的package包/类
/**
 * Checks if filter with the same name (ignoring case) already exists.
 */
private boolean sameNameFilterExists(String name) {
    LongSparseArray<Filter> filters = FiltersClient.INSTANCE.getByNameIgnoreCase(getContext(), name);

    if (isEditingExistingFilter()) {
        long id = getArguments().getLong(ARG_ID);

        for (int i = 0; i < filters.size(); i++) {
            long filterId = filters.keyAt(i);
            Filter filter = filters.get(filterId);

            // Ignore currently edited filter
            if (name.equalsIgnoreCase(filter.getName()) && id != filterId) {
                return true;
            }
        }

        return false;

    } else { // New filter
        return filters.size() > 0;
    }
}
 
开发者ID:orgzly,项目名称:orgzly-android,代码行数:26,代码来源:FilterFragment.java

示例2: convertToSparseArray

import android.support.v4.util.LongSparseArray; //导入方法依赖的package包/类
private LongSparseArray<Double> convertToSparseArray(JSONArray array) {
    double multiplier = getMultiplier(array);

    LongSparseArray<Double> sparse = new LongSparseArray<>();
    for (Integer index = 0; index < array.length(); index++) {
        try {
            JSONObject o = array.getJSONObject(index);
            long tas = getShitfTimeSecs((int) o.getLong("timeAsSeconds"));
            Double value = o.getDouble("value") * multiplier;
            sparse.put(tas, value);
        } catch (JSONException e) {
            log.error("Unhandled exception", e);
        }
    }

    // check if start is at 0 (midnight)
    // and add last value before midnight if not
    if (sparse.keyAt(0) != 0) {
        sparse.put(0, sparse.valueAt(sparse.size() - 1));
    }
    return sparse;
}
 
开发者ID:MilosKozak,项目名称:AndroidAPS,代码行数:23,代码来源:Profile.java

示例3: getCheckedItemIds

import android.support.v4.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 ChoiceMode#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 == ChoiceMode.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:melvinjlobo,项目名称:WebStarter,代码行数:24,代码来源:TwoWayView.java

示例4: getCheckedItemIds

import android.support.v4.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 myId 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:iTwenty,项目名称:Hashtagger,代码行数:28,代码来源:TwoWayView.java

示例5: getCheckedItemIds

import android.support.v4.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 == 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:ymback,项目名称:NGA-CLIENT-VER-OPEN-SOURCE,代码行数:25,代码来源:PLA_ListView.java

示例6: getCheckedItemIds

import android.support.v4.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:xiaoma1219,项目名称:netkuu.player,代码行数:25,代码来源:TwoWayView.java

示例7: removeItems

import android.support.v4.util.LongSparseArray; //导入方法依赖的package包/类
/**
 * Removed all selected items from cached {@link java.util.List}.
 *
 * @return Data items that have been removed from cache. Return {@code null} when no removal happened.
 */
public LongSparseArray<T> removeItems() {
	LongSparseArray<T> itemsToRmv = new LongSparseArray<T>();

	List<T> ds = getDataSource();
	for (T t : ds) {
		if (t.isChecked()) {
			itemsToRmv.put(getItemKey(t), t);
		}
	}

	long key;
	T item; ;
	for (int i = 0; i < itemsToRmv.size(); i++) {
		key = itemsToRmv.keyAt(i);
		item = itemsToRmv.get(key);
		ds.remove(item);
	}
	return itemsToRmv;
}
 
开发者ID:XinyueZ,项目名称:schautup,代码行数:25,代码来源:BaseActionModeListAdapter.java

示例8: getCheckedItemIds

import android.support.v4.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 == ListView.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:jonathangerbaud,项目名称:Klyph,代码行数:22,代码来源:AbsHListView.java

示例9: CompositionLayer

import android.support.v4.util.LongSparseArray; //导入方法依赖的package包/类
CompositionLayer(LottieDrawable lottieDrawable, Layer layerModel, List<Layer> layerModels,
    LottieComposition composition) {
  super(lottieDrawable, layerModel);

  LongSparseArray<BaseLayer> layerMap =
      new LongSparseArray<>(composition.getLayers().size());

  BaseLayer mattedLayer = null;
  for (int i = layerModels.size() - 1; i >= 0; i--) {
    Layer lm = layerModels.get(i);
    BaseLayer layer = BaseLayer.forModel(lm, lottieDrawable, composition);
    layerMap.put(layer.getLayerModel().getId(), layer);
    if (mattedLayer != null) {
      mattedLayer.setMatteLayer(layer);
      mattedLayer = null;
    } else {
      layers.add(0, layer);
      switch (lm.getMatteType()) {
        case Add:
        case Invert:
          mattedLayer = layer;
          break;
      }
    }
  }

  for (int i = 0; i < layerMap.size(); i++) {
    long key = layerMap.keyAt(i);
    BaseLayer layerView = layerMap.get(key);
    BaseLayer parentLayer = layerMap.get(layerView.getLayerModel().getParentId());
    if (parentLayer != null) {
      layerView.setParentLayer(parentLayer);
    }
  }
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:36,代码来源:CompositionLayer.java

示例10: getCheckedItemIds

import android.support.v4.util.LongSparseArray; //导入方法依赖的package包/类
public long[] getCheckedItemIds() {
    if (this.mChoiceMode == 0 || this.mCheckedIdStates == null || this.mAdapter == null) {
        return new long[0];
    }
    LongSparseArray<Integer> idStates = this.mCheckedIdStates;
    int count = idStates.size();
    long[] ids = new long[count];
    for (int i = 0; i < count; i++) {
        ids[i] = idStates.keyAt(i);
    }
    return ids;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:13,代码来源:AbsHListView.java

示例11: getValueToTime

import android.support.v4.util.LongSparseArray; //导入方法依赖的package包/类
private Double getValueToTime(LongSparseArray<Double> array, Integer timeAsSeconds) {
    Double lastValue = null;

    for (Integer index = 0; index < array.size(); index++) {
        long tas = array.keyAt(index);
        double value = array.valueAt(index);
        if (lastValue == null) lastValue = value;
        if (timeAsSeconds < tas) {
            break;
        }
        lastValue = value;
    }
    return lastValue;
}
 
开发者ID:MilosKozak,项目名称:AndroidAPS,代码行数:15,代码来源:Profile.java

示例12: getCheckedItemIds

import android.support.v4.util.LongSparseArray; //导入方法依赖的package包/类
public long[] getCheckedItemIds() {
    if (mChoiceMode == CHOICE_MODE_NONE || mCheckedIdStates == null || mAdapter == null) {
        return new long[0];
    }

    final LongSparseArray<Boolean> 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:kyze8439690,项目名称:StockAdapterView,代码行数:16,代码来源:ListView.java

示例13: getCheckedItemIds

import android.support.v4.util.LongSparseArray; //导入方法依赖的package包/类
public long[] getCheckedItemIds() {
	final LongSparseArray<Integer> idStates = checkedIdStates;
	if (idStates == null) {
		return new long[0];
	}

	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:cbeyls,项目名称:fosdem-companion-android,代码行数:16,代码来源:MultiChoiceHelper.java

示例14: onEvent

import android.support.v4.util.LongSparseArray; //导入方法依赖的package包/类
/**
 * Handler for {@link com.schautup.bus.GivenRemovedScheduleItemsEvent}.
 *
 * @param e
 * 		Event {@link com.schautup.bus.GivenRemovedScheduleItemsEvent}.
 */
public void onEvent(GivenRemovedScheduleItemsEvent e) {
	LongSparseArray<ScheduleItem> items = e.getItems();
	if (items != null) {
		long id;
		for (int i = 0; i < items.size(); i++) {
			id = items.keyAt(i);
			remove(id);
		}
	}
}
 
开发者ID:XinyueZ,项目名称:schautup,代码行数:17,代码来源:App.java

示例15: getCheckedItemIds

import android.support.v4.util.LongSparseArray; //导入方法依赖的package包/类
@Override
public long[] getCheckedItemIds() {
    if (mChoiceMode == 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:restorer,项目名称:gloomy-dungeons-2,代码行数:14,代码来源:GridView.java


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