A method for processing a list control

By setting list control properties in the embedded GUI, introducing adapters and inertial movement algorithms, the problem of inconvenient sliding viewing of embedded GUI is solved, and efficient and smooth list control interaction and resource optimization are achieved.

CN115712431BActive Publication Date: 2025-08-05SHENZHEN ZKSWE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211495930.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-24
Publication Date
2025-08-05
Estimated Expiration
2042-11-24

AI Technical Summary

Technical Problem

Existing embedded GUIs are difficult to support sliding to view more content when displaying multiple data, and are not convenient to operate, and there are problems such as waste of resources and poor interaction.

Method used

The list control properties are set through the FlyThings IDE, the ZKListView::AbsListAdapter adapter is introduced, the getListItemCount and obtainListItemData interfaces are implemented, and the image loading is optimized by combining the reference counting algorithm, and the interaction is optimized by using inertial movement to capture click events to achieve sliding and click response.

Benefits of technology

It realizes efficient data update and smooth interaction of list controls, reduces memory usage, and improves the smoothness and efficiency of sliding and click operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115712431B_ABST
    Figure CN115712431B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of embedded GUI technology, and specifically to a method for implementing a list control, comprising step S001, setting property parameters of the list control on the FlyThings IDE; step S002, calling refreshListView to request a refresh of the list control, triggering a redraw action of the list control and calling back the ZKListView::onDraw redraw interface; step S003, introducing a ZKListView::AbsListAdapter adapter to update data in the list control; and step S004, implementing the getListItemCount interface of AbsListAdapter, wherein the return value of the getListItemCount interface indicates the total number of items in the list.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of embedded GUI, in particular to a processing method for realizing a list control. Background Art

[0002] Currently, most embedded GUIs still use buttons, text, and progress bars as display methods. When it comes to displaying multiple data, the operation requires the use of a large number of text and button controls. This method also has its limitations, such as not supporting sliding to view more content. Therefore, in order to facilitate operation and support sliding to view more content, a list control is introduced here to solve the application scenario of multiple data display. Summary of the Invention

[0003] The purpose of the present invention is to provide a processing method for implementing a list control to solve the technical problems raised by the above background technology.

[0004] To achieve the above objectives, the present invention widely applies the technical solution of embedded GUI, and in particular provides the following technical solution: a processing method for implementing a list control, comprising the following steps:

[0005] Step S001: Set the property parameters of the list control on the FlyThings IDE;

[0006] Step S002, call refreshListView to request to refresh the list control, trigger the list control redraw action, and call back the ZKListView::onDraw redraw interface;

[0007] Step S003: To update the data on the list control, the ZKListView::AbsListAdapter adapter must be introduced. The data in the list is filled and obtained through the adapter. It is necessary to inherit AbsListAdapter to implement the getListItemCount interface and obtainListItemData interface.

[0008] Step S004: Implement the return value of the getListItemCount interface to indicate the total number of items in the list; implement the parameter pListItem of the obtainListItemData interface to indicate the list item pointer, and index to indicate the corresponding item index;

[0009] Step S005: After the adapter is filled, setListAdapter to the list control;

[0010] Step S006: Draw the list control, call drawListView in sequence to draw the list items, call back the defined adapter to fill the data content of each item, and draw the list items in the visible area.

[0011] Preferably, the processing method for implementing the list control further includes:

[0012] In step S007, a reference counting algorithm is introduced into the case of drawing the picture, with the picture path as the key and the picture content bitmap as the value. When loading the picture, it is first checked whether it exists in the container.

[0013] Preferably, in step S007, when the loaded image exists in the container, the reference calculation is accumulated by 1 and the corresponding value is returned.

[0014] Preferably, in step S007, when the loaded image does not exist in the container, the image bitmap content is loaded, the reference count is set to 1, and the image is added to the container.

[0015] Preferably, the processing method for implementing the list control further includes:

[0016] Step S008, the list responds to touch events, determines which sub-item the coordinates fall on when the list is clicked and records it, moves the touch, calculates the list item offset value, and redraws the list, wherein the drawing process is as follows: Step S002 to Step S006.

[0017] Preferably, the processing method for implementing the list control further includes:

[0018] Step S009: From the moment the touch is pressed and slid to the moment the touch is lifted, the coordinates and time of the touch event are added to VelocityTracker::addMovement to calculate the velocity value at the moment of lifting;

[0019] Among them, the instantaneous speed value calculation formula is: v = s / t to obtain the speed value.

[0020] Preferably, in step S009, the instantaneous speed value may be used to perform inertial movement, with the speed being reduced by a ratio of 0.95 each time, and the moving distance is calculated to move the list item.

[0021] Preferably, the processing method for implementing the list control further includes: step S010, capturing the list item click event, which requires inheriting ZKListView::IItemClickListener to implement the onItemClick interface. Clicking an item in the list will trigger the onItemClick event.

[0022] Preferably, in step S001, the attribute parameters of the list control include: coordinate position, number of list items, and drag effect, and the list control parses the attribute parameters to create a ZKListItem list item and subitems.

[0023] Preferably, in step S002, the ZKListView::onDraw redraw interface is called back, and the interface executes drawBackground to draw the background, drawListView to draw the list item content, and drawScrollbar to draw the scroll bar.

[0024] Compared with the prior art, the present invention has the following beneficial effects:

[0025] (1) The present invention realizes the processing of the list control through steps S001 to S006, and inherits and realizes the corresponding interface through the AbsListAdapter adapter that provides data. When the list control is updated, it will automatically call and fill the data;

[0026] (2) The present invention introduces a reference counting algorithm by drawing pictures. The path of the picture is used as the key and the picture content bitmap is used as the value. When loading a picture, it is first checked whether it exists in the container. If it exists, the reference calculation is accumulated by 1 and the corresponding value is returned. If it does not exist, the picture bitmap content is loaded, the reference count is set to 1, and it is added to the container. For the case of drawing repeated pictures, this algorithm can greatly reduce the memory of the picture and improve the drawing efficiency.

[0027] (3) The present invention adds the coordinates and time of the touch event from pressing and sliding to lifting to VelocityTracker::addMovement to calculate the velocity value at the moment of lifting. The calculation formula is: v = s / t to obtain the velocity value; relying on this velocity value, inertial movement is performed, the speed is reduced by 0.95 each time, and the moving distance is calculated to move the list item; using inertia to move the list item makes the interaction more delicate and smoother. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 This is a flowchart of a processing method for implementing a list control according to one embodiment of the present invention;

[0029] Figure 2 This is a flowchart of a second processing method for implementing a list control according to the present invention;

[0030] Figure 3 This is a schematic diagram of the adapter usage process of the present invention;

[0031] Figure 4This is a schematic diagram of the list item click event process of the present invention;

[0032] Figure 5 Schematic diagram of the drawing process of the present invention. DETAILED DESCRIPTION

[0033] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0034] See also Figures 1 to 5 As shown, a processing method for implementing a list control in the present invention is shown.

[0035] Step S001: To build a list control, set the property parameters of the list control on the FlyThings IDE, such as coordinate position, number of list items, drag effect, etc. The list control parses the property parameters and creates a ZKListItem list item and subitems.

[0036] Step S002, in order to realize the drawing work of the list control, the refreshListView is called to request to refresh the list control, triggering the list control redrawing action, calling back the ZKListView::onDraw redrawing interface, and executing drawBackground to draw the background, drawListView to draw the list item content, and drawScrollbar to draw the scroll bar in the interface;

[0037] Step S003: In order to provide a channel for filling data, the list control needs to introduce the ZKListView::AbsListAdapter adapter to update data. The data in the list is filled and obtained through the adapter. It needs to inherit AbsListAdapter to implement the two interfaces of getListItemCount and obtainListItemData.

[0038] Step S004, the getListItemCount interface description of AbsListAdapter, the return value of this interface indicates the total number of items in the list; obtainListItemData interface description, the parameter pListItem is the list item pointer, and index is the corresponding item index;

[0039] Step S005: In order to obtain information through internal callback of the list control, after the adapter filling is implemented, setListAdapter needs to be set to the list control;

[0040] Step S006: In order to draw the UI of each item in the list, the process of drawing the list control will call drawListView in sequence to draw the list items. During this process, the defined adapter will be called back to fill the data content of each item and draw the list items in the visible area.

[0041] Step S007: When drawing an image, a reference counting algorithm is introduced. The image path is used as the key and the image content bitmap is used as the value. When loading an image, it is first checked whether it exists in the container. If it exists, the reference count is incremented by 1 and the corresponding value is returned. If it does not exist, the image bitmap content is loaded, the reference count is set to 1, and the image is added to the container. For the case of drawing repeated images, this algorithm can greatly reduce the memory used for the image and improve the drawing efficiency.

[0042] Step S008, the list responds to the touch event. When the list is clicked, the coordinates are determined to be on which sub-item and recorded. The touch is moved, the offset value of the list item is calculated, and the list is redrawn. The drawing process is as above: Step S002 to Step S006;

[0043] Step S009: From the moment of pressing and sliding to the moment of lifting, the coordinates and time of the touch event are added to VelocityTracker::addMovement to calculate the velocity value at the moment of lifting. The calculation formula is: v = s / t to obtain the velocity value. Based on this velocity value, inertial movement is performed, and the speed is reduced by 0.95 each time. The movement distance is calculated and the list item is moved. Using inertia to move the list item makes the interaction more delicate and smoother.

[0044] Step S010, in order to provide a callback interface for user response, it is convenient to perform corresponding interactive operations after capturing events; to capture list item click events, it is necessary to inherit ZKListView::IItemClickListener to implement the onItemClick interface. Clicking an item in the list will trigger the onItemClick event. This design method provides a callback interface for user response, which is convenient for performing corresponding interactive operations after capturing events.

[0045] Example 1:

[0046] See Figure 3 As shown, the usage process of an adapter is as follows:

[0047] Inherit ZKListView::AbsListAdapter, then implement the getLisItemCount and obtainListItemData interfaces, set the adapter through the list setLisAdapter again, and call refreshisView to refresh the list when data needs to be updated; the adapter will be called inside the list control to request data.

[0048] Example 2:

[0049] See Figure 4 As shown, the process of a list item click event is as follows:

[0050] Inherit ZKListView::IItemClickListener, implement the onItemClick interface, register the listener through setItemClickListener, and use the index and itemID to know which item is clicked and perform the corresponding operation.

[0051] Example 3:

[0052] See Figure 5 As shown, a drawing flow chart is as follows:

[0053] Get the number of list items, call the fill data interface in a loop, and set the list item properties to draw the UI of each item.

[0054] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above and that the invention can be embodied in other specific forms without departing from the spirit or essential characteristics of the invention. Therefore, the embodiments should be considered in all respects as illustrative and non-restrictive, and the scope of the invention is defined by the appended claims, not the foregoing description, and all variations within the meaning and range of equivalents of the claims are intended to be included therein. Any reference sign in a claim should not be construed as limiting the claim to which it relates.

Claims

1. A processing method for implementing a list control, characterized by: The following steps are involved: Step S001: Set the property parameters of the list control on the FlyThings IDE; Step S002, call refreshListView to request to refresh the list control, trigger the list control redraw action, and call back the ZKListView::onDraw redraw interface; Step S003: To update the data on the list control, the ZKListView::AbsListAdapter adapter must be introduced. The data in the list is filled and obtained through the adapter. It is necessary to inherit AbsListAdapter to implement the getListItemCount interface and obtainListItemData interface. Step S004: Implement the return value of the getListItemCount interface, which indicates the total number of items in the list; implement the parameter pListItem of the obtainListItemData interface, which is the list item pointer, and index is the corresponding item index; Step S005: After the adapter is filled, setListAdapter to the list control; Step S006: Draw the list control, call drawListView in sequence to draw the list items, call back the defined adapter to fill the data content of each item, and draw the list items in the visible area.

2. A method for implementing a list control according to claim 1, characterized in that: The processing method for implementing the list control also includes: In step S007, a reference counting algorithm is introduced into the case of drawing the picture, with the picture path as the key and the picture content bitmap as the value. When loading the picture, it is first checked whether it exists in the container.

3. A method for implementing a list control according to claim 2, characterized in that: In step S007, when the loaded image is stored in the container, the reference calculation is accumulated by 1 and the corresponding value is returned; In step S007, when the loaded image does not exist in the container, the image bitmap content is loaded, the reference count is set to 1, and the image is added to the container.

4. A method for implementing a list control according to claim 3, characterized in that: The processing method for implementing the list control also includes: Step S008, the list responds to touch events, determines which sub-item the coordinates fall on when the list is clicked and records it, moves the touch, calculates the list item offset value, and redraws the list, wherein the drawing process is as follows: Step S002 to Step S006.

5. A method for implementing a list control according to claim 4, characterized in that: The processing method for implementing the list control also includes: Step S009: From the moment the touch is pressed and slid to the moment the touch is lifted, the coordinates and time of the touch event are added to VelocityTracker::addMovement to calculate the velocity value at the moment of lifting; The instantaneous speed value is calculated as follows: v = s / t to obtain the speed value.

6. A method for implementing a list control according to claim 5, characterized in that: In step S009, inertial movement can be performed using the instantaneous speed value, with the speed reduced by 0.95 each time, and the moving distance is calculated to move the list item.

7. A method for implementing a list control according to claim 5, characterized in that: The processing method for implementing the list control also includes: step S010, capturing the list item click event, which requires inheriting ZKListView::IItemClickListener to implement the onItemClick interface. Clicking an item in the list will trigger the onItemClick event.

8. The method for implementing a list control according to claim 1, wherein: In the step S001, the attribute parameters of the list control include: coordinate position, number of list items, and drag effect, and the list control parses the attribute parameters to create a ZKListItem list item and subitems.

9. The method for implementing a list control according to claim 1, wherein: In step S002, the ZKListView::onDraw redraw interface is called back, in which drawBackground is executed to draw the background, drawListView is executed to draw the list item content, and drawScrollbar is executed to draw the scroll bar.

Citation Information

Patent Citations

  • Control managing method for graphic user interface

    CN103135892A

  • List sliding processing method

    CN107977204A