本文整理匯總了Java中android.support.v4.util.LongSparseArray.valueAt方法的典型用法代碼示例。如果您正苦於以下問題:Java LongSparseArray.valueAt方法的具體用法?Java LongSparseArray.valueAt怎麽用?Java LongSparseArray.valueAt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v4.util.LongSparseArray
的用法示例。
在下文中一共展示了LongSparseArray.valueAt方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
}
}
}
}
示例2: 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;
}
示例3: deleteRemainingEntries
import android.support.v4.util.LongSparseArray; //導入方法依賴的package包/類
private boolean deleteRemainingEntries(LongSparseArray<DbContactSensor> allExistingContacts, boolean b) {
boolean bSomethingDeleted = false;
List<DbContactSensor> entriesToDelete = new ArrayList<>(allExistingContacts.size());
for (int i = 0, size = allExistingContacts.size(); i < size; i++) {
if (b && !isRunning()) {
return bSomethingDeleted;
}
DbContactSensor dbContact = allExistingContacts.valueAt(i);
dbContact.setIsDeleted(Boolean.TRUE);
dbContact.setIsNew(Boolean.FALSE);
dbContact.setIsUpdated(Boolean.TRUE);
entriesToDelete.add(dbContact);
if (!bSomethingDeleted) {
bSomethingDeleted = true;
}
}
// remove entries
daoProvider.getContactSensorDao().delete(entriesToDelete);
return bSomethingDeleted;
}