Progress bar display method and device

By using a timer to execute a callback function during the download process to virtually move the progress bar, the problem of abrupt progress bar display in existing technologies is solved, thus improving the user experience.

CN119271326BActive Publication Date: 2025-11-14CHENGDU CELIS TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411276608.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-12
Publication Date
2025-11-14
Estimated Expiration
2044-09-12

AI Technical Summary

Technical Problem

In existing technologies, progress bars are displayed in a rigid and mechanical manner, failing to smoothly advance according to the actual loading situation, resulting in a poor user experience.

Method used

By using a timer to execute callback functions at preset time intervals during the download process, the progress bar can be virtually moved, and the progress can be smoothly displayed according to the actual loading situation.

Benefits of technology

It enhances the user experience, with the progress bar displaying smooth, incremental progress based on the actual loading status, thus improving the fluidity of the user interface.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119271326B_ABST
    Figure CN119271326B_ABST
Patent Text Reader

Abstract

This application relates to the field of computer technology and provides a method and apparatus for displaying a progress bar. Applied to a manager deployed on a data-demanding end, the manager includes a downloader. The method includes: starting a timer when downloading pre-loaded data; if the number of completed sub-loading tasks currently downloaded by the downloader is less than a preset step limit, obtaining the current step percentage of the progress bar used to indicate the download progress of the pre-loaded data; calculating a preparatory step percentage based on the current step percentage and the virtual movement percentage when the timer executes a callback function at a preset time interval; calculating the next step percentage of the progress bar; if the preparatory step percentage is greater than the next step percentage, updating the current step percentage to the preparatory step percentage and refreshing the progress bar; and displaying the refreshed progress bar. This application improves the user experience by utilizing a timer to achieve smooth progress of the progress bar.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method and apparatus for displaying a progress bar. Background Technology

[0002] In various applications (such as car control apps), some application data (such as various configurations of the vehicle model) is usually pre-loaded to improve the user experience. To show the loading progress of this application data, a progress bar is usually used.

[0003] In related technologies, progress bars typically move to a few pre-defined points only after the loading progress has reached a preset value. However, this method results in a stiff and mechanical progress bar display, failing to smoothly advance according to the actual loading progress, leading to a poor user experience. Summary of the Invention

[0004] In view of this, embodiments of this application provide a progress bar display method and apparatus to solve the problem that the progress bar display effect in the prior art is stiff and mechanical, and cannot smoothly step according to the actual loading situation, resulting in a poor user experience.

[0005] A first aspect of this application provides a progress bar display method, applied to a manager, the manager being deployed on a data request end, the manager including a downloader;

[0006] The method includes:

[0007] Identify the task to be loaded and notify the downloader to download the preloaded data corresponding to the task from the data provider. The task to be loaded includes at least one sub-loading task.

[0008] Start a timer when the downloader begins downloading preloaded data;

[0009] Determine the number of sub-loading tasks that have been completed by the downloader;

[0010] If the number of completed steps is less than the preset maximum number of steps, then obtain the current percentage of progress of the progress bar used to indicate the download progress of the downloader in downloading preloaded data;

[0011] Calculate the pre-step percentage based on the current step percentage and the virtual movement percentage when the timer executes the callback function at preset time intervals;

[0012] Calculate the percentage of progress made in the next step of the progress bar;

[0013] If the planned step percentage is greater than the next step percentage, then update the current step percentage to the planned step percentage and refresh the progress bar.

[0014] The progress bar after the refresh is displayed.

[0015] A second aspect of this application provides a progress bar display device, comprising:

[0016] The notification module is configured to identify the task to be loaded and notify the downloader to download the preloaded data corresponding to the task to be loaded from the data provider. The task to be loaded includes at least one sub-loading task.

[0017] The module is configured to start a timer when the downloader begins downloading preloaded data;

[0018] The first determining module is configured to determine the number of sub-loading tasks that the downloader has currently completed downloading;

[0019] The acquisition module is configured to acquire the current step percentage of the progress bar used to indicate the download progress of the downloader downloading preloaded data if the number of completed steps is less than the preset upper limit of steps; the first calculation module is configured to calculate the pre-step percentage based on the current step percentage and the virtual movement percentage when the timer executes the callback function at a preset time interval.

[0020] The second calculation module is configured to calculate the percentage progress of the next step of the progress bar.

[0021] The refresh module is configured to update the current step percentage to the planned step percentage and refresh the progress bar if the planned step percentage is greater than the next step percentage.

[0022] The display module is configured to show the progress bar after the refresh.

[0023] A third aspect of this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above-described method.

[0024] A fourth aspect of this application provides a readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method.

[0025] Compared with the prior art, the beneficial effects of this application embodiment include at least the following: during the download process, when the timer executes the callback function at a preset time interval, it performs some "fake movements" that do not affect the actual progress of the progress bar, so that the progress bar can smoothly display the download progress of the task to be loaded according to the actual loading situation, thereby improving the user experience. Attached Figure Description

[0026] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0027] Figure 1 This is a schematic diagram illustrating one application scenario of this application.

[0028] Figure 2 This is a schematic diagram of a 2D car model page provided in an embodiment of this application;

[0029] Figure 3 This is a flowchart illustrating a progress bar display method provided in an embodiment of this application;

[0030] Figure 4 This is a schematic diagram illustrating the correspondence between services and managers provided in an embodiment of this application;

[0031] Figure 5 This is a schematic diagram illustrating the implementation architecture of a progress bar display method provided in an embodiment of this application;

[0032] Figure 6 This is a schematic diagram of a download view in the progress bar display method provided in this application embodiment;

[0033] Figure 7 This is a schematic diagram of a progress bar view in the progress bar display method provided in the embodiments of this application;

[0034] Figure 8 This is a schematic diagram illustrating the interaction between a downloader and a manager, provided in an embodiment of this application.

[0035] Figure 9 This is a schematic diagram of an interface concurrency in the progress bar display method provided in the embodiments of this application;

[0036] Figure 10 This is a schematic diagram illustrating a method for displaying a progress bar using a timer to achieve smooth progress bar movement, as provided in the embodiments of this application.

[0037] Figure 11This is a schematic diagram of a vehicle control page in the progress bar display method provided in the embodiments of this application;

[0038] Figure 12 This is a schematic diagram of the structure of a progress bar display device provided in an embodiment of this application;

[0039] Figure 13 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0040] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0041] A progress bar display method and apparatus according to embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0042] Figure 1 This is a schematic diagram illustrating an application scenario according to an embodiment of this application. The application scenario may include a data requester 101 and a data provider 102.

[0043] The data request terminal 101 (also known as the client) can be either hardware or software. When the data request terminal 101 is hardware, it can be various electronic devices with a display screen that support communication with the data provider terminal 102, including but not limited to smart cars (such as new energy vehicles), smartphones, tablets, laptops, and desktop computers. When the data request terminal 101 is software, it can be a client APP (e.g., a vehicle control APP) installed on the aforementioned electronic devices.

[0044] Data requester 101 has a manager deployed there, which includes a downloader. The downloader is connected to data provider 102.

[0045] The data provider 102, also known as the server or server, can be a single server, a server cluster consisting of several servers, or a cloud computing service center. This application embodiment does not limit this.

