BrotherV / Floating-ArcMenu

A prety menu for all application
129 stars 35 forks source link

FloatingActionButton animation not working as expected when itemCount is set to 1 #17

Open borosuman opened 6 years ago

borosuman commented 6 years ago

FloatingActionButton animation not working as expected when itemCount is set to 1. You can see the behavior here Screenshots here

BrotherV commented 6 years ago

Hi, can you send me your java and your xml codes? I'm wondering how it happened and I think there is a problem in your codes.

borosuman commented 6 years ago

Hi @BrotherV ,here is the code: activity_main.xml:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="x.bq.test.myapplication.MainActivity">

    <ProgressBar
        android:id="@+id/progress_bar_id"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:visibility="invisible"
        android:layout_gravity="center_vertical|center_horizontal"
        />
    <com.bvapp.arcmenulibrary.ArcMenu
        android:id="@+id/arc_menu_id"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:menuType="large"
        app:menuChildSize="48dp"
        app:menuGravity="Bottom_Right"
        app:menuClickAnim="true"
        app:menuChildAnim="false"
        app:menuShadowElevation="true"
        app:menuNormalColor="@color/colorAccent"
        android:layout_gravity="center_horizontal|right"
        />
</FrameLayout>

MainActivity.java:

public class MainActivity extends AppCompatActivity {
    private static final int[] ITEM_DRAWABLES = {R.drawable.ic_share_white_18dp};
    private ArcMenu fabArcMenu;
    private String[] str = {"Test"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        fabArcMenu = (ArcMenu) findViewById(R.id.arc_menu_id);
        fabArcMenu.showTooltip(true);
        fabArcMenu.setToolTipBackColor(Color.WHITE);
        fabArcMenu.setToolTipCorner(6f);
        fabArcMenu.setToolTipPadding(2f);
        fabArcMenu.setToolTipTextColor(Color.BLUE);
        fabArcMenu.setAnim(300, 300, ArcMenu.ANIM_MIDDLE_TO_RIGHT, ArcMenu.ANIM_MIDDLE_TO_RIGHT,
                ArcMenu.ANIM_INTERPOLATOR_ACCELERATE_DECLERATE, ArcMenu.ANIM_INTERPOLATOR_ACCELERATE_DECLERATE);
        final int itemCount = ITEM_DRAWABLES.length;
        for (int i = 0; i < itemCount; i++) {
            FloatingActionButton item = new FloatingActionButton(this);
            item.setSize(FloatingActionButton.SIZE_MINI);
            item.setIcon(ITEM_DRAWABLES[i]);
            item.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
            fabArcMenu.setChildSize(item.getIntrinsicHeight());

            final int position = i;
            fabArcMenu.addItem(item, str[i], new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    //You can access child click in here
                }
            });
        }
    }
}
samuelhalim1 commented 4 years ago

hey..so how was this issue? are there any solution? @BrotherV

BrotherV commented 4 years ago

Sorry I had to answer this a few months ago, sorry I was busy but I'll try to fin a solution or fix the library.