CircleProgress icon indicating copy to clipboard operation
CircleProgress copied to clipboard

Bottom text cut on ArcProgress when use Fragment

Open csechuan opened this issue 10 years ago • 14 comments

As per title, I found this issue happens only when using Fragment. I simulate the same thing on Activity, it works perfect.

** There are 3 posts regarding this issue. So I don't know which should I post into.

csechuan avatar Jan 25 '15 04:01 csechuan

I have the same issue

sp574 avatar Feb 03 '15 21:02 sp574

Same here.

xbassols avatar Mar 08 '15 06:03 xbassols

I will check this bug this weekend, please wait

uknownothingsnow avatar Mar 09 '15 13:03 uknownothingsnow

In Fragment the arcBottomHeight = 0 after reload.

on first load: -- /ArcProgress﹕ arcBottomHeight: 14.323726 -- /ArcProgress﹕ onDraw -> getBottomText : 142.5122

on reload: ** /ArcProgress﹕ arcBottomHeight: 0.0 ** /ArcProgress﹕ onDraw -> getBottomText : 142.5122

ferozsho avatar Mar 22 '15 19:03 ferozsho

@ferozsho thanks a lot, I will fix it

uknownothingsnow avatar Mar 23 '15 01:03 uknownothingsnow

@ferozsho would you mind give more detail about fragment reload, so I can reproduce this bug.

uknownothingsnow avatar Mar 23 '15 03:03 uknownothingsnow

@lzyzsd Thanks for response.

please check when i reuse the code its working. onfrag

ferozsho avatar Mar 23 '15 10:03 ferozsho

@ferozsho I still can not reproduce this bug, would you mind giving more detail about your code? I use show and hide to switch fragments and can not reproduce it.How do you reload your fragments?

uknownothingsnow avatar Mar 23 '15 14:03 uknownothingsnow

@lzyzsd Please add this below code on ArcProgress.java under onDraw method after 297 line and its working fine with below code.

        if(arcBottomHeight == 0) {
            float radius = getWidth() / 2f;
            float angle = (360 - arcAngle) / 2f;
            arcBottomHeight = radius * (float) (1 - Math.cos(angle / 180 * Math.PI));
        }

because the arcBottomHeight is getting to zero. after reload the fragment.

For calling multiples time on Activity:

FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.replace(R.id.overviewFragment, OverviewFragment .newInstance(selectedPeriod, sDate, eDate)); fragmentTransaction.commit();

1

Hope this help.

ferozsho avatar Mar 23 '15 18:03 ferozsho

I have the same problem. Please release with the fix. Thank you so much!

akshaylive avatar Apr 12 '15 08:04 akshaylive

@ferozsho u are my hero, I solved this by using ur solution, I wish I can kiss u. And of cause thank you author of this package! Which is very good looking and nice!

ngalongc avatar Aug 18 '15 14:08 ngalongc

can you push this commit and release a new fixed version please? :)

Lir10 avatar Sep 01 '15 09:09 Lir10

Looks like we can fix this from the fragment it self with :

@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        if (rootView == null) {
            rootView = inflater.inflate(R.layout.status, container, false);
            // Initialise your layout here
        } else {
            container.removeView(rootView);
        }
return rootView;
}

Lir10 avatar Sep 01 '15 12:09 Lir10

The same issue also happens when using the control in a regular activity inside a PercentFrameLayout.

b0wter avatar Sep 08 '16 16:09 b0wter