Skip to content

Commit

Permalink
Hotfix fab behaivor (JoaquimLey#23)
Browse files Browse the repository at this point in the history
* Fix JoaquimLey#8, was reverted
  • Loading branch information
JoaquimLey authored Jan 28, 2017
1 parent 75aa5c6 commit 8937764
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,30 @@
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.Snackbar;
import android.view.View;
import android.widget.FrameLayout;

/**
* FabOptions component default CoordinatorLayout.Behavior to react Snackbar
*/

public class FabOptionsBehavior extends CoordinatorLayout.Behavior {
public class FabOptionsBehavior extends CoordinatorLayout.Behavior<FrameLayout> {

@Override
public boolean layoutDependsOn(CoordinatorLayout parent, View child, View dependency) {
public boolean layoutDependsOn(CoordinatorLayout parent, FrameLayout child, View dependency) {
return dependency instanceof Snackbar.SnackbarLayout;
}

@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) {
public boolean onDependentViewChanged(CoordinatorLayout parent, FrameLayout child, View dependency) {
float translationY = Math.min(0, dependency.getTranslationY() - dependency.getHeight());
child.setTranslationY(translationY);
// TODO: 21/11/2016 Handle instanceof Bottomsheetnav & others
// TODO: 21/11/2016 Handle instanceof BottomSheetNav & others
return true;
}
//FabOptions component default {@link CoordinatorLayout.Behavior} to react to {@link Snackbar}

@Override
public void onDependentViewRemoved(CoordinatorLayout parent, FrameLayout child, View dependency) {
super.onDependentViewRemoved(parent, child, dependency);
child.setTranslationY(0);
}
}
4 changes: 2 additions & 2 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ dependencies {
final FABOPTIONS_VERSION = '1.1.0'

compile "com.android.support:design:$DESIGN_LIBRARY_VERSION"
compile "com.github.joaquimley:faboptions:$FABOPTIONS_VERSION"
// compile project(':faboptions')
// compile "com.github.joaquimley:faboptions:$FABOPTIONS_VERSION"
compile project(':faboptions')
}

0 comments on commit 8937764

Please sign in to comment.