Dynamic debugging method, device, system and equipment for user interface and storage medium
By building and updating the Java Bean object collection in the user interface layout file, the problem of user interface adjustment in Android application development needs to be waited for compilation is solved, and dynamic update of user interface attributes and improvement of development efficiency is achieved.
Patent Information
- Application Number
- CN202411116278.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-14
- Publication Date
- 2025-03-04
AI Technical Summary
In Android application development, user interface details adjustments need to wait for several minutes to complete before the results can be seen, resulting in serious slowdown in project development efficiency.
By obtaining the layout file of the currently modified user interface, building a collection of Java Bean objects corresponding to the property values of the view label, and updating the property values of the subview objects, realizing hot updates of the layout file.
It realizes dynamic update of user interface attributes, eliminates the process of project compilation and construction, and improves UI development and debugging efficiency.
Smart Images

Figure CN119556921A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software development, and in particular to a user interface dynamic debugging method, device, equipment and storage medium. Background Art
[0002] With the rapid development of mobile Internet, the functions of Android applications have increased, resulting in an increasing amount of engineering code in Android application development projects. The compilation time of the project has increased from tens of seconds to several minutes. For some detailed adjustments to the user interface, such as adjusting the font color, size or text, these adjustments usually only modify one line of code, but it takes several minutes of compilation to see the effect of the user interface modification, which seriously slows down the project development efficiency. Summary of the invention
[0003] The main purpose of the present invention is to provide a user interface dynamic debugging method, device, equipment and storage medium, aiming to solve the technical problem of how to improve the efficiency of user interface debugging.
[0004] A first aspect of the present invention provides a user interface dynamic debugging method, the user interface dynamic debugging method comprising:
[0005] Obtaining the layout file of the currently modified user interface, and constructing a Java Bean object set corresponding to the attribute value of each view tag in the layout file;
[0006] Obtain the root layout of the currently displayed user interface, and obtain the ID string values corresponding to all subview objects from the root layout;
[0007] Based on each of the ID string values, searching for a target Java Bean object in the Java Bean object set that matches each of the ID string values;
[0008] Based on the value of each target Java Bean object, the attribute value of the target subview object corresponding to each ID string value is updated.
[0009] Optionally, in a first implementation of the first aspect of the present invention, the obtaining of the layout file of the currently modified user interface and constructing a Java Bean object set corresponding to the attribute value of each view tag in the layout file includes:
[0010] Obtain the layout file of the currently modified user interface, wherein the layout file is in XLM format;
[0011] Identify all view tags in the layout file for adjusting the user interface;
[0012] Parsing each of the view tags respectively to obtain the attribute value of each of the view tags;
[0013] Java Bean objects corresponding to the attribute values of the view tags are constructed respectively to obtain a Java Bean object set, wherein each Java Bean object contains the ID string value of the corresponding view tag.
[0014] Optionally, in a second implementation of the first aspect of the present invention, updating the attribute value of the target subview object corresponding to each ID string value based on the value of each target Java Bean object includes:
[0015] Determine whether there is a numerical difference between each value of each target Java Bean object and each attribute value of the target subview object corresponding to the ID string value;
[0016] If there is a difference in values, then based on the values of the target Java Bean objects, the attribute values of the corresponding target subview objects are updated respectively.
[0017] A second aspect of the present invention further provides a user interface dynamic debugging method, the user interface dynamic debugging method comprising:
[0018] Receive a JSON string after serialization of a Java Bean object collection, wherein the Java Bean object collection is constructed based on the attribute values of each view tag in the layout file of the currently modified user interface;
[0019] Deserialize the JSON string to obtain the Java Bean object set;
[0020] Obtain the root layout of the currently displayed user interface, and obtain the ID string values corresponding to all subview objects from the root layout;
[0021] Based on each of the ID string values, searching for a target Java Bean object in the Java Bean object set that matches each of the ID string values;
[0022] Based on the value of each target Java Bean object, the attribute value of the target subview object corresponding to each ID string value is updated.
[0023] Optionally, in a first implementation method of the second aspect of the present invention, the layout file of the user interface is modified in the first terminal, the user interface is dynamically debugged in the second terminal, the first terminal and the second terminal are connected using a Socket, and the JSON string is sent from the first terminal to the second terminal through the Socket connection.
[0024] Optionally, in a second implementation of the second aspect of the present invention, the JSON string is obtained in the following manner:
[0025] Obtain the layout file of the currently modified user interface, wherein the layout file is in XLM format;
[0026] Identify all view tags in the layout file for adjusting the user interface;
[0027] Parsing each of the view tags respectively to obtain the attribute value of each of the view tags;
[0028] Constructing Java Bean objects corresponding to the attribute values of each view tag respectively to obtain a Java Bean object set, wherein each Java Bean object contains the ID string value of the corresponding view tag;
[0029] Serialize each Java Bean object into a JSON string.
[0030] A third aspect of the present invention provides a user interface dynamic debugging device, the user interface dynamic debugging device comprising:
[0031] A first acquisition module is used to acquire a layout file of the currently modified user interface and construct a Java Bean object set corresponding to the attribute value of each view tag in the layout file;
[0032] A second acquisition module is used to acquire the root layout of the currently displayed user interface, and acquire the ID string values corresponding to all subview objects from the root layout;
[0033] A first search module, used for searching, based on each of the ID string values, target Java Bean objects in the Java Bean object set that match each of the ID string values;
[0034] The first updating module is used to update the attribute value of the target subview object corresponding to each ID string value based on the value of each target Java Bean object.
[0035] Optionally, in a first implementation manner of the third aspect of the present invention, the first acquisition module is specifically configured to:
[0036] Obtain the layout file of the currently modified user interface, wherein the layout file is in XLM format;
[0037] Identify all view tags in the layout file for adjusting the user interface;
[0038] Parsing each of the view tags respectively to obtain the attribute value of each of the view tags;
[0039] Java Bean objects corresponding to the attribute values of the view tags are constructed respectively to obtain a Java Bean object set, wherein each Java Bean object contains the ID string value of the corresponding view tag.
[0040] Optionally, in a second implementation of the third aspect of the present invention, the first update module is specifically configured to:
[0041] Determine whether there are numerical differences between the numerical values of the target Java Bean objects and the attribute values of the target subview objects corresponding to the ID string values;
[0042] If there is a difference in values, then based on the values of the target Java Bean objects, the attribute values of the corresponding target subview objects are updated respectively.
[0043] A fourth aspect of the present invention further provides a user interface dynamic debugging device, the user interface dynamic debugging device comprising:
[0044] A receiving module, used to receive a JSON string serialized from a Java Bean object set, wherein the Java Bean object set is constructed based on the attribute values of each view tag in the layout file of the currently modified user interface;
[0045] A deserialization module, used to deserialize the JSON string to obtain the Java Bean object set;
[0046] A third acquisition module is used to acquire the root layout of the currently displayed user interface, and acquire the ID string values corresponding to all subview objects from the root layout;
[0047] A second search module is used to search the Java Bean object set for target Java Bean objects that match the respective ID string values based on the respective ID string values;
[0048] The second updating module is used to update the attribute value of the target subview object corresponding to each ID string value based on the value of each target Java Bean object.
[0049] Optionally, in a first implementation method of the fourth aspect of the present invention, the layout file of the user interface is modified in the first terminal, the user interface is dynamically debugged in the second terminal, the first terminal and the second terminal are connected using a Socket, and the JSON string is sent from the first terminal to the second terminal through the Socket connection.
[0050] Optionally, in a second implementation of the fourth aspect of the present invention, the JSON string is obtained in the following manner:
[0051] Obtain the layout file of the currently modified user interface, wherein the layout file is in XLM format;
[0052] Identify all view tags in the layout file for adjusting the user interface;
[0053] Parsing each of the view tags respectively to obtain the attribute value of each of the view tags;
[0054] Constructing Java Bean objects corresponding to the attribute values of each view tag respectively to obtain a Java Bean object set, wherein each Java Bean object contains the ID string value of the corresponding view tag;
[0055] Serialize each Java Bean object into a JSON string.
[0056] A fifth aspect of the present invention provides a user interface dynamic debugging system, the user interface dynamic debugging system comprising a first terminal and a second terminal, the first terminal and the second terminal are connected by a Socket;
[0057] The first terminal is used to: obtain a layout file of the currently modified user interface, wherein the layout file is in XLM format; identify all view tags in the layout file used to adjust the user interface; parse each view tag to obtain the attribute value of each view tag; construct a JavaBean object corresponding to the attribute value of each view tag to obtain a Java Bean object set, wherein each Java Bean object contains an ID string value of the corresponding view tag; serialize each Java Bean object into a JSON string; and send the JSON string from the first terminal to the second terminal through the Socket connection;
[0058] The second terminal is used to: receive the JSON string; deserialize the JSON string to obtain the Java Bean object set; obtain the root layout of the currently displayed user interface, and obtain the ID string values corresponding to all sub-view objects from the root layout; based on each ID string value, search for the target Java Bean object in the Java Bean object set that matches each ID string value; based on the value of each target Java Bean object, update the attribute value of the target sub-view object corresponding to each ID string value.
[0059] A sixth aspect of the present invention provides a computer device, comprising: a memory and at least one processor, wherein the memory stores instructions; the at least one processor calls the instructions in the memory so that the computer device executes the above-mentioned user interface dynamic debugging method.
[0060] A seventh aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the above-mentioned user interface dynamic debugging method.
[0061] In the technical solution provided by the present invention, the layout file of the currently modified user interface is first obtained, and at the same time, a Java Bean object set corresponding to the attribute values of each view tag in the layout file is constructed, and then the root layout of the currently displayed user interface is obtained, and the ID string values corresponding to all subview objects are obtained from the root layout, and then each ID string value is used as a query keyword to find the target Java Bean object that matches the ID string value in the Java Bean object set, and finally based on the value of each target Java Bean object, the attribute value of the target subview object corresponding to each ID string value is updated, thereby realizing hot update of the layout file, and realizing dynamic update of the modified attributes to the user interface without recompiling and packaging. The layout file hot update solution adopted by the present invention realizes the rapid response of the modified code on the user interface of the Android application, realizes the dynamic update of the user interface attributes in effect, saves the process of project compilation and construction, saves time costs for developers, and helps developers improve UI development and debugging efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] Figure 1 A schematic diagram of a first embodiment of a method for dynamic debugging of a user interface according to an embodiment of the present invention;
[0063] Figure 2 A schematic diagram of a second embodiment of the method for dynamic debugging of a user interface according to an embodiment of the present invention;
[0064] Figure 3 It is a schematic diagram of a first embodiment of a user interface dynamic debugging device in an embodiment of the present invention;
[0065] Figure 4 It is a schematic diagram of a second embodiment of the user interface dynamic debugging device in an embodiment of the present invention;
[0066] Figure 5 A schematic diagram of an embodiment of a user interface dynamic debugging system in an embodiment of the present invention;
[0067] Figure 6 FIG. 1 is a schematic diagram of an embodiment of a computer device in an embodiment of the present invention. DETAILED DESCRIPTION
[0068] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0069] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 The first embodiment of the user interface dynamic debugging method in the embodiment of the present invention includes:
[0070] 101. Obtain a layout file of the currently modified user interface, and construct a Java Bean object set corresponding to the attribute value of each view tag in the layout file;
[0071] In this embodiment, the layout file specifically refers to the Layout file, that is, the view file in XML format in the Android system. In Android development, the Layout file is an XML file used to define the user interface (UI). These files are usually placed in the res / layout / directory of the project and have an .xml extension. Each layout file describes the user interface layout of a screen, including which views (Views) should be displayed on the screen and how these views are arranged with each other. The layout file uses a set of predefined XML tags to define different views and layout containers. These tags correspond to classes in the Android SDK, such as TextView, Button, LinearLayout, RelativeLayout, etc. Complex user interfaces can be created by combining these tags. Adjusting the user interface (UI) can be achieved by modifying the Layout file.
[0072] In this embodiment, in order to quickly see the effect of the user interface changes, after obtaining the layout file of the currently modified user interface, a Java Bean object set corresponding to the attribute value of each view tag in the layout file is constructed.
[0073] Java Bean is a special Java class that follows certain coding conventions so that it can be easily serialized, deserialized, and accessed. Java Bean is widely used in various Java applications, especially those that need to encapsulate data and transfer data between different layers (such as presentation layer, business logic layer, data access layer).
[0074] In one embodiment, the above step 101 further includes:
[0075] 1011. Obtain a layout file of the currently modified user interface, where the layout file is in XLM format;
[0076] 1012. Identify all view tags in the layout file for adjusting the user interface;
[0077] 1013. Parse each of the view tags respectively to obtain an attribute value of each of the view tags;
[0078] 1014. Construct Java Bean objects corresponding to the attribute values of the view tags respectively to obtain a Java Bean object set, wherein each Java Bean object contains the ID string value of the corresponding view tag.
[0079] In this optional embodiment, the layout file of the user interface adopts the XLM format, so it is necessary to use a parser such as XmlPullParser or DOM to read the layout XML file. By traversing the layout file in XML format, all view tags are identified, such as <view>Tags, or more specifically, <button>, <textview>wait.
[0080] <view>The tag is usually used when developing mobile applications using React Native or similar JavaScript-based frameworks. It is not a part of HTML, but a component in the React Native framework that is used to create a view container on the mobile application interface. <view>The main uses of components include:
[0081] (1) Layout container: It can serve as a container for other components (such as text, images, buttons, etc.) to help developers organize and manage the layout of the application interface.
[0082] (2) Style setting: Through the style attribute, you can <view>Set styles for components and their subcomponents, such as background color, margins, padding, borders, etc. Style definitions follow React Native's stylesheet specification, which is similar to CSS but different.
[0083] (3) Layout attributes: React Native provides a variety of layout methods, such as Flexbox layout, <view>Components can use these layout properties to control exactly how their child components are laid out.
[0084] For each <view>The tag is parsed, its id, width, height, background and other attributes are parsed, and then the corresponding Java Bean object is constructed according to the parsed attributes. Each Java Bean object contains attributes such as id (the ID string value of the view tag), width, height, backgroundColor and so on.
[0085] 102. Obtain the root layout of the currently displayed user interface, and obtain the ID string values corresponding to all subview objects from the root layout;
[0086] In this embodiment, the root layout of the user interface refers to the outermost or top-level layout container in the user interface (UI), which is responsible for containing and organizing all other elements and sub-layouts in the interface. In Android development, the root layout specifically refers to RootView or DecorView, which is the top-level view (View) in an Activity or Fragment. RootView or DecorView is the root view of the entire application window (including the status bar, title bar, etc.).
[0087] In user interface (UI) design, a child view refers to a view element nested inside another view (usually called a parent view or container view). A hierarchical structure is formed between child views and parent views, which enables developers to build complex and feature-rich user interfaces. In mobile application development platforms such as Android and iOS, child views can be various UI components, such as buttons, text views, image views, etc. These components are dynamically added to the parent view through layout files or code to form part of the user interface.
[0088] In Android development, subview objects specifically refer to view tags, which can be any type of view components, such as TextView, Button, ImageView, etc., which are all subclasses of subview objects. The ID string value corresponding to the subview object is defined in the XML layout file and is used to uniquely identify the view component. These IDs are automatically generated by Android development tools (such as Android Studio) to the id class of the R.java file during compilation. By calling the Resource.getIdentifier(String name,String defType,String defPackage) method, you can get the ID string values corresponding to all subview objects.
[0089] 103. Based on each of the ID string values, searching for a target Java Bean object in the Java Bean object set that matches each of the ID string values;
[0090] In this embodiment, since the currently modified layout file is used for the currently displayed user interface, that is, the view object in the layout file and the sub-view object of the root layout correspond to each other and both use the same ID string value, the two can be matched through the ID string value. Specifically, the target Java Bean object that matches each ID string value in the Java Bean object collection is searched, thereby pairing the two, wherein each Java Bean object contains the ID string value of the corresponding view object.
[0091] 104. Based on the numerical value of each target Java Bean object, update the attribute value of the target subview object corresponding to each ID string value.
[0092] In this embodiment, the found target Java Bean object contains the ID string value of the corresponding view object and other attribute information, such as width, height, and background. Similarly, the attribute value of the target subview object includes the ID string value, width, height, background, and other attribute values. Through the pairing of step 103, the value of each target JavaBean object can be used to update the attribute value of the target subview object corresponding to each ID string value, thereby completing the hot update of the layout file corresponding to the user interface. After the update is completed, the modified user interface effect can be directly displayed.
[0093] In one embodiment, the step 104 further includes:
[0094] 1041. Determine whether there are numerical differences between the numerical values of the target Java Bean objects and the attribute values of the target subview objects corresponding to the ID string values;
[0095] 1042. If there is a difference in values, then based on the values of the target Java Bean objects, the attribute values of the corresponding target subview objects are updated respectively.
[0096] In this optional embodiment, before updating the attribute values, it is first determined whether there is a numerical difference between the numerical values of each target Java Bean object and the attribute values of the target sub-view object corresponding to the corresponding ID string value. That is, this optional embodiment only updates the attribute values of the target sub-view objects with numerical differences, thereby improving the efficiency and speed of attribute value updating.
[0097] This embodiment first obtains the layout file of the currently modified user interface, and at the same time constructs a Java Bean object set corresponding to the attribute values of each view tag in the layout file, and then obtains the root layout of the currently displayed user interface, and obtains the ID string values corresponding to all sub-view objects from the root layout, and then uses each ID string value as a query keyword to find the target Java Bean object that matches the ID string value in the Java Bean object set, and finally updates the attribute values of the target sub-view objects corresponding to each ID string value based on the numerical value of each target JavaBean object, thereby realizing hot update of the layout file, and dynamically updating the modified attributes to the user interface without recompiling and packaging. The layout file hot update scheme adopted in this embodiment realizes the rapid response of the modified code to the user interface of the Android application, and realizes the dynamic update of the user interface attributes in effect, eliminating the process of project compilation and construction, saving time costs for developers, and helping developers improve UI development and debugging efficiency.
[0098] Reference Figure 2 , Figure 2 This is the second embodiment of the user interface dynamic debugging method of the present invention. The difference between this embodiment and the first embodiment is that: in the first embodiment, the modification of the layout file of the user interface is completed at the first terminal, and the whole process of hot updating the layout file of the user interface is completed at the second terminal and the updated user interface is displayed. In this embodiment, the user interface dynamic debugging method includes:
[0099] 201. Receive a JSON string serialized from a Java Bean object set, where the Java Bean object set is constructed based on the attribute values of each view tag in the layout file of the currently modified user interface;
[0100] In this embodiment, the second terminal only receives the JSON string serialized from the Java Bean object set instead of the layout file of the user interface. Therefore, after the first terminal completes the modification of the layout file of the user interface, it is necessary to further convert the attribute values of each view tag in the layout file into a Java Bean object. The specific implementation method is as follows:
[0101] 2011. Obtaining a layout file of the currently modified user interface, wherein the layout file is in XLM format;
[0102] 2012. Identify all view tags in the layout file for adjusting the user interface;
[0103] 2013. Parse each of the view tags respectively to obtain the attribute value of each of the view tags;
[0104] 2014. Constructing Java Bean objects corresponding to the attribute values of each view tag respectively to obtain a Java Bean object set, wherein each Java Bean object contains the ID string value of the corresponding view tag.
[0105] In one embodiment, the layout file of the user interface is modified on a first terminal (such as a personal computer), the user interface is dynamically debugged on a second terminal (such as a mobile terminal, such as a mobile phone), the first terminal and the second terminal are connected using a Socket, and a JSON string is sent from the first terminal to the second terminal via the Socket connection.
[0106] In one embodiment, the JSON string is obtained in the following manner:
[0107] (1) Obtaining a layout file of the currently modified user interface, wherein the layout file is in XLM format;
[0108] (2) identifying all view tags in the layout file used to adjust the user interface;
[0109] (3) parsing each of the view tags respectively to obtain an attribute value of each of the view tags;
[0110] (4) constructing Java Bean objects corresponding to the attribute values of the view tags respectively to obtain a Java Bean object set, wherein each Java Bean object contains the ID string value of the corresponding view tag;
[0111] (5) Serialize each Java Bean object into a JSON string.
[0112] In this optional embodiment, each Java Bean object is serialized into a JSON string using Java's serialization mechanism (such as Serializable or Parcelable) or through a JSON library (such as Gson) and saved to local storage (such as a file, database) so that historical modification records can be viewed and restored at any time.
[0113] 202. Deserialize the JSON string to obtain the Java Bean object set;
[0114] In this embodiment, after receiving the JSON string, a corresponding library (such as Gson) is used to perform deserialization to obtain a JavaBean object collection.
[0115] 203. Obtain the root layout of the currently displayed user interface, and obtain the ID string values corresponding to all subview objects from the root layout;
[0116] 204. Based on each of the ID string values, search for a target Java Bean object in the Java Bean object set that matches each of the ID string values;
[0117] 205. Based on the numerical value of each target Java Bean object, update the attribute value of the target subview object corresponding to each ID string value.
[0118] In this embodiment, the above steps 203-205 are the same as steps 102-104 in the first embodiment, and thus will not be described in detail.
[0119] In this embodiment, at the first terminal, the layout file of the currently modified user interface is first obtained, and at the same time, a Java Bean object set corresponding to the attribute value of each view tag in the layout file is constructed, and then the Java Bean object set is serialized into a JSON string, and then sent to the second terminal for hot update. At the second terminal, the JSON string serialized by the Java Bean object set is first received, and then deserialized again to obtain the Java Bean object set, and at the same time, the root layout of the currently displayed user interface is obtained, and the ID string values corresponding to all subview objects are obtained from the root layout, and then each ID string value is used as a query keyword to find the target JavaBean object matching the ID string value in the Java Bean object set, and finally based on the value of each target Java Bean object, the attribute value of the target subview object corresponding to each ID string value is updated, thereby realizing the hot update of the layout file, and realizing the dynamic update of the modified attributes to the user interface without the need for recompilation and packaging. The layout file hot update scheme adopted in this embodiment realizes the rapid response of the modified code to the user interface of the Android application, realizes the dynamic update of the user interface attributes in effect, saves the process of project compilation and construction, saves time costs for developers, and helps developers improve UI development and debugging efficiency.
[0120] The above describes the user interface dynamic debugging method in the embodiment of the present invention. The following describes the user interface dynamic debugging device in the embodiment of the present invention. Figure 3 The first embodiment of the user interface dynamic debugging device in the embodiment of the present invention includes:
[0121] The first acquisition module 301 is used to acquire the layout file of the currently modified user interface and construct a Java Bean object set corresponding to the attribute value of each view tag in the layout file;
[0122] The second acquisition module 302 is used to acquire the root layout of the currently displayed user interface, and acquire the ID string values corresponding to all subview objects from the root layout;
[0123] A first search module 303 is used to search the Java Bean object set for target Java Bean objects that match the respective ID string values based on the respective ID string values;
[0124] The first updating module 304 is used to update the attribute value of the target subview object corresponding to each ID string value based on the value of each target Java Bean object.
[0125] Optionally, in one embodiment, the first acquisition module 301 is specifically used to:
[0126] Obtain the layout file of the currently modified user interface, wherein the layout file is in XLM format;
[0127] Identify all view tags in the layout file for adjusting the user interface;
[0128] Parsing each of the view tags respectively to obtain the attribute value of each of the view tags;
[0129] Java Bean objects corresponding to the attribute values of the view tags are constructed respectively to obtain a Java Bean object set, wherein each Java Bean object contains the ID string value of the corresponding view tag.
[0130] Optionally, in one embodiment, the first updating module 304 is specifically configured to:
[0131] Determine whether there is a numerical difference between each value of each target Java Bean object and each attribute value of the target subview object corresponding to the ID string value;
[0132] If there is a difference in values, then based on the values of the target Java Bean objects, the attribute values of the corresponding target subview objects are updated respectively.
[0133] Since the embodiments of the device part correspond to the embodiments of the above-mentioned method, please refer to the above-mentioned method embodiments for the introduction of the user interface dynamic debugging device provided by the present invention. The present invention will not be repeated here, and it has the same beneficial effects as the above-mentioned user interface dynamic debugging method.
[0134] See also Figure 4 The second embodiment of the user interface dynamic debugging device in the embodiment of the present invention includes:
[0135] The receiving module 401 is used to receive a JSON string serialized from a Java Bean object set, where the Java Bean object set is constructed based on the attribute values of each view tag in the layout file of the currently modified user interface;
[0136] A deserialization module 402 is used to deserialize the JSON string to obtain the Java Bean object set;
[0137] The third acquisition module 403 is used to acquire the root layout of the currently displayed user interface, and acquire the ID string values corresponding to all subview objects from the root layout;
[0138] A second search module 404 is used to search the Java Bean object set for target Java Bean objects that match the respective ID string values based on the respective ID string values;
[0139] The second updating module 405 is used to update the attribute value of the target subview object corresponding to each ID string value based on the value of each target Java Bean object.
[0140] Optionally, in one embodiment, the layout file of the user interface is modified in the first terminal, the user interface is dynamically debugged in the second terminal, the first terminal and the second terminal are connected using Socket, and the JSON string is sent from the first terminal to the second terminal through the Socket connection.
[0141] Optionally, in one embodiment, the JSON string is obtained in the following manner:
[0142] Obtain the layout file of the currently modified user interface, wherein the layout file is in XLM format;
[0143] Identify all view tags in the layout file for adjusting the user interface;
[0144] Parsing each of the view tags respectively to obtain the attribute value of each of the view tags;
[0145] Constructing Java Bean objects corresponding to the attribute values of each view tag respectively to obtain a Java Bean object set, wherein each Java Bean object contains the ID string value of the corresponding view tag;
[0146] Serialize each Java Bean object into a JSON string.
[0147] Since the embodiments of the device part correspond to the embodiments of the above-mentioned method, please refer to the above-mentioned method embodiments for the introduction of the user interface dynamic debugging device provided by the present invention. The present invention will not be repeated here, and it has the same beneficial effects as the above-mentioned user interface dynamic debugging method.
[0148] See also Figure 5 , Figure 5 This is the second embodiment of the user interface dynamic debugging device in the embodiment of the present invention. In this embodiment, the user interface dynamic debugging system includes a first terminal 501 and a second terminal 502, and the first terminal 501 and the second terminal 502 are connected by Socket;
[0149] In this embodiment, the first terminal 501 includes:
[0150] The first acquisition unit 5011 is used to acquire the layout file of the currently modified user interface, where the layout file is in XLM format;
[0151] The identification unit 5012 is used to identify all view tags in the layout file for adjusting the user interface; parse each view tag respectively to obtain the attribute value of each view tag;
[0152] The construction unit 5013 is used to respectively construct Java Bean objects corresponding to the attribute values of the view tags to obtain a Java Bean object set, wherein each Java Bean object contains the ID string value of the corresponding view tag;
[0153] The serialization unit 5014 is used to serialize each Java Bean object into a JSON string;
[0154] A sending unit 5015, configured to send the JSON string from the first terminal to the second terminal through the Socket connection;
[0155] In this embodiment, the second terminal 502 includes:
[0156] The receiving unit 5021 is used to receive the JSON string;
[0157] A deserialization unit 5022, used for deserializing the JSON string to obtain the Java Bean object set;
[0158] The second acquisition unit 5023 is used to acquire the root layout of the currently displayed user interface, and acquire the ID string values corresponding to all subview objects from the root layout;
[0159] A searching unit 5024 is used to search, based on each of the ID string values, for a target Java Bean object in the Java Bean object set that matches each of the ID string values;
[0160] The updating unit 5025 is used to update the attribute value of the target subview object corresponding to each ID string value based on the value of each target Java Bean object.
[0161] In this embodiment, the layout file of the user interface is modified on the first terminal 501 (such as a personal computer), the user interface is dynamically debugged on the second terminal 502 (such as a mobile terminal, such as a mobile phone), the first terminal 501 and the second terminal 502 are connected using a Socket, and the JSON string is sent from the first terminal 501 to the second terminal 502 through the Socket connection.
[0162] Since the embodiments of the system part correspond to the embodiments of the above-mentioned method, please refer to the above-mentioned method embodiments for the introduction of the user interface dynamic debugging system provided by the present invention. The present invention will not be repeated here, and it has the same beneficial effects as the above-mentioned user interface dynamic debugging method.
[0163] above Figure 3 , 4 5. The user interface dynamic debugging device and system in the embodiment of the present invention are described in detail from the perspective of modular functional entities. The computer device in the embodiment of the present invention is described in detail from the perspective of hardware processing.
[0164] Figure 6 6 is a schematic diagram of the structure of a computer device provided by an embodiment of the present invention. The computer device 600 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 610 (for example, one or more processors) and a memory 620, and one or more storage media 630 (for example, one or more mass storage devices) storing application programs 633 or data 632. Among them, the memory 620 and the storage medium 630 can be short-term storage or permanent storage. The program stored in the storage medium 630 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the computer device 600. Furthermore, the processor 610 can be configured to communicate with the storage medium 630 to execute a series of instruction operations in the storage medium 630 on the computer device 600.
[0165] The computer device 600 may also include one or more power supplies 640, one or more wired or wireless network interfaces 650, one or more input and output interfaces 660, and / or one or more operating systems 631, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. It will be appreciated by those skilled in the art that Figure 6 The illustrated computer device structure does not constitute a limitation on the computer device, and may include more or fewer components than illustrated, or combine certain components, or arrange the components differently.
[0166] The present invention also provides a computer device, which includes a memory and a processor. The memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the processor executes the steps of the user interface dynamic debugging method in the above embodiments.
[0167] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are executed on a computer, the computer executes the steps of the user interface dynamic debugging method.
[0168] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0169] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.
[0170] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.< / view> < / view> < / view> < / view> < / view> < / textview> < / button> < / view>
Claims
1. A user interface dynamic debugging method, characterized in that: The user interface dynamic debugging method comprises: Obtaining the layout file of the currently modified user interface, and constructing a Java Bean object set corresponding to the attribute value of each view tag in the layout file; Obtain the root layout of the currently displayed user interface, and obtain the ID string values corresponding to all subview objects from the root layout; Based on each of the ID string values, searching for a target Java Bean object in the Java Bean object set that matches each of the ID string values; Based on the value of each target Java Bean object, the attribute value of the target subview object corresponding to each ID string value is updated.
2. The user interface dynamic debugging method according to claim 1, characterized in that: The step of obtaining the layout file of the currently modified user interface and constructing a Java Bean object set corresponding to the attribute value of each view tag in the layout file includes: Obtain the layout file of the currently modified user interface, wherein the layout file is in XLM format; Identify all view tags in the layout file for adjusting the user interface; Parsing each of the view tags respectively to obtain the attribute value of each of the view tags; Java Bean objects corresponding to the attribute values of the view tags are constructed respectively to obtain a Java Bean object set, wherein each Java Bean object contains the ID string value of the corresponding view tag.
3. The user interface dynamic debugging method according to claim 1, characterized in that: The updating of the attribute value of the target subview object corresponding to each ID string value based on the value of each target Java Bean object includes: Determine whether there is a numerical difference between each value of each target Java Bean object and each attribute value of the target subview object corresponding to the ID string value; If there is a difference in values, then based on the values of the target Java Bean objects, the attribute values of the corresponding target subview objects are updated respectively.
4. A user interface dynamic debugging method, characterized in that: The user interface dynamic debugging method comprises: Receive a JSON string after serialization of a Java Bean object collection, wherein the Java Bean object collection is constructed based on the attribute values of each view tag in the layout file of the currently modified user interface; Deserialize the JSON string to obtain the Java Bean object set; Obtain the root layout of the currently displayed user interface, and obtain the ID string values corresponding to all subview objects from the root layout; Based on each of the ID string values, searching for a target Java Bean object in the Java Bean object set that matches each of the ID string values; Based on the value of each target Java Bean object, the attribute value of the target subview object corresponding to each ID string value is updated.
5. The user interface dynamic debugging method according to claim 4, characterized in that: The layout file of the user interface is modified in the first terminal, the user interface is dynamically debugged in the second terminal, the first terminal and the second terminal are connected using Socket, and the JSON string is sent from the first terminal to the second terminal through the Socket connection.
6. The user interface dynamic debugging method according to claim 5, characterized in that: The JSON string is obtained in the following way: Obtain the layout file of the currently modified user interface, wherein the layout file is in XLM format; Identify all view tags in the layout file for adjusting the user interface; Parsing each of the view tags respectively to obtain the attribute value of each of the view tags; Constructing Java Bean objects corresponding to the attribute values of each view tag respectively to obtain a Java Bean object set, wherein each Java Bean object contains the ID string value of the corresponding view tag; Serialize each Java Bean object into a JSON string.
7. A user interface dynamic debugging device, characterized in that: The user interface dynamic debugging device comprises: A first acquisition module is used to acquire a layout file of the currently modified user interface and construct a Java Bean object set corresponding to the attribute value of each view tag in the layout file; A second acquisition module is used to acquire the root layout of the currently displayed user interface, and acquire the ID string values corresponding to all subview objects from the root layout; A first search module, used for searching, based on each of the ID string values, target Java Bean objects in the Java Bean object set that match each of the ID string values; The first updating module is used to update the attribute value of the target subview object corresponding to each ID string value based on the value of each target Java Bean object.
8. A user interface dynamic debugging system, characterized in that: The user interface dynamic debugging system includes a first terminal and a second terminal, and the first terminal and the second terminal are connected by Socket; The first terminal is used to: obtain a layout file of the currently modified user interface, wherein the layout file is in XLM format; identify all view tags in the layout file for adjusting the user interface; and parse each of the view tags to obtain an attribute value of each of the view tags; Constructing Java Bean objects corresponding to the attribute values of each view tag respectively to obtain a Java Bean object set, wherein each Java Bean object contains the ID string value of the corresponding view tag; serializing each Java Bean object into a JSON string respectively; Sending the JSON string from the first terminal to the second terminal through the Socket connection; The second terminal is used to: receive the JSON string; deserialize the JSON string to obtain the Java Bean object set; obtain the root layout of the currently displayed user interface, and obtain the ID string values corresponding to all sub-view objects from the root layout; based on each ID string value, search for the target Java Bean object in the Java Bean object set that matches each ID string value; based on the value of each target Java Bean object, update the attribute value of the target sub-view object corresponding to each ID string value.
9. A computer device, characterized in that: The computer device comprises: a memory and at least one processor, wherein instructions are stored in the memory; The at least one processor calls the instructions in the memory to enable the computer device to execute the user interface dynamic debugging method according to any one of claims 1 to 6.
10. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions are executed by the processor, the user interface dynamic debugging method according to any one of claims 1 to 6 is implemented.