Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle some code #720

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.android.tools.build:gradle:2.1.0'
}
}

Expand Down
2 changes: 1 addition & 1 deletion library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
android:versionName="3.3.0">

<uses-sdk
android:minSdkVersion="8" />
android:minSdkVersion="11" />

<application />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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);

Expand All @@ -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;
Expand Down Expand Up @@ -418,7 +419,6 @@ public void setPanelHeight(int val) {
if (getPanelState() == PanelState.COLLAPSED) {
smoothToBottom();
invalidate();
return;
}
}

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down