diff --git a/README.MD b/README.MD index a431f1c..31c8cbf 100644 --- a/README.MD +++ b/README.MD @@ -3,7 +3,7 @@ #FabOptions [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-FabOptions-brightgreen.svg?style=flat)](http://android-arsenal.com/details/1/4734) [![MaterialUp](https://img.shields.io/badge/MaterialUp-FabOptions-blue.svg?style=flat)](https://material.uplabs.com/posts/faboptions) -[![Bintray](https://img.shields.io/badge/Bintray-v1.1.0-brightgreen.svg?style=flat)](https://bintray.com/joaquimleyapps/opensource/com.github.joaquimley%3Afaboptions/1.0.2) +[![Bintray](https://img.shields.io/badge/Bintray-v1.1.1-brightgreen.svg?style=flat)](https://bintray.com/leyopensource/FabOptions/com.github.joaquimley%3Afaboptions/1.1.1) ![minSdkVersion](https://img.shields.io/badge/minSdkVersion-14-green.svg?style=true) ![compileSdkVersion](https://img.shields.io/badge/compileSdkVersion-25-green.svg?style=true) @@ -27,7 +27,7 @@ Android implementation - Import gradle dependency: dependencies { - compile 'com.github.joaquimley:faboptions:1.1.0' + compile 'com.github.joaquimley:faboptions:1.1.1' } - Add the component to your layout: diff --git a/faboptions/build.gradle b/faboptions/build.gradle index 8921d20..ffc8a18 100644 --- a/faboptions/build.gradle +++ b/faboptions/build.gradle @@ -25,8 +25,8 @@ android { defaultConfig { minSdkVersion 14 targetSdkVersion 25 - versionCode 9 - versionName "1.1.0" + versionCode 10 + versionName "1.1.1" vectorDrawables.useSupportLibrary = true } diff --git a/faboptions/src/main/java/com/joaquimley/faboptions/FabOptionsBehavior.java b/faboptions/src/main/java/com/joaquimley/faboptions/FabOptionsBehavior.java index f7b2537..4851312 100644 --- a/faboptions/src/main/java/com/joaquimley/faboptions/FabOptionsBehavior.java +++ b/faboptions/src/main/java/com/joaquimley/faboptions/FabOptionsBehavior.java @@ -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 { @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); + } } \ No newline at end of file diff --git a/sample/build.gradle b/sample/build.gradle index 196b869..f68012f 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -24,8 +24,8 @@ android { applicationId "com.joaquimley.faboptions.sample" minSdkVersion 14 targetSdkVersion 25 - versionCode 5 - versionName "1.0.0" + versionCode 6 + versionName "1.0.1" } buildTypes { @@ -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') } diff --git a/sample/src/main/java/com/joaquimley/sample/XmlSampleActivity.java b/sample/src/main/java/com/joaquimley/sample/XmlSampleActivity.java index 4cf6673..2449c70 100644 --- a/sample/src/main/java/com/joaquimley/sample/XmlSampleActivity.java +++ b/sample/src/main/java/com/joaquimley/sample/XmlSampleActivity.java @@ -46,6 +46,7 @@ public class XmlSampleActivity extends AppCompatActivity implements View.OnClick } private Toolbar mToolbar; + private FabOptions mFabOptions; public static Intent newStartIntent(Context context) { return new Intent(context, XmlSampleActivity.class); @@ -58,33 +59,32 @@ protected void onCreate(Bundle savedInstanceState) { mToolbar = (Toolbar) findViewById(toolbar); mToolbar.setTitle(getString(R.string.title_activity_xml)); setSupportActionBar(mToolbar); - - FabOptions fabOptions = (FabOptions) findViewById(R.id.fab_options); - fabOptions.setOnClickListener(this); - if(!fabOptions.setButtonColor(R.id.faboptions_favorite, R.color.colorAccent)) { - Log.e("style button", "ERRORR"); - - } + mFabOptions = (FabOptions) findViewById(R.id.fab_options); + mFabOptions.setOnClickListener(this); } @Override public void onClick(View view) { switch (view.getId()) { case R.id.faboptions_favorite: + mFabOptions.setButtonColor(R.id.faboptions_favorite, R.color.colorAccent); Toast.makeText(XmlSampleActivity.this, "Favorite", Toast.LENGTH_SHORT).show(); break; case R.id.faboptions_textsms: + mFabOptions.setButtonColor(R.id.faboptions_textsms, R.color.colorAccent); Toast.makeText(XmlSampleActivity.this, "Message", Toast.LENGTH_SHORT).show(); break; case R.id.faboptions_download: + mFabOptions.setButtonColor(R.id.faboptions_download, R.color.colorAccent); Toast.makeText(XmlSampleActivity.this, "Download", Toast.LENGTH_SHORT).show(); break; case R.id.faboptions_share: + mFabOptions.setButtonColor(R.id.faboptions_share, R.color.colorAccent); Toast.makeText(XmlSampleActivity.this, "Share", Toast.LENGTH_SHORT).show(); break;