WO2019090854A1 - 列表控件的刷新方法、装置、存储介质及终端 - Google Patents

列表控件的刷新方法、装置、存储介质及终端 Download PDF

Info

Publication number
WO2019090854A1
WO2019090854A1 PCT/CN2017/112751 CN2017112751W WO2019090854A1 WO 2019090854 A1 WO2019090854 A1 WO 2019090854A1 CN 2017112751 W CN2017112751 W CN 2017112751W WO 2019090854 A1 WO2019090854 A1 WO 2019090854A1
Authority
WO
WIPO (PCT)
Prior art keywords
data object
image
list
style parameter
terminal
Prior art date
Application number
PCT/CN2017/112751
Other languages
English (en)
French (fr)
Inventor
罗俊宇
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2019090854A1 publication Critical patent/WO2019090854A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0481Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance
    • G06F3/0482Interaction with lists of selectable items, e.g. menus
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces

Definitions

  • the present application belongs to the field of communications technologies, and in particular, to a method, an apparatus, a storage medium, and a terminal for refreshing a list control.
  • the list is the most common control in the application development process.
  • the existing WeChat friends circle, QQ space, Taobao product display, etc. are all implemented by the list control, and all the data is displayed in the queue.
  • the prior art is to uniformly fix the content of each row of the data object in the list, such as the first behavior label, the second behavior image, and the third behavior function identifier, and the representation manner is single. If the content of each line is not fixed, in order to display text or image on any line of the data object, the style parameter of the data object must be calculated during the refresh process of the list control, which requires a large loss of memory and power.
  • the ground affects the smoothness of the list control refresh.
  • the embodiment of the present invention provides a method, a device, a storage medium, and a terminal for refreshing a list control, so as to solve the problem that the performance loss is large and the refresh fluency is low when the data objects of different performance modes are displayed in the prior art.
  • An embodiment of the present application provides a method for refreshing a list control, where the refresh method includes:
  • the data packet is obtained from the server, and the data object to be displayed in the visible window of the list is obtained according to the data packet;
  • the stored layout class is read from the terminal memory
  • a style parameter is obtained from the layout class, and the data object is loaded and displayed in the list visible window according to the style parameter.
  • the refreshing method further includes:
  • the data object is loaded and displayed in the list visible window according to the calculated style parameter.
  • the refreshing method further includes:
  • the style parameter includes a title, a text content, an image content, and a bottom four styles
  • the calculating the style parameters corresponding to the data object includes:
  • For the title/text content obtaining a character size, a total number of characters, a character start position, and calculating overall width and height information of the title/text content in the data object according to the character size, the total number of characters, and the character start position;
  • For the image content obtaining the width and height information of the single image, the image spacing, the position information of the first image, and the total number of images, and calculating the width and height information of the single image, the image spacing, the position information of the first image, and the total number of images.
  • the overall width and height information of the image content in the data object obtaining the width and height information of the single image, the image spacing, the position information of the first image, and the total number of images.
  • the loading and displaying the data object in the list visible window according to the style parameter includes:
  • For the image in the data object create an imageview object, load it using the picasso open source library, and display the loaded image in the list visible window according to the obtained style parameters;
  • the embodiment of the present application further provides a refreshing device for a list control, where the refreshing device includes:
  • An obtaining module configured to acquire a data packet from a server when obtaining a list refresh instruction, and obtain a data object to be displayed in the visible window of the list according to the data packet;
  • a determining module configured to determine, for each data object, whether a layout class corresponding to the data object exists in the terminal memory
  • a reading module configured to read the stored layout class from the terminal memory if present
  • a loading module configured to obtain a style parameter from the layout class, and load and display the data object in the list visible window according to the style parameter.
  • the refreshing device further includes:
  • a calculation module configured to calculate a style parameter corresponding to the data object if the layout class corresponding to the data object does not exist in the terminal memory
  • the loading module is further configured to load and display the data object in the list visible window according to the calculated style parameter.
  • the refreshing device further includes:
  • a storage module configured to create a layout class corresponding to the data object according to the style parameter, and store the layout class in a terminal memory.
  • the embodiment of the present application further provides a computer readable storage medium, where computer readable instructions are stored, and when the computer readable instructions are executed by the processor, the following steps are implemented:
  • the data packet is obtained from the server, and the data object to be displayed in the visible window of the list is obtained according to the data packet;
  • the stored layout class is read from the terminal memory
  • a style parameter is obtained from the layout class, and the data object is loaded and displayed in the list visible window according to the style parameter.
  • the embodiment of the present application further provides a terminal, where the terminal includes a memory, a processor, and computer readable instructions stored on the memory and executable on the processor, when the processor executes the computer readable instructions.
  • the data packet is obtained from the server, and the data object to be displayed in the visible window of the list is obtained according to the data packet;
  • the stored layout class is read from the terminal memory
  • a style parameter is obtained from the layout class, and the data object is loaded and displayed in the list visible window according to the style parameter.
  • the embodiment of the present application stores the layout class in the local terminal memory; when the list refresh instruction is obtained, the data packet is first obtained from the server, and the data object to be displayed in the visible window of the list is obtained; Determining, in each of the data objects, whether a layout class corresponding to the data object exists in the terminal memory; if yes, reading the stored layout class from the terminal memory, obtaining a style parameter, and following the pattern
  • the parameter loads and displays the data object in the list visible window; thereby implementing the lazy loading method to display the data object, as long as the layout class is already stored in the terminal memory, directly using the stored layout class
  • the method of loading and displaying avoids calculating the style parameter of the data object, effectively reducing the consumption of the terminal CPU, and solving the problem that the prior art exhibits large performance loss and low refresh fluency when displaying data objects of different expression modes.
  • FIG. 1 is a first implementation flowchart of a method for refreshing a list control according to an embodiment of the present application
  • FIG. 2 is a second implementation flowchart of a refresh method of a list control provided by an embodiment of the present application
  • FIG. 3 is a flowchart of an implementation of step S105 in a method for refreshing a list control according to an embodiment of the present application
  • FIG. 4 is a third implementation flowchart of a method for refreshing a list control according to an embodiment of the present application
  • FIG. 5 is a structural diagram of a refresh device of a list control provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram of a terminal provided by an embodiment of the present application.
  • FIG. 1 shows a first implementation flow of a refresh method of a list control provided by an embodiment of the present application.
  • the refresh method of the list control is applied to a terminal, and the terminal can interact with a background server.
  • the background server is a server device of the application, and is configured to store user account information, a response message, and a push notification that the user logs in to the application.
  • the application is usually a social application with network social circles, such as WeChat, QQ, LINE, FaceBook, etc., using a list control to display social dynamic information.
  • the terminal includes, but is not limited to, a smartphone, a tablet, a learning machine, and the like.
  • the refresh method of the list control includes:
  • step S101 when the list refresh instruction is acquired, the data packet is acquired from the server, and the data object to be displayed in the visible window of the list is acquired according to the data packet.
  • the list refresh instruction is instruction information indicating that the terminal updates the data object on the list control, and may be triggered by, for example, a start operation of the list control, a pull-down operation on the list control, and a pull-up operation.
  • the terminal accesses the server and sends a request message to the server. If the server returns Post data, then these Posts will be The data is saved to the terminal, and the PostID corresponding to each Post data is obtained. Among them, each Post data corresponds to a data object to be displayed on the list control.
  • step S102 for each data object, it is determined whether the layout class corresponding to the data object exists in the terminal memory.
  • each data refresh operation performs a calculation of a style parameter on a data object, and then renders the data object in a list visible window according to the calculated style parameter to display the data object.
  • the terminal Each time the terminal refreshes the list control, the terminal must calculate the style parameters of the data objects to be displayed on the interface. Sometimes there are cases where some data objects are calculated multiple times, which greatly affects the refresh of the list control. degree.
  • the embodiment of the present application opens up a piece of memory in the terminal local for storing a style parameter corresponding to the data object, and the style parameter is calculated when the data object is first displayed on the list control.
  • the embodiment of the present application further adds an event listening function, and the event monitoring function determines, according to the PostID corresponding to the Post data, whether there is a layout class of the data object to be displayed corresponding to the Post data in the memory of the terminal in each refresh process. .
  • the event listener function When a certain data object is to be displayed on the list control, the event listener function is started, and the event listener function is used to check whether the layout class corresponding to the data object exists in the terminal memory, if there is a corresponding memory in the terminal memory.
  • the layout class indicates that the data object is not displayed for the first time, and has been displayed on the list control before the refresh, the layout class of the terminal local memory is directly used, and step S103 is performed.
  • step S103 if present, the stored layout class is read from the terminal memory.
  • Context.getSystemService (Context.LAYOUT_INFLATER_SERVICE).inflater (R.layout. layout class name, null) reads the layout class corresponding to the layout class name.
  • the layout class is named a label of the layout class, and is paired with the data object and its layout class. Should be used to distinguish between different data objects stored in the terminal memory layout class.
  • the layout class may be the PostID described above.
  • step S104 a style parameter is obtained from the layout class, and the data object is loaded and displayed in the list visible window according to the style parameter.
  • the layout class records the style parameters of the data object, and the style parameter defines how the data object behaves in the list control.
  • the style parameters include, but are not limited to, a title, a text content, an image content, and a bottom four. Each data object includes a title, a bottom, and text content and/or image content.
  • the style parameter is obtained, the data is filled according to the style parameter, including padding text, padding image, network link, etc., thereby completing loading and displaying the data object in the list visible window.
  • the loading and displaying the data object in the list visible window according to the style parameter may further include:
  • For the image in the data object create an imageview object, load it using the picasso open source library, and display the loaded image in the list visible window according to the obtained style parameters;
  • the onTouchEvent method is used to set the image to execute the setColorFilter() function on the onKeyDown and the image to execute the clearColorFilter() function on the onKeyUp.
  • the embodiment of the present application selects the picasso open source library to load an image, which is beneficial to decoupling the loaded image and improving the efficiency of loading the image.
  • the setColorFilter() function is used to add a mask to the image
  • the clearColorFilter() function is used to clear the mask for the image.
  • the image view object is customized, and the onTouchEvent method is overwritten, and the ColorFilter is added in the onKeyDown, and then cleared on the onKeyUp, thereby realizing the effect of the user having the mask when clicking the image, thereby effectively improving the user experience.
  • the embodiment of the present application determines whether there is a layout class corresponding to the data object to be displayed in the visible window of the terminal in the memory of the terminal;
  • the result of the break is that when the layout class exists, the stored layout class is read, and the data object is loaded and displayed in the list visible window according to the style parameter in the layout class; thereby implementing lazy loading in the terminal.
  • the way to display the data object as long as the terminal stores the layout class, directly use the style parameters in the layout class to load and display, avoiding the repeated calculation of the style parameters for the data object, and the data object having no fixed format for the text and the image.
  • the utility model effectively reduces the consumption of the terminal CPU, so that the rendering speed of the list control is faster and smoother when sliding up and down, and solves the problem that the prior art exhibits large performance loss and low refresh fluency when displaying data objects of different expression modes. .
  • FIG. 2 it is a second implementation flow diagram of a refresh method of a list control provided by an embodiment of the present application, including:
  • step S105 if the layout class corresponding to the data object does not exist in the terminal memory, the style parameter corresponding to the data object is calculated.
  • the event monitoring function is used to check whether the layout class corresponding to the data object exists in the memory of the terminal, if the corresponding layout class does not exist in the terminal memory, the data object is displayed for the first time. Then calculating a style parameter corresponding to the data object.
  • the style parameter includes a title, a text content, an image content, and a bottom four styles.
  • the title is a publisher tag of the data object;
  • the text content is a representation of the written language of the data object, and may be a sentence, a paragraph, or a chapter;
  • the image content is a graphic or image in the data object.
  • the bottom is the end tag of the data object, including but not limited to the like function identifier, the comment function identifier, and the release time identifier.
  • Any data object consists of the above title, bottom, and text content and/or image content.
  • FIG. 3 shows an implementation flow of calculating a style parameter corresponding to the data object in step S105 provided by the embodiment of the present application, where the step S105 includes:
  • step S301 for the title/text content, the character size, the total number of characters, and the word are obtained.
  • the start position of the character calculates the overall width and height information of the title/text content in the data object according to the character size, the total number of characters, and the start position of the character.
  • step S302 for the image content, acquiring the width and height information of the single image, the image spacing, the position information of the first image, and the total number of images, according to the width and height information of the single image, the image spacing, and the position of the first image.
  • the information and the total number of images calculate the overall width and height information of the image content in the data object.
  • any data object includes the title, the bottom, and the text content and/or the image content, so the field information in each Post data returned by the server may be decomposed to obtain the corresponding data of the Post data.
  • the style parameters included in the data object include the title, the bottom, and the text content and/or the image content, so the field information in each Post data returned by the server may be decomposed to obtain the corresponding data of the Post data.
  • the overall width and height information respectively define a position of the text content or the image content in the data object; the character size, the total number of characters, and the starting position of the character all define the manner in which the text content is expressed in the data object;
  • the width and height information of a single image, the image spacing, the position information of the first image, and the total number of images define the representation of the image content in the data object.
  • step S106 the data object is loaded and displayed in the list visible window according to the calculated style parameter.
  • the data objects are loaded and displayed in the list visible window according to the style parameters. For details, refer to step S104 described in the embodiment of FIG. 1 , and details are not described herein again.
  • the embodiment of the present application determines whether there is a layout class corresponding to the data object to be displayed in the visible window of the terminal in the local memory of the terminal; and if only if the judgment result is that the layout class does not exist, the calculation is performed.
  • the performance loss of the terminal is effectively reduced, so that the rendering speed of the list control is faster and smoother when sliding up and down, which solves the problem that the performance loss of the terminal is large and the interface refreshing is low when the data objects of different expression modes are loaded in the prior art. The problem.
  • FIG. 4 it is a schematic diagram of a third implementation process of the refresh method of the list control provided by the embodiment of the present application. After calculating the style parameter corresponding to the data object, the refresh method further includes:
  • step S107 a layout class corresponding to the data object is created according to the style parameter, and the layout class is stored in a terminal memory.
  • the style parameter corresponding to the data object is calculated, a corresponding layout class is created, and the style parameter is saved as an object of the layout class to the terminal memory, so as to be acquired again.
  • the refresh instruction is executed, the layout class corresponding to the data object is directly read from the memory, and the loading and display on the list control is completed; the calculation of the style parameter is avoided for the data object, and the effect of using the calculation multiple times is realized.
  • the number of calculations of the terminal style parameters is reduced, so that the rendering speed of the list control is faster and smoother when sliding up and down, which solves the problem that the performance loss of the terminal is large and the interface refreshing is low when the data objects of different expression modes are loaded in the prior art. The problem.
  • the size of the serial number of each step does not mean the order of execution order, and the order of execution of each step should be determined by its function and internal logic, and should not constitute any implementation process of the embodiment of the present application. limited.
  • FIG. 5 is a structural diagram of a refreshing apparatus of a list control provided by an embodiment of the present application. For convenience of description, only parts related to the embodiment of the present application are shown.
  • the refreshing device of the list control is used to implement the refresh method of the list control described in the foregoing embodiments of FIG. 1, FIG. 2, FIG. 3, and FIG. 4, and may be a software unit built in the terminal, A hardware unit, a combination of hardware and software, including but not limited to a smart phone, a tablet computer, a learning machine, and the like.
  • the refreshing device of the list control includes:
  • the obtaining module 51 is configured to: when the list refresh instruction is obtained, acquire a data packet from the server, and obtain a data object to be displayed in the visible window of the list according to the data packet;
  • the determining module 52 is configured to determine, for each data object, whether a layout class corresponding to the data object exists in the memory of the terminal;
  • the reading module 53 is configured to, if present, read the stored layout class from the terminal memory;
  • the loading module 54 is configured to obtain a style parameter from the layout class, and load and display the data object in the list visible window according to the style parameter.
  • the list refresh instruction is instruction information indicating that the terminal updates the data object on the list control, and may be triggered by, for example, a start operation of the list control, a pull-down operation on the list control, and a pull-up operation.
  • the obtaining module 51 accesses the server and sends a request message to the server. If the server returns Post data, the Post data is saved to the terminal, and the PostID corresponding to each Post data is obtained. Among them, each Post data corresponds to a data object to be displayed on the list control.
  • the determining module 52 determines, according to the PostID corresponding to the Post data, whether the layout class of the data object corresponding to the Post data exists in the terminal memory through the event listening function. If the result of the determination is that the reading module 53 reads the layout class according to the PostID, the loading module 54 finishes loading and displaying the data object according to the style parameter in the layout class. Therefore, the terminal uses the lazy loading method to display the data object. As long as the terminal stores the layout class, the style parameter in the layout class is directly used for loading and displaying, thereby avoiding repeatedly calculating the style parameter for the data object, for the text.
  • the image has no fixed format data object, which effectively reduces the consumption of the terminal CPU, so that the rendering speed of the list control is faster and smoother when sliding up and down, and the performance loss of the prior art when displaying data objects of different expression modes is solved. Large, refreshing fluency problem.
  • the refreshing device further includes:
  • the calculation module 55 is configured to calculate a style parameter corresponding to the data object if the layout class corresponding to the data object does not exist in the terminal memory;
  • the loading module 54 is further configured to load and display the data object in the list visible window according to the calculated style parameter.
  • the refreshing device further includes:
  • the creation and storage module 56 is configured to create a layout class corresponding to the data object according to the style parameter, and store the layout class into the terminal memory.
  • the style parameter includes a title, a text content, an image content, and a bottom four styles
  • the calculation module 55 is further configured to:
  • For the title/text content obtaining a character size, a total number of characters, a character start position, and calculating overall width and height information of the title/text content in the data object according to the character size, the total number of characters, and the character start position;
  • For the image content obtaining the width and height information of the single image, the image spacing, the position information of the first image, and the total number of images, and calculating the width and height information of the single image, the image spacing, the position information of the first image, and the total number of images.
  • the overall width and height information of the image content in the data object obtaining the width and height information of the single image, the image spacing, the position information of the first image, and the total number of images.
  • the loading module 54 is specifically configured to:
  • For the image in the data object create an imageview object, load it using the picasso open source library, and display the loaded image in the list visible window according to the obtained style parameters;
  • the onTouchEvent method is used to set the image to execute the setColorFilter() function on the onKeyDown and the image to execute the clearColorFilter() function on the onKeyUp.
  • each module/unit in the embodiment of the present application may be used to implement all the technical solutions in the foregoing method embodiments, and the specific working process may refer to the corresponding process in the foregoing method embodiments, and details are not described herein again. .
  • the embodiment provides a computer readable storage medium having stored thereon computer readable instructions that, when executed by a processor, implement the list control of Embodiment 1.
  • the refresh method in order to avoid duplication, will not be described here.
  • the computer readable instructions when executed by the processor, the functions of the modules/units in the refreshing device of the list control in Embodiment 2 are implemented. To avoid repetition, details are not described herein again.
  • FIG. 6 is a schematic diagram of a terminal according to an embodiment of the present disclosure, where the terminal includes but is not limited to a server and a mobile terminal.
  • the terminal 6 of this embodiment includes a processor 60, a memory 61, and computer readable instructions 62 stored in the memory 61 and executable on the processor 60.
  • the steps in the embodiment of the refresh method of the list control are implemented, such as steps S101 to S104 shown in FIG. 1 and steps S105 to S106 described in the embodiment of FIG. Steps S301 to S302 described in the embodiment of FIG. 3 and step S107 described in the embodiment of FIG. 4; or, in the embodiment of the refreshing apparatus for implementing the above list control when the processor 60 executes the computer readable instructions 62
  • the functions of each module/unit such as the functions of modules 51 to 56 shown in FIG.
  • the computer readable instructions 62 may be partitioned into one or more modules/units that are stored in the memory 61 and executed by the processor 60, To complete this application.
  • the one or more modules/units may be a series of computer readable instruction segments capable of performing a particular function for describing the execution of the computer readable instructions 62 in the terminal 6.
  • the computer readable instructions 62 may be divided into an acquisition module, a determination module, a read module, and a load module, and the specific functions of each module are as follows:
  • An obtaining module configured to acquire a data packet from a server when obtaining a list refresh instruction, and obtain a data object to be displayed in the visible window of the list according to the data packet;
  • a determining module configured to determine, for each data object, whether a layout class corresponding to the data object exists in the terminal memory
  • a reading module configured to read the stored layout class from the terminal memory if present
  • a loading module configured to obtain a style parameter from the layout class, according to the style parameter
  • the data object is loaded and displayed in the list visible window.
  • the computer readable instructions 62 may also be segmented:
  • a calculation module configured to calculate a style parameter corresponding to the data object if the layout class corresponding to the data object does not exist in the terminal memory
  • the loading module is further configured to load and display the data object in the list visible window according to the calculated style parameter.
  • the computer readable instructions 62 may also be segmented:
  • a storage module configured to create a layout class corresponding to the data object according to the style parameter, and store the layout class in a terminal memory.
  • the terminal 6 can be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server.
  • the terminal may include, but is not limited to, a processor 60, a memory 61. It will be understood by those skilled in the art that FIG. 6 is merely an example of the terminal 6, and does not constitute a limitation of the terminal 6, and may include more or less components than those illustrated, or combine some components, or different components, such as
  • the terminal may also include an input/output device, a network access device, a bus, and the like.
  • the so-called processor 60 may be a central processing unit (CPU), or may be other general-purpose processors, a digital signal processor (DSP), an application specific integrated circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc.
  • the general purpose processor may be a microprocessor or the processor or any conventional processor or the like, which is a control center of the terminal, and connects various parts of the entire terminal using various interfaces and lines.
  • the memory 61 can be used to store the computer readable instructions and/or modules by running or executing computer readable instructions and/or modules stored in the memory, and recalling data stored in the memory Implementing various functions of the terminal.
  • the memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may be stored. According to The data created by the use of the terminal, etc.
  • the memory may include a high-speed random access memory, and may also include non-volatile memory such as a hard disk, a memory, a plug-in hard disk, a smart memory card (SMC), and a secure digital card (Secure Digital, SD). , Flash Card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
  • non-volatile memory such as a hard disk, a memory, a plug-in hard disk, a smart memory card (SMC), and a secure digital card (Secure Digital, SD).
  • SD Secure Digital
  • Flash Card at least one disk storage device, flash memory device, or other volatile solid-state storage device.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
  • the integrated modules/units if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium.
  • the present application implements all or part of the processes in the foregoing embodiments, and may also be implemented by computer readable instructions, which may be stored in a computer readable storage medium.
  • the computer readable instructions when executed by a processor, may implement the steps of the various method embodiments described above.
  • the computer readable instructions comprise computer readable instruction code, which may be in the form of source code, an object code form, an executable file or some intermediate form or the like.
  • the computer readable storage medium may include any entity or device capable of carrying the computer readable instruction code, a recording medium, a USB flash drive, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a read only memory (ROM, Read- Only Memory), Random Access Memory (RAM), electrical carrier signals, telecommunications signals, and software distribution media. It should be noted that the content contained in the computer readable storage medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in a jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, computer readable The storage medium does not include an electrical carrier signal and a telecommunication signal.