[0046] As an example, data requester 101 is a vehicle control APP installed in the aforementioned electronic device. Users can download various vehicle control-related configuration data from data provider 102 (such as a server) through this APP. These vehicle control-related configuration data include: ① a vehicle list; ② detailed information about the user's currently used vehicle; ③ all remote control configuration items; ④ air conditioning configuration items; ⑤ seat configuration items; ⑥ vehicle preparation reservation items; ⑦ charging items; and ⑧ a 2D vehicle model. Specifically: ① The vehicle list includes basic information about all vehicles under the user's name, such as vehicle names or vehicle codes. ② Detailed information about the user's currently used vehicle includes, but is not limited to, vehicle mileage and functional configuration information. ③ All remote control configuration items include, but are not limited to, flashing lights, vehicle location, charging port, windows, and window ventilation. ④ Air conditioning configuration items include, but are not limited to, air conditioning circulation, defrosting, rapid cooling, and rapid heating. ⑤ Seat configuration items include, but are not limited to, seat ventilation and seat heating. ⑥ Vehicle preparation options include, but are not limited to, trip time, air conditioning, repetition cycle, air circulation, air purification, defrosting, seat ventilation, seat heating, and steering wheel heating. ⑦ Charging options include, but are not limited to, charging limit, scheduled charging function on / off, and charging time slots. ⑧ 2D vehicle model refers to a 2D image corresponding to the current state of the user's (e.g., the car owner's) vehicle. For example, if the left door of the user's vehicle 1 is currently open and the actual vehicle color is white, then a 2D image corresponding to the current state (left door open) of vehicle 1 (My Car 1) and matching the actual vehicle color (white) can be simultaneously displayed on the homepage of the vehicle control app. Figure 2 (As shown). For example, if the trunk of user's vehicle 2 is currently open and the actual vehicle color is black, then a 2D image corresponding to the current state (trunk open) of vehicle 2 and matching the actual vehicle color (black) can be displayed on the homepage of the vehicle's app.

[0047] In platform-based vehicle control apps, to improve user experience, it's typically necessary to pre-download data, such as the various vehicle control-related configuration data mentioned above. Generally, different car models have different configurations; for example, model A has a sunroof, while model B does not; model A has heated and cooled cups, while model B does not. However, the configuration differences between different models are largely similar. Developing a dedicated vehicle control app for each model would be extremely costly and require significant manpower and resources. Therefore, the vehicle control configuration data for various models can be centrally stored in a data provider 102 (e.g., a server). The data provider 102 then sends the download request to the data requesting end 101 (e.g., a client) based on the downloaded vehicle control configuration data. In this way, the data requesting end 101 can decide whether to display certain items, differentiate the functions of certain items, and distinguish the logic of certain items based on the downloaded vehicle control configuration data, thus adapting to the personalized needs of different users.

[0048] It should be noted that the specific types, quantities, and combinations of data demand side 101 and data provider side 102 can be adjusted according to the actual needs of the application scenario, and this application embodiment does not impose any restrictions on this.

[0049] Figure 3 This is a flowchart illustrating a progress bar display method provided in an embodiment of this application. Figure 3 The progress bar display method can be determined by Figure 1 The data request is executed by the manager on side 101. For example... Figure 3 As shown, the progress bar display method may specifically include the following steps:

[0050] Step S301: Determine the task to be loaded and notify the downloader to download the preloaded data corresponding to the task to be loaded from the data provider. The task to be loaded includes at least one sub-loading task.

[0051] The progress bar display method of this application embodiment can be applied to any business, that is, the task to be loaded can be any business. For example, the task to be loaded can be downloading the vehicle control configuration data of one or more vehicles in the vehicle list under the user's name when the vehicle control APP starts, or the vehicle control configuration data of all vehicles in the vehicle list under the user's name.

[0052] In this embodiment, downloading the vehicle control configuration data (preloaded data) corresponding to a vehicle can be regarded as a task to be loaded (or a business). For example, if user A has vehicles 1, 2, and 3, then when the vehicle control APP starts, it can create task 1 to be loaded (downloading the vehicle control configuration data corresponding to vehicle 1), task 2 to be loaded (downloading the vehicle control configuration data corresponding to vehicle 2), and task 3 to be loaded (downloading the vehicle control configuration data corresponding to vehicle 3).

[0053] Figure 4 This is a schematic diagram illustrating the correspondence between services and managers provided in an embodiment of this application.

[0054] Figure 5 This is a schematic diagram illustrating the implementation architecture of a progress bar display method provided in an embodiment of this application.

[0055] Please see Figure 4 Assuming there are n business processes (tasks to be loaded), the data request side 101 can assign a manager (instance) to each business process (1, 2, ..., n), assigning values ​​to the download graph corresponding to each manager to form the application's graph. Each manager manages its subordinate downloaders and various interfaces related to downloading preloaded data, and controls the download logic, progress bar step calculation logic, display logic, and static handling of the preloaded data.

[0056] Please see Figure 5 The implementation architecture of this progress bar display method may include a manager, which can be deployed in the data request side 101. One manager corresponds to one business (task to be loaded), and one manager includes a downloader, a header view, a download view, and a progress bar view.

[0057] The graph is a configuration file, which can be a real file, cloud storage, cache storage, or database, etc.

[0058] A business graph is a configuration file that includes the mapping between various tasks to be loaded in the application and the manager.

[0059] The download graph consists of at least one download task, and each download task is composed of "interface nodes" as the basic unit. The "interface nodes" are arranged in a tree structure with a clear execution order. The data stored in the "interface nodes" includes: (1) the request information of the interface itself, such as the interface URL, interface type (e.g., whether it is post or get), interface parameters, etc.; (2) the operations required after the data of this interface is downloaded, such as: writing data to the cache, extracting some data from the data as backup data, decompressing, decrypting, etc.; (3) the information of the "interface nodes" of the superior, subordinate, and sibling levels.

[0060] All the interface information of a task to be loaded is organized into a tree structure. In specific implementations, dictionaries, trees, graphs, etc. can be used.

[0061] The requirement graph refers to the configuration items that support various business requirements. These configuration items include, but are not limited to: (1) Whether to support automatic download or require the user to manually click to download. If automatic download is supported, the page for initializing the application by the manager is a progress bar view. If automatic download is not supported, the page for initializing the application by the manager is a download view. (2) Whether the user can intervene during the download process. If the user can intervene, an intervention button is displayed on the progress bar interface. If the user cannot intervene, an intervention button is not displayed on the progress bar interface. (3) The type of intervention button, including canceling the current download and pausing the current download. Canceling the current download means that the entire download is canceled and restarted. Pausing the current download means that the download is paused, not canceled. (4) Whether a confirmation dialog box needs to pop up after the user clicks, including whether a confirmation dialog box needs to pop up and whether a confirmation dialog box does not need to pop up. If a confirmation dialog box needs to pop up, the manager needs to store and process the "static" state. If a confirmation dialog box does not need to pop up, the manager does not need to store and process the "static" state, and the user can switch the corresponding page and operate the corresponding data after clicking the intervention button. (5) After the download is complete, should the download interface disappear automatically, or should the user click to make it disappear? If the download interface disappears automatically, no additional action is needed. If the user clicks to make it disappear, an additional interface or button may be required, but this is simply adding a few more interface elements; the logic remains the same.

[0062] The header view is optional and can be ignored if the UI (User Interface) design doesn't include one. However, for vehicle control apps, if a user owns multiple vehicles and needs to preload the vehicle control configuration data for each, a header view is necessary. Whenever a user switches vehicles, the corresponding manager for that vehicle is displayed, managing the current page's display and data status. The header view is removed once the download is complete.

[0063] As an example, assuming data requester 101 is a vehicle control app, its download view can be set as follows: Figure 6 The interface / page shown can have its progress bar view set up as follows: Figure 7 The interface / page shown is the initial view of the vehicle control APP. It has a download button "Download". When the user clicks the "Download" button, the manager will receive a click notification from the download view. After that, the manager will instruct the downloader to start downloading the preloaded data corresponding to the task to be loaded from the data provider 102.

[0064] While the downloader is downloading the preloaded data corresponding to the task to be loaded, the manager will synchronously change the value of the progress bar view based on the current step percentage of the task to be loaded.

[0065] Based on the demand graph in the business graph, determine whether the user can intervene in the download process. If the user can intervene in the download process, then an intervention button (such as a "Cancel" button, which cancels the current download) can be displayed on the progress bar view.

[0066] Optionally, if the user clicks the "Cancel" button, a user confirmation dialog box can be displayed on the progress bar view interface.

[0067] If a user confirmation dialog box needs to be displayed, the manager needs to pause the process.

[0068] In the first scenario, the intervention button functions as: cancel the current download, OK - Cancel. If the user clicks "Cancel" in the dialog box, the manager will implement a smooth strategy to continue the download. If the user clicks "OK" in the dialog box, it means the entire download is canceled and restarted from the beginning. In this case, the manager will switch views, hiding the progress bar view and displaying the download view, while simultaneously resetting the manager's data.

[0069] The smoothing strategy, as described in this application embodiment, involves using a timer to move a certain distance (virtual percentage movement) on the progress bar when executing the callback function at preset time intervals, so that the progress bar can smoothly advance according to the actual download progress of the task to be loaded.

[0070] In the second scenario, the intervention button functions as: pause download, confirm, or cancel. If the user clicks "cancel" in the dialog box, the manager should implement a smooth strategy to resume the download. If the user clicks "confirm," indicating a pause rather than cancellation, the manager should remain static, awaiting further user action. In this case, a pre-set "continue download" button can be displayed on the interface, or the content of an existing button can be changed to a "continue download" button, allowing the user to choose whether to continue the download later.

[0071] If you don't need a pop-up dialog box, you can simply reset the data in the manager and switch the progress bar view to the download view.

[0072] In practical applications, the initial view of the vehicle control app can be determined by the demand graph: either a download view or a progress bar view. With the download view as the initial view, the download will only begin when the user manually clicks "Start Download." During the download, the user can click "Cancel" to stop the download. After stopping, a dialog box and the download view will appear on the interface, allowing the user to click "Download" to restart or continue the download. With the progress bar view as the initial view, the manager will notify the downloader to automatically download the pre-loaded data corresponding to the tasks to be loaded when the vehicle control app starts. During the download, the user can click the "Cancel" button to stop the download. After stopping, a dialog box and the download view will appear on the interface, allowing the user to click the "Download" button to restart or continue the download.

[0073] The manager's member variables include private and public variables. Private variables include: (1) total steps; (2) current steps; (3) step percentage for each sub-loading task; (4) current step percentage; (5) timer; (6) external root view; (7) manager's state; and (8) whether it is stationary. Public variables include: (9) callback block for when the tool's download is complete; and (10) callback block for when the tool's download is canceled.

[0074] (1) Total steps refer to the total number of sub-loading tasks of the task to be loaded, which can be determined based on the number of download tasks in the download graph. One download task corresponds to one sub-loading task. For example, suppose the task to be loaded is to download the vehicle control configuration data (pre-loaded data) corresponding to vehicle 1 under user A's name. The vehicle control configuration data of vehicle 1 includes ① vehicle list; ② detailed information of the vehicle currently used by the user; ③ all remote control configuration items; ④ air conditioning configuration items; ⑤ seat configuration items; ⑥ vehicle reservation items; ⑦ charging items; ⑧ 2D vehicle model. These eight types of vehicle control configuration data mean that the task to be loaded has 8 sub-loading tasks, that is, 8 download tasks, and the total number of steps is 8.

[0075] (2) Current step count refers to the number of sub-loading tasks that the downloader has completed downloading. The initial value of the current step count is 1. Every time the downloader completes a sub-loading task (download task), it will notify the manager. After receiving the notification, the manager calls the private function "update step count" in its member function to update its member variable "current step count".

[0076] (3) The percentage of progress for each sub-loading task, which is the percentage of download progress allocated to each sub-loading task, can be called the sub-step percentage.

[0077] (4) The current step percentage refers to the total download progress of the tasks to be loaded. For example, if the tasks to be loaded include 8 sub-tasks, and the downloader has completed downloading 3 of them (e.g., sub-tasks 1, 2, and 3), then the current step percentage = the step percentage of sub-task 1 + the step percentage of sub-task 2 + the step percentage of sub-task 3. The initial value of the current step percentage is 0.

[0078] (5) A timer is used to implement the smoothing strategy of this application embodiment. Specifically, a timer is created to ensure that during the download process, the progress bar is "fake" moved by the timer, but the distance moved will not exceed the "current step percentage" before the next step is triggered.

[0079] (6) External root view, i.e., the root view of this application embodiment. The three sub-views (header view, download view and progress bar view) of this application embodiment are directly added to this root view. When not in use, they are removed from the root view.

[0080] (7) Manager state, used to indicate the current state of the manager. The specific enumeration value of the state will vary depending on the business requirements. The initial value of the manager state is: Initial.

[0081] In one example, if the demand graph is: (1) Automatic download or manual download by the user: Automatic download - Yes; (2) Can the user intervene during the download process: Yes; (3) Type of intervention button: Cancel this download; (4) Should a confirmation dialog box pop up after the user clicks: Yes; then the manager's status is: Initial, Downloading, Complete.

[0082] In another example, if the demand graph is: (1) Automatic download or manual download by the user: Automatic download - Yes; (2) Can the user intervene during the download process: Yes; (3) Type of intervention button: Pause this download; (4) Should a confirmation dialog box pop up after the user clicks: Yes; then the manager's status is: Initial, Downloading, Paused, Completed.

[0083] (8) Whether to freeze: This is an optional member variable. If the requirement graph is: (Type of intervention button: Cancel this download) + (Does the user need to pop up a confirmation dialog after clicking: No), then this variable is unnecessary. In other words, if the state of freezing the manager and the interface is not needed, this member variable can be omitted.

[0084] (9) The callback block for when the download is complete is for external users. This callback block can be called to notify external users when the task to be loaded is completed. Of course, the data requester and external users can communicate in other ways than just the callback block. In the specific implementation of iOS, notifications, callback blocks, hooks, data sharing, etc., can all be used as communication methods between the two.

[0085] (10) The callback block for canceling the download in this tool is for external users. In this embodiment, when the user chooses to cancel the download, this callback block will be called.

[0086] The manager's member functions include private and public functions. The private functions include: (1) configuring download callbacks; (2) updating steps; (3) handling post-download issues; (4) resetting data; (5) making the interface disappear; (6) displaying the download interface; (7) displaying the progress bar interface; (8) switching interfaces; and (9) completing the download - preview version. The public functions include: (10) starting the download; (11) starting the download - preview version; and (12) pausing the download.

[0087] (1) Configure download callbacks. This function should be called automatically by the manager during initialization. It has two functions: ① Based on the download graph configuration, set the callback logic for each download by the downloader. Under normal processing, the callback logic is "update the number of steps"; for example, the callback logic for interface 1 is: update the current number of steps to = current number of steps + 1; the callback logic for interface 2 is: update the current number of steps to = current number of steps + 1. ② The downloader also has a callback logic for when all downloads are completed. Under normal processing, the callback logic for when all downloads are completed is: call the member function: "Complete Download - Preview".

[0088] (2) Update Steps: The main function of this function is to increment the current step count by 1. Simultaneously, the corresponding current step percentage needs to be updated. Since the download task is processed concurrently by multiple threads, locking is required for the step update operation to ensure data synchronization. Locking is applied upon entering the function and unlocked upon exiting.

[0089] The logic of this function is as follows:

[0090] 1) First, access the member variable "current step count" and get its value;

