CN111580810A - Method, device, mobile terminal and storage medium for realizing active paging - Google Patents

Method, device, mobile terminal and storage medium for realizing active paging Download PDF

Info

Publication number
CN111580810A
CN111580810A CN202010233926.0A CN202010233926A CN111580810A CN 111580810 A CN111580810 A CN 111580810A CN 202010233926 A CN202010233926 A CN 202010233926A CN 111580810 A CN111580810 A CN 111580810A
Authority
CN
China
Prior art keywords
data
current page
list
data corresponding
list data
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202010233926.0A
Other languages
Chinese (zh)
Inventor
周志文
纪向晴
黄杰
陈俊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Mapgoo Technology Co ltd
Original Assignee
Shenzhen Mapgoo Technology Co ltd
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 Shenzhen Mapgoo Technology Co ltd filed Critical Shenzhen Mapgoo Technology Co ltd
Priority to CN202010233926.0A priority Critical patent/CN111580810A/en
Publication of CN111580810A publication Critical patent/CN111580810A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/36Software reuse
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Abstract

The embodiment of the invention discloses a method, a device, a mobile terminal and a storage medium for realizing active paging, wherein the method comprises the following steps: automatically increasing the number of pages to obtain the data of the current page; acquiring the number of list data corresponding to the current page code data; judging whether a pull-down refreshing operation exists or not, and if so, loading and acquiring list data corresponding to the current page code data; otherwise, judging whether the number of the list data corresponding to the acquired current page code data is smaller than the displayable data number of one page, if so, not loading and displaying more data, and if not, loading and displaying more data. The invention avoids complex logic of realizing paging in the list page, reduces unnecessary code writing and improves the code reuse rate.

Description

Method, device, mobile terminal and storage medium for realizing active paging
Technical Field
The present invention relates to the field of mobile terminals, and in particular, to a method and an apparatus for implementing active paging, a mobile terminal, and a computer-readable storage medium.
Background
At present, in a mobile phone App, list data is a very common data expression form, and is generally implemented by recycleview and baserecycleview adapter, but does not provide a paging function. In the prior art, manual paging is generally adopted, a second page of data is requested and then added to a BaseRecyclerViewAdapterHelper helper, and when a page is pulled down for refreshing, the data in the BaseRecyclerViewAdapterHelper is manually controlled to be replaced by the first page of data, and whether the data is completely loaded or not needs to be manually judged. And each list page needs to be repeatedly operated, so that the code reuse rate is low, and the original logic of the list page codes is influenced.
Disclosure of Invention
In view of the above technical problems, embodiments of the present invention provide a method, an apparatus, a mobile terminal, and a storage medium for implementing active paging, so as to improve the code reuse rate.
The embodiment of the invention provides a method for realizing active paging, which comprises the following steps: automatically increasing the number of pages to obtain the data of the current page; acquiring the number of list data corresponding to the current page code data; judging whether a pull-down refreshing operation exists or not, and if so, loading and acquiring list data corresponding to the current page code data; otherwise, judging whether the number of the list data corresponding to the acquired current page code data is smaller than the displayable data number of one page, if so, not loading and displaying more data, and if not, loading and displaying more data.
Optionally, the determining whether there is a pull-down refresh operation, and if so, the step of loading and acquiring list data corresponding to the current page code data further includes: if the pull-down refreshing operation does not exist, judging whether the quantity of the list data corresponding to the acquired current page number is greater than 0; and if so, splicing and loading the list data corresponding to the current page code data.
Optionally, the splicing adopts an Android system method.
Optionally, the step of determining whether the number of list data corresponding to the acquired current page code data is less than the displayable number of data for one page includes: the number of data which can be displayed on one page is set to be M in advance, and whether the number of list data corresponding to the acquired current page code data is less than M is judged.
The present invention also provides an apparatus for implementing active paging, which is applied to the method for implementing active paging as claimed in any of the above claims, and the apparatus includes: the acquisition module is used for acquiring the current page code data and acquiring the number of list data corresponding to the current page code data; the judging module is used for judging whether a pull-down refreshing operation exists or not and judging whether the number of list data corresponding to the acquired current page code data is less than the number of data which can be displayed on one page or not; the execution module loads and acquires list data corresponding to the current page code data if a pull-down refreshing operation exists; and if the quantity of the list data corresponding to the acquired current page code data is less than the quantity of the data which can be displayed on one page, no more data is loaded and displayed.
The invention also provides a mobile terminal comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the method of implementing active paging as claimed in any one of the preceding claims.
The invention also provides a computer-readable storage medium, which when executed by a processor implements the steps of the method according to any one of the preceding claims.
According to the method for realizing active paging, provided by the embodiment of the invention, current page code data and the number of list data are acquired in a subclass after a BaseRecyclerViewAdapter helper is inherited, whether a pull-down operation exists or not and whether the number of the list data can be displayed in one page or not are judged, so that whether more data are loaded and displayed or not is determined, and therefore, compared with the prior art, the method for realizing active paging avoids complex logic of paging in a list page, reduces unnecessary code writing and improves the reuse rate of codes.
Drawings
FIG. 1 is a flowchart illustrating an embodiment of a method for implementing active paging according to the present invention;
FIG. 2 is a flowchart illustrating a method for implementing active paging according to another embodiment of the present invention;
FIG. 3 is a schematic structural diagram of an apparatus for implementing active paging according to the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The invention provides a method for realizing active paging, which inherits list data, page number data, each page data, whether a pull-down refreshing instruction exists or not and the like acquired in a subclass after a BaseRecyclerViewAdapter helper. BaseRecyclerViewAdapter helper: an adapter for loading a list for populating corresponding data into a reusable view in a swipe for display of the list.
Referring to fig. 1, a flow chart of an embodiment of a method for implementing active paging according to the present invention is shown, in which active paging is mainly performed on a subclass of a BaseRecyclerViewAdapterHelper, and the method includes:
step S10, automatically increasing the number of pages to obtain the current page data. Specifically, in page editing, a flag bit for identifying a page is added by one on the basis of the last time, new page data is formed after assignment, and the page code is used for specifying a code used in a request so as to avoid messy codes generated by the acquired data.
Step S20, the number of list data corresponding to the current page data is acquired. In the above steps, the re-edited page number, that is, the current page number data, is transmitted to the obtaining module, and the obtaining module obtains the number of the list data corresponding to the current page number according to the current page number.
In step S30, it is determined whether a pull-down refresh operation is performed. If yes, go to step S40, otherwise, go to step S50.
Judging whether refreshing exists, namely two conditions exist when the first page paging is requested, wherein the first condition is automatic refreshing, namely automatic loading when the page is opened, and the second condition is that the first page data is refreshed by pulling down, so as to judge whether refreshing exists.
The pull-down refresh is specifically to release the list after the pull-down list reaches a certain displacement, the list rebounds and reloads, whether a paging request exists is judged by judging whether the pull-down refresh exists, when the pull-down refresh exists, the paging request exists is judged, the current page code data and the number of the list data corresponding to the current page code data are received, if the pull-down refresh operation exists, namely the paging request exists, the step S40 is executed, otherwise, the step S50 is executed.
In an embodiment of the present invention, please refer to fig. 2, which is a flowchart illustrating another embodiment of a method for implementing active paging according to the present invention, wherein the step S30 of determining whether there is a pull-down refresh operation further includes:
if there is no pull-down refresh operation, step S31 is executed.
Step S31, judging whether the number of the list data corresponding to the acquired current page number is more than 0; if yes, indicating that the list data needs to be loaded, executing step S32, splicing and loading the list data corresponding to the current page code data;
otherwise, indicating that no list data needs to be loaded, step S50 is performed.
In the above embodiment of the present invention, the splicing adopts an Android system method.
Step S40, the list data corresponding to the current page data is loaded and acquired. In the above steps of the embodiment, if it is determined that there is a paging request, the list data corresponding to the current page code data is loaded.
Step S50, determining whether the number of list data corresponding to the acquired current page code data is less than the displayable data number of one page, if yes, executing step S60, otherwise, executing step S70.
In one embodiment of the present invention, the step of determining whether the number of list data corresponding to the acquired current page code data is less than the displayable number of one page includes:
the number of data which can be displayed on one page is set to be M in advance, and whether the number of list data corresponding to the acquired current page code data is less than M is judged. For example, if the number of data displayable on one page is 20, it is determined whether the number of list data corresponding to the current page number is less than 20, and if the number of data corresponding to the current page number is less than 20, it indicates that the current list data is less than one page of data, and the data can be displayed on one page.
Step S60, no more data is loaded for display. In the invention, if the number of the list data corresponding to the current page code data is less than the displayable data number of one page, the current list data is less than one page of data, and can be displayed in one page without loading and displaying more data.
Step S70, load display more data. In the above embodiment, if the number of the list data corresponding to the current page code data is greater than the number of data that can be displayed in one page, it indicates that the current list data is greater than one page of data, and the current list data cannot be displayed in one page, and more data needs to be loaded and displayed.
The invention provides a method for realizing active paging, which provides a subclass inherited to a BaseRecyclerViewAdapter helper and automatically judges paging logic according to current page code data, paging requests and whether pull-down refreshing exists in the subclass. Therefore, after the list page requests the list data, only the list data, the page code data, the paging requests, the paging data quantity and whether the pull-down refreshing is performed or not need to be transmitted to the subclasses, and the operation of automatically loading the pages in the subclasses can be realized. The complex logic of realizing paging in the list page is avoided, unnecessary code writing is reduced, and the code reuse rate is improved.
Referring to fig. 3, a schematic structural diagram of an apparatus for implementing active paging according to the present invention is shown, where the apparatus includes an obtaining module 10, a determining module 20, and an executing module 30, where,
an obtaining module 100, configured to obtain current page code data and obtain the number of list data corresponding to the current page code data;
the judging module 200 is configured to judge whether a pull-down refresh operation is performed and judge whether the number of list data corresponding to the acquired current page code data is smaller than the number of data displayable on one page;
the execution module 300 loads and acquires list data corresponding to the current page code data if a pull-down refresh operation exists; and if the quantity of the list data corresponding to the acquired current page code data is less than the quantity of the data which can be displayed on one page, no more data is loaded and displayed.
One embodiment of the present invention further provides a mobile terminal, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the computer program is executed by the processor, the steps of the method for implementing active paging according to any of the above embodiments are implemented.
One embodiment of the present invention further provides a computer readable storage medium, and the computer program, when executed by a processor, implements the steps of the method for implementing active paging according to any of the above embodiments.
The above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (7)

