Progress bar display method and device

By using a timer to execute a callback function during the download process, the progress bar can be virtually moved, solving the problem of stiff progress bar display in existing technologies and improving the user experience.

CN119271326AActive Publication Date: 2025-01-07CHENGDU CELIS TECH CO LTD

Patent Information

Application Number
CN202411276608.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-12
Publication Date
2025-01-07
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, ensuring that the progress bar can smoothly advance according to the actual loading situation.

Benefits of technology

The user experience has been improved, with a smoother progress bar display that accurately reflects the loading process, thus enhancing the user interaction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119271326A_ABST
    Figure CN119271326A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and provides a progress bar display method and device. The method is applied to a manager, the manager is deployed at a data demand end, and the manager comprises a downloader; the method comprises the following steps: starting a timer when starting to download preloaded data; if the completed number of the sub-loading tasks currently completed by the downloader is smaller than a preset step number upper limit value, the current step percentage of a progress bar used for indicating the downloading progress of the preloaded data downloaded by the downloader is obtained; calculating a preliminary stepping percentage according to the current stepping percentage and a virtual movement percentage when the timer executes the callback function according to the preset time interval; calculating the next step percentage of the progress bar; if the preparatory stepping percentage is greater than the next stepping percentage, updating the current stepping percentage as the preparatory stepping percentage, and refreshing the progress bar; and displaying the refreshed progress bar. Smooth stepping of the progress bar is realized by utilizing the timer, so that the use experience of a user is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a progress bar display method and device. Background Art

[0002] In various applications (for example, car control APPs), some application data (such as various configurations of vehicle models) are usually preloaded in order to improve user experience. In order to show the loading progress of the application data, a progress bar is usually used to display it.

[0003] In the related art, the progress bar moves to several preset specific points when the loading progress reaches a preset progress value. However, the progress bar display effect of this display method is very rigid and mechanical, and it cannot display smoothly and step by step according to the actual loading situation, resulting in a poor user experience. Summary of the invention

[0004] In view of this, an embodiment of the present application provides a progress bar display method and device to solve the problem in the prior art that the progress bar display effect is stiff and mechanical, and cannot be displayed smoothly in steps according to the actual loading situation, thereby resulting in a poor user experience.

[0005] In a first aspect of an embodiment of the present application, a progress bar display method is provided, which is applied to a manager, the manager is deployed at a data demand end, and the manager includes a downloader;

[0006] The method includes:

[0007] 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;

[0008] When the downloader starts downloading preloaded data, start the timer;

[0009] Determine the number of completed sub-load tasks that the downloader has currently completed downloading;

[0010] If the completed number is less than the preset step upper limit, the current step percentage of the progress bar for indicating the download progress of the preloaded data by the downloader is obtained;

[0011] Calculate the preparation step percentage according to the current step percentage and the virtual movement percentage when the timer executes the callback function at the preset time interval;

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

[0013] If the pre-step percentage is greater than the next step percentage, the current step percentage is updated to the pre-step percentage and the progress bar is refreshed;

[0014] Displays a progress bar after refreshing.

[0015] According to a second aspect of an embodiment of the present application, a progress bar display device is provided, comprising:

[0016] a notification module configured to determine a task to be loaded, and notify the downloader to download preloaded data corresponding to the task to be loaded from a data provider, wherein the task to be loaded includes at least one sub-loading task;

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

[0018] A first determining module is configured to determine the number of completed 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 preloaded data if the completed number is less than the preset upper limit of the number of steps; the first calculation module is configured to calculate the preliminary step percentage according to the current step percentage and the virtual movement percentage when the timer executes the callback function at the preset time interval;

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

[0021] A refresh module is configured to update the current step percentage to the preliminary step percentage and refresh the progress bar if the preliminary step percentage is greater than the next step percentage;

[0022] The display module is configured to display a refreshed progress bar.

[0023] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.

[0024] According to a fourth aspect of an embodiment of the present application, a readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0025] Compared with the prior art, the beneficial effects of the embodiments of the present application include at least: during the download process, a timer is used to execute a callback function at a preset time interval to perform some "fake movements" that will not affect the actual stepping of the progress bar, so that the progress bar can smoothly step according to the actual loading situation to display the download progress of the task to be loaded, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0027] Figure 1 It is a schematic diagram of an application scenario of an embodiment of the present application;

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

[0029] Figure 3 It is a flowchart of a progress bar display method provided by an embodiment of the present application;

[0030] Figure 4 This is a schematic diagram of the correspondence between a service and a manager provided in an embodiment of the present application;

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

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

[0033] Figure 7 It is a schematic diagram of a progress bar view in the progress bar display method provided in an embodiment of the present application;

[0034] Figure 8 This is a schematic diagram of interaction between a downloader and a manager provided in an embodiment of the present application;

[0035] Fig. 9 It is a concurrent interface diagram in the progress bar display method provided in the embodiment of the present application;

[0036] Fig.10 This is a schematic diagram of a method for displaying a progress bar provided in an embodiment of the present application, which uses a timer to realize smooth stepping of the progress bar;

[0037] Fig.11It is a schematic diagram of a vehicle control page in the progress bar display method provided in an embodiment of the present application;

[0038] Fig.12 is a structural schematic diagram of a progress bar display device provided in an embodiment of the present application;

[0039] Fig.13 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0040] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0041] A progress bar display method and device according to an embodiment of the present application will be described in detail below with reference to the accompanying drawings.

[0042] Figure 1 1 is a schematic diagram of an application scenario of an embodiment of the present application. The application scenario may include a data demand end 101 and a data provider end 102.

[0043] The data demand end 101 (also referred to as the client) can be hardware or software. When the data demand end 101 is hardware, it can be various electronic devices with a display screen that support communication with the data provider 102, including but not limited to smart cars (such as new energy vehicles, etc.), smart phones, tablet computers, laptop portable computers and desktop computers, etc. When the data demand end 101 is software, it can be a client APP (for example, a car control APP, etc.) installed in the above electronic devices.

[0044] The data demand end 101 is deployed with a manager, which includes a downloader. The downloader is in communication connection with the data provider end 102.

[0045] The data provider 102, also known as a service end or a server, may be a single server, a server cluster consisting of several servers, or a cloud computing service center, which is not limited in the embodiments of the present application.

[0046] As an example, the data demand end 101 is a vehicle control APP installed in the above-mentioned electronic device, and the user can download various configuration data related to vehicle control from the data provider 102 (such as a server) through the vehicle control APP. The various configuration data related to vehicle control include: ① vehicle list; ② detailed information of the vehicle currently used by the user; ③ all remote control configuration items; ④ air conditioning configuration items; ⑤ seat configuration items; ⑥ reservation and preparation items; ⑦ charging items; ⑧ 2D car model. Among them, ① vehicle list, including the basic information of all vehicles under the user's name, such as the vehicle name or vehicle code of all vehicles under the user's name. ② detailed information of the vehicle currently used by the user, including but not limited to the vehicle mileage, function configuration and other configuration information of the vehicle currently used by the user. ③ all remote control configuration items, including but not limited to flashing lights, car search, charging port, windows, window ventilation and other configuration items related to vehicle remote control. ④ air conditioning configuration items, including but not limited to air conditioning circulation, defrosting, extreme cooling, extreme heating and other configuration items. ⑤ seat configuration items, including but not limited to seat ventilation, seat heating and other configuration items. ⑥ Scheduled vehicle preparation items, including but not limited to travel time, air conditioning, repeat cycle, air circulation, air purification, defrost, seat ventilation, seat heating, steering wheel heating, etc. ⑦ Charging items, including but not limited to charging upper limit, scheduled charging function on / off, charging period and other configuration items. ⑧2D car model refers to a 2D picture corresponding to the current state of the user's (such as the owner's) vehicle. For example, the left door of the user's vehicle 1 is currently open and the actual color of the vehicle is white. Then, a 2D picture (such as the current state (left door open) of the vehicle 1 (My car 1) and the vehicle color is consistent with the actual color of the vehicle 1 (white) can be displayed synchronously on the homepage of the vehicle control APP. Figure 2 As another example, if the trunk of the user's vehicle 2 is currently open and the actual vehicle color is black, a 2D picture corresponding to the current state of the vehicle 2 (trunk open) and the vehicle color being consistent with the actual vehicle color of the vehicle 2 (black) can be synchronously displayed on the homepage of the vehicle APP.

[0047] In the platform-based car control APP, in order to improve the user experience, it is usually necessary to pre-download some data, such as the above-mentioned various configuration data related to car control. Under normal circumstances, the configurations of different models are different. For example, model A has a sunroof, but model B does not; model A has hot and cold cups, but model B does not. However, the configuration differences of different models are similar. If a car control APP is specially developed for each model, it will consume huge manpower and material resources and the cost is high. Therefore, the car control configuration data of various models can be stored in the data provider 102 (such as a server), and the data provider 102 sends it to the data demander 101 based on the download demand initiated by the data demander 101 (such as a client). In this way, the data demander 101 can decide whether to display certain items, the functional differences of certain items, the logical differences of certain items, etc. according to the downloaded car control configuration data to adapt to the personalized needs of different users.

[0048] It should be noted that the specific types, quantities and combinations of the data demand side 101 and the data provider side 102 can be adjusted according to the actual needs of the application scenario, and the embodiments of the present application do not limit this.

[0049] Figure 3 It is a flowchart of a progress bar display method provided in an embodiment of the present application. Figure 3 The progress bar display method can be Figure 1 The manager of the data demand end 101 is executed. Figure 3 As shown, the progress bar display method may specifically include the following steps:

[0050] Step S301, determining a task to be loaded, and notifying a downloader to download preloaded data corresponding to the task to be loaded from a data provider, wherein the task to be loaded includes at least one sub-loading task.

[0051] The progress bar display method of the embodiment of the present application 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 to download the vehicle control configuration data of a certain vehicle (or vehicles) in the vehicle list under the user's name when the vehicle control APP is started, or the vehicle control configuration data of all vehicles in the vehicle list under the user's name.

[0052] In the embodiment of the present application, downloading the vehicle control configuration data (preloaded data) corresponding to a vehicle can be regarded as a task to be loaded (or a service). For example, if user A has vehicles 1, 2, and 3, then when the vehicle control APP is started, task 1 to be loaded (download the vehicle control configuration data corresponding to vehicle 1), task 2 to be loaded (download the vehicle control configuration data corresponding to vehicle 2), and task 3 to be loaded (download the vehicle control configuration data corresponding to vehicle 3) can be created.

[0053] Figure 4 This is a schematic diagram of the correspondence between a service and a manager provided in an embodiment of the present application.

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

[0055] See also Figure 4 , assuming that there are n businesses (tasks to be loaded), the data demand end 101 can assign a manager (instance) to business 1, business 2, ... business n respectively, and assign values ​​to the download graphs corresponding to each manager to form the graph of the application. Each manager is used to manage its subordinate downloaders and various interfaces related to downloading preloaded data, and control the download logic of preloaded data, the step calculation logic of the progress bar, the display logic, static processing, etc.

[0056] See also Figure 5 The implementation architecture of the progress bar display method may include a manager, and the manager may be deployed in the data demand end 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] The business graph is a configuration file that includes the correspondence between each task to be loaded in the application and the manager.

[0059] The download graph consists of at least one download task. Each download task is composed of an "interface node" as the basic unit. The "interface nodes" are in a tree structure with a clear execution order. The data stored in the "interface node" include: (1) the request information of the interface itself, such as the interface URL, interface type (such as 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 certain data from the data as backup data, decompressing, decrypting, etc.; (3) the information of the "interface nodes" of the upper, lower and sibling levels.

[0060] All interface information of a task to be loaded forms a tree structure. In specific implementation, dictionaries, trees in data structures, graphs, etc. can be used.

[0061] The demand map refers to the configuration items that support various business requirements. These configuration items include but are not limited to: (1) Whether automatic download is supported or the user needs to click manually before downloading. If automatic download is supported, the manager initializes the application page as a progress bar view. If automatic download is not supported, the manager initializes the application page as 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, the progress bar interface does not display the intervention button. (3) The type of intervention button, including canceling the download and pausing the download. Canceling the download means that the download is to be canceled and restarted. Pausing the download means that the download is to be paused instead of 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 or not. If a pop-up is required, the manager needs to store and process the "static" state. If a pop-up is not required, the manager does not need to store and process the "static" state. After the user clicks the intervention button, the corresponding page can be switched and the corresponding data can be operated. (5) After the download is complete, does the manager automatically disappear the download interface, or does it make the download interface disappear after the user clicks on it? If the manager automatically disappears the download interface, no additional action is needed. If the download interface disappears after the user clicks on it, an additional interface or additional buttons may be required, but just adding a few more interface elements will suffice, and the logic is the same.

[0062] The header view is a non-essential view. If the UI (User Interface) design does not include a header view, it can be ignored. For a car control app, if a user has multiple cars and needs to preload the car control configuration data for each car, then a header view needs to be designed. Whenever the user switches cars, the manager corresponding to the car is displayed. The manager manages the display of the current page and the status of the data. When the download is complete, the header view will be removed.

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

[0064] When the downloader downloads the preloaded data corresponding to the task to be loaded, the manager will synchronously change the value of the progress bar view according to the current step percentage value of the task to be loaded.

[0065] According to the demand map in the business map, determine whether the user can intervene in the download process. If the user can intervene in the download process, an intervention button can be displayed on the progress bar view (for example, a "Cancel" button whose function is to cancel the download).

[0066] Optionally, if the user clicks the "Cancel" button, a user confirmation dialog box may be further popped up on the interface of the progress bar view.

[0067] If a user confirmation dialog box needs to be popped up, the manager needs to pause the operation.

[0068] In the first case, the function of the intervention button is: cancel this download, OK-Cancel. If the user clicks "Cancel" in the dialog box, the manager will use a smooth strategy to continue downloading. If the user clicks "OK" in the dialog box, it means that everything is canceled and the download starts over. At this time, the manager will switch the view, that is, hide the progress bar view, display the download view, and reset the manager's data.

[0069] The smoothing strategy is that the embodiment of the present application uses a timer to move a certain distance (virtual movement percentage) on the progress bar when executing a callback function at a preset time interval, so that the progress bar can smoothly step according to the actual download progress of the task to be loaded.

[0070] In the second case, the functions of the intervention button are: pause download, confirm-cancel. If the user clicks "Cancel" in the dialog box, the manager should make a smooth strategy to continue downloading. If the user clicks "OK" in the dialog box, it means that the download is to be paused instead of canceled, so the manager should remain static and wait for the user's subsequent operation. At this time, the preset "Continue Downloading" button can be displayed on the interface, or the content of the existing button on the interface can be changed to the Continue Downloading button, so that the user can choose whether to continue downloading later.

[0071] If a pop-up dialog box is not required, the manager can directly reset the data and switch the progress bar view to the download view.

[0072] In actual applications, the demand map can be used to determine whether the initial view of the car control APP is the download view or the progress bar view. If the download view is used as the initial view, the download will not start until the user manually clicks to start downloading. During the download process, the user can click "Cancel" to stop the download. After stopping, a dialog box + download view can be displayed on the interface, and the user can click Download to restart or continue downloading. With the progress bar view as the initial view, when the car control APP is just started, the manager will notify the downloader to automatically download the preloaded data corresponding to the task to be loaded. During the download process, the user can click the "Cancel" button to stop the download. After stopping, a dialog box + download view will be displayed on the interface, and the user can click the "Download" button to restart or continue downloading.

[0073] The member variables of the manager include private variables and public variables. Among them, private variables include: (1) total number of steps; (2) current number of steps; (3) step percentage of each sub-loading task; (4) current step percentage; (5) timer; (6) external root view; (7) state of the manager; (8) whether it is static. Public variables include: (9) callback block for download completion of this tool; (10) callback block for download cancellation of this tool.

[0074] (1) The total number of steps refers to the total number of sub-loading tasks of the task to be loaded, which can be determined according to the number of download tasks in the download map. 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 the name of user A, where 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; ⑥ reservation and standby items; ⑦ charging items; ⑧ 2D car model, these eight types of vehicle control configuration data, then the task to be loaded has 8 sub-loading tasks, that is, there are 8 download tasks, and the total number of steps is 8.

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

[0076] (3) Step percentage of each sub-loading task: The download progress percentage allocated to each sub-loading task can be called sub-step percentage.

[0077] (4) Current step percentage refers to the total download progress of the task to be loaded. For example, the task to be loaded includes 8 sub-load tasks, and the downloader has downloaded and completed 3 of them, such as sub-load tasks 1, 2, and 3. Then the current step percentage = the step percentage of sub-load task 1 + the step percentage of sub-load task 2 + the step percentage of sub-load task 3. The initial value of the current step percentage is 0.

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

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

[0080] (7) The state of the manager is used to mark the current state of the manager. The specific enumeration value of the state varies according to different business requirements. The initial value of the state of the manager is: initial.

[0081] In one example, if the demand graph is: (1) Automatic download or does the user need to click manually before downloading: Automatic download - Yes; (2) Can the user intervene during the download process: Yes; (3) Type of intervention button: Cancel this download; (4) Whether a confirmation dialog box needs to pop up after the user clicks: Need to pop up; then the status of the manager is: Initial, Downloading, Completed.

[0082] In another example, if the demand graph is: (1) Automatic download or requires user manual click before downloading: Automatic download - Yes; (2) Whether the user can intervene during the download process: Yes; (3) Type of intervention button: Pause this download; (4) Whether a confirmation dialog box needs to pop up after the user clicks: Need to pop up; then the status of the manager is: Initial, Downloading, Pause, Complete.

[0083] (8) Whether to be static. This is an optional member variable. If the requirement map is: (type of intervention button: cancel this download) + (whether a confirmation dialog box needs to pop up after the user clicks: no), then this variable is unnecessary. In other words, if the manager and interface do not need to be static, this member variable can be omitted.

[0084] (9) The callback block of the tool after downloading is completed. This is for external users. When the task to be loaded is downloaded, this callback block can be called to notify the external user. Of course, the data demand side and the external user of the embodiment of the present application communicate in more than one way. 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 of this tool is used by external users. In the embodiment of the present application, when the user chooses to cancel the download, this callback block will be called.

[0086] The member functions of the manager include private functions and public functions. Among them, private functions include: (1) configure download callback; (2) update step number; (3) post-processing; (4) reset data; (5) make the interface disappear; (6) display the download interface; (7) display the progress bar interface; (8) switch interface; (9) complete download - pre-judgment version. Public functions include: (10) start downloading; (11) start downloading - pre-judgment version; (12) pause downloading.

[0087] (1) Configure the download callback. This function should be called by the manager when it is initialized. It has two functions: ① According to the configuration of the download map, set the callback logic of each download of the downloader. Under normal processing, the callback logic is "update the number of steps; for example: the callback logic of interface 1 is: update the current number of steps to = current number of steps + 1; the callback logic of interface 2 is: update the current number of steps to = current number of steps + 1. ② The downloader also has a callback logic for the completion of all downloads. Under normal processing, the callback logic for the completion of all downloads is: call the member function: "Complete download - predicted version".

[0088] (2) Update the number of steps. The main function of this function is to increase the current number of steps by 1. When updating the current number of steps, the corresponding current step percentage needs to be updated. Since the download task is processed by multiple threads concurrently, the operation of updating the number of steps needs to be locked to ensure data synchronization. Lock it when entering the function and unlock it when leaving the function.

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

[0090] 1) First access the member variable "current step number" to get its value;

[0091] 2) Determine whether the current number of steps is equal to the total number of steps;

[0092] 3) If it is equal, set the current step percentage value to 1, that is, the download amount is: 100%; if it is not equal, the current step percentage value is obtained as: current step percentage = "current step number" * step percentage corresponding to the sub-load task. After that, set the current step number to the current step number + 1, but there must be an upper limit, the upper limit is "total step number" + 1. In other words, the "current step number" must take the minimum value of (current step number + 1) and ("total step number" + 1).

[0093] (3) After-processing. The actual after-processing after the download is completed 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 necessary because a manager is used temporarily. After a download, it will not be used again and will not be reused, so as to reduce the complexity of the use of the technical solution of this application. Of course, the manager of the embodiment of this application can support reuse. 3) Processing the interface, calling the member function "make the interface disappear" to make the interface of the cache solution disappear.

[0094] (4) Reset data, reset the values ​​of member variables in the manager, including: resetting the current step number to 1; resetting the current step percentage to 0; resetting the current state to start; stopping the timer; and clearing the callback of each download task of the downloader (optional).

[0095] If the manager does not need to be used repeatedly, it will be destroyed by memory after there is no reference to it. At this time, the downloader it brings will also be destroyed, and its callback will be destroyed even more. If the manager is to be reused, it needs to be cleaned up to avoid contaminating the new round of download tasks.

[0096] (5) Make the interface disappear. The interface of the embodiment of the present application includes: Figure 6 The download view shown and Figure 7 The progress bar view shown.

[0097] (6) Display the download interface and change the download view (such as Figure 6 As shown), add it to the "external root view" and set its layout constraints to be the same size as the "external root view".

[0098] (7) Display the progress bar interface and put the progress bar view (such as Figure 7 As shown), add it to the "external root view" and set its layout constraints to be the same size as the "external root view".

[0099] (8) Switching interfaces. If you switch from the download interface (download view) to the progress bar interface (progress bar view), remove the download view from the external root view and call the member function "Show progress bar interface". If you switch from the progress bar interface (progress bar view) to the download interface (download view), remove the progress bar view from the external root view and call the member function "Show in download interface".

[0100] (9) Complete download - Predicted version. When each download task is completed, the downloader will call back to notify the manager, and the manager will call the member function "Update Steps" and move the progress bar on the download interface. When all the tasks to be loaded are downloaded, the downloader notifies the manager, and the manager will call the member function "Complete Download - Predicted Version" to organize the data and interface.

[0101] The download is completed, which is notified by the downloader. Therefore, entering this function means that the download is actually completed. This function does not perform the actual download completion follow-up work. It also needs to judge based on various conditions whether to follow up or keep the status quo. The actual download completion follow-up work is performed by the member function "Follow-up processing".

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

[0103] 1) Determine whether the cached data has been downloaded. Take out the record at the storage location. If the value is updated to "downloaded", proceed to step 2), otherwise exit.

