CircleProgress
CircleProgress copied to clipboard
Bottom text cut on ArcProgress when use Fragment
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.
I have the same issue
Same here.
I will check this bug this weekend, please wait
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 thanks a lot, I will fix it
@ferozsho would you mind give more detail about fragment reload, so I can reproduce this bug.
@lzyzsd Thanks for response.
please check when i reuse the code its working.
@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?
@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();
Hope this help.
I have the same problem. Please release with the fix. Thank you so much!
@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!
can you push this commit and release a new fixed version please? :)
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;
}
The same issue also happens when using the control in a regular activity inside a PercentFrameLayout.