Custom window implementation method, device, equipment, medium and product based on open source swan Mongolia system
By blocking the system decoration function in the open source Hongmeng system, installing function packages and building custom window decoration components, the problem of custom restriction of window modules is solved, personalized design and function expansion of windows are realized, and development complexity is reduced.
Patent Information
- Application Number
- CN202510058557.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-14
- Publication Date
- 2025-05-13
AI Technical Summary
In the open source Hongmeng system, the existing window module has limitations in customizing the title bar content, which makes it difficult for application developers to implement additional functions on the title bar, and the implementation of window decoration is complex, which increases the development workload.
By blocking the system decoration function of the Hongmeng system when receiving a custom window construction request in the window component, installing the target function package and adding a custom window decoration component, and building and loading the corresponding functional components and icons in response to the configuration request of the title attributes and function buttons, the custom window is generated.
It realizes window customization, avoids duplicate development, meets the differentiated needs of applications, ensures consistency of interfaces and functions, and reduces development complexity and workload.
Smart Images

Figure CN119987767A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of open source Hongmeng system application development technology, and in particular to a method, device, equipment, medium and product for implementing a custom window based on the open source Hongmeng system. Background Art
[0002] In the OpenHarmony system, the window module provides a set of window decoration functions, including window title bars and borders. The title bar contains interface elements such as title, maximize, minimize, and close buttons by default, and has corresponding click behaviors for user operation. In order to further enhance the user experience, the system allows users to customize the title bar components to achieve more personalized functions to meet the needs of different users.
[0003] The existing window module has limitations in the customization of the title bar content. In the current open source Hongmeng system, the application's window decoration is fixed, making it difficult for application developers to implement additional functions on the title bar. Usually, in order to implement custom functions, developers need to add an extra row of title bar under the window decorator. This practice not only makes the title bar look bloated, but also the styles between different applications are inconsistent, affecting the consistency and beauty of the application window. In addition, the implementation of window decoration belongs to the subsystem level function. For application developers, adding and maintaining these functions is not only technically difficult, but also not conducive to the rapid adaptation and iteration of the application, increasing the development workload. Summary of the invention
[0004] The present invention provides a method, device, equipment, medium and product for implementing a custom window based on the open source Hongmeng system, so as to solve the problems of large development workload and inconsistency of interface and function when implementing a custom window based on the open source Hongmeng system.
[0005] According to one aspect of an embodiment of the present invention, a method for implementing a custom window based on an open source Hongmeng system is provided, including:
[0006] When a request to build a custom window in a target project is received in a window component, the system decoration function provided by Hongmeng system is shielded through the window component;
[0007] When receiving a request to add a target function package in a configuration file of a target project in the window component, installing the target function package in the window component to add a custom window decoration component in the window component;
[0008] In response to a configuration request for a target title attribute received in the custom window decoration component, a target function component matching the target title attribute is obtained in the Hongmeng system, and a target title adaptation function matching the target title attribute is constructed according to the target function component;
[0009] In response to a configuration request for at least one target function button received in the custom window decoration component, loading a target key icon matching the target function button in the Hongmeng system;
[0010] When it is detected that the configuration is completed through the custom window decoration component, the custom window is generated according to the constructed target title functions and the loaded target button icons.
[0011] According to another aspect of an embodiment of the present invention, a device for implementing a custom window based on an open source Hongmeng system is also provided, including:
[0012] The function shielding module is used to shield the system decoration function provided in the Hongmeng system through the window component when a request for building a custom window in the target project is received in the window component;
[0013] A component adding module, used for installing the target function package in the window component when receiving a request to add a target function package in the configuration file of the target project in the window component, so as to add a custom window decoration component in the window component;
[0014] A function construction module, for, in response to a configuration request for a target title attribute received in a custom window decoration component, obtaining a target function component matching the target title attribute in the Hongmeng system, and constructing a target title adaptation function matching the target title attribute according to the target function component;
[0015] A button loading module, configured to load a target key icon matching the target function button in the Hongmeng system in response to a configuration request for at least one target function button received in the custom window decoration component;
[0016] The window generation module is used to generate the custom window according to the constructed target title functions and loaded target button icons when it is detected that the configuration is completed through the custom window decoration component.
[0017] According to another aspect of an embodiment of the present invention, an electronic device is provided, the electronic device comprising:
[0018] at least one processor; and
[0019] a memory communicatively connected to the at least one processor; wherein,
[0020] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the custom window implementation method based on the open source Hongmeng system described in any embodiment of the present invention.
[0021] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is further provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the custom window implementation method based on the open source Hongmeng system described in any embodiment of the present invention when executed.
[0022] According to another aspect of an embodiment of the present invention, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps of the method described in any embodiment of the present invention are implemented.
[0023] The technical solution of the embodiment of the present invention is to shield the system decoration function of the Hongmeng system through the window component when receiving a construction request for a custom window in the target project in the window component; when receiving a request to add a target function package in the configuration file of the target project in the window component, install the target function package in the window component to add a custom window decoration component in the window component; in response to the configuration request for the target title attribute received in the custom window decoration component, obtain the target function component matching the target title attribute in the Hongmeng system, and build the target title adaptation function matching the target title attribute according to the target function component; in response to the configuration request for at least one target function button received in the custom window decoration component, load the target key icon matching the target function button in the Hongmeng system; when it is detected that the configuration is completed through the custom window decoration component, generate the custom window according to the constructed target title functions and the loaded target key icons. By configuring the developed window decoration function package, the application can directly reference the window decoration function to realize the customization of the window and avoid repeated development. The window decoration button can also be selected according to the needs to meet the differentiated needs of the application, ensure the stability of the application when specific functions are not supported, avoid potential abnormal situations, and achieve consistency of interface and function.
[0024] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0026] Figure 1 This is a flowchart of a method for implementing a custom window based on the open source Hongmeng system provided according to the first embodiment of the present invention;
[0027] Figure 2 is a flowchart of another method for implementing a custom window based on the open source Hongmeng system provided according to Embodiment 2 of the present invention;
[0028] Figure 3 This is a schematic diagram of a module structure of a solution applicable to an embodiment of the present invention;
[0029] Figure 4 It is a component layout style diagram applicable to the embodiment of the present invention;
[0030] Figure 5 It is an adaptation window title name component layout style diagram applicable to the embodiment of the present invention;
[0031] Figure 6 It is an adaptive window title icon component layout style diagram applicable to the embodiment of the present invention;
[0032] Figure 7 It is an adaptation window return key component layout style diagram applicable to the embodiment of the present invention;
[0033] Figure 8 It is a layout style diagram of a component for adapting window data display mode transformation applicable to an embodiment of the present invention;
[0034] Fig. 9 It is an adaptation window search box component layout style diagram applicable to the embodiment of the present invention;
[0035] Fig.10 This is a schematic diagram of the structure of a custom window implementation device based on the open source Hongmeng system provided according to Embodiment 3 of the present invention;
[0036] Fig.11 It is a structural diagram of an electronic device that implements the custom window implementation method based on the open source Hongmeng system according to an embodiment of the present invention. DETAILED DESCRIPTION
[0037] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0038] It should be noted that the terms "first", "second", etc. 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 of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "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.
[0039] Embodiment 1
[0040] Figure 1 The flowchart of a method for implementing a custom window based on an open source Hongmeng system is provided in the first embodiment of the present invention. This embodiment is applicable to the case of customizing application windows in an open source Hongmeng system. The method can be executed by a custom window implementation device based on an open source Hongmeng system. The custom window implementation device based on an open source Hongmeng system can be implemented in the form of hardware and / or software and can generally be configured in an electronic device. Figure 1 As shown, the method includes:
[0041] S110. When a request to build a custom window in a target project is received in a window component, the system decoration function provided in the Hongmeng system is shielded through the window component.
[0042] In the embodiment of the present invention, the window component refers to a set of tools and APIs (application programming interface) for building and managing application windows, allowing developers to define the appearance and behavior of windows, including the size, position, title bar and window decoration of the window. The system decoration function refers to the default interface elements provided by the operating system for the window, such as the title bar, border, maximize, minimize and close buttons, etc., through which basic window management and interaction functions can be achieved. The target project can be specifically understood as: in the Hongmeng system, developers may have specific needs and need to customize the appearance and behavior of the window to meet the specific functions or design requirements of the application, and the specific application or software project being developed.
[0043] Specifically, when a window component receives a request to create a custom window that does not use the system default decorations but implements elements such as the window title bar and border according to its own design, it is set through a configuration file or code to hide, disable or override the default title bar and border provided by the system, such as calling a specific API to disable the system decorations when the window is created, or setting the window layout parameters through code before the window is displayed to override the system default layout.
[0044] S120: When a request to add a target function package to a configuration file of a target project is received in the window component, the target function package is installed in the window component to add a custom window decoration component to the window component.
[0045] In the embodiment of the present invention, the configuration file includes the basic information of the application and the dependency declaration on the specific function package. The target function package refers to the code library or module developed to implement the custom window. These function packages can be reused by different applications or projects to achieve consistent functions and interface performance. The custom window decoration component refers to the component that the developer designs and implements the elements such as the window title bar, border and buttons in a personalized way to meet the needs of a specific application.
[0046] Specifically, when the window component receives a request from the developer to add a feature package specified in the application configuration file, the system will automatically install or load these feature packages according to the declaration in the configuration file, and perform operations such as downloading code, compiling or linking. After the feature package is successfully installed, the developer can use the API or components provided by these feature packages in the window component to implement customized window decoration, including customizing the style of the title bar, adding specific buttons or controls, and defining the behavior of the window.
[0047] S130. In response to a configuration request for a target title attribute received in a custom window decoration component, a target function component matching the target title attribute is obtained in the Hongmeng system, and a target title adaptation function matching the target title attribute is constructed according to the target function component.
[0048] In the embodiment of the present invention, the target title attribute can be specifically understood as: the specific characteristics or functions of the title bar that the developer hopes to implement in the custom window decoration, which can include the title name, icon, text, color, font size and search box style. The target function component can be specifically understood as: a code module designed to implement the target title attribute, which is used to build and display a custom title bar. The target title adaptation function can be specifically understood as: matching the target function component with the target title attribute and ensuring that they can be correctly integrated into the window component, which can be used to process the setting of attributes, the response to events, and the coordination with other window decoration components.
[0049] Specifically, when the window component receives a request to build a custom window, it installs or references the corresponding target function components according to the instructions of the target function package in the configuration file. These components can be native components in the Hongmeng system, or they can be a combination of components written by developers through shared packages based on the native components in the above-mentioned Hongmeng system. These components contain the code and resources required to implement each custom title attribute. Then, the window component connects the custom logic defined by the developer with the underlying functions of the system by calling the target title adaptation function, and configures and initializes the window according to the target title attributes to ensure that it can display and work as the developer intends. The target title adaptation function can contain multiple levels of calls, and ultimately these calls will be implemented on the native function functions provided by the Hongmeng system, ensuring the implementation of the function and the compatibility of the system.
[0050] S140. In response to a configuration request for at least one target function button received in the custom window decoration component, a target key icon matching the target function button is loaded in the Hongmeng system.
[0051] In an embodiment of the present invention, the target function button can be specifically understood as: in a custom window decoration component, the developer selects a predefined standardized native button in the loaded Hongmeng operating system according to the needs of the application, for example: splitIsShow refers to a split-screen button, indicating that the window supports split-screen function, maxIsShow refers to a maximize button, indicating that the window supports the maximum coverage of the entire screen, miniIsShow refers to a minimize button, indicating that the window supports minimization and is not displayed on the screen, and closeIsShow refers to a close button, indicating that the window supports being closed. Each target function button is associated with one or more specific functions and is used to perform specific operations, which may include closing a window, minimizing a window, maximizing a window, opening a settings menu, triggering a search function, and split-screen display. In addition, the window decoration component in the shared package loads all optional basic function buttons by default. When one of the basic function button components is not needed, the parameter passed to the corresponding button display is false, and this button is not displayed. Correspondingly, the corresponding button display parameter is not false for the target function button.
[0052] The target button icon can be specifically understood as: the visual element associated with the target function button, that is, the icon displayed on the button. These icons are used to intuitively convey the function of the button to the user. For example, a button to close a window can be displayed as an "X" icon, while a button to minimize the function can be displayed as a "-" icon.
[0053] Specifically, the window decoration component will listen to or receive a configuration request for at least one target function button from the application, and the system will find an icon resource that matches the target function button based on the description in the request. These icon resources can be pre-defined in the system or customized by the developer. After finding matching icons, the system loads these icons and applies them to the corresponding function buttons (corresponding to the positions set by the developer in the custom window). When the window decoration component is displayed, the user can see the function buttons with appropriate icons. Each target function button is also associated with a specific function implementation. When the user interacts with these buttons (such as clicking), the system calls a predefined function or method to execute the function code associated with the button.
[0054] S150. When it is detected that the configuration is completed through the custom window decoration component, the custom window is generated according to the constructed target title functions and the loaded target button icons.
[0055] Specifically, when the configuration including the construction of the title function and the loading of the button icon is completed, the system generates a custom window based on these configurations, which contains all the custom elements specified by the developer, such as the title bar, function buttons and icons. In addition, the system can also detect whether the configuration of the custom window decoration component has been completed, for example, it can check whether all necessary configuration items have been set and whether all resources have been loaded. After confirming that the configuration is complete, the system will integrate all elements, create the final layout of the window, and display it to the user.
[0056] The technical solution of the embodiment of the present invention is to shield the decoration function of the Hongmeng system when receiving a request to build a custom window; install the function package and add the decoration component when receiving a request to configure the function package; obtain the matching target function component in the system in response to the received configuration request for the title attribute, and build the target title adaptation function; load the matching target button icon in response to the received configuration request for the target function button; and generate a custom window when the configuration is detected to be completed. By configuring the developed window decoration function package, the application can directly reference the window decoration function to realize the customization of the window and avoid repeated development. It can also select the window decoration button according to the needs to meet the differentiated needs of the application, ensure the stability of the application when specific functions are not supported, avoid potential abnormal situations, achieve consistency of interface and function, and improve development efficiency.
[0057] Optionally, based on the above embodiments, in response to a configuration request for a target title attribute received in a custom window decoration component, obtaining a target function component matching the target title attribute in the Hongmeng system, and constructing a target title adaptation function matching the target title attribute according to the target function component may include:
[0058] In response to a configuration request for a title name attribute received in a custom window decoration component, in a custom construction function of the custom window decoration component, a horizontal linear layout container is added;
[0059] Set the width of the linear layout container to full, and set the alignment of the elements in the linear layout container to align with the beginning of the container;
[0060] Get the text display component that matches the title name attribute in the Hongmeng system, and add the text display component to the linear layout container;
[0061] The text display component is configured according to the display style and text content contained in the configuration request of the title name attribute to obtain a title name adaptation function that matches the title name attribute.
[0062] In the embodiment of the present invention, the custom construction function can be specifically understood as: a function defined by the developer for initializing and setting the properties of custom window decoration components (such as title bars and buttons, etc.). The linear layout container can be specifically understood as: arranging subcomponents (such as text, buttons, and pictures, etc.) in a linear (horizontal or vertical) order. The linear layout container can set a variety of properties, including width, height, alignment, and element spacing. The text display component can be specifically understood as: a decorative component for displaying text on the interface. The text display component can set a variety of properties, including text content, font size, color, style and other properties to meet the needs of interface design.
[0063] Specifically, since the title bar usually contains multiple elements, such as title text, icons, and buttons, they need to be arranged in order in the horizontal direction. Therefore, after importing the layout container class, in the custom construction function, create an instance of a horizontal linear layout so that its elements are arranged horizontally. Then set the layout properties of the container, which may include setting the width property of the linear layout container to occupy the full width of the available space, and setting the alignment of the elements in the container so that all child elements will be arranged starting from the starting edge of the container (such as the left edge).
[0064] According to the configuration request of the title name attribute, a text component instance is created by using the Text class in the open source Hongmeng system to display text information on the interface. Typically, the title name of the window is displayed on the interface. Set the properties of the text component to display the required title name. You can also configure the style of the text according to the configuration request of the title name attribute, such as font size, color and thickness, which can be achieved by setting the fontSize, fontColor and fontWeight properties of the Text component. Finally, according to the display style (such as font, color and size, etc.) and text content contained in the configuration request, the text display component is configured, and the text display component will display the title name according to the developer's intention. The above process is encapsulated into a title name adaptation function. By calling and executing this function, the system can generate a configured text display component that matches the title name attribute according to the configuration request of the title name attribute. This function can be reused by passing in the corresponding title name attribute parameters to quickly create and configure the title name attributes of the title bar when needed, realize window customization, avoid repeated development, meet the differentiated needs of applications, achieve consistency in interface and functions, and improve development efficiency.
[0065] Embodiment 2
[0066] Figure 2A flowchart of another custom window implementation method based on the open source Hongmeng system provided for Embodiment 2 of the present invention. This embodiment is a refinement of the operations of obtaining a target functional component matching the target title attribute in the Hongmeng system in response to a configuration request for a target title attribute received in a custom window decoration component in the above embodiment, and constructing a target title adaptation function matching the target title attribute according to the target functional component, specifically including: in response to a configuration request for a title icon attribute received in a custom window decoration component, in a custom construction function of the custom window decoration component, adding a horizontal linear layout container; setting the width of the linear layout container to full, and setting the element alignment in the linear layout container to align with the beginning of the container, and setting the element spacing to the target distance; obtaining a picture display component matching the title icon attribute in the Hongmeng system, and adding the picture display component to the linear layout container; configuring the picture display component according to the scale parameters and picture content contained in the configuration request for the title icon attribute, and obtaining a title icon adaptation function matching the title icon attribute.
[0067] Correspondingly, such as Figure 2 As shown, the method includes:
[0068] S210. When a request to build a custom window in a target project is received in a window component, the system decoration function provided in the Hongmeng system is shielded through the window component.
[0069] S220: When a request to add a target function package to a configuration file of a target project is received in the window component, the target function package is installed in the window component to add a custom window decoration component to the window component.
[0070] S230: In response to a configuration request for a title icon property received in the custom window decoration component, add a horizontal linear layout container in a custom construction function of the custom window decoration component.
[0071] S240, setting the width of the linear layout container to full, setting the alignment of elements in the linear layout container to align with the beginning of the container, and setting the element spacing to the target distance.
[0072] In the embodiment of the present invention, the target distance can be specifically understood as: the expected spatial interval between each element. This distance can be a fixed pixel value (such as 10px, i.e. 10 pixels) or a value relative to the screen density (such as 10vp, i.e. 10 view ratio units).
[0073] S250. Obtain an image display component that matches the title icon attributes in the Hongmeng system, and add the image display component to the linear layout container.
[0074] In the embodiment of the present invention, the title icon attributes can be specifically understood as: the attributes specified by the developer for the icon in the title bar, which define the appearance and behavior of the icon, such as the resource path, size and color of the icon. The image display component can be specifically understood as: a component used to display a local image file or a remote address image file on a window interface. In the open source Hongmeng system, it can refer to the Image component in the system.
[0075] Specifically, the developer creates an instance of an image display component by calling the constructor of the Image class, sets the src attribute of the image display component to point to the local path or remote address of the icon, sets the image resource for the image display component, and adds the configured image display component to the linear layout container.
[0076] S260: According to the scale parameter and the picture content included in the configuration request of the title icon attribute, the picture display component is configured to obtain a title icon adaptation function matching the title icon attribute.
[0077] In an embodiment of the present invention, the scale parameter refers to the size information of the image, including width and height. Generally, the view scale unit (such as vp or density-independent pixel unit dp) is used to set the size of the image to ensure that the image can adapt to different screen sizes and resolutions while maintaining visual quality. The image content can be specifically understood as: a specific image corresponding to the image resource set in the image display component. The title icon adaptation function can be specifically understood as: a function that sets the image display component properties according to the configuration request of the title icon properties, ensuring that the image display component can correctly display the expected icon.
[0078] Specifically, according to the image content in the configuration request, obtain the corresponding image resources such as loading local files or downloading images from the network, and according to the scale parameters in the configuration request, set the size of the image display component, such as setting the width, height, and zoom ratio. The above process is encapsulated into a title icon adaptation function. By calling and executing this function, the system can generate a configured image display component that matches the title icon attributes according to the configuration request of the title icon attributes. This function can be reused by passing in the corresponding title icon attribute parameters to quickly create and configure the title icon attributes of the title bar when needed, realize window customization, avoid repeated development, meet the differentiated needs of applications, achieve consistency in interface and functions, and improve development efficiency.
[0079] S270. In response to a configuration request for at least one target function button received in the custom window decoration component, a target key icon matching the target function button is loaded in the Hongmeng system.
[0080] S280: When it is detected that the configuration is completed through the custom window decoration component, the custom window is generated according to the constructed target title functions and the loaded target button icons.
[0081] The technical solution of the embodiment of the present invention is to shield the decoration function of the Hongmeng system when receiving a custom window construction request; install the function package and add the decoration component when receiving a configuration function package request; in response to the configuration request for the title icon attribute received in the custom window decoration component, add a horizontal linear layout container in the custom construction function of the custom window decoration component, set the container width, element alignment and element spacing, add a matching picture display component and configure it; in response to the configuration request for the target function button received, load the matching target button icon; generate a custom window when the configuration is detected to be completed. By configuring the developed window decoration function package, the application can directly reference the window decoration function to realize the customization of the window, especially the function realization of the custom title icon attribute, avoiding repeated development, and can also select the window decoration button according to the needs to meet the differentiated needs of the application, ensure the stability of the application when specific functions are not supported, avoid potential abnormal situations, and achieve consistency of interface and function.
[0082] Optionally, based on the above embodiments, in response to a configuration request for a target title attribute received in a custom window decoration component, obtaining a target function component matching the target title attribute in the Hongmeng system, and constructing a target title adaptation function matching the target title attribute according to the target function component may include:
[0083] In response to a configuration request for a title return key attribute received in the custom window decoration component, in a custom construction function of the custom window decoration component, a horizontal linear layout container is added;
[0084] Set the width of the linear layout container to full, set the alignment of the elements in the linear layout container to align with the beginning of the container, and set the element spacing to the target distance;
[0085] Add a stacking layout container to the horizontal linear layout container;
[0086] Set the element alignment in the stacking layout container to center, and set the padding of the stacking layout container to the target padding;
[0087] Add a click event to the stacking layout container and provide the target logic code returned by the click event;
[0088] In the Hongmeng system, obtain the image display component that matches the title return key attribute, and add the image display component to the stacking layout container;
[0089] The picture display component is configured according to the scale parameter and the return key picture content contained in the configuration request of the title return key attribute to obtain a title return key adaptation function matching the title return key attribute.
[0090] In an embodiment of the present invention, the title return key attribute can be specifically understood as: a series of attributes and behaviors for defining and configuring the return key in the window decoration component, which may include size, color, style, and interactive events. The target padding can be specifically understood as: the distance between the component content and its border, including the four directions of the top, bottom, left, and right of the component, which is used to adjust the position of the component content so that it maintains a certain interval with the component border to ensure the aesthetics of the layout and user experience. The target padding can use a specific value (such as pixel px) to set the padding, which is the same on all devices, regardless of the screen size and resolution differences, or can use a proportional unit relative to the screen width or height to set the padding. This padding will be adjusted according to the size of the screen to maintain the consistency of the layout on different devices. In order to ensure the compatibility and adaptability of the application on different devices, it is usually chosen to use a proportional unit relative to the screen width or height to set the padding.
[0091] The stacking layout container can be specifically understood as: a layout method that allows developers to stack components in the vertical or horizontal direction. The stacking order of components can be controlled by setting the zIndex property, that is, which component should be displayed on the top. When creating complex window interfaces, such as in the title bar, the stacking layout container can be used to achieve the click effect of the back key or the overlapping display of elements on the interface.
[0092] Specifically, in order to achieve more complex layout requirements in the horizontal layout, such as making the return key have an animation effect when clicked, or to achieve overlapping and stacking effects of elements in the horizontal layout, it is necessary to add a stacking layout container in the horizontal layout to stack elements in the vertical or horizontal direction, set the element alignment in the stacking layout container to center, and set the padding of the stacking layout container. Add a click event or other interactive event listener to the stacking layout container. When the user clicks or interacts with this container, a predefined return action is triggered, usually returning to the previous interface or performing other navigation operations. According to the configuration request of the title return key attribute, an image display component is obtained to display the return key icon. According to the scale parameters (such as width and height, etc.) in the configuration request and the return key image content, the image display component is configured, which may include setting the image size and the image content corresponding to the download resource path.
[0093] The above process is encapsulated into a title return key adaptation function. By calling and executing this function, the system can generate a configured image display component that matches the title return key attribute according to the configuration request of the title return key attribute. This function can be reused by passing in the corresponding title return key attribute parameters to quickly create and configure the title return key attribute of the title bar when needed, realize window customization, avoid repeated development, meet the differentiated needs of applications, achieve consistency of interface and functions, and improve development efficiency.
[0094] Optionally, based on the above embodiments, in response to a configuration request for a target title attribute received in a custom window decoration component, obtaining a target function component matching the target title attribute in the Hongmeng system, and constructing a target title adaptation function matching the target title attribute according to the target function component may include:
[0095] In response to a configuration request for a title view switching property received in a custom window decoration component, in a custom construction function of the custom window decoration component, a horizontal linear layout container is added;
[0096] Set the width of the linear layout container to full, set the alignment of the elements in the linear layout container to align with the beginning of the container, and set the element spacing to the target distance;
[0097] Add the first stacking layout container in the horizontal linear layout container;
[0098] In the Hongmeng system, obtain the image display component that matches the title view switching attribute, and add the image display component to the first stacking layout container;
[0099] configuring the image display component according to the first scale parameter and the list style icon included in the configuration request of the title view switching attribute;
[0100] Add a click event to the first stacking layout container and provide the target logic code of the page list display style for the click event;
[0101] Add a second stacking layout container in the horizontal linear layout container;
[0102] Obtain an image display component that matches the title view switching attribute in the Hongmeng system, and add the image display component to the second stacking layout container;
[0103] configuring the image display component according to the second scale parameter and the grid style icon included in the configuration request of the title view switching attribute;
[0104] A click event is added to the second stacking layout container, and a target logic code of the page grid display style is provided for the click event to obtain a title view switching adaptation function that matches the title view switching attribute.
[0105] In the embodiment of the present invention, the title view switching attribute can be specifically understood as: a series of attributes used to define and configure the display mode of the transformed data in the window decoration component. The first stacking layout container can be specifically understood as: a container for placing the image display component of the first view switching button. The first scale parameter can be specifically understood as: a size configuration related to the first view switching component (list style), such as width and height, to ensure that the size of the image display component meets the design requirements. The list style icon can be specifically understood as: an icon used to represent the list view mode. When the user clicks the image display component associated with this icon, the application will switch to the list view mode. The second stacking layout container can be specifically understood as: a container for placing the image display component of the second view switching button. The second scale parameter can be specifically understood as: a size configuration related to the second view switching component (grid style), to ensure that the size of the second image display component meets the design requirements. The grid style icon can be specifically understood as: an icon used to represent the grid view mode. When the user clicks the image display component associated with this icon, the application will switch to the grid view mode.
[0106] Specifically, add the first stacking layout container in the horizontal layout, obtain and place the first view switching component (such as a list style), configure the first view switching component according to the first scale parameter and the list style icon in the configuration request, and add a click event or other form of interactive event listener to the first stacking layout container. When the user interacts with this container by clicking or other means, the logic of the page list display style is triggered. Correspondingly, the logic of triggering the page grid display style can be set. The above process is encapsulated into a title view switching adaptation function. By calling and executing this function, the system can generate a configured image display component that matches the title view switching attribute according to the configuration request of the title view switching attribute. This function can be reused by passing in the corresponding title view switching attribute parameters to quickly create and configure the title view switching attributes of the title bar when needed, realize window customization, avoid repeated development, meet the differentiated needs of applications, achieve consistency in interface and functions, and improve development efficiency.
[0107] Optionally, based on the above embodiments, in response to a configuration request for a target title attribute received in a custom window decoration component, obtaining a target function component matching the target title attribute in the Hongmeng system, and constructing a target title adaptation function matching the target title attribute according to the target function component may include:
[0108] In response to a configuration request for a title search box property received in the custom window decoration component, in a custom construction function of the custom window decoration component, a horizontal linear layout container is added;
[0109] Set the width of the linear layout container to full, set the alignment of the elements in the linear layout container to align with the beginning of the container, and set the element spacing to the target distance;
[0110] Get the search box component that matches the title icon attributes in the Hongmeng system, and add the search box component to the linear layout container;
[0111] The search box component is configured according to the search box scale parameter and the displayed preview content included in the configuration request of the title search box attribute;
[0112] A click event is added to the search icon of the search box component, and the target logic code for displaying the page search content is provided for the click event to obtain a title search box adaptation function that matches the title search box attributes.
[0113] In the embodiment of the present invention, the title search box attributes can be specifically understood as: a series of attributes of the search box appearance and behavior, which can include search box scale parameters (such as size and shape, etc.), border style, background color, font style, and displayed preview content (used to help users understand the purpose of the search box). The search box component can be specifically understood as: a component used to provide an area on the interface for users to enter search queries, which can include a text input area and a search icon, in which users can enter search terms and activate the search function.
[0114] Specifically, after obtaining the search box component, the search box component is configured according to the search box scale parameter in the configuration request and the displayed preview content. The search box scale parameter can be a fixed pixel value or a relative unit to ensure that the search box can be correctly displayed on different devices and screen sizes. The displayed preview content can be a search suggestion, an auto-complete suggestion item, or a text prompting the user to enter. Add a click or other type of interactive event listener to the search icon of the search box component. When the user clicks or interacts with the search icon in other ways, the logic of displaying the page search content is triggered, such as opening a search page or popping up a search dialog box. The above process is encapsulated into a title search box adaptation function. By calling and executing the function, the system can generate a configured search box component that matches the title search box attributes according to the configuration request of the title search box attributes. This function can be reused by passing in the corresponding title search box attribute parameters to quickly create and configure the title search box attributes of the title bar when needed, realize window customization, avoid repeated development, meet the differentiated needs of applications, achieve consistency of interface and functions, and improve development efficiency.
[0115] Specific application scenarios
[0116] The window decoration functions provided by the window module in the OpenHarmony system include window title bars and window borders. The window title bar usually includes interface elements such as title, window maximize, minimize and close buttons, and has a default click behavior to facilitate user operations; users can customize the content of the window title bar components to solve other functions that users want to achieve through the title bar. However, the window decoration of the application is fixed and cannot be changed in other ways, so it is very difficult for the application to implement custom functions on the window decoration. It is usually necessary to add another row of title bars under the window decorator to implement such functions, but this will make the entire window title bar appear particularly bloated. At the same time, the development of different applications separately may lead to inconsistent styles, thereby destroying the consistency of the application window. In addition, the implementation of window decoration belongs to the functions in the subsystem. For application developers, it is relatively difficult to add and maintain these functions, which is not conducive to rapid adaptation and iteration.
[0117] To solve the above problems, an embodiment of the present invention proposes a custom window implementation method based on the open source Hongmeng system. By using a linear layout, a horizontal layout container is added. In this container, it is mainly divided into two parts: a custom title bar and optional basic function buttons. The custom title bar uses a cascading layout as a container, defines a blank custom construction function in the container, and exposes this property to the outside so that the calling application can provide a specific implementation of the custom function. The optional basic function button loads the corresponding button icon through conditional judgment and provides basic click function implementation. Figure 3 It is a schematic diagram of a module structure of a solution applicable to an embodiment of the present invention.
[0118] Figure 4 It is a component layout style diagram applicable to the embodiment of the present invention, wherein Row refers to a horizontal linear container, which means a horizontally arranged container for placing multiple subcomponents in a row; Stack refers to a stacking layout container, which means a container that can stack subcomponents vertically or horizontally, and is used to vertically stack title bar content or pictures; titleContent refers to a custom title bar, which means a custom title bar component; customButton refers to a custom optional button component, which means a button component that can be customized by the user and can be used to implement specific functions; Image refers to an image component, which means a component for displaying images. The dotted box in the figure represents a specific layout area. In the Row container, up to four customButton components can be added. These buttons can be the same or different, but the maximum number is four.
[0119] The embodiment of the present invention proposes a method for implementing a custom window based on the open source Hongmeng system, which may specifically include:
[0120] 1. Application adaptation custom title bar
[0121] Get the current window component before adaptation, and shield the system decoration function through the window component; introduce the corresponding shared package in the project's configuration file, and add the window decoration component in the shared package; implement the custom construction function of window decoration.
[0122] Implement custom construction functions for window decoration, which may include:
[0123] (1) Adapt window title name
[0124] Add a horizontal linear layout container in the function; set the width of the linear layout container to full; set the alignment of elements in the linear layout container to align with the beginning of the container; add a text display component in the linear layout container; set the style and text content that the text component needs to display. Figure 5 It is an adaptive window title name component layout style diagram applicable to the embodiment of the present invention.
[0125] (2) Adapt window title icon
[0126] Add a horizontal linear layout container in the function; set the width of the linear layout container to full and the element spacing to an appropriate distance; set the element alignment in the linear layout container to align with the beginning of the container, add an image component to the linear layout container; set the width and height of the image component and the image content to be displayed. Figure 6It is an adaptive window title icon component layout style diagram applicable to the embodiment of the present invention.
[0127] (3) Adapt window return key
[0128] Add a horizontal linear layout container in the function; set the width of the linear layout container to full and the element spacing to an appropriate distance; set the alignment of the elements in the linear layout container to align with the beginning of the container, and add a stacking layout container in the linear layout container; set the alignment of the elements in the stacking layout container to center; set the inner margin of the stacking layout container to an appropriate distance; add a click event to the layout container and provide a return logic code for the click event; add an image component to the stacking layout container; set the width, height and return key icon of the image component. Figure 7 It is an adaptation window return key component layout style diagram applicable to the embodiment of the present invention.
[0129] (4) Adapt window data display mode change (equivalent to the view switching mentioned above)
[0130] Add a horizontal linear layout container in the function; set the width of the linear layout container to full and the element spacing to an appropriate distance; set the element alignment in the linear layout container to align with the beginning of the container, add a cascading layout container in the linear layout container, and add an image component in the cascading container; set the width, height and list style icon of the image component, and add a click event to provide the logic of the page list display style; add a cascading layout container in the linear layout container, and add an image component in the cascading container; set the width, height and grid style icon of the image component, and add a click event to provide the logic of the page grid display style. Figure 8 It is a layout style diagram of a component for adapting window data display mode transformation applicable to an embodiment of the present invention.
[0131] (5) Adapt window search box
[0132] Add a horizontal linear layout container in the function; set the width of the linear layout container to full and the element spacing to an appropriate distance; set the element alignment in the linear layout container to align with the beginning of the container, and add a search box component in the linear layout container; set the width and height of the search box component and the preview content to be displayed; set the search icon click event of the search box component and provide the logic for displaying the page search content. Fig. 9 It is an adaptation window search box component layout style diagram applicable to an embodiment of the present invention.
[0133] 2. App adaptation optional basic function buttons
[0134] Get the current window component before adaptation, and shield the system decoration function through the window component; introduce the corresponding shared package in the project's configuration file; add the window decoration component in the shared package. The window decoration component in the shared package loads all optional basic function buttons by default. When one of the basic function button components is not needed, the parameter passed in to display the corresponding button is false, and the button will not be displayed. Among them, the basic function button components may include: splitIsShow refers to the split-screen button, indicating that the window supports the split-screen function; maxIsShow refers to the maximize button, indicating that the window supports the maximum coverage of the entire screen; miniIsShow refers to the minimize button, indicating that the window supports minimization and is not displayed on the screen; closeIsShow refers to the close button, indicating that the window supports being closed.
[0135] The embodiment of the present invention proposes a method for implementing a custom window based on the open source Hongmeng system. Through a customized window title, the application can display functions such as a return key, a search box, content style switching, and a window name in the title. The window decoration button can be selected to protect some applications from not supporting maximization or displaying abnormalities when the application is split screen. This method allows applications to customize the title bar function to meet differentiated needs, allows the selection of window decoration buttons to be displayed, meets the needs of different applications, uniformly processes window decoration buttons, and ensures the consistency of the basic interface and functions. Other applications can directly reference this window decoration function by configuring a shared package, without the need for repeated development, thereby improving development efficiency.
[0136] Embodiment 3
[0137] Fig.10 This is a schematic diagram of the structure of a custom window implementation device based on the open source Hongmeng system provided in the third embodiment of the present invention. Fig.10 As shown, the device includes: a function shielding module 1010, a component adding module 1020, a function building module 1030, a button loading module 1040 and a window generating module 1050, wherein:
[0138] The function shielding module 1010 is used to shield the system decoration function provided in the Hongmeng system through the window component when a request for building a custom window in a target project is received in the window component;
[0139] The component adding module 1020 is used to install the target function package in the window component when receiving a request to add a target function package in the configuration file of the target project in the window component, so as to add a custom window decoration component in the window component;
[0140] The function construction module 1030 is used to obtain a target function component matching the target title attribute in the Hongmeng system in response to a configuration request for the target title attribute received in the custom window decoration component, and to construct a target title adaptation function matching the target title attribute according to the target function component;
[0141] The button loading module 1040 is used to load a target key icon matching the target function button in the Hongmeng system in response to a configuration request for at least one target function button received in the custom window decoration component;
[0142] The window generation module 1050 is used to generate the custom window according to the constructed target title functions and loaded target button icons when it is detected that the configuration is completed through the custom window decoration component.
[0143] The technical solution of the embodiment of the present invention is to shield the decoration function of the Hongmeng system when receiving a request to build a custom window; install the function package and add the decoration component when receiving a request to configure the function package; obtain the matching target function component in the system in response to the received configuration request for the title attribute, and build the target title adaptation function; load the matching target button icon in response to the received configuration request for the target function button; and generate a custom window when the configuration is detected to be complete. By configuring the developed window decoration function package, the application can directly reference the window decoration function to achieve window customization and avoid repeated development. It can also select the window decoration button according to the needs to meet the differentiated needs of the application, ensure the stability of the application when specific functions are not supported, avoid potential abnormal situations, and achieve consistency of interface and function.
[0144] Based on the above embodiments, the function construction module 1030 is specifically used for:
[0145] In response to a configuration request for a title name attribute received in a custom window decoration component, in a custom construction function of the custom window decoration component, a horizontal linear layout container is added;
[0146] Set the width of the linear layout container to full, and set the alignment of the elements in the linear layout container to align with the beginning of the container;
[0147] Get the text display component that matches the title name attribute in the Hongmeng system, and add the text display component to the linear layout container;
[0148] The text display component is configured according to the display style and text content contained in the configuration request of the title name attribute to obtain a title name adaptation function that matches the title name attribute.
[0149] Further, based on the above embodiments, the function construction module 1030 can also be specifically used for:
[0150] In response to a configuration request for a title icon property received in a custom window decoration component, in a custom construction function of the custom window decoration component, a horizontal linear layout container is added;
[0151] Set the width of the linear layout container to full, set the alignment of the elements in the linear layout container to align with the beginning of the container, and set the element spacing to the target distance;
[0152] Get the image display component that matches the title icon attributes in the Hongmeng system, and add the image display component to the linear layout container;
[0153] The picture display component is configured according to the scale parameter and picture content included in the configuration request of the title icon attribute to obtain a title icon adaptation function matching the title icon attribute.
[0154] Further, based on the above embodiments, the function construction module 1030 can also be specifically used for:
[0155] In response to a configuration request for a title return key attribute received in the custom window decoration component, in a custom construction function of the custom window decoration component, a horizontal linear layout container is added;
[0156] Set the width of the linear layout container to full, set the alignment of the elements in the linear layout container to align with the beginning of the container, and set the element spacing to the target distance;
[0157] Add a stacking layout container to the horizontal linear layout container;
[0158] Set the element alignment in the stacking layout container to center, and set the padding of the stacking layout container to the target padding;
[0159] Add a click event to the stacking layout container and provide the target logic code returned by the click event;
[0160] In the Hongmeng system, obtain the image display component that matches the title return key attribute, and add the image display component to the stacking layout container;
[0161] The picture display component is configured according to the scale parameter and the return key picture content contained in the configuration request of the title return key attribute to obtain a title return key adaptation function matching the title return key attribute.
[0162] Further, based on the above embodiments, the function construction module 1030 can also be specifically used for:
[0163] In response to a configuration request for a title view switching property received in a custom window decoration component, in a custom construction function of the custom window decoration component, a horizontal linear layout container is added;
[0164] Set the width of the linear layout container to full, set the alignment of the elements in the linear layout container to align with the beginning of the container, and set the element spacing to the target distance;
[0165] Add the first stacking layout container in the horizontal linear layout container;
[0166] In the Hongmeng system, obtain the image display component that matches the title view switching attribute, and add the image display component to the first stacking layout container;
[0167] configuring the image display component according to the first scale parameter and the list style icon included in the configuration request of the title view switching attribute;
[0168] Add a click event to the first stacking layout container and provide the target logic code of the page list display style for the click event;
[0169] Add a second stacking layout container in the horizontal linear layout container;
[0170] Obtain an image display component that matches the title view switching attribute in the Hongmeng system, and add the image display component to the second stacking layout container;
[0171] configuring the image display component according to the second scale parameter and the grid style icon included in the configuration request of the title view switching attribute;
[0172] A click event is added to the second stacking layout container, and a target logic code of the page grid display style is provided for the click event to obtain a title view switching adaptation function that matches the title view switching attribute.
[0173] Further, based on the above embodiments, the function construction module 1030 can also be specifically used for:
[0174] In response to a configuration request for a title search box property received in the custom window decoration component, in a custom construction function of the custom window decoration component, a horizontal linear layout container is added;
[0175] Set the width of the linear layout container to full, set the alignment of the elements in the linear layout container to align with the beginning of the container, and set the element spacing to the target distance;
[0176] Get the search box component that matches the title icon attributes in the Hongmeng system, and add the search box component to the linear layout container;
[0177] The search box component is configured according to the search box scale parameter and the displayed preview content included in the configuration request of the title search box attribute;
[0178] A click event is added to the search icon of the search box component, and the target logic code for displaying the page search content is provided for the click event to obtain a title search box adaptation function that matches the title search box attributes.
[0179] The custom window implementation device based on the open source Hongmeng system provided in an embodiment of the present invention can execute the custom window implementation method based on the open source Hongmeng system provided in any embodiment of the present invention, and has functional modules and beneficial effects corresponding to the execution method.
[0180] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0181] Embodiment 4
[0182] Fig.11 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0183] like Fig.11 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0184] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0185] Processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. Processor 11 executes the various methods and processes described above, such as a custom window implementation method based on the open source Hongmeng system, that is:
[0186] When a request to build a custom window in a target project is received in a window component, the system decoration function provided by Hongmeng system is shielded through the window component;
[0187] When receiving a request to add a target function package in a configuration file of a target project in the window component, installing the target function package in the window component to add a custom window decoration component in the window component;
[0188] In response to a configuration request for a target title attribute received in the custom window decoration component, a target function component matching the target title attribute is obtained in the Hongmeng system, and a target title adaptation function matching the target title attribute is constructed according to the target function component;
[0189] In response to a configuration request for at least one target function button received in the custom window decoration component, loading a target key icon matching the target function button in the Hongmeng system;
[0190] When it is detected that the configuration is completed through the custom window decoration component, the custom window is generated according to the constructed target title functions and the loaded target button icons.
[0191] In some embodiments, a custom window implementation method based on the open source Hongmeng system may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the custom window implementation method based on the open source Hongmeng system described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute a custom window implementation method based on the open source Hongmeng system in any other appropriate manner (e.g., by means of firmware).
[0192] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0193] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0194] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0195] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0196] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0197] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0198] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0199] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for implementing a custom window based on the open source Hongmeng system, characterized in that: include: When a request to build a custom window in a target project is received in a window component, the system decoration function provided by Hongmeng system is shielded through the window component; When receiving a request to add a target function package in a configuration file of a target project in the window component, installing the target function package in the window component to add a custom window decoration component in the window component; In response to a configuration request for a target title attribute received in the custom window decoration component, a target function component matching the target title attribute is obtained in the Hongmeng system, and a target title adaptation function matching the target title attribute is constructed according to the target function component; In response to a configuration request for at least one target function button received in the custom window decoration component, loading a target key icon matching the target function button in the Hongmeng system; When it is detected that the configuration is completed through the custom window decoration component, the custom window is generated according to the constructed target title functions and the loaded target button icons.
2. The method according to claim 1, characterized in that In response to a configuration request for a target title attribute received in a custom window decoration component, a target function component matching the target title attribute is obtained in the Hongmeng system, and a target title adaptation function matching the target title attribute is constructed according to the target function component, including: In response to a configuration request for a title name attribute received in a custom window decoration component, in a custom construction function of the custom window decoration component, a horizontal linear layout container is added; Set the width of the linear layout container to full, and set the alignment of the elements in the linear layout container to align with the beginning of the container; Get the text display component that matches the title name attribute in the Hongmeng system, and add the text display component to the linear layout container; The text display component is configured according to the display style and text content contained in the configuration request of the title name attribute to obtain a title name adaptation function that matches the title name attribute.
3. The method according to claim 1, characterized in that In response to a configuration request for a target title attribute received in a custom window decoration component, a target function component matching the target title attribute is obtained in the Hongmeng system, and a target title adaptation function matching the target title attribute is constructed according to the target function component, including: In response to a configuration request for a title icon property received in a custom window decoration component, in a custom construction function of the custom window decoration component, a horizontal linear layout container is added; Set the width of the linear layout container to full, set the alignment of the elements in the linear layout container to align with the beginning of the container, and set the element spacing to the target distance; Get the image display component that matches the title icon attributes in the Hongmeng system, and add the image display component to the linear layout container; The picture display component is configured according to the scale parameter and picture content included in the configuration request of the title icon attribute to obtain a title icon adaptation function matching the title icon attribute.
4. The method according to claim 1, characterized in that: In response to a configuration request for a target title attribute received in a custom window decoration component, a target function component matching the target title attribute is obtained in the Hongmeng system, and a target title adaptation function matching the target title attribute is constructed according to the target function component, including: In response to a configuration request for a title return key attribute received in the custom window decoration component, in a custom construction function of the custom window decoration component, a horizontal linear layout container is added; Set the width of the linear layout container to full, set the alignment of the elements in the linear layout container to align with the beginning of the container, and set the element spacing to the target distance; Add a stacking layout container to the horizontal linear layout container; Set the element alignment in the stacking layout container to center, and set the padding of the stacking layout container to the target padding; Add a click event to the stacking layout container and provide the target logic code returned by the click event; In the Hongmeng system, obtain the image display component that matches the title return key attribute, and add the image display component to the stacking layout container; The picture display component is configured according to the scale parameter and the return key picture content contained in the configuration request of the title return key attribute to obtain a title return key adaptation function matching the title return key attribute.
5. The method according to claim 1, characterized in that In response to a configuration request for a target title attribute received in a custom window decoration component, a target function component matching the target title attribute is obtained in the Hongmeng system, and a target title adaptation function matching the target title attribute is constructed according to the target function component, including: In response to a configuration request for a title view switching property received in a custom window decoration component, in a custom construction function of the custom window decoration component, a horizontal linear layout container is added; Set the width of the linear layout container to full, set the alignment of the elements in the linear layout container to align with the beginning of the container, and set the element spacing to the target distance; Add the first stacking layout container in the horizontal linear layout container; In the Hongmeng system, obtain the image display component that matches the title view switching attribute, and add the image display component to the first stacking layout container; configuring the image display component according to the first scale parameter and the list style icon included in the configuration request of the title view switching attribute; Add a click event to the first stacking layout container and provide the target logic code of the page list display style for the click event; Add a second stacking layout container in the horizontal linear layout container; Obtain an image display component that matches the title view switching attribute in the Hongmeng system, and add the image display component to the second stacking layout container; configuring the image display component according to the second scale parameter and the grid style icon included in the configuration request of the title view switching attribute; A click event is added to the second stacking layout container, and a target logic code of the page grid display style is provided for the click event to obtain a title view switching adaptation function that matches the title view switching attribute.
6. The method according to claim 1, characterized in that In response to a configuration request for a target title attribute received in a custom window decoration component, a target function component matching the target title attribute is obtained in the Hongmeng system, and a target title adaptation function matching the target title attribute is constructed according to the target function component, including: In response to a configuration request for a title search box property received in the custom window decoration component, in a custom construction function of the custom window decoration component, a horizontal linear layout container is added; Set the width of the linear layout container to full, set the alignment of the elements in the linear layout container to align with the beginning of the container, and set the element spacing to the target distance; Get the search box component that matches the title icon attributes in the Hongmeng system, and add the search box component to the linear layout container; The search box component is configured according to the search box scale parameter and the displayed preview content included in the configuration request of the title search box attribute; A click event is added to the search icon of the search box component, and a target logic code for displaying the page search content is provided for the click event to obtain a title search box adaptation function that matches the title search box attributes.
7. A custom window implementation device based on the open source Hongmeng system, characterized in that: include: The function shielding module is used to shield the system decoration function provided in the Hongmeng system through the window component when a request for building a custom window in the target project is received in the window component; A component adding module, used for installing the target function package in the window component when receiving a request to add a target function package in the configuration file of the target project in the window component, so as to add a custom window decoration component in the window component; A function construction module, for, in response to a configuration request for a target title attribute received in a custom window decoration component, obtaining a target function component matching the target title attribute in the Hongmeng system, and constructing a target title adaptation function matching the target title attribute according to the target function component; A button loading module, configured to load a target key icon matching the target function button in the Hongmeng system in response to a configuration request for at least one target function button received in the custom window decoration component; The window generation module is used to generate the custom window according to the constructed target title functions and loaded target button icons when it is detected that the configuration is completed through the custom window decoration component.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the custom window implementation method based on the open source Hongmeng system as described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the custom window implementation method based on the open source Hongmeng system as described in any one of claims 1 to 6 when executed.
10. A computer program product, characterized in that The computer program product includes a computer program, which, when executed by a processor, implements the custom window implementation method based on the open source Hongmeng system according to any one of claims 1 to 6.