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

move() method smearing on KitKat with snackbar. #28

Closed
marcochin opened this issue May 31, 2015 · 6 comments
Closed

move() method smearing on KitKat with snackbar. #28

marcochin opened this issue May 31, 2015 · 6 comments
Assignees
Labels

Comments

@marcochin
Copy link

The FAB seems to be smearing (leaving a image trail behind) under certain conditions in KitKat when move is called.

I'm using your FAB in conjunction with nispok's Snackbar library https://github.com/nispok/snackbar,
and when the snackbar slides up, I move my FAB up by the snackbar height. However, when I SWIPE AWAY the snackbar (very important detail), the FAB comes back down, but it leaves a trail of itself.

I made my own translation animation and the smearing is gone, so it's a good chance that it's a bug in your library. I thought it should be something you should look at.

Note: I've only tested this on the emulator. ICS and Lollipop work fine.
Edit: Jellybean works fine, did not test ICS.

fab smearing

@vbaidak
Copy link
Member

vbaidak commented May 31, 2015

Hi marcochin,

Sure, I'll have a look at this
Please, provide the ActionButton configuration (xml or code) and the method calls to Snackbar and ActionBar libraries

Have you tried also to move ActionButton on KitKat without Snackbar library?

@marcochin
Copy link
Author

This only happens when you SWIPE AWAY the snackbar. If you dismiss the snackbar by clicking the snackbar action button, the animation will work properly. And no I haven't tried it without the snackbar library, dunno if I can reproduce it without swiping away the snackbar.

ActionButton in xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:fab="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent" android:layout_height="match_parent">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recycler_view"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:scrollbars="vertical"/>

    <com.software.shell.fab.ActionButton
        android:id="@+id/floating_action_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        fab:button_color="@color/fab_normal_state"
        fab:button_colorPressed="@color/fab_pressed_state"
        fab:image="@drawable/ic_add"
        fab:image_size="30dp"
        />
</RelativeLayout>

Snackbar configuration in java:

 SnackbarManager.show(
                Snackbar.with(getActivity())
                        .text(R.string.snack_bar_text_item_removed)
                        .actionLabel(R.string.snack_bar_action_undo)
                        .actionListener(new ActionClickListener() {
                            @Override
                            public void onActionClicked(Snackbar snackbar) {
                               /* some code */
                            }
                        })
                        .colorResource(R.color.snackbar_bg_color)
                        .textColorResource(R.color.snackbar_text_color)
                        .actionColorResource(R.color.snackbar_action_color)
                        .duration(5000)
                        .type(SnackbarType.SINGLE_LINE)
                        .swipeToDismiss(true)
                        .eventListener(new EventListener() {
                            @Override
                            public void onShow(Snackbar snackbar) {
                                float snackbarHeight = DpPxConversionUtil.convertPixelsToDp(snackbar.getHeight(), getActivity());
                                mFloatingActionButton.moveUp(snackbarHeight);
                            }

                            @Override
                            public void onShowByReplace(Snackbar snackbar) {

                            }

                            @Override
                            public void onShown(Snackbar snackbar) {

                            }

                            @Override
                            public void onDismiss(Snackbar snackbar) {
                                float snackbarHeight = DpPxConversionUtil.convertPixelsToDp(snackbar.getHeight(), getActivity());
                                mFloatingActionButton.moveDown(snackbarHeight);
                            }

                            @Override
                            public void onDismissByReplace(Snackbar snackbar) {

                            }

                            @Override
                            public void onDismissed(Snackbar snackbar) {

                            }
                        })
        );

DpPxConversionUtil Class if you're interested:

public class DpPxConversionUtil {

    public static float convertDpToPixel(float dp, Context context){
        return dp * context.getResources().getDisplayMetrics().density;
    }

    public static float convertPixelsToDp(float px, Context context){
        return px / context.getResources().getDisplayMetrics().density;
    }
}

@vbaidak vbaidak added the bug label Jun 1, 2015
@vbaidak vbaidak self-assigned this Jun 1, 2015
@vbaidak
Copy link
Member

vbaidak commented Jun 1, 2015

So, I found a possible place to fix within a library, which ActionButton depends on.

However, KitKat emulator is a sort of hard way to test the fix, because of the rendering (actually I can't get even smooth animation on it).

Will you have a possibility to check the fix on your side if I build the sample application and send you the .apk file?

@marcochin
Copy link
Author

Yea, but I can also only test it on an emulator. I had a real KitKat device, but I recently updated it to lollipop..

vbaidak pushed a commit that referenced this issue Jun 13, 2015
…changed the standard Android logging API to slf4j logging API
@vbaidak
Copy link
Member

vbaidak commented Jun 13, 2015

Fixed in version 1.1.2
Please check && confirm

@marcochin
Copy link
Author

I've ran it on my emulator and seems to be fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants