CN111309325A - Method and device for reference of third-party library and mobile terminal - Google Patents

Method and device for reference of third-party library and mobile terminal Download PDF

Info

Publication number
CN111309325A
CN111309325A CN202010074797.5A CN202010074797A CN111309325A CN 111309325 A CN111309325 A CN 111309325A CN 202010074797 A CN202010074797 A CN 202010074797A CN 111309325 A CN111309325 A CN 111309325A
Authority
CN
China
Prior art keywords
pull
view control
party library
refresh
layout
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.)
Granted
Application number
CN202010074797.5A
Other languages
Chinese (zh)
Other versions
CN111309325B (en
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.)
Shanghai Junzheng Network Technology Co Ltd
Original Assignee
Shanghai Junzheng Network 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 Shanghai Junzheng Network Technology Co Ltd filed Critical Shanghai Junzheng Network Technology Co Ltd
Priority to CN202010074797.5A priority Critical patent/CN111309325B/en
Publication of CN111309325A publication Critical patent/CN111309325A/en
Application granted granted Critical
Publication of CN111309325B publication Critical patent/CN111309325B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/38Creation or generation of source code for implementing user interfaces
    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a method, a device and a mobile terminal for third-party library reference, aiming at finding a more effective implementation scheme for third-party library reference, wherein the method comprises the following steps: creating a local view control and enabling the local view control to inherit a third-party view control in a third-party library; defining a refreshing layout adapter interface and creating a method to enable the local view control to realize refreshing of the layout adapter interface; the native view control is used in the layout file of an Activity to cause the Activity to hold a refresh layout adapter interface. According to the method and the device, the created local view control inherits the third-party library and the exchange of the third-party library is realized in the Activity without perception in a mode of refreshing the layout adapter interface, so that the modification of all related layouts and pages is avoided to a certain extent, and the development efficiency is improved.

Description

