diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/fab/ScrollAwareFABBehavior.java b/app/src/main/java/eu/kanade/tachiyomi/ui/base/fab/ScrollAwareFABBehavior.java index 707299b80..cbcd0100c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/fab/ScrollAwareFABBehavior.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/fab/ScrollAwareFABBehavior.java @@ -19,10 +19,19 @@ import android.content.Context; import android.support.design.widget.CoordinatorLayout; import android.support.design.widget.FloatingActionButton; import android.support.v4.view.ViewCompat; +import android.support.v4.view.animation.FastOutSlowInInterpolator; import android.util.AttributeSet; import android.view.View; +import android.view.animation.Animation; +import android.view.animation.AnimationUtils; +import android.view.animation.Interpolator; + +import eu.kanade.tachiyomi.R; public class ScrollAwareFABBehavior extends FloatingActionButton.Behavior { + private static final Interpolator INTERPOLATOR = new FastOutSlowInInterpolator(); + private boolean mIsAnimatingOut = false; + public ScrollAwareFABBehavior(Context context, AttributeSet attrs) { super(); } @@ -40,12 +49,43 @@ public class ScrollAwareFABBehavior extends FloatingActionButton.Behavior { final View target, final int dxConsumed, final int dyConsumed, final int dxUnconsumed, final int dyUnconsumed) { super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); - if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) { + if (dyConsumed > 0 && !this.mIsAnimatingOut && child.getVisibility() == View.VISIBLE) { // User scrolled down and the FAB is currently visible -> hide the FAB - child.hide(); + animateOut(child); } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) { // User scrolled up and the FAB is currently not visible -> show the FAB - child.show(); + animateIn(child); } } -} + + // Same animation that FloatingActionButton.Behavior uses to hide the FAB when the AppBarLayout exits + private void animateOut(final FloatingActionButton button) { + Animation anim = AnimationUtils.loadAnimation(button.getContext(), R.anim.fab_hide_to_bottom); + anim.setInterpolator(INTERPOLATOR); + anim.setDuration(200L); + anim.setAnimationListener(new Animation.AnimationListener() { + public void onAnimationStart(Animation animation) { + ScrollAwareFABBehavior.this.mIsAnimatingOut = true; + } + + public void onAnimationEnd(Animation animation) { + ScrollAwareFABBehavior.this.mIsAnimatingOut = false; + button.setVisibility(View.GONE); + } + + @Override + public void onAnimationRepeat(final Animation animation) { + } + }); + button.startAnimation(anim); + } + + // Same animation that FloatingActionButton.Behavior uses to show the FAB when the AppBarLayout enters + private void animateIn(FloatingActionButton button) { + button.setVisibility(View.VISIBLE); + Animation anim = AnimationUtils.loadAnimation(button.getContext(), R.anim.fab_show_from_bottom); + anim.setDuration(200L); + anim.setInterpolator(INTERPOLATOR); + button.startAnimation(anim); + } +} \ No newline at end of file diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoFragment.java b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoFragment.java index 532692c6b..b4df1d8d7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoFragment.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoFragment.java @@ -65,15 +65,6 @@ public class MangaInfoFragment extends BaseRxFragment { View view = inflater.inflate(R.layout.fragment_manga_info, container, false); ButterKnife.bind(this, view); - //Create edit drawable with size 24dp (google guidelines) - IconicsDrawable edit = new IconicsDrawable(this.getContext()) - .icon(GoogleMaterial.Icon.gmd_edit) - .color(ContextCompat.getColor(this.getContext(), R.color.white)) - .sizeDp(24); - - // Update image of fab button - fabEdit.setImageDrawable(edit); - // Set listener. fabEdit.setOnClickListener(v -> selectImage()); diff --git a/app/src/main/res/anim/fab_hide_to_bottom.xml b/app/src/main/res/anim/fab_hide_to_bottom.xml new file mode 100644 index 000000000..b5f8d63bd --- /dev/null +++ b/app/src/main/res/anim/fab_hide_to_bottom.xml @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/app/src/main/res/anim/fab_show_from_bottom.xml b/app/src/main/res/anim/fab_show_from_bottom.xml new file mode 100644 index 000000000..eea12e8c4 --- /dev/null +++ b/app/src/main/res/anim/fab_show_from_bottom.xml @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/app/src/main/res/drawable-hdpi/ic_action_add_18dp.png b/app/src/main/res/drawable-hdpi/ic_action_add_18dp.png deleted file mode 100644 index 7800ba33d..000000000 Binary files a/app/src/main/res/drawable-hdpi/ic_action_add_18dp.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_add_white_24dp.png b/app/src/main/res/drawable-hdpi/ic_add_white_24dp.png new file mode 100644 index 000000000..694179bd4 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_add_white_24dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_mode_edit_white_24dp.png b/app/src/main/res/drawable-hdpi/ic_mode_edit_white_24dp.png new file mode 100644 index 000000000..595ff10ac Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_mode_edit_white_24dp.png differ diff --git a/app/src/main/res/drawable-ldpi/ic_action_add_18dp.png b/app/src/main/res/drawable-ldpi/ic_action_add_18dp.png deleted file mode 100644 index 1a39b71f8..000000000 Binary files a/app/src/main/res/drawable-ldpi/ic_action_add_18dp.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_action_add_18dp.png b/app/src/main/res/drawable-mdpi/ic_action_add_18dp.png deleted file mode 100644 index ed40b2b21..000000000 Binary files a/app/src/main/res/drawable-mdpi/ic_action_add_18dp.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_add_white_24dp.png b/app/src/main/res/drawable-mdpi/ic_add_white_24dp.png new file mode 100644 index 000000000..3856041d7 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_add_white_24dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_mode_edit_white_24dp.png b/app/src/main/res/drawable-mdpi/ic_mode_edit_white_24dp.png new file mode 100644 index 000000000..12b09f1d9 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_mode_edit_white_24dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_action_add_18dp.png b/app/src/main/res/drawable-xhdpi/ic_action_add_18dp.png deleted file mode 100644 index 185be8a76..000000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_action_add_18dp.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_add_white_24dp.png b/app/src/main/res/drawable-xhdpi/ic_add_white_24dp.png new file mode 100644 index 000000000..67bb598e5 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_add_white_24dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_mode_edit_white_24dp.png b/app/src/main/res/drawable-xhdpi/ic_mode_edit_white_24dp.png new file mode 100644 index 000000000..5a06bff5a Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_mode_edit_white_24dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_add_18dp.png b/app/src/main/res/drawable-xxhdpi/ic_action_add_18dp.png deleted file mode 100644 index 2ab780a89..000000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_action_add_18dp.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_add_white_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_add_white_24dp.png new file mode 100644 index 000000000..0fdced8fc Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_add_white_24dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_mode_edit_white_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_mode_edit_white_24dp.png new file mode 100644 index 000000000..02e19d045 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_mode_edit_white_24dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_action_add_18dp.png b/app/src/main/res/drawable-xxxhdpi/ic_action_add_18dp.png deleted file mode 100644 index e6ca376b3..000000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_action_add_18dp.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_add_white_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_add_white_24dp.png new file mode 100644 index 000000000..d64c22e9e Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_add_white_24dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_mode_edit_white_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_mode_edit_white_24dp.png new file mode 100644 index 000000000..d6668a051 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_mode_edit_white_24dp.png differ diff --git a/app/src/main/res/layout/activity_edit_categories.xml b/app/src/main/res/layout/activity_edit_categories.xml index c709d0773..4e8b4af20 100644 --- a/app/src/main/res/layout/activity_edit_categories.xml +++ b/app/src/main/res/layout/activity_edit_categories.xml @@ -18,11 +18,12 @@ - - @@ -254,28 +256,25 @@ + + - + + - - - - - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 970ef0afe..eea86b5e7 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -7,6 +7,7 @@ 16dp 16dp 16dp + 56dp 24dp 20dp