[go: up one dir, main page]

CN118227004A - Method and related device for popup window based on OpenHarmony light-weight system - Google Patents

Method and related device for popup window based on OpenHarmony light-weight system Download PDF

Info

Publication number
CN118227004A
CN118227004A CN202410650387.9A CN202410650387A CN118227004A CN 118227004 A CN118227004 A CN 118227004A CN 202410650387 A CN202410650387 A CN 202410650387A CN 118227004 A CN118227004 A CN 118227004A
Authority
CN
China
Prior art keywords
pop
window
displayed
interface
view group
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202410650387.9A
Other languages
Chinese (zh)
Other versions
CN118227004B (en
Inventor
陈进发
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Xinguodu Tech Co Ltd
Original Assignee
Shenzhen Xinguodu Tech Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Xinguodu Tech Co Ltd filed Critical Shenzhen Xinguodu Tech Co Ltd
Priority to CN202410650387.9A priority Critical patent/CN118227004B/en
Publication of CN118227004A publication Critical patent/CN118227004A/en
Application granted granted Critical
Publication of CN118227004B publication Critical patent/CN118227004B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0481Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The application discloses a method and a related device for popup window based on OpenHarmony lightweight system, which are used for loading popup window functions on the lightweight system. The method for popup window based on OpenHarmony light-weight system comprises the following steps: acquiring data to be displayed by a popup, wherein the data to be displayed by the popup comprises popup title information and popup prompt information; setting an interface dialogue component according to the data to be displayed by the popup window; adding a plurality of control buttons and corresponding response actions of the control buttons into the interface dialogue component; initializing an interface dialogue component according to the data, the control buttons and the response actions displayed by the popup window, and generating the popup window; and displaying the popup window on a terminal screen.

Description

一种基于OpenHarmony轻量系统弹窗的方法及相关装置A method and related device for pop-up window based on OpenHarmony lightweight system

技术领域Technical Field

本申请涉及人机界面交互技术领域,尤其涉及一种基于OpenHarmony轻量系统弹窗的方法及相关装置。The present application relates to the field of human-computer interface interaction technology, and in particular to a method and related device for pop-up windows based on an OpenHarmony lightweight system.

背景技术Background technique

随着智能化科技的不断发展,人们的生活、工作、学习中越来越多地用到了智能化设备,为实现全场景化、全连接化和全智能化,开源鸿蒙(OpenHarmony)系统孕育而生。OpenHarmony系统采用了组件化的设计方案,可以根据设备的资源能力和业务特征进行灵活裁剪,满足不同形态的终端设备对于操作系统的要求。其中,OpenHarmony系统中的轻量系统可以提供多种轻量级网络协议、轻量级的图形框架,以及丰富的 IOT 总线读写部件等。With the continuous development of intelligent technology, people are increasingly using intelligent devices in their lives, work, and studies. In order to achieve full-scenario, full-connectivity, and full intelligence, the open source Hongmeng (OpenHarmony) system was born. The OpenHarmony system adopts a componentized design solution, which can be flexibly tailored according to the resource capabilities and business characteristics of the device to meet the requirements of different forms of terminal devices for the operating system. Among them, the lightweight system in the OpenHarmony system can provide a variety of lightweight network protocols, lightweight graphics frameworks, and a wealth of IOT bus read and write components.

轻量系统本身不支持弹窗功能。现有技术中实现弹窗的方式,是增加Windowmanager子系统、IPC子系统等组件,利用这些组件进行弹窗。然而,上述增加的组件都需要占用较多的内存资源,与轻量系统支持的小资源设备是不匹配的。The lightweight system itself does not support the pop-up window function. The existing technology implements the pop-up window by adding components such as the Windowmanager subsystem and the IPC subsystem, and using these components to perform the pop-up window. However, the above-mentioned added components need to occupy more memory resources, which is not compatible with the small resource devices supported by the lightweight system.

发明内容Summary of the invention

为了解决上述技术问题,本申请提供了一种基于OpenHarmony轻量系统弹窗的方法及相关装置,用于在轻量系统上加载弹窗功能。In order to solve the above technical problems, the present application provides a method and related devices for pop-up windows based on an OpenHarmony lightweight system, which are used to load a pop-up window function on a lightweight system.

下面对本申请中提供的技术方案进行描述:The technical solution provided in this application is described below:

本申请第一方面提供了一种基于OpenHarmony轻量系统弹窗的方法,包括:In a first aspect, the present application provides a method for pop-up windows based on an OpenHarmony lightweight system, comprising:

获取待弹窗展示的数据,所述待弹窗展示的数据包括弹窗标题信息和弹窗提示信息;Obtaining data to be displayed in a pop-up window, wherein the data to be displayed in the pop-up window includes pop-up window title information and pop-up window prompt information;

根据所述待弹窗展示的数据设置界面对话组件;Setting interface dialogue components according to the data to be displayed in the pop-up window;

在所述界面对话组件中添加若干个控制按钮以及所述若干个控制按钮对应的响应动作;Adding a number of control buttons and corresponding response actions of the control buttons in the interface dialogue component;

根据所述弹窗展示的数据、所述控制按钮和所述响应动作初始化所述界面对话组件,并生成弹窗;Initializing the interface dialogue component according to the data displayed in the pop-up window, the control button and the response action, and generating a pop-up window;

将所述弹窗展示在终端屏幕上。The pop-up window is displayed on the terminal screen.

可选的,所述根据所述弹窗展示的数据、所述控制按钮和所述响应动作初始化所述界面对话组件,并生成弹窗,包括:Optionally, the initializing the interface dialogue component according to the data displayed in the pop-up window, the control button and the response action, and generating the pop-up window includes:

获取终端屏幕尺寸;Get the terminal screen size;

根据所述终端屏幕尺寸和所述弹窗标题信息创建第一界面视图组容器,以使得弹窗主体在所述第一界面视图组容器所在区域上显示;Creating a first interface view group container according to the terminal screen size and the pop-up window title information, so that the pop-up window body is displayed in the area where the first interface view group container is located;

根据所述弹窗提示信息和所述控制按钮、所述响应动作创建第二界面视图组容器,以使得弹窗窗口在所述第二界面视图组容器所在区域上显示;Creating a second interface view group container according to the pop-up window prompt information, the control button, and the response action, so that the pop-up window is displayed in the area where the second interface view group container is located;

将所述第二界面视图组容器添加至所述第一界面视图组容器中;Adding the second interface view group container to the first interface view group container;

将所述第一界面视图组容器添加至根视图容器中,生成弹窗显示页面,以使得所述弹窗主体在所述终端屏幕上显示,所述弹窗窗口在所述弹窗主体中显示,所述弹窗窗口的尺寸小于所述弹窗主体。The first interface view group container is added to the root view container, and a pop-up display page is generated, so that the pop-up body is displayed on the terminal screen, the pop-up window is displayed in the pop-up body, and the size of the pop-up window is smaller than the pop-up body.

可选的,在所述根据所述终端屏幕尺寸和所述弹窗标题信息创建第一界面视图组容器之后,还包括:Optionally, after creating the first interface view group container according to the terminal screen size and the pop-up window title information, the method further includes:

将所述第一界面视图组容器的背景色设置为灰色;Setting the background color of the first interface view group container to gray;

调整所述第一界面视图组容器的透明度。The transparency of the first interface view group container is adjusted.

可选的,所述将所述第二界面视图组容器添加至所述第一界面视图组容器中,包括:Optionally, adding the second interface view group container to the first interface view group container includes:

将所述第二界面视图组容器的背景色设置为白色;Setting the background color of the second interface view group container to white;

将所述第二界面视图组容器居中放置在所述第一界面视图组容器中。The second interface view group container is centered in the first interface view group container.

可选的,所述若干个控制按钮包括如下至少一种:确定按钮、取消按钮、关机按钮或重启按钮。Optionally, the several control buttons include at least one of the following: an OK button, a cancel button, a power off button or a restart button.

可选的,在所述根据所述待弹窗展示的数据设置界面对话组件之前,还包括:Optionally, before setting the interface dialogue component according to the data to be displayed in the pop-up window, the method further includes:

创建界面对话组件;Create interface dialogue components;

创建定时任务列表;Create a scheduled task list;

当到达预先设置的时间时,判断所述定时任务列表是否存在元素;When the preset time is reached, determining whether there is an element in the scheduled task list;

若是,则取出所述元素并销毁;If so, the element is taken out and destroyed;

若否,则重新计时。If not, restart the timer.

可选的,在所述将所述弹窗展示在终端屏幕上之后,还包括:Optionally, after displaying the pop-up window on the terminal screen, the method further includes:

在根据用户选择的所述控制按钮后,完成对应所述控制按钮的响应动作;After the control button is selected by the user, a response action corresponding to the control button is completed;

销毁所述弹窗窗口和所述弹窗主体;Destroy the pop-up window and the pop-up window body;

将所述第一界面视图组容器转移至所述定时任务列表,作为所述定时任务列表中需要销毁的元素。The first interface view group container is transferred to the scheduled task list as an element in the scheduled task list that needs to be destroyed.

本申请第二方面提供了一种基于OpenHarmony轻量系统弹窗的装置,包括:A second aspect of the present application provides a device for a pop-up window based on an OpenHarmony lightweight system, including:

获取单元,用于获取待弹窗展示的数据,所述待弹窗展示的数据包括弹窗标题信息和弹窗提示信息;An acquisition unit, used for acquiring data to be displayed in a pop-up window, wherein the data to be displayed in the pop-up window includes pop-up window title information and pop-up window prompt information;

设置单元,用于根据所述待弹窗展示的数据设置界面对话组件;A setting unit, used for setting an interface dialogue component according to the data to be displayed in the pop-up window;

添加单元,用于在所述界面对话组件中添加若干个控制按钮以及所述若干个控制按钮对应的响应动作;An adding unit, used for adding a plurality of control buttons and response actions corresponding to the plurality of control buttons in the interface dialogue component;

初始化单元,用于根据所述弹窗展示的数据、所述控制按钮和所述响应动作初始化所述界面对话组件,并生成弹窗;An initialization unit, configured to initialize the interface dialogue component according to the data displayed in the pop-up window, the control button and the response action, and generate a pop-up window;

展示单元,用于将所述弹窗展示在终端屏幕上。The display unit is used to display the pop-up window on the terminal screen.

可选的,所述初始化单元具体用于:Optionally, the initialization unit is specifically used for:

获取终端屏幕尺寸;Get the terminal screen size;

根据所述终端屏幕尺寸和所述弹窗标题信息创建第一界面视图组容器,以使得弹窗主体在所述第一界面视图组容器所在区域上显示;Creating a first interface view group container according to the terminal screen size and the pop-up window title information, so that the pop-up window body is displayed in the area where the first interface view group container is located;

根据所述弹窗提示信息和所述控制按钮、所述响应动作创建第二界面视图组容器,以使得弹窗窗口在所述第二界面视图组容器所在区域上显示;Creating a second interface view group container according to the pop-up window prompt information, the control button, and the response action, so that the pop-up window is displayed in the area where the second interface view group container is located;

将所述第二界面视图组容器添加至所述第一界面视图组容器中;Adding the second interface view group container to the first interface view group container;

将所述第一界面视图组容器添加至根视图容器中,生成弹窗显示页面,以使得所述弹窗主体在所述终端屏幕上显示,所述弹窗窗口在所述弹窗主体中显示,所述弹窗窗口的尺寸小于所述弹窗主体。The first interface view group container is added to the root view container, and a pop-up display page is generated, so that the pop-up body is displayed on the terminal screen, the pop-up window is displayed in the pop-up body, and the size of the pop-up window is smaller than the pop-up body.

可选的,所述初始化单元具体用于:Optionally, the initialization unit is specifically used for:

将所述第一界面视图组容器的背景色设置为灰色;Setting the background color of the first interface view group container to gray;

调整所述第一界面视图组容器的透明度。The transparency of the first interface view group container is adjusted.

可选的,所述初始化单元具体用于:Optionally, the initialization unit is specifically used for:

将所述第二界面视图组容器的背景色设置为白色;Setting the background color of the second interface view group container to white;

将所述第二界面视图组容器居中放置在所述第一界面视图组容器中。The second interface view group container is centered in the first interface view group container.

可选的,所述若干个控制按钮包括如下至少一种:确定按钮、取消按钮、关机按钮或重启按钮。Optionally, the several control buttons include at least one of the following: an OK button, a cancel button, a power off button or a restart button.

可选的,在所述设置单元之前,还包括:Optionally, before the setting unit, it also includes:

界面对话组件单元,用于创建界面对话组件;An interface dialogue component unit, used for creating an interface dialogue component;

定时任务列表单元,用于创建定时任务列表;Scheduled task list unit, used to create a scheduled task list;

判断单元,用于当到达预先设置的时间时,判断所述定时任务列表是否存在元素;A judging unit, used for judging whether there is an element in the scheduled task list when a preset time is reached;

执行单元,用于取出所述元素并销毁;An execution unit, used for taking out the element and destroying it;

返回单元,用于重新计时。Return unit for retiming.

可选的,在所述展示单元之后,还包括:Optionally, after the display unit, it further includes:

响应单元,用于在根据用户选择的所述控制按钮后,完成对应所述控制按钮的响应动作;A response unit, used for completing a response action corresponding to the control button after the control button is selected by the user;

销毁单元,用于销毁所述弹窗窗口和所述弹窗主体;A destroying unit, used to destroy the pop-up window and the pop-up window body;

转移单元,用于将所述第一界面视图组容器转移至所述定时任务列表,作为所述定时任务列表中需要销毁的元素。A transfer unit is used to transfer the first interface view group container to the scheduled task list as an element that needs to be destroyed in the scheduled task list.

本申请第三方面提供了一种电子设备,所述电子设备包括:A third aspect of the present application provides an electronic device, the electronic device comprising:

处理器、存储器、输入输出单元以及总线;Processor, memory, input-output unit, and bus;

所述处理器与所述存储器、所述输入输出单元以及所述总线相连;The processor is connected to the memory, the input and output unit, and the bus;

所述存储器保存有程序,所述处理器调用所述程序以执行第一方面以及第一方面中任一项可选的所述基于OpenHarmony轻量系统弹窗的方法。The memory stores a program, and the processor calls the program to execute the first aspect and the optional method based on the OpenHarmony lightweight system pop-up window in any one of the first aspects.

本申请第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质上保存有程序,所述程序在计算机上执行时执行第一方面以及第一方面中任一项可选的所述基于OpenHarmony轻量系统弹窗的方法。The fourth aspect of the present application provides a computer-readable storage medium, on which a program is stored. When the program is executed on a computer, the method based on the OpenHarmony lightweight system pop-up window of the first aspect and any optional item in the first aspect is executed.

从以上技术方案可以看出,本申请具有以下优点:It can be seen from the above technical solutions that this application has the following advantages:

本申请提供的一种基于OpenHarmony轻量系统弹窗的方法,首先获取待弹窗展示的数据,待弹窗展示的数据包括弹窗标题信息和弹窗提示信息;然后根据待弹窗展示的数据设置界面对话组件;进一步地在界面对话组件中添加若干个控制按钮以及若干个控制按钮对应的响应动作;再进一步地根据弹窗展示的数据、控制按钮和响应动作初始化界面对话组件,并生成弹窗;最后将弹窗展示在终端屏幕上。本申请通过创建和设置新的界面对话组件来替代其它弹窗组件,并生成一种无需拖拽移动的简单弹窗,从而消除了对Windowmanager子系统、IPC子系统等弹窗组件的依赖,防止产生更大的资源消耗,满足将弹窗应用在轻量系统的小资源设备上的需求。The present application provides a method for pop-up windows based on the OpenHarmony lightweight system. First, the data to be displayed in the pop-up window is obtained, and the data to be displayed in the pop-up window includes pop-up window title information and pop-up window prompt information; then, the interface dialogue component is set according to the data to be displayed in the pop-up window; further, several control buttons and response actions corresponding to the control buttons are added to the interface dialogue component; further, the interface dialogue component is initialized according to the data displayed in the pop-up window, the control buttons and the response actions, and a pop-up window is generated; finally, the pop-up window is displayed on the terminal screen. The present application replaces other pop-up window components by creating and setting a new interface dialogue component, and generates a simple pop-up window that does not need to be dragged and moved, thereby eliminating the dependence on pop-up window components such as the Windowmanager subsystem and the IPC subsystem, preventing greater resource consumption, and meeting the demand for applying pop-up windows to small resource devices of lightweight systems.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

为了更清楚地说明本申请中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solution in the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

图1为本申请提供的基于OpenHarmony轻量系统弹窗的方法一个实施例流程示意图;FIG1 is a flow chart of an embodiment of a method for pop-up windows based on the OpenHarmony lightweight system provided by the present application;

图2为本申请提供的基于OpenHarmony轻量系统弹窗的方法另一个实施例流程示意图;FIG2 is a flow chart of another embodiment of the method for pop-up window based on OpenHarmony lightweight system provided by the present application;

图3为本申请提供的基于OpenHarmony轻量系统弹窗的方法另一个实施例流程示意图;FIG3 is a flow chart of another embodiment of the method for pop-up window based on OpenHarmony lightweight system provided by the present application;

图4为本申请提供的基于OpenHarmony轻量系统弹窗的方法另一个实施例流程示意图;FIG4 is a flow chart of another embodiment of the method for pop-up window based on OpenHarmony lightweight system provided by the present application;

图5为本申请提供的基于OpenHarmony轻量系统弹窗的方法另一个实施例流程示意图;FIG5 is a flow chart of another embodiment of the method for pop-up window based on OpenHarmony lightweight system provided by the present application;

图6为本申请提供的基于OpenHarmony轻量系统弹窗的方法另一个实施例流程示意图;FIG6 is a flow chart of another embodiment of the method for pop-up window based on OpenHarmony lightweight system provided by the present application;

图7为本申请提供的基于OpenHarmony轻量系统弹窗的装置一个实施例结构示意图;FIG7 is a schematic structural diagram of an embodiment of a device for a pop-up window based on an OpenHarmony lightweight system provided by the present application;

图8为本申请提供的电子设备一个实施例结构示意图。FIG8 is a schematic diagram of the structure of an embodiment of an electronic device provided in the present application.

具体实施方式Detailed ways

下面详细描述本发明的实施例,所述实施例的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施例是示例性的,仅用于解释本发明,而不能理解为对本发明的限制。Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.

在本发明的描述中,若干的含义是一个或者多个,多个的含义是两个以上,大于、小于、超过等理解为不包括本数,以上、以下、以内等理解为包括本数。如果有描述到第一、第二只是用于区分技术特征为目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量或者隐含指明所指示的技术特征的先后关系。In the description of the present invention, "several" means one or more, "more" means more than two, "greater than", "less than", "exceed" etc. are understood to exclude the number itself, and "above", "below", "within" etc. are understood to include the number itself. If there is a description of "first" or "second", it is only used for the purpose of distinguishing the technical features, and cannot be understood as indicating or implying the relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.

在本发明的描述中,需要理解的是,涉及到方位描述,例如上、下、左、右、前、后等指示的方位或位置关系为基于附图所示的方位或位置关系,仅是为了便于描述本发明和简化描述,而不是指示或暗示所指的装置或元件必须具有特定的方位、以特定的方位构造和操作,因此不能理解为对本发明的限制。In the description of the present invention, it should be understood that descriptions involving orientation, such as up, down, left, right, front, back, etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present invention.

在本说明书的描述中,参考术语“一个实施例”、“一些实施例”、“示意性实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包含于本发明的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不一定指的是相同的实施例或示例。而且,描述的具体特征、结构、材料或者特点可以在任何的一个或多个实施例或示例中以合适的方式结合。In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

本发明的描述中,需要说明的是,除非另有明确的限定,设置、安装、连接等词语应做广义理解,所属技术领域技术人员可以结合技术方案的具体内容合理确定上述词语在本发明中的具体含义。另外,下文中对于具体步骤的标识并不代表对于步骤顺序与执行逻辑的限定,各个步骤之间的执行顺序与执行逻辑应参照实施例所表述的内容进行理解与推定。In the description of the present invention, it should be noted that, unless otherwise clearly defined, the terms such as setting, installing, connecting, etc. should be understood in a broad sense, and the technical personnel in the relevant technical field can reasonably determine the specific meanings of the above terms in the present invention in combination with the specific content of the technical solution. In addition, the identification of specific steps below does not represent a limitation on the order of steps and execution logic, and the execution order and execution logic between the various steps should be understood and inferred with reference to the contents described in the embodiments.

本申请提供的方法,可以应用于终端也可以应用于系统,还可以应用于服务器上,例如终端可以是智能手机或电脑、平板电脑、智能电视、智能手表、便携计算机终端也可以是台式计算机等固定终端。The method provided in the present application can be applied to a terminal or a system, and can also be applied to a server. For example, the terminal can be a smart phone or a computer, a tablet computer, a smart TV, a smart watch, a portable computer terminal, or a fixed terminal such as a desktop computer.

本发明旨在至少解决现有技术中存在的技术问题之一。为此,本发明提供了一种基于OpenHarmony轻量系统弹窗的方法及相关装置,用于在轻量系统上加载弹窗功能。The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention provides a method and a related device for pop-up window based on OpenHarmony lightweight system, which is used to load the pop-up window function on the lightweight system.

请参阅图1,根据本发明的第一方面实施例的基于OpenHarmony轻量系统弹窗的方法,可以包括,但不限下述:Please refer to FIG. 1 . The method based on the OpenHarmony lightweight system pop-up window according to the first aspect of the present invention may include, but is not limited to, the following:

步骤S101,获取待弹窗展示的数据,待弹窗展示的数据包括弹窗标题信息和弹窗提示信息;Step S101, obtaining data to be displayed in a pop-up window, where the data to be displayed in the pop-up window includes pop-up window title information and pop-up window prompt information;

步骤S102,根据待弹窗展示的数据设置界面对话组件;Step S102, setting an interface dialogue component according to the data to be displayed in the pop-up window;

步骤S103,在界面对话组件中添加若干个控制按钮以及若干个控制按钮对应的响应动作;Step S103, adding a number of control buttons and a number of response actions corresponding to the control buttons in the interface dialogue component;

步骤S104,根据弹窗展示的数据、控制按钮和响应动作初始化界面对话组件,并生成弹窗;Step S104, initializing the interface dialogue component according to the data, control buttons and response actions displayed in the pop-up window, and generating a pop-up window;

步骤S105,将弹窗展示在终端屏幕上。Step S105, displaying the pop-up window on the terminal screen.

本申请提供的一种基于OpenHarmony轻量系统弹窗的方法,首先获取待弹窗展示的数据,待弹窗展示的数据包括弹窗标题信息和弹窗提示信息;然后根据待弹窗展示的数据设置界面对话组件;进一步地在界面对话组件中添加若干个控制按钮以及若干个控制按钮对应的响应动作;再进一步地根据弹窗展示的数据、控制按钮和响应动作初始化界面对话组件,并生成弹窗;最后将弹窗展示在终端屏幕上。本申请通过设置新的界面对话组件来替代其它弹窗组件,并生成一种无需拖拽移动的简单弹窗,从而消除了对Window manager子系统、IPC子系统等弹窗组件的依赖,防止产生更大的资源消耗,满足将弹窗应用在轻量系统的小资源设备上的需求。The present application provides a method for pop-up windows based on the OpenHarmony lightweight system. First, the data to be displayed in the pop-up window is obtained, and the data to be displayed in the pop-up window includes pop-up window title information and pop-up window prompt information; then, an interface dialogue component is set according to the data to be displayed in the pop-up window; further, several control buttons and response actions corresponding to the control buttons are added to the interface dialogue component; further, the interface dialogue component is initialized according to the data displayed in the pop-up window, the control buttons and the response actions, and a pop-up window is generated; finally, the pop-up window is displayed on the terminal screen. The present application replaces other pop-up window components by setting a new interface dialogue component, and generates a simple pop-up window that does not need to be dragged and moved, thereby eliminating the dependence on pop-up window components such as the Window manager subsystem and the IPC subsystem, preventing greater resource consumption, and meeting the demand for applying pop-up windows to small resource devices of lightweight systems.

一些实施例的步骤S101中,获取待弹窗展示的数据,待弹窗展示的数据包括弹窗标题信息和弹窗提示信息。需要说明的是,为了使弹窗具有明确意义且能配合完成终端上的工作,应获取需要在弹窗上展示的数据。其中,待弹窗展示的数据中的弹窗标题信息用于标明弹窗的主题内容;弹窗提示信息用于描述该弹窗的作用,并提示用户根据实际需求进行操作,例如对弹窗上的一些按钮进行选择。In step S101 of some embodiments, data to be displayed in a pop-up window is obtained, and the data to be displayed in the pop-up window includes pop-up window title information and pop-up window prompt information. It should be noted that in order to make the pop-up window have a clear meaning and can cooperate to complete the work on the terminal, the data to be displayed in the pop-up window should be obtained. Among them, the pop-up window title information in the data to be displayed in the pop-up window is used to indicate the subject content of the pop-up window; the pop-up window prompt information is used to describe the function of the pop-up window and prompt the user to operate according to actual needs, such as selecting some buttons on the pop-up window.

一些实施例的步骤S102中,根据待弹窗展示的数据设置界面对话组件。为了明确界面对话组件的主题与实现的交互功能,需要根据实际需求来设置界面对话组件,所述实际需求即步骤S101中获取的待弹窗展示的数据。根据待弹窗展示的数据中的弹窗标题信息设置界面对话组件的标题,例如:提示、警告或错误等。根据待弹窗提示信息设置界面对话组件要实现的交互功能,例如:是否确认操作或程序错误是否退出等。In step S102 of some embodiments, an interface dialogue component is set according to the data to be displayed in the pop-up window. In order to clarify the theme of the interface dialogue component and the interactive function to be implemented, the interface dialogue component needs to be set according to actual needs, and the actual needs are the data to be displayed in the pop-up window obtained in step S101. The title of the interface dialogue component is set according to the pop-up window title information in the data to be displayed in the pop-up window, such as: prompt, warning or error. The interactive function to be implemented by the interface dialogue component is set according to the prompt information of the pop-up window, such as: whether to confirm the operation or whether to exit in case of program error.

一些实施例的步骤S103中,在界面对话组件中添加若干个控制按钮以及若干个控制按钮对应的响应动作。在步骤S102设置了界面对话组件要实现的交互功能后,还需要提供用于人机交互的按钮,并根据用户选择的按钮响应操作。因此,在界面对话组件中添加一个或多个控制按钮,并设置与控制按钮相对应的响应动作。若干个控制按钮包括如下至少一种:确定按钮、取消按钮、关机按钮或重启按钮,具体此处不做限定。例如,在标题为“是否确认操作”的界面对话组件中,添加“确认”和“取消”的控制按钮,当用户选择“确认”的控制按钮时,做出继续执行工作的响应动作;或当用户选择“取消”的控制按钮时,做出取消工作的响应动作。In step S103 of some embodiments, several control buttons and response actions corresponding to the control buttons are added to the interface dialogue component. After the interactive function to be implemented by the interface dialogue component is set in step S102, it is also necessary to provide buttons for human-computer interaction and respond to operations according to the buttons selected by the user. Therefore, one or more control buttons are added to the interface dialogue component, and response actions corresponding to the control buttons are set. The several control buttons include at least one of the following: an OK button, a Cancel button, a Shutdown button, or a Restart button, which are not specifically limited here. For example, in an interface dialogue component titled "Confirm the Operation", control buttons of "Confirm" and "Cancel" are added. When the user selects the "Confirm" control button, a response action of continuing to execute the work is made; or when the user selects the "Cancel" control button, a response action of canceling the work is made.

一些实施例的步骤S104中,根据弹窗展示的数据、控制按钮和响应动作初始化界面对话组件,并生成弹窗。在步骤S101至步骤S103完成对界面对话组件的设置后,还需要进一步地对界面对话组件进行初始化,从而生成弹窗。弹窗展示给用户的信息,由步骤S101的数据和步骤S103的控制按钮和响应动作决定。In step S104 of some embodiments, the interface dialogue component is initialized according to the data, control buttons and response actions displayed in the pop-up window, and a pop-up window is generated. After the interface dialogue component is set in steps S101 to S103, the interface dialogue component needs to be further initialized to generate a pop-up window. The information displayed to the user in the pop-up window is determined by the data in step S101 and the control buttons and response actions in step S103.

参照图2,根据本发明的一些实施例,步骤S104的根据弹窗展示的数据、控制按钮和响应动作初始化界面对话组件,并生成弹窗,具体可以包括,但不限于下述:2 , according to some embodiments of the present invention, the initialization of the interface dialog component according to the data displayed in the pop-up window, the control button and the response action, and the generation of the pop-up window in step S104 may specifically include, but not limited to, the following:

步骤S201,获取终端屏幕尺寸;Step S201, obtaining the terminal screen size;

步骤S202,根据终端屏幕尺寸和弹窗标题信息创建第一界面视图组容器,以使得弹窗主体在第一界面视图组容器所在区域上显示;Step S202, creating a first interface view group container according to the terminal screen size and the pop-up window title information, so that the pop-up window body is displayed in the area where the first interface view group container is located;

步骤S203,根据弹窗提示信息和控制按钮、响应动作创建第二界面视图组容器,以使得弹窗窗口在第二界面视图组容器所在区域上显示;Step S203, creating a second interface view group container according to the pop-up window prompt information, the control button, and the response action, so that the pop-up window is displayed in the area where the second interface view group container is located;

步骤S204,将第二界面视图组容器添加至第一界面视图组容器中;Step S204, adding the second interface view group container to the first interface view group container;

步骤S205,将第一界面视图组容器添加至根视图容器中,生成弹窗显示页面,以使得弹窗主体在终端屏幕上显示,弹窗窗口在弹窗主体中显示,弹窗窗口的尺寸小于弹窗主体。Step S205, adding the first interface view group container to the root view container, generating a pop-up display page, so that the pop-up body is displayed on the terminal screen, the pop-up window is displayed in the pop-up body, and the size of the pop-up window is smaller than the pop-up body.

一些实施例的步骤S201至步骤S202中,先获取终端屏幕尺寸;再根据终端屏幕尺寸和弹窗标题信息创建第一界面视图组容器,以使得弹窗主体在第一界面视图组容器所在区域上显示。为了能够通过新建的界面对话组件生成弹窗,本申请使用界面视图组容器(UIViewGroup容器)加根视图(RootView)代替窗口加窗口根视图(WindowRootView)的方式。需要说明的是,界面视图组容器通常用于组织和布局UI元素,是一个包含和排列其他UI组件的容器,可以以一种结构化和可管理的方式组织UI元素,并创建复杂的用户界面。In steps S201 to S202 of some embodiments, the terminal screen size is first obtained; then a first interface view group container is created according to the terminal screen size and the pop-up window title information, so that the pop-up window body is displayed in the area where the first interface view group container is located. In order to be able to generate a pop-up window through a newly created interface dialogue component, this application uses an interface view group container (UIViewGroup container) plus a root view (RootView) instead of a window plus a window root view (WindowRootView). It should be noted that an interface view group container is usually used to organize and layout UI elements. It is a container that contains and arranges other UI components. It can organize UI elements in a structured and manageable manner and create complex user interfaces.

弹窗包括弹窗主体和弹窗窗口。本申请的第一界面视图组容器是弹窗主体的载体,弹窗主体的显示区域为第一界面视图组容器所在的区域。因此,需要将终端屏幕的尺寸作为第一界面视图组容器的尺寸,即弹窗主体全覆盖终端屏幕,从而保证弹窗弹出展示时,用户触摸屏幕只响应弹窗。The pop-up window includes a pop-up window body and a pop-up window. The first interface view group container of the present application is the carrier of the pop-up window body, and the display area of the pop-up window body is the area where the first interface view group container is located. Therefore, it is necessary to use the size of the terminal screen as the size of the first interface view group container, that is, the pop-up window body fully covers the terminal screen, so as to ensure that when the pop-up window pops up and is displayed, the user touches the screen to respond only to the pop-up window.

参照图3,根据本发明的一些实施例,步骤S202的根据终端屏幕尺寸和弹窗标题信息创建第一界面视图组容器之后,还需要对第一界面视图组容器进行详细设置,以实现弹窗主体在终端屏幕上的布局合理美观,具体可以包括,但不限于下述:3 , according to some embodiments of the present invention, after creating the first interface view group container according to the terminal screen size and the pop-up window title information in step S202, the first interface view group container needs to be set in detail to achieve a reasonable and beautiful layout of the pop-up window body on the terminal screen, which may include, but is not limited to, the following:

步骤S301,将第一界面视图组容器的背景色设置为灰色;Step S301, setting the background color of the first interface view group container to gray;

步骤S302,调整第一界面视图组容器的透明度。Step S302: adjust the transparency of the first interface view group container.

一些实施例的步骤S301至步骤S302中,先将第一界面视图组容器的背景色设置为灰色;再调整第一界面视图组容器的透明度。为了突出显示弹窗主体的标题或其它弹窗展示的信息,例如后续步骤中的弹窗窗口,需要将第一界面视图组容器的背景色和透明度进行调整,从而达到弹窗窗口区域外的位置不可点击的视觉效果。In some embodiments, in step S301 to step S302, the background color of the first interface view group container is first set to gray; and then the transparency of the first interface view group container is adjusted. In order to highlight the title of the pop-up window body or other pop-up window information, such as the pop-up window in the subsequent steps, the background color and transparency of the first interface view group container need to be adjusted, so as to achieve a visual effect that the position outside the pop-up window area is not clickable.

一些实施例的步骤S203中,根据弹窗提示信息和控制按钮、响应动作创建第二界面视图组容器,以使得弹窗窗口在第二界面视图组容器所在区域上显示。弹窗窗口是实现人机交互的主要页面,因此,弹窗窗口上展示有根据弹窗提示信息设置的标题和具体提示信息文本,以及根据控制按钮和响应动作设置的供用户点击的按钮。第二界面视图组容器是弹窗窗口的载体,弹窗窗口的显示区域为第二界面视图组容器所在的区域。In step S203 of some embodiments, a second interface view group container is created according to the pop-up window prompt information, control buttons, and response actions, so that the pop-up window is displayed in the area where the second interface view group container is located. The pop-up window is the main page for realizing human-computer interaction. Therefore, the pop-up window displays a title and specific prompt information text set according to the pop-up window prompt information, and a button for the user to click set according to the control buttons and response actions. The second interface view group container is the carrier of the pop-up window, and the display area of the pop-up window is the area where the second interface view group container is located.

一些实施例的步骤S204中,将第二界面视图组容器添加至第一界面视图组容器中。第一界面视图组容器上面加载第二界面视图组,使第二界面视图组浮在第一界面视图组之上,避免弹窗窗口被弹窗主体覆盖,从而使弹窗主体和弹窗窗口组合起来构成弹窗。In step S204 of some embodiments, the second interface view group container is added to the first interface view group container. The second interface view group is loaded on the first interface view group container, so that the second interface view group floats above the first interface view group to prevent the pop-up window from being covered by the pop-up window body, so that the pop-up window body and the pop-up window are combined to form a pop-up window.

参照图4,根据本发明的一些实施例,在步骤S204中,将第二界面视图组容器添加至第一界面视图组容器中,具体可以包括,但不限于下述:4 , according to some embodiments of the present invention, in step S204, adding the second interface view group container to the first interface view group container may specifically include, but not limited to, the following:

步骤S401,将第二界面视图组容器的背景色设置为白色;Step S401, setting the background color of the second interface view group container to white;

步骤S402,将第二界面视图组容器居中放置在第一界面视图组容器中。Step S402: center the second interface view group container in the first interface view group container.

一些实施例的步骤S401至步骤S402中,先将第二界面视图组容器的背景色设置为白色;再将第二界面视图组容器居中放置在第一界面视图组容器中。为了达到弹窗窗口在弹窗主体上的视觉效果合理美观,需要将第二容器界面视图组容器的背景色设置为白色,以使得白色的弹窗窗口在步骤S301中设置的灰色的弹窗主体上突出显示。进一步地调整弹窗窗口的位置布局,将第二界面视图组容器居中置于第一界面视图组容器中,便于用户查看和操作。In some embodiments, in step S401 to step S402, the background color of the second interface view group container is first set to white; then the second interface view group container is centered in the first interface view group container. In order to achieve a reasonable and beautiful visual effect of the pop-up window on the pop-up window body, it is necessary to set the background color of the second container interface view group container to white, so that the white pop-up window is highlighted on the gray pop-up window body set in step S301. Further adjust the position layout of the pop-up window, and center the second interface view group container in the first interface view group container, so that users can view and operate it easily.

一些实施例的步骤S205中,将第一界面视图组容器添加至根视图容器中,生成弹窗显示页面,以使得弹窗主体在终端屏幕上显示,弹窗窗口在弹窗主体中显示,弹窗窗口的尺寸小于弹窗主体。在步骤S201至步骤S204中设置完第一界面视图组容器和第二界面视图组容器后,还需要再将第一界面视图组容器添加至根视图容器中,从而生成弹窗。In step S205 of some embodiments, the first interface view group container is added to the root view container, and a pop-up window display page is generated, so that the pop-up window body is displayed on the terminal screen, the pop-up window is displayed in the pop-up window body, and the size of the pop-up window is smaller than the pop-up window body. After setting the first interface view group container and the second interface view group container in steps S201 to S204, the first interface view group container needs to be added to the root view container to generate a pop-up window.

一些实施例的步骤S105中,将弹窗展示在终端屏幕上。步骤S104完成界面对话组件的初始化并生成弹窗后,将弹窗展示在终端屏幕上,供用户在终端屏幕上根据弹窗展示的信息和实际需求进行操作。In step S105 of some embodiments, the pop-up window is displayed on the terminal screen. After completing the initialization of the interface dialogue component and generating the pop-up window in step S104, the pop-up window is displayed on the terminal screen for the user to operate on the terminal screen according to the information displayed in the pop-up window and actual needs.

参照图5,根据本发明的一些实施例,为了进一步减少弹窗功能占用的资源,可以创建一个定时任务列表,用于回收完成响应动作的弹窗资源,即当弹窗关闭时,释放弹窗申请使用的内存。为实现上述的回收功能,需要在步骤S102之前还创建定时任务列表,具体可以包括,但不限于下述:5, according to some embodiments of the present invention, in order to further reduce the resources occupied by the pop-up window function, a scheduled task list can be created to recycle the pop-up window resources that complete the response action, that is, when the pop-up window is closed, the memory used by the pop-up window application is released. To achieve the above recycling function, it is necessary to create a scheduled task list before step S102, which may include, but is not limited to, the following:

步骤S501,创建界面对话组件;Step S501, creating an interface dialogue component;

步骤S502,创建定时任务列表;Step S502, creating a scheduled task list;

步骤S503,当到达预先设置的时间时,判断定时任务列表是否存在元素;若是,则执行步骤S504;若否,则执行步骤S505;Step S503, when the preset time is reached, determine whether there is an element in the scheduled task list; if so, execute step S504; if not, execute step S505;

步骤S504,取出元素并销毁;Step S504, take out the element and destroy it;

步骤S505,重新计时。Step S505, re-timing.

一些实施例的步骤S501中,创建界面对话组件。需要说明的是,为了在OpenHarmony轻量系统上使用弹窗功能,且不增加另外的依赖组件,防止产生更大的资源消耗,本申请通过新增加的界面对话组件达成上述效果。界面对话组件(UIDialog组件)通常用于显示对话框或弹出窗口,这些窗口会中断用户的当前操作,并要求用户进行某种交互(例如确认、输入信息、选择等,具体此处不做限定)。界面对话组件可能包含各种UI元素,如按钮、文本框、图像等,用于与用户进行交互,具体此处不做限定。本申请创建的界面对话组件用于在后续步骤中建立、显示、隐藏或关闭弹窗。In step S501 of some embodiments, an interface dialogue component is created. It should be noted that in order to use the pop-up function on the OpenHarmony lightweight system without adding additional dependent components and preventing greater resource consumption, the present application achieves the above effect through a newly added interface dialogue component. Interface dialogue components (UIDialog components) are generally used to display dialog boxes or pop-up windows, which interrupt the user's current operation and require the user to perform some kind of interaction (such as confirmation, input information, selection, etc., which are not specifically limited here). The interface dialogue component may contain various UI elements, such as buttons, text boxes, images, etc., for interacting with the user, which are not specifically limited here. The interface dialogue component created in this application is used to create, display, hide or close pop-up windows in subsequent steps.

一些步骤S502至步骤S505中,创建定时任务列表;当到达预先设置的时间时,判断定时任务列表是否存在元素;若是,则取出元素并销毁;若否,则重新计时;需要说明的是,预先设置的时间为定时任务列表中预先设定的定时时长,用于定时完成定时任务列表中的任务,而本申请的定时任务列表的任务是定时销毁列表中存在的元素。例如,预先设置该定时时长为5秒,则每5秒判定定时任务列表中是否存在供后续销毁的元素,若存在,则将元素从定时任务列表中取出并销毁;若不存在,则重新计时5秒,再进行判定,以此往复。In some steps S502 to S505, a scheduled task list is created; when the preset time is reached, it is determined whether there are elements in the scheduled task list; if so, the elements are taken out and destroyed; if not, the time is reset; it should be noted that the preset time is the preset timing duration in the scheduled task list, which is used to complete the tasks in the scheduled task list on a scheduled basis, and the task of the scheduled task list of the present application is to regularly destroy the elements in the list. For example, if the timing duration is preset to 5 seconds, it is determined every 5 seconds whether there are elements in the scheduled task list for subsequent destruction. If so, the elements are taken out of the scheduled task list and destroyed; if not, the time is reset for 5 seconds and the determination is made again, and this is repeated.

参照图6,根据本发明的一些实施例,步骤S501至步骤S505创建了用于回收资源的定时任务列表,因此,下面是在上述步骤的基础上对回收操作进行的详细描述。具体可以包括,但不限于下述:Referring to FIG. 6 , according to some embodiments of the present invention, steps S501 to S505 create a timed task list for recycling resources. Therefore, the following is a detailed description of the recycling operation based on the above steps. Specifically, it may include, but is not limited to, the following:

步骤S601,在根据用户选择的控制按钮后,完成对应控制按钮的响应动作;Step S601, after the control button is selected by the user, completing the response action of the corresponding control button;

步骤S602,销毁弹窗窗口和弹窗主体;Step S602, destroying the pop-up window and the pop-up window body;

步骤S603,将第一界面视图组容器转移至定时任务列表,作为定时任务列表中需要销毁的元素。Step S603: Transfer the first interface view group container to the scheduled task list as an element that needs to be destroyed in the scheduled task list.

一些步骤S601至步骤S603中,在根据用户选择的控制按钮后,先完成对应控制按钮的响应动作;在销毁弹窗窗口和弹窗主体;然后将第一界面视图组容器转移至定时任务列表,作为定时任务列表中需要销毁的元素;需要说明的是,在步骤S106之后,应当先完成响应动作,再进行回收,避免无效回收。例如,当用户点击了弹窗窗口上的“确定”的控制按钮,响应确认的动作完成后,先将弹窗窗口和弹窗主体关闭并销毁,然后将第一界面视图组容器转移至步骤S501中的定时任务列表,到达定时时长就取出该第一界面视图组容器并销毁。由于步骤S204已经将第二界面视图组容器添加至第一界面视图组容器中,则第一界面视图组容器销毁时,第二界面视图组容器也销毁,从而实现了弹窗占用资源的释放。In some steps S601 to S603, after the control button selected by the user, the response action of the corresponding control button is completed first; the pop-up window and the pop-up window body are destroyed; and then the first interface view group container is transferred to the scheduled task list as an element that needs to be destroyed in the scheduled task list; it should be noted that after step S106, the response action should be completed first, and then recycling should be performed to avoid invalid recycling. For example, when the user clicks the "OK" control button on the pop-up window, after the response confirmation action is completed, the pop-up window and the pop-up window body are closed and destroyed first, and then the first interface view group container is transferred to the scheduled task list in step S501, and the first interface view group container is taken out and destroyed when the timing duration is reached. Since step S204 has added the second interface view group container to the first interface view group container, when the first interface view group container is destroyed, the second interface view group container is also destroyed, thereby releasing the resources occupied by the pop-up window.

上述对本申请提供的一种基于OpenHarmony轻量系统弹窗的方法进行了说明,下面对本申请提供的一种基于OpenHarmony轻量系统弹窗的装置和电子设备进行说明:The above describes a method for a pop-up window based on an OpenHarmony lightweight system provided by the present application. The following describes a device and an electronic device based on a pop-up window based on an OpenHarmony lightweight system provided by the present application:

参阅图7,本申请还提供了一种基于OpenHarmony轻量系统弹窗的装置,该装置包括:Referring to FIG. 7 , the present application further provides a device for a pop-up window based on an OpenHarmony lightweight system, the device comprising:

获取单元701,用于获取待弹窗展示的数据,待弹窗展示的数据包括弹窗标题信息和弹窗提示信息;An acquisition unit 701 is used to acquire data to be displayed in a pop-up window, where the data to be displayed in the pop-up window includes pop-up window title information and pop-up window prompt information;

设置单元702,用于根据待弹窗展示的数据设置界面对话组件;A setting unit 702, used to set an interface dialogue component according to the data to be displayed in the pop-up window;

添加单元703,用于在界面对话组件中添加若干个控制按钮以及若干个控制按钮对应的响应动作;An adding unit 703, used to add a number of control buttons and a number of response actions corresponding to the control buttons in the interface dialogue component;

初始化单元704,用于根据弹窗展示的数据、控制按钮和响应动作初始化界面对话组件,并生成弹窗;Initialization unit 704, used to initialize the interface dialogue component according to the data, control buttons and response actions displayed in the pop-up window, and generate a pop-up window;

展示单元705,用于将弹窗展示在终端屏幕上。The display unit 705 is used to display the pop-up window on the terminal screen.

可选的,初始化单元704具体用于:Optionally, the initialization unit 704 is specifically used for:

获取终端屏幕尺寸;Get the terminal screen size;

根据终端屏幕尺寸和弹窗标题信息创建第一界面视图组容器,以使得弹窗主体在第一界面视图组容器所在区域上显示;Creating a first interface view group container according to the terminal screen size and the pop-up window title information, so that the pop-up window body is displayed in the area where the first interface view group container is located;

根据弹窗提示信息和控制按钮、响应动作创建第二界面视图组容器,以使得弹窗窗口在第二界面视图组容器所在区域上显示;Creating a second interface view group container according to the pop-up window prompt information, the control button, and the response action, so that the pop-up window is displayed in the area where the second interface view group container is located;

将第二界面视图组容器添加至第一界面视图组容器中;Add the second interface view group container to the first interface view group container;

将第一界面视图组容器添加至根视图容器中,生成弹窗显示页面,以使得弹窗主体在终端屏幕上显示,弹窗窗口在弹窗主体中显示,弹窗窗口的尺寸小于弹窗主体。The first interface view group container is added to the root view container, and a pop-up display page is generated, so that the pop-up body is displayed on the terminal screen, the pop-up window is displayed in the pop-up body, and the size of the pop-up window is smaller than the pop-up body.

可选的,初始化单元704具体用于:Optionally, the initialization unit 704 is specifically used for:

将第一界面视图组容器的背景色设置为灰色;Set the background color of the first interface view group container to gray;

调整第一界面视图组容器的透明度。Adjust the transparency of the first interface view group container.

可选的,初始化单元704具体用于:Optionally, the initialization unit 704 is specifically used for:

将第二界面视图组容器的背景色设置为白色;Set the background color of the second interface view group container to white;

将第二界面视图组容器居中放置在第一界面视图组容器中。The second interface view group container is centered within the first interface view group container.

可选的,若干个控制按钮包括如下至少一种:确定按钮、取消按钮、关机按钮或重启按钮。Optionally, the plurality of control buttons include at least one of the following: an OK button, a Cancel button, a Power Off button or a Restart button.

可选的,在设置单元702之前,还包括:Optionally, before the setting unit 702, the method further includes:

界面对话组件单元706,用于创建界面对话组件;An interface dialogue component unit 706, used to create an interface dialogue component;

定时任务列表单元707,用于创建定时任务列表;Scheduled task list unit 707, used to create a scheduled task list;

判断单元708,用于当到达预先设置的时间时,判断定时任务列表是否存在元素;A judging unit 708, configured to judge whether there is an element in the scheduled task list when a preset time is reached;

执行单元709,用于取出元素并销毁;Execution unit 709, used to extract and destroy elements;

返回单元710,用于重新计时。The return unit 710 is used to re-time.

可选的,在展示单元705之后,还包括:Optionally, after the display unit 705, the following is further included:

响应单元711,用于在根据用户选择的控制按钮后,完成对应控制按钮的响应动作;A response unit 711, used to complete a response action of a corresponding control button after the control button is selected by the user;

销毁单元712,用于销毁弹窗窗口和弹窗主体;A destroying unit 712, used to destroy the pop-up window and the pop-up window body;

转移单元713,用于将第一界面视图组容器转移至定时任务列表,作为定时任务列表中需要销毁的元素。The transfer unit 713 is used to transfer the first interface view group container to the scheduled task list as an element that needs to be destroyed in the scheduled task list.

本申请还提供了一种电子设备,请参阅图8,该电子设备包括:The present application also provides an electronic device, see FIG8 , the electronic device includes:

处理器801、存储器802、输入输出单元803、总线804;Processor 801, memory 802, input and output unit 803, bus 804;

处理器801与存储器802、输入输出单元803以及总线804相连;The processor 801 is connected to the memory 802, the input and output unit 803 and the bus 804;

存储器802保存有程序,处理器801调用程序以执行如图1至图6任一实施例所示的基于OpenHarmony轻量系统弹窗的方法。The memory 802 stores a program, and the processor 801 calls the program to execute the method based on the OpenHarmony lightweight system pop-up window as shown in any embodiment of FIG. 1 to FIG. 6 .

本申请还涉及一种计算机可读存储介质,计算机可读存储介质上保存有程序,其特征在于,当程序在计算机上运行时,使得计算机执行如图1至图6任一实施例所示的基于OpenHarmony轻量系统弹窗的方法。The present application also relates to a computer-readable storage medium on which a program is stored, wherein when the program runs on a computer, the computer executes a method based on an OpenHarmony lightweight system pop-up window as shown in any one of the embodiments of FIG. 1 to FIG. 6 .

所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,read-onlymemory)、随机存取存储器(RAM,random access memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk and other media that can store program code.

Claims (10)

1.一种基于OpenHarmony轻量系统弹窗的方法,其特征在于,所述方法包括:1. A method for pop-up window based on OpenHarmony lightweight system, characterized in that the method comprises: 获取待弹窗展示的数据,所述待弹窗展示的数据包括弹窗标题信息和弹窗提示信息;Obtaining data to be displayed in a pop-up window, wherein the data to be displayed in the pop-up window includes pop-up window title information and pop-up window prompt information; 根据所述待弹窗展示的数据设置界面对话组件;Setting interface dialogue components according to the data to be displayed in the pop-up window; 在所述界面对话组件中添加若干个控制按钮以及所述若干个控制按钮对应的响应动作;Adding a number of control buttons and corresponding response actions of the control buttons in the interface dialogue component; 根据所述弹窗展示的数据、所述控制按钮和所述响应动作初始化所述界面对话组件,并生成弹窗;Initializing the interface dialogue component according to the data displayed in the pop-up window, the control button and the response action, and generating a pop-up window; 将所述弹窗展示在终端屏幕上。The pop-up window is displayed on the terminal screen. 2.根据权利要求1中所述的方法,其特征在于,所述根据所述弹窗展示的数据、所述控制按钮和所述响应动作初始化所述界面对话组件,并生成弹窗,包括:2. The method according to claim 1, characterized in that the initializing the interface dialogue component according to the data displayed in the pop-up window, the control button and the response action and generating the pop-up window comprises: 获取终端屏幕尺寸;Get the terminal screen size; 根据所述终端屏幕尺寸和所述弹窗标题信息创建第一界面视图组容器,以使得弹窗主体在所述第一界面视图组容器所在区域上显示;Creating a first interface view group container according to the terminal screen size and the pop-up window title information, so that the pop-up window body is displayed in the area where the first interface view group container is located; 根据所述弹窗提示信息和所述控制按钮、所述响应动作创建第二界面视图组容器,以使得弹窗窗口在所述第二界面视图组容器所在区域上显示;Creating a second interface view group container according to the pop-up window prompt information, the control button, and the response action, so that the pop-up window is displayed in the area where the second interface view group container is located; 将所述第二界面视图组容器添加至所述第一界面视图组容器中;Adding the second interface view group container to the first interface view group container; 将所述第一界面视图组容器添加至根视图容器中,生成弹窗显示页面,以使得所述弹窗主体在所述终端屏幕上显示,所述弹窗窗口在所述弹窗主体中显示,所述弹窗窗口的尺寸小于所述弹窗主体。The first interface view group container is added to the root view container, and a pop-up display page is generated, so that the pop-up body is displayed on the terminal screen, the pop-up window is displayed in the pop-up body, and the size of the pop-up window is smaller than the pop-up body. 3.根据权利要求2中所述的方法,其特征在于,在所述根据所述终端屏幕尺寸和所述弹窗标题信息创建第一界面视图组容器之后,还包括:3. The method according to claim 2, characterized in that after creating the first interface view group container according to the terminal screen size and the pop-up window title information, it also includes: 将所述第一界面视图组容器的背景色设置为灰色;Setting the background color of the first interface view group container to gray; 调整所述第一界面视图组容器的透明度。The transparency of the first interface view group container is adjusted. 4.根据权利要求2中所述的方法,其特征在于,所述将所述第二界面视图组容器添加至所述第一界面视图组容器中,包括:4. The method according to claim 2, wherein adding the second interface view group container to the first interface view group container comprises: 将所述第二界面视图组容器的背景色设置为白色;Setting the background color of the second interface view group container to white; 将所述第二界面视图组容器居中放置在所述第一界面视图组容器中。The second interface view group container is centered in the first interface view group container. 5.根据权利要求1中所述的方法,其特征在于,所述若干个控制按钮包括如下至少一种:确定按钮、取消按钮、关机按钮或重启按钮。5. The method according to claim 1, characterized in that the plurality of control buttons include at least one of the following: an OK button, a Cancel button, a Power Off button or a Restart button. 6.根据权利要求2-4中任一项所述的方法,其特征在于,在所述根据所述待弹窗展示的数据设置界面对话组件之前,还包括:6. The method according to any one of claims 2 to 4, characterized in that before setting the interface dialogue component according to the data to be displayed in the pop-up window, it also includes: 创建界面对话组件;Create interface dialogue components; 创建定时任务列表;Create a scheduled task list; 当到达预先设置的时间时,判断所述定时任务列表是否存在元素;When the preset time is reached, determining whether there is an element in the scheduled task list; 若是,则取出所述元素并销毁;If so, the element is taken out and destroyed; 若否,则重新计时。If not, restart the timer. 7.根据权利要求6中所述的方法,其特征在于,在所述将所述弹窗展示在终端屏幕上之后,还包括:7. The method according to claim 6, characterized in that after displaying the pop-up window on the terminal screen, it also includes: 在根据用户选择的所述控制按钮后,完成对应所述控制按钮的响应动作;After the control button is selected by the user, a response action corresponding to the control button is completed; 销毁所述弹窗窗口和所述弹窗主体;Destroy the pop-up window and the pop-up window body; 将所述第一界面视图组容器转移至所述定时任务列表,作为所述定时任务列表中需要销毁的元素。The first interface view group container is transferred to the scheduled task list as an element in the scheduled task list that needs to be destroyed. 8.一种基于OpenHarmony轻量系统弹窗的装置,其特征在于,所述装置包括:8. A device for pop-up window based on OpenHarmony lightweight system, characterized in that the device comprises: 获取单元,用于获取待弹窗展示的数据,所述待弹窗展示的数据包括弹窗标题信息和弹窗提示信息;An acquisition unit, used for acquiring data to be displayed in a pop-up window, wherein the data to be displayed in the pop-up window includes pop-up window title information and pop-up window prompt information; 设置单元,用于根据所述待弹窗展示的数据设置界面对话组件;A setting unit, used for setting an interface dialogue component according to the data to be displayed in the pop-up window; 添加单元,用于在所述界面对话组件中添加若干个控制按钮以及所述若干个控制按钮对应的响应动作;An adding unit, used for adding a plurality of control buttons and response actions corresponding to the plurality of control buttons in the interface dialogue component; 初始化单元,用于根据所述弹窗展示的数据、所述控制按钮和所述响应动作初始化所述界面对话组件,并生成弹窗;An initialization unit, configured to initialize the interface dialogue component according to the data displayed in the pop-up window, the control button and the response action, and generate a pop-up window; 展示单元,用于将所述弹窗展示在终端屏幕上。The display unit is used to display the pop-up window on the terminal screen. 9.一种电子设备,其特征在于,所述电子设备包括:9. An electronic device, characterized in that the electronic device comprises: 处理器、存储器、输入输出单元以及总线;Processor, memory, input-output unit, and bus; 所述处理器与所述存储器、所述输入输出单元以及所述总线相连;The processor is connected to the memory, the input and output unit, and the bus; 所述存储器保存有程序,所述处理器调用所述程序以执行如权利要求1至7中任一项所述方法。The memory stores a program, and the processor calls the program to execute the method according to any one of claims 1 to 7. 10.一种计算机可读存储介质,所述计算机可读存储介质上保存有程序,所述程序在计算机上执行时执行如权利要求1至7中任一项所述方法。10. A computer-readable storage medium having a program stored thereon, wherein the program, when executed on a computer, performs the method according to any one of claims 1 to 7.
CN202410650387.9A 2024-05-24 2024-05-24 Method and related device for popup window based on OpenHarmony light-weight system Active CN118227004B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410650387.9A CN118227004B (en) 2024-05-24 2024-05-24 Method and related device for popup window based on OpenHarmony light-weight system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410650387.9A CN118227004B (en) 2024-05-24 2024-05-24 Method and related device for popup window based on OpenHarmony light-weight system

Publications (2)

Publication Number Publication Date
CN118227004A true CN118227004A (en) 2024-06-21
CN118227004B CN118227004B (en) 2024-11-01

Family

ID=91507896

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410650387.9A Active CN118227004B (en) 2024-05-24 2024-05-24 Method and related device for popup window based on OpenHarmony light-weight system

Country Status (1)

Country Link
CN (1) CN118227004B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114115882A (en) * 2021-12-07 2022-03-01 天津车之家软件有限公司 Page display method and device and computing equipment
CN114546586A (en) * 2022-01-19 2022-05-27 国电南瑞科技股份有限公司 A container resource limitation, fault monitoring and recovery method
CN114995929A (en) * 2021-11-17 2022-09-02 荣耀终端有限公司 Method and device for displaying pop-up window
CN116841658A (en) * 2022-03-23 2023-10-03 华为技术有限公司 Interface display method and electronic device
CN116974659A (en) * 2022-04-21 2023-10-31 华为技术有限公司 Interface layout method and device
CN117389552A (en) * 2023-09-27 2024-01-12 北京米可世界科技有限公司 Popup window implementation method and device, electronic equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114995929A (en) * 2021-11-17 2022-09-02 荣耀终端有限公司 Method and device for displaying pop-up window
CN114115882A (en) * 2021-12-07 2022-03-01 天津车之家软件有限公司 Page display method and device and computing equipment
CN114546586A (en) * 2022-01-19 2022-05-27 国电南瑞科技股份有限公司 A container resource limitation, fault monitoring and recovery method
CN116841658A (en) * 2022-03-23 2023-10-03 华为技术有限公司 Interface display method and electronic device
CN116974659A (en) * 2022-04-21 2023-10-31 华为技术有限公司 Interface layout method and device
CN117389552A (en) * 2023-09-27 2024-01-12 北京米可世界科技有限公司 Popup window implementation method and device, electronic equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
MOB649E815D65E6: "鸿蒙API9加载弹窗", pages 1 - 2, Retrieved from the Internet <URL:https://blog.51cto.com/u_16175471/9170670> *
WMDING1: "HarmonyOS应用开发-基础组件,弹窗原来是这样实现的", pages 1 - 6, Retrieved from the Internet <URL:https://blog.csdn.net/wmdkanh/article/details/136668688> *

Also Published As

Publication number Publication date
CN118227004B (en) 2024-11-01

Similar Documents

Publication Publication Date Title
CN108089786B (en) User interface display method, device, device and storage medium
CN107111496B (en) Customizable blade applications
WO2020147462A1 (en) Recovery from application anomaly
US9665381B2 (en) Combining interfaces of shell applications and sub-applications
US20020118231A1 (en) Method of realistically displaying and interacting with electronic files
CN110990075B (en) Quick application startup method, device, equipment and storage medium
CN103345405A (en) Application program starting method and device and client
CN103197874A (en) Electronic device and method for synchronously displaying content when the electronic device belongs to different states
CN113810746B (en) Display equipment and picture sharing method
JP2010287205A (en) Electronic device, computer-implemented system, and application program display control method therefor
WO2015200618A1 (en) Light dismiss manager
CN112184168B (en) Reminder task generation method, device and electronic device
CN113282213A (en) Interface display method and device
CN110096329A (en) A display content control method, electronic device and computer-readable storage medium
CN103257788A (en) Windows desktop dynamic icon forming method
CN118227004B (en) Method and related device for popup window based on OpenHarmony light-weight system
CN115729412A (en) Interface display method and device
CN115562544A (en) Display device and revocation method
CN107526597A (en) User interface edit methods, device, terminal and computer-readable recording medium
CN115525187B (en) Screen splitting method and related equipment
CN115048191B (en) Method for switching display equipment by fast application and related equipment
WO2024078207A1 (en) Interface display method and apparatus, terminal device, and storage medium
CN112805685A (en) Method, apparatus, and computer-readable medium for propagating rich note data objects over web socket connections in a web collaborative workspace
CN110853643A (en) Method, device, device and storage medium for speech recognition in fast application
CN117076265A (en) Process indication method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant