當前位置: 首頁>>代碼示例>>Java>>正文


Java LongSparseArray.size方法代碼示例

本文整理匯總了Java中android.support.v4.util.LongSparseArray.size方法的典型用法代碼示例。如果您正苦於以下問題:Java LongSparseArray.size方法的具體用法?Java LongSparseArray.size怎麽用?Java LongSparseArray.size使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v4.util.LongSparseArray的用法示例。


在下文中一共展示了LongSparseArray.size方法的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: getValuesList

import android.support.v4.util.LongSparseArray; //導入方法依賴的package包/類
private String getValuesList(LongSparseArray<Double> array, LongSparseArray<Double> array2, DecimalFormat format, String units) {
    String retValue = "";

    for (Integer index = 0; index < array.size(); index++) {
        retValue += format_HH_MM((int) array.keyAt(index));
        retValue += "    ";
        retValue += format.format(array.valueAt(index));
        if (array2 != null) {
            retValue += " - ";
            retValue += format.format(array2.valueAt(index));
        }
        retValue += " " + units;
        if (index + 1 < array.size())
            retValue += "\n";
    }
    return retValue;
}
 
開發者ID:MilosKozak,項目名稱:AndroidAPS,代碼行數:18,代碼來源: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: matchItemIds

import android.support.v4.util.LongSparseArray; //導入方法依賴的package包/類
/**
 * Match start/end values by Adapter item ID. Adds matched values to mStartValuesList
 * and mEndValuesList and removes them from unmatchedStart and unmatchedEnd, using
 * startItemIds and endItemIds as a guide for which Views have unique item IDs.
 */
private void matchItemIds(ArrayMap<View, TransitionValues> unmatchedStart,
                          ArrayMap<View, TransitionValues> unmatchedEnd,
                          LongSparseArray<View> startItemIds, LongSparseArray<View> endItemIds) {
    int numStartIds = startItemIds.size();
    for (int i = 0; i < numStartIds; i++) {
        View startView = startItemIds.valueAt(i);
        if (startView != null && isValidTarget(startView)) {
            View endView = endItemIds.get(startItemIds.keyAt(i));
            if (endView != null && isValidTarget(endView)) {
                TransitionValues startValues = unmatchedStart.get(startView);
                TransitionValues endValues = unmatchedEnd.get(endView);
                if (startValues != null && endValues != null) {
                    mStartValuesList.add(startValues);
                    mEndValuesList.add(endValues);
                    unmatchedStart.remove(startView);
                    unmatchedEnd.remove(endView);
                }
            }
        }
    }
}
 
開發者ID:andkulikov,項目名稱:Transitions-Everywhere,代碼行數:27,代碼來源:Transition.java

示例10: getCheckedChildIds

import android.support.v4.util.LongSparseArray; //導入方法依賴的package包/類
List<Long> getCheckedChildIds(){

		if (!mList.hasStableIds()){
			Log.w(	TAG,
					"The adapter backing this list does not have stable ids. Please ensure your adapter implements stable ids and returns true for hasStableIds. If that's not possible, you will need to use getCheckedGroupPositions instead.");
			return new ArrayList<Long>();
		}

		final LongSparseArray<LongSparseArray<Integer>> checkedChildren = mCheckedChildren;
		final int count = checkedChildren.size();
		final ArrayList<LongSparseArray<Integer>> groupChildren = new ArrayList<LongSparseArray<Integer>>(count);

		for (int i = 0; i < count; i++)
			groupChildren.add(checkedChildren.valueAt(i));


		final ArrayList<Long> ids = new ArrayList<Long>();

		for (final LongSparseArray<Integer> groupCheckedChildren : groupChildren)
			for (final Long id : Util.keys(groupCheckedChildren))
				ids.add(id);

		return ids;
	}
 
開發者ID:kemallette,項目名稱:MultiChoiceExpandableList,代碼行數:25,代碼來源:CheckStateStore.java

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

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

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

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

示例15: asList

import android.support.v4.util.LongSparseArray; //導入方法依賴的package包/類
public static <T> List<T> asList(LongSparseArray<T> sparseArray) {
    if (sparseArray == null) {
        return null;
    }

    ArrayList<T> list = new ArrayList<>(sparseArray.size());
    for (int i = 0; i < sparseArray.size(); i++) {
        list.add(sparseArray.valueAt(i));
    }
    return list;
}
 
開發者ID:stablekernel,項目名稱:standardlib,代碼行數:12,代碼來源:SparseArrayUtils.java


注:本文中的android.support.v4.util.LongSparseArray.size方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。