custom swipe refresh layout
Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/commit/9f4a246d Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/tree/9f4a246d Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/diff/9f4a246d Branch: refs/heads/master Commit: 9f4a246daec57d4495a2acc49fb8879b41504dfe Parents: 704137b Author: Sagar <[email protected]> Authored: Fri May 6 16:55:47 2016 +0530 Committer: Sagar <[email protected]> Committed: Fri May 6 16:55:47 2016 +0530 ---------------------------------------------------------------------- .../utils/ScrollChildSwipeRefreshLayout.java | 32 ++++++++++++++++++++ 1 file changed, 32 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/9f4a246d/app/src/main/java/org/apache/taverna/mobile/utils/ScrollChildSwipeRefreshLayout.java ---------------------------------------------------------------------- diff --git a/app/src/main/java/org/apache/taverna/mobile/utils/ScrollChildSwipeRefreshLayout.java b/app/src/main/java/org/apache/taverna/mobile/utils/ScrollChildSwipeRefreshLayout.java new file mode 100644 index 0000000..f4e0e70 --- /dev/null +++ b/app/src/main/java/org/apache/taverna/mobile/utils/ScrollChildSwipeRefreshLayout.java @@ -0,0 +1,32 @@ +package org.apache.taverna.mobile.utils; + +import android.content.Context; +import android.support.v4.view.ViewCompat; +import android.support.v4.widget.SwipeRefreshLayout; +import android.util.AttributeSet; +import android.view.View; + +public class ScrollChildSwipeRefreshLayout extends SwipeRefreshLayout { + + private View mScrollUpChild; + + public ScrollChildSwipeRefreshLayout(Context context) { + super(context); + } + + public ScrollChildSwipeRefreshLayout(Context context, AttributeSet attrs) { + super(context, attrs); + } + + @Override + public boolean canChildScrollUp() { + if (mScrollUpChild != null) { + return ViewCompat.canScrollVertically(mScrollUpChild, -1); + } + return super.canChildScrollUp(); + } + + public void setScrollUpChild(View view) { + mScrollUpChild = view; + } +}
