The first thing to note is that the effect of making a circle rotation is not what the blogger does, it's referring to a code on GitHub, just adding a change to it, optimizing it, and adding a tick animation.
First look at the effect, 1+ 's phone to get root permissions is really difficult, unable to record screen, can only use this screenshot to generate Git stupid method, in fact, the operation is still very smooth.
This is the address of the code GitHub:
git clone https://github.com/lxxcaroline/progresswheelview.git
This is the GitHub address of the Circle rotation code:
git clone https://github.com/pnikosis/materialish-progress.git
My amendment to the original author's code is
1. The original author calls invalidate directly in the OnDraw function, which causes the interface to refresh, especially when you open the settings in this developer option and then go back to the application's interface and find that he is frequently refreshed. The advice my boss gave me was to use Handler.sendmessagedelay (Message, Delaymills) to invoke the Invalidate method in the Handlemessage method of handler each time the delay was refreshed, In the OnDraw function to send a message to handler can, as long as the 16ms within the refresh frame does not lag is good.
2. The animation of the hook is my main modification, divided into two straight lines to draw. Here is my design, the middle of the small box side length is the code in the Ticksize, so each time the painting will go to the center of the circle, and then centered to draw a square, respectively draw a tick of two lines, draw short first, draw short and then began to draw long.
There are comments in the code, let's see for yourselves.
Android make similar payment circle and hook interface Progresswheel