FloatingActionButton icon indicating copy to clipboard operation
FloatingActionButton copied to clipboard

Progress Animation

Open jpshelley opened this issue 10 years ago • 16 comments

Would love to see someone add a feature to include the progress activity as noted here: http://www.google.com/design/spec/components/progress-activity.html#progress-activity-types-of-indicators -By adding the progress to the outer circle of the FAB.

Any thoughts?

jpshelley avatar Oct 01 '14 21:10 jpshelley

+1

rahatarmanahmed avatar Nov 07 '14 06:11 rahatarmanahmed

+1

nwalters512 avatar Nov 07 '14 14:11 nwalters512

This would be beautiful @makovkastar

AkshayChordiya avatar Nov 09 '14 15:11 AkshayChordiya

I've been looking for this for quite a while now, and this would really be a great addition.

outadoc avatar Nov 29 '14 11:11 outadoc

you could try to achieve this effect using this library https://github.com/pnikosis/materialish-progress and in the layout something like this: (Pseudo code)

<FrameLayout>
    <com.melnykov.fab.FloatingActionButton
              android:layout_width="56dp"
              android:layout_height="56dp" />
    <com.pnikosis.materialishprogress.ProgressWheel
              android:layout_width="56dp"
              android:layout_height="56dp"
              android:visibility="gone" />
</FrameLayout>

And when you want to display the ProgressWheel simply make it visible (setVisibility) I haven't tried that out so I've no idea how this will look like (Maybe the ProgressWheel has to be ~2dp bigger so that it doesn't lay directly on the FAB)

ChrisMCMine avatar Nov 29 '14 12:11 ChrisMCMine

Forgive me for plugging my own library but I think it is more accurate to the examples given in the Material design guide: https://github.com/rahatarmanahmed/CircularProgressView

The only problem I can think of with compositing a FAB and a progress wheel is that the shadow would need to be larger.

I've also had trouble with drawing views on top of a FAB, not sure how to fix that either. On Nov 29, 2014 6:39 AM, "ChrisMCMine" [email protected] wrote:

you could try to achieve this effect using this library https://github.com/pnikosis/materialish-progress and in the layout something like this: (Pseudo code)

And when you want to display the ProgressWheel simply make it visible ( setVisibility) I haven't tried that out so I've no idea how this will look like (Maybe the ProgressWheel has to be ~2dp bigger so that it doesn't lay directly on the FAB)

— Reply to this email directly or view it on GitHub https://github.com/makovkastar/FloatingActionButton/issues/24#issuecomment-64950537 .

rahatarmanahmed avatar Nov 29 '14 19:11 rahatarmanahmed

Rahat, do you have any opposition to me trying to integrate your code directly into this library?

nwalters512 avatar Nov 29 '14 22:11 nwalters512

I would prefer it if you used my library as a dependency, and any changes you need be made as pull requests. But otherwise, I don't have any objections.

rahatarmanahmed avatar Nov 29 '14 23:11 rahatarmanahmed

@rahatarmanahmed @makovkastar I foked the FAB library and I've started work here: https://github.com/nwalters512/FloatingActionButton. The best way I could think to do this is by adding a FAB and circular progress indicator to a single relative layout and creating a new custom view based on that. Because the FAB itself is an ImageButton, there was no way for me to add the progress indicator while keeping it a dependency. The issues I've had so far are that a) I can't make the circular progress view display above the FAB in the z-order, and b) putting the FAB in a relative layout seems to clip the shadow. I've tried several things and nothing's worked to solve either of the issues. Any help would be appreciated.

nwalters512 avatar Nov 30 '14 02:11 nwalters512

I've figured out why you can't draw anything on top of the FAB. This only happens in Lollipop because it uses elevation on Lollipop. Anything on a higher elevation has a higher z-order. Easy fix, set elevation to be the same as the FAB. Here's what I use to put my CircularProgressView on my FAB to be used as a loading animation (note this is within a relativelayout with some other stuff I didn't include):

<FrameLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignTop="@id/player_bottom_bar"
    android:layout_alignParentRight="true"
    android:layout_marginRight="16dp"
    android:layout_marginTop="-28dp"
    android:clipChildren="false"
    >
    <com.melnykov.fab.FloatingActionButton
        xmlns:fab="http://schemas.android.com/apk/res-auto"
        android:id="@+id/playPauseButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:src="@drawable/ic_action_play_light"
        fab:fab_colorNormal="@color/colorPrimary"
        fab:fab_colorPressed="@color/colorPrimaryDark"
        />
    <com.github.rahatarmanahmed.cpv.CircularProgressView
        xmlns:cpv="http://schemas.android.com/apk/res-auto"
        android:id="@+id/loading_anim"
        android:layout_width="24dp"
        android:layout_height="24dp"
        android:layout_gravity="center"
        android:elevation="@dimen/fab_elevation_lollipop"
        cpv:cpv_color="#FFF"
        cpv:cpv_indeterminate="true"
        cpv:cpv_thickness="3dp"
        />
</FrameLayout>

rahatarmanahmed avatar Dec 06 '14 04:12 rahatarmanahmed

:+1: I would also love to see this feature!

sailorseashell avatar Dec 12 '14 18:12 sailorseashell

Oh @nwalters512 I forgot to mention to solve the clipping issue, I had to put clipChildren on both the surrounding FrameLayout as you see, AND the parent RelativeLayout. No clue why but that fixed it.

rahatarmanahmed avatar Dec 12 '14 18:12 rahatarmanahmed

+1

nekdenis avatar Dec 15 '14 09:12 nekdenis

+1

TpRadebe avatar Jan 26 '15 17:01 TpRadebe

For those still looking for a clean progress bar too: https://github.com/ckurtm/FabButton

jpshelley avatar Mar 17 '15 00:03 jpshelley

+1

githubdoramon avatar Jun 10 '15 21:06 githubdoramon