[0091] 2) Determine if the current step count equals the total step count;

[0092] 3) If the percentage is equal, set the current step percentage to 1, meaning the download percentage is 100%. If it's not equal, calculate the current step percentage as: Current step percentage = "Current number of steps" * Step percentage corresponding to the sub-loading task. Then, set the current number of steps to the current number of steps + 1, but with an upper limit of "Total number of steps" + 1. In other words, the "Current number of steps" should be the minimum of (current number of steps + 1) and ("Total number of steps" + 1).

[0093] (3) Post-download processing: The actual post-download processing includes: 1) Updating the record in the storage location: the service changes from "not downloaded" to "downloaded"; 2) Calling the member function "reset data". This step is not mandatory because a manager is used temporarily; it is used only once and then discarded, thus reducing the complexity of using the technical solution of this application. Of course, the manager in this embodiment of the application can be reused. 3) Processing the interface: calling the member function "make the interface disappear" to make the interface of the caching solution disappear.

[0094] (4) Reset data, reset the values ​​of member variables in the manager, including: reset the current step count to 1; reset the current step percentage to 0; reset the current state to start; stop the timer; clear the callbacks of each download task of the downloader (not required).

[0095] If the manager is not needed for repeated use, it will be destroyed from memory once it has no references. At this time, its associated downloader will also be destroyed, and its callbacks will also need to be destroyed. If the manager is to be reused, it needs to be cleaned up to avoid polluting the next round of download tasks.

[0096] (5) Make the interface disappear. The interface in this embodiment includes, for example, the following: Figure 6 The download view shown and as follows Figure 7 The progress bar view shown.

[0097] (6) Display the download interface, showing the download view (e.g., ... Figure 6 As shown, add it to the "Outer Root View" and set its layout constraint to be the same size as the "Outer Root View".

[0098] (7) Display the progress bar interface, showing the progress bar view (e.g., ... Figure 7 As shown, add it to the "Outer Root View" and set its layout constraint to be the same size as the "Outer Root View".

[0099] (8) Switching interfaces. If switching from the download interface (download view) to the progress bar interface (progress bar view), the download view is removed from the outer root view, and then the member function "Show progress bar interface" is called. If switching from the progress bar interface (progress bar view) to the download interface (download view), the progress bar view is removed from the outer root view, and then the member function "Show in download interface" is called.

[0100] (9) Complete Download - Preview Version. When each download task is completed, the downloader will send a callback notification to the manager, which will then call the member function "Update Steps" and move the progress bar on the download interface. When all pending tasks have been downloaded, the downloader will notify the manager, which will then call the member function "Complete Download - Preview Version" to organize the data and interface.

[0101] The downloader notifies you that the download is complete, so entering this function means the actual download is finished. This function doesn't perform the actual cleanup work after the download is complete; it still needs to determine, based on various conditions, whether to perform cleanup or maintain the status quo. The actual cleanup work is performed by the member function "Cleanup Processing".

[0102] The processing logic for completing the download is as follows:

[0103] 1) Determine if the cached data has already been downloaded. Retrieve the record from the storage location. If the value has been updated to "downloaded", proceed to step 2); otherwise, exit.

[0104] 2) Check if the member variable "Is it still?" is true. If "Is it still?" is true, it means the manager is currently paused. This could be because the user is still on the dialog box, or because the user has chosen to pause the download. In this case, do nothing, maintain the status quo, and exit. If "Is it still?" is false, proceed to step 3).

[0105] 3) Optionally, a prompt may appear for the user. This could be a "Download successful" message displayed on the current screen, or a dialog box, etc., in any form.

[0106] 4) The download is now complete. The member function "Clean-up" is called to begin the actual download completion work, such as setting data and closing the interface.

[0107] 5) Call the callback block indicating that the download is complete. Notify external users that the download is finished and they can proceed with their own business logic.

[0108] (10) Start downloading. Function parameter: an external view. This external view is the top-level view of the application (such as a car control APP), and can be used as the root view of the application. It is stored in the member variable "external root view".

[0109] Its execution logic is as follows:

[0110] 1) Display the initial interface: Based on the requirements graph, select the initial page to display. Taking the download view as the initial page as an example, the manager calls the member function "Display Download Interface" to display, as shown below. Figure 6 The download interface (download view) shown.

[0111] 2) Prepare data: Set the member variable "Current step percentage" to 0; call the member function "Start Timer". Once the timer is started, the progress bar on the download interface will move slowly; set the member variable "Manager status" to "Downloading" instead of "Initial"; set the member variable "Still" to "No".

[0112] 3) Instruct the downloader to start downloading: Call the downloader's "Start Download" member function to notify the downloader to begin downloading.

[0113] (11) Start Download - Preview Version is an operation associated with Start Download.

[0114] (12) Pause download is an optional operation.

[0115] Step S302: When the downloader starts downloading preloaded data, start the timer.

[0116] Start a timer, which means start a repeating timer.

[0117] The downloader is used for downloading and data processing. Specifically, the downloader reads the download graph and creates concurrent download queues (roughly equivalent to a thread, but with some differences) based on the download tasks in the graph. Each download queue corresponds to one download task.

[0118] Figure 8 This is a schematic diagram illustrating the interaction between a downloader and a manager, as provided in an embodiment of this application.

[0119] Once all queues have completed their tasks, the system will trigger a callback indicating overall queue completion. The downloader notifies the manager upon completion of each individual task and upon overall task completion. The notification strategy between the downloader and the manager can be implemented in various ways, such as notifications, callback blocks, or mutual holding, and no specific restrictions are specified here.

