Skip to content

Commit

Permalink
made gesturesEnabled public
Browse files Browse the repository at this point in the history
  • Loading branch information
mancj committed Jan 22, 2017
1 parent d71b5c0 commit 5516313
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 20 deletions.
30 changes: 14 additions & 16 deletions app/src/main/java/com/example/slideup/SlideUpViewActivity.java
Expand Up @@ -29,25 +29,23 @@ protected void onCreate(Bundle savedInstanceState) {
dim = findViewById(R.id.dim);
fab = (FloatingActionButton) findViewById(R.id.fab);


SlideUp.Listener slideUpListener = new SlideUp.Listener() {
@Override
public void onSlide(float percent) {
dim.setAlpha(1 - (percent / 100));
}

@Override
public void onVisibilityChanged(int visibility) {
if (visibility == View.GONE){
fab.show();
}
}
};

slideUp = new SlideUp.Builder<>(slideView)
.withListeners(slideUpListener)
.withListeners(new SlideUp.Listener() {
@Override
public void onSlide(float percent) {
dim.setAlpha(1 - (percent / 100));
}

@Override
public void onVisibilityChanged(int visibility) {
if (visibility == View.GONE){
fab.show();
}
}
})
.withStartGravity(Gravity.BOTTOM)
.withLoggingEnabled(true)
.withGesturesEnabled(true)
.withStartState(SlideUp.State.HIDDEN)
.build();

Expand Down
6 changes: 2 additions & 4 deletions library/src/main/java/com/mancj/slideup/SlideUp.java
Expand Up @@ -128,8 +128,7 @@ public final static class Builder<T extends View>{
private float density;
private int startGravity = BOTTOM;
private boolean isRTL;
private boolean gesturesEnabled;

private boolean gesturesEnabled = true;

/**
* <p>Construct a SlideUp by passing the view or his child to use for the generation</p>
Expand Down Expand Up @@ -217,7 +216,7 @@ public Builder withTouchableArea(float area){
*
* @param enabled <b>(default - true)</b>
* */
private Builder withGesturesEnabled(boolean enabled){
public Builder withGesturesEnabled(boolean enabled){
gesturesEnabled = enabled;
return this;
}
Expand Down Expand Up @@ -562,7 +561,6 @@ private void createAnimation(){
valueAnimator.addListener(this);
}


@Override
public final boolean onTouch(View v, MotionEvent event) {
if (!gesturesEnabled) return false;
Expand Down

0 comments on commit 5516313

Please sign in to comment.