Identification method and device for effective exposure of component content, electronic equipment and medium

By triggering the scroll event of the scroll view component after sliding input, and using the delay task of the onScrollChanged method to identify the visible state of the view content, the problem of inaccurate exposure effectiveness judgment during inertial sliding of the sliding component in the prior art is solved, and the accurate identification of the sliding effective exposure time is achieved.

CN120066658APending Publication Date: 2025-05-30BEIJING 58 INFORMATION TTECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510229558.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-27
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

When the prior art determines that the component content is effectively exposed, it is difficult to accurately identify the visible state of the sliding component during the inertial sliding after the finger is lifted, resulting in inaccurate judgment of exposure effectiveness.

Method used

By responding to the sliding input on the user's screen, the scroll event of the scroll view component is triggered and the onScrollChanged method is continuously called back, using the delayed task and the sliding effective exposure time, it identifies whether the view content in the scroll view component remains visible after the sliding is finished.

Benefits of technology

It realizes accurate identification of the effective exposure time of sliding, accurately judges the exposure effectiveness of component content, and solves the problem of wrong judgment when sliding is truly over.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120066658A_ABST
    Figure CN120066658A_ABST
Patent Text Reader

Abstract

The invention provides a component content effective exposure identification method and device, electronic equipment and a medium, and the method comprises the steps: responding to a sliding input of a user on a screen, and triggering a scrolling event of a scrolling view component; the method comprises the following steps: continuously callback monitoring the change of a rolling state and corresponding to an onScroll Changed method of a delay task, a first duration between the triggering time of the method and the triggering time of the delay task is a sliding effective exposure duration, and in the process of continuously callback the method for N times, the first N-1 delay tasks are limited to be executed; in response to the last callback of the method, determining that the scrolling event is ended; and when the delay task corresponding to the method is executed and the view content in the scroll view component is recognized to be in a visible state, determining that the view content is in an effective exposure state. According to the method and the device, the effective exposure duration of sliding can be used as a quantization parameter of sliding ending and effective exposure, and the exposure effectiveness can be accurately identified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular, to a method, device, electronic device, and medium for identifying effective exposure of component content. Background Art

[0002] A View is a core element of the Android UI (User Interface). It is responsible for drawing, layout, and event handling, and is the basis for building the Android application interface. View exposure means that a certain view is displayed on the user's screen, and effective exposure means that during the user's browsing process, the component content is completely displayed on the screen and stays for enough time for the user to have the opportunity to notice it and even possibly interact with it.

[0003] In the prior art, when judging effective exposure, it is necessary to calculate the duration of the visibility of the component content after the touch ends based on touch events (events generated when the user touches the View component on the device screen). The specific solution is as follows:

[0004] 1. Determine whether the component content is visible. If it is not visible, execute step 2; if it is visible, execute step 3.

[0005] 2. When the component content is not visible, register a touch listening event to monitor the change of the sliding gesture. When the sliding ends and the finger is lifted or the sliding is cancelled passively, if the component content changes from an invisible state to a visible state at this time, it means it has been exposed; otherwise, the content has not been exposed.

[0006] 3. If it changes to a visible state, create a timer task, set the timing duration parameter value to the effective exposure duration, and start timing.

[0007] 4. When the finger touches the screen again and starts sliding, if there was a previous timing task, cancel it.

[0008] 5. When the timer ends and the timer is not intercepted, execute the timer end task.

[0009] 6. The timer end task includes: determining whether the content of the current component is still in a visible state. If it is, it is recorded as effective exposure; otherwise, it is invalid exposure.

[0010] Through the above steps, it is relatively easy to perceive the change of the component content from an invisible state to a visible state, and to calculate the duration of the visible state. Finally, by judging this duration, it is possible to identify whether the exposure of the component content is effective. The above solution design is relatively traditional and can solve the problem of effective exposure in basic scenarios.

[0011] However, with in - depth exploration of the sliding component, a problem is found: after the finger is lifted, the sliding component usually has an inertial slide, and this inertial slide will continue for a short period of time. That is to say, when the finger is lifted, the slide does not end immediately. In this transitional scenario, the accuracy of using the above - mentioned solution to judge the visible state of the component content is not high, and it may even be completely wrong, which is a major defect of the existing solution. Summary of the Invention