[0120] In many business scenarios, it is not possible to simply split download tasks into independent interfaces; there must be related interfaces. For example, the 2D car model interface mentioned earlier in "step percentage of each task" depends on the data provided by the current vehicle interface. That is, the order of the download task is: current vehicle interface -> 2D car model interface.

[0121] After obtaining data from an interface, you may need to perform some special operations on this data according to business requirements, such as updating the cache, updating data in certain storage pools, or making some settings.

[0122] Before downloading, it is necessary to clarify the configuration of each download task so that the downloader understands what it needs to do in addition to the download interface. This information can be placed in the download graph as a subgraph of the cache graph.

[0123] For each interface's data (partial or full data), an "interface cache ID" can be assigned and the corresponding data stored for later direct retrieval and use, thus eliminating the need to request the interface again or reducing the frequency of interface requests.

[0124] The downloader's only external API (Application Programming Interface) is "Start Download," which is called by the manager. Therefore, the downloader is completely invisible to the outside world; it belongs only to the manager.

[0125] The specific logical steps for "Start Download" are as follows:

[0126] 1) Based on the download graph configuration, create a download queue for each download task and set a callback when the entire queue is completed.

[0127] 2) In the callback function of each download queue and the callback function when the entire queue is completed, the downloader notifies the manager to facilitate further operations.

[0128] 3) For each download task, the downloader configures the corresponding download task and subsequent operations according to the download graph.

[0129] Step S303: Determine the number of sub-loading tasks that the downloader has currently completed.

[0130] The number of completed steps refers to the "current step count" in the private variable of the manager's member variables.

[0131] Step S304: If the number of completed steps is less than the preset upper limit, then obtain the current percentage of progress of the progress bar used to indicate the download progress of the downloader downloading preloaded data.

[0132] The preset step limit is generally set to the total steps + 1. For example, if the total steps are 8, the preset step limit can be set to 9.

[0133] When the current step percentage changes, an operation is immediately performed to make the progress bar in the progress bar view draw to the same position as the value. This allows users to intuitively see the actual position of the progress bar on the interface and thus understand the download progress of the task to be loaded.

[0134] If the demand graph includes an intervention configuration item to pause download, and the member variable "Is it still?" is true, then no progress bar drawing operation will be performed, and the process will exit directly. If the demand graph includes an intervention configuration item to pause download, and the member variable "Is it still?" is false, then when the current step percentage changes, an operation will be performed immediately to make the progress bar in the progress bar view draw to the position consistent with the value.

[0135] Step S305: Calculate the pre-step percentage based on the current step percentage and the virtual movement percentage when the timer executes the callback function at a preset time interval.

[0136] The preset time interval can be flexibly set according to the actual situation. Generally, the preset time interval is set to a small fixed value, such as 1 second, 0.5 seconds, etc.

[0137] Step S306: Calculate the percentage of the progress bar moving to the next step.

[0138] As an example, the percentage of the next step can be calculated according to formula (1).

[0139] p next =S cur *p subtask (1);

[0140] In equation (1), p next S indicates the percentage of the next step. cur p represents the current step number. subtask This represents the percentage of progress for each sub-loading task (also known as the sub-step percentage).

[0141] In one example, a percentage of download progress can be allocated to each sub-task of the task to be loaded using an even distribution method. For example, if the task to be loaded includes 8 sub-tasks, i.e., a total of 8 steps, then the percentage of progress for each sub-task is 1 / 8 (i.e., 0.125).

[0142] In another example, an uneven distribution can be used to allocate a percentage of download progress to each sub-task of the task to be loaded. For example, taking a vehicle control app as the data requester and the task to be loaded as downloading all vehicle control configuration data for vehicle 1 as an example, the task to be loaded includes 8 sub-tasks: ① Vehicle list; ② Detailed information of the vehicle currently used by the user; ③ All remote control configuration items; ④ Air conditioning configuration items; ⑤ Seat configuration items; ⑥ Vehicle preparation reservation items; ⑦ Charging items; ⑧ 2D car model. These 8 sub-tasks, i.e., a total of 8 steps, are used. The 2D car model data interface depends on the current vehicle data. First, the current vehicle interface data needs to be downloaded to obtain the vehicle's unique identifier. Then, based on the unique identifier, the 2D car model data interface is requested to obtain the specific vehicle image data. Because of this strong correlation, the current vehicle interface and the 2D car model data interface can be combined into one download task. This download task will inevitably take more time than the download tasks of the other single interfaces. Therefore, the allocation of the step percentage for each sub-task is as follows:

[0143] ① Vehicle list: 1 / 8 (0.125) increment; ② Current vehicle + 2D car model: 2 / 8 (0.25) increment; ③ All remote control configuration items: 1 / 8 (0.125) increment; ④ Air conditioning configuration items: 1 / 8 (0.125) increment; ⑤ Seat configuration items: 1 / 8 (0.125) increment; ⑥ Vehicle preparation reservation items: 1 / 8 (0.125) increment; ⑦ Charging items: 1 / 8 (0.125) increment.

[0144] Step S307: If the prepared step percentage is greater than the next step percentage, update the current step percentage to the prepared step percentage and refresh the progress bar.

[0145] Existing progress bar methods primarily rely on animation, and the drawing of progress bars is quite complex, placing high demands on application performance. To address this technical issue, this application proposes an improved progress bar view refresh scheme, including the following steps: 1) Add a private member variable "shapelayer" and an external member variable "externally desired progress" (i.e., current step percentage) to the progress bar view, with a value range of 0-1 and a default value of 0. 2) Override the system function layoutSubviews for the progress bar view. (a) In the function, determine if the shapelayer exists. If it is empty, it indicates that this is the first drawing, so begin the first drawing steps, i.e., steps (b)-(c); otherwise, skip to step (d). (b) Draw the progress bar and related controls such as text according to the UI design. The shape of the progress bar is arbitrary; for example, it can be a circle or other shapes, using only iOS's conventional drawing methods. (c) After drawing the shape, set its strokeEnd property to "externally desired progress," thus completing the initial drawing. (d) Set its strokeEnd property to "the desired progress level". 3) Whenever a value is assigned to the progress bar view's member variable "the desired progress level", the progress bar view's own system method is synchronously called: setNeedsLayout() or layoutIfNeeded(). Both can be called, or one can be chosen to be called. After these two functions are called, the system will automatically call the layoutSubviews method, thus realizing the progress bar drawing.

[0146] The improved progress bar view refresh scheme provided in this application embodiment does not involve any animation, and the progress bar is drawn in a very simple way. It can be drawn by simply using the "current step percentage" member variable of the manager in this scheme, which greatly improves the performance of the application.

[0147] Step S308: Display the refreshed progress bar.

[0148] The technical solution provided in this application embodiment, during the download process, utilizes a timer to execute a callback function at preset time intervals to perform some "fake movements" that do not affect the actual progress of the progress bar. This allows the progress bar to smoothly display the download progress of the task to be loaded based on the actual loading situation, thereby improving the user experience.

[0149] In some embodiments, before calculating the pre-step percentage based on the current step percentage and the virtual movement percentage when the timer executes the callback function at preset time intervals, the method further includes:

[0150] Determine the sub-step percentage for each sub-loading task;

[0151] Generate a first random number, and determine the first initial movement percentage based on the sub-step percentage and the first random number;

[0152] When the callback function is executed each time the timer reaches the interval, the first remaining percentage of progress bar movement is calculated and recorded after the progress bar has moved the first initial percentage of movement.

[0153] When the step count is updated, if the first remaining percentage of movement is negative, the first random number is adjusted to obtain a second random number, where the first random number is greater than the second random number.

[0154] The virtual movement percentage is determined based on the sub-step percentage and the second random number.

[0155] As an example, suppose the task to be loaded is to download the vehicle control configuration data of vehicle 1 under user A's name. This task includes 8 sub-tasks: ① Vehicle list; ② Detailed information of the user's currently used vehicle; ③ All remote control configuration items; ④ Air conditioning configuration items; ⑤ Seat configuration items; ⑥ Vehicle preparation reservation items; ⑦ Charging items; ⑧ 2D car model. If the download progress percentage is allocated to each sub-task of the task to be loaded in an even distribution, then the sub-step percentage for each sub-task of the task to be loaded is 1 / 8 (i.e., 0.125).

[0156] The first initial movement percentage can be calculated according to formula (2).

[0157]

[0158] In equation (2), p move_1 p represents the initial movement percentage. subtask This represents the sub-step percentage for each sub-loading task, and m1 represents the first random number.

[0159] As an example, suppose the first random number m1 is 3, and the sub-step percentage p of each sub-loading task... subtask If the value is 1 / 8 (i.e. 0.125), then according to the above formula (2), the first initial movement percentage when the timer executes the callback function each time the time interval is reached is 1 / 24.

[0160] If the preset time interval is 1 second, then when the timer executes the callback function at the 1st second, the progress bar has moved an initial percentage of 1 / 24, and the remaining percentage is 1 / 8 - 1 / 24 = 2 / 24. When the timer executes the callback function at the 2nd second, the progress bar has moved an initial percentage of 2 / 24, and the remaining percentage is 1 / 8 - 2 / 24 = 1 / 24. When the timer executes the callback function at the 3rd second, the progress bar has moved an initial percentage of 3 / 24, and the remaining percentage is 1 / 8 - 3 / 24 = 0. When the timer executes the callback function at the 4th second, the progress bar has moved an initial percentage of 4 / 24, and the remaining percentage is 1 / 8 - 4 / 24 = -1 / 24. At this point, the "Update Steps" member function has not yet been called.

[0161] Afterwards, the manager's member function "Update Steps" is called, triggering the update step count and calculating the first remaining percentage of movement after the progress bar has accumulated the first initial movement percentage. In the example above, when the timer executes the callback function at the 4th second, the calculated first remaining percentage of movement is -1 / 24, which is negative. This indicates that the timer moves too far each time it executes the callback function, and in this case, the first random number m1 needs to be increased. Increasing the first random number m1 can be done in ways including, but not limited to, m2 = m1 + 1, or... etc.; where k is a random number less than 1, and m1 < m2.

[0162] It is worth noting that the degree to which the first random number m1 is reduced is related to the absolute value of the first remaining moving percentage. The larger the absolute value of the first remaining moving percentage, the larger the first random number m1 is; the smaller the absolute value of the first remaining moving percentage, the smaller the first random number m1 is.

[0163] The strategy of increasing the first random number m1 is influenced by the absolute value of the first remaining movement percentage after the timer executes the callback function when the manager calls the member function "update steps". The specific implementation is not limited, for example: m1 - = (Absolute value of the first remaining movement percentage + random number) / First initial movement percentage. m1 - This indicates that the first random number m1 is increased.

[0164] In some embodiments, determining the virtual movement percentage based on the sub-step percentage and a second random number includes:

[0165] The second initial movement percentage is determined based on the sub-step percentage and the second random number;

[0166] When the callback function is executed each time the timer reaches the interval, the second remaining percentage of progress bar movement is calculated and recorded after the progress bar has moved the second initial percentage of movement.

[0167] When the step update is triggered, if the second remaining movement percentage is positive, the second initial movement percentage is determined as the virtual movement percentage.

[0168] Specifically, the determination of the second initial moving percentage and the second remaining moving percentage can refer to the method for determining the first initial moving percentage and the first remaining moving percentage in the above embodiments, and will not be repeated here.

[0169] If the calculated and recorded second remaining percentage of the progress bar after the second initial percentage of movement is positive when the callback function is executed each time the timer reaches the time interval, then the second initial percentage of movement is determined as the virtual percentage of movement.

[0170] In some embodiments, determining the second initial movement percentage as a virtual movement percentage includes:

[0171] Determine whether the second remaining percentage of movement is greater than a preset percentage threshold;

[0172] If the second remaining percentage of movement is greater than the preset percentage threshold, the second random number is adjusted to obtain a third random number, wherein the third random number is greater than the second random number and less than the first random number;

[0173] The third initial move percentage is determined based on the sub-step percentage and the third random number;

[0174] When the callback function is executed each time the timer reaches the interval, the third remaining percentage of the progress bar after the third initial percentage of movement is calculated and recorded.

[0175] When the update step count is triggered, if the third remaining movement percentage is positive and less than the preset percentage threshold, the third initial movement percentage is determined as the virtual movement percentage.

[0176] The preset percentage threshold can be flexibly set according to the actual situation. For example, the preset percentage threshold can be set to 50% of the step percentage of each sub-loading task. For instance, if the step percentage of each sub-loading task is 1 / 8, then the preset percentage threshold can be set to 1 / 16.

[0177] As an example, if the manager calculates a second remaining movement percentage greater than 0 (i.e., a positive number) when calling the member function "Update Steps," it then checks whether the second remaining movement percentage is greater than a preset percentage threshold. If the second remaining movement percentage is greater than the preset percentage threshold, it means that the second remaining movement percentage is too large, and the progress bar's step movement effect is not smooth. In this case, the second random number can be appropriately reduced to obtain a third random number, where the third random number is greater than the first random number and less than the second random number.

[0178] The method for decreasing the second random number is similar to the method for increasing the first random number, and will not be repeated here.

[0179] The methods for determining the third initial moving percentage and the third remaining moving percentage can refer to the methods for determining the first initial moving percentage and the first remaining moving percentage in the above embodiments, and will not be repeated here.

[0180] By using the above method, the virtual percentage of timer movement when executing the callback function at each preset time interval can be flexibly adjusted, so that the progress bar can smoothly display the download progress of the task to be loaded according to the actual loading situation, thereby improving the user experience.

[0181] In some implementations, an average random number can be obtained by running the application once or multiple times, and then fixed in the application. When used later, the average random number can be directly called to calculate the virtual percentage of progress bar movement.

[0182] In other embodiments, before the virtual movement percentage based on the current step percentage and the timer executing the callback function at preset time intervals, the method further includes:

[0183] Determine the execution time interval between the current sub-download task and the next sub-download task. The execution time interval is the average time interval, maximum time interval, or minimum time interval between the current sub-download task and the next sub-download task.

[0184] Determine the preset time interval based on the running time interval;

[0185] Based on the sub-step percentage and preset time interval corresponding to each sub-loading task, determine the virtual movement percentage when the timer executes the callback function at the preset time interval.

[0186] As an example, please refer to Figure 9In the example where the vehicle control app downloads vehicle control configuration data corresponding to the task to be loaded from a data provider (such as a server), since 7 out of the 8 sub-loading tasks are data interfaces and only 1 sub-loading task (2D car model) is a resource interface, these data interfaces and resource interfaces are basically executed in parallel to save user download time. That is, most interfaces will be sent at the same time and return at approximately the same time. Therefore, the time interval between sub-loading task 0 and sub-loading task 1 is the most accurate, and subsequent intervals can be ignored.

[0187] Please see Figure 10 Assuming the sub-step percentage of the current sub-download task is denoted as step 1, and the sub-step percentage of the next sub-download task is denoted as step 2, the running time interval can be calculated and recorded after multiple trial runs of the application (such as a vehicle control APP), with the average time interval, maximum time interval, or minimum time interval between step 1 and step 2 being recorded.

[0188] For example, suppose the application (such as a vehicle control APP) is run w times. The average time interval between sub-loading task 0 and sub-loading task 1 during these w runs is calculated. The mathematical expression for the average time interval is as follows (3):

[0189]

[0190] In equation (3), t1 represents the average time interval between sub-loading task 0 and sub-loading task 1 during w trial runs; w represents the total number of application trial runs; t1 represents the time interval between sub-loading task 0 and sub-loading task 1 during the first trial run; t2 represents the time interval between sub-loading task 0 and sub-loading task 1 during the second trial run; t w This represents the time interval between sub-loading task 0 and sub-loading task 1 during the w-th trial run.

[0191] In some embodiments, determining a preset time interval based on a running time interval includes:

[0192] If the running time interval is less than or equal to the preset minimum interval unit, then the running time interval is set as the preset time interval;

[0193] If the running time interval is greater than the preset minimum interval unit, then the preset minimum interval unit will be set as the preset time interval.

[0194] The preset minimum interval unit can be set to a minimum time unit that is visible and acceptable to the user, such as 1 second, 0.5 seconds, etc.

[0195] For ease of understanding, let's continue with the example above, assuming the preset minimum interval unit is 1 second, and the running time interval is the average time interval between sub-loading task 0 and sub-loading task 1 in w trial runs. if If the time interval is set to the preset time interval, then the running time interval is determined to be 1 second. if If the minimum interval unit is 1 second, then the preset time interval is set as the preset time interval.

[0196] In some embodiments, determining the virtual movement percentage when the timer executes the callback function at the preset time interval, based on the sub-step percentage corresponding to each sub-loading task and the preset time interval, includes:

[0197] Determine the number of times the timer executes the callback function at preset time intervals during the execution of a sub-download task by the downloader;

[0198] Calculate the virtual movement percentage when the timer executes the callback function at preset time intervals, based on the sub-step percentage and the number of executions.

[0199] To make it easier to understand, let's continue with the example above. If the preset time interval is... Therefore, the timer executes the callback function once during the step from step 1 to step 2. If the preset time interval is the preset minimum interval unit, then the timer executes the callback function once during the step from step 1 to step 2. Where Int() is the floor function, t min This indicates the preset minimum interval unit.

[0200] Next, the virtual movement percentage is calculated based on the sub-step percentage of each sub-task of the task to be loaded and the number of times the callback function is executed in one step by the timer.

[0201] As an example, the virtual movement percentage can be calculated according to equation (4).

[0202]

[0203] In equation (4), p fic This represents the virtual movement percentage that the timer moves each time a callback function is executed during a download task (also known as a sub-load task) performed by the downloader; p subtask E represents the percentage of sub-steps for each sub-task of the task to be loaded; fre This indicates the number of times the timer executes the callback function during a download task performed by the downloader.

[0204] It's important to note that because the sub-loading task is processed concurrently by multiple threads, the timer needs to acquire a lock when executing the callback function to ensure data synchronization. The lock is acquired upon entering the callback function and unlocked upon exiting it.

[0205] The approach of this application embodiment to achieve smooth progress bar movement using a timer is as follows: create a repeatedly executed timer to ensure that during the download process, the progress bar is constantly being moved "fake" by the timer, but the distance moved will never exceed the "current step percentage" before the next step is triggered.