1. A method for implementing active paging, the method comprising:
automatically increasing the number of pages to obtain the data of the current page;
acquiring the number of list data corresponding to the current page code data;
judging whether a pull-down refreshing operation exists or not, and if so, loading and acquiring list data corresponding to the current page code data;
otherwise, judging whether the number of the list data corresponding to the acquired current page code data is smaller than the displayable data number of one page, if so, not loading and displaying more data, and if not, loading and displaying more data.
2. The method for implementing active paging as claimed in claim 1, wherein the step of determining whether there is a pull-down refresh operation, and if so, the step of loading and acquiring list data corresponding to current page data further comprises:
if the pull-down refreshing operation does not exist, judging whether the quantity of the list data corresponding to the acquired current page number is greater than 0;
and if so, splicing and loading the list data corresponding to the current page code data.
3. The method for implementing active paging as claimed in claim 2, wherein the splicing employs an Android system method.
4. The method for implementing active paging as claimed in claim 1, wherein the step of determining whether the number of list data corresponding to the acquired current page data is less than the number of data displayable for one page comprises:
the number of data which can be displayed on one page is set to be M in advance, and whether the number of list data corresponding to the acquired current page code data is less than M is judged.
5. An apparatus for implementing active paging, applied to the method for implementing active paging according to any one of claims 1 to 4, the apparatus comprising:
the acquisition module is used for acquiring the current page code data and acquiring the number of list data corresponding to the current page code data;
the judging module is used for judging whether a pull-down refreshing operation exists or not and judging whether the number of list data corresponding to the acquired current page code data is less than the number of data which can be displayed on one page or not;
the execution module loads and acquires list data corresponding to the current page code data if a pull-down refreshing operation exists; and if the quantity of the list data corresponding to the acquired current page code data is less than the quantity of the data which can be displayed on one page, no more data is loaded and displayed.
6. A mobile terminal, characterized in that it comprises a memory, a processor and a computer program stored on the memory and executable on the processor, which computer program, when executed by the processor, implements the steps of the method of implementing active paging according to any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that the computer program realizes the steps of the method according to any of claims 1-4 when executed by a processor.
CN202010233926.0A 2020-03-30 2020-03-30 Method, device, mobile terminal and storage medium for realizing active paging Pending CN111580810A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010233926.0A CN111580810A (en) 2020-03-30 2020-03-30 Method, device, mobile terminal and storage medium for realizing active paging

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010233926.0A CN111580810A (en) 2020-03-30 2020-03-30 Method, device, mobile terminal and storage medium for realizing active paging

