Open Arash-gm opened 9 years ago
@Arash-gm The code currently assumes that the second child is a floating action button. I'm not sure I understand what result you want to achieve: do you want the whole RelativeLayout containing the FAB and your other button to move along, or do you only want the FAB to move?
@Tr4Android: Thx for the response, actually I want my second button move according to fab movement, like Google map GPS button which GPS button is above the fab.for achieving rhis Ive thought that maybe a Relativelayout might does the job but that didnt work.
@Arash-gm If you want to achieve exactly the same behavior and layout as the GPS button on Google Maps you can try the following:
onPanelSlideListener
. It has two callbacks (onPanelHiddenExecuted( )
and onPanelShownExecuted( )
) that also provide an Interpolator and a duration which you can use to translate the FAB using an ObjectAnimator.
Hope this helps! @TR4Android : i will try that hope it works ;)
@Arash-gm Any update? Did it work?
@TR4Android : for now I've added another button over it , but i have other problems to solve as i make PanelHeight to 1dp (because i wanted to panel collapse to most bottom part of screen) and make SlidingUpPanelLayout to use Fragment instead , FAB no longer attach to SlidingUpPanel.
@Arash-gm In order to hide the sliding up panel you could use setPanelState(PanelState.HIDDEN)
. That might be a cleaner solution than setting the panel height to 1dp.
@TR4Android : I've tried that with no success in onPanelCollapsed i've set like this :
@Override
public void onPanelCollapsed(View panel) {
slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
}
this line would get called but the panel won't get hidden,and the panel will be on the bottom of the page
@TR4Android : also i wanted to use the view you are passing through your panel listeners but it throws : android.widget.FrameLayout cannot be cast to com.sothree.slidinguppanel.SlidingUpPanelLayout
@Arash-gm Any particular reason you are calling this from onPanelCollapsed()
? Or do you just want the panel to disappear when the user collapses the panel?
Also, the View panel
passed in the listener is the panel itself, not the SlidingUpPanelLayout. I'm guessing you're using a FrameLayout for the fragment, so that's what's returned.
yes its true i figured it out myself that it returns panel and not SlidingUpPanelLayout so i've used global slidingLayout to change its state to hidden but it doesn't change it's state.i wanted to make SlidingUpPanelLayout not visible to user when it collapse.
@Arash-gm Hmm. I would have thought that this works. I'll take a look at this issue.
@TR4Android : Thx ;)
@TR4Android : for a hint i've debug the library and when i've added Breakpoints and going through step by step it successfully hid the panel on smoothSlideTo(...) but when i exit debug mode it doesn't hid the panel.
@Arash-gm I didn't resolve the issue yet. It's rather strange because it should theoretically work. Thanks for the hint though :)
@Arash-gm This might be a timing issue causing the slide state of the panel to be changed to DRAGGING between the call to dispatchOnPanelCollapsed()
and your call to setPanelState(PanelState.HIDDEN)
and thus not calling the smooth slide. I'm not sure I know the code well enough to fix this though, so I guess it's better to wait for a fix.
@TR4Android : unfortunately we don't have enough time to wait for next update of umano library maybe we should think of another solution . Thank you for your time and effort. much appreciated ;)
@Arash-gm I'll try to come up with some sort of hotfix, but no promises here :smiley:
@Arash-gm Unfortunately it seems like the issue is related to the smoothSlideTo()
method itself which is not that easy to fix, so the only thing you can do for now is use setPanelHeight()
to hide the panel correctly, maybe in conjuction with a call to invalidateLayout()
on the FloatingActionButtonLayout. There probably will still be issues though, as the fab is positioned based on the panel state, and this isn't set properly when using setPanelState
. Also, animation sadly will not work when using this.
@Arash-gm Anything I can do on that? Or did you find a solution?
@Tr4Android : i've set panel height to 1 and hid the panel on a Handler with postDelay(500) and it just worked for now , maybe i should work more later on the issue.
@Arash-gm Ok. Good to know that you found a workaround. I'd wait till the original library gets updated to resolve this issue.
Hi , first of all thank you for your nice work , but im struggling to add a button over FloatingActionButton with no success for couple of hours . i know that FloatingActionButtonLayout can have just two childs , so FloatingActionButton is my second child in my layout and it works just fine , but i wanted to add a ReleativeLayout to wrap the FAB and another Button above it , and it hides FAB even i replace RelativeLayout with a FrameLayout. i've also looked at your works and i've changed mFloatingActionButton = getChildAt(1) to : FrameLayout fl = (FrameLayout)getChildAt(1); mFloatingActionButton = fl.getChildAt(0);
in FloatingActionButtonLayout.java file but it doesn't change anything.i would be very happy to help me with this issue.