[0206] For example, if the current step percentage between step 1 and step 2 is 1 / 8, then the timer will not move more than 1 / 8 of the distance between step 1 and step 2. After the next step is triggered, the timer will continue moving from the position of the next step. For example, if the timer was originally at 1 / 12, and now the next step is triggered, the progress bar will immediately move to 1 / 8, and then the timer will continue moving from 1 / 8, but will not exceed 2 / 8.

[0207] By using the above methods, the smoothness of the progress bar movement can be ensured, giving users the visual impression that the progress bar moves at a constant speed from one step to the next, without being too abrupt in the visual effect, thereby improving the user experience.

[0208] In some embodiments, after calculating the next percentage progress of the progress bar, the method further includes:

[0209] If the planned step percentage is less than or equal to the next step percentage, the current step percentage remains unchanged until the step update is triggered, then the current step percentage is updated to the next step percentage, and the progress bar is refreshed.

[0210] If the planned step percentage is less than or equal to the next step percentage, then update the current step percentage to the next step percentage and refresh the progress bar.

[0211] If the pre-step percentage is less than or equal to the next step percentage, the virtual movement percentage is reduced to obtain the updated virtual movement percentage; the updated pre-step percentage is calculated based on the current step percentage and the updated virtual movement percentage; the current step percentage is updated to the updated pre-step percentage, and the progress bar is refreshed.

[0212] The preparatory step percentage can be calculated according to formula (5).

[0213] p pre =p cur +p fic (5);

[0214] In equation (5), p pre p indicates the percentage of the preparatory step;cur This indicates the current percentage of the progress bar; p fic This represents the virtual percentage of movement that the timer makes each time the callback function is executed.

[0215] If the pre-step percentage p pre Greater than the percentage p for the next step next Then the current percentage of the progress bar p cur Assign the value as the pre-step percentage p pre And refresh the progress bar.

[0216] If the pre-step percentage p pre Less than or equal to the next percentage p next This indicates that the timer will exceed the specified step range when executing the callback function this time, meaning it is very close to the edge of the range. The manager will soon call the member function "update steps". The progress bar will not remain still. Therefore, the timer can skip executing the callback function this time, that is, keep the current step percentage unchanged until the manager calls the member function "update steps" (triggering the update step), update the current step percentage to the next step percentage, and refresh the progress bar.

[0217] If the pre-step percentage p pre Less than or equal to the next percentage p next This indicates that the timer's callback function execution exceeded the specified step range, meaning it was very close to the edge of the range. It can wait at the edge, update the current step percentage to the next step percentage, and refresh the progress bar. This strategy won't cause too much inconvenience to the user because the member function "update steps" will be called soon, and the progress bar won't remain static.

[0218] If the pre-step percentage p pre Less than or equal to the next percentage p next This indicates that the timer's execution of the callback function exceeds the specified step range. Therefore, the virtual movement percentage during callback function execution can be reduced to make the download interface move more dynamically, thereby improving the user's download experience. Specifically, the virtual movement percentage can be reduced to obtain an updated virtual movement percentage; based on the current step percentage and the updated virtual movement percentage, an updated pre-step percentage is calculated; the current step percentage is updated to the updated pre-step percentage, and the progress bar is refreshed. The method for reducing the virtual movement percentage can be dividing or subtracting a random number, etc., and this embodiment does not impose specific limitations on this.

[0219] Using the above method, when the preparatory step percentage is greater than the next step percentage, the current step percentage of the progress bar is assigned to the preparatory step percentage, and the progress bar is refreshed; when the preparatory step percentage is less than or equal to the next step percentage, the progress bar can be displayed smoothly according to the actual loading situation by stopping and waiting in place, waiting at the edge, or reducing the virtual movement percentage when the timer executes the callback function, thereby improving the user's download experience.

[0220] In some embodiments, the method further includes:

[0221] When a user triggers a pause download operation, the current download interface state is set to a static state, and the timer is turned off;

[0222] When a user triggers a "continue download" request, determine whether all pending tasks have been downloaded.

[0223] If all pending tasks have been downloaded, a preset virtual paused download interface will be displayed on the current download screen.

[0224] If the task to be loaded has not been fully downloaded, and the interfaces of the sub-tasks of the task to be loaded are all one-time data interfaces, then wait for the one-time data interface to finish downloading the currently downloading sub-task, and restart the timer.

[0225] When the timer executes the callback function, record the download time from when the user triggers the continue download operation to when the one-time data interface completes the download of the pending task;

[0226] If the download time is less than the preset time threshold, adjust the preset time interval of the timer and the number of times the callback function is executed;

[0227] Starting from the time when the user triggers the continue download operation, record the cumulative time for the timer to execute the callback function according to the adjusted preset time interval and number of executions;

[0228] If the accumulated time reaches the preset time threshold, the current step percentage will be set to 1 and the timer will be turned off.

[0229] As an example, if a user wants to pause the download while downloading the preloaded data corresponding to the task to be loaded, they can trigger the pause operation by selecting the preset "Pause Download" button on the current download interface. When the manager detects the pause operation triggered by the user, it sets the member variable "Is it still" to true. At this time, the interface state of the current download interface is set to still state, and the timer is turned off.

[0230] If the download pause was triggered by a user confirmation dialog box, then a confirmation dialog box needs to be displayed on the current download screen. If the pause was triggered by the user selecting to pause the download, then a confirmation dialog box is not necessary.

[0231] If a user wants to continue downloading the pre-loaded data for a pending task, they can trigger the download to continue by selecting the "Continue Download" button preset on the current download screen. When the manager detects this user-triggered request, it sets the member variable "Still" to false and then checks whether all pending tasks have been downloaded completely.

[0232] In the first scenario, if all pending download tasks have already been completed when a user triggers a "continue download" action, a pre-defined virtual paused download interface can be displayed on the current download screen to improve the user's download experience. Then, the member function "complete download" is executed. This virtual paused download interface is a fake, temporary download screen.

[0233] As an example, a virtual pause download interface can be set up as follows: 1) Set an animation for y seconds (y is a set value; it shouldn't be too long to avoid making the user wait too slowly, such as 1 second or 2 seconds). The animation's running curve can be constant speed or other speeds. In the animation, set the member variable "Current Step Percentage" from the current pause value to 1. 2) Start a new timer, setting "Current Step Percentage" from the current pause value to 1. For example, set the preset time interval to 1 second, and set the timer to execute the callback function 3 times. The value moved each time the callback function is executed is: (1 - Current Paused Value) / Number of Executions.

[0234] In the second scenario, when a user triggers a continued download operation, if the task to be loaded has not been fully downloaded and all of its sub-tasks are one-time data interfaces (meaning the interfaces of the task to be loaded consist of one-time data interfaces), then we can wait for the interfaces to finish downloading. Meanwhile, to improve the user's download experience, we can call the member function "Start Timer" to restart the timer.

[0235] After restarting the timer, record the download time from when the user triggers the resume download operation to when the one-time data interface completes the download of the task to be loaded. If this download time is less than a preset time threshold (which can be flexibly set according to actual needs, for example, 1 second), then the virtual movement percentage when the timer executes the callback function each time needs to be reduced, and the number of times the timer executes the callback function needs to be increased. Use an additional variable to prevent the member function "Update Steps" from setting the "Current Step Percentage" to 1; the step of setting the "Current Step Percentage" to 1 should be performed within the timer.

[0236] If the timer accumulates enough time (e.g., 1 second) to execute the callback function according to the adjusted preset time interval and execution count to reach the preset time threshold, the "Current Step Percentage" is set to 1, and the timer is turned off. Afterward, the manager executes the member function "Complete Download". This makes the progress bar's progress display smoother.

[0237] If the download time exceeds the preset time threshold, the timer can be left running, and the process can wait for the interface to finish downloading before the manager executes the member function "Complete Download".

[0238] When the download interface is static, the member variable "Status: Static" is true. While the download interface is static, the downloader is downloading data silently and reasonably. However, because this member variable prevents the progress bar from being drawn, the progress bar doesn't move, and the user perceives it as paused. When the user triggers the download to resume, the member variable "Status: Static" is set to false. At this point, it's only necessary to check whether the task to be loaded has actually finished downloading before proceeding.

[0239] All of the above-mentioned optional technical solutions can be combined in any way to form the optional embodiments of this application, and will not be described in detail here.

[0240] The following is an application example of the progress bar display method according to an embodiment of this application.

[0241] Assuming the data requester 101 is a vehicle control app, when the app starts, 1) it first pulls the interface from the data provider 102 (e.g., a server) to obtain a list of vehicles under the user's name. 2) If the number of vehicles in the list is 0, the app redirects to the preset "Please go to the vehicle binding page". 3) If the number of vehicles in the list is greater than 0, it checks whether the cached data has been downloaded; if it has, the app redirects to the "vehicle control page" (e.g., [missing information]). Figure 11 (As shown); if no download has been made, create or reuse a manager, call the manager's "Start Download" method, and pass the top-level view of the current app as a parameter to display the download page (e.g., Figure 6 (As shown).

[0242] To conserve program performance, the manager can be reused to avoid additional state logging. If a user has multiple vehicles, and they've downloaded half of the vehicle pre-loading information for vehicle A and then paused it, while the download for vehicle B hasn't started yet, using a new manager each time they switch vehicles would necessitate saving download status data for both vehicles A and B to immediately update the manager to the corresponding vehicle's state. For performance reasons, a manager can be reused, eliminating the steps of creating, saving, and resetting the manager.

[0243] Establish a mapping between vehicles and managers, with one vehicle corresponding to one manager. Store this mapping in a location such as cache, file, or hard drive. For example, if a user has three vehicles: A, B, and C, establish a mapping between A, B, and C and managers 1, 2, and 3: A -> Manager 1; B -> Manager 2; C -> Manager 3. Here, the vehicles represent a business function, which can be called a business graph.

[0244] 4) For a car's download page, the user can click the download button on the download page. When the manager detects the user's click of the download button, it notifies the downloader to start the download.