[0012] In view of the above problems, embodiments of the present application provide a method, device, electronic device, and medium for identifying effective exposure of component content that overcomes the above problems or at least partially solves the above problems.

[0013] In a first aspect, an embodiment of the present application provides a method for identifying effective exposure of component content, including:

[0014] Responding to receiving a sliding input from a user on the screen, triggering a scrolling event of a scroll view component;

[0015] After triggering the scrolling event of the scroll view component, continuously calling back the onScrollChanged method for listening to changes in the scrolling state. The onScrollChanged method corresponds to a delayed task, and a first duration between the triggering time of the onScrollChanged method and the triggering time of the delayed task is the sliding effective exposure duration. During the continuous N - time callback of the onScrollChanged method, the first (N - 1) delayed tasks are restricted from execution, where N is greater than 1;

[0016] Responding to the last callback of the onScrollChanged method, determining the end of the scrolling event;

[0017] When executing the delayed task corresponding to the last onScrollChanged method callback and identifying that the view content in the scroll view component is in a visible state, determining that the view content in the scroll view component is in an effective exposure state.

[0018] In a second aspect, an embodiment of the present application provides a device for identifying effective exposure of component content, including:

[0019] A triggering module, configured to respond to receiving a sliding input from a user on the screen and trigger a scrolling event of a scroll view component;

[0020] A processing module, configured to continuously call back the onScrollChanged method for listening to the change of the scrolling state after triggering the scrolling event of the scrolling view component. The onScrollChanged method corresponds to a delayed task. The first duration between the triggering time of the onScrollChanged method and the triggering time of the delayed task is the effective exposure duration for sliding. During the continuous callback of the onScrollChanged method for N times, the first (N - 1) delayed tasks are restricted from execution, where N is greater than 1;

[0021] A first determination module, configured to determine the end of the scrolling event in response to the last callback of the onScrollChanged method;

[0022] A second determination module, configured to determine that the view content in the scrolling view component is in an effective exposure state when executing the delayed task corresponding to the last callback of the onScrollChanged method and identifying that the view content in the scrolling view component is in a visible state.

[0023] In a third aspect, an embodiment of the present application provides an electronic device, including a processor, a memory, and a computer program stored on the memory and executable on the processor. When the computer program is executed by the processor, the steps of the method for identifying the effective exposure of component content as described in the first aspect above are implemented.

[0024] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for identifying the effective exposure of component content as described in the first aspect above are implemented.

[0025] In the technical solution of the embodiment of the present application, when receiving a sliding input of a user on the screen, the scrolling event of the scrolling view component is triggered, and the onScrollChanged method for listening to the change of the scrolling state is continuously called back. In response to the last callback of the onScrollChanged method, the end of the scrolling event is determined. When executing the delayed task corresponding to the last method callback, it is identified whether the view content in the scrolling view component remains in a visible state. If the view content is in a visible state, it is determined that the display duration of the view content meets the effective exposure duration for sliding, and it is determined that the view content is in an effective exposure state. It is possible to use the effective exposure duration for sliding as a quantization parameter for the end of sliding and effective exposure, accurately identify the effectiveness of exposure, and solve the problem of misjudging the true end of sliding. Description of the Drawings

[0026] Figure 1Schematic diagram showing the method for identifying effective exposure of component content provided by an embodiment of the present application;

[0027] Figure 2 Overall implementation flowchart of the method for identifying effective exposure of component content provided by an embodiment of the present application;

[0028] Figure 3 Schematic diagram of the device for identifying effective exposure of component content provided by an embodiment of the present application;

[0029] Figure 4 Schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Detailed implementation manners

[0030] The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are some, but not all, of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without making creative efforts fall within the scope of protection of the present application.

[0031] It should be understood that the "one embodiment" or "an embodiment" mentioned throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of the present application. Therefore, the "in one embodiment" or "in an embodiment" that appears throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. The plurality in the embodiments of the present application can include two and more than two.

[0032] In various embodiments of the present application, it should be understood that the sequence numbers of the following processes do not mean the order of execution, and the execution order of each process should be determined according to its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.

[0033] An embodiment of the present application provides a method for identifying effective exposure of component content, as Figure 1 shown, the method includes the following steps:

[0034] Step 101, in response to receiving a sliding input from the user on the screen, trigger a scrolling event of the scroll view component.

[0035] The scroll view component is a component widely used in the GUI (Graphical User Interface). It allows users to view content that exceeds the current view range by scrolling. This component is an essential part of GUI design and provides a convenient way for users to view content that exceeds the current view range.

[0036] In the embodiments of the present application, it is necessary to monitor the sliding action of the user's finger on the device screen. When the sliding input of the user on the device screen is recognized, in response to this input, the scrolling event of the scroll view component is triggered. The scrolling event of the scroll view component refers to a series of events triggered when the user scrolls the view (triggered by the user's sliding gesture, rather than triggered by the scroll view itself). These events can be used to monitor the scrolling state, update the view content, implement lazy loading and other functions. The scrolling event includes different stages such as the start of scrolling, during scrolling, and end of scrolling, and these stages can be monitored and processed through corresponding event callbacks.

[0037] Step 102: After triggering the scrolling event of the scroll view component, continuously call back the onScrollChanged method for monitoring the change of the scrolling state. The onScrollChanged method corresponds to a delayed task. The first time period between the triggering time of the onScrollChanged method and the triggering time of the delayed task is the sliding effective exposure time period. During the continuous N times of calling back the onScrollChanged method, the first (N - 1) delayed tasks are restricted from execution, and the value of N is greater than 1.

[0038] After triggering the scrolling event of the scroll view component, in response to the occurrence of scrolling, continuously call back the onScrollChanged method for monitoring the change of the scrolling state. The onScrollChanged method is a method in the View class for monitoring the scrolling event of the view. When the view scrolls, this method will be triggered multiple times until the scrolling ends.

[0039] The onScrollChanged method corresponds to a delayed task. There is a time interval between the triggering time of the onScrollChanged method and the triggering time of the delayed task, that is, after the onScrollChanged method is triggered, the corresponding delayed task is executed after an interval of a time period. In the embodiments of the present application, during the continuous N times of calling back the onScrollChanged method, the first (N - 1) delayed tasks are all restricted from execution. For example, when the scrolling ends, the onScrollChanged method is called back a total of 7 times, and the delayed tasks corresponding to the first 6 times of calling back this method are all restricted from execution. And in the embodiments of the present application, the first time period between the triggering time of the onScrollChanged method and the triggering time of the delayed task is the sliding effective exposure time period, and the sliding effective exposure time period is the minimum time period corresponding to the effective exposure state. For example, if the sliding effective exposure time period is set to 5S, then the exposure time period greater than or equal to 5S belongs to the effective exposure state.

[0040] In the embodiments of the present application, it is necessary to preset the sliding effective exposure duration of the component content. This duration can be the default duration or can be changed according to requirements. After defining the minimum duration corresponding to the effective exposure state, the sliding effective exposure duration is determined as the first duration between triggering the onScrollChanged method and triggering the delayed task. After setting the first duration according to the sliding effective exposure duration, it is possible to identify whether the display duration of the view content meets the sliding effective exposure duration based on whether the delayed task corresponding to the last method callback is executed, and further identify whether the view content is in the effective exposure state.

[0041] Step 103: In response to the last callback of the onScrollChanged method, determine that the scrolling event ends.

[0042] When scrolling occurs, as the finger moves, the onScrollChanged method continuously calls back the offset and position of the component sliding, but does not inform when the sliding stops. It just stops calling back this method when the sliding actually ends. Therefore, when it is recognized that the onScrollChanged method is the last callback, it is determined that the scrolling event ends.

[0043] Step 104: When the delayed task corresponding to the last onScrollChanged method callback is executed and it is recognized that the view content in the scroll view component is in the visible state, determine that the view content in the scroll view component is in the effective exposure state.

[0044] When the scrolling ends, the view content in the scroll view component no longer changes, the onScrollChanged method is no longer called back, and the delayed task corresponding to the last onScrollChanged method callback is allowed to be executed. Since the first duration between the moment when the delayed task is triggered and the moment when the onScrollChanged method is triggered is set as the sliding effective exposure duration, it is possible to measure whether the exposure duration of the view content in the scroll view component meets the sliding effective exposure duration based on whether the delayed task corresponding to the last method callback is executed.

[0045] When the delayed task corresponding to the last onScrollChanged method callback is executed and it is recognized that the view content (the view content corresponding to the end of the scroll) in the scroll view component remains in the visible state, determine that the view content in the scroll view component is in the effective exposure state.

[0046] If the delayed task corresponding to the last method callback has not been executed yet, and at this time, a sliding input from the user on the screen is received, which causes a change in the view content in the scroll view component, then the exposure duration of the original view content is less than the first duration, and at this time, the original view content is not in a valid exposure state. If it is recognized that the view content (the view content corresponding to the end of the scroll) in the scroll view component is in an invisible state when the delayed task corresponding to the last method callback is executed, then it is determined that the exposure duration of the view content in the scroll view component does not meet the conditions and corresponds to an invalid exposure state.

[0047] In the above implementation of this application, when a sliding input from the user on the screen is received, a scroll event of the scroll view component is triggered, and the onScrollChanged method for listening to changes in the scroll state is continuously called back. In response to the last callback of the onScrollChanged method, it is determined that the scroll event ends. When executing the delayed task corresponding to the last method callback, it is recognized whether the view content in the scroll view component remains in a visible state. If the view content is in a visible state, it is determined that the display duration of the view content meets the sliding effective exposure duration, and it is determined that the view content is in a valid exposure state. It is possible to use the sliding effective exposure duration as a quantitative parameter for the end of the slide and valid exposure, accurately identify the exposure effectiveness, and solve the problem of misjudging the true end of the slide.

[0048] In the embodiment of this application, when the sliding input from the user on the screen stops, the scroll event remains triggered based on the sliding inertia, and the onScrollChanged method continues to be called; when the sliding inertia ends, the onScrollChanged method stops being called and the scroll event ends, and the time when the sliding inertia ends is the true stop time of the slide.

[0049] When the sliding input of the user's finger on the screen ends, based on the sliding inertia, the scroll event remains triggered, and the onScrollChanged method continues to be called. When the sliding inertia ends, this method stops being called, at which time the scroll event ends, and the time when the sliding inertia ends is the true stop time of the slide.

[0050] During this process, since it is considered that the scroll view component has inertial sliding after the user's finger is lifted, after the user's finger leaves the screen, the onScrollChanged method will continue to be called based on the scrolling of the scroll view component. By calling back the onScrollChanged method, the offset during the sliding process can be output, and the onScrollChanged method is continuously called back until the inertial sliding ends. When the inertial sliding ends, the onScrollChanged method is no longer called back, and the end of the inertial sliding means the end of the scroll event. Thus, the true end time of the scroll can be determined considering the transition scenario.

[0051] The following introduces the solution for continuously calling back the onScrollChanged method and identifying the end of the scroll event. During the process of continuously calling back the onScrollChanged method N times, the second time interval between two adjacent callbacks is less than the first time interval between triggering the onScrollChanged method and triggering the delayed task; in two adjacent callbacks, the delayed task corresponding to the previous callback of the onScrollChanged method is cancelled when the onScrollChanged method is called back the second time, so as to limit the execution of the delayed task.

[0052] When scrolling occurs, the onScrollChanged method for listening to the change of the scroll state needs to be continuously called back, and this method stops being called back when the scrolling ends. The time interval between two adjacent method callbacks is the second time interval, and the second time interval is usually a fixed time interval. The second time interval is less than the first time interval between triggering the onScrollChanged method and triggering the delayed task, and the value of the second time interval is relatively small, usually at the ms level. For two adjacent callbacks, when the method is called back the second time, since the triggering time of the delayed task corresponding to the previous method callback has not been reached, the delayed task corresponding to the previous callback of the onScrollChanged method is cancelled, so as to limit the execution of the previous delayed task. For the last method callback, since the onScrollChanged method will not be called back continuously after this, the delayed task corresponding to this method will not be cancelled, so the delayed task is allowed to execute.

[0053] Among them, in response to identifying that the delayed task corresponding to the onScrollChanged method is executed, it is determined that the onScrollChanged method is the last callback and the scroll event ends, and the true stop time of the sliding can be determined based on the difference between the execution time of the delayed task and the first time interval.

[0054] When the delayed task corresponding to a certain method callback is executed, it is determined that this method callback is the last method callback. Based on the last callback of the onScrollChanged method, the end of the scroll event can be determined. It should be noted that there is a deviation within the allowable error range between the triggering time of the last method callback and the actual end time of the scroll. Since the time interval between two adjacent method callbacks is at the millisecond level, the interval between the triggering time of the last method callback and the actual end time of the scroll is also at the millisecond level, and this interval can be ignored macroscopically. As an example, after a certain method callback and before the time point of the next method callback, the scroll actually ends. Since the onScrollChanged method will not be called back after the scroll ends, this method callback is the last method callback. Since the time interval between two adjacent method callbacks is at the millisecond level (e.g., 10 ms), the deviation between the time point of the last method callback and the time point of the actual end of the scroll can be ignored, and thus the end of the scroll event can be determined based on the last method callback.

[0055] Since the deviation between the triggering time of the last method callback and the actual end time of the scroll can be ignored, and the time interval between the triggering time of the onScrollChanged method and the triggering time of the delayed task is the first duration, when the delayed task is executed, the triggering time of the last method callback can be determined according to the difference between the execution time of the delayed task and the first duration, and then the actual end time of the scroll can be determined. The actual end time of the scroll is the time when the sliding actually stops and is also the time when the sliding inertia ends. That is, by using the successful execution of the delayed task in the last onScrollChanged method callback, the sliding stop timing can be accurately judged, and then based on the time parameters related to the delayed task, the actual sliding stop time can be accurately judged. Specifically: pushing forward a delay duration (the first duration) based on the execution time of the delayed task is the actual sliding stop time.

[0056] Furthermore, when approaching the end of the scroll, the scroll speed is getting smaller and smaller, and the scroll spacing will also become smaller and smaller as the scroll ends. Therefore, the total scroll distance corresponding to the last method callback is approximately the same as the total scroll distance corresponding to the actual end of the scroll, and the difference between the two can be ignored. That is, the total scroll distance corresponding to the last method callback can be regarded as the total scroll distance corresponding to the actual end of the scroll.

[0057] By setting the delayed task of the onScrollChanged method and the relationship between the first duration and the second duration, during the continuous callback of the onScrollChanged method, the previous delayed task can be cancelled based on the callback of the latter method. The last method callback can be identified based on the execution of the delayed task, and thus the end of the scroll event can be identified. When the delayed task is executed, the triggering time of the last method callback can be determined based on the difference between the execution time of the delayed task and the first duration. Therefore, based on the time parameters related to the delayed task, the true stop time of the sliding can be accurately judged.

[0058] In an optional embodiment of the present application, the method further includes:

[0059] Register a scroll listening event based on the viewTreeObserver property of the scroll view component;

[0060] Listen for the user's sliding input on the screen based on the scroll listening event.

[0061] ViewTreeObserver is a tool used to listen for changes in the view tree (ViewTree) in Android development. It allows developers to listen for events such as global layout changes and view size changes in the view tree. Through ViewTreeObserver, developers can achieve precise control and optimization of the application interface layout, improving the user experience.

[0062] For each view component, there is a viewTreeObserver property. Through this property, multiple scroll event listeners can be registered additionally without affecting the event listeners for the normal business of the component. Normally, when setting a scroll listening event through a component, only one can be set in most cases. If this listening entry is occupied, conflicts may occur.

[0063] After registering a scroll listening event based on the viewTreeObserver property of the scroll view component, listen for the user's sliding input on the screen based on the scroll listening event. After detecting the user's sliding input, trigger the scroll event of the scroll view component, continuously callback the onScrollChanged method, and identify whether the view content is in a valid exposure state based on the execution of the delayed task corresponding to the last method callback. It can be achieved that by listening for the user's sliding input, the wrong idea that the sliding is considered to end after the finger is lifted is discarded. The scroll event is listened for using ViewTreeObserver, and the stay duration of the view content after the sliding truly ends is cleverly judged by setting the delayed task and the effective exposure duration of the sliding. At the same time, the true stop time of the sliding is also judged.

[0064] Among them, when the last delayed task corresponding to the onScrollChanged method callback is executed and it is recognized that the view content in the scroll view component is in a visible state, determining that the view content in the scroll view component is in a valid exposure state includes:

[0065] When executing the delayed task, cancel the scroll listening event;

[0066] Identify whether the view content in the scroll view component is in a visible state;

[0067] In response to the execution of the delayed task and the view content in the scroll view component being in a visible state, determine that the view content in the scroll view component is in a valid exposure state that meets the sliding valid exposure duration.

