From 379c6ceba3aacc323832d5695d6a02aca1ca3665 Mon Sep 17 00:00:00 2001 From: Soichiro Kashima Date: Sun, 11 Jan 2015 13:59:49 +0900 Subject: [PATCH] Fix that top padding is shown in a certain condition in ToolbarControl examples. #38 --- .../samples/ScrollFromBottomListViewActivity.java | 4 ++-- .../samples/ScrollFromBottomRecyclerViewActivity.java | 4 ++-- .../samples/ToolbarControlListViewActivity.java | 4 ++-- .../samples/ToolbarControlRecyclerViewActivity.java | 4 ++-- .../samples/ToolbarControlScrollViewActivity.java | 4 ++-- .../samples/ToolbarControlWebViewActivity.java | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/observablescrollview-samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/ScrollFromBottomListViewActivity.java b/observablescrollview-samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/ScrollFromBottomListViewActivity.java index 0097ffaf..b9978ac4 100644 --- a/observablescrollview-samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/ScrollFromBottomListViewActivity.java +++ b/observablescrollview-samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/ScrollFromBottomListViewActivity.java @@ -77,8 +77,8 @@ public void run() { @Override public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) { - if (dragging) { - int toolbarHeight = mToolbarView.getHeight(); + int toolbarHeight = mToolbarView.getHeight(); + if (dragging || scrollY < toolbarHeight) { if (firstScroll) { float currentHeaderTranslationY = ViewHelper.getTranslationY(mHeaderView); if (-toolbarHeight < currentHeaderTranslationY && toolbarHeight < scrollY) { diff --git a/observablescrollview-samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/ScrollFromBottomRecyclerViewActivity.java b/observablescrollview-samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/ScrollFromBottomRecyclerViewActivity.java index 834ffe15..79b9bf63 100644 --- a/observablescrollview-samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/ScrollFromBottomRecyclerViewActivity.java +++ b/observablescrollview-samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/ScrollFromBottomRecyclerViewActivity.java @@ -75,8 +75,8 @@ public void run() { @Override public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) { - if (dragging) { - int toolbarHeight = mToolbarView.getHeight(); + int toolbarHeight = mToolbarView.getHeight(); + if (dragging || scrollY < toolbarHeight) { if (firstScroll) { float currentHeaderTranslationY = ViewHelper.getTranslationY(mHeaderView); if (-toolbarHeight < currentHeaderTranslationY && toolbarHeight < scrollY) { diff --git a/observablescrollview-samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/ToolbarControlListViewActivity.java b/observablescrollview-samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/ToolbarControlListViewActivity.java index 10a58ad7..3109035c 100644 --- a/observablescrollview-samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/ToolbarControlListViewActivity.java +++ b/observablescrollview-samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/ToolbarControlListViewActivity.java @@ -74,8 +74,8 @@ public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCoun @Override public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) { - if (dragging) { - int toolbarHeight = mToolbarView.getHeight(); + int toolbarHeight = mToolbarView.getHeight(); + if (dragging || scrollY < toolbarHeight) { if (firstScroll) { float currentHeaderTranslationY = ViewHelper.getTranslationY(mHeaderView); if (-toolbarHeight < currentHeaderTranslationY && toolbarHeight < scrollY) { diff --git a/observablescrollview-samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/ToolbarControlRecyclerViewActivity.java b/observablescrollview-samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/ToolbarControlRecyclerViewActivity.java index 98373644..47618e39 100644 --- a/observablescrollview-samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/ToolbarControlRecyclerViewActivity.java +++ b/observablescrollview-samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/ToolbarControlRecyclerViewActivity.java @@ -58,8 +58,8 @@ protected void onCreate(Bundle savedInstanceState) { @Override public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) { - if (dragging) { - int toolbarHeight = mToolbarView.getHeight(); + int toolbarHeight = mToolbarView.getHeight(); + if (dragging || scrollY < toolbarHeight) { if (firstScroll) { float currentHeaderTranslationY = ViewHelper.getTranslationY(mHeaderView); if (-toolbarHeight < currentHeaderTranslationY && toolbarHeight < scrollY) { diff --git a/observablescrollview-samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/ToolbarControlScrollViewActivity.java b/observablescrollview-samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/ToolbarControlScrollViewActivity.java index 79a57a99..c63b792a 100644 --- a/observablescrollview-samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/ToolbarControlScrollViewActivity.java +++ b/observablescrollview-samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/ToolbarControlScrollViewActivity.java @@ -52,8 +52,8 @@ protected void onCreate(Bundle savedInstanceState) { @Override public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) { - if (dragging) { - int toolbarHeight = mToolbarView.getHeight(); + int toolbarHeight = mToolbarView.getHeight(); + if (dragging || scrollY < toolbarHeight) { if (firstScroll) { float currentHeaderTranslationY = ViewHelper.getTranslationY(mHeaderView); if (-toolbarHeight < currentHeaderTranslationY && toolbarHeight < scrollY) { diff --git a/observablescrollview-samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/ToolbarControlWebViewActivity.java b/observablescrollview-samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/ToolbarControlWebViewActivity.java index fc9c4b42..2cb18fd2 100644 --- a/observablescrollview-samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/ToolbarControlWebViewActivity.java +++ b/observablescrollview-samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/ToolbarControlWebViewActivity.java @@ -60,8 +60,8 @@ protected void onCreate(Bundle savedInstanceState) { private ObservableScrollViewCallbacks mScrollViewScrollCallbacks = new ObservableScrollViewCallbacks() { @Override public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) { - if (mDragging) { - int toolbarHeight = mToolbarView.getHeight(); + int toolbarHeight = mToolbarView.getHeight(); + if (mDragging || scrollY < toolbarHeight) { if (mFirstScroll) { mFirstScroll = false; float currentHeaderTranslationY = ViewHelper.getTranslationY(mHeaderView);