[0245] 5) During the download process, users can click the pause button on the download page to determine whether a dialog box should pop up based on the demand map.

[0246] 6) Once the download is complete, the manager can automatically disappear the download interface, or require the user to click to make the interface disappear. External users will be notified, and they can then continue with their existing business logic.

[0247] Steps 4) through 6) above are all included in the manager. External users only need to check whether the cached data has been downloaded to use it. This is one usage provided to external callers.

[0248] Steps 1) through 3) above can also be included in the manager, which is what its member function "Start Download - Preview" does. This provides a simpler usage for external callers.

[0249] The manager's member function "Start Download - Preview Version" reads the "Business Graph" in the graph to determine whether the current business needs to access the preloaded data function.

[0250] Through the above steps, the download view and progress bar view of this application embodiment can be displayed and switched, and the download view and progress bar view can be seamlessly integrated into the existing page without polluting the original code, and can be displayed and hidden at any time.

[0251] In this embodiment, the interface data (preloaded data) downloaded in the above steps is stored in a cache space, and a cache ID is assigned to each interface data. When a certain interface data needs to be used, the corresponding interface data can be retrieved from the cache space based on the cache ID. When it is necessary to update the interface data in the cache, the interface data in the cache space can be updated synchronously based on the cache ID.

[0252] Because the cache ID of an interface is a key variable, and its corresponding value is the cached data (interface data), it may be a custom structure, and the data structure of each interface is different.

[0253] All or partial data from the interfaces obtained from all download tasks are stored separately, organized by "interface node". For example, if a download task includes the current vehicle interface and the subsequent 2D car model interface, it would be stored as follows: Current Vehicle Interface ID: Actual data of the current vehicle interface. 2D Car Model Interface ID: Actual data of the 2D car model interface. Note that depending on business requirements, some or all of this data may be stored. Additionally, it is necessary to store whether a certain business has already downloaded pre-loaded data. For example, a certain business ID: Whether pre-downloaded data has been performed.

[0254] Based on this, this application proposes a caching method for cached data. Specifically, a variable is used to manage the key-value pair. Updating the cache involves assigning a value to this variable; reading the cache involves directly reading this variable.

[0255] Inside the variable, override the set method, where: retrieve the currently cached binary data; convert the data structure to be cached into binary data; compare the two binary data; if they match, there is no need to write them to the cache; if they do not match, overwrite the old one with the new one.

[0256] Inside the variable, override the get method, where: retrieve the currently cached binary data; convert the binary data into the data structure corresponding to the interface; in this way, the APP can directly use the data entity where the data is used externally without any conversion operations, which is very convenient.

[0257] By using binary data, the differences in data structures between various interfaces are masked when caching, which makes comparison and retrieval more convenient.

[0258] The aforementioned caching mechanism utilizes cache IDs to ensure the cache remains up-to-date (by keeping the cache up-to-date with data and variable changes); by comparing binary data, it reduces the number of disk writes, resulting in good performance and ease of use.

[0259] In this embodiment of the application, the places where the cache is recorded include, but are not limited to, the local sandbox of the APP, memory, cloud storage, and other storage locations.

[0260] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.

[0261] Figure 12 This is a schematic diagram of the structure of a progress bar display device provided in an embodiment of this application. Figure 12 As shown, the progress bar display device includes:

[0262] The notification module 1201 is configured to determine the task to be loaded and notify the downloader to download the preloaded data corresponding to the task to be loaded from the data provider. The task to be loaded includes at least one sub-loading task.

[0263] Module 1202 is configured to start a timer when the downloader begins downloading preloaded data;

[0264] The first determining module 1203 is configured to determine the number of completed sub-loading tasks that the downloader has currently finished downloading;

[0265] The acquisition module 1204 is configured to acquire the current step percentage of the progress bar used to indicate the download progress of the downloader downloading preloaded data if the number of completed steps is less than the preset upper limit of steps.

[0266] The first calculation module 1205 is configured to calculate the pre-step percentage based on the current step percentage and the virtual movement percentage when the timer executes the callback function at a preset time interval.

[0267] The second calculation module 1206 is configured to calculate the percentage of the next step in the progress bar.

[0268] The refresh module 1207 is configured to update the current step percentage to the preparatory step percentage and refresh the progress bar if the preparatory step percentage is greater than the next step percentage.

[0269] Display module 1208 is configured to display the refreshed progress bar.

[0270] In some embodiments, the above-described apparatus further includes:

[0271] The second determining module is configured to determine the sub-step percentage corresponding to each sub-loading task;

[0272] The generation module is configured to generate a first random number and determine a first initial movement percentage based on the sub-step percentage and the first random number.

[0273] The third calculation module is configured to calculate and record the first remaining percentage of progress after the progress bar has moved the first initial percentage of progress each time the timer reaches the time interval and executes the callback function.

[0274] The adjustment module is configured to, when triggering an update step count, adjust the first random number to obtain a second random number if the first remaining movement percentage is negative, wherein the first random number is less than the second random number;

[0275] The third determining module is configured to determine the virtual movement percentage based on the sub-step percentage and the second random number.

[0276] In some embodiments, the third determining module described above includes:

[0277] The first determining unit is configured to determine the second initial movement percentage based on the sub-step percentage and the second random number;

[0278] The calculation unit is configured to calculate and record the second remaining percentage of progress bar movement after the progress bar has accumulated the second initial percentage of movement, each time the callback function is executed when the timer reaches the time interval;

[0279] The second determining unit is configured to determine the second initial movement percentage as a virtual movement percentage if the second remaining movement percentage is positive when the step update is triggered.

[0280] In some embodiments, the second determining unit described above includes:

[0281] The judgment component is configured to determine whether the second remaining percentage of movement is greater than a preset percentage threshold.

[0282] The adjustment component is configured to adjust the second random number to obtain a third random number if the second remaining percentage of movement is greater than a preset percentage threshold, wherein the third random number is greater than the first random number and less than the second random number;

[0283] The first determining component is configured to determine the third initial movement percentage based on the sub-step percentage and the third random number;

[0284] The calculation component is configured to calculate and record the third remaining percentage of progress after the progress bar has moved the third initial percentage of progress each time the timer reaches the time interval and executes the callback function;

[0285] The second determining component is configured to, when triggering an update step count, determine the third initial movement percentage as a virtual movement percentage if the third remaining movement percentage is positive and less than a preset percentage threshold.

[0286] In some embodiments, the above-described apparatus further includes:

[0287] The fourth determining module is configured to determine the running time interval between the current sub-download task and the next sub-download task. The running time interval is the average time interval, the maximum time interval, or the minimum time interval between the current sub-download task and the next sub-download task.

[0288] The fifth determining module is configured to determine a preset time interval based on the running time interval;

[0289] The sixth determining module is configured to determine the virtual movement percentage when the timer executes the callback function at the preset time interval, based on the sub-step percentage corresponding to each sub-loading task and the preset time interval.

[0290] In some embodiments, the fifth determining module described above includes:

[0291] The first time interval determination unit is configured to determine the running time interval as the preset time interval if the running time interval is less than or equal to the preset minimum interval unit.

[0292] The second time interval determination unit is configured to determine the preset minimum interval unit as the preset time interval if the running time interval is greater than the preset minimum interval unit.

[0293] In some embodiments, the sixth determining module described above includes:

[0294] The number of executions determination unit is configured to determine the number of times the timer executes the callback function at preset time intervals during the execution of a sub-download task by the downloader;

[0295] The percentage calculation unit is configured to calculate the virtual movement percentage when the timer executes the callback function at preset time intervals, based on the sub-step percentage and the number of executions.

[0296] In some embodiments, the above-described apparatus further includes:

[0297] The maintenance module is configured to maintain the current step percentage until an update step is triggered if the prepared step percentage is less than or equal to the next step percentage, update the current step percentage to the next step percentage, and refresh the progress bar.

[0298] The first update module is configured to update the current step percentage to the next step percentage and refresh the progress bar if the prepared step percentage is less than or equal to the next step percentage.

[0299] The second update module is configured to reduce the virtual movement percentage to obtain the updated virtual movement percentage if the prepared step percentage is less than or equal to the next step percentage; calculate the updated prepared step percentage based on the current step percentage and the updated virtual movement percentage; update the current step percentage to the updated prepared step percentage and refresh the progress bar.

[0300] In some embodiments, the above-described apparatus further includes:

[0301] The first shutdown module is configured to set the current download interface to a static state and shut down the timer when it receives a user-triggered pause download operation.

[0302] The judgment module is configured to determine whether all tasks to be loaded have been downloaded completely when a user triggers a continue download operation.

[0303] The pause module is configured to display a preset virtual pause download interface on the current download screen if all tasks to be loaded have been downloaded.

[0304] The waiting-to-download module is configured to wait for the one-time data interface to finish downloading the currently downloading sub-load task if the task to be loaded has not been fully downloaded and the interfaces of the sub-load tasks of the task to be loaded are all one-time data interfaces, and then restart the timer.