Publications (1)

Publication Number Publication Date
CN111580810A true CN111580810A (en) 2020-08-25

Family

ID=72111444

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010233926.0A Pending CN111580810A (en) 2020-03-30 2020-03-30 Method, device, mobile terminal and storage medium for realizing active paging

Country Status (1)

Country Link
CN (1) CN111580810A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112528189A (en) * 2020-12-23 2021-03-19 平安普惠企业管理有限公司 Data-based component packaging method and device, computer equipment and storage medium
CN112540823A (en) * 2020-12-25 2021-03-23 杭州智聪网络科技有限公司 Micro-page paging method for modular loading

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109840115A (en) * 2017-11-27 2019-06-04 中移(杭州)信息技术有限公司 RecyclerView paging loading method and device in a kind of android system
CN110457613A (en) * 2019-05-24 2019-11-15 平安普惠企业管理有限公司 Page data loading control method, device, computer equipment and storage medium
CN110866202A (en) * 2019-11-15 2020-03-06 成都知道创宇信息技术有限公司 Front-end paging method and device and readable storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109840115A (en) * 2017-11-27 2019-06-04 中移(杭州)信息技术有限公司 RecyclerView paging loading method and device in a kind of android system
CN110457613A (en) * 2019-05-24 2019-11-15 平安普惠企业管理有限公司 Page data loading control method, device, computer equipment and storage medium
CN110866202A (en) * 2019-11-15 2020-03-06 成都知道创宇信息技术有限公司 Front-end paging method and device and readable storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112528189A (en) * 2020-12-23 2021-03-19 平安普惠企业管理有限公司 Data-based component packaging method and device, computer equipment and storage medium
CN112540823A (en) * 2020-12-25 2021-03-23 杭州智聪网络科技有限公司 Micro-page paging method for modular loading
CN112540823B (en) * 2020-12-25 2023-05-23 杭州智聪网络科技有限公司 Micro page paging method for componentized carrying

Similar Documents

Publication Publication Date Title
CN108804483B (en) Rendering method of cell page, server and computer-readable storage medium
CN103914322A (en) Terminal acceleration method and terminal
CN111580810A (en) Method, device, mobile terminal and storage medium for realizing active paging
CN109901881B (en) Plug-in loading method and device of application program, computer equipment and storage medium
CN106055612B (en) Data paging display method and terminal equipment
CN102520918A (en) Method and device for increasing list refreshing frequency
US9619102B2 (en) Method and apparatus for presenting images, mobile terminal and computer storage medium
CN112287257A (en) Page display method and device, electronic equipment and storage medium
US20190294450A1 (en) Method for Interface Refresh Synchronization,Terminal Device, and Non-Transitory Computer-Readable Storage Medium
CN111782304A (en) Logic control method and device for paging loading data, computer equipment and medium
CN111651700A (en) Message display method and device, electronic equipment and storage medium
CN105354090A (en) Management method and device of virtual equipment
CN109840113B (en) Application data processing method and equipment, storage medium and terminal thereof
CN106933613B (en) APP page loading method and device
CN114928603A (en) Client software upgrading method and device, electronic equipment and medium
CN106708605B (en) Method and device for detecting resource leakage
CN109446462B (en) Page-based data monitoring processing method, device, equipment and storage medium
CN110597700A (en) Server testing method and device
CN110968365B (en) Loading method and device
CN113268266B (en) Multi-version coexistence management method, system and medium for applet rendering framework
CN113076725A (en) Method and terminal for popularizing third-party software based on PPT
CN110377381B (en) List refreshing method and device for information system
CN114356799A (en) Data storage method, device, system and computer readable storage medium
CN109213479B (en) Webpage pull-down refreshing display method, storage medium, electronic device and system
CN114090533A (en) Volume capacity information management method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200825