CN111930761A - Information interaction method and device and model-view-representation architecture - Google Patents

Information interaction method and device and model-view-representation architecture Download PDF

Info

Publication number
CN111930761A
CN111930761A CN202010720054.0A CN202010720054A CN111930761A CN 111930761 A CN111930761 A CN 111930761A CN 202010720054 A CN202010720054 A CN 202010720054A CN 111930761 A CN111930761 A CN 111930761A
Authority
CN
China
Prior art keywords
view
target view
state
layer
update
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
CN202010720054.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.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance 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 Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202010720054.0A priority Critical patent/CN111930761A/en
Publication of CN111930761A publication Critical patent/CN111930761A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2393Updating materialised views
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the disclosure discloses an information interaction method, an information interaction device and a model-view-presenter architecture. One embodiment of the method comprises: receiving update data of a target view; sending the update data to a view model layer to instruct the view model layer to perform the following view update operations: determining the life cycle state of the target view; in response to determining that the lifecycle state of the target view is in a non-destruction state, updating the target view based on the update data. The life cycle state of the target view is sensed through the view model layer, when the target view is in a non-destruction state, the target view is updated, the process that developers write codes for judging the life cycle state of the target view and embed the codes in relevant clients of the terminal device is replaced, and the workload of the developers is relieved.

Description

