Page interaction method based on compose framework
By detecting Android soft keyboard operations, determining its height, and controlling the movement of page content components, the problems of soft keyboard obstruction and stuttering in the Compose framework were solved, resulting in better adaptability and user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZEN-AI TECH
- Filing Date
- 2024-08-02
- Publication Date
- 2026-07-03
AI Technical Summary
In existing technologies, when Android devices using the Compose framework display the Android soft keyboard, the information list cannot be adapted to match, resulting in the soft keyboard obscuring content or causing jerky or jarring issues.
By detecting keyboard visibility operations, the height of the soft keyboard is determined, and based on this, the movement distance and direction of page content components are controlled to avoid obstruction and blank space.
Improved the display compatibility of page content with the Android soft keyboard, avoiding obstruction and white space, and enhancing the user experience.
Smart Images

Figure CN119025002B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a page interaction method based on the Compos framework. Background Technology
[0002] In existing technologies, XML (Extensible Markup Language) frameworks are typically used to implement page interactions in Android device applications. However, due to problems such as verbose and complex code, low development efficiency, poor code readability and maintainability, difficulty in implementing dynamic page changes and responses, separation from other programming language code, and difficulty in real-time previewing, some solutions use the Compose framework to replace XML frameworks for page interactions.
[0003] However, in Android applications using the Compose framework, the display of information lists in scenarios such as displaying Android keyboards cannot adapt to the appearance or disappearance of the Android keyboard. For example, in some cases, when the Android keyboard is displayed, it will obscure at least part of the information list content; or, when the Android keyboard is displayed, the page will exhibit noticeable jerking or shaking.
[0004] It is evident that improving the compatibility of information lists in pages using the Compose framework with other functional pages is a technical issue worthy of attention. Summary of the Invention
[0005] In view of this, in order to solve some or all of the above-mentioned technical problems, this application provides a page interaction method based on the Compos framework.
[0006] In a first aspect, embodiments of this application provide a page interaction method based on the Compos framework, the method comprising:
[0007] Detect keyboard show / hide operations triggered by a target page, wherein the keyboard show / hide operation indicates that the Android soft keyboard is shown or hidden on the target page;
[0008] If the keyboard show / hide operation is detected, determine the keyboard height of the Android soft keyboard that the keyboard show / hide operation indicates to be shown or hidden;
[0009] Based on the keyboard height, the movement distance of the page content components displayed on the target page is determined, wherein the movement distance is greater than or equal to the keyboard height;
[0010] Determine a target direction that matches the keyboard show / hide operation, wherein the target direction represents the movement direction of the page content component;
[0011] The Android soft keyboard is shown or hidden according to the keyboard show / hide operation instructions, and the page content components are controlled to move the movement distance along the target direction.
[0012] In one possible implementation, the method further includes:
[0013] Create an object that implements the global layout listener interface, call the initialization function of the page content component, and set the layout callback listener for the page content component;
[0014] Upon detecting the keyboard show / hide operation and listening to the completion of the global rendering of the page content component, compare the initial height of the page content component with the instantaneous height of the page content component;
[0015] If the initial height and the instantaneous height are inconsistent, the keyboard show / hide operation indicator is determined to display the Android soft keyboard, and the target direction is upward;
[0016] When the initial height and the instantaneous height are the same, it is determined that the keyboard show / hide operation instruction hides the Android soft keyboard, and the target direction is downward.
[0017] In one possible implementation, the method further includes:
[0018] If the initial height and the instantaneous height are inconsistent, the function to obtain the visible display frame of the window is called, and the size and position information of the viewable area of the page content component are obtained through the function to obtain the visible display frame of the window.
[0019] The size information and the position information are filled into the rectangle attribute of the callback function;
[0020] Call the callback function, obtain the height parameter of the rectangle attribute from the callback function, and determine the height parameter as the instantaneous height;
[0021] Obtain the initial height;
[0022] Calculate the pixel difference between the initial height and the instantaneous height, and determine the pixel difference as the keyboard height of the Android soft keyboard.
[0023] In one possible implementation, the method further includes:
[0024] Determine the target duration between the trigger time of the keyboard show / hide operation and the current time;
[0025] When the Android soft keyboard is displayed by the keyboard show / hide operation indicator, it is determined that the keyboard height of the Android soft keyboard displayed by the keyboard show / hide operation indicator is positively correlated with the target duration in a first time period, wherein the first time period represents the time period during which the Android soft keyboard changes from being completely hidden to being fully displayed.
[0026] When the keyboard show / hide operation indicates that the Android soft keyboard is hidden, it is determined that the keyboard height of the Android soft keyboard hidden by the keyboard show / hide operation is negatively correlated with the target duration in a second time period, wherein the second time period represents the time period from when the Android soft keyboard is fully displayed to when it is fully hidden.
[0027] In one possible implementation, the method further includes:
[0028] Set a white space layer for the page content component, and set the height of the white space layer to the pixel difference;
[0029] Place the white space layer at the bottom of the page content component;
[0030] The bottom inner margin value of the content inner margin attribute of the page content component is set to the pixel difference value.
[0031] Control the page content component to move upward by the pixel difference.
[0032] In one possible implementation, the method further includes:
[0033] Detect the emoji page display operation triggered by the target page;
[0034] The height of the emoji page is set to the pixel difference, and the emoji page is controlled to move by the pixel difference, wherein the emoji page covers the Android soft keyboard.
[0035] In one possible implementation, the method further includes:
[0036] Detect the display operation of the function page triggered by the target page;
[0037] The height of the function page is set to the pixel difference, and the function page is controlled to move by the pixel difference, wherein the function page covers the Android soft keyboard.
[0038] In one possible implementation, the method further includes:
[0039] Set a horizontal interpolator to control the page to display and collapse smoothly.
[0040] In one possible implementation, prior to detecting the keyboard show / hide operation triggered by the target page, the method further includes:
[0041] Controls disable the Android system's response to the soft keyboard pop-up.
[0042] Secondly, embodiments of this application provide a page interaction device based on the Compos framework, the device comprising:
[0043] A detection unit is used to detect keyboard show / hide operations triggered by a target page, wherein the keyboard show / hide operation indicates that the Android soft keyboard is shown or hidden on the target page.
[0044] The first determining unit is configured to determine the keyboard height of the Android soft keyboard that is indicated to be displayed or hidden when the keyboard display operation is detected.
[0045] The second determining unit is used to determine the movement distance of the page content component displayed on the target page based on the keyboard height, wherein the movement distance is greater than or equal to the keyboard height;
[0046] The third determining unit is used to determine a target direction that matches the keyboard show / hide operation, wherein the target direction represents the movement direction of the page content component;
[0047] The control unit is configured to show or hide the Android soft keyboard according to the keyboard show / hide operation instructions, and to control the page content component to move the movement distance along the target direction.
[0048] Thirdly, embodiments of this application provide an electronic device, including:
[0049] Memory, used to store computer programs;
[0050] A processor is configured to execute a computer program stored in the memory, wherein, when the computer program is executed, it implements the method of any embodiment of the page interaction method based on the Compos framework of the first aspect of this application described above.
[0051] Fourthly, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, it implements the method of any embodiment of the page interaction method based on the Compos framework as described in the first aspect above.
[0052] Fifthly, embodiments of this application provide a computer program comprising computer-readable code that, when executed on a device, causes a processor in the device to implement the method of any embodiment of the page interaction method based on the Compos framework described in the first aspect above.
[0053] The page interaction method based on the Compos framework provided in this application embodiment can detect keyboard show / hide operations triggered by a target page. The keyboard show / hide operation instructs the display or hiding of an Android soft keyboard on the target page. Upon detecting the keyboard show / hide operation, the method determines the keyboard height of the Android soft keyboard to be displayed or hidden. Then, based on the keyboard height, it determines the movement distance of the page content component displayed on the target page, wherein the movement distance is greater than or equal to the keyboard height. Subsequently, it determines a target direction matching the keyboard show / hide operation, wherein the target direction represents the movement direction of the page content component. Finally, it displays or hides the Android soft keyboard according to the instruction of the keyboard show / hide operation and controls the page content component to move the movement distance along the target direction. Therefore, by controlling the movement of page content components along a direction matching the keyboard's display / hide operation when the Android soft keyboard is shown or hidden, the obstruction of the information list content of the page content components when the Android soft keyboard is displayed can be avoided, as well as the excessive white space of the page content components when the Android soft keyboard is hidden. This improves the compatibility between the page content and the display method of the Android soft keyboard in pages using the Compos framework. Attached Figure Description
[0054] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0055] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0056] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.
[0057] Figure 1 A flowchart illustrating a page interaction method based on the Compos framework provided in this application embodiment;
[0058] Figure 2 A flowchart illustrating another page interaction method based on the Compos framework provided in this application embodiment;
[0059] Figures 3A-3D A schematic diagram illustrating an application scenario of another page interaction method based on the Compos framework provided in this application embodiment;
[0060] Figure 4 A schematic diagram of the structure of a page interaction device based on the Compos framework provided in an embodiment of this application;
[0061] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0062] Various exemplary embodiments of this application will now be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. It should be noted that, unless otherwise specifically stated, the relative arrangement, numerical expressions, and values of the components and steps set forth in these embodiments do not limit the scope of this application.
[0063] Those skilled in the art will understand that the terms "first" and "second" in the embodiments of this application are only used to distinguish different steps, devices or modules, and do not represent any specific technical meaning, nor do they indicate the logical order between them.
[0064] It should also be understood that in this embodiment, "multiple" can refer to two or more, and "at least one" can refer to one, two or more.
[0065] It should also be understood that any component, data or structure mentioned in the embodiments of this application can generally be understood as one or more unless explicitly defined or given contrary guidance in the context.
[0066] Furthermore, the term "and / or" in this application is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this application generally indicates that the preceding and following related objects have an "or" relationship.
[0067] It should also be understood that the description of the various embodiments in this application emphasizes the differences between the various embodiments, and the similarities or similarities can be referred to each other. For the sake of brevity, they will not be described in detail.
[0068] Furthermore, the directional terms such as up, upward, down, downward, left, right, top, and bottom in this application are defined as follows: when the screen is facing the observer, up refers to the top edge of the screen, and the closer to the top of the screen, the higher it is; down, opposite to up, is the bottom edge of the screen, and the closer to the bottom of the screen, the lower it is; top is the edge of the screen closest to the observer's eyes; bottom refers to the edge of the screen closest to the observer's body; left refers to the edge of the screen on the observer's left side when the screen is facing the observer; right refers to the edge of the screen on the observer's right side when the screen is facing the observer; downward refers to moving towards the bottom of the screen; upward refers to moving towards the top of the screen.
[0069] The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit the scope of this application and its application or use.
[0070] Techniques, methods, and equipment known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and equipment should be considered part of the specification.
[0071] It should be noted that similar labels and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be discussed further in subsequent figures.
[0072] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. To facilitate understanding of the embodiments of this application, the application will be described in detail below with reference to the accompanying drawings and embodiments. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0073] To address the technical challenge of improving the compatibility between page content and Android soft keyboard display in pages using the Composer framework, this application provides a page interaction method based on the Composer framework, which can improve the compatibility between page content and Android soft keyboard display in pages using the Composer framework.
[0074] Figure 1This is a flowchart illustrating a page interaction method based on the Compose framework, provided as an embodiment of this application. This method can be applied to one or more electronic devices such as smartphones, laptops, desktop computers, portable computers, and servers. Furthermore, the execution entity of this method can be hardware or software. When the execution entity is hardware, it can be one or more of the aforementioned electronic devices. For example, a single electronic device can execute this method, or multiple electronic devices can cooperate with each other to execute this method. When the execution entity is software, this method can be implemented as multiple software programs or software modules, or as a single software program or software module. No specific limitations are imposed here.
[0075] like Figure 1 As shown, the method specifically includes:
[0076] Step 101: Detect keyboard show / hide operations triggered by the target page, wherein the keyboard show / hide operations indicate that the Android soft keyboard is shown or hidden on the target page.
[0077] In this embodiment, the target page can be any page on a device with an Android system installed that can display an Android soft keyboard.
[0078] The Android soft keyboard is a UI component on the Android system that provides text input functionality on Android devices. It's a virtual input device that simulates the function of a traditional physical keyboard. Users can input text, numbers, and symbols by touching the Android soft keyboard keys on the screen. The target page can be the display screen of a device with Android installed. The target page can display a combination of page content components and the displayed Android soft keyboard; alternatively, it can display a combination of page content components and a hidden Android soft keyboard. The page content components can be popup windows.
[0079] Typically, the Android keyboard can be displayed on the target page when the input field gains focus, when the control used to trigger the display of the Android keyboard is triggered, or when swiping up from the bottom of the device screen. The Android keyboard can be hidden on the target page when the input field loses focus, when the control used to trigger the hiding of the Android keyboard is triggered, or when clicking a "hide" or "done" button on the keyboard.
[0080] Therefore, the keyboard show / hide operation can be any of the operations described above used to trigger the Android soft keyboard to show or hide.
[0081] In this application, by running self-developed instant messaging software on an Android device (such as an Android phone), it is possible to support multiple users to create group chats or two users to send messages to each other for chat.
[0082] Instant messaging software can include a target page, page content components, a soft keyboard, an emoticon page, and a function page. The target page acts as a container for these components. The page content components display user-sent messages, which can be shown in a list format; these components belong to layer 1 of the target page. The soft keyboard (with input boxes) allows users to edit message content. It can be located in layer 2 of the target page. The emoticon page allows users to select emoticons to send to chat partners; it can be located in layer 3 of the target page. The function page provides at least one of the following chat functions: selecting and sending album images, taking photos or videos, sending location, voice input, selecting saved content, selecting and sending files, selecting and sending music, etc.; it can be located in layer 4 of the target page.
[0083] Layers 1, 2, 3, and 4 are four independent layers. With the soft keyboard displayed, layer 2 is located above layers 1, 3, and 4. Here, "above layer" refers to the layer closer to the user, i.e., the layer that the user can directly see. Therefore, if layer 2 changes on the target page (shows or hides), it will directly affect the amount of content displayed in layer 1. For example, the content displayed in layer 2 may obscure the information displayed in layer 1, thus preventing the user from seeing at least some of the information in the obscured layer 1.
[0084] In some optional implementations of this embodiment, the keyboard show / hide operation triggered by the target page can be detected in the following way:
[0085] If the target input field on the target page is detected to have gained focus, it is determined that a keyboard show / hide operation indicating the display of the Android soft keyboard on the target page has been detected.
[0086] The target input box can be an input box on the target page.
[0087] It is understandable that in the above optional implementation methods, once the input box on the page gains focus, it can be determined that a keyboard show / hide operation indicating the display of the Android soft keyboard on the target page has been detected. Furthermore, the Android soft keyboard can be displayed, and the page content can be controlled to move a corresponding distance in a direction matching the keyboard show / hide operation (specifically, the keyboard display operation). This can avoid the Android soft keyboard from obscuring the page content when it is displayed.
[0088] Step 102: If the keyboard show / hide operation is detected, determine the keyboard height of the Android soft keyboard that the keyboard show / hide operation indicates to show or hide.
[0089] In this embodiment, the keyboard height can represent the height of the currently displayed Android on-screen keyboard.
[0090] In some cases, the keyboard height can be a constant height.
[0091] In other cases, the keyboard height determined in step 102 may also vary with the target duration. In this case, the keyboard height is variable. The method for determining the keyboard height will be described later and will not be repeated here.
[0092] In some cases, the following methods can be used to determine whether the on-screen keyboard is displayed:
[0093] An object implementing the OnGlobalLayoutListener interface is created, and the initialization function (addOnGlobalLayoutListener) of the page content component is called to set a listener for layout callbacks for the page content component (PopupWindow). Upon detecting a keyboard show / hide operation and confirming the completion of the global rendering of the page content component, the initial height and instantaneous height of the page content component are compared. If the initial height and the instantaneous height are inconsistent, the keyboard show / hide operation is determined to indicate that the Android soft keyboard should be displayed. If the initial height and the instantaneous height are consistent, the keyboard show / hide operation is determined to indicate that the Android soft keyboard should be hidden.
[0094] Specifically, when the initial height and the instantaneous height are inconsistent and the instantaneous height gradually decreases, the display state of the Android soft keyboard is determined to be from a completely hidden state to gradually appearing. When the initial height and the instantaneous height remain consistent, the display state of the Android soft keyboard is determined to be completely hidden. When the initial height and the instantaneous height are inconsistent and the instantaneous height gradually increases, the display state of the Android soft keyboard is determined to be from a fully displayed state to gradually returning to a completely hidden state.
[0095] When the input field receives focus and the global layout of the popup component (i.e., the page content component (PopupWindow)) is completed (after being drawn by the Android UI system), the system retrieves the initial height value of the popup component (same as "initial height") and its instantaneous height value (same as "instantaneous height") to determine whether the soft keyboard should be displayed. For example, if the instantaneous height value of the popup component is inconsistent with its initial height value, it is determined that the popup component is being squeezed by the soft keyboard, and the soft keyboard is displayed; if the instantaneous height value of the popup component is consistent with its initial height value, it is determined that the popup component is not being squeezed, and the soft keyboard is not displayed.
[0096] Furthermore, assuming the keyboard show / hide operation indicates that the Android soft keyboard is displayed, when the global layout of the pop-up component is detected as complete, the function to obtain the visible display frame (getWindowVisibleDisplayFrame) is called. This function obtains the size and position information (boundary coordinates) of the viewable area of the pop-up component. The size and position information of the viewable area are then filled into the rectangle attribute (Rect) of the callback function. The height value in the rectangle attribute is the remaining height value of the pop-up component. When the global layout of the pop-up component is detected as complete, the callback function (onGlobalLayout) is called. The callback function obtains the height value (i.e., the height parameter) in the rectangle attribute. Then, the pixel difference between the original height value of the pop-up component (the height value calculated by the Android screen) and the remaining height value of the pop-up component (the pop-up component after being compressed by the soft keyboard) is calculated. If the pixel difference is greater than, for example, one-quarter of the screen height, the soft keyboard is displayed, and the pixel difference is used as the height value of the soft keyboard.
[0097] Step 103: Based on the keyboard height, determine the movement distance of the page content component displayed on the target page, wherein the movement distance is greater than or equal to the keyboard height.
[0098] In this embodiment, the keyboard height can be determined as the moving distance of the page content component displayed on the target page, or the sum of the keyboard height and the preset length can be determined as the moving distance of the page content component displayed on the target page.
[0099] Step 104: Determine the target direction that matches the keyboard show / hide operation, wherein the target direction represents the movement direction of the page content component.
[0100] In this embodiment, the target direction can be the direction that matches the keyboard show / hide operation.
[0101] In some optional implementations of this embodiment, when the Android soft keyboard is displayed at the bottom of the target page and the keyboard show / hide operation indicates that the Android soft keyboard is displayed, the target direction is upward.
[0102] It is understandable that in the above optional implementation methods, when the Android soft keyboard is displayed at the bottom of the page (which can be determined based on the position of the input box), once the Android soft keyboard needs to be displayed, the page content components of the target page will move upward with the Android soft keyboard to avoid the page content (i.e., the message list) being obscured by the Android soft keyboard.
[0103] In some optional implementations of this embodiment, when the display position of the Android soft keyboard is in the lower middle part of the target page (which can be determined based on the position of the input box), and the keyboard show / hide operation indicates hiding the Android soft keyboard, the target direction is downward.
[0104] It is understandable that in the above optional implementation methods, when the Android soft keyboard is displayed at the bottom of the page, once the Android soft keyboard is hidden, the page content components of the target page will move down with the Android soft keyboard to reduce the white space of the display area of the page content components, so that users can browse more page content (i.e., the message list).
[0105] In some optional implementations of this embodiment, when the Android soft keyboard is displayed at the top of the target page and the keyboard show / hide operation indicates that the Android soft keyboard is hidden, the target direction is upward.
[0106] It is understandable that in the above optional implementation methods, when the Android soft keyboard is displayed at the top of the page, once the Android soft keyboard is hidden, the page content components of the target page will move upward with the Android soft keyboard to reduce the white space of the display area of the page content components, allowing users to browse more page content (i.e., the message list).
[0107] In some optional implementations of this embodiment, when the Android soft keyboard is displayed at the top of the target page and the keyboard show / hide operation indicates that the Android soft keyboard is displayed, the target direction is downward.
[0108] It is understandable that in the above optional implementation methods, when the Android soft keyboard is displayed at the top of the page, once the Android soft keyboard needs to be displayed, the page content components of the target page will move down with the Android soft keyboard to avoid the page content (i.e., the message list) being obscured by the Android soft keyboard.
[0109] Step 105: Show or hide the Android soft keyboard according to the keyboard show / hide operation instructions, and control the page content component to move the movement distance along the target direction.
[0110] In this embodiment, if the keyboard show / hide operation indicates that the Android soft keyboard is to be displayed, the Android soft keyboard can be displayed on the target page; if the keyboard show / hide operation indicates that the Android soft keyboard is to be hidden, the Android soft keyboard displayed on the target page can be hidden.
[0111] While showing or hiding the Android soft keyboard, the page content component can be controlled to move the movement distance along the target direction to avoid the Android soft keyboard obscuring the page content (i.e., the message list) when it is displayed, and to avoid the page content component having too much white space when the Android soft keyboard is hidden.
[0112] In the Compose framework, you can use `Modifier.padding` to set the inner padding of a component. By calling the `padding` method and passing in the corresponding padding value, you can add some space inside the component.
[0113] The padding method has various overloaded forms, allowing you to set inner margins on one, two, or four sides. In this embodiment, by setting the bottom of the padding to the aforementioned movement distance, you can control the page content to move along the target direction by that distance.
[0114] In some optional implementations of this embodiment, the keyboard show / hide operation triggered by the target page can be detected in the following way:
[0115] The keyboard show / hide operation triggered by the target page is detected by listening to the page content component of the target page.
[0116] In this method, the page content component is inherited (customized), and its width is set to 0 pixels, its height is set to Match_parent (the height of the Android device's display screen) to fill the entire screen, and its background color is transparent.
[0117] Based on this, the keyboard height of the Android soft keyboard, which is indicated by the keyboard show / hide operation, can be determined in the following way:
[0118] The keyboard height of the Android soft keyboard, which is indicated by the keyboard show / hide operation, is determined using the page content component.
[0119] Specifically, the keyboard height can be determined in the following way:
[0120] 1) Inherit the PopupWindow component to implement a custom popup;
[0121] 2) Set the initial value of the width of the pop-up component to 0 pixels, and the initial value of the height to the height of the screen used to display the target page (Match_parent) in pixels. Set the background color of the pop-up component to transparent. Here, Match_parent means that the height fills the entire screen to determine the change of the Android soft keyboard in the height direction.
[0122] 3) Create an object that implements the global layout listener (OnGlobalLayoutListener) interface and call the initialization function (addOnGlobalLayoutListener) of the pop-up component to set the layout callback listener for the pop-up component;
[0123] 4) When the input box is detected to have focus and the global layout of the pop-up component is completed (after being drawn by the Android UI system), obtain the initial height value and the instantaneous height value of the pop-up component to determine whether the soft keyboard is displayed (if the instantaneous height value of the pop-up component is inconsistent with the initial height value, it is determined that the pop-up component is squeezed by the soft keyboard, and the soft keyboard is displayed; if the instantaneous height value of the pop-up component is consistent with the initial height value, it is determined that the pop-up component is not squeezed, and the soft keyboard is not displayed).
[0124] 5) When the global layout (same as global drawing) of the pop-up component is completed, call the function to get the window's visible display frame (getWindowVisibleDisplayFrame). The size and position information (boundary coordinates) of the viewable area of the pop-up component are obtained through the function to get the window's visible display frame. The size and position information of the viewable area are then filled into the rectangle property (Rect). The height value in the rectangle property is the remaining height value of the pop-up component.
[0125] 6) When the global layout of the pop-up component is completed, the callback function (onGlobalLayout) is triggered. The height value in the rectangle attribute is obtained by using the callback function. Then, the pixel difference between the original height value of the pop-up component (the height value of the screen calculated by Android screen) and the remaining height value of the pop-up component (the pop-up component after being squeezed by the soft keyboard) is calculated.
[0126] 7) If the pixel difference is greater than one-quarter of the screen height, the pixel difference is determined as the soft keyboard display and the pixel difference is used as the height value of the soft keyboard.
[0127] Furthermore, after obtaining the height value of the soft keyboard, when the emoticon page needs to be displayed, the height of the emoticon page (the default height when the page is opened is 0) is set to the above height value; when the function page needs to be displayed, the height of the function page (the default height when the page is opened is 0) is set to the above height value.
[0128] Furthermore, add a whitespace layer to the page content component, setting its height to the pixel difference. Place this whitespace layer at the bottom of the page content component. Then, set the bottom padding value of the content content component's padding property to the pixel difference. Finally, move the page content component upwards by the pixel difference.
[0129] In some cases, where the soft keyboard display is certain, a whitespace layer (same as the whitespace layer) can be added to the page content component layer. The width of the whitespace layer is the same as the width of the page content component layer, and the height of the whitespace layer is the same as the height of the soft keyboard. The whitespace layer is located at the bottom of the page content component layer and is not used to display any information content (referring to the chat message list).
[0130] It's important to note that the whitespace layer is there to allow the page content components to scroll up; without it, the corresponding function or effect will not be achieved. Specifically, without the whitespace layer, the chat list will not scroll up; the whitespace layer acts as support for the page content. Furthermore, the whitespace layer is added based on pixel differences only when the soft keyboard, emoji page, or function page appears. If the soft keyboard, emoji page, or function page does not appear, the whitespace layer's height is 0. Setting the bottom padding value (contentPaddingBottom) of the page content's content padding property to the soft keyboard's height will scroll the whitespace layer in the target direction by the soft keyboard's height. Before adding the whitespace layer, it's also necessary to compare whether the height of the displayed information list in the page content component is greater than the difference between the full screen height and the soft keyboard's height. If it's greater than this difference, the whitespace layer is set; if it's less, it's not needed.
[0131] It is understandable that, among the above optional implementation methods, a page content component with a width of 0 pixels can be used to listen for the triggering of keyboard show / hide operations.
[0132] In some optional implementations of this embodiment, the target page displays controls for triggering the display or hiding of the emoji page, and the target page also displays controls for triggering the display or hiding of the function page.
[0133] As an example, the emoticon page can be used to implement at least one of the following functions: emoticon input, emoticon collection, selfie emoticons, etc. The function page can be used to implement at least one of the following functions: album browsing, taking photos, recording videos, voice calls, video calls, money transfers, location services, voice input, page content collection, etc.
[0134] Based on this, after determining the keyboard height of the Android soft keyboard that the keyboard show / hide operation indicator displays or hides, the following steps can also be performed:
[0135] The first step involves detecting an emoji page display operation triggered by the target page, determining the target height (i.e., pixel difference) of the Android soft keyboard on the target page as the display height of the emoji page. The emoji page is then moved by the pixel difference, wherein the emoji page covers the Android soft keyboard.
[0136] The above display height refers to the height of the currently displayed emoji page.
[0137] The target height refers to the keyboard height when the Android soft keyboard is fully displayed on the target page.
[0138] In practice, the target height corresponding to the screen width of the device where the target page is located can be determined based on a preset correspondence table.
[0139] The above correspondence table represents the relationship between screen width and target height.
[0140] The second step is to show or hide the emoticon page according to the specified display height.
[0141] In some cases, the emoji page can be located below the display area of the Android soft keyboard on the target page.
[0142] It is understandable that in the above optional implementation methods, if the target page needs to switch from displaying the Android soft keyboard to displaying the emoji page, the hierarchical relationship between the emoji page and the Android soft keyboard will be adjusted so that the Android soft keyboard is located below the display area of the emoji page on the target page.
[0143] In addition, after determining the keyboard height of the Android soft keyboard that the keyboard show / hide operation indicator displays or hides, the following steps can also be performed:
[0144] The first step involves detecting a function page display operation triggered by the target page, determining the target height (i.e., pixel difference) of the Android soft keyboard on the target page as the display height of the function page. The function page is then controlled to move by the pixel difference, wherein the function page covers the Android soft keyboard.
[0145] The display height mentioned above refers to the height of the currently displayed function page.
[0146] The target height refers to the keyboard height when the Android soft keyboard is fully displayed on the target page.
[0147] In practice, the target height corresponding to the screen width of the device where the target page is located can be determined based on a preset correspondence table.
[0148] The above correspondence table represents the relationship between screen width and target height.
[0149] The second step is to show or hide the function page according to the specified display height.
[0150] In some cases, the function page can be located below the display area of the Android soft keyboard on the target page.
[0151] It is understandable that in the above optional implementation methods, if the target page needs to switch from displaying the Android soft keyboard to displaying the function page, the hierarchical relationship between the function page and the Android soft keyboard will be adjusted so that the Android soft keyboard is located below the display area of the function page in the target page.
[0152] In some optional implementations of this embodiment, the page content component can be controlled to move the movement distance along the target direction in the following manner:
[0153] If the white space height of the message list is less than the movement distance, control the page content component to move the movement distance along the target direction.
[0154] Here, the white space height of the message list is less than the movement distance, meaning the message list contains a lot of content. Typically, when the Android soft keyboard is displayed at the bottom of the target page, each message in the message list (e.g., text, images, etc.) can be arranged from the top to the bottom of the Android device according to the order of sending time. In this case, the white space of the message list can be located at a relatively low position on the target page. When the Android soft keyboard is displayed at the top of the target page, the message list (e.g., text, images, etc.) can be arranged from the bottom to the top of the Android device. In this case, the white space of the Android device can be located at a relatively high position on the target page.
[0155] It is understandable that, among the above optional implementation methods, the message list can be controlled to move with the Android soft keyboard only when there is a lot of content in the message list. When there is a small number of messages in the message list, since the Android soft keyboard generally does not obscure the messages in the message list, it is not necessary to control the message list to move with the Android soft keyboard.
[0156] In some optional implementations of this embodiment, before detecting the keyboard show / hide operation triggered by the target page, the response of the Android system's soft keyboard pop-up can also be turned off.
[0157] In one embodiment of this application, the specific method for controlling the disabling of the Android system's soft keyboard pop-up response can be to disable the "android:windowSoftInputMode" configuration item in the Android application's configuration file (AndroidManifest.xml). In related technologies, the "android:windowSoftInputMode" configuration item causes the entire page content to be pushed beyond the top of the Android device when the soft keyboard is displayed, potentially making the information on the page invisible to the user.
[0158] Here, in Compose, you can use the `docker-compose down` command to shut down system responsiveness. This command stops and removes all services and related resources defined by the Compose file, including containers, networks, etc. After executing the `docker-compose down` command, Compose can stop containers sequentially according to service dependencies and clean up related resources.
[0159] Disabling keyboard pushing in the registry can be achieved by modifying a registry key.
[0160] As an example, you can turn off keyboard push by following these steps:
[0161] 1. Open the Registry Editor: In the Windows operating system, you can press Win+R keys, type "regedit" and press Enter to open the Registry Editor.
[0162] 2. Navigate to the relevant key: In the Registry Editor, navigate to the following path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout.
[0163] 3. Create a new binary value: In the right pane, right-click in a blank area and select "New" -> "Binary Value".
[0164] 4. Name the binary value: Name the newly created binary value "Scancode Map".
[0165] 5. Modify the binary value data: Double-click the "Scancode Map" binary value. In the pop-up editing window, enter the following data: 00 00 00 00 00 00 00 00 02 00 00 00 00 00 52E0 00 00 00 00. "52E0" in the above data is the scan code of the keyboard key to be disabled. In practice, you can find the corresponding scan code and replace it according to the key that needs to be disabled.
[0166] 6. Save and close the Registry Editor: After completing the data entry, click the "OK" button to save the changes and close the Registry Editor.
[0167] 7. Restart for the changes to take effect.
[0168] It is understandable that, among the above optional implementation methods, by controlling the system response to close and / or disabling keyboard push in the registry, it is possible to further ensure that the page content components move with the Android soft keyboard.
[0169] In practice, when users use instant messaging and conferencing software on Android phones, clicking the input box will display a soft keyboard interface and shrink the chat box (corresponding page content component) interface. To address this, this application embodiment utilizes the Compose framework to ensure that the soft keyboard interface and input box do not obscure the latest chat history; it also ensures that the emoticon page and input box do not obscure the latest chat history; and it further ensures that the function page and input box do not obscure the latest chat history.
[0170] For example, see Figure 3A , Figure 3A The target page shown includes page content (i.e., chat history) and an input box. When the user clicks the input box and gains focus through it, as shown... Figure 3B As shown, the Android soft keyboard will be displayed on the target page, and the chat content will move up. When the user clicks on other parts of the target page (excluding the input field), if the keyboard show / hide operation indicator is detected as hidden, the Android soft keyboard will be hidden on the target page, and the chat content will move down (fall back). When the user performs a trigger operation on the emoji page, if the Android device can detect the above trigger operation, such as... Figure 3C As shown, the emoji page can be displayed on the target page. When the user performs a triggering action on the function page, the Android device can detect the aforementioned triggering action, such as... Figure 3D As shown, the function page can be displayed on the target page. Figure 3C In the text, the emoji page is used to input emojis, etc. Figure 3D In the middle, the function pages are used for taking photos, browsing albums, video calls, and voice calls, etc.
[0171] In some cases, the implementation of the above steps in this embodiment can be achieved without relying on the XML schema, and can be completely replaced by the Compose schema instead of the XML schema.
[0172] Furthermore, regardless of whether the Android device (i.e., the entity executing the above method) is placed horizontally and displays page content horizontally, or placed vertically and displays page content vertically, the display orientation of page content, soft keyboard, etc. can be smoothly switched.
[0173] The page interaction method based on the Compos framework provided in this application embodiment can detect keyboard show / hide operations triggered by a target page. The keyboard show / hide operation instructs the display or hiding of an Android soft keyboard on the target page. Upon detecting the keyboard show / hide operation, the method determines the keyboard height of the Android soft keyboard to be displayed or hidden. Then, based on the keyboard height, it determines the movement distance of the page content component displayed on the target page, wherein the movement distance is greater than or equal to the keyboard height. Subsequently, it determines a target direction matching the keyboard show / hide operation, wherein the target direction represents the movement direction of the page content component. Finally, it displays or hides the Android soft keyboard according to the instruction of the keyboard show / hide operation and controls the page content component to move the movement distance along the target direction. Therefore, by controlling the movement of page content components along a direction matching the keyboard's display / hide operation when the Android soft keyboard is shown or hidden, the obstruction of page content (i.e., the message list) when the Android soft keyboard is displayed can be avoided, as well as the excessive white space in the page content when the Android soft keyboard is hidden. This improves the compatibility between page content components in pages using the Compos framework and the display method of the Android soft keyboard.
[0174] Figure 2 This is a flowchart illustrating another page interaction method based on the Compos framework provided in an embodiment of this application. Figure 2 As shown, the method specifically includes:
[0175] Step 201: Detect keyboard show / hide operations triggered by the target page, wherein the keyboard show / hide operations indicate that the Android soft keyboard is shown or hidden on the target page.
[0176] In this embodiment, step 201 and Figure 1 Step 101 in the corresponding embodiment is basically the same, and will not be repeated here.
[0177] Step 202: If the keyboard show / hide operation is detected, determine the keyboard height of the Android soft keyboard that the keyboard show / hide operation indicates to show or hide.
[0178] In this embodiment, step 202 and Figure 1 Step 102 in the corresponding embodiment is basically the same, and will not be repeated here.
[0179] Step 203: Determine the target duration between the trigger time of the keyboard show / hide operation and the current time.
[0180] In this embodiment, the target duration can represent the time period between the trigger time of the keyboard show / hide operation and the current time.
[0181] Step 204: Based on the target duration and the keyboard show / hide operation, determine the keyboard height of the Android soft keyboard that the keyboard show / hide operation indicates to show or hide, wherein the movement distance is greater than or equal to the keyboard height.
[0182] In this embodiment, the real-time keyboard height can be determined based on different target durations and keyboard show / hide operations, meaning that the keyboard height changes accordingly with the value of the time period.
[0183] In some optional implementations of this embodiment, the keyboard height of the Android soft keyboard, which is indicated to be displayed or hidden by the keyboard display / hide operation, can be determined based on the target duration and the keyboard display / hide operation:
[0184] When the Android soft keyboard is displayed by the keyboard show / hide operation indicator, it is determined that the keyboard height of the Android soft keyboard displayed by the keyboard show / hide operation indicator is positively correlated with the target duration in the first time period.
[0185] The first time period refers to the time period during which the Android soft keyboard changes from being completely hidden to being fully displayed.
[0186] When the Android soft keyboard is completely hidden, its keyboard height can be determined to be 0% of the target height. When the Android soft keyboard is fully displayed, its keyboard height can be determined to be 100% of the target height.
[0187] As an example, the first time period from when the Android soft keyboard is completely hidden to when it is fully displayed can include multiple time points. Each time point can correspond to frame 0, frame 1, frame 2, frame 3, ... frame n in the process of the Android soft keyboard going from hidden to displayed. Therefore, the keyboard height during the above first time period can be: 0% of the target height, 10% of the target height, 20% of the target height, 30% of the target height, ... 100% of the target height.
[0188] When the keyboard show / hide operation indicates that the Android soft keyboard is hidden, it is determined that the keyboard height of the Android soft keyboard hidden by the keyboard show / hide operation is negatively correlated with the target duration in a second time period, wherein the second time period represents the time period from when the Android soft keyboard is fully displayed to when it is fully hidden.
[0189] When the Android soft keyboard is completely hidden, its keyboard height can be determined to be 0% of the target height. When the Android soft keyboard is fully displayed, its keyboard height can be determined to be 100% of the target height.
[0190] As an example, the second time period from when the Android soft keyboard is fully displayed to when it is fully hidden can include multiple time points. Each time point can correspond to frame 0, frame 1, frame 2, frame 3, ... frame n in the process of the Android soft keyboard going from display to hiding. Therefore, the keyboard height during the above second time period can be: 100% of the target height, 90% of the target height, 80% of the target height, 70% of the target height, ... 0% of the target height.
[0191] Here, animations (such as gradient animations) can be used to control the display or hiding of the Android soft keyboard, emoji page, and function page. A horizontal interpolation mechanism is set to control the smooth display and collapse of the pages. The pages include the Android soft keyboard, emoji page, and function page. For example, when the user clicks the emoji page display control, the currently displayed soft keyboard or function page collapses or is placed at the bottom, controlling the emoji page to display smoothly. When the user clicks the function page display control, the currently displayed soft keyboard or emoji page collapses or is placed at the bottom, controlling the function page to display smoothly. Here, "smooth" is relative to "jumping"; the height is divided into multiple height value slices, so that moving frame by frame achieves a smooth gradient effect.
[0192] In addition, the smooth appearance and smooth disappearance of the soft keyboard, emoji page, and function page means that when the soft keyboard, emoji page, and function page appear smoothly, the page content of the target page can scroll upwards smoothly, with a following display effect. After scrolling upwards, the latest information of the page content can be displayed above the soft keyboard, emoji page, and function interface without being obscured.
[0193] It is understandable that in the above-mentioned optional implementation methods, since the keyboard height is positively or negatively correlated with the target duration, the Android soft keyboard can be gradually shown or hidden. For example, when the keyboard show / hide operation indicates that the Android soft keyboard is shown, since the keyboard height is positively correlated with the target duration, after triggering the keyboard show / hide operation indicating that the Android soft keyboard is shown, the target duration will gradually increase over time, and the keyboard height will increase accordingly (positive correlation), thereby achieving the effect of gradually showing the Android soft keyboard. When the keyboard show / hide operation indicates that the Android soft keyboard is hidden, since the keyboard height is negatively correlated with the target duration, after triggering the keyboard show / hide operation indicating that the Android soft keyboard is hidden, the target duration will gradually increase over time, and the keyboard height will decrease accordingly (negative correlation), thereby achieving the effect of gradually hiding the Android soft keyboard.
[0194] Step 205: Determine the target direction that matches the keyboard show / hide operation, wherein the target direction represents the movement direction of the page content component.
[0195] In this embodiment, step 205 and Figure 1 Step 104 in the corresponding embodiment is basically the same, and will not be repeated here.
[0196] Step 206: Show or hide the Android soft keyboard according to the keyboard show / hide operation instructions, and control the page content component to move the movement distance along the target direction.
[0197] In this embodiment, step 206 and Figure 1 Step 105 in the corresponding embodiment is basically the same, and will not be repeated here.
[0198] It should be noted that, in addition to the contents described above, this embodiment may also include... Figure 1 The corresponding technical features described in the corresponding embodiments, thereby achieving Figure 1 The technical effects of the page interaction method based on the Composer framework shown are illustrated in the image. Please refer to [link / reference]. Figure 1 The relevant descriptions are presented concisely and will not be elaborated upon here.
[0199] The page interaction method based on the Compos framework provided in this application embodiment can determine the keyboard height of the Android soft keyboard to be displayed or hidden by the keyboard display or hiding operation based on the target duration between the trigger time of the keyboard display or hiding operation and the current time, thereby enabling the Android soft keyboard to be gradually displayed or gradually hidden.
[0200] Figure 4 This is a schematic diagram of a page interaction device based on the Compos framework, provided as an embodiment of this application. Specifically, it includes:
[0201] The detection unit 401 is used to detect keyboard show / hide operations triggered by the target page, wherein the keyboard show / hide operation indicates that the Android soft keyboard is shown or hidden on the target page.
[0202] The first determining unit 402 is used to determine the keyboard height of the Android soft keyboard that is indicated to be displayed or hidden when the keyboard display operation is detected.
[0203] The second determining unit 403 is used to determine the movement distance of the page content component displayed on the target page based on the keyboard height, wherein the movement distance is greater than or equal to the keyboard height;
[0204] The third determining unit 404 is used to determine a target direction that matches the keyboard show / hide operation, wherein the target direction represents the movement direction of the page content component;
[0205] The control unit 405 is used to show or hide the Android soft keyboard according to the keyboard show / hide operation instructions, and to control the page content component to move the movement distance along the target direction.
[0206] In one possible implementation,
[0207] When the Android soft keyboard is displayed at the bottom of the target page, and the keyboard show / hide operation indicator displays the Android soft keyboard, the target direction is upward.
[0208] When the Android soft keyboard is displayed in the lower middle part of the target page, and the keyboard show / hide operation indicates that the Android soft keyboard is hidden, the target direction is downward.
[0209] In one possible implementation, determining the keyboard height of the Android soft keyboard, which is indicated by the keyboard show / hide operation, includes:
[0210] Determine the target duration between the trigger time of the keyboard show / hide operation and the current time;
[0211] Based on the target duration and the keyboard show / hide operation, determine the keyboard height of the Android soft keyboard that the keyboard show / hide operation indicates to show or hide.
[0212] In one possible implementation, determining the keyboard height of the Android soft keyboard, which the keyboard display / hides as indicated by the keyboard display / hides operation, based on the target duration and the keyboard display / hides operation includes:
[0213] When the Android soft keyboard is displayed by the keyboard show / hide operation indicator, it is determined that the keyboard height of the Android soft keyboard displayed by the keyboard show / hide operation indicator is positively correlated with the target duration in a first time period, wherein the first time period represents the time period during which the Android soft keyboard is completely hidden to fully displayed.
[0214] When the keyboard show / hide operation indicates that the Android soft keyboard is hidden, it is determined that the keyboard height of the Android soft keyboard hidden by the keyboard show / hide operation is negatively correlated with the target duration in the second time period, wherein the second time period represents the time period from when the Android soft keyboard is fully displayed to when it is fully hidden.
[0215] In one possible implementation, detecting the keyboard show / hide operation triggered by the target page includes:
[0216] The keyboard show / hide operation triggered by the target page is detected by listening to the keyboard show / hide operation on the target page's page content component, wherein the width of the page content component is 0 pixels; and
[0217] Determining the keyboard height of the Android soft keyboard, which is indicated by the keyboard show / hide operation, includes:
[0218] The keyboard height of the Android soft keyboard, which is indicated by the keyboard show / hide operation, is determined using the page content component.
[0219] In one possible implementation, detecting the keyboard show / hide operation triggered by the target page includes:
[0220] If the target input field on the target page is detected to have gained focus, it is determined that a keyboard show / hide operation indicating the display of the Android soft keyboard on the target page has been detected.
[0221] In one possible implementation, the target page displays controls for triggering the display or hiding of emoji pages, and the target page also displays controls for triggering the display or hiding of function pages.
[0222] After determining the keyboard height of the Android soft keyboard to which the keyboard show / hide operation indicator is displayed or hidden, the device further includes:
[0223] The fourth determining unit (not shown in the figure) is used to determine the target height of the Android soft keyboard on the target page as the display height of the emoji page when a trigger operation on the emoji page is detected.
[0224] The first display / hide unit (not shown in the figure) is used to display or hide the emoticon page according to the display height.
[0225] The fifth determining unit (not shown in the figure) is used to determine the target height of the Android soft keyboard on the target page as the display height of the function page when a trigger operation on the function page is detected.
[0226] The second display / hide unit (not shown in the figure) is used to display or hide the function page according to the display height.
[0227] In one possible implementation, controlling the page content component to move the movement distance along the target direction includes:
[0228] If the white space height of the page content is less than the moving distance, control the page content component to move the moving distance along the target direction.
[0229] In one possible implementation, prior to detecting the keyboard show / hide operation triggered by the target page, the device further includes:
[0230] Controls disable the Android system's response to the soft keyboard pop-up.
[0231] The page interaction device based on the Compos framework provided in this embodiment can be as follows: Figure 4 The page interaction device based on the Compos framework shown can execute all the steps of the page interaction methods based on the Compos framework described above, thereby achieving the technical effects of the page interaction methods based on the Compos framework described above. For details, please refer to the relevant descriptions above. For the sake of brevity, it will not be elaborated here.
[0232] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 5 The illustrated electronic device 500 includes at least one processor 501, a memory 502, at least one network interface 504, and other user interfaces 503. The various components in the electronic device 500 are coupled together via a bus system 505. It is understood that the bus system 505 is used to implement communication between these components. In addition to a data bus, the bus system 505 also includes a power bus, a control bus, and a status signal bus. However, for clarity, ... Figure 5 The general designated all buses as Bus System 505.
[0233] The user interface 503 may include a display, keyboard, or clicking device (e.g., mouse, trackball, touchpad, or touchscreen).
[0234] It is understood that the memory 502 in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The memory 502 described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0235] In some implementations, memory 502 stores elements, executable units or data structures, or subsets thereof, or extended sets thereof: operating system 5021 and application program 5022.
[0236] The operating system 5021 includes various system programs, such as the framework layer, core library layer, and driver layer, used to implement various basic business functions and handle hardware-based tasks. The application program 5022 includes various applications, such as a media player and a browser, used to implement various application functions. Programs implementing the methods of this application embodiment can be included in application program 5022.
[0237] In this embodiment, the processor 501 executes the method steps provided in each method embodiment by calling the program or instructions stored in the memory 502, specifically the program or instructions stored in the application program 5022.
[0238] The methods disclosed in the embodiments of this application can be applied to or implemented by processor 501. Processor 501 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in processor 501 or by instructions in the form of software. The processor 501 may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software units in the decoding processor. The software units may be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 502. Processor 501 reads the information in memory 502 and, in conjunction with its hardware, completes the steps of the above method.
[0239] It is understood that the embodiments described herein can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described above in this application, or combinations thereof.
[0240] For software implementation, the techniques described herein can be implemented by units that perform the functions described above. The software code can be stored in memory and executed by a processor. The memory can be implemented within the processor or external to the processor.
[0241] The electronic device provided in this embodiment may be as follows: Figure 5 The electronic device shown can execute all the steps of the page interaction methods based on the Compos framework described above, thereby achieving the technical effects of the page interaction methods based on the Compos framework described above. For details, please refer to the relevant descriptions above. For the sake of brevity, it will not be elaborated here.
[0242] This application also provides a storage medium (computer-readable storage medium). This storage medium stores one or more programs. The storage medium may include volatile memory, such as random access memory; it may also include non-volatile memory, such as read-only memory, flash memory, hard disk, or solid-state drive; and it may also include combinations of the above types of memory.
[0243] When one or more programs in the storage medium can be executed by one or more processors to implement the page interaction method based on the Compos framework that is executed on the electronic device side.
[0244] The processor described above is used to execute a page interaction program based on the Compos framework stored in memory to implement the following steps of the page interaction method based on the Compos framework executed on the electronic device side.
[0245] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0246] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented in hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0247] It should be understood that the terminology used herein is for the purpose of describing particular exemplary embodiments only and is not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms “a,” “an,” and “described” as used herein may also include the plural forms. The terms “comprising,” “including,” “containing,” and “having” are inclusive and therefore indicate the presence of the stated features, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, elements, components, and / or combinations thereof. The method steps, processes, and operations described herein are not construed as requiring them to be performed in a particular order described or illustrated unless the order of performance is explicitly indicated. It should also be understood that additional or alternative steps may be used.
[0248] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A page interaction method based on a compose framework, characterized in that, The method includes: Detect keyboard show / hide operations triggered by a target page, wherein the keyboard show / hide operation indicates that the Android soft keyboard is shown or hidden on the target page; If the keyboard show / hide operation is detected, determine the keyboard height of the Android soft keyboard that the keyboard show / hide operation indicates to be shown or hidden; Based on the keyboard height, the movement distance of the page content components displayed on the target page is determined, wherein the movement distance is greater than or equal to the keyboard height; Determine a target direction that matches the keyboard show / hide operation, wherein the target direction represents the movement direction of the page content component; The Android soft keyboard is shown or hidden according to the keyboard show / hide operation instructions, and the page content components are controlled to move the movement distance along the target direction. Create an object that implements the global layout listener interface, call the initialization function of the page content component, and set the layout callback listener for the page content component; Upon detecting the keyboard show / hide operation and listening to the completion of the global rendering of the page content component, compare the initial height of the page content component with the instantaneous height of the page content component; If the initial height and the instantaneous height are inconsistent, the keyboard show / hide operation indicator is determined to display the Android soft keyboard, and the target direction is upward; the function to obtain the visible display frame of the window is called to obtain the size and position information of the viewable area of the page content component; the size and position information are filled into the rectangle attribute of the callback function; the callback function is called to obtain the height parameter of the rectangle attribute, and the height parameter is determined as the instantaneous height; the initial height is obtained; the pixel difference between the initial height and the instantaneous height is calculated, and the pixel difference is determined as the keyboard height of the Android soft keyboard.
2. The method of claim 1, wherein, The method further includes: When the initial height and the instantaneous height are the same, it is determined that the keyboard show / hide operation instruction hides the Android soft keyboard, and the target direction is downward.
3. The method of claim 1, wherein, The method further includes: Determine the target duration between the trigger time of the keyboard show / hide operation and the current time; When the Android soft keyboard is displayed by the keyboard show / hide operation indicator, it is determined that the keyboard height of the Android soft keyboard displayed by the keyboard show / hide operation indicator is positively correlated with the target duration in a first time period, wherein the first time period represents the time period during which the Android soft keyboard changes from being completely hidden to being fully displayed. When the keyboard show / hide operation indicates that the Android soft keyboard is hidden, it is determined that the keyboard height of the Android soft keyboard hidden by the keyboard show / hide operation is negatively correlated with the target duration in a second time period, wherein the second time period represents the time period from when the Android soft keyboard is fully displayed to when it is fully hidden.
4. The method of claim 1, wherein, The method further includes: Set a white space layer for the page content component, and set the height of the white space layer to the pixel difference; Place the white space layer at the bottom of the page content component; The bottom inner margin value of the content inner margin attribute of the page content component is set to the pixel difference value. Control the page content component to move upward by the pixel difference.
5. The method according to claim 1, characterized in that, The method further includes: Detect the emoji page display operation triggered by the target page; The height of the emoji page is set to the pixel difference, and the emoji page is controlled to move by the pixel difference, wherein the emoji page covers the Android soft keyboard.
6. The method according to claim 1, characterized in that, The method further includes: Detect the display operation of the function page triggered by the target page; The height of the function page is set to the pixel difference, and the function page is controlled to move by the pixel difference, wherein the function page covers the Android soft keyboard.
7. The method according to claim 5 or 6, characterized in that, The method further includes: Set a horizontal interpolator to control the page to display and collapse smoothly.
8. The method according to claim 1, characterized in that, Before detecting the keyboard show / hide operation triggered by the target page, the method further includes: Controls disable the Android system's response to the soft keyboard pop-up.
9. A page interaction device based on the Compos framework, characterized in that, The device includes: A detection unit is used to detect keyboard show / hide operations triggered by a target page, wherein the keyboard show / hide operation indicates that the Android soft keyboard is shown or hidden on the target page. The first determining unit is configured to determine the keyboard height of the Android soft keyboard that is indicated to be displayed or hidden when the keyboard display operation is detected. The second determining unit is used to determine the movement distance of the page content component displayed on the target page based on the keyboard height, wherein the movement distance is greater than or equal to the keyboard height; The third determining unit is used to determine a target direction that matches the keyboard show / hide operation, wherein the target direction represents the movement direction of the page content component; The control unit is used to show or hide the Android soft keyboard according to the keyboard show / hide operation instructions, and to control the page content component to move the movement distance along the target direction; The first determining unit is further configured to create an object that implements the global layout listener interface, call the initialization function of the page content component, and set the layout callback listener for the page content component; Upon detecting the keyboard show / hide operation and listening to the completion of the global rendering of the page content component, compare the initial height of the page content component with the instantaneous height of the page content component; If the initial height and the instantaneous height are inconsistent, the keyboard show / hide operation indicator is determined to display the Android soft keyboard, and the target direction is upward; the function to obtain the visible display frame of the window is called to obtain the size and position information of the viewable area of the page content component; the size and position information are filled into the rectangle attribute of the callback function; the callback function is called to obtain the height parameter of the rectangle attribute, and the height parameter is determined as the instantaneous height; the initial height is obtained; the pixel difference between the initial height and the instantaneous height is calculated, and the pixel difference is determined as the keyboard height of the Android soft keyboard.
10. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor is configured to execute a computer program stored in the memory, wherein when the computer program is executed, it implements the page interaction method based on the Compos framework as described in any one of claims 1-8.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the page interaction method based on the Compos framework as described in any one of claims 1-8.