Method and device for reference of third-party library and mobile terminal
Technical Field
The invention relates to the field of mobile communication, in particular to a method and a device for third-party library reference and a mobile terminal.
Background
Most existing applications use a pull-down to refresh the pull-up load library, and most of the applications will refer to the third party library directly in the layout. If the code directly holds the reference of the third-party library, all relevant layout and page modifications have to be performed when other pull-down refresh pull-up load libraries are replaced, so that the development efficiency is reduced.
Disclosure of Invention
In order to find a more effective implementation scheme for the reference of the third-party library, the invention provides a method and a device for the reference of the third-party library and a mobile terminal.
The first scheme is as follows:
a method for providing a third-party library reference comprises the following steps:
creating a local view control, and enabling the local view control to inherit a third-party view control which is used for realizing pull-down refreshing and pull-up loading in a third-party library;
defining a refresh layout adapter interface and creating a method for realizing pull-down refresh and pull-up loading view control in the refresh layout adapter interface, so that the local view control realizes the refresh layout adapter interface;
using the native view control in an Activity's layout file to cause Activity to hold the refresh layout adapter interface.
Preferably, after the local view control is used in the layout file of Activity, the method includes the following steps:
and when the third-party library is replaced by a new third-party library, the local view control is switched to inherit the new third-party view control which is used for realizing pull-down refreshing and pull-up loading in the new third-party library, and the local view control after switching inherits realizes the refreshing layout adapter interface.
Preferably, the method for implementing the pull-down refresh pull-up load view control includes one or more of the following:
automatically starting refreshing;
setting pull-down refresh monitoring;
setting to load more snoops;
transitioning the page to a complete refresh style;
enabling the page to show a style that is completely loaded and has no more data;
enabling the page to display the finished loading style;
mark no more data;
setting allows more loads;
setting allows for automatic triggering of loading more operations;
setting permission to trigger pull-down refresh;
whether the setting is visible.
Preferably, after the local view control is used in the layout file of Activity, the method includes the following steps:
setting the page number of the first page as a starting page number according to a preset page number format based on the monitored callback of the pull-down refresh; sending a home page request and receiving home page request data corresponding to the home page request;
and clearing original data in the list control, adding the first page request data again, and informing the list control of updating.
Preferably, after the local view control is used in the layout file of Activity, the method includes the following steps:
sending a data request and receiving response data corresponding to the data request based on the monitored call-back of the pull-up loading;
analyzing the response data, and identifying whether a response list is empty;
and if not, the response data is recovered to the end of the list control, and the list control is notified to update.
Preferably, after the local view control is used in the layout file of Activity, the method includes the following steps:
and identifying user instruction information according to the current page number information.
Preferably, the identifying the user instruction information according to the current page number information includes the steps of:
judging whether the current page number is a starting page number;
if yes, the user instruction information is in pull-down refreshing;
if not, the user instruction information is pull-up loading.
Scheme II:
an apparatus for providing a third-party library reference, the apparatus for the third-party library reference comprising:
the creation inheritance module is used for creating a local view control and enabling the local view control to inherit a third-party view control which is used for realizing pull-down refreshing and pull-up loading in a third-party library;
an adaptation implementation module, configured to define a refresh layout adapter interface and create a method for implementing pull-down refresh and pull-up loading of a view control in the refresh layout adapter interface, so that the local view control implements the refresh layout adapter interface;
and the using module is used for using the local view control in the layout file of the Activity so that the Activity holds the refresh layout adapter interface.
Preferably, the third-party library reference device comprises:
and the replacement conversion module is used for enabling the local view control to inherit the new third-party view control which is used for realizing pull-down refreshing and pull-up loading in the new third-party library in the conversion after the local view control is used in the Activity layout file and when the third-party library is replaced by the new third-party library, and enabling the converted and inherited local view control to realize the refreshing layout adapter interface.
Preferably, the method for implementing the pull-down refresh pull-up load view control includes one or more of the following:
automatically starting refreshing;
setting pull-down refresh monitoring;
setting to load more snoops;
transitioning the page to a complete refresh style;
enabling the page to show a style that is completely loaded and has no more data;
enabling the page to display the finished loading style;
mark no more data;
setting allows more loads;
setting allows for automatic triggering of loading more operations;
setting permission to trigger pull-down refresh;
whether the setting is visible.
Preferably, the third-party library reference device comprises:
the pull-down module is used for setting the page number of the first page as the initial page number according to a preset page number format based on the monitored pull-down refresh callback after the local view control is used in the Activity layout file; sending a home page request and receiving home page request data corresponding to the home page request;
and the re-adding module is used for emptying the original data in the list control, re-adding the data by using the home page request data and informing the list control of updating.
Preferably, the third-party library reference device comprises:
the pull-up module is used for sending a data request and receiving response data corresponding to the data request based on a callback of monitored pull-up loading after the local view control is used in an Activity layout file;
the analysis identification module is used for analyzing the response data and identifying whether the response list is empty or not;
and the adding module is used for adding the response data back to the list control without the tail when the response list is not empty, and informing the list control to update.
Preferably, the third-party library reference device comprises:
and the instruction identification module is used for identifying the user instruction information according to the current page number information after the local view control is used in the Activity layout file.
Preferably, the instruction recognition module includes:
the judging unit is used for judging whether the current page number is a starting page number;
the pull-down instruction unit is used for refreshing the user instruction information in a pull-down mode if the current page number is the initial page number;
and the pull-up instruction unit is used for loading the user instruction information in a pull-up mode if the current page number is not the initial page number.
The third scheme is as follows:
there is provided a mobile terminal including:
one or more processors;
a memory;
one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform a method of third party library referencing as in any of scenario one.
Compared with the prior art, the method, the device and the mobile terminal for the third-party library reference have the following beneficial effects:
according to the method, the device and the mobile terminal for the third-party library reference, the created local view control inherits the third-party library and the exchange of the third-party library is realized in the Activity in an imperceptible mode by means of a mode of refreshing the layout adapter interface, so that the modification of all related layouts and pages is avoided to a certain extent, and the development efficiency is improved.
The scheme provided by the invention has the advantages that the change of the existing system is small, the compatibility of the system is not influenced, and the realization is simple and efficient.
Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
The foregoing and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 is a flow chart illustrating a method for third-party library referencing according to an embodiment of the present invention;
FIG. 2 is a block diagram of an apparatus referenced by a third-party library according to another embodiment of the present invention;
fig. 3 is a schematic structural diagram of a module of a mobile terminal according to another embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, 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.
In some of the flows described in the present specification and claims and in the above figures, a number of operations are included that occur in a particular order, but it should be clearly understood that these operations may be performed out of order or in parallel with the order in which they occur, the order of the operations being 202, 204, etc. merely to distinguish between various operations, the order of which does not itself represent any order of performance. Additionally, the flows may include more or fewer operations, and the operations may be performed sequentially or in parallel. It should be noted that, the descriptions of "first", "second", etc. in this document are used for distinguishing different messages, devices, modules, etc., and do not represent a sequential order, nor limit the types of "first" and "second" to be different.
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.
In one embodiment, the present invention provides a method for third party library referencing, which is applied to the field of device and server interaction and device display, wherein the device is preferably a network-enabled electronic device, such as a mobile phone, a computer, a tablet computer, a smart watch, a personal digital assistant, and the like.
Referring to fig. 1, fig. 1 is a schematic flow chart illustrating a method for referring to a third-party library according to an embodiment of the present invention, and as shown in fig. 1, the method for referring to a third-party library according to an embodiment of the present invention includes steps S101 to S105, which are as follows:
step S101: and creating a local view control, and enabling the local view control to inherit a third-party view control which is used for realizing pull-down refreshing and pull-up loading in a third-party library.
The android system provides three ways for a developer to design a User Interface (UI), including a layout file control UI, a code control UI and a mixed control UI, wherein the layout file control UI is an eXtensible Markup Language (XML) file compiling Interface, a layout type and a control are added, resources used in the layout are added into a resource file, and the layout file is loaded in the Activity of the android program; the code control UI is used for writing an operation code in Activity to realize the operation of a control, is in non-visual design and is suitable for the condition of simpler interface; the hybrid control UI combines the layout file control UI and the code control UI, namely, in the initial interface, the unchanged interface elements, the layout file, the frequently changed interface elements and the code control are used, and the operation codes are written in the Activity to realize the operation of the control.
In order to facilitate understanding of the method for third-party library reference according to the embodiment of the present invention, the embodiment of the present invention is explained and explained with a layout file control UI, and it should be understood that the method for third-party library reference according to the embodiment of the present invention may also be applied to a hybrid control UI.
In the android system, the control inherits from View, which is the base class of all controls in the android, and can complete a specific function class. In the embodiment of the invention, the local View control is a self-defined control, and the View is also the base class of the local View control.
For example, assuming that AView represents a View control specifically implementing a pull-down refresh and pull-up loading function, and bvew is a local View control, the local View control inherits a third-party View control in a third-party library for implementing pull-down refresh and pull-up loading, that is, the bvew inherits AView. It should be explained that the keyword inherited in the android system is extensions, and the new class inherits the state and behavior of the general class and adds its own new state and behavior as needed. The class resulting from inheritance is called a subclass, and the inherited class is called a parent class.
Step S103: defining a refresh layout adapter interface and creating a method for realizing pull-down refresh and pull-up loading view control in the refresh layout adapter interface, so that the local view control realizes the refresh layout adapter interface; the meaning of the Interface (Interface) is different from the Interface represented by I of a Graphical User Interface (GUI), and the Interface is an abstract class and is a class that cannot be initialized.
In some embodiments, a method for implementing a pull-down refresh pull-up load view control includes one or more of:
automatically starting refreshing;
setting pull-down refresh monitoring;
setting to load more snoops;
transitioning the page to a complete refresh style;
enabling the page to show a style that is completely loaded and has no more data;
enabling the page to display the finished loading style;
mark no more data;
setting allows more loads;
setting allows for automatic triggering of loading more operations;
setting permission to trigger pull-down refresh;
whether the setting is visible.
Specifically, the refresh layout adapter interface is defined as follows:
Figure BDA0002378005480000081
Figure BDA0002378005480000091
Figure BDA0002378005480000101
it should be noted that the refresh layout adapter interface is implemented by a local View control, that is, the Bview in the example represents the View control implementing the refresh layout adapter interface.
Step S105: using the native view control in an Activity's layout file to cause Activity to hold the refresh layout adapter interface.
Specifically, the Activity layout file is preferably Activity _ main _ xml, so that after the BView control is found in the Activity, the BView control can be converted into a refreshed layout adapter interface, and then the interface is held, that is, the Activity does not depend on the BView control but the Aview control, thereby achieving the decoupling purpose.
In some embodiments, in order to solve the problem of replacement of a third-party library, a method for referencing by a third-party library according to an embodiment of the present invention includes, after using a local view control in a layout file of Activity, the following steps:
and when the third-party library is replaced by a new third-party library, the local view control is switched to inherit the new third-party view control which is used for realizing pull-down refreshing and pull-up loading in the new third-party library, and the local view control after switching inherits realizes the refreshing layout adapter interface.
In some embodiments, the replacement of the third-party library by the new third-party library may be an active replacement or a passive replacement, which is not limited in this embodiment of the present invention.
Exemplarily, assuming that CView represents a View control which is used in a new third-party library and realizes a pull-down refresh pull-up loading function in a pull-down refresh pull-up loading library, at this time, only the bvew control needs to be converted and inherited to the CView control and realizes a refresh layout adapter interface again indirectly based on the CView control, and all of the components are in a layout file, so that the conversion of the third-party library is realized without perception in Activity, the modification of all related layouts and pages is avoided to a certain extent, and the development efficiency is improved.
In order to solve the problem of user instruction identification, the method for third-party library reference according to the embodiment of the present invention further includes the following steps after the local view control is used in the Activity layout file:
and identifying user instruction information according to the current page number information.
Specifically, the step of identifying the user instruction information according to the current page number information comprises the following steps:
judging whether the current page number is a starting page number;
if yes, the user instruction information is in pull-down refreshing;
if not, the user instruction information is pull-up loading.
In some embodiments, the current page number may be obtained through a preset interface and a class implementing the interface. For example, assuming that the current page number is page, the method in the defined preset interface is getpage (). It should be noted that, in different programming languages, the preset interfaces and the types of implementation interfaces may be different, and the embodiment of the present invention is not limited thereto.
In order to solve the problem of pull-down refresh of a third-party library, the method for referencing the third-party library in the embodiment of the present invention includes the following steps after a local view control is used in an Activity layout file:
setting the page number of the first page as a starting page number according to a preset page number format based on the monitored callback of the pull-down refresh; sending a home page request and receiving home page request data corresponding to the home page request;
and clearing original data in the list control, requesting data to be added again by using the home page, and informing the list control to update.
In some embodiments, prior to the callback of the snoop-based pull-down refresh, the following steps are included: initializing the native view control and refreshing the layout adapter interface.
It is noted that when the original data in the list control is empty, it needs to be cleared so that the first page requests the data to be added again.
In order to solve the problem of pull-up loading, the method for third-party library referencing according to the embodiment of the present invention includes the following steps after the local view control is used in an Activity layout file:
sending a data request and receiving response data corresponding to the data request based on the monitored call-back of the pull-up load;
analyzing the response data, and identifying whether the response list is empty;
if not, the response data is traced back to the end of the list control, and the list control is notified to update.
In order to solve different effects of the same library, the method for referencing by a third-party library according to the embodiment of the present invention may further define a refresh layout factory interface, which is used to define initialization of the refresh layout adapter, an operation behavior of the refresh layout adapter after the network request is finished, and the like. If different pull-down refreshing pull-up loading implementation styles are needed in different service scenes, only different refreshing layout factory interface implementation classes need to be provided.
It is noted that, in a process of implementing a method for third-party library referencing according to an embodiment of the present invention, the following interfaces and classes for implementing the interfaces are defined. It should be noted that the following embodiments are not the only implementations of the embodiments of the present invention, and that several modifications and alterations can be made by those skilled in the art without departing from the principle of the present invention according to their own language or programming convention, and these modifications and alterations should also be construed as the protection scope of the present invention.
A generic paging interface is defined: the method is used for processing behaviors related to the paging request, such as acquisition of a current page, and different distribution interface implementation classes can be provided according to specific service scenes when the method is used;
a refresh construct class is defined and implemented: the initialization sequence is used for solidifying the paging interface realization class and refreshing the layout adapter interface realization class;
a list control adapter interface is defined: adapter behaviors of list controls such as ListView and RecyclerView are abstracted uniformly;
a pull-down refresh snoop adapter interface is defined: an operation for listening for a pull-down refresh;
one load more snoop adapter interface is defined: an operation for listening for a pull-up load;
a network request interface is defined: for initiating a specific network request, often implemented by Activity;
a network response interface is defined: the method is used for uniformly processing relevant logics after the network request is completed, such as informing of refreshing layout updating, updating of the state of a paging interface implementation class and the like;
a director interface is defined: the system is used for finishing the initialization of the refreshing layout, starting the pull-down refreshing, receiving the response of the network request success, and the like;
a director interface implementation class is defined and implemented: an implementation of a director interface in a generic scenario is provided. The implementation class can be directly used in most scenes, and if other special scenes exist, other implementation classes of the director interface can be provided according to specific service scenes.
It is to be noted that, in actual use, Activity generally only needs to call a director interface, and a specific application process thereof may be performed in a conventional manner by a person skilled in the art, and details of the embodiment of the present invention are not described herein.
In some embodiments, when the network request is completed, the refresh layout method in the refresh layout factory interface is notified to update, and the state related to the generic paging interface implementation class is updated.
Compared with the prior art, the method for the third-party library reference in the embodiment of the invention has the following beneficial effects:
according to the method for the third-party library reference, the created local view control inherits the third-party library and the exchange of the third-party library is realized in the Activity in a mode of refreshing the layout adapter interface, so that the modification of all related layouts and pages is avoided to a certain extent, and the development efficiency is improved.
Referring to fig. 2, based on the same inventive concept as the third-party library referencing method according to the embodiment of the present invention, another embodiment of the present invention provides a third-party library referencing apparatus, where the third-party library referencing apparatus includes:
an inheriting module 2002 for creating a local view control and making the local view control inherit a third-party view control in a third-party library for realizing pull-down refresh and pull-up loading;
an adaptation implementation module 2004, configured to define a refresh layout adapter interface and create a method for implementing pull-down refresh and pull-up loading of a view control in the refresh layout adapter interface, so that the local view control implements the refresh layout adapter interface;
a module 2006 is used for using the native view control in the layout file of an Activity to cause the Activity hold to refresh the layout adapter interface.
In some embodiments, the third party library referenced apparatus comprises:
and the replacement conversion module is used for enabling the local view control to inherit the new third-party view control which is used for realizing pull-down refreshing and pull-up loading in the new third-party library in the conversion after the local view control is used in the Activity layout file and when the third-party library is replaced by the new third-party library, and enabling the local view control after the conversion inherits to realize the refreshing layout adapter interface.
Preferably, the method for implementing the pull-down refresh pull-up load view control comprises one or more of the following:
automatically starting refreshing;
setting pull-down refresh monitoring;
setting to load more snoops;
transitioning the page to a complete refresh style;
enabling the page to show a style that is completely loaded and has no more data;
enabling the page to display the finished loading style;
mark no more data;
setting allows more loads;
setting allows for automatic triggering of loading more operations;
setting permission to trigger pull-down refresh;
whether the setting is visible.
In some embodiments, the third party library referenced apparatus comprises:
the pull-down module is used for setting the page number of the first page as the initial page number according to a preset page number format based on the monitored pull-down refresh callback after the local view control is used in the Activity layout file; sending a home page request and receiving home page request data corresponding to the home page request;
and the re-adding module is used for emptying the original data in the list control, requesting data to be added again by using the home page and notifying the list control to be updated.
In some embodiments, the third party library referenced apparatus comprises:
the pull-up module is used for sending a data request and receiving response data corresponding to the data request based on a callback of monitored pull-up loading after a local view control is used in an Activity layout file;
the analysis identification module is used for analyzing the response data and identifying whether the response list is empty;
and the adding module is used for adding the response data back to the list control without the tail when the response list is not empty, and informing the list control to update.
In some embodiments, the third party library referenced apparatus comprises:
and the instruction identification module is used for identifying the user instruction information according to the current page number information after the local view control is used in the Activity layout file.
Specifically, the instruction identification module comprises:
the judging unit is used for judging whether the current page number is a starting page number;
the pull-down instruction unit is used for refreshing the user instruction information in a pull-down mode if the current page number is the initial page number;
and the pull-up instruction unit is used for loading the user instruction information in a pull-up mode if the current page number is not the initial page number.
Compared with the prior art, the device quoted by the third-party library in another embodiment of the invention has the following beneficial effects:
according to the device for the third-party library reference, provided by the embodiment of the invention, the inheritance module 2002, the adaptation realization module 2004 and the use module 2006 are set, so that the exchange of the third-party library is realized in the Activity without perception, the modification of all related layouts and pages is avoided to a certain extent, and the development efficiency is improved.
Referring to fig. 3, another embodiment of the present invention provides a mobile terminal based on the same inventive concept as a method for third-party library reference according to an embodiment of the present invention. Fig. 3 is a block diagram illustrating a partial structure of a cellular phone related to a mobile terminal according to still another embodiment of the present invention. The mobile phone comprises: radio Frequency (RF) circuitry 1510, memory 1520, input unit 1530, display unit 1540, sensor 1550, audio circuitry 1560, wireless fidelity (WiFi) module 1570, processor 1580, and power supply 1590. Those skilled in the art will appreciate that the handset configuration shown in fig. 3 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The following describes each component of the mobile phone in detail with reference to fig. 3:
the RF circuit 1510 may be configured to receive and transmit signals during information transmission and reception or during a call, and in particular, receive downlink information of a base station and then process the received downlink information to the processor 1580; in addition, the data for designing uplink is transmitted to the base station. In general, RF circuitry 1510 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like. In addition, RF circuit 1510 may also communicate with networks and other devices via wireless communication. The wireless communication may use any communication standard or protocol, including but not limited to Global System 0f Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Message Service (SMS), etc.
The memory 1520 may be used to store software programs and modules, and the processor 1580 performs various functional applications and data processing of the cellular phone by operating the software programs and modules stored in the memory 1520. The memory 1520 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program 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 store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. Further, the memory 1520 may include high-speed random access memory and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device.
The input unit 1530 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the cellular phone. Specifically, the input unit 1530 may include a touch panel 1531 and other input devices 1532. The touch panel 1531, also referred to as a touch screen, can collect touch operations of a user (e.g., operations of the user on or near the touch panel 1531 using any suitable object or accessory such as a finger or a stylus) and drive corresponding connection devices according to a preset program. Alternatively, the touch panel 1531 may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, and sends the touch point coordinates to the processor 1580, and can receive and execute commands sent by the processor 1580. In addition, the touch panel 1531 may be implemented by various types such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. The input unit 1530 may include other input devices 1532 in addition to the touch panel 1531. In particular, other input devices 1532 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 1540 may be used to display information input by the user or information provided to the user and various menus of the mobile phone. The Display unit 1540 may include a Display panel 1541, and optionally, the Display panel 1541 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. Further, the touch panel 1531 may cover the display panel 1541, and when the touch panel 1531 detects a touch operation on or near the touch panel 1531, the touch operation is transmitted to the processor 1580 to determine the type of the touch event, and then the processor 1580 provides a corresponding visual output on the display panel 1541 according to the type of the touch event. Although in fig. 3, the touch panel 1531 and the display panel 1541 are two separate components to implement the input and output functions of the mobile phone, in some embodiments, the touch panel 1531 and the display panel 1541 may be integrated to implement the input and output functions of the mobile phone.
The handset can also include at least one sensor 1550, such as light sensors, motion sensors, and other sensors. Specifically, the light sensor may include an ambient light sensor that adjusts the brightness of the display panel 1541 according to the brightness of ambient light and a proximity sensor that turns off the display panel 1541 and/or the backlight when the mobile phone is moved to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally, three axes), can detect the magnitude and direction of gravity when stationary, and can be used for applications of recognizing the posture of a mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer and tapping), and the like; as for other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured on the mobile phone, further description is omitted here.
Audio circuitry 1560, speaker 1561, and microphone 1562 may provide an audio interface between a user and a cell phone. The audio circuit 1560 may transmit the electrical signal converted from the received audio data to the speaker 1561, and convert the electrical signal into an audio signal by the speaker 1561 and output the audio signal; on the other hand, the microphone 1562 converts collected sound signals into electrical signals, which are received by the audio circuit 1560 and converted into audio data, which are processed by the audio data output processor 1580 and then passed through the RF circuit 1510 for transmission to, for example, another cellular phone, or for output to the memory 1520 for further processing.
WiFi belongs to short-distance wireless transmission technology, and the mobile phone can help a user to receive and send e-mails, browse webpages, access streaming media and the like through a WiFi module 1570, and provides wireless broadband internet access for the user. Although fig. 3 shows WiFi module 1570, it is understood that it does not belong to the essential components of the handset and can be omitted entirely as needed within the scope not changing the essence of the invention.
The processor 1580 is a control center of the mobile phone, connects various parts of the entire mobile phone by using various interfaces and lines, and performs various functions of the mobile phone and processes data by operating or executing software programs and/or modules stored in the memory 1520 and calling data stored in the memory 1520, thereby integrally monitoring the mobile phone. Optionally, the processor 1580 may include one or more processing units; preferably, the processor 1580 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, and the like, and a modem processor, which mainly handles wireless communications. It is to be appreciated that the modem processor may not be integrated into the processor 1580.
The handset also includes a power supply 1590 (e.g., a battery) for powering the various components, which may preferably be logically coupled to the processor 1580 via a power management system to manage charging, discharging, and power consumption management functions via the power management system.
Although not shown, the mobile phone may further include a camera, a bluetooth module, etc., which are not described herein.
In another embodiment of the present invention, the processor 1580 included in the mobile terminal further has the following functions:
one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to:
creating a local view control, and enabling the local view control to inherit a third-party view control which is used for realizing pull-down refreshing and pull-up loading in a third-party library;
defining a refresh layout adapter interface and creating a method for realizing pull-down refresh and pull-up loading view control in the refresh layout adapter interface, so that the local view control realizes the refresh layout adapter interface;
using the native view control in an Activity's layout file to cause Activity to hold the refresh layout adapter interface.
In some embodiments, after using the native view control in the layout file of Activity, the method comprises the following steps:
and when the third-party library is replaced by a new third-party library, the local view control is switched to inherit the new third-party view control which is used for realizing pull-down refreshing and pull-up loading in the new third-party library, and the local view control after switching inherits realizes the refreshing layout adapter interface.
Specifically, the method for implementing the pull-down refresh pull-up loading view control includes one or more of the following:
automatically starting refreshing;
setting pull-down refresh monitoring;
setting to load more snoops;
transitioning the page to a complete refresh style;
enabling the page to show a style that is completely loaded and has no more data;
enabling the page to display the finished loading style;
mark no more data;
setting allows more loads;
setting allows for automatic triggering of loading more operations;
setting permission to trigger pull-down refresh;
whether the setting is visible.
In some embodiments, after using the native view control in the layout file of Activity, the method comprises the following steps:
setting the page number of the first page as a starting page number according to a preset page number format based on the monitored callback of the pull-down refresh; sending a home page request and receiving home page request data corresponding to the home page request;
and clearing original data in the list control, adding the first page request data again, and informing the list control of updating.
In some embodiments, after using the native view control in the layout file of Activity, the method comprises the following steps:
sending a data request and receiving response data corresponding to the data request based on the monitored call-back of the pull-up loading;
analyzing the response data, and identifying whether a response list is empty;
and if not, the response data is recovered to the end of the list control, and the list control is notified to update.
In some embodiments, after using the native view control in the layout file of Activity, the method comprises the following steps:
and identifying user instruction information according to the current page number information.
Specifically, the identifying the user instruction information according to the current page number information includes the following steps:
judging whether the current page number is a starting page number;
if yes, the user instruction information is in pull-down refreshing;
if not, the user instruction information is pull-up loading.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
Compared with the prior art, the mobile terminal of the other embodiment of the invention has the following beneficial effects:
in another embodiment of the present invention, the mobile terminal inherits the created local view control to the third-party library and updates the layout adapter interface in an implementation manner, so that the exchange of the third-party library is implemented in Activity without sensing, and therefore, all related layouts and pages are prevented from being modified to a certain extent, and the development efficiency is improved.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by associated hardware instructed by a program, which may be stored in a computer-readable storage medium, and the storage medium may include: a Read Only Memory (ROM), a Random Access Memory (RAM), a magnetic or optical disk, or the like.
The foregoing is only a partial embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (15)