Information interaction method and device and model-view-representation architecture
Technical Field
The present disclosure relates to the field of internet technologies, and in particular, to an information interaction method and apparatus, and a model-view-presenter architecture.
Background
In the past, system development is generally completed based on a Model-View-Controller (MVC) architecture, and as development projects become more and more huge, participation of research and development personnel becomes more and more, and the defects of excessively complex MVC architecture, low project development efficiency and the like are highlighted. Currently, project development has been developed towards modularization, low coupling and high cohesion, and it is very common to develop projects based on a Model-View-Presenter architecture.
Currently, the Model-View-representer architecture is mainly divided into three layers, namely a Presenter (Presenter) layer, a Model (Model) layer, and a View (View) layer. Wherein the separation of the model layer and the view layer is achieved by using a presenter layer. The main program logic is implemented in the presenter layer. The indicator layer is not directly related to the specific view layer, the indicator layer and the view layer interact through an interface, and the indicator layer can be kept unchanged in model-view-indicator when the view layer is changed.
Disclosure of Invention
This disclosure is provided to introduce concepts in a simplified form that are further described below in the detailed description. This disclosure is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
The embodiment of the disclosure provides an information interaction method, an information interaction device and a model-view-presenter architecture.
In a first aspect, an embodiment of the present disclosure provides an information interaction method, where the method includes: receiving update data of a target view; sending the update data to a view model layer to instruct the view model layer to perform the following view update operations: determining the life cycle state of the target view; in response to determining that the lifecycle state of the target view is in a non-destruction state, updating the target view based on the update data.
In a second aspect, an embodiment of the present disclosure provides an information interaction apparatus, including: the receiving module is used for receiving the update data of the target view; a sending module, configured to send the update data to a view model layer to instruct the view model layer to perform a view update operation as follows: determining the life cycle state of the target view; in response to determining that the lifecycle state of the target view is in a non-destruction state, updating the target view based on the update data.
In a third aspect, an embodiment of the present disclosure provides a model-view-presenter architecture, including: the view layer is used for receiving preset operation of a user on a target view and sending information of updating operation generated according to the preset operation to the indicator layer; the indicator layer is used for receiving the information of the updating operation and sending an updating information acquisition request triggered according to the information of the updating operation to the model layer; the model layer is used for acquiring the updating data according to the received updating information acquisition request and sending the updating data to the view model layer; a view model layer for performing the following view update operations: determining the life cycle state of the target view; in response to determining that the lifecycle state of the target view is in a non-destruction state, determining an updated target view for display based on the update data; and sending the updated target view to a view layer for displaying.
In a fourth aspect, an embodiment of the present disclosure provides an electronic device, including: one or more processors; a storage device, on which one or more programs are stored, which, when executed by the one or more processors, cause the one or more processors to implement the information interaction method of the first aspect.
In a fifth aspect, the disclosed embodiments provide a computer-readable medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the information interaction method described in the first aspect.
The information interaction method, the information interaction device and the model-view-indicator framework provided by the embodiment of the disclosure receive the update data of the target view; sending the update data to a view model layer to instruct the view model layer to perform the following view update operations: determining the life cycle state of the target view; in response to determining that the lifecycle state of the target view is in a non-destruction state, updating the target view based on the update data. According to the scheme, the life cycle state of the target view is sensed through the view model layer, when the target view is in the non-destruction state, the target view is updated, the process that developers write codes for judging the life cycle state of the target view and embed the codes in relevant clients of the terminal device is replaced, on one hand, the workload of the developers is reduced, and on the other hand, the cost of the clients can be reduced.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale.
FIG. 1 is a flow diagram of one embodiment of a method of information interaction according to the present disclosure;
FIG. 2 is a schematic structural diagram of one embodiment of an information interaction device according to the present disclosure;
FIG. 3 is a schematic structural diagram of one embodiment of a model-view-presenter architecture according to the present disclosure;
FIG. 4 is an exemplary system architecture to which the information interaction method of one embodiment of the present disclosure may be applied;
fig. 5 is a schematic diagram of a basic structure of an electronic device provided according to an embodiment of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
It should be noted that, in the present disclosure, the embodiments and features of the embodiments may be combined with each other without conflict.
To facilitate a better understanding of the embodiments of the present disclosure, terms that may appear in the embodiments of the present disclosure will be explained below:
the Model-View-Presenter (MVP) architecture is evolved from the Model-View-Controller (MVC) architecture, and is divided into three layers: model (Model) layer, View (View) layer, Presenter (Presenter) layer. The Model layer is responsible for data access operations, such as reading and writing of a database, requests of network data, and the like; the View layer is responsible for displaying data and providing a friendly interface for interaction with a user; the Presenter layer is used for connecting the bridge of the View layer and the Model layer and processing the service logic. The Model layer and the View layer cannot directly interact in the Model-View-representer architecture. The Presenter layer can obtain the required data from the Model layer, perform some appropriate processing, and then submit the data to the View layer for display. Therefore, the View layer and the Model layer are isolated through the Presenter layer, so that no coupling exists between the View layer and the Model layer, and meanwhile, the service logic is extracted from the View layer.
Referring to fig. 1, which shows a flowchart of an embodiment of an information interaction method according to the present disclosure, as shown in fig. 1, the information interaction method may include the following steps 101 to 102.
Step 101, receiving update data of a target view.
In this embodiment, the information interaction method may be performed by a model layer.
The target view may include, for example, a list view, an image view, etc. presented in the page; the update data may include, for example, information content or the like for updating text information, picture information, or the like in the target view. For example, for a student list containing student a, student B, and student C, the corresponding update data may be student D. Here, any one of the other three students may be replaced with the student D, or the student D may be added to the student list to obtain an updated student list.
The Model layer may obtain update data of the target view, receive the update data, and then may send the update data to a view Model layer (ViewModel layer) to enable the ViewModel layer to perform a corresponding view update operation based on the update data.
Step 102, sending the update data to the view model layer to instruct the view model layer to perform the following view update operations: determining the life cycle state of the target view; in response to determining that the lifecycle state of the target view is in the non-destruction state, the target view is updated based on the update data.
The ViewModel layer may detect the life cycle state of the target view after receiving the update data sent by the Model layer. The life cycle state here may correspond to, for example, an alive state and a destroyed state of the target view, and the alive state may include, for example, an active state, a suspended state, and the like of the target view.
The active state of the target view may be the state in which focus is obtained in the system for the target view. When the target view is in an active state, the user can perform related operations on the target view.
The pause state of the target view may be a state in which the target view has not gained focus in the system, but is still visible to the user. For example, when a transparent, invisible layer to the user is displayed on top of the target view, or when there is a dialog layer on top of the target view, the target view is in a paused state. The target view cannot be operated on by the user in the pause state.
In practice, the lifecycle state may correspond to a visible state and an invisible state of the target view (e.g., the surviving state may correspond to the visible state and the destroyed state may correspond to the invisible state). If the target view is in a visible state when the target view is updated, the corresponding target view can be updated. The visible state herein may include a state in which the target view can be seen by the user, and the invisible state may include a state in which the target view cannot be seen by the user.
Therefore, after receiving the update data of the target view, the ViewModel layer may detect a lifecycle state corresponding to the target view, so as to determine whether to update the target view by using the received update data according to the lifecycle state of the target view.
When the ViewModel layer determines that the life cycle state of the target view is in the non-destruction state (survival state), the target view may be updated by using the acquired update data. For example, the current target view is a list view including banana, strawberry, dragon fruit, and peach, and the update data corresponding to the list view is "apple". The update data may be added to the list view when it is determined that the list view lifecycle state is in a non-destruction state. The updated list view may comprise apples, i.e. the updated target view comprises bananas, strawberries, dragon fruits, peaches, apples.
In the prior art, after the Model layer acquires data, the life cycle state of the target view needs to be judged through codes embedded in relevant clients of the terminal device to determine whether to update the target view. Therefore, a developer needs to write a code for judging the life cycle state of the target view, and then embed the code into the relevant client, which brings a heavy workload to the developer.
In the embodiment, the update data of the target view is received firstly; then, the update data is sent to the view model layer to instruct the view model layer to perform the following view update operations: determining the life cycle state of the target view; in response to determining that the lifecycle state of the target view is in the non-destruction state, the target view is updated based on the update data. The life cycle state of the target view is sensed through the view model layer, when the target view is in a non-destruction state, the target view is updated, a process that a developer writes codes for judging the life cycle state of the target view and embeds the codes in a relevant client of the terminal device is replaced, and the work load of the developer is relieved.
In some optional implementations, the determining the lifecycle state of the target view may include: and determining the life cycle state of the target view according to the received life state parameters corresponding to the target view sent by the preset life state monitoring component.
In some application scenarios, the preset life state monitoring component may be used to monitor a life cycle state of the target view, after monitoring the life state parameter, the preset life state monitoring component may send the life state parameter to the ViewModel layer, and after receiving the life state parameter, the ViewModel layer may determine the life cycle state of the target view based on the life state parameter.
In practice, the preset life state monitoring component may be determined according to a specific operating system. For example, in Android system (Android), the life state parameters of the target view can be monitored by using a life state monitoring component (LifeCycle component) set by the Android system, which can monitor the life cycle change of the view in the Android system. The LifeCycle may pass the monitored vital state parameters to Livedata. Livedata can judge the life cycle state of the target view according to the life state parameters. Livedata can be used as the storage content of the view model layer. In this way, the view model layer can determine the life cycle state of the target view through Livedata. In an apple operating system (IOS), a corresponding life state monitoring component (RxLifecycle, the IOS system can monitor the life cycle change of a view) can be utilized to monitor a life state parameter corresponding to a target view, and the monitored life state parameter is sent to a ViewModel layer, so that the ViewModel layer can determine the life cycle state of the target view. The android system and the apple system are well known operating systems in the prior art, and the working principle of the android system and the apple system is known to those skilled in the art and is not described in detail herein.
After the ViewModel layer determines that the life cycle state of the target view is the non-destruction state based on the received life state parameters, the target view can be updated based on the received update data. For example, when it is determined that the life cycle state of the target view is the non-destruction state based on the life state parameter, the data to be updated at the characterization time 12:00 in the current target view may be updated to 12: 01.
In these optional implementation manners, the step of monitoring the life state parameter corresponding to the target view by using the preset life state monitoring component and determining the life cycle state of the target view based on the life state parameter replaces the process of a developer writing a code for determining the life cycle of the target view and embedding the code in a relevant client of the terminal device. On the one hand, the burden of developers can be reduced, and on the other hand, the cost can be reduced.
In some optional implementations, before sending the update data to the view model layer, the information interaction method further includes: and converting the updating data into the display data corresponding to the target view.
After the Model layer receives the update data, the Model layer can process the received update data accordingly. The processed update data (i.e. presentation data) can be directly presented in the target view. For example, the received update data is "2020, 6, 8", and when the update data represents a date, the update data can be converted into a format conventionally representing the date, resulting in the presentation data: 2020.06.08.
after converting the update data into the presentation data, the updating the target view based on the update data in response to determining that the life cycle state of the target view is in the non-destruction state may include: the target view is updated based on the presentation data.
The ViewModel layer may update the target view according to the presentation data so that the user may visually see the corresponding information content. For example, after updating the target view with the above-mentioned presentation data "2020.06.08", it is possible to present "2020.06.08" in the target view, and then the user can see the corresponding information content "2020.06.08".
In some optional implementations, before determining the lifecycle state of the target view, the view update operation further includes: and storing the display data.
After the Model layer converts the update data into corresponding display data, the display data can be sent to the ViewModel layer, and the ViewModel layer stores the display data, so that the display data cannot be lost, and when the life cycle state of the target view is detected to be a non-destruction state, the corresponding display data can be directly extracted to update the target view.
In some optional implementations, the updating the target view based on the update data in response to determining that the lifecycle state of the target view is in the non-destruction state includes: and in response to the fact that the life cycle state of the target view is determined to be in the non-destruction state, sending the display data to the view layer, so that the view layer updates the target view according to the display data.
After the View layer receives the presentation data, the target View can be updated based on the presentation data (i.e., the presentation data is presented) to obtain the information content that the user wants to browse. For example, the presentation data is "2020.07.17", and the View layer may update the target View with the presentation data, and at this time, the View layer may present the information content of "2020.07.17".
In some optional implementations, before the step 101, the information interaction method further includes: and receiving an updating information acquisition request sent by the indicator layer, wherein the updating information acquisition request is triggered by the indicator layer according to the information of the updating operation sent by the view layer, and the information of the updating operation is generated by the view layer according to the preset operation executed by a user.
The user can execute preset operation on the target view on the user terminal to instruct the user terminal to display the corresponding updated target view. The preset operation here may be, for example, an operation that performs a downward sliding operation in the current interface, or a triggering operation on a preset update control, which may substantially indicate an update of the target view. The preset updating control may include, for example, a preset button or the like.
After the View layer detects that the user performs the preset operation, information of the update operation corresponding to the preset operation may be generated. The information of the update operation herein may include information corresponding to a preset operation, for example, a preset operation corresponding to adding information content, and the information of the update operation may represent information that triggers an add button in the current view to add information content. After the View layer generates the information of the update operation, the View layer may send the information to the Presenter layer. After receiving the information of the update operation, the Presenter layer can trigger a corresponding update information acquisition request and send the update information acquisition request to the Model layer, so that the Model layer can acquire corresponding update data according to the update information acquisition request.
For example, when the user performs a preset operation of clicking a download key in the target View to obtain a cloud picture, the preset operation may be detected by the View layer, and then the View layer may send the generated information of the corresponding update operation (i.e., the information of obtaining the cloud picture corresponding to the click operation) to the Presenter layer, and then the Presenter layer may trigger an update information obtaining request such as "please obtain the cloud picture". The Presenter layer sends the update information acquisition request to the Model layer, so that the Model layer can acquire the corresponding target cloud picture. In some application scenarios, the update information acquisition request may include acquisition location information corresponding to the update data, where the acquisition location information may be, for example, a website address for generating the update data, corresponding website information, and the like. Thus, when the Model layer acquires the update data, the corresponding update data can be acquired quickly and accurately based on the corresponding acquisition position information.
In some optional implementations, the update operation includes at least one of: an insert operation, a delete operation, a modify operation, or a query operation.
The inserting operation may include, for example, a preset operation of clicking an "insert" button to insert the year information, the identity information, the profile information, or the like in the current list, and then the target list to which the year information, the identity information, the profile information, or the like is added may be obtained; the deletion operation may include, for example, a preset operation of pressing the object "pear" to be deleted for a long time to delete "pear" in the current list containing "apple", "banana", and "pear", and then a target list containing only "apple" and "banana" may be obtained; the modification operation may include, for example, a preset operation of replacing a landscape picture existing in the current view with a person picture; the query operation may include, for example, a preset operation of clicking a "query" button to query logistics information of a target item, and the like.
In some optional implementations, the view update operation may further include: in response to determining that the lifecycle state of the target view is in a destruction state, the target view is not updated.
That is, if the ViewModel layer detects that the life cycle state of the target view is the destroyed state, the target view may not be updated. For example, after the Model layer acquires the update data but before the target view is not updated with the update data, the user closes the application corresponding to the target view. At this time, the target view may be considered as a destroyed state, and the ViewModel layer may not update the target view. In these alternative implementations, when the life cycle of the target view is in the destroyed state, if the update data of the target view is received, the target view does not need to be updated. Resource consumption caused by background updating of the target view is reduced.
Further, after the above-mentioned not updating the target view in response to determining that the lifecycle state of the target view is in the destruction state, the view update operation further comprises: in response to determining not to update the target view, the update data for the target view is cleared.
In some application scenarios, if the ViewModel layer determines not to update the target view, the previously stored update data may be deleted, so as to release the memory.
Referring to fig. 2, which shows a schematic structural diagram of an embodiment of an information interaction apparatus according to the present disclosure, as shown in fig. 2, the information interaction apparatus includes a receiving module 201 and a sending module 202. The receiving module 201 is configured to receive update data of a target view; a sending module 202, configured to send update data to the view model layer to instruct the view model layer to perform the following view update operations: determining the life cycle state of the target view; in response to determining that the lifecycle state of the target view is in the non-destruction state, the target view is updated based on the update data.
It should be noted that, for specific processing of the receiving module 201 and the sending module 202 of the information interaction apparatus and technical effects brought by the processing, reference may be made to the related descriptions of step 101 to step 102 in the corresponding embodiment of fig. 1, and no further description is given here.
In some optional implementations of this embodiment, the sending module 202 is further configured to indicate the view model layer: and determining the life cycle state of the target view according to the received life state parameters corresponding to the target view sent by the preset life state monitoring component.
In some optional implementation manners of this embodiment, the information interaction apparatus further includes a conversion module, where the conversion module is configured to: before sending the update data to the view model layer, the update data is converted into presentation data corresponding to the target view. And the sending module 202 is further configured to instruct the view model layer to: the target view is updated based on the presentation data.
In some optional implementations of this embodiment, the sending module 202 is further configured to indicate the view model layer: before determining the lifecycle state that the target view is in, the presentation data is stored.
In some optional implementations of this embodiment, the sending module 202 is further configured to indicate the view model layer: and in response to the fact that the life cycle state of the target view is determined to be in the non-destruction state, sending the display data to the view layer, so that the view layer updates the target view according to the display data.
In some optional implementation manners of this embodiment, the information interaction apparatus further includes a first receiving module, where the first receiving module is configured to: before receiving the update data of the target view, receiving an update information acquisition request sent by a presenter layer, wherein the update information acquisition request is triggered by the presenter layer according to the information of the update operation sent by a view layer, and the information of the update operation is generated by the view layer according to the preset operation executed by a user.
In some optional implementations of this embodiment, the update operation includes at least one of: an insert operation, a delete operation, a modify operation, or a query operation.
In some optional implementations of this embodiment, the view update operation further includes: in response to determining that the lifecycle state of the target view is in a destruction state, the target view is not updated.
In some optional implementations of this embodiment, the sending module 202 is further configured to indicate the view model layer: after not updating the target view in response to determining that the lifecycle state of the target view is in the destruction state, performing the following view update operations: in response to determining not to update the target view, the update data for the target view is cleared.
Referring to fig. 3, which illustrates a schematic structural diagram of one embodiment of a model-view-presenter architecture according to the present disclosure, as shown in fig. 3, the model-view-presenter architecture may include a view layer 301, a presenter layer 302, a model layer 303, and a view model layer 304. The view layer 301 is configured to receive a preset operation of a user on a target view, and send information of an update operation generated according to the preset operation to the indicator layer 302; the indicator layer 302 is used for receiving the information of the updating operation and sending an updating information acquisition request triggered according to the information of the updating operation to the model layer 303; the model layer 303 is configured to obtain update data according to the received update information obtaining request, and send the update data to the view model layer 304; a view model layer 304 for performing the following view update operations: determining the life cycle state of the target view; in response to determining that the lifecycle state of the target view is in a non-destruction state, determining an updated target view for display based on the update data; and sending the updated target view to the view layer 301 for display.
For example, in an article browsing interface, a user performs a preset operation of sliding down to acquire article information of a next page. At this time, the viewing layer 301 receives the sliding operation, and generates information of a corresponding updating operation according to the sliding operation, where the information of the updating operation may be, for example, "slide down to obtain article information of a next page". And may send information of the update operation to the presenter layer 302; after receiving the information of the update operation, the presenter layer 302 may trigger a corresponding update information acquisition request for requesting to acquire article information of a next page of the current page, and may send the update information acquisition request to the model layer 303. After receiving the update information acquisition request, the model layer 302 may know the specific information data to be acquired, execute the acquisition operation, download the article information corresponding to the next page, and transmit the article information to the view model layer 304 for storage, and after receiving the article information corresponding to the next page, the view model layer 304 may detect whether the current life cycle state of the target view is a non-destruction state. Here, if it is detected that the user currently stays in the current page, and waits to browse an updated next page or retains a detection result that the target view is in a non-destruction state, such as the current page, the current page may be updated based on the acquired article information of the next page, that is, the article information of the next page is presented to the user in the user interface. If it is detected that the user has closed the application program for browsing the article or quits the detection result that the target view is in the destroyed state, the current page may not be updated.
In the prior art, after the Model layer acquires data, the life cycle state of the target view needs to be judged through a code embedded in a relevant client of the terminal device, so as to determine whether to update the target view. Therefore, a developer needs to write a code for judging the life cycle state of the target view, and then embed the code into the relevant client, which brings a heavy workload to the developer.
In this embodiment, the newly added View model layer 304(View model layer) is used to monitor the life cycle state of the target View in the View layer, so as to realize the life cycle state sensing function of the model-View-presenter architecture, and update the target View when sensing that the target View in the View layer is in a non-destruction state, thereby reducing the workload of developers.
Referring to fig. 4, an exemplary system architecture to which the information interaction method of one embodiment of the present disclosure may be applied is shown.
As shown in fig. 4, the system architecture may include terminal devices 401, 402, 403, a network 404, and a server 405. The network 404 serves as a medium for providing communication links between the terminal devices 401, 402, 403 and the server 405. Network 404 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few. The terminal devices and servers described above may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., Ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The terminal devices 401, 402, 403 may interact with a server 405 over a network 404 to receive or send messages or the like. The terminal devices 401, 402, 403 may have various client applications installed thereon, such as a video distribution application, a search-type application, and a news-information-type application.
The terminal devices 401, 402, and 403 may be hardware or software. When the terminal devices 401, 402, and 403 are hardware, they may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III, mpeg compression standard Audio Layer 3), MP4 players (Moving Picture Experts Group Audio Layer IV, mpeg compression standard Audio Layer 4), laptop portable computers, desktop computers, and the like. When the terminal devices 401, 402, and 403 are software, they can be installed in the electronic devices listed above. It may be implemented as multiple pieces of software or software modules (e.g., software or software modules used to provide distributed services) or as a single piece of software or software module. And is not particularly limited herein.
The server 405 may be a server that can provide various services, for example, receives an update data acquisition request transmitted by the terminal apparatuses 401, 402, and 403, performs analysis processing on the update data acquisition request, and transmits an analysis processing result (for example, update data corresponding to the update data acquisition request) to the terminal apparatuses 401, 402, and 403.
It should be noted that the information interaction method provided by the embodiment of the present disclosure may be executed by a terminal device, and accordingly, the information interaction apparatus may be disposed in the terminal device.
It should be understood that the number of terminal devices, networks, and servers in fig. 4 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to fig. 5, shown is a schematic diagram of an electronic device (e.g., the terminal device of fig. 4) suitable for use in implementing embodiments of the present disclosure. The electronic device shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 5, the electronic device may include a processing means (e.g., central processing unit, graphics processor, etc.) 501 that may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage means 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data necessary for the operation of the electronic apparatus are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other through a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
Generally, the following devices may be connected to the I/O interface 505: input devices 506 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 507 including, for example, a Liquid Crystal Display (LCD), speakers, vibrators, and the like; storage devices 508 including, for example, magnetic tape, hard disk, etc.; and a communication device 509. The communication means 509 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. While fig. 5 illustrates an electronic device having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means 509, or installed from the storage means 508, or installed from the ROM 502. The computer program performs the above-described functions defined in the methods of the embodiments of the present disclosure when executed by the processing device 501.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: receiving update data of a target view; sending update data to the view model layer to instruct the view model layer to perform the following view update operations: determining the life cycle state of the target view; in response to determining that the lifecycle state of the target view is in the non-destruction state, the target view is updated based on the update data.
Computer program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of a module does not in some cases constitute a limitation of the unit itself, for example, the receiving module may also be described as a "module that receives update data of the target view".
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims (13)

1. An information interaction method, comprising:
receiving update data of a target view;
sending the update data to a view model layer to instruct the view model layer to perform the following view update operations: determining the life cycle state of the target view; in response to determining that the lifecycle state of the target view is in a non-destruction state, updating the target view based on the update data.
2. The method of claim 1, wherein the determining the lifecycle state of the target view comprises:
and determining the life cycle state of the target view according to the received life state parameter corresponding to the target view sent by the preset life state monitoring component.
3. The method of claim 1, wherein prior to said sending the update data to the view model layer, the method further comprises:
converting the update data into display data corresponding to the target view; and
the updating the target view based on the update data in response to determining that the lifecycle state of the target view is in a non-destruction state comprises:
updating the target view based on the presentation data.
4. The method of claim 3, wherein prior to said determining the lifecycle state of the target view, the view update operation further comprises:
and storing the display data.
5. The method of claim 3, wherein updating the target view based on the update data in response to determining that the lifecycle state of the target view is in a non-destruction state comprises:
and in response to the fact that the life cycle state of the target view is determined to be in a non-destruction state, sending the display data to a view layer, so that the view layer updates the target view according to the display data.
6. The method of claim 1, wherein prior to said receiving update data for the target view, the method further comprises:
receiving an update information acquisition request sent by a presenter layer, wherein the update information acquisition request is triggered by the presenter layer according to update operation information sent by a view layer, and the update operation information is generated by the view layer according to preset operation executed by a user.
7. The method of claim 6, wherein the update operation comprises at least one of: an insert operation, a delete operation, a modify operation, or a query operation.
8. The method of claim 1, wherein the view update operation further comprises:
not updating the target view in response to determining that the lifecycle state of the target view is in a destruction state.
9. The method of claim 8, wherein after not updating the target view in response to determining that the lifecycle state of the target view is in a destruction state, the view update operations further comprise:
in response to determining not to update the target view, clearing update data of the target view.
10. An information interaction apparatus, comprising:
the receiving module is used for receiving the update data of the target view;
a sending module, configured to send the update data to a view model layer to instruct the view model layer to perform a view update operation as follows: determining the life cycle state of the target view; in response to determining that the lifecycle state of the target view is in a non-destruction state, updating the target view based on the update data.
11. A model-view-presenter architecture, comprising:
the view layer is used for receiving preset operation of a user on a target view and sending information of updating operation generated according to the preset operation to the indicator layer;
the indicator layer is used for receiving the information of the updating operation and sending an updating information acquisition request triggered according to the information of the updating operation to the model layer;
the model layer is used for acquiring the updating data according to the received updating information acquisition request and sending the updating data to the view model layer;
a view model layer for performing the following view update operations: determining the life cycle state of the target view; in response to determining that the lifecycle state of the target view is in a non-destruction state, determining an updated target view for display based on the update data; and
and sending the updated target view to the view layer for displaying.
12. An electronic device, comprising:
one or more processors;
storage means having one or more programs stored thereon which, when executed by the one or more processors, cause the one or more processors to implement the method of any of claims 1-9.
13. A computer-readable medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-9.
CN202010720054.0A 2020-07-23 2020-07-23 Information interaction method and device and model-view-representation architecture Pending CN111930761A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010720054.0A CN111930761A (en) 2020-07-23 2020-07-23 Information interaction method and device and model-view-representation architecture

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010720054.0A CN111930761A (en) 2020-07-23 2020-07-23 Information interaction method and device and model-view-representation architecture

