diff --git a/demo/res/layout/activity_demo.xml b/demo/res/layout/activity_demo.xml
index 417fa7b4..e6bf9245 100644
--- a/demo/res/layout/activity_demo.xml
+++ b/demo/res/layout/activity_demo.xml
@@ -75,6 +75,12 @@
android:paddingRight="10dp"
android:paddingLeft="10dp"/>
+
+
+
+
diff --git a/demo/res/values/strings.xml b/demo/res/values/strings.xml
index ffe6ea36..dd353f99 100644
--- a/demo/res/values/strings.xml
+++ b/demo/res/values/strings.xml
@@ -8,4 +8,6 @@
Disable Anchor Point
The Awesome Sliding Up Panel
Brought to you by
http://umanoapp.com]]>
on Twitter]]>
+ Expand w/out animation
+ Collapse w/out animation
diff --git a/demo/src/com/sothree/slidinguppanel/demo/DemoActivity.java b/demo/src/com/sothree/slidinguppanel/demo/DemoActivity.java
index d06a4229..49378c31 100644
--- a/demo/src/com/sothree/slidinguppanel/demo/DemoActivity.java
+++ b/demo/src/com/sothree/slidinguppanel/demo/DemoActivity.java
@@ -75,6 +75,12 @@ public void onClick(View v) {
startActivity(i);
}
});
+ findViewById(R.id.collapseBtn).setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ mLayout.collapseNoAnimation();
+ }
+ });
}
@Override
@@ -126,6 +132,12 @@ public boolean onOptionsItemSelected(MenuItem item) {
}
return true;
}
+ case R.id.action_expand: {
+ if (mLayout != null) {
+ mLayout.expandNoAnimation();
+ }
+ return true;
+ }
}
return super.onOptionsItemSelected(item);
}
diff --git a/gradle.properties b/gradle.properties
index 85cc1038..30a0ed3a 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,4 +1,4 @@
-VERSION_NAME=3.0.0
+VERSION_NAME=3.0.1
VERSION_CODE=10
GROUP=com.sothree.slidinguppanel
diff --git a/library/src/com/sothree/slidinguppanel/SlidingUpPanelLayout.java b/library/src/com/sothree/slidinguppanel/SlidingUpPanelLayout.java
index d0643a98..106590be 100644
--- a/library/src/com/sothree/slidinguppanel/SlidingUpPanelLayout.java
+++ b/library/src/com/sothree/slidinguppanel/SlidingUpPanelLayout.java
@@ -14,6 +14,7 @@
import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
+import android.util.Log;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
@@ -953,6 +954,16 @@ public PanelState getPanelState() {
return mSlideState;
}
+ public void expandNoAnimation() {
+ onPanelDragged(0);
+ mMainView.requestLayout();
+ mSlideState = PanelState.EXPANDED;
+ if (mSlideableView.getVisibility() != View.VISIBLE) {
+ mSlideableView.setVisibility(View.VISIBLE);
+ }
+ dispatchOnPanelExpanded(mSlideableView);
+ }
+
/**
* Change panel state to the given state with
* @param state - new panel state
@@ -991,6 +1002,14 @@ public void setPanelState(PanelState state) {
}
}
+ public void collapseNoAnimation() {
+ int defaultHeight = getHeight() - getPaddingBottom() - getPaddingTop() - mPanelHeight;
+ onPanelDragged(defaultHeight);
+ mMainView.requestLayout();
+ mSlideState = PanelState.COLLAPSED;
+ dispatchOnPanelCollapsed(mSlideableView);
+ }
+
/**
* Update the parallax based on the current slide offset.
*/