1. A method for referencing by a third-party library, which is characterized in that the method for referencing by the third-party library comprises the following steps:
creating a local view control, and enabling the local view control to inherit a third-party view control which is used for realizing pull-down refreshing and pull-up loading in a third-party library;
defining a refresh layout adapter interface and creating a method for realizing pull-down refresh and pull-up loading view control in the refresh layout adapter interface, so that the local view control realizes the refresh layout adapter interface;
using the native view control in an Activity's layout file to cause Activity to hold the refresh layout adapter interface.
2. The method of third party library referencing according to claim 1, wherein said using said native view control in a layout file for Activity, comprises the steps of:
and when the third-party library is replaced by a new third-party library, the local view control is switched to inherit the new third-party view control which is used for realizing pull-down refreshing and pull-up loading in the new third-party library, and the local view control after switching inherits realizes the refreshing layout adapter interface.
3. The method of third party library referencing according to claim 1, wherein said method for implementing a pull-down refresh pull-up load view control comprises one or more of:
automatically starting refreshing;
setting pull-down refresh monitoring;
setting to load more snoops;
transitioning the page to a complete refresh style;
enabling the page to show a style that is completely loaded and has no more data;
enabling the page to display the finished loading style;
mark no more data;
setting allows more loads;
setting allows for automatic triggering of loading more operations;
setting permission to trigger pull-down refresh;
whether the setting is visible.
4. The method of third party library referencing according to claim 1, wherein said using said native view control in a layout file for Activity, comprises the steps of:
setting the page number of the first page as a starting page number according to a preset page number format based on the monitored callback of the pull-down refresh; sending a home page request and receiving home page request data corresponding to the home page request;
and clearing original data in the list control, adding the first page request data again, and informing the list control of updating.
5. The method of third party library referencing according to claim 1, wherein said using said native view control in a layout file for Activity, comprises the steps of:
sending a data request and receiving response data corresponding to the data request based on the monitored call-back of the pull-up loading;
analyzing the response data, and identifying whether a response list is empty;
and if not, the response data is recovered to the end of the list control, and the list control is notified to update.
6. The method of third party library referencing according to claim 1, wherein said using said native view control in a layout file for Activity, comprises the steps of:
and identifying user instruction information according to the current page number information.
7. The method for third party library referencing according to claim 6, wherein said identifying user command information based on current page number information comprises the steps of:
judging whether the current page number is a starting page number;
if yes, the user instruction information is in pull-down refreshing;
if not, the user instruction information is pull-up loading.
8. An apparatus for reference by a third-party library, the apparatus for reference by the third-party library comprising:
the creation inheritance module is used for creating a local view control and enabling the local view control to inherit a third-party view control which is used for realizing pull-down refreshing and pull-up loading in a third-party library;
an adaptation implementation module, configured to define a refresh layout adapter interface and create a method for implementing pull-down refresh and pull-up loading of a view control in the refresh layout adapter interface, so that the local view control implements the refresh layout adapter interface;
and the using module is used for using the local view control in the layout file of the Activity so that the Activity holds the refresh layout adapter interface.
9. The apparatus for third party library referencing according to claim 8, wherein said apparatus for third party library referencing comprises:
and the replacement conversion module is used for enabling the local view control to inherit the new third-party view control which is used for realizing pull-down refreshing and pull-up loading in the new third-party library in the conversion after the local view control is used in the Activity layout file and when the third-party library is replaced by the new third-party library, and enabling the converted and inherited local view control to realize the refreshing layout adapter interface.
10. The apparatus for third party library referencing according to claim 8, wherein said means for implementing a pull-down refresh pull-up load view control comprises one or more of:
automatically starting refreshing;
setting pull-down refresh monitoring;
setting to load more snoops;
transitioning the page to a complete refresh style;
enabling the page to show a style that is completely loaded and has no more data;
enabling the page to display the finished loading style;
mark no more data;
setting allows more loads;
setting allows for automatic triggering of loading more operations;
setting permission to trigger pull-down refresh;
whether the setting is visible.
11. The apparatus for third party library referencing according to claim 8, wherein said apparatus for third party library referencing comprises:
the pull-down module is used for setting the page number of the first page as the initial page number according to a preset page number format based on the monitored pull-down refresh callback after the local view control is used in the Activity layout file; sending a home page request and receiving home page request data corresponding to the home page request;
and the re-adding module is used for emptying the original data in the list control, re-adding the data by using the home page request data and informing the list control of updating.
12. The apparatus for third party library referencing according to claim 8, wherein said apparatus for third party library referencing comprises:
the pull-up module is used for sending a data request and receiving response data corresponding to the data request based on a callback of monitored pull-up loading after the local view control is used in an Activity layout file;
the analysis identification module is used for analyzing the response data and identifying whether the response list is empty or not;
and the adding module is used for adding the response data back to the list control without the tail when the response list is not empty, and informing the list control to update.
13. The apparatus for third party library referencing according to claim 8, wherein said apparatus for third party library referencing comprises:
and the instruction identification module is used for identifying the user instruction information according to the current page number information after the local view control is used in the Activity layout file.
14. The apparatus for third party library referencing according to claim 13, wherein said instruction identification module comprises:
the judging unit is used for judging whether the current page number is a starting page number;
the pull-down instruction unit is used for refreshing the user instruction information in a pull-down mode if the current page number is the initial page number;
and the pull-up instruction unit is used for loading the user instruction information in a pull-up mode if the current page number is not the initial page number.
15. A mobile terminal, comprising:
one or more processors;
a memory;
one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the method recited by any of claims 1-7.
CN202010074797.5A 2020-01-22 2020-01-22 Third party library reference method and device and mobile terminal Active CN111309325B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010074797.5A CN111309325B (en) 2020-01-22 2020-01-22 Third party library reference method and device and mobile terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010074797.5A CN111309325B (en) 2020-01-22 2020-01-22 Third party library reference method and device and mobile terminal