Publications (1)

Publication Number Publication Date
CN111930761A true CN111930761A (en) 2020-11-13

Family

ID=73315799

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010720054.0A Pending CN111930761A (en) 2020-07-23 2020-07-23 Information interaction method and device and model-view-representation architecture

Country Status (1)

Country Link
CN (1) CN111930761A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113409433A (en) * 2021-06-11 2021-09-17 东北大学 Medical three-dimensional model display and cutting system based on mobile terminal

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105490842A (en) * 2015-11-30 2016-04-13 用友网络科技股份有限公司 Method for managing dialogue in online service system based on MVVM (model-view-viewmodel) model
US20160110055A1 (en) * 2014-10-20 2016-04-21 Oracle International Corporation Event-based architecture for expand-collapse operations

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160110055A1 (en) * 2014-10-20 2016-04-21 Oracle International Corporation Event-based architecture for expand-collapse operations
CN105490842A (en) * 2015-11-30 2016-04-13 用友网络科技股份有限公司 Method for managing dialogue in online service system based on MVVM (model-view-viewmodel) model

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
"开工!今天撸一波jetpack下的Lifecycle、ViewModel和LiveData", 《腾讯云》, pages 1 - 6 *
JIANGCHENG345413: "《mvpvm》", 《CSDN博客》, pages 2 *
程田: "《Android MVPVM架构实践》", 《简书》, pages 1 - 7 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113409433A (en) * 2021-06-11 2021-09-17 东北大学 Medical three-dimensional model display and cutting system based on mobile terminal
CN113409433B (en) * 2021-06-11 2023-10-17 东北大学 Medical three-dimensional model display and cutting system based on mobile terminal