[0104] 2) Determine whether the member variable "Is it still" is true. If "Is it still" is true, it means that the manager is in a paused state at this moment. This may be because the user is still in the dialog interface, or because the user has chosen to pause the download. At this time, do nothing, keep the status quo, and exit. If "Is it still" is false, proceed to step 3).

[0105] 3) Optionally, a prompt for the user is popped up, such as a prompt of "Download Successful" or a dialog box popped up on the current interface, and the specific form is not limited.

[0106] 4) The download is actually completed. Call the member function "aftermath processing" to start the actual download completion work, such as: setting data, closing the interface, etc.

[0107] 5) Call the callback block of the tool to complete the download. Notify the external user that the download is complete and then proceed with the subsequent business logic.

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

[0109] Its execution logic is as follows:

[0110] 1) Display the initial interface: According to the demand map, select the page to be displayed initially. Taking the initial page as the download view as an example, the manager calls the member function "display download interface" to display the following 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 turned on, the progress bar on the download interface will move slowly; set the member variable "manager status" to: from "initial" to "downloading"; set the member variable "is it stationary" to: no.

[0112] 3) Let the downloader start downloading: call the downloader's "Start Downloading" external member function to notify the downloader to start downloading.

[0113] (11) Start downloading - pre-judgment version, which is an operation associated with starting downloading.

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

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

[0116] Start the timer to start a repeating timer.

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

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

[0119] When all queues are executed, the system will enter the callback of the overall queue completion. The downloader notifies the manager when each task is completed and the overall task is completed. The notification strategy between the downloader and the manager can be implemented in various ways such as notification, callback block, mutual holding, etc., and no specific restrictions are made here.

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

[0121] After obtaining the data from an interface, some special operations need to be performed with this data according to business needs, such as updating the cache, updating the data in certain storage pools, and performing some settings.

[0122] Before downloading, you first need to clarify the configuration of each download task so that the downloader knows what to do in addition to the download interface. These contents can be placed in the download map as a sub-map of the cache map.

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

[0124] The only external API (application programming interface) of the downloader is "Start Downloading", which is called by the manager. Therefore, the downloader is something that is completely invisible to the outside world and belongs only to the manager.

[0125] The specific logical steps of "Start Downloading" are as follows:

[0126] 1) According to the configuration of the download map, create a download queue for each download task and set a callback for the overall queue to be completed.

[0127] 2) In the callback function of each download queue and the callback function of the overall queue, 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 map.

[0129] Step S303, determining the completed number of sub-loading tasks that the downloader has currently completed downloading.

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

[0131] Step S304: if the completed number is less than the preset upper limit of the number of steps, the current step percentage of the progress bar for indicating the download progress of the downloader downloading the preloaded data is obtained.

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

[0133] When the current step percentage changes, an operation is performed immediately to draw the progress bar of the progress bar view to a position consistent with the value, so that the user can intuitively see the actual position of the progress bar on the interface and understand the download progress of the task to be loaded.

[0134] If the demand graph includes an intervention configuration item for pausing downloads, and the member variable "Is it stationary" is true, no progress bar drawing operation is performed and the program exits directly. If the demand graph includes an intervention configuration item for pausing downloads, and the member variable "Is it stationary" is false, when the current step percentage changes, an operation is immediately performed to draw the progress bar of the progress bar view to a position consistent with the value.

[0135] Step S305 , calculating the preliminary step percentage according to 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 actual conditions. Generally, the preset time interval is set to a smaller fixed value, such as 1 second, 0.5 second, etc.

[0137] Step S306, calculating the next step percentage of the progress bar.

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

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

[0140] In formula (1), p next Indicates the next step percentage, S cur Indicates the current step number, p subtask Indicates the step percentage of each sub-loading task (also called sub-step percentage).

[0141] In one example, the percentage of download progress can be allocated to each sub-loading task of the task to be loaded in an even distribution manner. For example, if the task to be loaded includes 8 sub-loading tasks, that is, the total number of steps is 8, then the step percentage of each sub-loading task is 1 / 8 (ie, 0.125).

[0142] In another example, an uneven distribution method can also be used to allocate the percentage of download progress for each sub-loading task of the task to be loaded. For example, taking the data demand end as a vehicle control APP, and the task to be loaded as downloading all vehicle control configuration data of vehicle 1, the task to be loaded includes 8 sub-loading tasks, namely ① vehicle list; ② detailed information of the vehicle currently used by the user; ③ all remote control configuration items; ④ air conditioning configuration items; ⑤ seat configuration items; ⑥ reservation and preparation items; ⑦ charging items; ⑧ 2D car model, these 8 sub-loading tasks, that is, the total number of steps is 8. The 2D car model data interface depends on the data of the current vehicle. First, the current vehicle interface data must be downloaded to obtain the unique identifier of the vehicle, and then the 2D car model data interface is requested based on the unique identifier to obtain specific vehicle image data. Because of this strong correlation, the current vehicle interface and the 2D car model data interface can be used as a download task, then this download task will inevitably take up more time than the download tasks of the other single interfaces, so the distribution of the step percentages of each sub-loading task is as follows:

[0143] ① Vehicle list: the step percentage is 1 / 8 (i.e. 0.125); ② Current vehicle + 2D car model: the step percentage is 2 / 8 (i.e. 0.25); ③ All remote control configuration items: the step percentage is 1 / 8 (i.e. 0.125); ④ Air conditioning configuration items: the step percentage is 1 / 8 (i.e. 0.125); ⑤ Seat configuration items: the step percentage is 1 / 8 (i.e. 0.125); ⑥ Reserved vehicle items: the step percentage is 1 / 8 (i.e. 0.125); ⑦ Charging items: the step percentage is 1 / 8 (i.e. 0.125).

[0144] Step S307: If the preliminary step percentage is greater than the next step percentage, the current step percentage is updated to the preliminary step percentage, and the progress bar is refreshed.

[0145] The existing stepping methods are mainly based on adding animation, and the drawing method of the progress bar is relatively complex, which has high performance requirements for the application. In order to solve this technical problem, the embodiment of the present application proposes an improved progress bar view refresh solution, including the following steps: 1) Add a private member variable "shape layer" (shapelayer) and an external member variable "progress that the outside wants to set" (i.e., the current step percentage) in the progress bar view, with a value range of 0-1 and a default value of 0. 2) Rewrite the system function layoutSubviews of the progress bar view. (a) In the function, determine whether the shape layer exists. If it is empty, it means that this is the first drawing, then start the first drawing steps, that is, steps (b)-(c), otherwise jump to step (d). (b) According to the UI design draft, draw the progress bar and related controls such as text. The shape of the progress bar is arbitrary, for example, it can be a circle or other shapes, and it only needs to use the conventional drawing methods of iOS. (c) After the shape is drawn, set its strokeEnd attribute to "progress that the outside wants to set", and the initialization drawing is completed. (d) Set its strokeEnd property to the "progress that the external party wants to set". 3) Whenever the external party assigns a value to the member variable "progress that the external party wants to set" of the progress bar view, the system method of the progress bar view itself is synchronously called: setNeedsLayout() or layoutIfNeeded(). You can call both or choose to call one of them. After calling these two functions, the system automatically calls the layoutSubviews method to achieve the drawing of the progress bar.

[0146] The improved progress bar view refresh solution provided in the embodiment of the present application does not involve any animation, and the method of drawing the progress bar is very simple. The progress bar can be drawn by simply cooperating with the member variable "current step percentage" of the manager of the solution, which greatly improves the performance of the application.

[0147] Step S308, displaying the refreshed progress bar.