Publications (2)

Publication Number Publication Date
CN111309325A true CN111309325A (en) 2020-06-19
CN111309325B CN111309325B (en) 2023-08-18

Family

ID=71145171

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010074797.5A Active CN111309325B (en) 2020-01-22 2020-01-22 Third party library reference method and device and mobile terminal

Country Status (1)

Country Link
CN (1) CN111309325B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111782304A (en) * 2020-07-21 2020-10-16 平安国际智慧城市科技股份有限公司 Logic control method and device for paging loading data, computer equipment and medium
CN114816369A (en) * 2022-06-29 2022-07-29 广州易方信息科技股份有限公司 Method and device for safely cutting third-party library supported by Android terminal
CN115809056A (en) * 2023-02-07 2023-03-17 深圳复临科技有限公司 Component multiplexing implementation method and device, terminal equipment and readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102981861A (en) * 2012-12-12 2013-03-20 上海航天测控通信研究所 Using method of custom control based on Qt
CN103902634A (en) * 2012-12-30 2014-07-02 航天信息股份有限公司 Method for achieving automatic binding between View assembly and database fields through Adapter
CN105094683A (en) * 2015-06-30 2015-11-25 北京金山安全软件有限公司 Data display method and device
CN108170416A (en) * 2017-12-28 2018-06-15 北京云杉世纪网络科技有限公司 A kind of method and system for building web front-end
CN109976851A (en) * 2019-03-15 2019-07-05 努比亚技术有限公司 Menu item display methods, wearable device and computer readable storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102981861A (en) * 2012-12-12 2013-03-20 上海航天测控通信研究所 Using method of custom control based on Qt
CN103902634A (en) * 2012-12-30 2014-07-02 航天信息股份有限公司 Method for achieving automatic binding between View assembly and database fields through Adapter
CN105094683A (en) * 2015-06-30 2015-11-25 北京金山安全软件有限公司 Data display method and device
CN108170416A (en) * 2017-12-28 2018-06-15 北京云杉世纪网络科技有限公司 A kind of method and system for building web front-end
CN109976851A (en) * 2019-03-15 2019-07-05 努比亚技术有限公司 Menu item display methods, wearable device and computer readable storage medium

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111782304A (en) * 2020-07-21 2020-10-16 平安国际智慧城市科技股份有限公司 Logic control method and device for paging loading data, computer equipment and medium
CN111782304B (en) * 2020-07-21 2024-04-02 深圳赛安特技术服务有限公司 Paging loading data logic control method, device, computer equipment and medium
CN114816369A (en) * 2022-06-29 2022-07-29 广州易方信息科技股份有限公司 Method and device for safely cutting third-party library supported by Android terminal
CN114816369B (en) * 2022-06-29 2022-10-04 易方信息科技股份有限公司 Method and device for safely cutting third-party library supported by Android terminal
CN115809056A (en) * 2023-02-07 2023-03-17 深圳复临科技有限公司 Component multiplexing implementation method and device, terminal equipment and readable storage medium
CN115809056B (en) * 2023-02-07 2023-05-05 深圳复临科技有限公司 Component multiplexing implementation method and device, terminal equipment and readable storage medium

