//@Nullable private View findViewForPosition(int position) { if (mListViewWrapper == null) { throw new Java.Lang.IllegalStateException("Call setAbsListView on this ExpanableListItemAdapter!"); } View result = null; for (int i = 0; i < mListViewWrapper.getChildCount() && result == null; i++) { View childView = mListViewWrapper.getChildAt(i); if (childView != null && AdapterViewUtil.getPositionForView(mListViewWrapper, childView) == position) { result = childView; } } return(result); }
private bool handleDownEvent(View view, MotionEvent motionEvent) { if (!mSwipeEnabled) { return(false); } View downView = findDownView(motionEvent); if (downView == null) { return(false); } int downPosition = AdapterViewUtil.getPositionForView(mListViewWrapper, downView); mCanDismissCurrent = isDismissable(downPosition); /* Check if we are processing the item at this position */ if (mCurrentPosition == downPosition || downPosition >= mVirtualListCount) { return(false); } if (view != null) { view.OnTouchEvent(motionEvent); } disableHorizontalScrollContainerIfNecessary(motionEvent, downView); mDownX = motionEvent.GetX(); mDownY = motionEvent.GetY(); mCurrentView = downView; mSwipingView = getSwipeView(downView); mCurrentPosition = downPosition; mVelocityTracker = VelocityTracker.Obtain(); mVelocityTracker.AddMovement(motionEvent); return(true); }
/** * Performs the undo animation and restores the original state for given {@link android.view.View}. * * @param view the parent {@code View} which contains both primary and undo {@code View}s. */ public void undo(View view) { int position = AdapterViewUtil.getPositionForView(getListViewWrapper(), view); mUndoPositions.Remove(position); View primaryView = mCallback.getPrimaryView(view); View undoView = mCallback.getUndoView(view); primaryView.Visibility = ViewStates.Visible; ObjectAnimator undoAlphaAnimator = ObjectAnimator.OfFloat(undoView, ALPHA, 1f, 0f); ObjectAnimator primaryAlphaAnimator = ObjectAnimator.OfFloat(primaryView, ALPHA, 0f, 1f); ObjectAnimator primaryXAnimator = ObjectAnimator.OfFloat(primaryView, TRANSLATION_X, primaryView.Width, 0f); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.PlayTogether(undoAlphaAnimator, primaryAlphaAnimator, primaryXAnimator); animatorSet.AddListener(new UndoAnimatorListener(undoView, this)); animatorSet.Start(); mCallback.onUndo(view, position); }