[0148] The technical solution provided by the embodiment of the present application uses a timer to execute a callback function at a preset time interval during the download process to perform some "fake movements" that will not affect the actual stepping of the progress bar, so that the progress bar can smoothly step according to the actual loading situation to display the download progress of the task to be loaded, thereby improving the user experience.

[0149] In some embodiments, before calculating the preliminary step percentage according to 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:

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

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

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

[0153] When the step number update is triggered, if the first remaining movement percentage is a negative number, the first random number is adjusted to obtain a second random number, wherein the first random number is greater than the second random number;

[0154] Based on the sub-step percentage and the second random number, the virtual move percentage is determined.

[0155] As an example, suppose the task to be loaded is to download the vehicle control configuration data of vehicle 1 under the name of user A. The task to be loaded includes 8 sub-loading tasks, namely: ① vehicle list; ② detailed information of the vehicle currently used by the user; ③ all remote control configuration items; ④ air conditioning configuration items; ⑤ seat configuration items; ⑥ reservation and standby items; ⑦ charging items; ⑧ 2D car model. If the percentage of download progress is allocated to each sub-loading task of the task to be loaded in an even distribution manner, then the sub-step percentage of each sub-loading 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 formula (2), p move_1 represents the first initial movement percentage, p subtask represents the sub-step percentage of each sub-loading task, and m1 represents the first random number.

[0159] As an example, assuming that the first random number m1 is 3, the sub-step percentage p of each sub-loading task is subtask is 1 / 8 (ie 0.125), then according to the above formula (2), it can be calculated that the first initial moving percentage of the timer when executing 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 reaches the 1st second to execute the callback function, the first initial movement percentage of the progress bar is 1 / 24, and the first remaining movement percentage is 1 / 8-1 / 24=2 / 24. When the timer reaches the 2nd second to execute the callback function, the first initial movement percentage of the progress bar is 2 / 24, and the first remaining movement percentage is 1 / 8-2 / 24=1 / 24. When the timer reaches the 3rd second to execute the callback function, the first initial movement percentage of the progress bar is 3 / 24, and the first remaining movement percentage is 1 / 8-3 / 24=0. When the timer reaches the 4th second to execute the callback function, the first initial movement percentage of the progress bar is 4 / 24, and the first remaining movement percentage is 1 / 8-4 / 24=-1 / 24. At this time, the "Update Steps" member function has not been called.

[0161] Afterwards, the manager's member function "Update Steps" is called, which triggers the update step count and calculates the first remaining movement percentage after the progress bar has moved the first initial movement percentage. In the above example, when the timer executes the callback function at the 4th second, the calculated first remaining movement percentage is -1 / 24, which is a negative number. This means that the timer moves too far each time it executes the callback function. At this time, the first random number m1 needs to be increased. The way to increase the first random number m1 includes but is not limited to: m2 = m1 + 1, or etc.; wherein k is a random number less than 1, m1<m2.

[0162] It is worth noting that the degree of reduction of the first random number m1 is related to the absolute value of the first remaining movement percentage. The larger the absolute value of the first remaining movement percentage, the greater the degree of increase of the first random number m1; the smaller the absolute value of the first remaining movement percentage, the smaller the degree of increase of the first random number m1.

[0163] The strategy of increasing the first random number m1 is affected by the absolute value of the first remaining movement percentage after the timer executes the callback function to accumulate the first initial movement percentage when the manager calls the member function "Update Steps". The specific implementation method is not limited, for example: m1 - =(absolute value of the first remaining movement percentage + random number) / first initial movement percentage. m1 - It indicates that the first random number m1 is increased.

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

[0165] Determining a second initial movement percentage based on the sub-step percentage and the second random number;

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

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

[0168] Specifically, the second initial movement percentage and the second remaining movement percentage may be determined by referring to the method for determining the first initial movement percentage and the first remaining movement percentage in the above embodiment, which will not be described in detail here.

[0169] If the second remaining movement percentage after the progress bar moves the second initial movement percentage calculated and recorded each time the timer reaches the time interval to execute the callback function is a positive number, the second initial movement percentage is determined as the virtual movement percentage.

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

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

[0172] If the second remaining movement percentage 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] Determining a third initial movement percentage according to the sub-step percentage and the third random number;

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

[0175] When the step number update is triggered, if the third remaining movement percentage is a positive number and is less than a 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 actual conditions, for example, the preset percentage threshold is set to 50% of the step percentage of each sub-loading task. Exemplarily, 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 that the second remaining movement percentage is greater than 0 (i.e., a positive number) when calling the member function "Update Steps", it is determined 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 stepping movement effect of the progress bar is not smooth. At this time, the second random number can be appropriately reduced 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.

[0178] The method of decreasing the second random number is similar to the method of increasing the first random number, and will not be described in detail here.

[0179] The method for determining the third initial movement percentage and the third remaining movement percentage may refer to the method for determining the first initial movement percentage and the first remaining movement percentage in the above embodiment, which will not be described in detail here.

[0180] Through the above method, the virtual movement percentage of the timer can be flexibly adjusted each time the preset time interval is reached to execute the callback function, so that the progress bar can smoothly step and 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 may be obtained by running the application program one or more times and then fixed in the application program. When the application program is subsequently used, the average random number may be directly called to calculate the virtual movement percentage of the progress bar.

[0182] In some other embodiments, before executing the virtual movement percentage of the callback function according to the current step percentage and the timer at the preset time interval, the method further includes:

[0183] Determine the running time interval between the current sub-download task and the next sub-download task, where 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;

[0184] Determine a preset time interval according to the running time interval;

[0185] According to the sub-step percentage corresponding to each sub-loading task and the preset time interval, the virtual movement percentage when the timer executes the callback function according to the preset time interval is determined.

[0186] As an example, see Fig. 9In the example where the car control APP downloads the car control configuration data corresponding to the task to be loaded from the data provider (such as the server), since 7 of the 8 sub-loading tasks are data interfaces and only 1 sub-loading task (2D car model) is a resource interface, in order to save user download time, these data interfaces and resource interfaces are basically executed in parallel, that is, most interfaces will be issued at the same time and returned at nearly the same time. Therefore, the time interval between sub-loading task 0 and sub-loading task 1 is the most accurate, and the subsequent time can be ignored.

[0187] See also Fig.10 , assuming that the sub-step percentage of the current sub-download task is recorded as step 1, and the sub-step percentage of the next sub-download task is recorded as step 2, the running time interval can be after multiple trial runs of the application (such as the car control APP), calculating and recording the average time interval or the maximum time interval or the minimum time interval between step 1 and step 2.

[0188] For example, assuming that an application (such as a car control APP) is run w times, the average time interval between sub-loading task 0 and sub-loading task 1 in the w times of the test run is counted. The mathematical expression of the average time interval is as follows:

[0189]

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

[0191] In some embodiments, determining the preset time interval according to the running time interval includes:

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

[0193] If the running time interval is greater than the preset minimum interval unit, the preset minimum interval unit is determined as the preset time interval.

[0194] The preset minimum interval unit may be set to a minimum time unit that is visible and acceptable to the user, for example, 1 second, 0.5 second, etc.

[0195] For ease of understanding, continue to use the above example, assuming that 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 seconds, then the running time interval is determined as the preset time interval, that is, the preset time interval is determined as if seconds, then the preset minimum interval unit is determined as the preset time interval, that is, the preset time interval is determined to be 1 second.

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

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

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

[0199] For ease of understanding, continue to use the above example, if the preset time interval is Then the number of executions of the callback function by the timer from step 1 to step 2 is 1. If the preset time interval is the preset minimum interval unit, then the number of executions of the callback function by the timer from step 1 to step 2 is Among them, Int() is the floor rounding function, t min Indicates the preset minimum interval unit.

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

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

