Control method of control, electronic equipment and computer readable medium
By hiding the soft keyboard first and then hiding the dialog control in the display state of the soft keyboard in the dialog control, the problem of displaying or hiding exceptions during user interaction is solved, and the user experience is improved.
Patent Information
- Application Number
- CN202311240652.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-22
- Publication Date
- 2025-03-25
AI Technical Summary
When the mobile phone is in the lock screen, home screen, application and other interfaces, when the user interacts with the soft input method, it may affect the normal display or hiddenness of the soft input method, resulting in poor user experience.
When the soft keyboard corresponding to the edit box control in the dialog box control is in the display state, execute the preset callback function corresponding to the user action message, first control the soft keyboard to hide, and then control the dialog box control to hide according to the dialog box control hidden function.
By hiding the soft keyboard first and then hiding the dialog box controls, the flash problem caused by the soft keyboard losing focus when hiding is avoided, and the user experience is improved.
Smart Images

Figure CN119690532A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of terminal technology, and in particular to a control method of a control, an electronic device, and a computer-readable medium. Background Art
[0002] Currently, when the phone is in the lock screen, home screen, application and other interfaces, if the user interacts with the soft input method, in some special scenarios it will affect the normal display or hiding of the soft input method, thereby affecting the user experience.
[0003] For example, in a special scenario where a user opens a dialog box with an edit box, if the screen is quickly closed and the screen is brightened, the dialog box will disappear and the soft input method will not have time to hide. At this time, when the phone is unlocked again, a brief soft input method hiding animation will be seen. If the button of the dialog box or the area outside the dialog box is clicked, the dialog box will be hidden, but the soft input method will lose focus when the dialog box is hidden and cannot be hidden normally. When the dialog box is opened again, the soft input method will flash, giving the user a bad user experience. Summary of the invention
[0004] The present disclosure aims to solve at least one of the technical problems existing in the prior art, and proposes a control method of a control, an electronic device and a computer-readable medium.
[0005] To achieve the above objectives, in a first aspect, an embodiment of the present disclosure provides a control method of a control, including:
[0006] When the soft keyboard corresponding to the edit box control in the dialog control is in a displayed state, executing a preset callback function corresponding to a user action message to control the hiding of the soft keyboard; the user action message represents an action performed by the user on the interface where the dialog control is located;
[0007] According to the dialog control hiding function, the dialog control is controlled to be hidden.
[0008] In a second aspect, an embodiment of the present disclosure further provides an electronic device, including:
[0009] one or more processors;
[0010] A memory having one or more programs stored thereon, when the one or more programs are executed by the one or more processors, the one or more processors implement the control method of the control as described in the above embodiment.
[0011] In a third aspect, the embodiments of the present disclosure further provide a computer-readable medium on which a computer program is stored, and when the program is executed by a processor, the control method of the control component as described in the above embodiments is implemented.
[0012] The present disclosure has the following beneficial effects:
[0013] The embodiments of the present disclosure provide a control method, an electronic device, and a computer-readable medium. When a soft keyboard corresponding to an edit box control in a dialog box control is in a displayed state, when a user performs an action on an interface where the dialog box control is located, the soft keyboard is first controlled to be hidden, and then the dialog box control is controlled to be hidden. This avoids the situation in which the soft keyboard flashes when the dialog box is opened again because the soft keyboard is not hidden normally, so that there is no abnormality in the visual perception of the interface, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 A schematic diagram of the hardware structure of a mobile terminal provided in an embodiment of the present disclosure;
[0015] Figure 2 A flowchart of a control method of a control provided by an embodiment of the present disclosure;
[0016] Figure 3 This is a flowchart of a specific implementation method of step S0 in the embodiment of the present disclosure;
[0017] Figure 4 This is a flow chart of a specific implementation method of step S1 in the embodiment of the present disclosure;
[0018] Figure 5 This is another specific implementation method flow chart of step S1 in the embodiment of the present disclosure;
[0019] Figure 6 A flowchart of hiding a soft keyboard and a dialog box control in an embodiment of the present disclosure;
[0020] Figure 7 A schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure;
[0021] Figure 8 A schematic diagram of the structure of a computer-readable medium provided in an embodiment of the present disclosure;
[0022] Fig. 9 A flowchart of executing a preset callback function corresponding to a first user action message provided in an embodiment of the present disclosure;
[0023] Fig.10 A flowchart of a method for controlling a control corresponding to a first user action message provided by an embodiment of the present disclosure;
[0024] Fig.11 A flowchart of executing a preset callback function corresponding to a second user action message provided in an embodiment of the present disclosure;
[0025] Fig.12A flowchart of executing a preset callback function corresponding to a third user action message provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the technical solution of the present disclosure, the control method of the control provided by the present disclosure, the electronic device and the computer-readable medium are described in detail below with reference to the accompanying drawings.
[0027] Example embodiments will be described more fully below with reference to the accompanying drawings, but the example embodiments may be embodied in different forms and should not be construed as limited to the embodiments set forth herein. On the contrary, the purpose of providing these embodiments is to make the present disclosure thorough and complete and to enable those skilled in the art to fully understand the scope of the present disclosure.
[0028] In the absence of conflict, the various embodiments of the present disclosure and the various features therein may be combined with each other.
[0029] As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.
[0030] The terms used herein are only used to describe specific embodiments and are not intended to limit the present disclosure. As used herein, the singular forms "a", "an" and "the" are also intended to include the plural forms, unless the context clearly indicates otherwise. It will also be understood that when the terms "comprising" and / or "made of" are used in this specification, the presence of the features, wholes, steps, operations, elements and / or components is specified, but the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof is not excluded.
[0031] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by those of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and the present disclosure, and will not be interpreted as having an idealized or overly formal meaning unless explicitly defined as such herein.
[0032] To further illustrate the control method of the control in the embodiment of the present disclosure, the electronic device and the computer-readable medium, the application scenarios of the control method of the control in the embodiment of the present disclosure, the electronic device and the computer-readable medium are described below:
[0033] In some embodiments, the control method of the control in the embodiments of the present disclosure is applied to a terminal, which can be executed in a mobile terminal, a tablet computer, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 is a schematic diagram of the hardware structure of a mobile terminal provided according to an embodiment of the present disclosure, such as Figure 1 As shown, the mobile terminal in the embodiment of the present disclosure includes:
[0034] The terminal in the embodiment of the present disclosure may be executed in a mobile terminal, a tablet computer, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 A schematic diagram of the hardware structure of a mobile terminal provided in an embodiment of the present disclosure is shown in FIG. Figure 1 As shown, the mobile terminal in the embodiment of the present disclosure includes:
[0035] RF unit 001, memory 002, WIFI module 003, power supply 004, processor 005, sensor 006, interface unit 007, audio output unit 008, display unit 009, input unit 010, A / V input unit 011 and other components. It should be noted that: Figure 1 The mobile terminal structure shown in the figure does not constitute a limitation on the mobile terminal, and the mobile terminal may include Figure 1 More or fewer components, or combinations of certain components, or different component arrangements are shown. The specific introduction of the above components is as follows:
[0036] The radio frequency unit 001 is used for receiving and sending information or receiving and sending signals during a call. Specifically, the radio frequency unit 001 can send uplink information to the base station, or after receiving downlink information sent by the base station, send it to the processor 005 of the mobile terminal for processing; the downlink information sent by the base station to the radio frequency unit 001 can be generated according to the uplink information sent by the radio frequency unit 001, or it can be actively pushed to the radio frequency unit 001 after detecting that the information of the mobile terminal is updated. For example, after detecting that the geographical location of the mobile terminal has changed, the base station can send a message notification of the geographical location change to the radio frequency unit 001 of the mobile terminal. After receiving the message notification, the radio frequency unit 001 can send the message notification to the processor 005 of the mobile terminal for processing, and the processor 005 of the mobile terminal can control the message notification to be displayed on the flexible display panel 009a of the mobile terminal. Generally speaking, the radio frequency unit 001 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, etc. In addition, the radio frequency unit 001 can also communicate with the network and other devices through wireless communication, which may specifically include: communicating with a server in the network system through wireless communication. For example, the mobile terminal can download file resources from the server through wireless communication, such as downloading applications from the server. After the mobile terminal completes downloading an application, if the file resources corresponding to the application in the server are updated, the server can push a resource update message notification to the mobile terminal through wireless communication to remind the user to update the application. The above-mentioned wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access 2000 (CDMA2000), Wideband Code Division Multiple Access WCDMA (Wideband Code Division Multiple Access, WCDMA), Time Division-Synchronous Code Division Multiple Access (TD-SCDMA), Frequency Division Duplexing-Long Term Evolution (FDD-LTE) and Time Division Duplexing-Long Term Evolution (TDD-LTE), etc.
[0037] The memory 002 is used to store software programs and various data. Specifically, the memory 002 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, at least one application required for a function, etc.; the data storage area may store data created according to the use of the mobile phone, etc. In addition, the memory 002 may include a high-speed random access memory, and may also include a non-volatile memory, for example, at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0038] The WIFI module 003 is used to provide wireless broadband Internet access. Specifically, WIFI is a short-range wireless transmission technology. The mobile terminal can access the network through the WIFI module 003 to enable users to send and receive emails, browse web pages, and access streaming media.
[0039] The power supply 004 is used to supply power to the mobile terminal. Specifically, the power supply 004 is logically connected to the processor 005 through a power management system, so that the power management system can manage charging, discharging, power consumption and other functions.
[0040] The processor 005 constitutes the control center of the mobile terminal, and uses various interfaces and lines to connect various parts of the entire mobile terminal. By running or executing the software programs and / or modules stored in the memory 002, and calling the data stored in the memory 002, the processor 005 performs various functions of the mobile terminal and processes data, thereby monitoring the mobile terminal as a whole. For example, the processor 005 can execute the control method of the control in the embodiment of the present disclosure. Specifically, the processor 005 may include one or more processing units; in addition, the processor 005 may also integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface and application programs, etc., and the modem processor mainly processes wireless communications. It can be understood that the above-mentioned modem processor may not be integrated in the processor 005.
[0041] Sensor 006, for example, light sensor, motion sensor and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 009a according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 009a or the backlight when the mobile terminal is moved to the ear. The motion sensor may include an accelerometer sensor, which can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary, and can be used for applications that identify the posture of the mobile terminal (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc. It should be noted that the mobile terminal can also be used in Figure 1On the basis shown in , other sensors such as gravity sensor, fingerprint sensor, pressure sensor, iris sensor, molecular sensor, gyroscope, barometer, hygrometer, thermometer, infrared sensor, etc. are configured, but the embodiments of the present disclosure are not limited to this.
[0042] The interface unit 007 is used to receive input (e.g., data information, power, etc.) from an external device and transmit the received input to one or more elements of the mobile terminal or can be used to transmit data between the mobile terminal and the external device. Specifically, the interface unit 007 includes at least one interface through which an external device can be connected to the mobile terminal, for example, the external device can include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, an audio input / output (I / O) port, a video I / O port, a headphone port, and the like.
[0043] The audio output unit 008 is used to convert the audio data received by the RF unit 001 or the WIFI module 003 or stored in the memory 002 into an audio signal and output it as sound when the mobile terminal is in a call signal receiving mode, a talk mode, a recording mode, a voice recognition mode, a broadcast receiving mode, etc. At the same time, the audio output unit 008 can also provide audio output related to a specific function performed by the mobile terminal (for example, a call signal receiving sound, a message receiving sound, etc.). The audio output unit 008 may include a speaker, a buzzer, etc.
[0044] The display unit 009 is used to display information input by the user or information provided to the user. Specifically, the display unit 009 may include a display panel 009a, and the display panel 009a may be a panel of different types, structures or materials, such as an active matrix organic light-emitting diode (AMOLED) or a passive organic electroluminescent diode (Passivematrix OLED).
[0045] The user input unit 010 is used to receive input digital or character information, and to generate key signal input related to the user settings and function control of the mobile terminal. Specifically, the user input unit 010 may include a touch panel 010a and other input devices 010b. The touch panel 010a, also known as a touch screen, can collect the user's touch operations on or near it, and drive the corresponding connection device according to a pre-set program. The touch panel 010a may include two parts: a touch detection device and a touch controller; wherein the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, and converts it into the touch point coordinates to send to the processor 005, and can receive and execute the command sent by the processor 005. In addition, the touch panel 010a can be implemented in various types such as resistive, capacitive, infrared and surface acoustic wave. In addition to the touch panel 010a, the user input unit 010 may also include other input devices 010b, which may include but are not limited to one or more of a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.), a trackball, a mouse, a joystick, etc., and the embodiments of the present disclosure are not limited to this.
[0046] A / V input unit 011 is used to receive audio or video signals. A / V input unit 011 may include microphone 011a, image processor (Graphics Processing Unit, GPU) 011b, image capture device. Image processor 011b processes the image data of static pictures or videos obtained by image capture device 011c (such as front camera, rear camera, etc.) in video capture mode or image capture mode. The processed image frame can be displayed on display unit 009. The image frame processed by image processor 011b can be stored in memory 002 or sent via radio frequency unit 001 or WIFI module 003. Microphone 011a can receive audio data via microphone 011a in operating modes such as telephone call mode, recording mode, voice recognition mode, etc., and can process such sound into audio data. The processed audio data can be converted into a format output that can be sent to a mobile communication base station via radio frequency unit 001 in the case of telephone call mode. Microphone 011a may implement various types of noise cancellation or suppression algorithms to cancel or suppress noise or interference generated during the process of receiving and transmitting audio signals.
[0047] It should be noted that Figure 1 The processor 005 in the terminal shown can implement the control method of the control in the embodiment of the present disclosure. The control method of the control in the embodiment of the present disclosure, the electronic device and the computer readable medium are described below:
[0048] Figure 2 A flowchart of a control method of a control provided by an embodiment of the present disclosure. Figure 2 , the present disclosure provides a control method of a control, including:
[0049] S1. When a soft keyboard corresponding to an edit box control in a dialog control is in a displayed state, executing a preset callback function corresponding to a user action message to control hiding of the soft keyboard; the user action message represents an action performed by a user on the interface where the dialog control is located;
[0050] S2. According to the dialog control hiding function, control the dialog control to hide.
[0051] In an embodiment of the present disclosure, the visual effect of the state change of the control in the interface is presented by animation. In some embodiments, the display of the soft keyboard is performed by a "pop-up" animation, and the hiding of the soft keyboard is performed by a "retract" animation. The animation of the state change of the control requires a certain duration to be displayed in the interface. When the soft keyboard corresponding to the edit box control in the dialog control is in a displayed state, when the action performed by the user on the interface where the dialog control is located is too close to the operation of showing and hiding the soft keyboard, the action performed by the user on the interface where the dialog control is located will be performed earlier than the soft keyboard in time to complete the display and hiding operation. However, since the hiding of the soft keyboard requires obtaining the focus (WindowToken) in the corresponding edit box control, the preset callback function corresponding to the user action message is executed to control the soft keyboard to hide, and then the dialog control hiding function in the preset callback function is called back to control the dialog control to hide. In this way, the hiding execution process of the soft keyboard is performed earlier than the dialog control, avoiding obtaining an empty WindowToken when hiding the soft keyboard, and preventing the flashing of the soft input method displayed in the interface after the dialog control is pulled up again, thereby improving the user experience.
[0052] In addition, it is worth noting that the embodiments of the present disclosure can be applied to the terminal in the lock screen state, the main screen state after the terminal is unlocked, the terminal opening application and other interfaces, which need to interact with the soft input method. In some embodiments, when the terminal is in the lock screen state, by first hiding the soft keyboard and then hiding the dialog box control, the flashing of the soft keyboard can be effectively prevented after the terminal is unlocked again.
[0053] In some embodiments, the interface may be a graphical user interface (GUI), which refers to a computer operation user interface displayed in a graphical manner. In the embodiments of the present disclosure, the mobile operating system used by the terminal is not particularly limited, and may be an Android operating system.
[0054] In the embodiment of the present disclosure, a dialog control, an edit box control and a soft keyboard (SoftInput) are provided in the interface, but it is not limited thereto and other controls may also be included. Among them, the dialog control is used to display information to the user or collect information from the user. In the embodiment of the present disclosure, there is no special limitation on the controls contained in the dialog control, and the dialog control may be provided with a button control, an edit box control, etc. In some embodiments, the dialog control may obtain the user's decision information through the button control. In other embodiments, the dialog control may obtain the user's input information through the edit box control. The edit box control may be used for the user to input, edit or modify text information. The soft keyboard may also be referred to as a soft input method, which is a virtual keyboard displayed in the interface and may be used to input characters according to the user's touch or click on the corresponding position of the interface. In the embodiment of the present disclosure, there is no special limitation on the use environment of the soft keyboard, and it may be used on a terminal interface of a touch screen or on other terminal interfaces without a physical keyboard environment. The button control is used to provide decision options to the user. In some embodiments, at least one button control corresponding to different decision information may be provided in the dialog control, and the decision made by the user in the current dialog control may be determined according to the user's click or selection.
[0055] In some embodiments, the user action message includes:
[0056] A first user action message, wherein the first user action message indicates that the action performed by the user on the interface where the dialog control is located is: clicking on an outer area of the dialog control in the interface;
[0057] Or, a second user action message, wherein the second user action message indicates that the action performed by the user on the interface where the dialog control is located is: turning off the screen of the interface;
[0058] Alternatively, a third user action message, wherein the third user action message indicates that the action performed by the user on the interface where the dialog control is located is: clicking an internal area of the dialog control in the interface.
[0059] In an embodiment of the present disclosure, a user action message indicates an action performed by a user on an interface in a current state, and the current state is that the soft keyboard corresponding to the edit box control in the dialog control is in a display state. Among them, the first user action message refers to a user clicking on the outer area of the dialog control in the interface. In the original control method of the control, clicking on the outer area of the dialog control in the current state will directly control the dialog control to hide, resulting in the soft keyboard being unable to obtain focus and unable to hide normally. When the dialog control is pulled up again or the terminal interface is unlocked again, a flashing situation will occur. The second user action message refers to the user turning off the screen of the interface, and the third user action message refers to the user clicking on the inner area of the dialog control in the interface. After the terminal interface is turned off or the inner area of the dialog control in the interface is clicked, the dialog control is hidden, and the soft keyboard loses focus, resulting in an abnormality, so that when the dialog control is pulled up again or the terminal interface is unlocked again, the interface will show a flashing soft keyboard. Among them, the terminal interface turning off the screen refers to the interface (such as a screen) of the terminal (such as a computer, a mobile phone, etc.) being turned off or entering a standby state. In this state, no content is displayed on the interface until the user restarts the operation (such as touching the screen, pressing a button or moving the mouse), and the interface lights up again to display the content. In addition, turning off the screen can also be referred to as screen extinguishing, screen off, black screen, screen off, etc., and the present disclosure is not limited thereto. Operations indicating that the interface is closed or enters a standby state can be actions performed by the user on the interface where the dialog control is located as represented by the second user action message. In addition, the flashing of the soft keyboard refers to a short hidden animation of the soft keyboard presented on the interface. In some embodiments, clicking on the inner area of the dialog control in the interface can be clicking on at least one button control in the dialog control.
[0060] It is worth noting that the user action message is not limited thereto, and may be a user action message indicating that other actions performed on the interface in the current state will cause the soft keyboard to flash.
[0061] In some embodiments, before S1, the method further includes:
[0062] S0. Obtain at least one user action message.
[0063] In this embodiment, the user action message is an interactive action performed by the user on the terminal interface. The disclosure does not specifically limit the interactive action, which may be a trigger event (e.g., click, drag, scroll, etc.), a state change (e.g., click a button to change the state from "on" to "off", etc.), input data (e.g., input text information in a form or edit box control), etc.
[0064] Accordingly, Figure 3 is a flowchart of a specific implementation method of step S0 in the embodiment of the present disclosure. Figure 3, when the user action message is a first user action message, S0, comprises:
[0065] S01. According to the preset callback function, determining whether the action performed by the user on the interface is a click action and whether the click position corresponding to the click action is within a preset area in the interface; the outer area of the dialog control in the interface includes the preset area;
[0066] S02: When the action performed by the user on the interface is a click action and a click position corresponding to the click action is within a preset area in the interface, obtaining the first user action message.
[0067] In an embodiment of the present disclosure, the first user action message is a click on the outer area of the dialog control in the interface. After clicking on the outer area of the dialog control in the interface, the dialog control is usually hidden directly, so the timing of hiding the soft keyboard cannot be determined. Therefore, the preset callback function of the interface is used to determine whether the action performed by the user on the interface is a click action, and the click position corresponding to the click action is within the preset area in the interface, and the first user action message is obtained. The preset area can be any area in the outer area of the dialog control in the interface. In some embodiments, when the user action message is the first user action message, the preset callback function is a touch function used to determine whether the action of "clicking the outer area of the dialog box" has been executed. The touch function is used to determine: whether the action performed by the user on the interface is a click action, and whether the click position corresponding to the click action is within the preset area in the interface.
[0068] Figure 4 is a flowchart of a specific implementation method of step S1 in the embodiment of the present disclosure. Figure 4 , S1 includes:
[0069] S11, obtaining a soft input method management object corresponding to the soft keyboard and an edit box element corresponding to the edit box control;
[0070] S12, judging whether the soft input method management object and the edit box element satisfy a first preset condition; if the soft input method management object and the edit box element satisfy the first preset condition, controlling the soft keyboard to be hidden through the soft input method management object according to a focus parameter of the edit box control.
[0071] In this embodiment, when the user action message is the first user action message, the preset callback function is a touch function. During the callback process of the touch function, step S1 is executed when it is determined that the action performed by the user on the interface is a click action and the click position corresponding to the click action is within the preset area in the interface. When the user action message is the second user action message, the preset callback function is a screen-off function. By monitoring the screen-on and screen-off status of the interface by the system, during the callback process of the screen-off function, step S1 is executed when it is determined that the user turns off the screen on the interface. When the user action message is the third user action message, the preset callback function is a click function. When it is determined that the user clicks on the interface, step S1 is executed.
[0072] The soft input method management object corresponding to the soft keyboard and the edit box element corresponding to the edit box control are obtained. When the soft input method management object and the edit box control meet the first preset condition, the soft keyboard obtains the focus parameter of the edit box control and controls the hiding of the soft keyboard through the soft input method management object.
[0073] Accordingly, in some embodiments, S12 includes:
[0074] Determine whether the soft input method management object is not empty and whether the edit box element is not empty; wherein, the soft input method management object is not empty, indicating that the soft input method management object is in a normal operating state, and the edit box element is not empty, indicating that the edit box control is provided in the dialog control.
[0075] In this embodiment, judging whether the soft input method management object is not empty is used to determine whether the soft input method manager object can be used normally. In some embodiments, when the soft input method management object is not empty, the soft input method management object can be used normally, and when it is empty, it cannot be used normally. Judging whether the edit box element is not empty is used to determine whether there is an edit box control in the dialog control. In some other embodiments, when the edit box element is not empty, it is determined that there is an edit box control in the dialog control, and when it is empty, it is determined that there is no edit box control in the dialog control.
[0076] Figure 5 This is another specific implementation method flow chart of step S1 in the embodiment of the present disclosure. Figure 5 After determining whether the soft input method management object and the edit box element meet the first preset condition, S1 further includes:
[0077] S13, obtaining dialog parameters of the dialog control;
[0078] S14, determining whether the dialog parameter satisfies a second preset condition; if the dialog parameter satisfies the second preset condition, calling a dialog control hiding function of the dialog control to control hiding of the dialog control.
[0079] In the embodiment of the present disclosure, after determining whether the soft input method management object and the edit box element meet the first preset condition, whether the soft keyboard is controlled to be hidden (indicating that the soft keyboard does not exist in the current interface) when the first preset condition is met, or the soft keyboard is not controlled to be hidden (indicating that the current terminal cannot hide the soft keyboard) when the soft input method management object and the edit box element do not meet the first preset condition, the steps of obtaining the dialog parameter of the dialog control, calling the dialog control hiding function of the dialog control when the dialog parameter meets the second preset condition, and controlling the dialog control to be hidden are performed. By first obtaining the focus of the edit box control to hide the soft keyboard, or after confirming that the soft keyboard cannot be hidden, the dialog control is hidden, which effectively solves the problem that the soft keyboard is forced to lose focus due to the dialog control being hidden first, so that the soft keyboard cannot be hidden normally.
[0080] Accordingly, in some embodiments, S14 includes:
[0081] Determine whether the dialog parameter is not empty; wherein, the dialog parameter being not empty indicates that the dialog control is in a display state.
[0082] In an embodiment of the present disclosure, a dialog parameter is used to determine whether a dialog control is in a display state or a hidden state in an interface. In some embodiments, a dialog parameter that is not empty indicates that the dialog control is in a display state in the interface, and a dialog parameter that is empty indicates that the dialog control is in a hidden state. It is worth noting that the state of a dialog control in an interface can also be measured by other parameters or methods, and the present disclosure is not limited thereto.
[0083] In one example, Figure 6 This is a flowchart of hiding the soft keyboard and dialog box controls in the embodiment of the present disclosure, refer to Figure 6 , first hide the soft keyboard, then hide the dialog controls including:
[0084] Step 601, when the soft keyboard corresponding to the edit box control in the dialog control is in the display state, determine whether the current soft input method manager object is not empty, and determine whether the edit box element is not empty. If both the soft input method manager object and the edit box element are not empty, execute step 602, otherwise execute 603.
[0085] Among them, the executable code corresponding to step 601 is: "mInputMethodManager!=null&&mDialogField!=null". The interpretation of this code is to perform two non-null checks, "mInputMethodManager" represents the soft input method manager object, "mDialogField" represents the edit box element, "null" represents null, "mInputMethodManager!=null" represents checking whether the soft input method manager object is not null, "mDialogField!=null" represents checking whether the edit box element is not null, and "&&" represents and, that is, when the soft input method manager object is not null and the edit box element is not null, the judgment result is yes, and step 602 is executed, otherwise step 603 is executed.
[0086] Step 602: Call a soft keyboard hiding function (the main parameter is the focus of the edit box) through the soft input method manager object to hide the soft keyboard.
[0087] Among them, the executable code corresponding to step 602 is: "mInputMethodManager.hideSoftInputFromWindow(mDialogField.getWindowToken().0)", wherein "mInputMethodManager" represents the soft input method manager object, "mDialogField" is the field corresponding to the dialog box control, "hideSoftInputFromWindow" is a function of the soft input method manager object, which requires the focus "WindowToken" to determine the window of the soft keyboard to be hidden, "mDialogField.getWindowToken()" means getting the focus in the dialog box control, and "0" means that no additional flag is set, that is, through the function corresponding to the soft input method manager object, the focus is determined in the dialog box control and the soft keyboard is hidden.
[0088] Step 603, determine whether the dialog box is not empty and is being displayed. If it is not empty and is being displayed, execute step 604, otherwise end.
[0089] The executable code corresponding to step 603 is: "mDialog! = null && mDialog.is.Showing()", where "mDialog" is an instance of the dialog control "Dialog", "is.Showing()" is a function of the dialog control, which is used to check whether the dialog control is in the display state, and "null" means null. If "mDialog" is not null and is being displayed, the judgment result is true, that is, T (yes), and step 704 is executed; if "mDialog" is null or not in the display state, the judgment result is false, that is, F (no), and the process ends.
[0090] Step 604, calling the dialog control hiding function of the dialog control to hide the dialog control, and ending.
[0091] Among them, the executable code corresponding to step 604 is: "mDialog.dismiss()", where "mDialog" is an instance of the dialog control "Dialog", and "dismiss()" is the dialog control hidden function of the dialog control "Dialog", which is used to close or dismiss the dialog control. When "dismiss()" is called, the dialog box will be closed and any resources associated with it will be released.
[0092] Through the above process, when the soft keyboard corresponding to the edit box control in the dialog control is in the displayed state, when the user performs an action on the interface where the dialog control is located, the soft keyboard is first controlled to be hidden, and then the dialog control is controlled to be hidden, thereby avoiding the situation in which the soft keyboard flashes when the dialog box is pulled up again because the soft keyboard is not hidden normally, so that there is no abnormality in the visual perception of the interface, thereby improving the user experience.
[0093] Figure 7 A schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. Figure 7 , an embodiment of the present disclosure provides an electronic device, comprising:
[0094] One or more processors 701;
[0095] A memory 702, on which one or more programs are stored. When the one or more programs are executed by one or more processors, the one or more processors implement any of the above control methods of the control;
[0096] One or more I / O interfaces 703 are connected between the processor and the memory and are configured to implement information exchange between the processor and the memory.
[0097] Among them, the processor 701 is a device with data processing capabilities, including but not limited to a central processing unit (CPU); the memory 702 is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory (FLASH); the I / O interface (read-write interface) 703 is connected between the processor 701 and the memory 702, and can realize information interaction between the processor 701 and the memory 702, including but not limited to a data bus (Bus), etc.
[0098] In some embodiments, the processor 701 , the memory 702 , and the I / O interface 703 are connected to each other via a bus 704 , and further connected to other components of the computing device.
[0099] Figure 8 A schematic diagram of a computer-readable medium provided in an embodiment of the present disclosure. Figure 8 The embodiment of the present disclosure provides a computer-readable medium on which a computer program is stored. When the program is executed by a processor, the control method of any of the above-mentioned controls is implemented.
[0100] In order to enable those skilled in the art to more clearly understand the technical solutions provided by the embodiments of the present disclosure, the technical solutions provided by the embodiments of the present disclosure are described in detail below through specific embodiments:
[0101] Embodiment 1:
[0102] Fig. 9 A flowchart of executing a preset callback function corresponding to a third user action message provided in an embodiment of the present disclosure, referring to Fig. 9 , the terminal is a mobile phone. When the user pulls up a dialog control in the lock screen state, the home screen state after the terminal is unlocked, the terminal opens an application, and the like, and there is an edit box control in the dialog control, the focus of the edit box control is obtained, and the soft keyboard corresponding to the focus is pulled up.
[0103] In a comparative example, when the user clicks on the outer area of the dialog control in the terminal interface, according to the framework code analysis before the solution, after the user clicks on the outer area of the dialog control in the terminal interface, the dialog control hiding function onDismiss will be directly called back, so it is impossible to introduce a control method that hides the soft keyboard first and then hides the dialog control.
[0104] In one example, Fig.10 A flowchart of a control method corresponding to a first user action message provided in an embodiment of the present disclosure, referring to Fig.10, when the user clicks the outer area of the dialog control in the terminal interface, in order to avoid the flashing problem of the soft keyboard, the soft keyboard is hidden first, and then the dialog control is hidden, including:
[0105] Step 1001, rewrite the touch function onTouch of the window Window, and use the touch function to determine whether the action on the current interface is that the user presses and then lifts the interface and whether the click area is outside the dialog control area. If the determination result is yes, execute step 1002, otherwise end.
[0106] Among them, the executable code corresponding to step 1001 is: "event.getAction==Motion.ACTION_UP&&event.getY()<-20" wherein "event" is a touch screen event, "getAction()" is a function of a touch screen event, used to return a constant describing the touch action and detect whether it is pressed, and "getY()" is another function of a touch screen event, returning the coordinate of the touch event on the Y-axis (vertical direction) of the interface.
[0107] If the touch action is that the pressed part leaves the screen, and the Y coordinate of the touch event is less than -20, then the judgment result is "true", that is, yes, and continue to execute 1002. If the touch action is not that the pressed part leaves the screen, or the Y coordinate of the touch event is not less than -20, then the judgment result is "false", that is, no, and end.
[0108] Step 1002, determine whether the current action is the pressed part pressed up (event, getAction() == MotionEvent.ACTION_UP) and whether the click area is outside the dialog box (event.getY() <-20). If both are true, execute the following steps: Figure 6 The control method of hiding the soft keyboard first and then hiding the dialog box control is shown.
[0109] It can be seen that without setting the touch function, it is impossible to introduce a control method of hiding the soft keyboard first and then hiding the dialog control. By hiding the soft keyboard first and then hiding the dialog control before calling back the dialog control hide function, the problem of the soft keyboard flashing caused by clicking the external area of the dialog control when the soft keyboard corresponding to the edit box control in the dialog control is in the displayed state can be effectively improved, thereby optimizing the user experience.
[0110] Embodiment 2: Fig.11 A flowchart of a preset callback function corresponding to a second user action message provided in an embodiment of the present disclosure is provided, referring to Fig.11, the terminal is a mobile phone. When the user pulls up a dialog control in the lock screen state, the home screen state after the terminal is unlocked, the terminal opens an application, and the like, and there is an edit box control in the dialog control, the focus of the edit box control is obtained, and the soft keyboard corresponding to the focus is pulled up.
[0111] In another comparison example, when the user turns off the terminal screen, the dialog control hide function of the dialog control will be called back, losing focus, resulting in an abnormal hiding of the soft keyboard (ie, getWindowToken() = null), so that when the phone is unlocked again, a short hiding animation of the soft keyboard can be seen.
[0112] In another embodiment, the system monitors the screen status and calls back the screen-off function onGoToSleep when the screen is turned off. In this function, the soft keyboard is hidden first and then the dialog control, that is, the soft input method is hidden before the dialog control disappears, thereby avoiding a brief hiding animation of the soft keyboard when entering the desktop.
[0113] It can be seen that by hiding the soft keyboard first and then hiding the dialog control in the callback screen-off function onGoToSleep, the problem of soft keyboard flashing caused by screen-off when the soft keyboard corresponding to the edit box control in the dialog control is in the displayed state can be effectively improved, thereby optimizing the user experience.
[0114] Embodiment three: Fig.12 A flowchart of executing a preset callback function corresponding to a third user action message provided in an embodiment of the present disclosure, referring to Fig.12 , the terminal is a mobile phone. When the user pulls up a dialog control in the lock screen state, the home screen state after the terminal is unlocked, the terminal opens an application, and the like, and there is an edit box control in the dialog control, the focus of the edit box control is obtained, and the soft keyboard corresponding to the focus is pulled up.
[0115] In another comparative example, when the user clicks a button control in the dialog control, the dialog control is hidden, and the dialog control hiding function onDismiss of the hiding listener setOnDismissListner is automatically called back; if hiding the soft keyboard in the dialog control hiding function onDismiss is invalid, because when the dialog control hiding function onDismiss is triggered, the current window has lost the focus WindowToken of the edit box EditText, and hiding the soft keyboard requires passing the focus of the edit box EditText as a parameter, which leads to an abnormal hiding of the soft input method in the dialog control hiding function onDismiss, which directly leads to the flashing of the soft input method when the dialog box is pulled up again.
[0116] In another embodiment, clicking the dialog button will call back the dialog click function, and after execution, the dialog control hiding function of the dialog control will be called back; a control control function is added to the click function of the callback dialog box to make it possible to hide the soft keyboard first and then hide the dialog control, thereby avoiding a brief hiding animation of the soft keyboard when entering the desktop.
[0117] It can be seen that by hiding the soft keyboard first and then hiding the dialog control in the callback click function, the problem of soft keyboard flashing caused by clicking the internal area of the dialog control when the soft keyboard corresponding to the edit box control in the dialog control is in the displayed state can be effectively improved, thereby optimizing the user experience.
[0118] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those skilled in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0119] Example embodiments have been disclosed herein, and although specific terms are employed, they are used and should be interpreted only in a general illustrative sense and not for limiting purposes. In some instances, it will be apparent to those skilled in the art that, unless otherwise expressly noted, features, characteristics, and / or elements described in conjunction with a particular embodiment may be used alone or in combination with features, characteristics, and / or elements described in conjunction with other embodiments. Therefore, those skilled in the art will appreciate that various changes in form and detail may be made without departing from the scope of the present disclosure as set forth in the appended claims.
Claims
1. A control method for a control, comprising: When the soft keyboard corresponding to the edit box control in the dialog control is in a displayed state, executing a preset callback function corresponding to the user action message to control the soft keyboard to be hidden; The user action message represents the action performed by the user on the interface where the dialog control is located; According to the dialog control hiding function, the dialog control is controlled to be hidden.
2. The control method of the control according to claim 1, wherein: The user action message includes: A first user action message, wherein the first user action message indicates that the action performed by the user on the interface where the dialog control is located is: clicking on an outer area of the dialog control in the interface; Or, a second user action message, wherein the second user action message indicates that the action performed by the user on the interface where the dialog control is located is: turning off the screen of the interface; Alternatively, a third user action message, wherein the third user action message indicates that the action performed by the user on the interface where the dialog control is located is: clicking an internal area of the dialog control in the interface.
3. The control method of the control according to claim 2, wherein: Before executing the preset callback function corresponding to the user action message, it also includes: Get at least one user action message.
4. The control method of the control according to claim 3, wherein: In a case where the user action message is a first user action message, obtaining at least one user action message includes: According to the preset callback function, it is determined whether the action performed by the user on the interface is a click action and the click position corresponding to the click action is within a preset area in the interface; the outer area of the dialog control in the interface includes the preset area; In the case where the action performed by the user on the interface is a click action and the click position corresponding to the click action is within a preset area in the interface, the first user action message is obtained.
5. The control method of the control according to claim 1, wherein: Executing a preset callback function corresponding to the user action message to control the hiding of the soft keyboard includes: Obtaining a soft input method management object corresponding to the soft keyboard and an edit box element corresponding to the edit box control; Determine whether the soft input method management object and the edit box element meet a first preset condition; if the soft input method management object and the edit box element meet the first preset condition, control the soft keyboard to be hidden through the soft input method management object according to the focus parameter of the edit box control.
6. The control method of the control according to claim 5, wherein: Determining whether the soft input method management object and the edit box element meet a first preset condition includes: Determine whether the soft input method management object is not empty and whether the edit box element is not empty; wherein, the soft input method management object is not empty, indicating that the soft input method management object is in a normal operating state, and the edit box element is not empty, indicating that the edit box control is provided in the dialog control.
7. The control method of the control according to claim 5, wherein: After determining whether the soft input method management object and the edit box element meet the first preset condition, the method further includes: Get the dialog parameters of the dialog control; Determine whether the dialog parameter satisfies a second preset condition; if the dialog parameter satisfies the second preset condition, call the dialog control hiding function of the dialog control to control the dialog control to hide.
8. The control method of the control according to claim 7, wherein: Determining whether the dialog box parameters meet a second preset condition includes: Determine whether the dialog parameter is not empty; wherein, the dialog parameter being not empty indicates that the dialog control is in a display state.
9. An electronic device, comprising: one or more processors; A memory having one or more programs stored thereon, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the control method of the control according to any one of claims 1 to 8.
10. A computer-readable medium having a computer program stored thereon, wherein when the program is executed by a processor, the control method of the control according to any one of claims 1 to 8 is implemented.