Also Published As

Publication number Publication date
CN111309325B (en) 2023-08-18

Similar Documents

Publication Publication Date Title
CN103500002B (en) The method of application program management, device and terminal unit
US10186244B2 (en) Sound effect processing method and device, plug-in unit manager and sound effect plug-in unit
CN107734616B (en) Application program closing method and device, storage medium and electronic equipment
CN106502703B (en) Function calling method and device
CN108549519B (en) Split screen processing method and device, storage medium and electronic equipment
CN111309325B (en) Third party library reference method and device and mobile terminal
CN106776036A (en) A kind of resource allocation methods and device
CN105278937A (en) Method and device for displaying pop-up box messages
US20190317841A1 (en) Method for prompting message in terminal and terminal
CN103473092A (en) Method and device for processing downloaded applications and terminal equipment
CN106713608B (en) Application function state modification method and device and terminal
CN103455348A (en) Subarea adjustment method, device, terminal, server and system
CN104093123A (en) Application program information pushing method, device and system and mobile terminal
CN111277991B (en) Operator name display method and device, mobile terminal and storage medium
CN108932093A (en) Split screen application switching method, device, storage medium and electronic equipment
EP2869604B1 (en) Method, apparatus and device for processing a mobile terminal resource
CN110046497B (en) Function hook realization method, device and storage medium
CN108536388A (en) split screen processing method, device, storage medium and electronic equipment
CN106095423B (en) Method, terminal and server for providing browsing service
CN106919458B (en) Method and device for Hook target kernel function
CN106649595B (en) Object pool-based webpage starting acceleration method and device and terminal
US20200125369A1 (en) Method, device, and terminal for accelerating startup of application
CN104423990A (en) Tile updating method and device
CN109145598B (en) Virus detection method and device for script file, terminal and storage medium
CN106230919B (en) File uploading method and device

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
GR01 Patent grant
GR01 Patent grant