[0202]

[0203] In formula (4), p fic It indicates the virtual movement percentage of the timer each time it executes the callback function during the download task (also called sub-loading task) executed by the downloader; p subtask Indicates the sub-step percentage of each sub-loading task of the task to be loaded; E fre Indicates the number of times the timer executes the callback function during the download task executed by the downloader.

[0204] It is worth noting that since the sub-loading tasks are processed concurrently by multiple threads, the timer needs to be locked when executing the callback function to ensure data synchronization. The lock is added when entering the callback function and unlocked when leaving the callback function.

[0205] The idea of ​​using a timer to achieve smooth stepping of the progress bar in the embodiment of the present application is to create a repetitive timer to ensure that during the download process, the progress bar is always "fake" moved by the timer, but before the next step is triggered, the moving distance will never exceed the "current step percentage".

[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 between step 1 and step 2. After the next step is triggered, the timer will continue to move from the next step. For example, if the timer has been executed to 1 / 12 and the next step is triggered, the progress bar will immediately move to 1 / 8, and then the timer will continue to move from 1 / 8, but will not exceed 2 / 8.

[0207] Through the above method, the smoothness of the progress bar movement can be ensured, giving the user the visual feeling that the progress bar moves from one step to the next at a uniform speed, and the visual effect is not too abrupt, thereby improving the user experience.

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

[0209] If the pre-step percentage is less than or equal to the next step percentage, the current step percentage is maintained unchanged until the step update is triggered, the current step percentage is updated to the next step percentage, and the progress bar is refreshed;

[0210] If the prepared step percentage is less than or equal to the next step percentage, the current step percentage is updated to the next step percentage and the progress bar is refreshed;

[0211] If the preparation 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 preparation step percentage is calculated according to the current step percentage and the updated virtual movement percentage; the current step percentage is updated to the updated preparation 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 formula (5), p pre Indicates the percentage of preparatory step; pcur Indicates the current step percentage of the progress bar; p fic Indicates the virtual move percentage that the timer moves each time the callback function is executed.

[0215] If the preparatory step percentage p pre Greater than the next step percentage p next , then the current step percentage of the progress bar p cur Assign the value to the preparatory step percentage p pre , and refresh the progress bar.

[0216] If the preparatory step percentage p pre Less than or equal to the next step percentage p next , which means that this time the timer will exceed the range specified by the above step when executing the callback function, which means that the distance to the edge of the range is very close, and the manager will soon call the member function "Update Steps". The progress bar will not stay still, so the timer does not need to execute the callback function this time, that is, maintain the current step percentage unchanged until the manager calls the member function "Update Steps" (triggering update steps), updates the current step percentage to the next step percentage, and refreshes the progress bar.

[0217] If the preparatory step percentage p pre Less than or equal to the next step percentage p next , which means that this time the timer will exceed the specified range of the above step when executing the callback function, indicating that the distance to the edge of the range is very close, and you can wait at the edge, update the current step percentage to the next step percentage, and refresh the progress bar. This strategy will not cause too much trouble to the user, because the member function "Update Steps" will be called soon, and the progress bar will not stay still.

[0218] If the preparatory step percentage p pre Less than or equal to the next step percentage p next , indicating that this time the timer will exceed the range specified by the above-mentioned step when executing the callback function. The virtual movement percentage of the timer when executing the callback function can be reduced, so that the download interface can be reasonably moved, thereby further 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, the updated preparation step percentage is calculated; the current step percentage is updated to the updated preparation step percentage, and the progress bar is refreshed. Among them, the method of reducing the virtual movement percentage can be to divide the virtual movement percentage by a random number, or to subtract a random number, etc., and the embodiments of the present application do not impose specific restrictions on this.

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

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

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

[0222] When receiving a continue downloading operation triggered by the user, determining whether all the tasks to be loaded have been downloaded;

[0223] If all the tasks to be loaded have been downloaded, a preset virtual download pause interface will be displayed on the current download interface;

[0224] If the task to be loaded has not been downloaded completely, and the interfaces of the sub-loading tasks of the task to be loaded are all one-time data interfaces, wait for the one-time data interface to complete the download of the sub-loading task currently being downloaded, and restart the timer;

[0225] When the timer executes the callback function, the download time from the user triggering the continued download operation to the one-time data interface completing the download task to be loaded is recorded;

[0226] If the download time is less than the preset time threshold, the preset time interval of the timer and the number of executions of the callback function are adjusted;

[0227] Starting from the time point when the user triggers the download continuation operation, record the cumulative time of the timer executing the callback function according to the adjusted preset time interval and execution number;

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

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

[0230] If the download pause is triggered by the pop-up user confirmation dialog interface, a confirmation dialog interface needs to be popped up on the current download interface. If the download pause is triggered by the user choosing to pause the download, there is no need to pop up a confirmation dialog interface on the current download interface.

[0231] If the user wants to continue downloading the preloaded data corresponding to the task to be loaded, the user can trigger the continued download operation by selecting the "Continue Downloading" button preset on the current download interface. When the manager detects the continued download operation triggered by the user, it sets the member variable "Is Static" to false, and then determines whether the task to be loaded has been downloaded completely.

[0232] In the first case, when it is detected that the user triggers the downloading operation, if the tasks to be loaded have been downloaded completely, a preset virtual pause downloading interface can be displayed on the current downloading interface to improve the user's downloading experience, and then the member function "complete downloading" is executed. The virtual pause downloading interface is a fake, short-lived downloading interface.

[0233] As an example, a virtual pause download interface can be set in the following way: 1) Set an animation of y seconds (y is a set value, which cannot be too long to prevent the user from waiting too slowly, such as 1 second or 2 seconds). In addition, the running curve of the animation can be a uniform speed or other speeds. In the animation, set the member variable "current step percentage" from the current paused value to 1. 2) Start a new timer and set the "current step percentage" from the current paused value to 1. For example, set the preset time interval to 1 second, set the number of executions of the timer callback function to 3 times, and the value moved each time the callback function is executed is: (1-current paused value) / number of executions.

[0234] In the second case, when it is detected that the user triggers the continue downloading operation, if the task to be loaded has not been fully downloaded, and the sub-loading tasks of the task to be loaded are all one-time data interfaces, that is, the interfaces of the task to be loaded are all composed of one-time data interfaces, then you can wait for the interface download to be completed. At the same time, in order to improve the user's downloading experience, you can call the member function "Start Timer" to restart the timer.

[0235] After restarting the timer, record the download time from the user triggering the continued download operation to the one-time data interface completing the download of the task to be loaded. If the download time is less than the preset time threshold (which can be flexibly set according to actual needs, for example, it can be set to 1 second, etc.), it is necessary to reduce the virtual movement percentage each time the timer executes the callback function, and increase the number of executions of the timer callback function. Use an additional variable to prevent the member function "Update Steps" from setting the "Current Step Percentage" to 1, and put the step of setting the "Current Step Percentage" to 1 into the timer to complete.

[0236] If the cumulative time of the callback function executed by the timer according to the adjusted preset time interval and execution times reaches the preset time threshold (such as 1 second), the "current step percentage" is set to 1 and the timer is turned off. After that, the manager executes the member function "complete download". In this way, the step display effect of the progress bar can be smoother.

[0237] If the download time is greater than the preset time threshold, the timer may not be started, and the manager directly waits for the interface to finish downloading, and executes the member function "complete download".

