diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..14da415
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+UcMainPagerDemo
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..a852314
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
new file mode 100644
index 0000000..e7bedf3
--- /dev/null
+++ b/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..508b3d9
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..4716600
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1.8
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..8c11ae1
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/github/hellocsl/ucmainpager/behavior/uc/UcNewsHeaderPagerBehavior.java b/app/src/main/java/github/hellocsl/ucmainpager/behavior/uc/UcNewsHeaderPagerBehavior.java
index 1b74aec..49e6e2f 100644
--- a/app/src/main/java/github/hellocsl/ucmainpager/behavior/uc/UcNewsHeaderPagerBehavior.java
+++ b/app/src/main/java/github/hellocsl/ucmainpager/behavior/uc/UcNewsHeaderPagerBehavior.java
@@ -3,6 +3,8 @@
import android.content.Context;
import android.support.design.widget.CoordinatorLayout;
import android.support.v4.view.ViewCompat;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
@@ -68,7 +70,7 @@ public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, View chi
if (BuildConfig.DEBUG) {
Log.d(TAG, "onStartNestedScroll: ");
}
- return (nestedScrollAxes & ViewCompat.SCROLL_AXIS_VERTICAL) != 0 && canScroll(child, 0) && !isClosed(child);
+ return (nestedScrollAxes & ViewCompat.SCROLL_AXIS_VERTICAL) != 0 && canScroll(child, 0) && isOnRVTop(child, target);
}
@@ -88,6 +90,21 @@ public boolean isClosed() {
return mCurState == STATE_CLOSED;
}
+ /**
+ * to judge whether current recyclerview'item is at the top of recyclerview
+ *
+ * @param child
+ * @param target
+ * @return
+ */
+ private boolean isOnRVTop(View child, View target) {
+ if (target instanceof RecyclerView) {
+ boolean isRVTop = ((LinearLayoutManager) ((RecyclerView) target)
+ .getLayoutManager()).findFirstCompletelyVisibleItemPosition() == 0;
+ return isRVTop;
+ }
+ return true;
+ }
private void changeState(int newState) {
if (mCurState != newState) {
@@ -113,6 +130,8 @@ private boolean canScroll(View child, float pendingDy) {
public boolean onInterceptTouchEvent(CoordinatorLayout parent, final View child, MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_UP && !isClosed()) {
handleActionUp(parent, child);
+ } else if (ev.getAction() == MotionEvent.ACTION_UP && isClosed()) {
+ handleActionDown(parent, child);
}
return super.onInterceptTouchEvent(parent, child, ev);
}
@@ -151,6 +170,22 @@ private void handleActionUp(CoordinatorLayout parent, final View child) {
} else {
mFlingRunnable.scrollToOpen(DURATION_SHORT);
}
+ }
+
+ private void handleActionDown(CoordinatorLayout parent, final View child) {
+ if (BuildConfig.DEBUG) {
+ Log.d(TAG, "handleActionUp: ");
+ }
+ if (mFlingRunnable != null) {
+ child.removeCallbacks(mFlingRunnable);
+ mFlingRunnable = null;
+ }
+ mFlingRunnable = new FlingRunnable(parent, child);
+ if (child.getTranslationY() > getHeaderOffsetRange() / 3 * 2) {
+ mFlingRunnable.scrollToOpen(DURATION_SHORT);
+ } else {
+ mFlingRunnable.scrollToClosed(DURATION_SHORT);
+ }
}
diff --git a/build.gradle b/build.gradle
index 168f129..aff4f41 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.0.0'
+ classpath 'com.android.tools.build:gradle:2.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/gradle.properties b/gradle.properties
index 1d3591c..1704c26 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,18 +1,17 @@
-# Project-wide Gradle settings.
-
-# IDE (e.g. Android Studio) users:
-# Gradle settings configured through the IDE *will override*
-# any settings specified in this file.
-
+## Project-wide Gradle settings.
+#
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
-
+#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
-
+#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
-# org.gradle.parallel=true
\ No newline at end of file
+# org.gradle.parallel=true
+#Fri Sep 16 22:38:01 CST 2016
+systemProp.http.proxyHost=127.0.0.1
+systemProp.http.proxyPort=1080
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..13372ae
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..122a0dc
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Mon Dec 28 10:00:20 PST 2015
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip