From c52f7c878f0673a84347e6860a83b7f17c5ff3f6 Mon Sep 17 00:00:00 2001 From: Robert Armenski Date: Fri, 1 May 2015 04:01:05 +0200 Subject: [PATCH 1/2] Add top margin into position calculation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Top margin of the panel is considered when calculating the down position for the panel so it doesn’t fall of the screen --- .../argonware/slidingdownpanel/SlidingDownPanelLayout.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/src/com/argonware/slidingdownpanel/SlidingDownPanelLayout.java b/library/src/com/argonware/slidingdownpanel/SlidingDownPanelLayout.java index d66a396..5f3674c 100644 --- a/library/src/com/argonware/slidingdownpanel/SlidingDownPanelLayout.java +++ b/library/src/com/argonware/slidingdownpanel/SlidingDownPanelLayout.java @@ -624,8 +624,8 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) { if (lp.slideable) { final int margin = lp.leftMargin + lp.rightMargin; - final int range = Math.min(nextYStart, - height - paddingBottom - mOverhangSize - yStart - margin); + final int range = Math.max(0, Math.min(nextYStart, + height - paddingBottom - mOverhangSize - yStart - margin - lp.topMargin)); mSlideRange = range; lp.dimWhenOffset = yStart + lp.topMargin + range + childHeight / 2 > height - paddingBottom; From f15900d1f4bb9d1b67852928c3b44b30b449f839 Mon Sep 17 00:00:00 2001 From: Robert Armenski Date: Fri, 1 May 2015 04:22:10 +0200 Subject: [PATCH 2/2] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index bff79f1..6fd9143 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,9 @@ AndroidSlidingDownPanel ======================= SlidingDownPanel provides a vertical, multi-pane layout for user at the top level of a UI, just like the usage in [Aviate](http://getaviate.com/). +![Panel up](http://i.imgur.com/yvvTYnvl.png "Panel up") +![Panel down](http://i.imgur.com/SvrCw7nl.png "Panel slided down") + Usage ===== The layout could be usage as [SlidingPaneLayout]( http://developer.android.com/reference/android/support/v4/widget/SlidingPaneLayout.html). To use of the layout, simply include `com.argonware.slidingdownpanel.SlidingDownPanelLayout` as the root element for your multi pane layout. Add two children view. The first child is your main layout. The second child is your layout for the sliding down panel.