[0068] In the delayed task, first cancel the listening of the scroll event, and then determine whether the view content in the current scroll view component is in a visible state. If the component is not correctly rendered, there are data problems, or for other reasons, the view content may be invisible. When it is determined through judgment that the view content is in a visible state, it is determined that the display duration of the view content in the scroll view component meets the sliding valid exposure duration, and then it is determined that the view content is in a valid exposure state; otherwise, it means that the view content is not effectively exposed.

[0069] In the above process, by using the scroll listening event and taking the sliding valid exposure duration as the quantization parameter for the end of the slide and valid exposure, the exposure effectiveness of the view content is accurately identified, ensuring the effective identification of the exposure state of the view content.

[0070] The following introduces the method for identifying the effective exposure of the component content in the embodiment of the present application through an overall interaction process, as Figure 2 shown, including:

[0071] Step 201: Based on the viewTreeObserver property of the scroll view component, register a scroll listening event, and listen for the user's sliding input on the screen based on the scroll listening event.

[0072] Step 202: Set the sliding valid exposure duration of the component content, and determine the sliding valid exposure duration as the first duration between triggering the onScrollChanged method and triggering the delayed task.

[0073] Step 203: In response to receiving the user's sliding input on the screen, trigger the scroll event of the scroll view component.

[0074] Step 204: Continuously call back the onScrollChanged method for listening to the change in the scroll state. In adjacent two callbacks, cancel the delayed task corresponding to the previous callback during the latter callback.

[0075] Step 205: In response to recognizing that the delayed task corresponding to the onScrollChanged method is executed, determine that the onScrollChanged method is the last callback and determine that the scrolling event ends.

[0076] Step 206: When executing the delayed task, cancel the scrolling monitoring event.

[0077] Step 207: Determine the actual stop time of the sliding based on the difference between the execution time of the delayed task and the first duration.

[0078] Step 208: Identify the state of the view content in the scrolling view component.

[0079] Step 209: In response to the execution of the delayed task and the view content in the scrolling view component being in a visible state, determine that the view content in the scrolling view component is in a valid exposure state that meets the sliding valid exposure duration.

[0080] In the above implementation process, the execution order between some steps is not strictly restricted. For example, the execution order between Step 201 and Step 202, and between Step 206 and Step 207 is not specifically limited. The above solution is also triggered based on a touch event, and the state of the finger touching the screen and starting to slide is monitored during the monitoring. At the beginning of the sliding, a scrolling monitoring event is registered through the viewTreeObserver property of the component. As the scrolling method onScrollChanged is continuously called back during the scrolling process, a delayed task is set, and the delay duration is the sliding valid exposure duration. The subsequent callback will cancel the delayed task that the previous callback has not had time to execute until the scrolling ends and the onScrollChanged method is no longer called back, and the delayed task can be executed. In the delayed task, first, the monitoring of the scrolling event is cancelled, and then it is determined whether the current view content is in a visible state. If it is visible, it means a valid exposure. Otherwise, it means it does not belong to a valid exposure.

[0081] An embodiment of the present application provides a device for identifying the valid exposure of component content, as Figure 3 shown, including:

[0082] A trigger module 301, configured to trigger a scrolling event of a scrolling view component in response to receiving a sliding input of a user on the screen;

[0083] The processing module 302 is configured to continuously call back the onScrollChanged method for listening to the change of the scrolling state after triggering the scrolling event of the scrolling view component. The onScrollChanged method corresponds to a delayed task. The first duration between the triggering time of the onScrollChanged method and the triggering time of the delayed task is the effective exposure duration for sliding. During the continuous N callbacks of the onScrollChanged method, the first (N - 1) delayed tasks are restricted from execution, where N is greater than 1;

[0084] The first determination module 303 is configured to determine the end of the scrolling event in response to the last callback of the onScrollChanged method;

[0085] The second determination module 304 is configured to determine that the view content in the scrolling view component is in an effective exposure state when the delayed task corresponding to the last onScrollChanged method callback is executed and it is recognized that the view content in the scrolling view component is in a visible state.

[0086] Optionally, during the continuous N callbacks of the onScrollChanged method, the second duration between adjacent callbacks is less than the first duration between the triggering of the onScrollChanged method and the triggering of the delayed task;

[0087] During adjacent callbacks, the delayed task corresponding to the previous onScrollChanged method callback is cancelled when the onScrollChanged method is called back the second time, so as to restrict the execution of the delayed task.

[0088] Optionally, when the user's sliding input on the screen stops, the scrolling event remains triggered based on the sliding inertia, and the onScrollChanged method continues to be called;

[0089] When the sliding inertia ends, the onScrollChanged method stops being called, the scrolling event ends, and the time when the sliding inertia ends is the true stop time of the sliding.

[0090] Optionally, the first determination module is further configured to:

[0091] In response to recognizing that the delayed task corresponding to the onScrollChanged method is executed, determine that the onScrollChanged method is the last callback and determine the end of the scrolling event;

[0092] Wherein, the sliding true stop time can be determined based on the difference between the execution time of the delayed task and the first duration.

[0093] Optionally, the device further includes:

[0094] A setting module, configured to set the sliding effective exposure duration of the component content, where the sliding effective exposure duration is the minimum duration corresponding to the effective exposure state;

[0095] A third determination module, configured to determine the sliding effective exposure duration as the first duration between triggering the onScrollChanged method and triggering the delayed task.

[0096] Optionally, the device further includes:

[0097] A registration module, configured to register a scroll listening event based on the viewTreeObserver attribute of the scroll view component;

[0098] A listening module, configured to listen for the user's sliding input on the screen based on the scroll listening event.

[0099] Optionally, the second determination module includes:

[0100] A cancellation sub-module, configured to cancel the scroll listening event when the delayed task is executed;

[0101] An identification sub-module, configured to identify whether the view content in the scroll view component is in a visible state;

[0102] A determination sub-module, configured to determine that the view content in the scroll view component is in an effective exposure state that meets the sliding effective exposure duration in response to the execution of the delayed task and the view content in the scroll view component being in a visible state.

[0103] For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple. For related parts, refer to the partial description of the method embodiment.

[0104] The embodiment of the present application further provides an electronic device, including: a processor, a memory, and a computer program stored on the memory and executable on the processor. When the computer program is executed by the processor, it implements each process of the method embodiment for identifying the effective exposure of component content, and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.

[0105] For example, Figure 4 shows a schematic diagram of the physical structure of an electronic device. As Figure 4As shown, the electronic device may include: a processor 410, a communications interface 420, a memory 430, and a communication bus 440. Among them, the processor 410, the communications interface 420, and the memory 430 communicate with each other via the communication bus 440. The processor 410 can call the logical instructions in the memory 430. The processor 410 is used to execute each process of the method for identifying the effective exposure of the component content in the embodiments of the present application, which will not be elaborated one by one here.

[0106] In addition, when the logical instructions in the above-mentioned memory 430 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.

[0107] The embodiments of the present application also provide a computer-readable storage medium. A computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, it implements each process of the embodiments of the method for identifying the effective exposure of the component content described above, and can achieve the same technical effects. To avoid repetition, it will not be elaborated here. Among them, the computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc, etc.

[0108] It should be noted that in this article, the term "including", "comprising", or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article, or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such a process, method, article, or device. Without further limitations, an element defined by the statement "including one..." does not exclude the existence of another identical element in the process, method, article, or device including that element.

[0109] Through the description of the above embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions for causing a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in various embodiments of the present application.

[0110] The embodiments of the present application have been described above in conjunction with the accompanying drawings. However, the present application is not limited to the above specific embodiments. The above specific embodiments are merely illustrative and not restrictive. Under the inspiration of the present application, those of ordinary skill in the art can also make many forms without departing from the purpose of the present application and the scope protected by the claims, and all of them belong to the protection scope of the present application.

[0111] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in the embodiments of the present application can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.

[0112] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments and will not be repeated here.

[0113] In the embodiments provided by the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection may be through some interfaces. The indirect coupling or communication connection of the devices or units can be in an electrical, mechanical, or other form.

[0114] The unit described as a separation component may or may not be physically separated. The component shown as a unit may or may not be a physical unit, that is, it may be located in one place or may be distributed over multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0115] In addition, each functional unit in various embodiments of the present application may be integrated in a processing unit, may exist physically separately for each unit, or two or more units may be integrated in one unit.

[0116] If the above functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical discs that can store program codes.