Similar Documents

Publication Publication Date Title
US11016716B2 (en) Picture interface display method and apparatus according to jump protocol
CN111897740B (en) User interface testing method and device, electronic equipment and computer readable medium
CN110619100B (en) Method and apparatus for acquiring data
CN109408754B (en) Webpage operation data processing method and device, electronic equipment and storage medium
CN110232091B (en) Method, system and apparatus for synchronizing data
CN111597107B (en) Information output method and device and electronic equipment
CN107479868A (en) A kind of interface loading method, device and equipment
CN110619096A (en) Method and apparatus for synchronizing data
CN111726675A (en) Object information display method and device, electronic equipment and computer storage medium
CN110673886B (en) Method and device for generating thermodynamic diagrams
CN111813685B (en) Automatic test method and device
CN111930761A (en) Information interaction method and device and model-view-representation architecture
CN111400581B (en) System, method and apparatus for labeling samples
CN111552620B (en) Data acquisition method, device, terminal and storage medium
CN112256370A (en) Information display method and device and electronic equipment
CN111310086A (en) Page jump method and device and electronic equipment
CN113568695A (en) Corner mark processing method and device for boarder application
CN112422648B (en) Data synchronization method and system
CN110084298B (en) Method and device for detecting image similarity
CN112311842A (en) Method and device for information interaction
WO2020078049A1 (en) User information processing method and device, server, and readable medium
CN111596987A (en) Page display method and device and electronic equipment
CN112306976A (en) Information processing method and device and electronic equipment
CN112307717A (en) Text labeling information display method and device, electronic equipment and medium
CN113407229B (en) Method and device for generating offline scripts

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