コード例 #1
0
 /**
  * @return Whether it is possible for the child view of this layout to scroll up. Override this if
  *     the child view is a custom view.
  */
 public boolean canChildScrollUp() {
   if (android.os.Build.VERSION.SDK_INT < 14) {
     if (mTarget instanceof AbsListView) {
       final AbsListView absListView = (AbsListView) mTarget;
       return absListView.getChildCount() > 0
           && (absListView.getFirstVisiblePosition() > 0
               || absListView.getChildAt(0).getTop() < absListView.getPaddingTop());
     } else {
       return ViewCompat.canScrollVertically(mTarget, -1) || mTarget.getScrollY() > 0;
     }
   } else {
     return ViewCompat.canScrollVertically(mTarget, -1);
   }
 }
コード例 #2
0
  public boolean canChildScrollUp() {
    if (Build.VERSION.SDK_INT < 14) {
      if ((this.mTarget instanceof AbsListView)) {
        AbsListView absListView = (AbsListView) this.mTarget;
        return (absListView.getChildCount() > 0)
            && ((absListView.getFirstVisiblePosition() > 0)
                || (absListView.getChildAt(0).getTop() < absListView.getPaddingTop()));
      }

      return (ViewCompat.canScrollVertically(this.mTarget, -1)) || (this.mTarget.getScrollY() > 0);
    }

    return ViewCompat.canScrollVertically(this.mTarget, -1);
  }
 @Override
 public boolean canChildScrollUp() {
   if (mScrollUpChild != null) {
     return ViewCompat.canScrollVertically(mScrollUpChild, -1);
   }
   return super.canChildScrollUp();
 }
コード例 #4
0
 @Override
 public boolean canScrollVertically(int direction) {
   if (android.os.Build.VERSION.SDK_INT < 14) {
     if (mTargetView instanceof AdapterView) {
       return canListScroll(direction);
     } else {
       return direction < 0
           ? mTargetView.getScrollY() > 0
           : mTargetView.getScrollY() < mTargetView.getMeasuredHeight();
     }
   } else {
     return ViewCompat.canScrollVertically(mTargetView, direction);
   }
 }
コード例 #5
0
 public boolean canChildScrollDown() {
   if (android.os.Build.VERSION.SDK_INT < 14) {
     if (mTarget instanceof AbsListView) {
       final AbsListView absListView = (AbsListView) mTarget;
       View lastChild = absListView.getChildAt(absListView.getChildCount() - 1);
       if (lastChild != null) {
         return (absListView.getLastVisiblePosition() == (absListView.getCount() - 1))
             && lastChild.getBottom() > absListView.getPaddingBottom();
       } else {
         return false;
       }
     } else {
       return mTarget.getHeight() - mTarget.getScrollY() > 0;
     }
   } else {
     return ViewCompat.canScrollVertically(mTarget, 1);
   }
 }
コード例 #6
0
 public static boolean canViewScrollUp(View view) {
   if (view == null) {
     return false;
   }
   if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
     if (view instanceof AbsListView) {
       final AbsListView absListView = (AbsListView) view;
       if (absListView.getChildCount() == 0) {
         return false;
       }
       return absListView.getFirstVisiblePosition() > 0
           || absListView.getChildAt(0).getTop() < absListView.getPaddingTop();
     } else {
       return view.getScrollY() > 0;
     }
   } else {
     return ViewCompat.canScrollVertically(view, -1);
   }
 }
コード例 #7
0
 @Override
 public boolean canSwipeRefreshChildScrollUp() {
   return ViewCompat.canScrollVertically(mNodeListView, -1);
 }
コード例 #8
0
 /**
  * @return Whether it is possible for the child view of this layout to scroll up. Override this if
  *     the child view is a custom view.
  */
 private boolean canScrollDown(RecyclerView recyclerView) {
   return ViewCompat.canScrollVertically(recyclerView, 1);
 }
コード例 #9
0
 public boolean canChildScrollDown() {
   return ViewCompat.canScrollVertically(scrollChild, 1);
 }
コード例 #10
0
ファイル: NestedScrollView.java プロジェクト: eFOIA-12/eFOIA
  public boolean onInterceptTouchEvent(MotionEvent var1) {
    boolean var4 = true;
    int var2 = var1.getAction();
    if (var2 == 2 && this.mIsBeingDragged) {
      return true;
    } else if (this.getScrollY() == 0 && !ViewCompat.canScrollVertically(this, 1)) {
      return false;
    } else {
      switch (var2 & 255) {
        case 0:
          var2 = (int) var1.getY();
          if (!this.inChild((int) var1.getX(), var2)) {
            this.mIsBeingDragged = false;
            this.recycleVelocityTracker();
          } else {
            this.mLastMotionY = var2;
            this.mActivePointerId = MotionEventCompat.getPointerId(var1, 0);
            this.initOrResetVelocityTracker();
            this.mVelocityTracker.addMovement(var1);
            if (this.mScroller.isFinished()) {
              var4 = false;
            }

            this.mIsBeingDragged = var4;
            this.startNestedScroll(2);
          }
          break;
        case 1:
        case 3:
          this.mIsBeingDragged = false;
          this.mActivePointerId = -1;
          this.recycleVelocityTracker();
          this.stopNestedScroll();
          break;
        case 2:
          var2 = this.mActivePointerId;
          if (var2 != -1) {
            int var3 = MotionEventCompat.findPointerIndex(var1, var2);
            if (var3 == -1) {
              Log.e("NestedScrollView", "Invalid pointerId=" + var2 + " in onInterceptTouchEvent");
            } else {
              var2 = (int) MotionEventCompat.getY(var1, var3);
              if (Math.abs(var2 - this.mLastMotionY) > this.mTouchSlop
                  && (this.getNestedScrollAxes() & 2) == 0) {
                this.mIsBeingDragged = true;
                this.mLastMotionY = var2;
                this.initVelocityTrackerIfNotExists();
                this.mVelocityTracker.addMovement(var1);
                this.mNestedYOffset = 0;
                ViewParent var5 = this.getParent();
                if (var5 != null) {
                  var5.requestDisallowInterceptTouchEvent(true);
                }
              }
            }
          }
        case 4:
        case 5:
        default:
          break;
        case 6:
          this.onSecondaryPointerUp(var1);
      }

      return this.mIsBeingDragged;
    }
  }