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


Java SparseArray.remove方法代码示例

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


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

示例1: deleteTimer

import android.util.SparseArray; //导入方法依赖的package包/类
@ReactMethod
public void deleteTimer(ExecutorToken executorToken, int timerId) {
  synchronized (mTimerGuard) {
    SparseArray<Timer> timersForContext = mTimerIdsToTimers.get(executorToken);
    if (timersForContext == null) {
      return;
    }
    Timer timer = timersForContext.get(timerId);
    if (timer == null) {
      return;
    }
    // We may have already called/removed it
    timersForContext.remove(timerId);
    if (timersForContext.size() == 0) {
      mTimerIdsToTimers.remove(executorToken);
    }
    mTimers.remove(timer);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:20,代码来源:Timing.java

示例2: retrieveFromScrap

import android.util.SparseArray; //导入方法依赖的package包/类
static View retrieveFromScrap(SparseArray<View> scrapViews, int position) {
  int size = scrapViews.size();
  if (size > 0) {
    // See if we still have a view for this position.
    for (int i = 0; i < size; i++) {
      int fromPosition = scrapViews.keyAt(i);
      View view = scrapViews.get(fromPosition);
      if (fromPosition == position) {
        scrapViews.remove(fromPosition);
        return view;
      }
    }
    int index = size - 1;
    View r = scrapViews.valueAt(index);
    scrapViews.remove(scrapViews.keyAt(index));
    return r;
  } else {
    return null;
  }
}
 
开发者ID:LineChen,项目名称:Month_Calendar,代码行数:21,代码来源:RecycleBin.java

示例3: retrieveFromScrap

import android.util.SparseArray; //导入方法依赖的package包/类
static View retrieveFromScrap(SparseArray<View> scrapViews, int position) {
    int size = scrapViews.size();
    if (size > 0) {
        // See if we still have a view for this position.
        for (int i = 0; i < size; i++) {
            int fromPosition = scrapViews.keyAt(i);
            View view = scrapViews.get(fromPosition);
            if (fromPosition == position) {
                scrapViews.remove(fromPosition);
                return view;
            }
        }
        int index = size - 1;
        View r = scrapViews.valueAt(index);
        scrapViews.remove(scrapViews.keyAt(index));
        return r;
    } else {
        return null;
    }
}
 
开发者ID:Loofer,项目名称:Watermark,代码行数:21,代码来源:RecyclingPagerAdapter.java

示例4: retrieveFromScrap

import android.util.SparseArray; //导入方法依赖的package包/类
static View retrieveFromScrap(SparseArray<View> scrapViews, int position) {
	int size = scrapViews.size();
	if (size > 0) {
		// See if we still have a view for this position.
		for (int i = 0; i < size; i++) {
			int fromPosition = scrapViews.keyAt(i);
			View view = scrapViews.get(fromPosition);
			if (fromPosition == position) {
				scrapViews.remove(fromPosition);
				return view;
			}
		}
		int index = size - 1;
		View r = scrapViews.valueAt(index);
		scrapViews.remove(scrapViews.keyAt(index));
		return r;
	} else {
		return null;
	}
}
 
开发者ID:snowwolf10285,项目名称:PicShow-zhaipin,代码行数:21,代码来源:RecycleBin.java

示例5: retrieveFromScrap

import android.util.SparseArray; //导入方法依赖的package包/类
static View retrieveFromScrap(SparseArray<View> scrapViews, int position) {
    int size = scrapViews.size();
    if (size <= 0) {
        return null;
    }
    for (int i = 0; i < size; i++) {
        int fromPosition = scrapViews.keyAt(i);
        View view = (View) scrapViews.get(fromPosition);
        if (fromPosition == position) {
            scrapViews.remove(fromPosition);
            return view;
        }
    }
    int index = size - 1;
    View r = (View) scrapViews.valueAt(index);
    scrapViews.remove(scrapViews.keyAt(index));
    return r;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:19,代码来源:RecycleBin.java

示例6: pruneScrapViews

import android.util.SparseArray; //导入方法依赖的package包/类
/**
 * Makes sure that the size of scrapViews does not exceed the size of activeViews.
 * (This can happen if an adapter does not recycle its views).
 */
private void pruneScrapViews() {
  final int maxViews = activeViews.length;
  final int viewTypeCount = this.viewTypeCount;
  final SparseArray<View>[] scrapViews = this.scrapViews;
  for (int i = 0; i < viewTypeCount; ++i) {
    final SparseArray<View> scrapPile = scrapViews[i];
    int size = scrapPile.size();
    final int extras = size - maxViews;
    size--;
    for (int j = 0; j < extras; j++) {
      scrapPile.remove(scrapPile.keyAt(size--));
    }
  }
}
 
开发者ID:LineChen,项目名称:Month_Calendar,代码行数:19,代码来源:RecycleBin.java

示例7: setFirstOut

import android.util.SparseArray; //导入方法依赖的package包/类
private static void setFirstOut(SparseArray<Fragment> firstOutFragments, SparseArray<Fragment> lastInFragments, Fragment fragment) {
    if (fragment != null) {
        int containerId = fragment.mContainerId;
        if (containerId != 0 && !fragment.isHidden()) {
            if (fragment.isAdded() && fragment.getView() != null && firstOutFragments.get(containerId) == null) {
                firstOutFragments.put(containerId, fragment);
            }
            if (lastInFragments.get(containerId) == fragment) {
                lastInFragments.remove(containerId);
            }
        }
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:14,代码来源:BackStackRecord.java

示例8: setLastIn

import android.util.SparseArray; //导入方法依赖的package包/类
private void setLastIn(SparseArray<Fragment> firstOutFragments, SparseArray<Fragment> lastInFragments, Fragment fragment) {
    if (fragment != null) {
        int containerId = fragment.mContainerId;
        if (containerId != 0) {
            if (!fragment.isAdded()) {
                lastInFragments.put(containerId, fragment);
            }
            if (firstOutFragments.get(containerId) == fragment) {
                firstOutFragments.remove(containerId);
            }
        }
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:14,代码来源:BackStackRecord.java

示例9: pruneScrapViews

import android.util.SparseArray; //导入方法依赖的package包/类
/**
 * Makes sure that the size of scrapViews does not exceed the size of activeViews.
 * (This can happen if an adapter does not recycle its views).
 */
private void pruneScrapViews() {
    final int maxViews = activeViews.length;
    final int viewTypeCount = this.viewTypeCount;
    final SparseArray<View>[] scrapViews = this.scrapViews;
    for (int i = 0; i < viewTypeCount; ++i) {
        final SparseArray<View> scrapPile = scrapViews[i];
        int size = scrapPile.size();
        final int extras = size - maxViews;
        size--;
        for (int j = 0; j < extras; j++) {
            scrapPile.remove(scrapPile.keyAt(size--));
        }
    }
}
 
开发者ID:Loofer,项目名称:Watermark,代码行数:19,代码来源:RecyclingPagerAdapter.java

示例10: pruneScrapViews

import android.util.SparseArray; //导入方法依赖的package包/类
/**
 * Makes sure that the size of scrapViews does not exceed the size of
 * activeViews. (This can happen if an adapter does not recycle its views).
 */
private void pruneScrapViews() {
	final int maxViews = activeViews.length;
	final int viewTypeCount = this.viewTypeCount;
	final SparseArray<View>[] scrapViews = this.scrapViews;
	for (int i = 0; i < viewTypeCount; ++i) {
		final SparseArray<View> scrapPile = scrapViews[i];
		int size = scrapPile.size();
		final int extras = size - maxViews;
		size--;
		for (int j = 0; j < extras; j++) {
			scrapPile.remove(scrapPile.keyAt(size--));
		}
	}
}
 
开发者ID:snowwolf10285,项目名称:PicShow-zhaipin,代码行数:19,代码来源:RecycleBin.java

示例11: calculateFragments

import android.util.SparseArray; //导入方法依赖的package包/类
private void calculateFragments(SparseArray<Fragment> firstOutFragments, SparseArray<Fragment> lastInFragments) {
    if (this.mManager.mContainer.onHasView()) {
        for (Op op = this.mHead; op != null; op = op.next) {
            switch (op.cmd) {
                case 1:
                    setLastIn(firstOutFragments, lastInFragments, op.fragment);
                    break;
                case 2:
                    Fragment f = op.fragment;
                    if (this.mManager.mAdded != null) {
                        for (int i = 0; i < this.mManager.mAdded.size(); i++) {
                            Fragment old = (Fragment) this.mManager.mAdded.get(i);
                            if (f == null || old.mContainerId == f.mContainerId) {
                                if (old == f) {
                                    f = null;
                                    lastInFragments.remove(old.mContainerId);
                                } else {
                                    setFirstOut(firstOutFragments, lastInFragments, old);
                                }
                            }
                        }
                    }
                    setLastIn(firstOutFragments, lastInFragments, op.fragment);
                    break;
                case 3:
                    setFirstOut(firstOutFragments, lastInFragments, op.fragment);
                    break;
                case 4:
                    setFirstOut(firstOutFragments, lastInFragments, op.fragment);
                    break;
                case 5:
                    setLastIn(firstOutFragments, lastInFragments, op.fragment);
                    break;
                case 6:
                    setFirstOut(firstOutFragments, lastInFragments, op.fragment);
                    break;
                case 7:
                    setLastIn(firstOutFragments, lastInFragments, op.fragment);
                    break;
                default:
                    break;
            }
        }
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:46,代码来源:BackStackRecord.java

示例12: doFrame

import android.util.SparseArray; //导入方法依赖的package包/类
/**
 * Calls all timers that have expired since the last time this frame callback was called.
 */
@Override
public void doFrame(long frameTimeNanos) {
  if (isPaused.get() && !isRunningTasks.get()) {
    return;
  }

  long frameTimeMillis = frameTimeNanos / 1000000;
  synchronized (mTimerGuard) {
    while (!mTimers.isEmpty() && mTimers.peek().mTargetTime < frameTimeMillis) {
      Timer timer = mTimers.poll();
      WritableArray timersForContext = mTimersToCall.get(timer.mExecutorToken);
      if (timersForContext == null) {
        timersForContext = Arguments.createArray();
        mTimersToCall.put(timer.mExecutorToken, timersForContext);
      }
      timersForContext.pushInt(timer.mCallbackID);
      if (timer.mRepeat) {
        timer.mTargetTime = frameTimeMillis + timer.mInterval;
        mTimers.add(timer);
      } else {
        SparseArray<Timer> timers = mTimerIdsToTimers.get(timer.mExecutorToken);
        if (timers != null) {
          timers.remove(timer.mCallbackID);
          if (timers.size() == 0) {
            mTimerIdsToTimers.remove(timer.mExecutorToken);
          }
        }
      }
    }
  }

  for (Map.Entry<ExecutorToken, WritableArray> entry : mTimersToCall.entrySet()) {
    getReactApplicationContext().getJSModule(entry.getKey(), JSTimersExecution.class)
        .callTimers(entry.getValue());
  }
  mTimersToCall.clear();

  Assertions.assertNotNull(mReactChoreographer)
      .postFrameCallback(ReactChoreographer.CallbackType.TIMERS_EVENTS, this);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:44,代码来源:Timing.java


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