[0305] The first recording module is configured to record the download time from when the user triggers the continue download operation to when the one-time data interface completes the download of the task to be loaded, when the timer executes the callback function;

[0306] The adjustment module is configured to adjust the preset time interval of the timer and the number of times the callback function is executed if the download time is less than a preset time threshold.

[0307] The second recording module is configured to record the cumulative time of the timer executing the callback function according to the adjusted preset time interval and number of executions, starting from the time point when the user triggers the continue download operation;

[0308] The second shutdown module is configured to set the current step percentage to 1 and shut down the timer if the accumulated time reaches a preset time threshold.

[0309] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0310] Figure 13 This is a schematic diagram of the electronic device 13 provided in an embodiment of this application. Figure 13As shown, the electronic device 13 of this embodiment includes: a processor 1301, a memory 1302, and a computer program 1303 stored in the memory 1302 and executable on the processor 1301. When the processor 1301 executes the computer program 1303, it implements the steps in the various method embodiments described above. Alternatively, when the processor 1301 executes the computer program 1303, it implements the functions of each module / unit in the various device embodiments described above.

[0311] Electronic device 13 may be a desktop computer, laptop, handheld computer, cloud server, or other electronic device. Electronic device 13 may include, but is not limited to, processor 1301 and memory 1302. Those skilled in the art will understand that... Figure 13 This is merely an example of electronic device 13 and does not constitute a limitation on electronic device 13. It may include more or fewer components than shown, or different components.

[0312] The processor 1301 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0313] The memory 1302 can be an internal storage unit of the electronic device 13, such as a hard disk or RAM of the electronic device 13. The memory 1302 can also be an external storage device of the electronic device 13, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, FlashCard, etc., equipped on the electronic device 13. The memory 1302 can also include both internal and external storage units of the electronic device 13. The memory 1302 is used to store computer programs and other programs and data required by the electronic device.

[0314] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0315] If integrated modules / units are implemented as software functional units and sold or used as independent products, they can be stored in a readable storage medium (e.g., a computer-readable storage medium). Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program may include computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. A computer-readable storage medium may include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.

[0316] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A method for displaying a progress bar, characterized in that, The application is to a manager, which is deployed on the data request side, and the manager includes a downloader; The method includes: The task to be loaded is determined, and the downloader is notified to download the preloaded data corresponding to the task to be loaded from the data provider. The task to be loaded includes at least one sub-loading task. A timer is started when the downloader begins downloading the preloaded data; Determine the number of sub-loading tasks that the downloader has currently completed downloading; If the number of completed steps is less than the preset upper limit, then obtain the current percentage of progress of the progress bar used to indicate the download progress of the downloader in downloading the preloaded data; Calculate the pre-step percentage based on the current step percentage and the virtual movement percentage when the timer executes the callback function at a preset time interval; Calculate the percentage of the progress bar that has progressed to the next step; If the preparatory step percentage is greater than the next step percentage, then the current step percentage is updated to the preparatory step percentage, and the progress bar is refreshed; Display the refreshed progress bar; Before determining the current step percentage and the virtual movement percentage when the timer executes the callback function at a preset time interval, the method further includes: Determine the running time interval between the current sub-download task and the next sub-download task, wherein the running time interval is the average time interval, the maximum time interval, or the minimum time interval between the current sub-download task and the next sub-download task; Determine the preset time interval based on the stated operating time interval; Based on the sub-step percentage corresponding to each sub-loading task and the preset time interval, determine the virtual movement percentage when the timer executes the callback function according to the preset time interval.

2. The method according to claim 1, characterized in that, Before calculating the pre-step percentage based on the current step percentage and the virtual movement percentage when the timer executes the callback function at a preset time interval, the method further includes: Determine the sub-step percentage corresponding to each of the sub-loading tasks; Generate a first random number, and determine a first initial movement percentage based on the sub-step percentage and the first random number; When the timer executes the callback function each time the time interval is reached, the first remaining percentage of movement of the progress bar after the first initial percentage of movement is accumulated is calculated and recorded; When the step count is updated, if the first remaining percentage of movement is negative, the first random number is adjusted to obtain a second random number, wherein the first random number is less than the second random number. The virtual movement percentage is determined based on the sub-step percentage and the second random number.

3. The method according to claim 2, characterized in that, Determining the virtual movement percentage based on the sub-step percentage and the second random number includes: The second initial movement percentage is determined based on the sub-step percentage and the second random number; When the timer executes the callback function each time the time interval is reached, the second remaining percentage of movement of the progress bar after the second initial percentage of movement is accumulated is calculated and recorded; When the step update is triggered, if the second remaining movement percentage is positive, then the second initial movement percentage is determined as the virtual movement percentage.

4. The method according to claim 3, characterized in that, Determining the second initial movement percentage as the virtual movement percentage includes: Determine whether the second remaining percentage of movement is greater than a preset percentage threshold; If the second remaining percentage of movement is greater than a preset percentage threshold, the second random number is adjusted to obtain a third random number, wherein the third random number is greater than the first random number and less than the second random number; The third initial movement percentage is determined based on the sub-step percentage and the third random number; When the timer executes the callback function each time the time interval is reached, the third remaining percentage of the progress bar after the progress bar has moved the third initial percentage is calculated and recorded. When the step count is updated, if the third remaining movement percentage is positive and less than a preset percentage threshold, then the third initial movement percentage is determined as a virtual movement percentage.

5. The method according to claim 1, characterized in that, Determine a preset time interval based on the aforementioned operating time interval, including: If the running time interval is less than or equal to the preset minimum interval unit, then the running time interval is determined as the preset time interval; If the running time interval is greater than the preset minimum interval unit, then the preset minimum interval unit is determined as the preset time interval.

6. The method according to claim 1 or 5, characterized in that, Based on the sub-step percentage corresponding to each sub-loading task and the preset time interval, determine the virtual movement percentage when the timer executes the callback function according to the preset time interval, including: The number of times the timer executes the callback function at the preset time interval is determined during the execution of a sub-download task by the downloader; Based on the sub-step percentage and the number of executions, calculate the virtual movement percentage when the timer executes the callback function at a preset time interval.

7. The method according to any one of claims 1 to 5, characterized in that, After calculating the percentage of progress of the progress bar, the process also includes: If the preparatory step percentage is less than or equal to the next step percentage, the current step percentage remains unchanged until the step count is updated, the current step percentage is updated to the next step percentage, and the progress bar is refreshed. If the preparatory step percentage is less than or equal to the next step percentage, then the current step percentage is updated to the next step percentage, and the progress bar is refreshed. If the preparatory step percentage is less than or equal to the next step percentage, the virtual movement percentage is reduced to obtain an updated virtual movement percentage; based on the current step percentage and the updated virtual movement percentage, an updated preparatory step percentage is calculated; the current step percentage is updated to the updated preparatory step percentage, and the progress bar is refreshed.

8. The method according to claim 1, characterized in that, The method further includes: When a user triggers a pause download operation, the current download interface state is set to a static state, and the timer is turned off; When a user-triggered "continue download" operation is received, it is determined whether all the tasks to be loaded have been downloaded. If all the tasks to be loaded have been downloaded, a preset virtual pause download interface will be displayed on the current download interface. If the task to be loaded has not been fully downloaded, and the interfaces of the sub-tasks of the task to be loaded are all one-time data interfaces, then wait for the one-time data interface to finish downloading the currently downloading sub-task, and restart the timer. When the timer executes the callback function, the download time from when the user triggers the continue download operation to when the one-time data interface completes the download of the task to be loaded is recorded; If the download time is less than a preset time threshold, then adjust the preset time interval of the timer and the number of times the callback function is executed; Starting from the time point when the user triggers the continue download operation, record the cumulative time of the timer executing the callback function according to the adjusted preset time interval and execution number; If the accumulated time reaches a preset time threshold, the current step percentage is set to 1, and the timer is turned off.

9. A progress bar display device, characterized in that, include: The notification module is configured to determine the task to be loaded and notify the downloader to download the preloaded data corresponding to the task to be loaded from the data provider, wherein the task to be loaded includes at least one sub-loading task; The module is configured to start a timer when the downloader begins downloading the preloaded data; The first determining module is configured to determine the number of sub-loading tasks that the downloader has currently completed downloading; The acquisition module is configured to acquire the current step percentage of the progress bar used to indicate the download progress of the downloader in downloading the preloaded data if the number of completed steps is less than a preset upper limit value; the first calculation module is configured to calculate the pre-step percentage based on the current step percentage and the virtual movement percentage when the timer executes the callback function at a preset time interval. The second calculation module is configured to calculate the percentage of progress made in the next step of the progress bar; The refresh module is configured to update the current step percentage to the preparatory step percentage and refresh the progress bar if the preparatory step percentage is greater than the next step percentage. The display module is configured to show the refreshed progress bar. Before determining the current step percentage and the virtual movement percentage when the timer executes the callback function at a preset time interval, the method further includes: Determine the running time interval between the current sub-download task and the next sub-download task, wherein the running time interval is the average time interval, the maximum time interval, or the minimum time interval between the current sub-download task and the next sub-download task; Determine the preset time interval based on the stated operating time interval; Based on the sub-step percentage corresponding to each sub-loading task and the preset time interval, determine the virtual movement percentage when the timer executes the callback function according to the preset time interval.

Citation Information

Patent Citations

  • Progress bar generation method and device, computer equipment and storage medium

    CN113590007A

  • Method and device for creating progress bar and method for displaying progress bar

    CN114968244A