Abstract

本申请适用于通信技术领域,提供了一种列表控件的刷新方法、装置、存储介质及终端,所述方法包括:当获取到列表刷新指令时,从服务器获取数据包,根据所述数据包获取列表可视窗口中将要展示的数据对象;对于每一个数据对象,判断终端内存中是否存在所述数据对象对应的布局类;若存在时,从所述终端内存中读取所存储的布局类;从所述布局类中获取样式参数,并按照所述样式参数在所述列表可视窗口中加载并显示所述数据对象。本申请实现了采用懒加载的方式来展示数据对象,有效地降低了终端CPU的消耗,解决了现有技术在展示不同表现方式的数据对象时性能损耗大、刷新流畅度低的问题。

Description

列表控件的刷新方法、装置、存储介质及终端
本专利申请以2017年11月13日提交的申请号为201711114699.4的中国发明专利申请为基础,并要求其优先权。
技术领域
本申请属于通信技术领域,尤其涉及一种列表控件的刷新方法、装置、存储介质及终端。
背景技术
列表是应用程序开发过程中最常见的控件,现有的微信朋友圈、QQ空间、淘宝商品展示等都是通过列表控件来实现的,所有数据按照队列展示出来。在常见的列表控件中,现有技术是将列表中数据对象的每一行的内容统一固定起来,比如第一行为标签、第二行为图像、第三行为功能标识,表现方式单一。若每一行的内容不固定,要实现在数据对象的任意行上展示文本或图像时,每次列表控件的刷新过程中都要计算数据对象的样式参数,需要损耗较大的内存和电量,严重地影响了列表控件刷新的流畅度。
发明内容
本申请实施例提供了一种列表控件的刷新方法、装置、存储介质及终端,以解决现有技术在展示不同表现方式的数据对象时,性能损耗大、刷新流畅度低的问题。
本申请实施例提供了一种列表控件的刷新方法,所述刷新方法包括:
当获取到列表刷新指令时,从服务器获取数据包,根据所述数据包获取列表可视窗口中将要展示的数据对象;
对于每一个数据对象,判断终端内存中是否存在所述数据对象对应的布局类;
若存在时,从所述终端内存中读取所存储的布局类;
从所述布局类中获取样式参数,并按照所述样式参数在所述列表可视窗口中加载并显示所述数据对象。
进一步地,所述刷新方法还包括:
若终端内存中不存在所述数据对象对应的布局类时,计算所述数据对象对应的样式参数;
按照计算得到的样式参数在所述列表可视窗口中加载并显示所述数据对象。
进一步地,在计算所述数据对象对应的样式参数后,所述刷新方法还包括:
根据所述样式参数创建所述数据对象对应的布局类,并将所述布局类存储至终端内存中。
进一步地,所述样式参数包括标题、文本内容、图像内容以及底部四种样式;
所述计算所述数据对象对应的样式参数包括:
对于所述标题/文本内容,获取字符大小、字符总数、字符起始位置,根据所述字符大小、字符总数、字符起始位置计算所述数据对象中标题/文本内容的整体宽高信息;
对于所述图像内容,获取单一图像的宽高信息、图像间距、首张图像的位置信息以及图像总数,根据所述单一图像的宽高信息、图像间距、首张图像的位置信息以及图像总数计算所述数据对象中图像内容的整体宽高信息。
进一步地,所述按照所述样式参数在所述列表可视窗口中加载并显示所述数据对象包括:
对于数据对象中的图像,创建imageview对象,使用picasso开源库进行加载,并根据所获取的样式参数在列表可视窗口中显示所加载的图像;
复写onTouchEvent方法;
通过所述onTouchEvent方法设置图像在onKeyDown时执行setColorFilter() 函数以及图像在onKeyUp时去执行clearColorFilter()函数。
本申请实施例还提供了一种列表控件的刷新装置,所述刷新装置包括:
获取模块,用于当获取到列表刷新指令时,从服务器获取数据包,根据所述数据包获取列表可视窗口中将要展示的数据对象;
判断模块,用于对于每一个数据对象,判断终端内存中是否存在所述数据对象对应的布局类;
读取模块,用于若存在时,从所述终端内存中读取所存储的布局类;
加载模块,用于从所述布局类中获取样式参数,并按照所述样式参数在所述列表可视窗口中加载并显示所述数据对象。
进一步地,所述刷新装置还包括:
计算模块,用于若终端内存中不存在所述数据对象对应的布局类时,计算所述数据对象对应的样式参数;
所述加载模块还用于,按照计算得到的样式参数在所述列表可视窗口中加载并显示所述数据对象。
进一步地,所述刷新装置还包括:
创建及存储模块,用于根据所述样式参数创建所述数据对象对应的布局类,并将所述布局类存储至终端内存中。
本申请实施例还提供了一种计算机可读存储介质,其上存储有计算机可读指令,该计算机可读指令被处理器执行时实现下步骤:
当获取到列表刷新指令时,从服务器获取数据包,根据所述数据包获取列表可视窗口中将要展示的数据对象;
对于每一个数据对象,判断终端内存中是否存在所述数据对象对应的布局类;
若存在时,从所述终端内存中读取所存储的布局类;
从所述布局类中获取样式参数,按照所述样式参数在所述列表可视窗口中加载并显示所述数据对象。
本申请实施例还提供了一种终端,所述终端包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤:
当获取到列表刷新指令时,从服务器获取数据包,根据所述数据包获取列表可视窗口中将要展示的数据对象;
对于每一个数据对象,判断终端内存中是否存在所述数据对象对应的布局类;
若存在时,从所述终端内存中读取所存储的布局类;
从所述布局类中获取样式参数,按照所述样式参数在所述列表可视窗口中加载并显示所述数据对象。
与现有技术相比,本申请实施例通过在本地终端内存中存储布局类;当获取到列表刷新指令时,先从服务器获取数据包,得到列表可视窗口中将要展示的数据对象;然后针对每一条数据对象,判断所述终端内存中是否存在所述数据对象对应的布局类;若存在时,则从所述终端内存中读取所存储的布局类,得到样式参数,并按照所述样式参数在所述列表可视窗口中加载、显示所述数据对象;从而实现了采用懒加载的方式来展示数据对象,只要终端内存中已存储有布局类,则直接使用所存储的布局类来进行加载并展示,避免了对该数据对象计算样式参数,有效地降低了终端CPU的消耗,解决了现有技术在展示不同表现方式的数据对象时性能损耗大、刷新流畅度低的问题。
附图说明
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他附图。
图1是本申请实施例提供的列表控件的刷新方法的第一实现流程图;
图2是本申请实施例提供的列表控件的刷新方法的第二实现流程图;
图3是本申请实施例提供的列表控件的刷新方法中步骤S105的实现流程图;
图4是本申请实施例提供的列表控件的刷新方法的第三实现流程图;
图5是本申请实施例提供的列表控件的刷新装置的组成结构图;
图6是本申请实施例提供的终端的示意图。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
实施例1
图1示出了本申请实施例提供的列表控件的刷新方法的第一实现流程。
在本申请实施例中,所述列表控件的刷新方法应用于终端,所述终端能够与后台服务器交互。所述后台服务器为应用程序的服务端设备,用于存储用户登录所述应用程序的用户帐号信息、响应消息以及推送通知。所述应用程序通常为社交类应用程序,具有网络社交圈子,比如微信、QQ、LINE、FaceBook等,使用列表控件展示社交动态信息。可选地,所述终端包括但不限于智能手机、平板电脑、学习机等。
参阅图1,所述列表控件的刷新方法包括:
在步骤S101中,当获取到列表刷新指令时,从服务器获取数据包,根据所述数据包获取列表可视窗口中将要展示的数据对象。
在这里,所述列表刷新指令为指示终端对列表控件上的数据对象进行更新的指令信息,可以通过比如对列表控件的启动操作、在列表控件上的下拉操作、上拉操作触发。在本申请实施例中,终端获取到列表控件的刷新指令后,访问服务器,向服务器发送请求消息。如果服务器返回了Post数据,则将这些Post 数据保存至终端,并获取每一个Post数据对应的PostID。其中,每一个Post数据对应列表控件上将要展示的一个数据对象。
在步骤S102中,对于每一个数据对象,判断终端内存中是否存在所述数据对象对应的布局类。
在现有技术中,每次刷新操作都要对数据对象进行样式参数的计算,然后按照所计算出的样式参数在列表可视窗口内进行渲染,展示所述数据对象。终端在每次刷新列表控件时都要对界面上将要展示的数据对象进行样式参数计算,有时候还会存在对某些数据对象进行多次计算的情况,极大的影响了列表控件的刷新流畅度。鉴于此,本申请实施例在终端本地中开辟了一块内存,用于存储数据对象对应的样式参数,该样式参数为该数据对象首次在列表控件上展示时计算得到。进一步地,本申请实施例还增添了事件监听函数,通过该事件监听函数在每次刷新过程中,根据Post数据对应的PostID判断终端内存中是否存在Post数据对应的将要显示的数据对象的布局类。
当要在列表控件上展示某条数据对象时,则启动所述事件监听函数,由所述事件监听函数去查看终端内存中是否存在该条数据对象对应的布局类,如果终端内存中存在对应的布局类时,表明所述数据对象并非首次展示,本次刷新之前已在列表控件上展示过,则直接使用终端本地内存的所述布局类,执行步骤S103。
在步骤S103中,若存在时,从所述终端内存中读取所存储的布局类。
可选地,在Activity所在类中,可以使用
this.getLayoutInflater().inflater(R.layout.布局类名,null)读取所述布局类名对应的布局类。
在非Activity所在类中,则可以使用
Context.getSystemService(Context.LAYOUT_INFLATER_SERVICE).inflater(R.layout.布局类名,null)读取所述布局类名对应的布局类。
应当理解,所述布局类名为布局类的标签,与数据对象及其布局类一一对 应,用于区分不同数据对象存储在终端内存中的布局类。示例性地,所述布局类可以为前文所述的PostID。
在步骤S104中,从所述布局类中获取样式参数,按照所述样式参数在所述列表可视窗口中加载并显示所述数据对象。
在这里,所述布局类中记录了数据对象的样式参数,所述样式参数定义了数据对象在列表控件中的表现方式。在本申请实施例中,所述样式参数包括但不限于标题、文本内容、图像内容以及底部四种,每一个数据对象包括标题、底部,以及文本内容和/或图像内容。在得到样式参数之后,则根据所述样式参数填充数据,包括填充文字、填充图像、网络链接等,从而完成在列表可视窗口中加载并显示数据对象。
可选地,作为本申请的一个优选实施例,所述按照所述样式参数在所述列表可视窗口中加载并显示所述数据对象还可以包括:
对于数据对象中的图像,创建imageview对象,使用picasso开源库进行加载,并根据所获取的样式参数在列表可视窗口中显示所加载的图像;
复写onTouchEvent方法;
通过所述onTouchEvent方法设置图像在onKeyDown时执行setColorFilter()函数以及图像在onKeyUp时去执行clearColorFilter()函数。
在这里,本申请实施例选用picasso开源库来加载图像,有利于加载图像的解耦,提高加载图像的效率。进一步地,所述setColorFilter()函数用于为图像添加蒙版,所述clearColorFilter()函数则用于为图像清除蒙版。本申请实施例通过自定义imageview对象,并复写onTouchEvent方法,在onKeyDown时添加ColorFilter,然后在onKeyUp时清除掉,实现了用户在点击图像时带蒙版的效果,有效地提升了用户的体验感。对于蒙版的颜色效果,可以根据需求在setColorFilter()函数中设置,此处不作限制。
综上所述,本申请实施例通过在获取到列表刷新指令时,判断终端内存中是否存在列表可视窗口内将要显示的所述数据对象对应的布局类;然后根据判 断结果为存在布局类时,读取所存储的布局类,并按照所述布局类中的样式参数在所述列表可视窗口中加载并显示所述数据对象;从而实现了在终端采用懒加载的方式来展示数据对象,只要终端存储有布局类时,直接使用该布局类中的样式参数来进行加载、展示,避免了对数据对象重复计算样式参数,对于文本及图像没有固定格式的数据对象,有效地降低了终端CPU的消耗,使得列表控件在上下滑动时的渲染速度更快、更流畅,解决了现有技术在展示不同表现方式的数据对象时性能损耗大、刷新流畅度低的问题。
进一步地,基于图1提供的列表控件的刷新方法的第一实现流程的基础上,提出本申请实施例提供的列表控件的刷新方法的第二实现流程。
如图2所示,是本申请实施例提供的列表控件的刷新方法的第二实现流程示意图,包括:
在步骤S105中,若终端内存中不存在所述数据对象对应的布局类时,计算所述数据对象对应的样式参数。
在发明实施例中,在由事件监听函数去查看终端内存中是否存在该条数据对象对应的布局类后,如果终端内存中不存在对应的布局类时,即表明所述数据对象为首次展示,则计算所述数据对象对应的样式参数。
可选地,在本申请实施例中,所述样式参数包括标题、文本内容、图像内容以及底部四种样式。其中,所述标题为数据对象的发布者标签;所述文本内容为数据对象的书面语言的表现形式,可以为一个句子、一个段落或者一个篇章;所述图像内容为数据对象中的图形或影像;所述底部为数据对象的末尾标签,包括但不限于点赞功能标识、评论功能标识、发布时间标识。任何一个数据对象都由上述标题、底部构成,还包括文本内容和/或图像内容。图3示出了本申请实施例提供的步骤S105中计算所述数据对象对应的样式参数的实现流程,所述步骤S105包括:
在步骤S301中,对于所述标题/文本内容,获取字符大小、字符总数、字 符起始位置,根据所述字符大小、字符总数、字符起始位置计算所述数据对象中标题/文本内容的整体宽高信息。
在步骤S302中,对于所述图像内容,获取单一图像的宽高信息、图像间距、首张图像的位置信息以及图像总数,根据所述单一图像的宽高信息、图像间距、首张图像的位置信息以及图像总数计算所述数据对象中图像内容的整体宽高信息。
在本申请实施例中,任何数据对象均包括所述标题、底部,以及文本内容和/或图像内容,因此可以通过分解服务器返回的每一条Post数据中的字段信息,来获取该Post数据对应的数据对象所包括的样式参数。
其中,所述整体宽高信息分别定义了文本内容或图像内容在数据对象中的位置;所述字符大小、字符总数、字符起始位置,均定义了文本内容在数据对象中的表现方式;所述单一图像的宽高信息、图像间距、首张图像的位置信息以及图像总数,则定义了图像内容在数据对象中的表现形式。终端通过读取这些样式参数完成在列表控件上加载及显示数据对象。
在步骤S106中,按照计算得到的样式参数在所述列表可视窗口中加载并显示所述数据对象。
在计算得到样式参数之后,则根据所述样式参数在列表可视窗口中进行布局,加载并显示所述数据对象。具体请参见图1实施例中所述的步骤S104,此处不再赘述。
本申请实施例通过在获取到列表刷新指令时,判断终端本地内存中是否存在列表可视窗口内将要显示的所述数据对象对应的布局类;当且仅当判断结果为不存在布局类时,计算所述数据对象对应的样式参数,并按照所述样式参数在所述列表可视窗口中加载并显示所述数据对象;从而优化了样式参数的计算方式,避免了对数据对象重复计算样式参数,有效地降低了终端的性能损耗,使得列表控件在上下滑动时的渲染速度更快、更流畅,解决了现有技术在加载不同表现方式的数据对象时终端的性能损耗大、界面刷新流畅度低的问题。
进一步地,基于图2提供的列表控件的刷新方法的第二实现流程的基础上,提出本申请实施例提供的列表控件的刷新方法的第三实现流程。
如图4所示,是本申请实施例提供的列表控件的刷新方法的第三实现流程示意图,在计算所述数据对象对应的样式参数后,所述刷新方法还包括:
在步骤S107中,根据所述样式参数创建所述数据对象对应的布局类,并将所述布局类存储至终端内存中。
对于在列表控件上首次展示的数据对象,在计算得到所述数据对象对应的样式参数之后,创建对应的布局类,将所述样式参数作为布局类的对象保存至终端内存中,以便于再次获取到刷新指令时直接从内存中读取所述数据对象对应的布局类,完成在列表控件上的加载和显示;避免对所述数据对象重复计算样式参数,实现了一次计算多次使用的效果,减少了终端样式参数的计算次数,使得列表控件在上下滑动时的渲染速度更快、更流畅,解决了现有技术在加载不同表现方式的数据对象时终端的性能损耗大、界面刷新流畅度低的问题。
应理解,在上述实施例中,各步骤的序号的大小并不意味着执行顺序的先后,各步骤的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。
实施例2
图5示出了本申请实施例提供的列表控件的刷新装置的组成结构图,为了便于说明,仅示出了与本申请实施例相关的部分。
在本申请实施例中,所述列表控件的刷新装置用于实现上述图1、图2、图3、图4实施例中所述的列表控件的刷新方法,可以是内置于终端的软件单元、硬件单元、软硬件结合的单元,所述终端包括但不限于智能手机、平板电脑、学习机等。
参阅图5,所述列表控件的刷新装置包括:
获取模块51,用于当获取到列表刷新指令时,从服务器获取数据包,根据所述数据包获取列表可视窗口中将要展示的数据对象;
判断模块52,用于对于每一个数据对象,判断终端内存中是否存在所述数据对象对应的布局类;
读取模块53,用于若存在时,从所述终端内存中读取所存储的布局类;
加载模块54,用于从所述布局类中获取样式参数,并按照所述样式参数在所述列表可视窗口中加载并显示所述数据对象。
在这里,所述列表刷新指令为指示终端对列表控件上的数据对象进行更新的指令信息,可以通过比如对列表控件的启动操作、在列表控件上的下拉操作、上拉操作触发。在本申请实施例中,获取模块51获取到列表控件的刷新指令后,访问服务器,向服务器发送请求消息。如果服务器返回了Post数据,则将这些Post数据保存至终端,并获取每一个Post数据对应的PostID。其中,每一个Post数据对应列表控件上将要展示的一个数据对象。然后,判断模块52通过事件监听函数根据Post数据对应的PostID判断终端内存中是否存在Post数据对应的数据对象的布局类。若判断结果为存在时,读取模块53根据所述PostID读取布局类,加载模块54根据布局类中的样式参数完成加载和显示数据对象。从而实现了在终端采用懒加载的方式来展示数据对象,只要终端存储有布局类时,直接使用该布局类中的样式参数来进行加载、展示,避免了对数据对象重复计算样式参数,对于文本及图像没有固定格式的数据对象,有效地降低了终端CPU的消耗,使得列表控件在上下滑动时的渲染速度更快、更流畅,解决了现有技术在展示不同表现方式的数据对象时性能损耗大、刷新流畅度低的问题。
进一步地,所述刷新装置还包括:
计算模块55,用于若终端内存中不存在所述数据对象对应的布局类时,计算所述数据对象对应的样式参数;
所述加载模块54还用于,按照计算得到的样式参数在所述列表可视窗口中加载并显示所述数据对象。
进一步地,所述刷新装置还包括:
创建及存储模块56,用于根据所述样式参数创建所述数据对象对应的布局类,并将所述布局类存储至终端内存中。
可选地,所述样式参数包括标题、文本内容、图像内容以及底部四种样式;
所述计算模块55还用于:
对于所述标题/文本内容,获取字符大小、字符总数、字符起始位置,根据所述字符大小、字符总数、字符起始位置计算所述数据对象中标题/文本内容的整体宽高信息;
对于所述图像内容,获取单一图像的宽高信息、图像间距、首张图像的位置信息以及图像总数,根据所述单一图像的宽高信息、图像间距、首张图像的位置信息以及图像总数计算所述数据对象中图像内容的整体宽高信息。
可选地,所述加载模块54具体用于:
对于数据对象中的图像,创建imageview对象,使用picasso开源库进行加载,并根据所获取的样式参数在列表可视窗口中显示所加载的图像;
复写onTouchEvent方法;
通过所述onTouchEvent方法设置图像在onKeyDown时执行setColorFilter()函数以及图像在onKeyUp时去执行clearColorFilter()函数。
需要说明的是,本申请实施例中的各模块/单元可以用于实现上述方法实施例中的全部技术方案,其具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。
实施例3
本实施例提供一计算机可读存储介质,该计算机可读存储介质上存储有计算机可读指令,该计算机可读指令被处理器执行时实现实施例1中列表控件的 刷新方法,为避免重复,这里不再赘述。或者,该计算机可读指令被处理器执行时实现实施例2中列表控件的刷新装置中各模块/单元的功能,为避免重复,这里不再赘述。
实施例4
图6是本申请实施例提供的一种终端的示意图,所述终端包括但不限于服务器、移动终端。如图6所示,该实施例的终端6包括:处理器60、存储器61以及存储在所述存储器61中并可在所述处理器60上运行的计算机可读指令62。所述处理器60执行所述计算机可读指令62时实现上述列表控件的刷新方法实施例中的步骤,例如图1所示的步骤S101至S104、图2实施例中所述的步骤S105至S106、图3实施例中所述的步骤S301至S302以及图4实施例所述的步骤S107;或者,所述处理器60执行所述计算机可读指令62时实现上述列表控件的刷新装置实施例中各模块/单元的功能,例如图5所示模块51至56的功能。
示例性的,所述计算机可读指令62可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器61中,并由所述处理器60执行,以完成本申请。所述一个或多个模块/单元可以是能够完成特定功能的一系列计算机可读指令段,该指令段用于描述所述计算机可读指令62在所述终端6中的执行过程。例如,所述计算机可读指令62可以被分割成获取模块、判断模块、读取模块、加载模块,各模块具体功能如下:
获取模块,用于当获取到列表刷新指令时,从服务器获取数据包,根据所述数据包获取列表可视窗口中将要展示的数据对象;
判断模块,用于对于每一个数据对象,判断终端内存中是否存在所述数据对象对应的布局类;
读取模块,用于若存在时,从所述终端内存中读取所存储的布局类;
加载模块,用于从所述布局类中获取样式参数,按照所述样式参数在所述 列表可视窗口中加载并显示所述数据对象。
可选地,所述计算机可读指令62还可以分割出:
计算模块,用于若终端内存中不存在所述数据对象对应的布局类时,计算所述数据对象对应的样式参数;
所述加载模块还用于,按照计算得到的样式参数在所述列表可视窗口中加载并显示所述数据对象。
可选地,所述计算机可读指令62还可以分割出:
创建及存储模块,用于根据所述样式参数创建所述数据对象对应的布局类,并将所述布局类存储至终端内存中。
所述终端6可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。所述终端可包括,但不仅限于,处理器60、存储器61。本领域技术人员可以理解,图6仅仅是终端6的示例,并不构成对终端6的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述终端还可以包括输入输出设备、网络接入设备、总线等。
所称处理器60可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等,所述处理器是所述终端的控制中心,利用各种接口和线路连接整个终端的各个部分。
所述存储器61可用于存储所述计算机可读指令和/或模块,所述处理器通过运行或执行存储在所述存储器内的计算机可读指令和/或模块,以及调用存储在存储器内的数据,实现所述终端的各种功能。所述存储器可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据 终端的使用所创建的数据等。此外,存储器可以包括高速随机存取存储器,还可以包括非易失性存储器,例如硬盘、内存、插接式硬盘、智能存储卡(Smart Media Card,SMC)、安全数字卡(Secure Digital,SD)、闪存卡(Flash Card),至少一个磁盘存储器件、闪存器件或其他易失性固态存储器件。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,也可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一计算机可读存储介质中,该计算机可读指令在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机可读指令包括计算机可读指令代码,所述计算机可读指令代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读存储介质可以包括:能够携带所述计算机可读指令代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质等。需要说明的是,所述计算机可读存储介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如在某些司法管辖区,根据立法和专利实践,计算机可读存储介质不包括是电载波信号和电信信号。
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申 请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。