[0117] The above is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present application can easily think of changes or substitutions, which should all be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A method for identifying effective exposure of component content, characterized in that: include: In response to receiving a sliding input from the user on the screen, triggering a scroll event of the scroll view component; After the scrolling event of the scroll view component is triggered, the onScrollChanged method for monitoring the scrolling state change is continuously called back, the onScrollChanged method corresponds to a delayed task, the first time interval between the triggering time of the onScrollChanged method and the triggering time of the delayed task is the effective exposure time of the sliding, and in the process of calling back the onScrollChanged method N times in a row, the first (N-1) delayed tasks are restricted from execution, and the value of N is greater than 1; In response to the last callback of the onScrollChanged method, determining that the scrolling event ends; When the delayed task corresponding to the last onScrollChanged method callback is executed and it is identified that the view content in the scroll view component is in a visible state, it is determined that the view content in the scroll view component is in a valid exposure state.

2. The method for identifying effective exposure of component content according to claim 1, characterized in that: in, In the process of calling back the onScrollChanged method N times in a row, the second time interval between two adjacent callbacks is less than the first time interval between triggering the onScrollChanged method and triggering the delayed task; In two adjacent callbacks, the later callback of the onScrollChanged method cancels the delayed task corresponding to the previous callback of the onScrollChanged method to limit the execution of the delayed task.

3. The method for identifying effective exposure of component content according to claim 1, characterized in that: When the user stops sliding input on the screen, the scroll event remains triggered based on the sliding inertia, and the onScrollChanged method continues to be called; When the sliding inertia ends, the onScrollChanged method stops being called, the scrolling event ends, and the time when the sliding inertia ends is the time when the sliding actually stops.

4. The method for identifying effective exposure of component content according to any one of claims 1 to 3, characterized in that: The step of determining that the scrolling event ends in response to the last callback of the onScrollChanged method includes: In response to identifying that the delayed task corresponding to the onScrollChanged method is executed, determining that the onScrollChanged method is the last callback and determining that the scrolling event is finished; The actual stopping time of sliding may be determined based on the difference between the execution time of the delayed task and the first duration.

5. The method for identifying effective exposure of component content according to claim 1, characterized in that: The method further comprises: Set the effective exposure time of sliding of component content, where the effective exposure time is the minimum time corresponding to the effective exposure state; The effective sliding exposure duration is determined as the first duration between triggering the onScrollChanged method and triggering the delayed task.

6. The method for identifying effective exposure of component content according to claim 1, characterized in that: The method further comprises: Register scrolling listener events based on the viewTreeObserver property of the scroll view component; The user's sliding input on the screen is monitored based on the scroll monitoring event.

7. The method for identifying effective exposure of component content according to claim 6, characterized in that: The step of determining that the view content in the scroll view component is in a valid exposure state when the delayed task corresponding to the last onScrollChanged method callback is executed and the view content in the scroll view component is identified to be in a visible state comprises: When executing the delayed task, canceling the scroll listening event; Identify whether the view content in the scroll view component is visible; In response to the delayed task being executed and the view content in the scroll view component being in a visible state, it is determined that the view content in the scroll view component is in a valid exposure state that satisfies a sliding effective exposure duration.

8. A device for identifying effective exposure of component content, characterized in that: include: A trigger module, configured to trigger a scrolling event of the scroll view component in response to receiving a sliding input from a user on the screen; A processing module, configured to, after triggering a scroll event of the scroll view component, continuously call back an onScrollChanged method for monitoring scroll state changes, wherein the onScrollChanged method corresponds to a delayed task, and the first time interval between the triggering time of the onScrollChanged method and the triggering time of the delayed task is the effective exposure time of sliding, and in the process of calling back the onScrollChanged method N times in a row, the first (N-1) delayed tasks are restricted from execution, and the value of N is greater than 1; A first determining module, configured to determine that the scrolling event ends in response to the last callback of the onScrollChanged method; The second determination module is used to determine that the view content in the scroll view component is in a valid exposure state when executing the delayed task corresponding to the last onScrollChanged method callback and identifying that the view content in the scroll view component is in a visible state.

9. An electronic device, characterized in that: The invention comprises a processor, a memory and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the steps of the method for identifying effective exposure of component content as described in any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for identifying effective exposure of component content as described in any one of claims 1 to 7 are implemented.