Scalified / fab

Floating Action Button Library for Android
Apache License 2.0
849 stars 164 forks source link

Request - Circular ProgressBar #13

Open TurKurT656 opened 9 years ago

TurKurT656 commented 9 years ago

Hi Can u add a circular progressBar around the FAB like this lib: https://github.com/ckurtm/FabButton

vbaidak commented 9 years ago

Hi,

Useful feature. I will add it to the features queue. I can't provide any estimations now about it cause there are a lot of other more critical features to implement

So check for updates

TurKurT656 commented 9 years ago

You Are only developer that answers my issues so quickly. ThnQ Very Much

vbaidak commented 9 years ago

Thanks)

I'm available the times when not sleeping)

JV-TM commented 9 years ago

Hi, I would appreciate ANY progressBar visualization as well.

Another (possibly cooler) way to do so could be to use whole button animation. Let say "disable" button (gray) and rotate it with icon inside. And the most cool way would be to make it really simple ((-: E.g.: To set this fab:progressAnimation="@anim/fab_progress_rotate" in XML and than just programically call "actionButton.startProgress() / stopProgress()"

What do you think ?

vbaidak commented 9 years ago

Hi!

I'm ok with it. Currently I'm finishing 1.1.0 version and will release it soon. I also have some plans to implement menu in Action Button. So it will take some time

If you have time and wish you can try to implement it (after 1.1.0 release) and send me the pull request

Thanks for contribution

JV-TM commented 9 years ago

Meanwhile I played with this (beware 15 min test - just a test)... put progressbar behind FAB, change progressBar color programically, rotate FAB and start progressbar, then stop it when finished

<ProgressBar android:id="@+id/createOrder_progressBar" android:layout_width="70dp" android:layout_height="70dp" android:layout_alignBottom="@+id/createOrder_layout" android:layout_alignParentRight="true" android:layout_marginBottom="-39dp" android:layout_marginRight="13dp" android:elevation="@dimen/elevation_high" android:visibility="gone" tools:visibility="visible" />

<com.software.shell.fab.ActionButton
    android:id="@+id/createOrder_button"
    xmlns:fab="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBottom="@+id/createOrder_layout"
    android:layout_alignParentRight="true"
    android:layout_marginBottom="-32dp"
    android:layout_marginRight="@dimen/padding20"
    android:elevation="@dimen/elevation_high"
    android:visibility="invisible"
    fab:button_color="@color/green"
    fab:button_colorPressed="@color/darkGreen"
    fab:image="@drawable/ic_send_white_24dp"
    fab:show_animation="@anim/fab_fade_in"
    tools:visibility="visible"
    />

<?xml version="1.0" encoding="utf-8"?>

progressBar = (ProgressBar) view.findViewById(R.id.createOrder_progressBar); progressBar.getIndeterminateDrawable().setColorFilter(getResources().getColor(R.color.green), android.graphics.PorterDuff.Mode.MULTIPLY);

actionButton = (ActionButton) view.findViewById(R.id.createOrder_button); actionButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Progress like animation actionButton.startAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.rotate)); progressBar.setVisibility(View.VISIBLE); actionButton.setClickable(false); actionButton.setButtonColor(Color.LTGRAY);

    doCreateOrder(v);

} }); // Initial animation actionButton.postDelayed(new Runnable() { @Override public void run() { actionButton.show(); } }, 250);

// FINISH operation progressBar.setVisibility(View.GONE); actionButton.setClickable(true); actionButton.setButtonColor(getResources().getColor(R.color.green)); actionButton.clearAnimation();

fab1 fab2 fab3

vbaidak commented 9 years ago

Idea is good. However I think it would be better to draw the progress instead of using the android's ones. This is what actually differs Action Button from another libraries. All elements in this library are indeed drawn in 2D instead of using an existing implementation

We can extend the ActionButton class, override the onDraw(Canvas canvas) method and add additional ones.

JV-TM commented 9 years ago

Any progress? Thanks...

vbaidak commented 9 years ago

In plans, however I can't answer now how much time will it take. I'm planning a great refactoring + new features in the nearest time