Claims (20)

  1. 一种列表控件的刷新方法,其特征在于,所述刷新方法包括:
    当获取到列表刷新指令时,从服务器获取数据包,根据所述数据包获取列表可视窗口中将要展示的数据对象;
    对于每一个数据对象,判断终端内存中是否存在所述数据对象对应的布局类;
    若存在时,从所述终端内存中读取所存储的布局类;
    从所述布局类中获取样式参数,按照所述样式参数在所述列表可视窗口中加载并显示所述数据对象。
  2. 如权利要求1所述的列表控件的刷新方法,其特征在于,所述刷新方法还包括:
    若终端内存中不存在所述数据对象对应的布局类时,计算所述数据对象对应的样式参数;
    按照计算得到的样式参数在所述列表可视窗口中加载并显示所述数据对象。
  3. 如权利要求2所述的列表控件的刷新方法,其特征在于,在计算所述数据对象对应的样式参数后,所述刷新方法还包括:
    根据所述样式参数创建所述数据对象对应的布局类,并将所述布局类存储至终端内存中。
  4. 如权利要求2或3所述的列表控件的刷新方法,其特征在于,所述样式参数包括标题、文本内容、图像内容以及底部四种样式;
    所述计算所述数据对象对应的样式参数包括:
    对于所述标题/文本内容,获取字符大小、字符总数、字符起始位置,根据所述字符大小、字符总数、字符起始位置计算所述数据对象中标题/文本内容的整体宽高信息;
    对于所述图像内容,获取单一图像的宽高信息、图像间距、首张图像的位 置信息以及图像总数,根据所述单一图像的宽高信息、图像间距、首张图像的位置信息以及图像总数计算所述数据对象中图像内容的整体宽高信息。
  5. 如权利要求1所述的列表控件的刷新方法,其特征在于,所述按照所述样式参数在所述列表可视窗口中加载并显示所述数据对象包括:
    对于数据对象中的图像,创建imageview对象,使用picasso开源库进行加载,并根据所获取的样式参数在列表可视窗口中显示所加载的图像;
    复写onTouchEvent方法;
    通过所述onTouchEvent方法设置图像在onKeyDown时执行setColorFilter()函数以及图像在onKeyUp时去执行clearColorFilter()函数。
  6. 一种列表控件的刷新装置,其特征在于,所述刷新装置包括:
    获取模块,用于当获取到列表刷新指令时,从服务器获取数据包,根据所述数据包获取列表可视窗口中将要展示的数据对象;
    判断模块,用于对于每一个数据对象,判断终端内存中是否存在所述数据对象对应的布局类;
    读取模块,用于若存在时,从所述终端内存中读取所存储的布局类;
    加载模块,用于从所述布局类中获取样式参数,按照所述样式参数在所述列表可视窗口中加载并显示所述数据对象。
  7. 如权利要求6所述的列表控件的刷新装置,其特征在于,所述刷新装置还包括:
    计算模块,用于若终端内存中不存在所述数据对象对应的布局类时,计算所述数据对象对应的样式参数;
    所述加载模块还用于,按照计算得到的样式参数在所述列表可视窗口中加载并显示所述数据对象。
  8. 如权利要求7所述的列表控件的刷新装置,其特征在于,所述刷新装置还包括:
    创建及存储模块,用于根据所述样式参数创建所述数据对象对应的布局类, 并将所述布局类存储至终端内存中。
  9. 如权利要求7或8所述的列表控件的刷新装置,其特征在于,所述样式参数包括标题、文本内容、图像内容以及底部四种样式;
    所述计算模块用于:
    对于所述标题/文本内容,获取字符大小、字符总数、字符起始位置,根据所述字符大小、字符总数、字符起始位置计算所述数据对象中标题/文本内容的整体宽高信息;
    对于所述图像内容,获取单一图像的宽高信息、图像间距、首张图像的位置信息以及图像总数,根据所述单一图像的宽高信息、图像间距、首张图像的位置信息以及图像总数计算所述数据对象中图像内容的整体宽高信息。
  10. 如权利要求6所述的列表控件的刷新装置,其特征在于,所述加载模块包括:
    对于数据对象中的图像,创建imageview对象,使用picasso开源库进行加载,并根据所获取的样式参数在列表可视窗口中显示所加载的图像;
    复写onTouchEvent方法;
    通过所述onTouchEvent方法设置图像在onKeyDown时执行setColorFilter()函数以及图像在onKeyUp时去执行clearColorFilter()函数。
  11. 一种计算机可读存储介质,其上存储有计算机可读指令,其特征在于,该计算机可读指令被处理器执行时实现如下步骤:
    当获取到列表刷新指令时,从服务器获取数据包,根据所述数据包获取列表可视窗口中将要展示的数据对象;
    对于每一个数据对象,判断终端内存中是否存在所述数据对象对应的布局类;
    若存在时,从所述终端内存中读取所存储的布局类;
    从所述布局类中获取样式参数,按照所述样式参数在所述列表可视窗口中加载并显示所述数据对象。
  12. 如权利要求11所述的计算机可读存储介质,其特征在于,该计算机可读指令被处理器执行时还实现如下步骤:
    若终端内存中不存在所述数据对象对应的布局类时,计算所述数据对象对应的样式参数;
    按照计算得到的样式参数在所述列表可视窗口中加载并显示所述数据对象。
  13. 如权利要求12所述的计算机可读存储介质,其特征在于,所述计算所述数据对象对应的样式参数,之后还包括:
    根据所述样式参数创建所述数据对象对应的布局类,并将所述布局类存储至终端内存中。
  14. 如权利要求12或13所述的计算机可读存储介质,其特征在于,所述样式参数包括标题、文本内容、图像内容以及底部四种样式;
    所述计算所述数据对象对应的样式参数,包括:
    对于所述标题/文本内容,获取字符大小、字符总数、字符起始位置,根据所述字符大小、字符总数、字符起始位置计算所述数据对象中标题/文本内容的整体宽高信息;
    对于所述图像内容,获取单一图像的宽高信息、图像间距、首张图像的位置信息以及图像总数,根据所述单一图像的宽高信息、图像间距、首张图像的位置信息以及图像总数计算所述数据对象中图像内容的整体宽高信息。
  15. 如权利要求11所述的计算机可读存储介质,其特征在于,所述按照所述样式参数在所述列表可视窗口中加载并显示所述数据对象,包括:
    对于数据对象中的图像,创建imageview对象,使用picasso开源库进行加载,并根据所获取的样式参数在列表可视窗口中显示所加载的图像;
    复写onTouchEvent方法;
    通过所述onTouchEvent方法设置图像在onKeyDown时执行setColorFilter()函数以及图像在onKeyUp时去执行clearColorFilter()函数。
  16. 一种终端,所述终端包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机可读指令,其特征在于,所述处理器执行所述计算机可读指令时实现如下步骤:
    当获取到列表刷新指令时,从服务器获取数据包,根据所述数据包获取列表可视窗口中将要展示的数据对象;
    对于每一个数据对象,判断终端内存中是否存在所述数据对象对应的布局类;
    若存在时,从所述终端内存中读取所存储的布局类;
    从所述布局类中获取样式参数,按照所述样式参数在所述列表可视窗口中加载并显示所述数据对象。
  17. 如权利要求16所述的终端,其特征在于,所述处理器执行所述计算机可读指令时还实现如下步骤:
    若终端内存中不存在所述数据对象对应的布局类时,计算所述数据对象对应的样式参数;
    按照计算得到的样式参数在所述列表可视窗口中加载并显示所述数据对象。
  18. 如权利要求17所述的终端,其特征在于,所述计算所述数据对象对应的样式参数,之后还包括:
    根据所述样式参数创建所述数据对象对应的布局类,并将所述布局类存储至终端内存中。
  19. 如权利要求17或18所述的终端,其特征在于,所述样式参数包括标题、文本内容、图像内容以及底部四种样式;
    所述计算所述数据对象对应的样式参数,包括:
    对于所述标题/文本内容,获取字符大小、字符总数、字符起始位置,根据所述字符大小、字符总数、字符起始位置计算所述数据对象中标题/文本内容的整体宽高信息;
    对于所述图像内容,获取单一图像的宽高信息、图像间距、首张图像的位置信息以及图像总数,根据所述单一图像的宽高信息、图像间距、首张图像的位置信息以及图像总数计算所述数据对象中图像内容的整体宽高信息。
  20. 如权利要求16所述的终端,其特征在于,所述按照所述样式参数在所述列表可视窗口中加载并显示所述数据对象,包括:
    对于数据对象中的图像,创建imageview对象,使用picasso开源库进行加载,并根据所获取的样式参数在列表可视窗口中显示所加载的图像;
    复写onTouchEvent方法;
    通过所述onTouchEvent方法设置图像在onKeyDown时执行setColorFilter()函数以及图像在onKeyUp时去执行clearColorFilter()函数。
PCT/CN2017/112751 2017-11-13 2017-11-24 列表控件的刷新方法、装置、存储介质及终端 WO2019090854A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201711114699.4 2017-11-13
CN201711114699.4A CN107908336B (zh) 2017-11-13 2017-11-13 列表控件的刷新方法、装置、存储介质及终端

Publications (1)

Publication Number Publication Date
WO2019090854A1 true WO2019090854A1 (zh) 2019-05-16

Family

ID=61845028

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/112751 WO2019090854A1 (zh) 2017-11-13 2017-11-24 列表控件的刷新方法、装置、存储介质及终端

Country Status (2)

Country Link
CN (1) CN107908336B (zh)
WO (1) WO2019090854A1 (zh)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108647075A (zh) * 2018-05-11 2018-10-12 阿里巴巴集团控股有限公司 应用页面的Listview刷新方法、装置和电子设备
CN109462769B (zh) * 2018-10-30 2021-03-16 武汉斗鱼网络科技有限公司 直播间挂件显示方法、装置、终端及计算机可读介质
CN109542578A (zh) * 2018-11-30 2019-03-29 北京微播视界科技有限公司 一种列表界面的显示方法、装置、设备及存储介质
CN110333920B (zh) * 2019-05-08 2022-06-17 武汉瓯越网视有限公司 一种更新图标的方法及相关装置
CN112073793A (zh) * 2019-06-11 2020-12-11 海信视像科技股份有限公司 一种图像显示方法及装置
CN110442330B (zh) * 2019-07-05 2023-07-21 五八有限公司 列表组件转换方法、装置、电子设备及存储介质
CN110457084B (zh) * 2019-07-10 2021-11-30 五八有限公司 一种加载方法及装置
CN112925474B (zh) * 2019-12-06 2023-05-23 深圳Tcl新技术有限公司 一种终端设备的控制方法、存储介质及终端设备
CN113051012B (zh) * 2021-03-18 2022-12-02 平安普惠企业管理有限公司 基于列表视图的数据加载方法、装置、设备及介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120254720A1 (en) * 2011-03-30 2012-10-04 Cbs Interactive Inc. Systems and methods for updating rich internet applications
CN105739973A (zh) * 2016-01-22 2016-07-06 深圳市盛弘电气股份有限公司 一种基于Android的UI控件自动识别刷新方法及装置
CN106445314A (zh) * 2016-09-07 2017-02-22 广东欧珀移动通信有限公司 显示界面刷新方法及装置
CN106775836A (zh) * 2016-11-29 2017-05-31 腾讯科技(深圳)有限公司 界面显示方法及界面显示装置

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4700392B2 (ja) * 2005-04-11 2011-06-15 株式会社ソニー・コンピュータエンタテインメント 情報処理装置、コンピュータの制御方法及びプログラム
CN107018171A (zh) * 2007-05-03 2017-08-04 三维实验室公司 远程配置便携式设备的用户界面的方法
CN103095556B (zh) * 2012-08-29 2016-07-06 五八同城信息技术有限公司 一种基于即时通信的列表刷新方法和装置
US9483444B2 (en) * 2013-07-09 2016-11-01 Flipboard, Inc. Dynamic layout engine for a digital magazine
CN104881298A (zh) * 2014-02-27 2015-09-02 国际商业机器公司 用于在线显示文档的方法和装置
CN104238881A (zh) * 2014-09-10 2014-12-24 北京金山安全软件有限公司 终端信息的显示方法、装置及终端
CN105872635A (zh) * 2015-12-16 2016-08-17 乐视云计算有限公司 视频资源分发的方法和装置
CN107247748B (zh) * 2017-05-24 2020-08-07 北京潘达互娱科技有限公司 页面加载方法及装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120254720A1 (en) * 2011-03-30 2012-10-04 Cbs Interactive Inc. Systems and methods for updating rich internet applications
CN105739973A (zh) * 2016-01-22 2016-07-06 深圳市盛弘电气股份有限公司 一种基于Android的UI控件自动识别刷新方法及装置
CN106445314A (zh) * 2016-09-07 2017-02-22 广东欧珀移动通信有限公司 显示界面刷新方法及装置
CN106775836A (zh) * 2016-11-29 2017-05-31 腾讯科技(深圳)有限公司 界面显示方法及界面显示装置

