CN-115718632-B - Dynamic display method and device for circular progress bar of An Zhuo Duan and computer equipment
Abstract
The invention discloses a dynamic display method and device for an android Zhuo Duan circular progress bar and computer equipment, and relates to the technical field of android development and application. According to the method, after initializing an inner circle pattern and an outer circle pattern of a circular progress bar, firstly drawing to obtain an inner circle view and an outer circle view of the circular progress bar, when a user sets or updates an actual value of the progress bar, invoking An Zhuoduan an attribute animation mode, gradually returning all interval values positioned in an animation execution parameter value interval from a minimum interval value to the ground within a preset animation duration, updating and calculating an outer circle rotation end point angle based on the interval value after each interval value is returned, and then invoking An Zhuoduan a continuous drawing mode to redraw the outer circle view according to an updated calculation result of the outer circle rotation end point angle, so that a dynamically displayed An Zhuoduan circular progress bar is obtained, circular progress bar text prompt can be dynamically realized according to the current progress, and the requirement of dynamic visualization is met.
Inventors
- JIANG XIAOLONG
- LIU WEI
- ZHANG LI
Assignees
- 成都屏盟科技有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20221121
Claims (10)
- 1. A dynamic display method for an An Zhuo Duan circular progress bar is characterized by comprising the following steps: initializing an inner circle pattern and an outer circle pattern of a circular progress bar; Acquiring a progress bar height and a progress bar width set by a user, and determining the width and the height of the circular progress bar with equal values according to the progress bar height and the progress bar width; calling An Zhuoduan a construction function RectF () according to the thickness attribute of the painting brush of the inner circle style and the width and the height of the circular progress bar, newly creating a first rectangular RectF object required for drawing the inner circle, and calling An Zhuoduan a construction function RectF () according to the thickness attribute of the painting brush of the outer circle style and the width and the height of the circular progress bar, newly creating a second rectangular RectF object required for drawing the outer circle; Calling An Zhuoduan an arc-drawing function drawArc (), drawing to obtain an inner circle view of the circular progress bar according to the first rectangle RectF class object, a preset inner circle rotation starting point angle, a preset inner circle rotation end point angle and the inner circle pattern, calling the arc-drawing function drawArc (), drawing to obtain an outer circle view of the circular progress bar according to the second rectangle RectF class object, a preset outer circle rotation starting point angle, an outer circle rotation end point angle calculated based on an actual value of the progress bar and the outer circle pattern; When the user sets or updates the actual value of the progress bar, a An Zhuoduan attribute animation mode ValueAnimator is called, all interval values in an animation execution parameter value interval are returned gradually from the minimum interval value to the ground in a preset animation duration, after each interval value is returned, the external circle rotation end point angle is updated and calculated based on the interval value, then according to the updated calculation result of the external circle rotation end point angle, the An Zhuoduan continuous drawing mode postInvalidate is called to redraw the external circle view, and the dynamically displayed An Zhuoduan circular progress bar is obtained, wherein the animation execution parameter value interval is [0, mCP set ] when the user sets and is [ mCP bf ,mCP af ],mCP set ] when the user sets, the actual value of the progress bar is represented by the user, mCP bf represents the actual value of the progress bar before updating, and mCP af represents the actual value of the progress bar after updating.
- 2. The An Zhuoduan circular progress bar dynamic display method of claim 1, further comprising: initializing the text style of the circular progress bar; according to the actual value of the progress bar, a progress proportional value is calculated; Calling An Zhuoduan a construction function Rect (), and newly creating a rectangular Rect class object; Calling An Zhuoduan a text rectangle acquisition function getTextBounds (), according to the progress proportion value and the rectangle Rect object, to obtain a text rectangle box for displaying the progress proportion value; Calling An Zhuoduan a rectangular frame width acquisition function width (), acquiring the width of the text rectangular frame, and calling An Zhuoduan a rectangular frame height acquisition function height (), acquiring the height of the text rectangular frame; According to the width and the height of the text rectangular box and the width and the height of the circular progress bar, text starting point coordinates (TextX, textY) required for describing the text are calculated according to the following formula: wherein Width represents the Width of the circular progress bar, height represents the Height of the circular progress bar, textWidth represents the Width of the text rectangular box, and TextHeight represents the Height of the text rectangular box; And calling An Zhuoduan a text drawing function drawText () according to the progress proportion value, the text starting point coordinate and the text style to draw so as to obtain the text view of the circular progress bar.
- 3. The method for dynamically displaying a An Zhuoduan circular progress bar as recited in claim 2 wherein, after each interval value is returned, the method further comprises updating the calculated progress scale value and the text start point coordinates based on the interval value, and then re-rendering the text view by invoking the An Zhuoduan continuous rendering mode postInvalidate based on the updated calculation results of the progress scale value and the text start point coordinates.
- 4. The method for dynamically displaying the An Zhuoduan circular progress bar according to claim 1, wherein initializing an inner circle pattern and an outer circle pattern of the circular progress bar comprises: judging whether a user configures an attribute of a target circular style, wherein the target circular style refers to an inner circular style or an outer circular style of a circular progress bar; If yes, call An Zhuoduan the Paint function Paint (), newly create a brush to be used as the brush of the target circular style, call An Zhuoduan the Paint color setting function Paint. Setcolor () to obtain the Paint color attribute configured by the user for the target circular style, and call An Zhuoduan the Paint thickness setting function Paint. Setstrokes width () to obtain the Paint thickness attribute configured by the user for the target circular style.
- 5. The An Zhuoduan round progress bar dynamic display method according to claim 1, wherein obtaining a progress bar height and a progress bar width set by a user, and determining the width and the height of the round progress bar with equal values according to the progress bar height and the progress bar width, comprises: Invoking An Zhuoduan default size acquisition functions getDefaultSize () and An Zhuoduan suggest a minimum height acquisition function getSuggestedMinimumHeight () to acquire a user-set progress bar height, and invoking the An Zhuoduan default size acquisition functions getDefaultSize () and An Zhuoduan suggest a minimum width acquisition function getSuggestedMinimumWidth () to acquire a user-set progress bar width; calling An Zhuoduan to obtain a minimum function Math.min () to obtain a minimum value in the height of the progress bar and the width of the progress bar; The call An Zhuoduan measures dimension settings function setMeasuredDimension () to set the width and height of the circular progress bar to the minimum values, respectively.
- 6. The dynamic display method of a An Zhuoduan circular progress bar according to claim 1, wherein calling An Zhuoduan a constructor RectF () according to the thickness attribute of the brushes of the inner circle style and the width and height of the circular progress bar, creating a first rectangular RectF class object required for drawing the inner circle, comprising: Calculating a start point coordinate (left, top) and an end point coordinate (bottom) of the rectangle according to the thickness attribute of the brush of the inner circle style and the width and the height of the circular progress bar according to the following formula: Wherein mSW represents a parameter value of a thickness attribute of the brush of the inner circle style, width represents a Width of the circular progress bar, and Height represents a Height of the circular progress bar; and calling An Zhuoduan a constructor RectF () according to the start point coordinate (left) and the end point coordinate (right, bottom), and creating a first rectangular RectF object required for drawing the inner circle.
- 7. The An Zhuoduan circular progress bar dynamic display method according to claim 1, wherein the inner circle rotation start point angle is set to 270 degrees, the inner circle rotation end point angle is set to 360 degrees, the outer circle rotation start point angle is also set to 270 degrees, and the outer circle rotation end point angle is calculated according to the following formula: oSA=(mCP/mTP)×360 Wherein oSA denotes the rotation end point angle of the outer circle, mCP denotes the actual value of the progress bar, and mTP denotes the known total value of the progress bar.
- 8. A dynamic display device for an An Zhuo Duan circular progress bar is characterized by comprising a progress bar initialization model, a progress bar size determination module, a rectangular object new module, an inner and outer circular view drawing module and an outer circular view redrawing module; the progress bar initialization model is used for initializing an inner circle pattern and an outer circle pattern of the circular progress bar; The progress bar size determining module is used for obtaining the progress bar height and the progress bar width set by a user, and determining the width and the height of the circular progress bar with equal values according to the progress bar height and the progress bar width; The rectangle object newly-built module is respectively in communication connection with the progress bar initialization model and the progress bar size determination module, and is used for calling An Zhuoduan a constructor RectF () according to the thickness attribute of the painting brush of the inner circle style and the width and the height of the circular progress bar, newly-building a first rectangle RectF object required for drawing the inner circle, and calling An Zhuoduan a constructor RectF () according to the thickness attribute of the painting brush of the outer circle style and the width and the height of the circular progress bar, and newly-building a second rectangle RectF object required for drawing the outer circle; The inside and outside circle view drawing module is respectively in communication connection with the progress bar initialization model and the rectangle object new module, and is used for calling An Zhuoduan an arc drawing function drawArc (), drawing to obtain an inside circle view of the circular progress bar, and calling an arc drawing function drawArc (), drawing to obtain an outside circle view of the circular progress bar according to the first rectangle RectF class object, a preset inside circle rotation starting point angle, a preset inside circle rotation ending point angle and the inside circle pattern, and according to the second rectangle RectF class object, the preset outside circle rotation starting point angle, the outside circle rotation ending point angle calculated based on the actual value of the progress bar and the outside circle pattern; The outer circle view redrawing module is in communication connection with the inner and outer circle view drawing module, and is configured to call An Zhuoduan an attribute animation mode ValueAnimator when a user sets or updates the actual value of the progress bar, gradually return each interval value located in an animation execution parameter interval from the minimum interval value to the ground within a preset animation duration, update and calculate the outer circle rotation end point angle based on the interval value after each interval value is returned, and call An Zhuoduan a continuous drawing mode postInvalidate to redraw the outer circle view according to the update calculation result of the outer circle rotation end point angle, so as to obtain a dynamically displayed An Zhuoduan circular progress bar, wherein the animation execution parameter interval is [0, mCP set ] when the user sets and is [ mCP bf ,mCP af ],mCP set ] when the user sets the actual value of the progress bar, mCP bf represents the actual value of the progress bar before update, and mCP af represents the actual value of the progress bar after update.
- 9. A computer device, comprising a memory, a processor and a transceiver, which are connected in turn in communication, wherein the memory is used for storing a computer program, the transceiver is used for receiving and transmitting a message, and the processor is used for reading the computer program and executing the An Zhuoduan circular progress bar dynamic display method according to any one of claims 1 to 7.
- 10. A computer readable storage medium having instructions stored thereon which, when executed on a computer, perform the An Zhuoduan circular progress bar dynamic presentation method of any one of claims 1 to 7.
Description
Dynamic display method and device for circular progress bar of An Zhuo Duan and computer equipment Technical Field The invention belongs to the technical field of android development and application, and particularly relates to a dynamic display method and device for an android Zhuo Duan circular progress bar and computer equipment. Background In the conventional Android development application, a business scenario requiring the use of a progress bar effect is often encountered, in general, the progress bar effect of the Android native is used, but the native progress bar effect cannot meet the requirement of dynamic visualization, so how to dynamically realize the circular progress bar text prompt according to the current progress is a subject of urgent study by those skilled in the art. Disclosure of Invention The invention aims to provide a dynamic display method, a device, computer equipment and a computer readable storage medium for an Android Zhuo Duan circular progress bar, which are used for solving the problem that the existing progress bar effect of Android native can not meet the dynamic visualization requirement. In order to achieve the above purpose, the present invention adopts the following technical scheme: In a first aspect, a dynamic display method for an ampere Zhuo Duan circular progress bar is provided, including: initializing an inner circle pattern and an outer circle pattern of a circular progress bar; Acquiring a progress bar height and a progress bar width set by a user, and determining the width and the height of the circular progress bar with equal values according to the progress bar height and the progress bar width; calling An Zhuoduan a construction function RectF () according to the thickness attribute of the painting brush of the inner circle style and the width and the height of the circular progress bar, newly creating a first rectangular RectF object required for drawing the inner circle, and calling An Zhuoduan a construction function RectF () according to the thickness attribute of the painting brush of the outer circle style and the width and the height of the circular progress bar, newly creating a second rectangular RectF object required for drawing the outer circle; Calling An Zhuoduan an arc-drawing function drawArc (), drawing to obtain an inner circle view of the circular progress bar according to the first rectangle RectF class object, a preset inner circle rotation starting point angle, a preset inner circle rotation end point angle and the inner circle pattern, calling the arc-drawing function drawArc (), drawing to obtain an outer circle view of the circular progress bar according to the second rectangle RectF class object, a preset outer circle rotation starting point angle, an outer circle rotation end point angle calculated based on an actual value of the progress bar and the outer circle pattern; When the user sets or updates the actual value of the progress bar, a An Zhuoduan attribute animation mode ValueAnimator is called, all interval values in an animation execution parameter value interval are returned gradually from the minimum interval value to the ground in a preset animation duration, after each interval value is returned, the external circle rotation end point angle is updated and calculated based on the interval value, then according to the updated calculation result of the external circle rotation end point angle, the An Zhuoduan continuous drawing mode postInvalidate is called to redraw the external circle view, and the dynamically displayed An Zhuoduan circular progress bar is obtained, wherein the animation execution parameter value interval is [0, mCP set ] when the user sets and is [ mCP bf,mCPaf],mCPset ] when the user sets, the actual value of the progress bar is represented by the user, mCP bf represents the actual value of the progress bar before updating, and mCP af represents the actual value of the progress bar after updating. Based on the above summary, a dynamic visualization scheme for a circular progress bar is provided, namely after initializing an inner circle pattern and an outer circle pattern of the circular progress bar, firstly determining the width and the height of the circular progress bar with equal values according to the height of the progress bar and the width of the progress bar set by a user, then calling An Zhuoduan a construction function RectF (), newly creating a rectangular RectF type object required for drawing an inner circle and an outer circle, then calling An Zhuoduan an arc drawing function drawArc (), drawing an inner circle view and an outer circle view of the circular progress bar according to the rectangular RectF type object, the inner circle rotation start point angle, the outer circle rotation end point angle and the inner circle pattern, finally calling An Zhuoduan an attribute animation mode ValueAnimator when the actual value of the progress bar is set or updated by the user, gradually ret