Giter VIP home page Giter VIP logo

Comments (25)

PsyGik avatar PsyGik commented on June 4, 2024 1

I implemented it like this along with the listener:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:fab="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.fragmentLayout">
<android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/swipe_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
       <include layout="@layout/root_layout"/>
    </android.support.v4.widget.SwipeRefreshLayout>
    <View
        android:id="@+id/shadowView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone"
        android:background="@color/Transparentish_White" />
    <LinearLayout
        android:orientation="vertical"
        android:layout_gravity="bottom|end"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

        <com.getbase.floatingactionbutton.FloatingActionsMenu
            android:id="@+id/action_menu"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            fab:fab_addButtonColorNormal="@color/holo_blue_dark"
            fab:fab_addButtonColorPressed="@color/white_pressed"
            fab:fab_labelStyle="@style/menu_labels_style"
            android:layout_marginBottom="16dp"
            android:layout_marginRight="16dp"
            android:layout_marginEnd="16dp">

            <com.getbase.floatingactionbutton.FloatingActionButton
                android:id="@+id/action_new_task"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                fab:fab_colorNormal="@color/white"
                fab:fab_icon="@drawable/ic_action_tasks"
                fab:fab_size="mini"
                fab:fab_title="New Task"
                fab:fab_colorPressed="@color/white_pressed" />

            <com.getbase.floatingactionbutton.FloatingActionButton
                android:id="@+id/action_new_list"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                fab:fab_colorNormal="@color/white"
                fab:fab_icon="@drawable/ic_action_lists"
                fab:fab_size="mini"
                fab:fab_title="New List"
                fab:fab_colorPressed="@color/white_pressed" />

            <com.getbase.floatingactionbutton.FloatingActionButton
                android:id="@+id/action_new_note"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                fab:fab_colorNormal="@color/white"
                fab:fab_icon="@drawable/ic_action_notes"
                fab:fab_size="mini"
                fab:fab_title="New Note"
                fab:fab_colorPressed="@color/white_pressed" />

        </com.getbase.floatingactionbutton.FloatingActionsMenu>
    </LinearLayout>
</FrameLayout>

And to achieve the Inbox style background shadow, I am changing the visibility of shadowView. However it'll not overlap on the actionbar/toolbar in your activity.

from android-floating-action-button.

DineshAnandan avatar DineshAnandan commented on June 4, 2024 1

We can override the onBackpressed method.

@ Override
public void onBackPressed()
{
if (fabMenu.isExpanded())
{
fabMenu.collapse();
}
else
{
super.onBackPressed();
}
}

from android-floating-action-button.

DineshAnandan avatar DineshAnandan commented on June 4, 2024

also if menu is opend, when i click outside of the floating menu i should close. Is it possible?

from android-floating-action-button.

chalup avatar chalup commented on June 4, 2024

It's currently not supported, but it would definitely be a nice addition.

from android-floating-action-button.

chalup avatar chalup commented on June 4, 2024

I thought a bit more about this and I think it should be handled by another View + FloatingActionsMenu onExpand/onCollapse listeners. I'd need to add this to the sample application.

from android-floating-action-button.

chalup avatar chalup commented on June 4, 2024

Yup, that's exactly what I had in mind. Any ideas how to make the menu collapse on user pressing back button?

from android-floating-action-button.

chalup avatar chalup commented on June 4, 2024

The problem with this approach is that the Activity have to know about the FAM. I'll try to figure something out using Fragments' back stack, but IIRC there were some issues with backstack and nested fragments :(

from android-floating-action-button.

PsyGik avatar PsyGik commented on June 4, 2024

Have you tried public boolean onKeyDown(int keyCode, KeyEvent event) along with the current state of the button?

Say,

boolean onKeyDown(int keyCode, KeyEvent event){

    if(keyCode == KeyEvent.KEYCODE_BACK && mExpanded)
        collapse();
}

from android-floating-action-button.

damianhinch avatar damianhinch commented on June 4, 2024

Is it possible to add an onExpand/onCollapse listener? I would like to use this to blank out the background as in the Inbox app but am unsure if that is supported or how to do this.

from android-floating-action-button.

chalup avatar chalup commented on June 4, 2024

@damianhinch it's already implemented in fa4824b, available in since version 1.5.0.

from android-floating-action-button.

damianhinch avatar damianhinch commented on June 4, 2024

@chalup Oh wow sorry I was using an older version mistakenly. Thank you very much!

from android-floating-action-button.

pawelantczak avatar pawelantczak commented on June 4, 2024

Yep. +1 for this one.
It sometimes hard to hit smaller button.

from android-floating-action-button.

LewisRhine avatar LewisRhine commented on June 4, 2024

What if you had a blank fragment a with transport white background what you inflated between the fab, and the all other ui elements when the menu is opened, and dismiss on collapse. Then back would dismiss it like any fragment in the stack, and you could set an on click to tell the fragment to collapse the menu. Maybe even bake it into the menu fab view?

from android-floating-action-button.

chalup avatar chalup commented on June 4, 2024

I'd probably put it into separate helper class implementing FAM listener and Fragment back stack listener, but yeah, that's exactly what I had in mind few comments above.

from android-floating-action-button.

devishankar avatar devishankar commented on June 4, 2024

It can be implemented with the help of FloatingActionsMenu.OnFloatingActionsMenuUpdateListener(), but the problem i'm facing is, when i use this Listener it spoils the nice flow of animation in the floating buttons, any workaround to make the animation fluid....

from android-floating-action-button.

jkwiecien avatar jkwiecien commented on June 4, 2024

I also tried implementing it myself using OnFloatingActionsMenuUpdateListener callbacks but as above, adding another animation there ruins floating menu animation :(

from android-floating-action-button.

wjwarren avatar wjwarren commented on June 4, 2024

For anyone interested, I implemented this on my fork of this project. Have a look at commits wjwarren@d72b15b, wjwarren@d72b15b, wjwarren@714fff6 and wjwarren@3bf1166 in particular.

from android-floating-action-button.

alvinwoon avatar alvinwoon commented on June 4, 2024

Thanks for the 1.7 chalup. Would love to see background in next release. (Fingers crossed)

from android-floating-action-button.

srikanthgr avatar srikanthgr commented on June 4, 2024

@DineshAnandan I am not sure whether its the right solution but i added a GestureDetector on listview and on onFling method was able to close.

from android-floating-action-button.

manjunathc23 avatar manjunathc23 commented on June 4, 2024

We have implemented this, However key is the responsibility should lie outside the FAB menu. That feature is clearly not FAB menu's

from android-floating-action-button.

chalup avatar chalup commented on June 4, 2024

@manjunathc23 I agree, but I also think this is a very common request/use case, so it should be implemented in the sample application.

from android-floating-action-button.

chalup avatar chalup commented on June 4, 2024

Note to self: take a look at #111 when implementing this stuff.

from android-floating-action-button.

chalup avatar chalup commented on June 4, 2024

Another note to self: #150

from android-floating-action-button.

alphanso avatar alphanso commented on June 4, 2024

I have added a tutorial explaining how you can implement background shadow with current library.
http://www.rishabhsinghal.in/implement-floating-action-button-similar-to-inbox-by-gmail-or-evernote/

from android-floating-action-button.

shahinfasihi avatar shahinfasihi commented on June 4, 2024

if you are using a RelativeLayout i can help with a trick to work for you ;
you can set a textview above all your objects before the floating action button
after that you can set your textview to show when your button click (in default it's visibility is gone)
and you can give your textview any color that you want to see it as a dim object when you click the btn (and textview visibility should be visible)
or you can use link below
https://github.com/Clans/FloatingActionButton

from android-floating-action-button.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.