Also Published As

Publication number Publication date
CN107908336A (zh) 2018-04-13
CN107908336B (zh) 2019-04-19

Similar Documents

Publication Publication Date Title
WO2019090854A1 (zh) 列表控件的刷新方法、装置、存储介质及终端
WO2017107833A1 (zh) 浏览器标签内的页面切换方法及装置
TWI498821B (zh) 非暫時性之機器可讀儲存媒體及用於使韌體支援舊版作業系統之方法及電腦系統
CN113704301B (zh) 异构计算平台的数据处理方法、装置、系统、设备及介质
MX2014009068A (es) Metodo, terminal y dispositivo electronico para procesar documento de libro electronico.
KR20180019158A (ko) 동적 이미지를 프리뷰하기 위한 방법 및 디바이스, 그리고 표현 패키지를 디스플레이하기 위한 방법 및 디바이스
CN113655999B (zh) 一种页面控件的渲染方法、装置、设备及存储介质
CN107341005A (zh) 图表生成方法及其装置
CN109271247A (zh) 内存优化方法、装置、计算机装置以及存储介质
WO2017206893A1 (zh) 界面刷新同步方法、装置、终端及存储介质
CN105989012B (zh) 一种页面显示方法、装置、移动终端和系统
CN115878247A (zh) 一种前端元素适应性显示方法、装置、存储介质及系统
CN113835835B (zh) 一种创建一致性组的方法、装置、及计算机可读存储介质
WO2019114044A1 (zh) 图像处理方法、装置、电子设备及计算机可读存储介质
US20180276719A1 (en) Method and device for determining area of message operation region and electronic device
US11822882B2 (en) Automatic enhancement of paragraph justification
CN115145634A (zh) 一种系统管理软件自适配方法、装置及介质
CN114816408A (zh) 信息处理方法及装置
CN111026682B (zh) 板卡芯片的数据访存方法、装置及计算机可读存储介质
JP2012190456A (ja) グラフィック出力における重なりを回避するためにラベルを移動させる方法、システム及びコンピューター読取可能媒体
CN111090633A (zh) 一种分布式文件系统的小文件聚合方法、装置及设备
CN111625192B (zh) 一种元数据对象访问方法、装置、设备以及介质
CN112395036B (zh) 页面渲染方法及系统
CN112269538B (zh) 一种数据读取方法、装置、设备及介质
US20220028135A1 (en) Pixel-based techniques for combining vector graphics shapes

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17931702

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 13.08.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 17931702

Country of ref document: EP

Kind code of ref document: A1