FABProgressCircle icon indicating copy to clipboard operation
FABProgressCircle copied to clipboard

finalIcon is never displayed

Open ja1984 opened this issue 10 years ago • 11 comments

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! :/

ja1984 avatar Jun 16 '15 21:06 ja1984

Hi, I confirm the issue.

StephaneBg avatar Jun 17 '15 10:06 StephaneBg

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

fnberta avatar Jul 01 '15 20:07 fnberta

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" [email protected] 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 .

JorgeCastilloPrz avatar Jul 01 '15 20:07 JorgeCastilloPrz

Because you are using CoordinatorLayout.

luwei2012 avatar Jul 08 '15 11:07 luwei2012

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

Flitskikker avatar Sep 21 '15 11:09 Flitskikker

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

fnberta avatar Nov 24 '15 13:11 fnberta

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

MrBrightside29 avatar Dec 03 '15 16:12 MrBrightside29

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

MrBrightside29 avatar Dec 03 '15 17:12 MrBrightside29

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 :

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

mjsobremonte avatar Jan 25 '16 06:01 mjsobremonte

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!

ByoxCode avatar Feb 25 '16 21:02 ByoxCode

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().

J4NS-R avatar Jan 20 '18 15:01 J4NS-R