[0238] When the current download interface is in a static state, the member variable "is static" is true. When the current download interface is static, the downloader is downloading data reasonably and silently. However, since this member variable prevents the drawing of the progress bar interface, the progress bar will not move, and the user feels that it is indeed paused. When the user triggers to continue downloading, the member variable "is static" is set to false. At this time, it only needs to determine whether the task to be loaded has been downloaded and then process it.

[0239] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.

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

[0241] Assume that the data demand end 101 is a vehicle control APP. When the vehicle control APP is just started, 1) first pull the interface of the data provider 102 (such as a server) to obtain the vehicle list under the user's name. 2) If the number of vehicles in the vehicle list is 0, the vehicle control APP jumps to the preset "Please go to the vehicle binding page". 3) If the number of vehicles in the vehicle list is greater than 0, determine whether the cached data has been downloaded; if it has been downloaded, the APP jumps to the "Vehicle Control Page" (such as Fig.11 If it has not been downloaded, create or reuse a manager, call the manager's "Start Download" method, pass the parameters to the top-level view of the current App, and let it display the download page (as shown in Figure 6 shown).

[0242] In order to save program performance, managers can be reused to avoid additional state records. If a user has multiple cars, he downloads half of the vehicle preload information under car A and then pauses; it has not yet downloaded under car B. If a new manager is used every time a car is switched, the download status and other data of cars A and B must be saved so that the manager can be immediately placed in the state corresponding to the car. For performance considerations, managers can be reused directly, thus eliminating the steps of creating a new car + saving the status + resetting the status.

[0243] Establish a correspondence between a car and a manager, one car corresponds to one manager, and save this relationship somewhere, such as cache, file, hard disk, etc. For example, a user has three cars, car A, car B, and car C. Establish a correspondence between car A, car B, car C and managers 1, 2, and 3, specifically: car A->manager 1; the user's car B->manager 2; the user's car C->manager 3. The car here actually belongs to a business, which can be called a business map.

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

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

[0246] 6) After the download is completed, the manager can automatically disappear the download interface according to business needs, or let the user click to disappear the download interface. Notify external users, and external users continue with their original business logic steps.

[0247] The above steps 4) to 6) are all included in the manager, and external users only need to determine whether the cached data has been downloaded before using it. This is a usage provided to external callers.

[0248] The above steps 1) to 3) can also be included in the manager, which is what its member function "Start Downloading - Predicted Version" does. This is a simpler usage provided to external callers.

[0249] The manager's member function "Start Download - Prediction 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 display and switching of the download view and progress bar view of the embodiment of the present application can be realized, and the download view and progress bar view can be seamlessly cut into the existing page without pollution to the original code, and can be displayed and hidden at any time.

[0251] In an embodiment of the present application, the interface data (preloaded data) downloaded in the above steps is stored in the 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 taken out from the cache space for use according to the cache ID. When the interface data in the cache needs to be updated, the interface data in the cache space can be synchronously updated based on the cache ID.

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

[0253] Part or all of the interface data obtained by all download tasks are stored separately in units of "interface nodes". For example: a download task includes the current vehicle interface and the subsequent 2D car model interface, which is stored as: current vehicle interface ID: current vehicle interface actual data. 2D car model interface ID: 2D car model interface actual data. Note that according to business needs, some or all of these data are stored. In addition, it is also necessary to store whether a certain business has downloaded pre-loaded data. For example, a certain business ID: whether pre-downloaded data has been performed.

[0254] Based on this, the present application proposes a caching method for caching data. Specifically, a variable is used to manage the key-value pair. To update the cache, a value is assigned to the variable; to read the cache, the variable is directly read.

[0255] Inside the variable, override the set method, which: retrieves the currently cached binary data; converts the data structure to be cached into binary data; compares the two binary data, if they are consistent, there is no need to write them into the cache; if they are inconsistent, overwrites the old with the new.

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

[0257] When using binary data and shielding the cache, the difference in data structure of each interface makes comparison and access more convenient.

[0258] The above cache storage mechanism uses cache ID to ensure that the cache is kept up to date (using data and variable changes to keep the cache up to date); through binary data comparison, the number of writes to disk can be reduced, with good performance and ease of use.

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

[0260] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.

[0261] Fig.12 Schematic diagram of a progress bar display device provided in an embodiment of the present application. Fig.12 As shown, the progress bar display device includes:

[0262] The notification module 1201 is configured to determine a task to be loaded, and notify the downloader to download 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;

[0263] The start module 1202 is configured to start the timer when the downloader starts downloading the preloaded data;

[0264] The first determining module 1203 is configured to determine the number of completed sub-loading tasks that the downloader has currently completed 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 the preloaded data if the completed number is less than the preset step upper limit value;

[0266] The first calculation module 1205 is configured to calculate the preliminary step percentage according to 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 next step progress percentage of the progress bar;

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

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

[0270] In some embodiments, the above apparatus further comprises:

[0271] A second determination module is configured to determine a sub-step percentage corresponding to each sub-loading task;

[0272] A generating module configured to generate a first random number and determine a first initial movement percentage according to the sub-step percentage and the first random number;

[0273] A third calculation module is configured to calculate and record a first remaining movement percentage after the progress bar has accumulated a first initial movement percentage when the callback function is executed each time the timer reaches the time interval;

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

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

[0276] In some embodiments, the third determination module includes:

[0277] A first determining unit is configured to determine a second initial movement percentage according to the sub-step percentage and a second random number;

[0278] A calculation unit is configured to calculate and record a second remaining movement percentage after the progress bar has moved a second initial movement percentage cumulatively when the timer executes the callback function each time the timer reaches the time interval;

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

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

[0281] A determination component configured to determine whether the second remaining movement percentage is greater than a preset percentage threshold;

[0282] an adjustment component configured to adjust the second random number to obtain a third random number if the second remaining movement percentage 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] A first determination component is configured to determine a third initial movement percentage based on the sub-step percentage and a third random number;

[0284] A calculation component is configured to calculate and record a third remaining movement percentage after the progress bar has moved a third initial movement percentage cumulatively when the callback function is executed each time the timer reaches the time interval;

[0285] The second determination component is configured to determine the third initial movement percentage as the virtual movement percentage if the third remaining movement percentage is a positive number and is less than a preset percentage threshold when the step number update is triggered.

[0286] In some embodiments, the above apparatus further comprises:

[0287] A fourth determining module is configured to determine a running time interval between the current sub-download task and the next sub-download task, where the running time interval is an average time interval, a maximum time interval, or a minimum time interval between the current sub-download task and the next sub-download task;

[0288] A fifth determining module is configured to determine a preset time interval according to the running time interval;

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

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

[0291] A first time interval determining unit is configured to determine the running time interval as a preset time interval if the running time interval is less than or equal to a preset minimum interval unit;

[0292] The second time interval determining 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 includes:

[0294] A times determination unit is configured to determine the times that the timer executes the callback function at a preset time interval 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 according to the preset time interval according to the sub-step percentage and the execution number.

[0296] In some embodiments, the above apparatus further comprises:

[0297] A maintenance module is configured to maintain the current step percentage unchanged until the step number update is triggered if the preliminary 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] A first updating module is configured to update the current step percentage to the next step percentage and refresh the progress bar if the preliminary 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 apparatus further comprises:

[0301] The first closing module is configured to set the interface state of the current download interface to a static state and close the timer when receiving a download pause operation triggered by the user;

[0302] A judgment module is configured to judge whether all the tasks to be loaded have been downloaded when receiving a continue downloading operation triggered by a user;

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

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

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

[0306] An adjustment module, configured to adjust a preset time interval of a timer and a number of execution times of a callback function 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 execution number starting from the time point when the user triggers the continuing download operation;

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

[0309] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean 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 the present application.

