CN118277127A - View transmission method, device, system and computer readable storage medium - Google Patents
View transmission method, device, system and computer readable storage medium Download PDFInfo
- Publication number
- CN118277127A CN118277127A CN202410417192.XA CN202410417192A CN118277127A CN 118277127 A CN118277127 A CN 118277127A CN 202410417192 A CN202410417192 A CN 202410417192A CN 118277127 A CN118277127 A CN 118277127A
- Authority
- CN
- China
- Prior art keywords
- view
- custom
- file
- interface
- provider
- 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
Links
- 230000005540 biological transmission Effects 0.000 title claims abstract description 135
- 238000000034 method Methods 0.000 title claims abstract description 83
- 239000011230 binding agent Substances 0.000 claims abstract description 22
- 230000007246 mechanism Effects 0.000 claims abstract description 22
- 238000012546 transfer Methods 0.000 claims description 35
- 238000004590 computer program Methods 0.000 claims description 18
- 238000012545 processing Methods 0.000 claims description 16
- 238000006243 chemical reaction Methods 0.000 claims description 8
- 230000006870 function Effects 0.000 description 14
- 230000008569 process Effects 0.000 description 14
- 238000001514 detection method Methods 0.000 description 5
- 230000026676 system process Effects 0.000 description 4
- 238000004891 communication Methods 0.000 description 3
- 238000011161 development Methods 0.000 description 3
- 230000006399 behavior Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000010276 construction Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000009467 reduction Effects 0.000 description 2
- 230000005236 sound signal Effects 0.000 description 2
- 230000009471 action Effects 0.000 description 1
- 238000007599 discharging Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000001815 facial effect Effects 0.000 description 1
- 238000012905 input function Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 238000013404 process transfer Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/546—Message passing systems or structures, e.g. queues
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/06—Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The application discloses a view transmission method, a device, a system and a computer readable storage medium, comprising the following steps: acquiring custom view parameters created by a view provider based on a custom view interface in a pre-created cross-process transmission view class; generating a custom view file according to the custom view parameters and a preset custom view template; and transmitting the custom view file to a view display side through a binder transmission mechanism. The custom view parameters created by the custom view interface in the pre-created cross-process transmission view class do not need to be generated based on the basic control, so that the complexity of the custom view is reduced, and the transmission efficiency of the custom view can be improved.
Description
Technical Field
The present application relates to the field of view processing technologies, and in particular, to a method, an apparatus, a system, and a computer readable storage medium for transmitting views.
Background
The software development kit (software development kit, SDK) provided by the android system comprises a view class- - -RemoteViews supporting cross-process transmission, and the view class has a function of transmitting a view of a view provider to a view display party for display, and the function is typically applied to a scene displayed in a notification bar, and the scene is called cross-process view transmission.
However, the view class-RemoteViews supporting cross-process transmission, which is native to the android system, only supports the generation of views based on the basic control, and even when the custom view is generated, the basic control is required to be used as a support, the custom view is not supported to be transmitted, or the complexity of the generated custom view is higher, so that the transmission efficiency of the custom view is lower; therefore, how to improve the transmission efficiency of the custom view in the android system is an urgent problem to be solved.
Disclosure of Invention
The embodiment of the application provides a view transmission method, a device, a system and a computer readable storage medium, which can improve the transmission efficiency of custom views in an android system.
In a first aspect, an embodiment of the present application provides a view transmission method, where the method includes:
acquiring custom view parameters created by a view provider based on a custom view interface in a pre-created cross-process transmission view class;
generating a custom view file according to the custom view parameters and a preset custom view template;
And transmitting the custom view file to a view display side through a binder transmission mechanism.
In a second aspect, embodiments of the present application provide a view transmitting apparatus,
The acquisition unit is used for acquiring custom view parameters created by the view provider based on a custom view interface in a pre-created cross-process transmission view class;
The generating unit is used for generating a custom view file according to the custom view parameters and a preset custom view template;
And the transmission unit is used for transmitting the custom view file to a view display side through a binder transmission mechanism.
In a third aspect, an embodiment of the present application further provides a view transmission system, including a memory storing a computer program; the processor loads a computer program from the memory to perform the steps of any of the view transfer methods provided by the embodiments of the present application.
In a fourth aspect, embodiments of the present application further provide a computer readable storage medium storing a computer program, where the computer program is adapted to be loaded by a processor to perform any of the steps of the view transmission method provided by the embodiments of the present application.
In a fifth aspect, embodiments of the present application further provide a computer program product comprising a computer program which, when executed by a processor, implements the steps of any of the view transmission methods provided by the embodiments of the present application.
By adopting the scheme of the application embodiment, the view provider acquires the custom view parameters created based on the custom view interface in the pre-created cross-process transmission view class; generating a custom view file according to the custom view parameters and a preset custom view template; and transmitting the custom view file to a view display side through a binder transmission mechanism. The custom view parameters created by the custom view interface in the pre-created cross-process transmission view class do not need to be generated based on the basic control, so that the complexity of the custom view is reduced, and the transmission efficiency of the custom view can be improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a first embodiment of a view transmission method provided in an embodiment of the present application;
fig. 2 is a flowchart of a second embodiment of a view transmission method provided in an embodiment of the present application;
Fig. 3 is a schematic structural view of a view transmission device provided in an embodiment of the present application;
Fig. 4 is a schematic structural diagram of a view transmission system provided in an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to fall within the scope of the application. Meanwhile, in the description of the embodiments of the present application, the terms "first", "second", and the like are used only to distinguish the description, and are not to be construed as indicating or implying relative importance. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more features. In the description of the embodiments of the present application, the meaning of "plurality" is two or more, unless explicitly defined otherwise.
The embodiment of the application provides a view transmission method, a device, a system and a computer readable storage medium.
In particular, the present embodiment will be described from the viewpoint of a view transfer system which may be integrated in a view transfer apparatus in particular, that is, the view transfer method of the embodiment of the present application may be executed by the view transfer system.
The view transmission method provided by the embodiment of the application can be applied to equipment using an android system, such as a mobile terminal, a pc terminal and the like.
The following describes in detail the embodiments with reference to the drawings, in which the execution subject is a view transmission system. The following description of the embodiments is not intended to limit the preferred embodiments. Although a logical order is depicted in the flowchart, in some cases the steps shown or described may be performed in an order different than depicted in the figures.
Referring to fig. 1, a first embodiment of a view transmission method according to the present application is provided.
Preferably, this process of view transmission can be applied to the notification bar presentation class scenario. For example, the view corresponding to the notification message of the microblog is displayed in the notification bar.
Specifically, the specific flow of the first embodiment of the present application includes the contents of steps 101 to 103, and the following details of each step are described below:
Step 101, obtaining a custom view parameter created by a view provider based on a custom view interface in a pre-created cross-process transmission view class.
In this embodiment, in a device using an android system, such as a mobile terminal, a pc terminal, or the like, a view transmission system and a plurality of processes/applications are included, where when an a process/application needs to display a corresponding view in a B process/application, the a process/application is a view provider, and the B process/application is a view display.
In this embodiment, the cross-process transmission view class (RemoteViews) created in advance by the view transmission system can provide an external interface, where the external interface includes not only the event interface and the data interface of the basic control, but also the custom event data interface and the custom service data interface of the supported custom view.
In this step, the view transfer system first obtains custom view parameters created by the view provider based on the custom view interface in the pre-created cross-process transfer view class.
Specifically, the custom view interface comprises a custom event data interface and a custom service data interface, and the custom view parameters comprise custom event data created by the view provider based on the custom event data interface and custom service data created by the view provider based on the custom service data interface. Custom event data generally refers to events triggered when a user interacts with a view, such as click events, long press events, slide events, and the like. The custom service data refers to data related to a view and is used for describing or controlling the state or behavior of the view, for example, for a view of a list item, the custom service data may be information such as title, content, picture, etc. of the list item, and for a view of a button, the custom service data may be text, icon, click state, etc. of the button.
It can be understood that the pre-created cross-process transmission view class comprises a custom event data interface and a custom service data interface, and related users can create custom event data for a view provider based on the custom event data interface and create custom service data for the view provider based on the custom service data interface; because the custom event data interface and the custom service data interface are provided in the pre-created cross-process transmission view class, a basic control can be selectively not used when the custom view parameter is created, and the complexity of the custom view parameter is prevented from being improved due to the use of the basic control.
The View transmission system includes a custom RemoteViews SDK tool package, provides an external interface, an event interface and a data interface including a basic control, and also includes a custom event data interface and a custom service data interface of a supported custom View, and related developer related users can create custom event data for a View provider based on the custom event data interface and create custom service data for the View provider based on the custom service data interface.
Step 102, generating a custom view file according to the custom view parameters and a preset custom view template.
In the step, the view transmission system acquires the custom view parameters of the view provider, and generates a custom view file according to the custom view parameters and a preset custom view template.
The preset custom view template is generated in the cross-process transmission view class which is created in advance.
The custom view file comprises all necessary data corresponding to the custom view required to be displayed by the view provider, and a follow-up view display party is required to generate and display the custom view according to the custom view file.
For example, after receiving user related to developer, the view transmission system creates user event data for view provider based on user event data interface, and needs to bind user event data and user service data with each corresponding user sub-view in user view template to obtain user view file, which is UI XML view description file of serialization object after instantiation.
Optionally, the specific step of generating the custom view file according to the custom view parameter and the preset custom view template in this embodiment may include the contents of steps 1021-1023:
Step 1021, for each custom sub-view in a preset custom view template, acquiring corresponding target custom event data from the custom event data, and acquiring target custom service data from the custom service data;
In the step, the view transmission system generates a preset custom view template in a pre-created cross-process transmission view class through a view provider, wherein the custom view template comprises at least one custom sub-view which is a component part of the custom view forming the final display; the custom view interface comprises a custom event data interface and a custom service data interface, and the custom view parameters comprise custom event data created by the view provider based on the custom event data interface and custom service data created by the view provider based on the custom service data interface; for each custom sub-view in a preset custom view template, the view transmission system acquires corresponding target custom event data from the custom event data, and acquires target custom service data from the custom service data.
It can be understood that the custom event data corresponding to each custom sub-view is generally different from the custom service data of the view provider, where the custom event data of the view provider obtained by the view transmission system includes the custom event data of each custom sub-view of the custom view, and the custom service data of the view provider obtained by the view transmission system includes the custom service data of each custom sub-view of the custom view.
Step 1022, binding the target custom event data with the target custom service data and storing the binding in the custom sub-view to generate a custom sub-view file set;
In the step, the view transmission system binds and stores target custom event data and target custom service data in a custom sub-view to generate a custom sub-view file set; specifically, the view transmission system needs to bind the target custom event data and the target custom service data of each custom sub-view in the custom view template (UI XML view description file), and for the basic attribute of each custom sub-view, such as width and height, no additional binding is needed because it is already set in the custom view template.
Step 1023, generating a custom view file based on the custom sub-view file set and a preset custom view template.
In this step, the view transfer system generates a custom view file based on the custom child view file set and a preset custom view template. It can be understood that after the view transmission system view transmission binds the target custom event data and the target custom service data of each custom sub-view, a custom sub-view file set is obtained, and the custom sub-view file set and a preset custom view template are generated to generate a custom view file.
Specifically, the process/application A realizes the binding of the code writing and completion event of the custom view required to be displayed in the application/process B through the custom view interface provided by the pre-created cross-process transmission view class (RemoteViews) in the SDK provided by the embodiment, and the custom view file is obtained, and the binding of the code writing and completion event of the custom view can be realized without a basic control supported by RemoteViews, so that the complexity of the custom view file is greatly reduced.
And step 103, transmitting the custom view file to a view display side through a binder transmission mechanism.
In this step, the view transmission system transmits the custom view file to the view display side through the binder transmission mechanism after obtaining the custom view file. Specifically, the view transfer system transfers the custom view file to the view displayer through the view provider call notifyToDispay and using a system layer binder mechanism (binder transfer mechanism).
Specifically, when the custom view file is transmitted to the B process/application through a system layer binder mechanism (a binder transmission mechanism), the transmission efficiency is greatly improved; and after receiving the custom view file, the application/process analyzes the event Action, the UI description file, the displayed data and the like through rules to render the view, bind the event and bind the data through analyzing the custom view file, so as to generate and display the custom view.
Illustratively, the view transfer system notifies the binder transfer mechanism to transfer the custom view file to the view displayer by the view provider by invoking notifyToDispay. Wherein notifyToDispay this function is an imaginary function name, which aims at informing the operation of transmitting the custom view file to the display side in the code.
In summary, the view transmission system of the present embodiment obtains the custom view parameters created by the view provider based on the custom view interface in the pre-created cross-process transmission view class; generating a custom view file according to custom view parameters and a preset custom view template; and transmitting the custom view file to a view display side through a binder transmission mechanism. The custom view parameters created by the custom view interface in the cross-process transmission view class are pre-created, the custom view parameters do not need to be generated based on the basic control, the complexity of the custom view parameters is further reduced, the complexity of the custom view files generated according to the custom view parameters and the preset custom view templates can be further reduced, and when the custom view files are transmitted to the view display side through the binder transmission mechanism, the transmission efficiency of the custom view can be improved due to the reduction of the complexity of the custom view files.
Referring to fig. 2, a second embodiment of the view transmission method according to the present application is presented based on the embodiment of fig. 1.
Specifically, the specific flow of the second embodiment of the present application includes the contents of steps 201 to 205, and the following details of each step are described below:
In step 201, the acquisition view provider obtains custom view parameters created based on a custom view interface in a pre-created cross-process transport view class.
This step can be understood by referring to the content of step 101 in the embodiment of fig. 1, which is not described herein.
Step 202, generating a custom view file according to the custom view parameters and a preset custom view template.
This step can be understood by referring to the content of step 102 in the embodiment of fig. 1, which is not described herein.
And step 203, transmitting the custom view file to a view display side through a binder transmission mechanism.
This step can be understood by referring to the content of step 103 in the embodiment of fig. 1, which is not described herein.
Step 204, creating a context object of the view provider, and obtaining a custom view interface based on the context object and the custom view file;
In this step, the view transmission system creates a context object of the view provider, and renders, adjusts and strongly converts the custom view file based on the context object, resulting in a custom view interface.
Among other things, context Object is a common concept in software development that provides an interface to access application resources and perform certain operations. In different programming environments and frameworks, the context objects may have different meanings and functions. In Android development, context objects are an important concept. It represents the state and environment of the current application and provides a way to access system services, resources, and application components. In Android, all Activity, service, broadcastReceiver and ContentProvider are subclasses of Context, which can be used as Context objects. The context object has the following important functions in Android development:
Accessing a resource: the context object allows access to resources of the application, such as strings, images, layouts, etc. By invoking a context object, resources associated with an application may be obtained.
And (3) starting the assembly: the context object provides a method to launch other components, such as launching a new Activity, launching a service, or sending a broadcast. Individual components may be launched and managed in an application by a context object.
Accessing system services: the context object allows access to various services provided by the Android system, such as notification manager, sensor service, location service, and the like. Through the context object you can get an instance of these system services.
Acquiring application information: the context object provides a method for obtaining information of the package name, version number, application context, and the like. Through the context object, relevant information of the application program can be acquired.
Specifically, the step of "creating a context object of the view provider" includes the contents of steps 2041-2048:
Step 2041, verifying whether the view provider has system rights;
In this step, the view transfer system verifies whether the view provider has system rights. Specifically, the view transmission system may acquire the rights parameters of the view provider, and verify whether the view provider has the system rights according to the rights parameters.
Step 2042, if it is determined that the view provider has the system authority, acquiring an application name and a first flag parameter of the view provider, and generating a context object of the view provider according to the application name and the first flag parameter;
In the step, if the view transmission system determines that the view provider has the system authority, the application name and the first flag parameter of the view provider are acquired, and the context object of the view provider is generated according to the application name and the first flag parameter. Specifically, for an Application with system rights, a context object of the view provider can be generated through a context. CreateApplationContext (mApplication, context. Context_ RESTRICT ED) interface, wherein mApplication is an Application name of the view provider, mApplication generally refers to an Application object of a current Application program, and an Application class is a global single instance class, can be created and initialized when the Application program is started, and can be used for initializing Application-level resources and configuration information; context_restricted is a first flag parameter, context_restricted is a parameter constant that indicates that acquisition is limited to the current application context object, and if the context object is acquired using this parameter, the returned context object will not be able to access system level resources, such as system services and other application resources.
Step 2043, if it is determined that the view provider does not have the system authority, acquiring an application package name and a second flag parameter of the view provider, and generating a context object of the view provider according to the application package name and the second flag parameter.
In the step, if the view transmission system determines that the view provider does not have the system authority, the view provider application package name and the second flag bit parameter are acquired, and the context object of the view provider is generated according to the application package name and the second flag bit parameter. Specifically, for applications without system rights, a context object of the view provider is generated by context, createPackageContext (STRING PACKAGENAME, int flag), where STRING PACKAGENAME is an application package name, and in Android, each application must have a unique package name to identify the application and distinguish it from other applications; the int flag is a second flag parameter, an integer type parameter, used to specify some flags or options in Android development, which can be used to control the behavior of the method to meet specific requirements.
Specifically, based on the context object and the custom view file, a custom view interface is obtained, including:
Step 2044, based on the context object, determining a view resource identifier corresponding to each custom sub-view file in the custom view file;
and 2045, obtaining a corresponding view resource based on the view resource identifier to render, and obtaining a custom view object.
In steps 2044 to 2045, the view transmission system determines, based on the context object, a view resource identifier corresponding to each custom sub-view file in the custom view file, obtains a corresponding view resource based on the view resource identifier, and renders the view resource to obtain a custom sub-view object corresponding to each custom sub-view file, and further generates a custom view object according to all the custom sub-view objects. Specifically, the view transmission system calls a layoutInformater/inplate interface to render each custom sub-view file in the custom view file to render, so as to obtain a custom view object.
Step 2046, processing the custom view object to generate a custom base view;
In the step, the view transmission system processes the custom view object to generate a custom base view, specifically, the view transmission system processes the custom view object through a view display side by adopting custom LayoutInflater and rewriting onCreateView (STRING NAME, attributeSet attrs) to generate a custom base view; wherein onCreateView (STRING NAME, attributeSet attrs) is one of methods for creating custom views, which is commonly used in the construction and initialization process of custom views, and which is commonly used in the code of custom views, and which is commonly called in the construction function of custom views, for parsing attributes in XML layout files (custom view files) and initializing views; layoutInflater is a class in Android that is used to load XML layout files and instantiate corresponding view objects that allows a developer to convert an XML layout file into its corresponding view objects.
Further, step 2046 includes:
Step 20461, obtaining a custom view name and a custom view class package name of the custom view object, and splicing the custom view name and the custom view class package name to obtain a custom view class name;
In the step, the view transmission system acquires a custom view name and a custom view class package name of a custom view object, and splices the custom view name and the custom view class package name to obtain the custom view class name; specifically, the view transmission system processes the custom view object by adopting custom LayoutInflater and rewriting onCreateView (STRING NAME, attributeSet attrs), acquires the name parameter (custom view name) of the input and the class packet name of the supported custom view by intercepting onCreateView, and performs secondary splicing, for example com.tcl.remoteViews. $ { name }, where name is the name value returned by onCreateView method; and splicing the obtained custom view names and the custom view class package names to obtain the complete custom view class names.
Step 20462, loading the custom view class based on the custom view class name and the preset loader, and generating a custom base view based on the custom view class.
In this step, the view transfer system loads the custom view class based on the custom view class name and the preset loader, and generates a custom base view based on the custom view class. Specifically, the view transmission system acquires a corresponding custom view class package in the custom view object according to the custom view class name, and loads resources provided by a view provider in the custom view class package based on a classLoader class loader of classLoader constructed in advance in the view display side to generate the custom view class. Class loader is used for loading byte code files and generating corresponding class objects, and in Android, class loader is also widely applied to loading various resources in application programs, such as layout files, pictures, audio and the like, and various resources, plugins and the like are loaded by using class loader so as to realize functions of dynamic loading, updating and the like.
Step 2047, adjusting the custom basic view based on the basic attribute parameters in the custom view object to obtain a custom reference view;
In this step, the view transmission system adjusts the custom base view based on the basic attribute parameters in the custom view object to obtain the custom view. Specifically, in the foregoing step, the view transmission system processes the custom view object by using the custom LayoutInflater and the rewrite onCreateView (STRING NAME, attributeSet attrs), the view transmission system intercepts onCreateView, obtains AttributeSet attrs, attributeSet attrs basic attribute parameters in the custom view object, and adjusts the custom basic view according to the basic attribute parameters to obtain the custom reference view.
And 2048, performing strong conversion processing on the custom reference view to obtain a target view interface.
In the step, the view transmission system performs strong conversion processing on the user-defined reference view and the target view interface. The practical implementation steps of the interface for strongly converting the self-defined reference view into the target view are as follows: setting logic of data binding and logic of event binding in the custom reference view, and performing strong conversion processing on the custom reference view according to the set type of the target interface to obtain the target view interface.
Step 205, generating and displaying, by the view display, a custom view based on the custom view interface and the custom view file.
In this step, the view transmission system generates and displays a custom view based on the custom view interface and the custom view file through the view displayer.
Specifically, step 205 includes:
step 2051, obtaining, by the view display, a custom event data set and a custom service data set in the custom view file;
step 2052, binding the custom event data set and the custom service data set with the custom view interface by the view display side, and generating and displaying a custom view.
In steps 2051 to 2052, the view transmission system acquires a custom event data set and a custom service data set in a custom view file through a view display; and binding the custom event data set and the custom service data set with the custom view interface to generate and display the custom view.
The view transmission system of the embodiment transmits the custom view parameters created by the custom view interface in the view class through the pre-created cross-process without generating the custom view parameters based on the basic control, thereby reducing the complexity of the custom view parameters, further reducing the complexity of the custom view files generated according to the custom view parameters and the pre-set custom view templates, and improving the transmission efficiency of the custom view due to the reduction of the complexity of the custom view files when transmitting the custom view files to the view display through the binder transmission mechanism. And transmitting the custom view file to the view display side through a binder transmission mechanism; creating a context object of the view provider, and obtaining a custom view interface based on the context object and the custom view file; the view display side generates and displays the custom view based on the target view interface and the custom view file, so that the custom view is prevented from being generated after the view display side sequences and deserializes the custom view file, the steps of serialization and deserialization are reduced, the time for converting the custom view file into the custom view by the view display side is shortened, and the display efficiency of the custom view is further improved.
The embodiment also provides a view transmission device, which may be specifically integrated into a device using an android system, such as a mobile terminal, a pc terminal, and the like, as shown in fig. 3, where the view transmission device may include:
An obtaining unit 1001, configured to obtain a custom view parameter created by a view provider based on a custom view interface in a pre-created cross-process transmission view class;
A generating unit 1002, configured to generate a custom view file according to the custom view parameter and a preset custom view template;
A transmission unit 1003, configured to transmit the custom view file to a view display party through a binder transmission mechanism.
In an alternative example, the generating unit is further configured to:
Aiming at each custom sub-view in a preset custom view template, acquiring corresponding target custom event data from the custom event data, and acquiring target custom service data from the custom service data;
Binding the target custom event data with the target custom service data and storing the target custom event data and the target custom service data in the custom sub-view to generate a custom sub-view file set;
And generating a custom view file based on the custom sub-view file set and a preset custom view template.
In an alternative example, the view transmission apparatus further includes:
The creation unit is used for creating a context object of the view provider and obtaining a target view interface based on the context object and the custom view file;
and the creation unit is used for generating and displaying a custom view based on the target view interface and the custom view file through the view display party.
In an alternative example, the creation unit is further configured to:
Verifying whether the view provider has system rights;
if the view provider is determined to have the system authority, acquiring an application name and a first zone bit parameter of the view provider, and generating a context object of the view provider according to the application name and the first zone bit parameter;
and if the view provider does not have the system authority, acquiring an application package name and a second zone bit parameter of the view provider, and generating a context object of the view provider according to the application package name and the second zone bit parameter.
In an alternative example, the creation unit is further configured to:
determining view resource identifiers corresponding to each custom sub-view file in the custom view files based on the context objects;
obtaining corresponding view resources based on the view resource identifiers to render, and obtaining custom view objects;
Processing the custom view object to generate a custom base view;
Adjusting the custom basic view based on basic attribute parameters in the custom view object to obtain a custom reference view;
and performing strong conversion processing on the self-defined reference view to obtain a target view interface.
In an alternative example, the creation unit is further configured to:
Acquiring a custom view name and a custom view class package name of the custom view object, and splicing the custom view name and the custom view class package name to obtain a custom view class name;
And loading the custom view class based on the custom view class name and a preset loader, and generating a custom base view based on the custom view class.
In an alternative example, the display unit is further configured to:
acquiring a custom event data set and a custom service data set in the custom view file through the view display side;
And binding the custom event data set and the custom service data set with the custom view interface through the view display side to generate and display a custom view.
By adopting the scheme of the embodiment, the custom view parameters created by the custom view interface in the cross-process transmission view class are created in advance, and the custom view is not required to be generated based on the basic control, so that the complexity of the custom view is reduced, and the transmission efficiency of the custom view can be improved; by creating the target view interface and combining the custom view file to generate and display the custom view, serialization and inverse serialization of the custom view are avoided, and the efficiency of displaying the custom view is improved.
Correspondingly, the embodiment of the application also provides a view transmission system, as shown in fig. 4, and fig. 4 is a schematic structural diagram of the view transmission system provided by the embodiment of the application. The view transfer system 1100 includes a processor 1101 having one or more processing cores, a memory 1102 having one or more computer readable storage media, and a computer program stored on the memory 1102 and executable on the processor. The processor 1101 is electrically connected to the memory 1102. It will be appreciated by those skilled in the art that the view transfer system structure shown in the figures does not constitute a limitation of the view transfer system and may include more or less components than illustrated, or may combine certain components, or may have a different arrangement of components.
The processor 1101 is a control center of the view transfer system 1100, connects various parts of the entire view transfer system 1100 using various interfaces and lines, and performs various functions of the view transfer system 1100 and processes data by running or loading software programs and/or units stored in the memory 1102 and invoking data stored in the memory 1102, thereby performing overall monitoring of the view transfer system 1100. The processor 1101 may be a processor CPU, a graphics processor GPU, a network processor (Network Processor, NP), etc., that may implement or perform the methods, steps, and logic blocks disclosed in embodiments of the present application.
In an embodiment of the present application, the processor 1101 in the view transmission system 1100 loads instructions corresponding to the processes of one or more application programs into the memory 1102 according to the following steps, and the processor 1101 executes the application programs stored in the memory 1102, so as to implement various functions, for example:
acquiring custom view parameters created by a view provider based on a custom view interface in a pre-created cross-process transmission view class;
generating a custom view file according to the custom view parameters and a preset custom view template;
And transmitting the custom view file to a view display side through a binder transmission mechanism.
In an alternative example, further comprising:
The custom view interface comprises a custom event data interface and a custom service data interface, the custom view parameters comprise custom event data created by the view provider based on the custom event data interface and custom service data created by the view provider based on the custom service data interface, and the generating of the custom view file according to the custom view parameters and a preset custom view template comprises:
Aiming at each custom sub-view in a preset custom view template, acquiring corresponding target custom event data from the custom event data, and acquiring target custom service data from the custom service data;
Binding the target custom event data with the target custom service data and storing the target custom event data and the target custom service data in the custom sub-view to generate a custom sub-view file set;
And generating a custom view file based on the custom sub-view file set and a preset custom view template.
In an alternative example, further comprising:
creating a context object of the view provider, and obtaining a target view interface based on the context object and the custom view file;
and generating and displaying a custom view based on the target view interface and the custom view file by the view display.
In an alternative example, further comprising:
Verifying whether the view provider has system rights;
if the view provider is determined to have the system authority, acquiring an application name and a first zone bit parameter of the view provider, and generating a context object of the view provider according to the application name and the first zone bit parameter;
and if the view provider does not have the system authority, acquiring an application package name and a second zone bit parameter of the view provider, and generating a context object of the view provider according to the application package name and the second zone bit parameter.
In an alternative example, further comprising:
determining view resource identifiers corresponding to each custom sub-view file in the custom view files based on the context objects;
obtaining corresponding view resources based on the view resource identifiers to render, and obtaining custom view objects;
Processing the custom view object to generate a custom base view;
Adjusting the custom basic view based on basic attribute parameters in the custom view object to obtain a custom reference view;
and performing strong conversion processing on the self-defined reference view to obtain a target view interface.
In an alternative example, further comprising:
Acquiring a custom view name and a custom view class package name of the custom view object, and splicing the custom view name and the custom view class package name to obtain a custom view class name;
And loading the custom view class based on the custom view class name and a preset loader, and generating a custom base view based on the custom view class.
In an alternative example, further comprising:
acquiring a custom event data set and a custom service data set in the custom view file through the view display side;
And binding the custom event data set and the custom service data set with the custom view interface through the view display side to generate and display a custom view.
Therefore, the custom view parameters created by the custom view interface in the cross-process transmission view class are created in advance, the custom view is not required to be generated based on the basic control, the complexity of the custom view is further reduced, and the transmission efficiency of the custom view can be improved; by creating the target view interface and combining the custom view file to generate and display the custom view, serialization and inverse serialization of the custom view are avoided, and the efficiency of displaying the custom view is improved.
The specific implementation of each operation above may be referred to the previous embodiments, and will not be described herein.
Optionally, as shown in fig. 4, the view transmission system 1100 further includes: a touch display 1103, a radio frequency circuit 1104, an audio circuit 1105, an input unit 1106, and a power supply 1107. The processor 1101 is electrically connected to the touch display 1103, the radio frequency circuit 1104, the audio circuit 1105, the input unit 1106, and the power supply 1107, respectively. It will be appreciated by those skilled in the art that the view transfer system structure shown in fig. 3 is not limiting of the view transfer system and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
The touch display 1103 may be used to display a graphical user interface and receive an operation instruction generated by a user acting on the graphical user interface. The touch display 1103 may include a display panel and a touch panel. Wherein the display panel may be used to display information entered by a user or provided to a user and various graphical user interfaces of the view transfer system, which may be composed of graphics, text, icons, video and any combination thereof. Alternatively, the display panel may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. The touch panel may be used to collect touch operations on or near the user (such as operations on or near the touch panel by the user using any suitable object or accessory such as a finger, stylus, etc.), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Alternatively, the touch panel may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch azimuth 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 detection device, converts it into touch point coordinates, and sends the touch point coordinates to the processor 1101, and can receive and execute commands sent from the processor 1101. The touch panel may overlay the display panel, and upon detection of a touch operation thereon or thereabout, the touch panel is passed to the processor 1101 to determine the type of touch event, and the processor 1101 then provides a corresponding visual output on the display panel based on the type of touch event. In the embodiment of the present application, the touch panel and the display panel may be integrated into the touch display 1103 to realize the input and output functions. In some embodiments, however, the touch panel and the touch panel may be implemented as two separate components to perform the input and output functions. I.e. the touch screen 1103 may also implement an input function as part of the input unit 1106.
The rf circuitry 1104 may be used to transceive rf signals to establish wireless communications with a network device or other view transfer system via wireless communications.
The audio circuit 1105 may be used to provide an audio interface between the user and the view transfer system through speakers, microphones. The audio circuit 1105 may transmit the received electrical signal after audio data conversion to a speaker, where the electrical signal is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signals into electrical signals, which are received by the audio circuit 1105 and converted into audio data, which are processed by the audio data output processor 1101, and transmitted to, for example, another view transmission system via the radio frequency circuit 1104, or the audio data are output to the memory 1102 for further processing. The audio circuit 1105 may also include an ear bud jack to provide communication of the peripheral headphones with the view transfer system.
The input unit 1106 may be used to receive input numbers, character information, or user characteristic information (e.g., fingerprint, iris, facial information, etc.), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
A power supply 1107 is used to power the various components of the view transfer system 1100. Alternatively, the power supply 1107 may be logically connected to the processor 1101 through a power management system, so as to perform functions of managing charging, discharging, and power consumption management through the power management system. The power supply 1107 may also include one or more of any of a direct current or alternating current power supply, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
Although not shown in fig. 4, the view transmission system 1100 may further include a camera, a sensor, a wireless fidelity module, a bluetooth module, etc., which are not described herein.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that all or a portion of the steps of the various methods of the above embodiments may be performed by instructions, or by instructions controlling associated hardware, which may be stored in a computer-readable storage medium and loaded and executed by a processor.
To this end, an embodiment of the present application provides a computer readable storage medium in which a plurality of computer programs are stored, the computer programs being capable of being loaded by a processor to perform any of the view transmission methods provided by the embodiment of the present application. The computer program may perform the steps of the view transmission method as follows:
acquiring custom view parameters created by a view provider based on a custom view interface in a pre-created cross-process transmission view class;
generating a custom view file according to the custom view parameters and a preset custom view template;
And transmitting the custom view file to a view display side through a binder transmission mechanism.
In an alternative example, further comprising:
The custom view interface comprises a custom event data interface and a custom service data interface, the custom view parameters comprise custom event data created by the view provider based on the custom event data interface and custom service data created by the view provider based on the custom service data interface, and the generating of the custom view file according to the custom view parameters and a preset custom view template comprises:
Aiming at each custom sub-view in a preset custom view template, acquiring corresponding target custom event data from the custom event data, and acquiring target custom service data from the custom service data;
Binding the target custom event data with the target custom service data and storing the target custom event data and the target custom service data in the custom sub-view to generate a custom sub-view file set;
And generating a custom view file based on the custom sub-view file set and a preset custom view template.
In an alternative example, further comprising:
creating a context object of the view provider, and obtaining a target view interface based on the context object and the custom view file;
and generating and displaying a custom view based on the target view interface and the custom view file by the view display.
In an alternative example, further comprising:
Verifying whether the view provider has system rights;
if the view provider is determined to have the system authority, acquiring an application name and a first zone bit parameter of the view provider, and generating a context object of the view provider according to the application name and the first zone bit parameter;
and if the view provider does not have the system authority, acquiring an application package name and a second zone bit parameter of the view provider, and generating a context object of the view provider according to the application package name and the second zone bit parameter.
In an alternative example, further comprising:
determining view resource identifiers corresponding to each custom sub-view file in the custom view files based on the context objects;
obtaining corresponding view resources based on the view resource identifiers to render, and obtaining custom view objects;
Processing the custom view object to generate a custom base view;
Adjusting the custom basic view based on basic attribute parameters in the custom view object to obtain a custom reference view;
and performing strong conversion processing on the self-defined reference view to obtain a target view interface.
In an alternative example, further comprising:
Acquiring a custom view name and a custom view class package name of the custom view object, and splicing the custom view name and the custom view class package name to obtain a custom view class name;
And loading the custom view class based on the custom view class name and a preset loader, and generating a custom base view based on the custom view class.
In an alternative example, further comprising:
acquiring a custom event data set and a custom service data set in the custom view file through the view display side;
And binding the custom event data set and the custom service data set with the custom view interface through the view display side to generate and display a custom view.
Therefore, the custom view parameters created by the custom view interface in the cross-process transmission view class are created in advance, the custom view is not required to be generated based on the basic control, the complexity of the custom view is further reduced, and the transmission efficiency of the custom view can be improved; by creating the target view interface and combining the custom view file to generate and display the custom view, serialization and inverse serialization of the custom view are avoided, and the efficiency of displaying the custom view is improved.
The specific implementation of each operation above may be referred to the previous embodiments, and will not be described herein.
Wherein the computer-readable storage medium may comprise: read Only Memory (ROM), random access Memory (RAM, random Access Memory), magnetic or optical disk, and the like.
Because the computer program stored in the computer readable storage medium can execute any view transmission method provided by the embodiment of the present application, the beneficial effects that any view transmission method provided by the embodiment of the present application can achieve can be achieved, and detailed descriptions of the foregoing embodiments are omitted herein.
According to one aspect of the present application, there is also provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the view transfer system reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the view transfer system performs the methods provided in the various alternative implementations of the above embodiments.
In the embodiments of the view transmission device, the computer readable storage medium, the view transmission system and the computer program product, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to related descriptions of other embodiments. It will be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process and the beneficial effects of the above-described view transmission apparatus, computer readable storage medium, computer program product, view transmission system and corresponding units thereof may be referred to the description of the view transmission method in the above embodiments, which is not repeated herein.
The foregoing has outlined rather broadly the principles and embodiments of the present application in order that the detailed description of the application that follows may be better understood, and in order that the present application may be better understood; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in light of the ideas of the present application, the present description should not be construed as limiting the present application.
Claims (10)
1.A view transmission method, characterized in that the view transmission method comprises:
acquiring custom view parameters created by a view provider based on a custom view interface in a pre-created cross-process transmission view class;
generating a custom view file according to the custom view parameters and a preset custom view template;
And transmitting the custom view file to a view display side through a binder transmission mechanism.
2. The view transmission method according to claim 1, wherein the custom view interface includes a custom event data interface and a custom service data interface, the custom view parameters include custom event data created by the view provider based on the custom event data interface and custom service data created by the view provider based on the custom service data interface, and the generating a custom view file according to the custom view parameters and a preset custom view template includes:
Aiming at each custom sub-view in a preset custom view template, acquiring corresponding target custom event data from the custom event data, and acquiring target custom service data from the custom service data;
Binding the target custom event data with the target custom service data and storing the target custom event data and the target custom service data in the custom sub-view to generate a custom sub-view file set;
And generating a custom view file based on the custom sub-view file set and a preset custom view template.
3. The view transmission method according to claim 1, wherein after the transmitting the custom view file to the view display side by the binder transmission mechanism, the method comprises:
creating a context object of the view provider, and obtaining a target view interface based on the context object and the custom view file;
and generating and displaying a custom view based on the target view interface and the custom view file by the view display.
4. A method of view transfer according to claim 3, wherein said creating a context object for the view provider comprises:
Verifying whether the view provider has system rights;
if the view provider is determined to have the system authority, acquiring an application name and a first zone bit parameter of the view provider, and generating a context object of the view provider according to the application name and the first zone bit parameter;
and if the view provider does not have the system authority, acquiring an application package name and a second zone bit parameter of the view provider, and generating a context object of the view provider according to the application package name and the second zone bit parameter.
5. A method of view transfer according to claim 3, wherein the obtaining a target view interface based on the context object and the custom view file includes:
determining view resource identifiers corresponding to each custom sub-view file in the custom view files based on the context objects;
obtaining corresponding view resources based on the view resource identifiers to render, and obtaining custom view objects;
Processing the custom view object to generate a custom base view;
Adjusting the custom basic view based on basic attribute parameters in the custom view object to obtain a custom reference view;
and performing strong conversion processing on the self-defined reference view to obtain a target view interface.
6. The view transmission method according to claim 5, wherein the processing the custom view object to generate a custom base view includes:
Acquiring a custom view name and a custom view class package name of the custom view object, and splicing the custom view name and the custom view class package name to obtain a custom view class name;
And loading the custom view class based on the custom view class name and a preset loader, and generating a custom base view based on the custom view class.
7. A method of view transmission according to claim 3, wherein said generating and displaying, by said view displayer, a custom view based on said custom view interface and said custom view file, comprises:
acquiring a custom event data set and a custom service data set in the custom view file through the view display side;
And binding the custom event data set and the custom service data set with the custom view interface through the view display side to generate and display a custom view.
8. A view transmission device, the device comprising:
the acquisition unit is used for acquiring custom view parameters created by the view provider based on a custom view interface in a pre-created cross-process transmission view class;
The generating unit is used for generating a custom view file according to the custom view parameters and a preset custom view template;
And the transmission unit is used for transmitting the custom view file to a view display side through a binder transmission mechanism.
9. A view transmission system comprising a processor and a memory, the memory storing a computer program; the processor loads a computer program from the memory to perform the steps of the view transfer method according to any of claims 1-7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, which is adapted to be loaded by a processor for performing the steps of the view transfer method according to any of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410417192.XA CN118277127A (en) | 2024-04-03 | 2024-04-03 | View transmission method, device, system and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410417192.XA CN118277127A (en) | 2024-04-03 | 2024-04-03 | View transmission method, device, system and computer readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN118277127A true CN118277127A (en) | 2024-07-02 |
Family
ID=91639449
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410417192.XA Pending CN118277127A (en) | 2024-04-03 | 2024-04-03 | View transmission method, device, system and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN118277127A (en) |
-
2024
- 2024-04-03 CN CN202410417192.XA patent/CN118277127A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112257135B (en) | Model loading method and device based on multithreading, storage medium and terminal | |
EP3793169B1 (en) | Application function implementation method and electronic device | |
US20240111473A1 (en) | Distributed display method and terminal for application interface | |
JP2023506936A (en) | MULTI-SCREEN COOPERATION METHOD AND SYSTEM AND ELECTRONIC DEVICE | |
GB2547536A (en) | Application containers with dynamic sub-package loading | |
EP4220627A1 (en) | Control method and apparatus, and electronic device | |
WO2022127661A1 (en) | Application sharing method, and electronic device and storage medium | |
CN109933381B (en) | Kernel loading method and device | |
CN114741008B (en) | Distributed cross-device cooperation method, electronic device and communication system | |
CN106027631B (en) | Data transmission method and device | |
CN113593279B (en) | Vehicle, interaction parameter adjusting method thereof and mobile terminal | |
JP7319431B2 (en) | Application function implementation method and electronic device | |
WO2022161024A1 (en) | Upgrade prompt method, terminal device, and computer readable storage medium | |
CN111435318A (en) | Dex optimization method of application program and terminal | |
WO2024212776A1 (en) | Resource reloading method and apparatus, electronic device, and storage medium | |
CN112114883A (en) | Terminal awakening method, terminal and computer storage medium | |
CN118277127A (en) | View transmission method, device, system and computer readable storage medium | |
JP7632831B2 (en) | Screen projection method and related device | |
CN113760164B (en) | Display device and response method of its control operation | |
CN113886070A (en) | Device information management method, device and computer readable storage medium | |
CN116263683A (en) | Cross-equipment display method and equipment system for application interface | |
CN111159734A (en) | Communication terminal and multi-application data inter-access processing method | |
CN115100994B (en) | A control method, host computer and terminal for medical film reading display | |
WO2024109443A1 (en) | Device connection method, device and system | |
WO2024078306A1 (en) | Banner notification message display method and electronic device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |