JorgeCastilloPrz / FABProgressCircle

Material progress circle around any FloatingActionButton. 100% Guidelines.
1.25k stars 181 forks source link

finalIcon is never displayed #6

Open ja1984 opened 9 years ago

ja1984 commented 9 years ago

Hi!

Thank you for an awesome library, it looks amazing and is so easy to implement. I have one issue however, I can't get the finalIcon to display

This is my setup

 <com.github.jorgecastilloprz.FABProgressCircle
    android:id="@+id/fabProgressCircle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|right"
    android:layout_margin="16dp"
    app:reusable="true"
    app:finalIcon="@drawable/ic_action_accept"
    >
    <com.melnykov.fab.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_action_accept"
        fab:fab_colorNormal="@color/twee_blue_light"
        fab:fab_colorPressed="@color/twee_blue_dark"
        fab:fab_colorRipple="@color/twee_blue_light" />
</com.github.jorgecastilloprz.FABProgressCircle>

After i run the beginFinalAnimation(); the FAB changes color to orange, but the icon never shows.

I don't know what I'm doing wrong! :/

StephaneBg commented 9 years ago

Hi, I confirm the issue.

fnberta commented 9 years ago

Any update on this? I'm facing the same issue!

JorgeCastilloPrz commented 9 years ago

I am pretty busy lately. As soon as i get some free time to spend on it, i will fix it. You can provide a Pull Request to help me fixing it too. It would be nice. El 1/7/2015 10:30 p. m., "fnberta" notifications@github.com escribió:

Any update on this? I'm facing the same issue!

— Reply to this email directly or view it on GitHub https://github.com/JorgeCastilloPrz/FABProgressCircle/issues/6#issuecomment-117816843 .

luwei2012 commented 9 years ago

Because you are using CoordinatorLayout.

Flitskikker commented 9 years ago

I'm having the same issue (FAB from design library in a CoordinatorLayout).

fnberta commented 8 years ago

I think there is an easy fix for this issue: See https://github.com/JorgeCastilloPrz/FABProgressCircle/pull/20

MrBrightside29 commented 8 years ago

I'm not using CoordinatorLayout but fullscreen flags and the icon is not showing. Is this library still under development or is deprecated?

MrBrightside29 commented 8 years ago

Well, I've just found a workaround that works in my case. Just wrap the FABProgressCircle with a RelativeLayout.

mjsobremonte commented 8 years ago

My hack-around method using CoordinatorLayout without having to modify the lib (API 11+) :

    private void applyDependencyFixes() {
        final FABProgressCircle fabPc = (FABProgressCircle) findViewById(R.id.fabProgressCircle);
        if (fabPc != null) {
            fabPc.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
                @Override
                public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
                    ImageView imgView = (ImageView) v.findViewById(R.id.completeFabIcon);
                    if ((imgView != null) && (imgView.getScaleType() != ImageView.ScaleType.CENTER_INSIDE)) {
                        imgView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
                    }
                }
            });
        }
    }

OR if you want the lib/xml hack around version :

ByoxCode commented 8 years ago

Hi!

I'm trying with the shongololo29 solution's but only works the first time.

I'm reviewing the FABProgressCircle class and it's adding a CompleteFABView view to the parent view, without remove the previous one.

I found issue's solution, I'm doing this in my code aditionally to the shongololo29's solution:

Check if the FABProgressCircle view contain a CompleteFABView and remove

for (int i = 0; i < mFabProgressRegGoogle.getChildCount(); i++){
    if (mFabProgressRegGoogle.getChildAt(i) instanceof CompleteFABView) {
        mFabProgressRegGoogle.removeViewAt(i);
        break;
    }
}

And maybe you should change the shongololo29's suggestion

OR if you want the lib/xml hack around version :

  • Edit FABProgressCircle/library/src/main/res/layout/complete_fab.xml
  • Just add this attribute in the image view : android:scaleType="centerInside"

Doing this, you delete the OnLayoutChangeListener

Cheers!

J4NS-R commented 6 years ago

In my case this happened because I was calling beginFinalAnimation() too soon. I called show(), did some quick calculations and then called beginFinalAnimation(). I guess calling them both within too little milliseconds causes the latter to be ignored.

I worked around the issue by creating an AsyncTask that waits 500ms and then calls beginFinalAnimation() in its onPostExecute().