[0310] Fig.13 Schematic diagram of an electronic device 13 provided in an embodiment of the present application. Fig.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, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 1301 executes the computer program 1303, the functions of the modules / units in the above-mentioned device embodiments are implemented.

[0311] The electronic device 13 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 13 may include, but is not limited to, a processor 1301 and a memory 1302. Those skilled in the art will appreciate that Fig.13 The electronic device 13 is merely an example and does not limit the electronic device 13 , and may include more or fewer components than those shown in the figure, or different components.

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

[0313] The memory 1302 may be an internal storage unit of the electronic device 13, for example, a hard disk or memory of the electronic device 13. The memory 1302 may also be an external storage device of the electronic device 13, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card (FlashCard), etc. equipped on the electronic device 13. The memory 1302 may also include both an internal storage unit of the electronic device 13 and an external storage device. 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 can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned 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 above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units.

[0315] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium (e.g., a computer-readable storage medium). Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, which may be in source code form, object code form, executable file or some intermediate form. Computer-readable storage media may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.

[0316] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A progress bar display method, characterized in that: Applied to a manager, the manager is deployed at a data demand end, and the manager includes a downloader; The method comprises: Determine a task to be loaded, and notify the downloader to download preloaded data corresponding to the task to be loaded from a data provider, wherein the task to be loaded includes at least one sub-loading task; When the downloader starts downloading the preloaded data, starting a timer; Determine the number of completed sub-loading tasks that the downloader has currently completed downloading; If the completed number is less than a preset upper limit of the number of steps, obtaining a current step percentage of a progress bar for indicating the download progress of the preloaded data by the downloader; Calculate a preliminary step percentage according to the current step percentage and the virtual movement percentage when the timer executes the callback function at a preset time interval; Calculate the next progress percentage of the progress bar; If the preliminary step percentage is greater than the next step percentage, the current step percentage is updated to the preliminary step percentage, and the progress bar is refreshed; Displays a progress bar after refreshing.

2. The method according to claim 1, characterized in that: Before calculating the preliminary step percentage according to 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; generating a first random number, and determining a first initial movement percentage according to the sub-step percentage and the first random number; When the timer executes the callback function each time when the timer reaches the time interval, a first remaining movement percentage after the progress bar has cumulatively moved the first initial movement percentage is calculated and recorded; When the step number update is triggered, if the first remaining movement percentage is a negative number, the first random number is adjusted to obtain a second random number, wherein the first random number is smaller than the second random number; A virtual move percentage is determined according to the sub-step percentage and the second random number.

3. The method according to claim 2, characterized in that Determining a virtual movement percentage according to the sub-step percentage and the second random number includes: Determining a second initial movement percentage according to the sub-step percentage and the second random number; When the timer executes the callback function each time when the timer reaches the time interval, a second remaining movement percentage after the progress bar has cumulatively moved the second initial movement percentage is calculated and recorded; When the step number update is triggered, if the second remaining movement percentage is a positive number, 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 a virtual movement percentage includes: Determining whether the second remaining movement percentage is greater than a preset percentage threshold; If the second remaining movement percentage is greater than a preset percentage threshold, adjusting the second random number 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; Determining a third initial movement percentage according to the sub-step percentage and the third random number; When the timer executes the callback function each time when the timer reaches the time interval, a third remaining movement percentage after the progress bar has cumulatively moved the third initial movement percentage is calculated and recorded; When the step number update is triggered, if the third remaining movement percentage is a positive number and is less than a preset percentage threshold, the third initial movement percentage is determined as a virtual movement percentage.

5. The method according to claim 1, characterized in that: Before executing the virtual movement percentage of the callback function according to the current step percentage and the timer at the 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; Determining a preset time interval according to the running time interval; According to the sub-step percentage corresponding to each of the sub-loading tasks and the preset time interval, the virtual movement percentage when the timer executes the callback function according to the preset time interval is determined.

6. The method according to claim 5, characterized in that Determining a preset time interval according to the running time interval includes: If the running time interval is less than or equal to the preset minimum interval unit, the running time interval is determined as the preset time interval; If the running time interval is greater than the preset minimum interval unit, the preset minimum interval unit is determined as the preset time interval.

7. The method according to claim 5 or 6, characterized in that: Determining, according to the sub-step percentage corresponding to each of the sub-loading tasks and the preset time interval, the virtual movement percentage when the timer executes the callback function according to the preset time interval, includes: Determine the number of times the timer executes the callback function according to the preset time interval during the execution of a sub-download task by the downloader; The virtual movement percentage when the timer executes the callback function at a preset time interval is calculated according to the sub-step percentage and the execution number.

8. The method according to any one of claims 1 to 6, characterized in that: After calculating the next progress percentage of the progress bar, the method further includes: If the preliminary step percentage is less than or equal to the next step percentage, the current step percentage is maintained unchanged until the step number update is triggered, the current step percentage is updated to the next step percentage, and the progress bar is refreshed; If the preliminary step percentage is less than or equal to the next step percentage, the current step percentage is updated to the next step percentage, and the progress bar is refreshed; If the preliminary 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; the updated preliminary step percentage is calculated according to the current step percentage and the updated virtual movement percentage; the current step percentage is updated to the updated preliminary step percentage, and the progress bar is refreshed.

9. The method according to claim 1, characterized in that: The method further comprises: When receiving a download pause operation triggered by the user, setting the interface state of the current download interface to a static state and turning off the timer; When receiving a continue downloading operation triggered by the user, determining whether all the tasks to be loaded have been downloaded; If the tasks to be loaded have all been downloaded, a preset virtual download pause interface is displayed on the current download interface; If the task to be loaded has not been downloaded completely, and the interfaces of the sub-loading tasks of the task to be loaded are all one-time data interfaces, wait for the one-time data interface to complete downloading the sub-loading task currently being downloaded, and restart the timer; When the timer executes the callback function, the download time from the user triggering the continued download operation to the one-time data interface completing the download of the task to be loaded is recorded; If the download time is less than a preset time threshold, adjusting the preset time interval of the timer and the number of executions of the callback function; Starting from the time point when the user triggers the download continuation operation, the accumulated time of the timer executing the callback function according to the adjusted preset time interval and execution number is recorded; If the accumulated time reaches the preset time threshold, the current step percentage is set to 1 and the timer is turned off.

10. A progress bar display device, characterized in that: include: a notification module configured to determine a task to be loaded, and notify the downloader to download preloaded data corresponding to the task to be loaded from a data provider, wherein the task to be loaded includes at least one sub-loading task; A start module, configured to start a timer when the downloader starts downloading the preloaded data; A first determining module is configured to determine the number of completed sub-loading tasks that the downloader has currently completed downloading; an acquisition module configured to acquire a current step percentage of a progress bar indicating the download progress of the preloaded data by the downloader if the completed number is less than a preset step upper limit; a first calculation module configured to calculate a preliminary step percentage according to the current step percentage and a virtual movement percentage when the timer executes a callback function at a preset time interval; A second calculation module is configured to calculate the next progress percentage of the progress bar; a refresh module configured to update the current step percentage to the preliminary step percentage and refresh the progress bar if the preliminary step percentage is greater than the next step percentage; The display module is configured to display a refreshed progress bar.

Citation Information

Patent Citations

  • Method for implementing starting up progress bar in mobile communication terminal

    CN101094477A

  • Progress bar display control method and device and computer readable storage medium

    CN110275816A

  • 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

  • Method and system for measuring progress of time-consuming calculation task, electronic equipment and medium

    CN117971602A

Cited By

  • Car model downloading method and device, computer equipment and storage medium

    CN121309568A