taltstidl / AndroidSlidingUpPanel

This library provides a simple way to add a draggable sliding up panel (popularized by Google Music and Google Maps) to your Android application. Brought to you by Umano.
http://umano.me
Apache License 2.0
13 stars 6 forks source link

Add ability to properly set Floating Action Button visibility #14

Open taltstidl opened 9 years ago

taltstidl commented 9 years ago

Taken from issue #12. Because this library also handles the visibility in some cases to make sure the Floating Action Button is appearing correctly depending on the panel position, external calls to setVisibility() will be overidden. This will probably be done as a custom call to set the Floating Action Button, so the library can still track the visibility when needed (mFloatingActionButtonLayout.setFloatingActionButtonVisibility()).

Arash-gm commented 9 years ago

@TR4Android : did you commit any changes? where can i use setFloatingActionButtonVisibility()?

taltstidl commented 9 years ago

@Arash-gm It's not available yet. Sorry for that. Will be coming soon.

taltstidl commented 9 years ago

Commit 6d0ed126cd94571881a182a4a88cf52cae6e1503 has better handling of the visibility. You have to make sure though that you only use the setFloatingActionButtonVisibility(int visibility) of the FloatingActionButtonLayout, so the code can still handle the visibility when it has to. The int visibility must be either View.VISIBLE, View.INVISIBLE or View.GONE as with the normal setVisibility call.

taltstidl commented 9 years ago

@Arash-gm Tell me if this fixes your issue. Thanks!

Arash-gm commented 9 years ago

@TR4Android : with replacing new commit , the app crashes on application launch with error on :

Caused by: java.lang.NullPointerException at com.sothree.slidinguppanel.SlidingUpPanelLayout.smoothSlideTo(SlidingUpPanelLayout.java:1297) at com.sothree.slidinguppanel.SlidingUpPanelLayout.smoothToBottom(SlidingUpPanelLayout.java:506) at com.sothree.slidinguppanel.SlidingUpPanelLayout.setPanelHeight(SlidingUpPanelLayout.java:499)

i've also tried just lines of your changes for changing visibility with no success.

taltstidl commented 9 years ago

@Arash-gm Sorry for that. I'll have a look at this issue tomorrow. I don't know what causes this yet, as it works fine on my phone.

taltstidl commented 9 years ago

@Arash-gm Could you please provide your configuration so I can reproduce this issue. What are the attributes of the panel? What is the fabs default visibility? What methods are you calling on startup?

Arash-gm commented 9 years ago

@TR4Android : sorry to answering late , the panel attributes are :

<com.sothree.slidinguppanel.FloatingActionButtonLayout  xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:sothree="http://schemas.android.com/apk/res-auto"
xmlns:fab="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
sothree:umanoFabMode="circular_reveal"
android:id="@+id/fabLayout">

<!-- SLIDING UP PANEL -->
<com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:fab="http://schemas.android.com/apk/res-auto"
    xmlns:sothree="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/sliding_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="bottom"
    sothree:umanoDragView="@+id/dragView"
    sothree:umanoParalaxOffset="10dp"
    sothree:umanoShadowHeight="0dp"
    sothree:umanoFadeColor="@color/color_slideup_layout_parallax"
    sothree:umanoOverlay="true"
    android:background="@android:color/transparent">

and on onViewCreated of my Fragment i call :

    slidingLayout.setPanelHeight(1);
    slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
    slidingLayout.setDragView(R.id.view_fake_prevent_swipe);
taltstidl commented 9 years ago

@Arash-gm This issue can probably be solved by adding the attributes for the methods you call when the fragments view is created (something like sothree:umanoPanelHeight="1" or sothree:umanoInitialState="hidden") and deleting those calls. I'll look at this issue further though.

Arash-gm commented 9 years ago

@TR4Android : i've removed run time calls and the NPE error went out , but visibility and detaching doesn't work. and when i touch on FAB spot its getting visible again!

Arash-gm commented 9 years ago

@TR4Android : watching on Layout boundaries , it shows that always FAB panel is out there even it is detached or visibility set to gone.

taltstidl commented 9 years ago

@Arash-gm Unfortunately I am unable to reproduce this issue in the demo activity. Could you please provide the relevant code so I can check it out? Thanks.