diff --git a/build.gradle b/build.gradle
index 9d66dfce..85b0dd79 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,7 +5,7 @@ buildscript {
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.5.0'
+ classpath 'com.android.tools.build:gradle:2.1.0'
}
}
diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml
index 2d9f13bc..7a0fbbe3 100644
--- a/library/src/main/AndroidManifest.xml
+++ b/library/src/main/AndroidManifest.xml
@@ -5,7 +5,7 @@
android:versionName="3.3.0">
+ android:minSdkVersion="11" />
diff --git a/library/src/main/java/com/sothree/slidinguppanel/SlidingUpPanelLayout.java b/library/src/main/java/com/sothree/slidinguppanel/SlidingUpPanelLayout.java
index fa306f6d..3d674b4a 100644
--- a/library/src/main/java/com/sothree/slidinguppanel/SlidingUpPanelLayout.java
+++ b/library/src/main/java/com/sothree/slidinguppanel/SlidingUpPanelLayout.java
@@ -11,7 +11,6 @@
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
-import android.support.annotation.NonNull;
import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
@@ -235,14 +234,14 @@ public interface PanelSlideListener {
* @param panel The child view that was moved
* @param slideOffset The new offset of this sliding pane within its range, from 0-1
*/
- public void onPanelSlide(View panel, float slideOffset);
+ void onPanelSlide(View panel, float slideOffset);
/**
* Called when a sliding panel state changes
*
* @param panel The child view that was slid to an collapsed position
*/
- public void onPanelStateChanged(View panel, PanelState previousState, PanelState newState);
+ void onPanelStateChanged(View panel, PanelState previousState, PanelState newState);
}
/**
@@ -283,9 +282,10 @@ public SlidingUpPanelLayout(Context context, AttributeSet attrs, int defStyle) {
if (defAttrs != null) {
int gravity = defAttrs.getInt(0, Gravity.NO_GRAVITY);
setGravity(gravity);
+ defAttrs.recycle();
}
- defAttrs.recycle();
+
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.SlidingUpPanelLayout);
@@ -311,9 +311,10 @@ public SlidingUpPanelLayout(Context context, AttributeSet attrs, int defStyle) {
if (interpolatorResId != -1) {
scrollerInterpolator = AnimationUtils.loadInterpolator(context, interpolatorResId);
}
+ ta.recycle();
}
- ta.recycle();
+
}
final float density = context.getResources().getDisplayMetrics().density;
@@ -418,7 +419,6 @@ public void setPanelHeight(int val) {
if (getPanelState() == PanelState.COLLAPSED) {
smoothToBottom();
invalidate();
- return;
}
}
@@ -511,6 +511,7 @@ public void removePanelSlideListener(PanelSlideListener listener) {
* Provides an on click for the portion of the main view that is dimmed. The listener is not
* triggered if the panel is in a collapsed or a hidden position. If the on click listener is
* not provided, the clicks on the dimmed area are passed through to the main layout.
+ *
* @param listener
*/
public void setFadeOnClickListener(View.OnClickListener listener) {
@@ -572,6 +573,7 @@ public void setScrollableView(View scrollableView) {
/**
* Sets the current scrollable view helper. See ScrollableViewHelper description for details.
+ *
* @param helper
*/
public void setScrollableViewHelper(ScrollableViewHelper helper) {
@@ -1329,7 +1331,7 @@ public boolean tryCaptureView(View child, int pointerId) {
@Override
public void onViewDragStateChanged(int state) {
- if (mDragHelper.getViewDragState() == ViewDragHelper.STATE_IDLE) {
+ if (mDragHelper != null && mDragHelper.getViewDragState() == ViewDragHelper.STATE_IDLE) {
mSlideOffset = computeSlideOffset(mSlideableView.getTop());
applyParallaxForCurrentSlideOffset();
@@ -1388,8 +1390,8 @@ public void onViewReleased(View releasedChild, float xvel, float yvel) {
// settle at the bottom
target = computePanelTopPosition(0.0f);
}
-
- mDragHelper.settleCapturedViewAt(releasedChild.getLeft(), target);
+ if (mDragHelper != null)
+ mDragHelper.settleCapturedViewAt(releasedChild.getLeft(), target);
invalidate();
}
@@ -1448,9 +1450,8 @@ public LayoutParams(Context c, AttributeSet attrs) {
final TypedArray ta = c.obtainStyledAttributes(attrs, ATTRS);
if (ta != null) {
this.weight = ta.getFloat(0, 0);
+ ta.recycle();
}
-
- ta.recycle();
}
}
diff --git a/library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java b/library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java
index 58a4e82a..17edb16c 100644
--- a/library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java
+++ b/library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java
@@ -64,7 +64,7 @@ public class ViewDragHelper {
/**
* Edge flag indicating that the left edge should be affected.
*/
- public static final int EDGE_LEFT = 1 << 0;
+ public static final int EDGE_LEFT = 1;
/**
* Edge flag indicating that the right edge should be affected.
@@ -89,7 +89,7 @@ public class ViewDragHelper {
/**
* Indicates that a check should occur along the horizontal axis
*/
- public static final int DIRECTION_HORIZONTAL = 1 << 0;
+ public static final int DIRECTION_HORIZONTAL = 1;
/**
* Indicates that a check should occur along the vertical axis