WO2019007227A1 - Method and apparatus for continuing to display view after switching pages - Google Patents

Method and apparatus for continuing to display view after switching pages Download PDF

Info

Publication number
WO2019007227A1
WO2019007227A1 PCT/CN2018/092828 CN2018092828W WO2019007227A1 WO 2019007227 A1 WO2019007227 A1 WO 2019007227A1 CN 2018092828 W CN2018092828 W CN 2018092828W WO 2019007227 A1 WO2019007227 A1 WO 2019007227A1
Authority
WO
WIPO (PCT)
Prior art keywords
page
view
video
topmost
new
Prior art date
Application number
PCT/CN2018/092828
Other languages
French (fr)
Chinese (zh)
Inventor
涂勇
Original Assignee
广州优视网络科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 广州优视网络科技有限公司 filed Critical 广州优视网络科技有限公司
Publication of WO2019007227A1 publication Critical patent/WO2019007227A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/70Information retrieval; Database structures therefor; File system structures therefor of video data
    • G06F16/74Browsing; Visualisation therefor
    • G06F16/745Browsing; Visualisation therefor the internal structure of a single video sequence
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Definitions

  • the present application relates to the field of computer technology, and in particular, to a method and apparatus for continuing to display a view after page switching.
  • short videos are very popular on the Internet, and many online companies are sparing no effort to launch short video content, such as video bars provided on browsers, such as UC browsers, 360 browsers, etc., such as video provided on information apps. Columns, today's headlines, etc., are very suitable for viewing on mobile smart terminals.
  • short videos can be played directly on a web page, usually in a list, and of course can be played in full screen.
  • the second page A2 is often created in the new Activity.
  • the view control for playing the video needs to be recreated in the new Activity, and the video data needs to be reloaded, and the record is saved before the fast forward.
  • the process of playing the progress it takes a certain amount of time.
  • the smart terminal used such as a smart phone
  • has weak computing power fast forward. It takes longer to play the progress of the previously saved record, so the phenomenon of frustration or pause playback is more obvious.
  • This kind of video pause play after the page switch will interrupt the user's visual experience, and the uncertainty of the time of reloading the play video B on the second page A2 makes the user's satisfaction with the current video play experience greatly reduced, resulting in The loss of user volume.
  • the transition effect is not very smooth, especially in the application of the Android system.
  • the friend circle function provided by an app, when the user posts a plurality of photos on the friend circle of the APP, the user's friend first sees a thumbnail of the photos in his friend circle. If you want to see the original image of the photo, you need to click on the thumbnail of the photo to switch to the original image of the photo displayed on another page, but the transitional display effect is smooth when the original image of the photo is displayed after the page is switched. It is obviously not as smooth as the transition effect of the same operation under the ios system.
  • One of the reasons for the above phenomenon is caused by the limitations of the page jump caused by the characteristics of the Android system itself.
  • Embodiments of the present application provide a method and apparatus for continuing to display a view after page switching to at least partially improve the above problem.
  • the first embodiment of the present application provides a method for continuing to display a view after page switching, including:
  • creating the second page in the same Activity creating a new view control for displaying the one view on the first page of interest to the user and adding the new view control to the The topmost view in the activity, and then the one view that is of interest to the user is displayed by the new view control added to the topmost view above the second page.
  • the second embodiment of the present application provides a method for maintaining video playback after page switching, including:
  • a new view control for video playback is created and added to the topmost view in the Activity. Using the new view control on the topmost view to play the one video clicked by the user;
  • the second page is created in the same Activity, and the video is continued to be played over the second page by the new view control added to the topmost view.
  • the third embodiment of the present application provides an apparatus for continuing to display a view after page switching, including:
  • a first page display module configured to display at least one view information on a first page created by an Activity
  • the page click monitoring module is configured to monitor the user's click operation on the specified location area on the first page
  • a page switching command issuing module configured to, when listening to the user clicking the specified location area on the first page, issue an instruction to switch a view of the user displayed on the first page to the second page for display;
  • a page switching command processing module configured to, in response to the switching instruction, create the second page in the same Activity, and create a new view control for displaying the one view on the first page of interest to the user and Adding the new view control to the topmost view in the Activity, and then displaying the one view of interest to the user by the new view control added to the topmost view above the second page.
  • the fourth embodiment of the present application provides an apparatus for maintaining video playback after page switching, including:
  • a first page display module configured to display at least one video view on a first page created by an Activity
  • a video playback instruction monitoring module configured to listen to a user clicking an image view displayed on the first page to issue an instruction to play the video
  • a video play instruction processing module configured to, in response to the play instruction, create a new view control for video playback and add it to a topmost view in the Activity, using the new view control on the topmost view To play the one video that the user clicked.
  • a page click monitoring module configured to listen to a user click operation on a specified location area associated with the playing video on the first page
  • a page switching command issuing module configured to issue an instruction to switch from the first page to the second page to play the video when the user clicks on the specified location area on the first page
  • a page switching command processing module configured to, in response to the switching instruction, create the second page in the same Activity, and continue over the second page by adding the new view control added to the topmost view Play the video.
  • the embodiment of the present application further provides a storage device, where a plurality of instructions are stored, the instruction being adapted to be loaded by a processor and performing a method for continuing to display a view after page switching as provided by the first embodiment of the present application.
  • the embodiment of the present application further provides a storage device, where a plurality of instructions are stored, the instruction being adapted to be loaded by a processor and performing a method for keeping the video playing after the page switching is provided by the second embodiment of the present application.
  • the embodiment of the present application further provides an intelligent mobile terminal, including: a processor configured to load and execute various instructions; and a storage device provided by the present application.
  • only one Activity can exist at the same time by means of the currently displayed screen, and an Activity only corresponds to the feature of a top-level view DecorView, and also utilizes the view.
  • the view of the upper layer of the tree layout will cover the view of the next layer.
  • the topmost view DecorView is always at the top of the entire Window interface, so different pages such as the first page and the second page are created in the same Activity, created for A new view control that displays the view information of the user's interest and adds it to the topmost view. This ensures that the view view that guarantees the display effect is always on the top level regardless of how the page is switched in an Activity, avoiding the page.
  • the page level problem that needs to be considered before and after switching, and avoids the time it takes to reload, render, and display the view after the page is switched, when the first page and the second page are respectively created in different activities. After the different pages are switched, the view continues to display the smoothing effect. And other effects.
  • a new view control for playing the video is created and added in the topmost view, and the first page and the second page are separately created in different activities.
  • it is necessary to re-create the view control for playing the video the time taken to reload the video data, and not need to record the playback progress before the page switching, and save the work of fast-forwarding the playback progress of the saved record after switching. Time, which enables seamless continuous playback after switching between different pages without frustration or pause playback.
  • FIG. 1 is a schematic block diagram of an intelligent mobile terminal according to an embodiment of the present application
  • FIG. 2 is a flowchart of a method for continuing to display a view after page switching according to the first embodiment of the present application
  • FIG. 3 is a schematic block diagram of an apparatus for continuing to display a view after page switching according to a second embodiment of the present application
  • FIG. 4 is a flowchart of a method for keeping a video to continue playing after a page switch according to a third embodiment of the present application
  • FIG. 5 is a schematic block diagram of an apparatus for maintaining video playback after page switching according to a fourth embodiment of the present application.
  • FIG. 1 is a block diagram showing an intelligent mobile terminal according to an embodiment of the present application.
  • the smart mobile terminal may be a terminal such as a smart phone or a tablet computer, and the smart mobile terminal is operated based on the Android system, and includes a memory, a processor, a display unit, and a communication unit, and the components of the memory, the processor, the display unit, and the communication unit are mutually Directly or indirectly electrically connected to achieve data transmission or interaction.
  • these components can be electrically connected to each other directly through one or more communication buses or signal lines.
  • the memory stores at least one functional module included in the apparatus for continuing to display the view after the page switching, and the processor is configured to execute the executable module stored in the memory upon receiving the execution instruction.
  • the display unit is configured to provide an interactive interface with the user and configured to display information to be displayed, such as video information in a page file, and the like.
  • the communication unit is configured to establish a communication connection with an external device, for example, a communication connection of the electronic device to the server can be established to obtain a page file from the server.
  • FIG. 1 is merely illustrative, and the smart mobile terminal may further include more or less components than those shown in FIG. 1 or have a completely different configuration from that shown in FIG. 1. No restrictions. Moreover, the components shown in FIG. 1 can be implemented in hardware, software, or a combination thereof.
  • FIG. 2 is a flowchart of a method for continuing to display a view after page switching according to the first embodiment of the present application, and the method can be applied to the smart mobile terminal shown in FIG. 1.
  • a method for continuing to display a view after page switching includes:
  • S1 Display at least one view on the first page created by an Activity.
  • Activity is one of the most basic four components of the Android component (Activity, Service Service, ContentProvider Content Provider, BroadcastReceiver Broadcast Receiver).
  • An Activity is an interface component used to implement user interaction with a program, such as making a call, taking a photo, sending an email, or viewing a map.
  • Each Activity is an interface for depicting the user interface, allowing the user to create a user interface on it. Usually this interface is full screen, but it can be smaller than the screen and can float on top of other windows.
  • the various information displayed on the user interface is implemented by the View control.
  • a View is a rectangular area that is responsible for drawing and event processing in this area.
  • the at least one view information displayed on the first page includes, but is not limited to, a video, a picture, a text, and the like.
  • the page described in the first embodiment of the present application includes a page of a webpage type and a page of a non-webpage type.
  • the webpage-like page may include, for example, a page displayed on various browser apps, and the non-page-like page may include, for example, a page displayed on a video player APP (eg, Youku APP), an instant messaging APP (eg, nail and WeChat).
  • a video player APP eg, Youku APP
  • instant messaging APP eg, nail and WeChat
  • the specific implementation method of displaying at least one view information on the first page created by an Activity may be implemented by using a conventional technique well known to those skilled in the art, as long as it is ensured that multiple similar pages can be created on one Activity by using the technology. For example, you can use the Fragment class to build, so I won't go into too much here.
  • S2 when listening to the user clicking the specified location area on the first page, issuing an instruction to switch a view of the user displayed on the first page to the second page for display.
  • the system internally monitors the user's click on the touch screen of the smart mobile terminal, especially whether the click position of the user on the screen is the designated location area on the first page, and is sent when the user clicks on the specified location area on the first page. Switching a view of interest to the user displayed on the first page to an instruction for display on the second page.
  • the user sends out a different specified location area on the first page on the touch screen of the smart mobile terminal, and in the APP, the user is usually interested.
  • the one view that needs to be switched to display on the second page is associated with a specified location area for the user to click to indicate page switching, ie one view that the user is interested in is for the user to click on
  • the specified location area indicating the page switching is associated, so that the smart mobile terminal can know which view is to be displayed on the second page by the specified location area clicked by the user, that is, the one view displayed on the first page of interest to the user.
  • the view that the user is interested in is a view on the first page corresponding to the specified location area clicked by the user.
  • a page of a browser app or a video player APP that provides video playback or short video playback often displays multiple views, and each view displays a state to be played. (for example, it can be displayed to prompt the user to click Video thumbnail of the pattern), at the bottom of each video view or short video view window is the details bar (the details bar is associated with the corresponding video or short video), when the user is clicked on the details bar (by issuing The page switching instruction) switches to another page, and in the upper area of the other page, the video or short video is ready to be played, and it can be determined that the video or short video to be played on another page is a video or short video that is of interest to the user.
  • an instant messaging app that can provide a circle of friends, such as WeChat, when the user sees that his friend has posted a plurality of photo information on the circle of friends, only the friend circle page displayed at this time is only A thumbnail of the photo, when listening to the user clicking on one of the thumbnails (by issuing a page switching command), switching from the first page of the plurality of friends views currently displayed on the circle of friends to displaying the clicked thumbnail
  • the second page of the complete original image of the figure, that is, the original image of the clicked thumbnail is the entire photo drawn and displayed on the second page.
  • the image displayed by the click video view, the detail view bar of the video view window, the thumbnail view, and the like may cause page switching, and other location areas may be involved for different application scenarios, and specific designated locations.
  • the area can be specified by different APP developers, and has nothing to do with the implementation of the technical solution of the embodiment of the present application.
  • the user clicks on the specified location area on the first page the user can display the user feeling displayed on the first page.
  • a view of the interest (associated with the specified location area of the click) is switched to the instruction displayed on the second page.
  • the switching instruction refers to an instruction in step S2 to switch a view of the user displayed on the first page to a second page for display.
  • the method for creating the second page in the same activity may be implemented by using a conventional technique well known to those skilled in the art, for example, constructing a second page by using a Fragment class, or implementing a custom View, that is, a custom View. And make it inherit View, rewrite onDraw (), onMesure (), etc., here will not be introduced too much.
  • a view on the first page of interest to the user is associated with a specified location area that the user clicked on the first page to indicate page switching, by the specified location clicked by the user.
  • the area knows which view will be displayed on the second page, ie the one view on the first page of interest to the user.
  • the topmost view in the Activity Before adding the created new view control for displaying the one view on the first page of interest to the user to the topmost view in the Activity, the topmost view in the Activity needs to be obtained first.
  • the topmost view (ViewGroup: DecorView) in the Activity can be obtained by the Activity.getWindow().getDecorView() method.
  • All views in the user interface are a tree structure, and the topmost view of the entire view tree ViewTree is DecorView.
  • the DecorView is also the root node of the entire view tree.
  • DecorView is the top-level view view or root view in the entire application window. It usually includes: status bar, title bar, and content display interface.
  • a custom view display layout is usually placed on the content display interface.
  • the following will introduce how to create a new view control for displaying the one view on the first page that the user is interested in, and add the new view control to the topmost view in the Activity, and then The one view above the second page is displayed by the new view control added to the topmost view.
  • a method of creating a new view control for displaying the one view on the first page of interest to the user may be implemented using conventional techniques in the art.
  • the new view control for creating the picture may be an ImageView control; when the user is interested in displaying on the first page
  • a new view control for creating the text when a view is text, a new view control for creating the text may be a TextView control; when the one of the views that the user is interested in displaying on the first page is a video, create a new one for displaying the played video.
  • the view control can be a VideoView control. Because the creation of ImageView control, TextView control, VideoView control, etc. are all conventional techniques in the field, it is not introduced here.
  • Adding this new view control to the topmost view can be done using the addView() method. In this way, because the view that was last added in the topmost view will always be displayed on the screen without being occluded, the new view control added to the topmost view will display the user above the created second page. The one view of interest. When the size of the new view is smaller than the second page, other information may be displayed on the second page that is not obscured by the new view.
  • the method provided by the first embodiment of the present application is innovative in that, during the page switching process, a view for displaying the user's interest is created by creating different pages such as the first page and the second page in the same Activity.
  • the new view control and add it to the topmost view, so that in any Activity, no matter how you switch pages, the view view that guarantees the display effect is always on the top level, avoiding the pages that need to be considered before and after the page switch.
  • Hierarchical problems avoiding the time it takes to reload, render, and display the view after the page is switched, in the case of creating the first page and the second page in different activities, so that the view continues after the different pages are switched. Shows smooth transitions such as effects.
  • the added new view control occludes the content displayed on the page, in order to avoid occlusion when returning from the second page to the first page, the added new one may be removed from the topmost view.
  • the method provided by the first embodiment of the present application may further include: returning from the second page to the returning instruction in response to the returning instruction from the second page to the first page
  • the first page removes the added new view control from the topmost view.
  • a return arrow or a return button is displayed on the second page. When the user clicks the return arrow or the return button (also referred to as a bounce) displayed on the second page, it can be regarded as returning from the second page to the first page.
  • the instructions of the page. Returning from the second page to the first page is a common function of the existing third party application APP, so its specific implementation method can be implemented using existing conventional techniques.
  • VideoView control as a view control for playing video has been described above, any view control that can be used to play a video can be used in embodiments of the present application.
  • this article refers to any view control for video or short video playback as VideoPlayerView.
  • the first page created by an Activity is first used on the first page.
  • Display one or more of the states to be played for example, the display prompts the user to click Video thumbnail of the pattern.
  • the user clicks on the details bar at the bottom of the video or short video window and the system of the smart mobile terminal can monitor the user's Click to operate, and then switch to the second page to play the video or short video switching instructions.
  • a second page ie, a detail page
  • a new view control VideoPlayerView for playing a video is created, and the created view VideoPlayerView is added to the videoViewer by the decorView.addView(VideoPlayerView) method.
  • the top-level view in the Activity, DecorView gets the top-level view DecorView for this Activity via the Activity.getWindow().getDecorView() method before adding, because the video or short video window has a detail bar with the video or short video.
  • the hyperlink address of the video file so the video or short video is played over the details page (second page) presented to the user after creation by the new view control VideoPlayerView added to the topmost view.
  • the first page and the second page are located on the same Activity.
  • the new view control for playing the video corresponding to the video view is at the top level of the same Activity.
  • the view is created, so that when it is required to switch back to the first page from the second page, the position and display size of the new view control can be directly changed without newly creating an Activity, creating a new view control, and reloading the being played. Video can avoid the jamming problem during page switching.
  • the user may first click on one of the videos or the short video to play on the first page.
  • click on the details bar at the bottom of the video or short video window to issue an instruction to play the video or short video on the details page (second page) after the system listens to the click operation.
  • the video or short video clicked by the user is first played on the first page, in order to ensure that the currently playing video or short video continues to play smoothly on the second page after the page is switched, the first time created by an Activity is created.
  • At least one video view is displayed on one page; when the user is prompted to click on one of the video thumbnails on the first page to issue an instruction to play the video, first create a new view control VideoPlayerView for playing the video, through decorView.addView
  • the (VideoPlayerView) method adds the created view control VideoPlayerView to the topmost view DecorView in the Activity, and plays the video or short video clicked by the user above the first page.
  • the topmost view DecorView is obtained for this Activity via the Activity.getWindow().getDecorView() method before adding the new view control VideoPlayerView.
  • the size (ie, height and width) of the VideoPlayerView and the video clicked by the user or The short video has the same view size (ie, height and width), and also needs to obtain the location area information of the view view of the video or short video on the first page, and the VideoPlayerView that plays the video or short video according to the obtained location area information.
  • the position of the VideoPlayerView playing the short video in the topmost view DecorView overlaps with the position of the view view of the video or short video clicked by the user on the first page Overlay, which allows the user to watch the video being played or the short video as if it were played on the original location of the first page, rather than being played on another page.
  • the user makes a swipe gesture on the touch screen, causing the first page to scroll up or down, in order to make the view VideoPlayerView added in the topmost view DecorView do Seamlessly follow the scrolling operation so that its position remains overlapping with the position on the first page of the video being played or the view of the short video. This can be achieved by:
  • Binding the new view control (view VideoPlayerView) with a view view of the video or short video of the user in the first page (for the convenience of description, the agreement is the target view view); in the system, in the first page
  • the target view view is globally monitored, and a corresponding callback function is registered for the global listener.
  • the callback function is configured to acquire the latest location information of the target view view when the target view view is monitored. And sending the latest location information to a view bound to the target view view, that is, the new view control, to trigger the new view control to move according to a predefined action. In this embodiment, it may be predetermined to control the new view control to move to the same position as the target view view.
  • the system can listen to the user's click operation, and then issue a switching instruction to switch to the video or short video on the details page (second page).
  • the instruction should be switched to create a second page (ie, a detail page) in the same Activity, by the new view control added to the topmost view above the details page (second page) presented to the user after creation VideoPlayerView to continue playing the video or short video.
  • the effect of continuing playback performed here can achieve seamless playback, that is, continuous playback without interruption, without pause.
  • the size (ie, height and width) of the VideoPlayerView is the same as the size of the view on the first page that the user is interested in (ie, Height and width are the same.
  • the VideoPlayerView playing the video or the short video may be anywhere in the topmost view, so that it is located anywhere on the second page as seen from the display effect.
  • the display area located at the top position of the screen is preferably played.
  • the VideoPlayerView of the video or short video is located in the top area of the topmost view, more preferably in portrait mode.
  • the method for obtaining the location area information of a certain view may be implemented by a method well-known in the art, for example, by using ViewA.getLocationOnScreen(locA) to obtain the location of the video or short video view of the first page, where the view A is located.
  • ViewA.getLocationOnScreen(locA) to obtain the location of the video or short video view of the first page, where the view A is located.
  • the user instruction returns from the second page to the first page, in order to ensure that the video is being played.
  • the method provided by the embodiment may further include: when the one view displayed on the first page that is of interest to the user is a video, Before the page is switched to the second page, according to the user clicking the specified location area on the first page, the location area information on the first page of the video view associated with the specified location area is recorded, and the receipt returns from the second page to the first page. Responding to the return instruction from the second page to the first page and continuing to maintain the new view control in the topmost view, according to the previously recorded position on the first page of the video view The area information adjusts a position of the new view control for playing the video in the topmost view to overlap the original position on the first page where the video view is located before switching to the second page.
  • the fourth instance may further include: when receiving an instruction to return from the second page to the first page, query whether the new view control in the topmost view is still playing the video, if The new view control in the topmost view is still playing the video, returning to the first page from the second page in response to the return instruction and continuing to play through the new view control in the topmost view Said video.
  • the method further includes: when returning from the second page to the first page, when the user clicks on other non-video views, or when the video playback that is still playing continues, The added new view control is removed from the topmost view to prevent the new view control from obscuring other information that needs to be displayed.
  • the fourth example may further include: after returning from the second page to the first page, when the user makes a swipe gesture on the screen to cause the video view on the covered first page to scroll up or down
  • the smart mobile terminal can detect that the video view on the first page is moved. At this time, the smart mobile terminal can monitor whether the video view leaves the interface corresponding to the activity, and if not, control
  • the new view control in the topmost view follows the video view in the first page to perform a seamless follow move operation (here, a scroll operation consistent with the aforementioned up or down scroll operation);
  • the smart mobile terminal may detect that the video view leaves the interface corresponding to the Activity, and the added the top view may be removed from the top view. New view control.
  • a photograph taken on a circle of friends provided by an APP under the Android system that has been used by users in the background art, such as a landscape photograph is provided according to the first embodiment of the present application.
  • the method firstly creates a first page of the circle of friends through an Activity, that is, by clicking a circle of friends icon to enter a first page on the corresponding interface, the first page is a page displaying information published by a friend, and the published information is, for example, Text information, picture information or text and image information, and these information are displayed in one or more views.
  • creating a second page in the same Activity creating a view control for displaying a picture, such as an ImageView, and adding the created new view control to the topmost view DecorView in the Activity
  • the new view control for displaying the image reads the hyperlink address of the full-size image contained in the thumbnail image clicked by the user to obtain the data of the full-size image, draws and renders the complete image, and finally displays it to the user after creation.
  • the full picture is displayed at the top of the second page, which is the complete landscape photo pointed by the thumbnail of the user click.
  • the display size and location of the new view control correspond to a page (first page or second page) of current user interest, for example, when the user needs to When the video view is played on the first page, the display size and position of the new video control are generally the same as the display size and position of the video view in the first page (in some scenarios, Alternatively, when the user needs to play the video view on the second page, the display size and position of the new video control are generally the same as the display size of the video view in the second page.
  • the locations correspond to the same (in some scenarios, they can be different).
  • the data of the mobile APP providing the first page and the related APP of the second page includes the display size and location of the video view on the first page, and The display size and location of the second page are different depending on the specific design of the APP.
  • the smart mobile terminal can obtain the data of the APP from the remote server and save it in the memory of the terminal. It is worth noting here that for a picture or text display, because more information is to be displayed, the display size of the new view control added to the topmost view when switching to the second page is often The corresponding view size displayed on the first page is not the same.
  • the display size of the new view control added to the topmost view when switching to the second page is self-displayed according to the horizontal screen display or the vertical screen display.
  • the new view can occupy a part of the screen display, or can be full-screen display, for example, when displaying a complete picture or text, suitable for full-screen display.
  • the location of the new view control added to the topmost view when switching to the second page is customized according to the application scenario, that is, Continue to display the view at any of the set positions.
  • a view information displayed on the first page that is of interest to the user is, for example, a video
  • the new view added to the topmost view for displaying the video when the second page is switched The position of the control is preferably at the top area of the topmost view.
  • At least one view may also be displayed on the second page.
  • multiple views may be displayed on the second page, including but not limited to: text introduction of the played video, advertisement information, Recommend related videos and more.
  • multiple views may be displayed on the area where the second page is not occluded, including but not limited to: text introduction to the picture, advertisement information, or text content. Associated recommendation information and more.
  • the plurality of views displayed on the first page and the second page may be slidable.
  • the plurality of views on the first page or the second page displayed on the screen may follow up or down.
  • the first page is a main page
  • the second page is a detail page
  • the method for continuing to display a view after page switching can only have one Activity at the same time by means of the currently displayed screen, and an Activity only corresponds to the feature of a top-level view DecorView, and also uses the view tree.
  • the layout of the upper layer will cover the view of the next layer.
  • the topmost view DecorView is the root view of all windows, always at the top of the entire Window interface, so create the first page, the second page, etc. in the same Activity.
  • Different pages create a new view control for displaying the information of the user's interest and add it to the topmost view. This ensures that the view view that guarantees the display effect is always the most in any activity regardless of how the page is switched.
  • FIG. 3 is a schematic block diagram of an apparatus for continuing to display a view after page switching according to a second embodiment of the present application.
  • an apparatus for continuously displaying a view after page switching includes:
  • a first page display module configured to display at least one view information on a first page created by an Activity
  • the page click monitoring module is configured to monitor the user's click operation on the specified location area on the first page
  • a page switching command issuing module configured to, when listening to the user clicking the specified location area on the first page, issue an instruction to switch a view of the user displayed on the first page to the second page for display;
  • a page switching command processing module configured to create the second page in the same Activity in response to the switching instruction, and create a new view control for displaying the one view on the first page of interest to the user and Adding the new view control to the topmost view in the Activity, and then displaying the one view of interest to the user by the new view control added to the topmost view above the second page.
  • the displaying the at least one view information on the first page may include, but is not limited to, a video, a picture, and a text.
  • the view information that is of interest to the user is associated with a specified location area that the user clicks to indicate page switching.
  • the first page is constructed using a Fragment class
  • the second page is implemented by using a Fragment class or by a custom View.
  • creating a new view control for displaying the picture is an ImageView control
  • the new view control that is created to display the text is a TextView control
  • the new view control for playing the video is created.
  • the device for continuing to display the view after the page switching may further include: a top-level view obtaining module configured to obtain the most of the activities before adding the new view control to the top-level view in the Activity Top view.
  • the display size and location of the video view in the first page and the display size and location of the second page are pre-stored in the smart mobile terminal, and the page switching command processing module switches from the first page to the second page.
  • the display size and position of the new view control in the topmost view may be determined according to a display size and location of the video view in the second page.
  • the display size and location pre-stored in the smart mobile terminal may be changed according to specific application scenarios.
  • the display size of the new view control added to the topmost view when switching to the second page may be adaptively adjusted according to the horizontal screen display or the vertical screen display.
  • the new view added to the topmost view for displaying the video when the second page is switched can be in the top area of the topmost view.
  • the page described in the second embodiment of the present application may include a page of a webpage type and a page of a non-webpage type.
  • At least one view is displayed on the second page.
  • the plurality of views displayed on the first page and the second page may be configured to be slidable.
  • the first page is a main page
  • the second page is a detail page.
  • the device may further include: a first view control removal module configured to, when receiving an instruction to return from the second page to the first page, return to the first page from the second page in response to the return instruction The new view control added is removed from the topmost view.
  • a first view control removal module configured to, when receiving an instruction to return from the second page to the first page, return to the first page from the second page in response to the return instruction The new view control added is removed from the topmost view.
  • the device may further include: a location information recording module configured to: when the one view information displayed on the first page that is of interest to the user is a video, according to the user before switching from the first page to the second page Clicking on the specified location area on the first page to record the location area information on the first page of the video view associated with the specified location area;
  • a location information recording module configured to: when the one view information displayed on the first page that is of interest to the user is a video, according to the user before switching from the first page to the second page Clicking on the specified location area on the first page to record the location area information on the first page of the video view associated with the specified location area;
  • the page returns an instruction listening module configured to listen to an instruction issued by the user to return from the second page to the first page;
  • a page return instruction processing module configured to, in response to the monitored return instruction, return from the second page to the first page and continue to maintain the new view control in the topmost view, according to the previously recorded video view Position area information on a page, adjusting a position of the new view control for playing the video in the topmost view to be the same as on the first page of the video view before switching to the second page There is overlap in position coverage.
  • the device may further include: a second view control removal module configured to return from the second page to the first page, when the user clicks on other non-video views, or when the video playback that is still playing continues Removing the added new view control from the topmost view.
  • a second view control removal module configured to return from the second page to the first page, when the user clicks on other non-video views, or when the video playback that is still playing continues Removing the added new view control from the topmost view.
  • the page return instruction processing module may be further configured to: in response to the monitored return instruction, query whether the new view control in the topmost view is still playing the video, if the topmost view is in this case The new view control is still playing the video, returning from the second page to the first page and continuing to play the video through the new view control in the topmost view.
  • the device may further include: a view scroll processing module, configured to move from the second page to the first page, and when the video view on the first page is detected to move within the interface corresponding to the activity And causing the new view control added to the topmost view to follow the video view to follow the moving operation seamlessly so that the relative positional relationship between the new view control and the video view is not during the moving process
  • the third view control removes the module, configured to remove the added new view control from the topmost view when the video view scrolls up or down away from the interface corresponding to the Activity.
  • the device of the second embodiment of the present application is configured to keep the View from continuing to display after the page is switched, and creates a different page such as the first page and the second page in the same Activity, and is created for use in the second embodiment.
  • a new view control that displays the view information of the user's interest and adds it to the topmost view. This ensures that the view view that guarantees the display effect is always on the top level regardless of how the page is switched in an Activity, avoiding the page.
  • the page level problem that needs to be considered before and after switching, and avoids the time it takes to reload, render, and display the view after the page is switched, when the first page and the second page are respectively created in different activities.
  • the effect of the smooth transition of the view continues to be displayed. For the video played on the first page, after the page is switched, since the same view is always used to play the video and is always at the top of the window interface, seamless continuous playback is achieved after switching between different pages.
  • FIG. 4 is a flowchart of a method for keeping a video to continue playing after a page switch according to a third embodiment of the present application.
  • a method for maintaining video playback after page switching includes:
  • S21 Display at least one video view on the first page created by an Activity.
  • the first page can be constructed using a Fragment class, which includes pages of a web page class and pages of a non-web page class.
  • This step S21 can be implemented using conventional techniques in the art, and will not be described again here.
  • the touch screen assumes two functions of information input and information display without separately providing an input device such as a keyboard or a mouse.
  • the user wants to watch the video displayed on the page and click on the video view directly on the touch screen to issue an instruction to play the video.
  • a new view control for video playback in response to the play instruction, can be created and added to the topmost view in the Activity using conventional techniques in the art, so that The new view control is used on the topmost view to play the one video clicked by the user.
  • the new view control for video playback can be a VideoView control.
  • S23 Send an instruction to switch the video from the first page to the second page to play the video when the user is clicked on the specified location area on the first page that is associated with the video being played.
  • a common designated location area is a peripheral location of the video window being played, such as a detail bar at the bottom of the video window.
  • the implementation process of this step is the same as or similar to the corresponding process described in the first embodiment, and therefore will not be described again.
  • S24 responsive to the switching instruction, creating the second page in the same Activity, and continuing to play the video by adding the new view control added to the topmost view above the second page.
  • the method of creating the second page in the same Activity may be implemented by a conventional technique well known to those skilled in the art, for example, using the Fragment class to construct a second page, or by Custom View to achieve, that is, customize the View, and make it inherit View, override onDraw (), onMesure () and so on.
  • the new view control added to the topmost view when switching to the second page is overlaid on the second page, thereby enabling the addition to the topmost view above the second page.
  • the new view control is used to continue playing the video.
  • the method provided by the third embodiment of the present application further includes: returning from the second page to the second page in response to the return instruction upon receiving the switching instruction returning from the second page to the first page One page and removes the added new view control from the topmost view.
  • a return arrow or a back button is usually displayed on the second page.
  • the innovation of the method provided by the third embodiment of the present application is similar to that of the first embodiment: in the process of page switching, creating a video for playing a video by creating different pages such as a first page and a second page in the same Activity.
  • the new view control and add it to the topmost view which ensures that no matter how you switch pages in an Activity, you can always use the same view to play the video and always be at the top of the window interface, avoiding
  • the page level problem that needs to be considered before and after the page switching, and avoids the case where the first page and the second page are respectively created in different activities, and the view control for playing the video needs to be re-created after the page is switched, and the video is reloaded.
  • the time spent on the data does not require the recording progress before the page is switched. It saves the working time of fast-forwarding to the playback progress of the saved record after switching, so that seamless continuous playback is achieved after switching between different pages without happening. Frustrated or paused.
  • the new view control for video playback is the same size as the one video view clicked by the user.
  • the position of the new view control for video playback in the topmost view is the same as the position of the one video view clicked by the user on the first page, thereby implementing overlapping coverage. This has the advantage that the user can visually see that the video he clicked has the same effect as playing on the original location of the first page.
  • the method further includes: when the new view control is used on the topmost view to play the video at a location where a video view on the first page clicked by the user is located, and is being issued Before the switching instruction, if it is detected that the one video view moves within the interface corresponding to the Activity, controlling the video view to follow the one video view to perform a seamless following moving operation, so that the new view The relative positional relationship between the control and the one video view is unchanged during the moving process; when the video view leaves the interface corresponding to the Activity, the added new view control is removed from the topmost view.
  • this second example can be implemented in conjunction with the first example.
  • the method may further include: recording, on the first page of the video view associated with the specified location area, according to the user clicking on the specified location area on the first page before switching from the first page to the second page Location area information, upon receiving an instruction to return from the second page to the first page, returning from the second page to the first page in response to the return instruction and continuing to maintain the new view control in the topmost view, according to Positioning area information on the first page of the previously recorded video view, adjusting a position of the new view control for playing the video in the topmost view to be described before switching to the second page The original position on the first page of the video view overlaps.
  • the purpose of the third example is to facilitate the user to continue to play other videos after the instruction returns to the first page, without re-creating the view control for video playback, and the new view control that is not removed is in the topmost view.
  • the position in the overlap overlaps with the original position on the first page of the video view that the user clicked before switching to the second page, without obscuring other views.
  • this third example can be implemented freely in conjunction with the first and second examples.
  • the method further includes: after returning from the second page to the first page, removing the added new view control from the topmost view when the user clicks on other non-video views, ie, when When the user clicks on other non-video views, the user may not think that the user does not want to continue watching the video. In this case, the added new view control needs to be removed from the topmost view to avoid the situation where the new view occludes other views. .
  • the method further includes: querying, when the instruction returns from the second page to the first page, whether the new view control in the topmost view is still playing Video, if the new view control in the topmost view is still playing the video at this time, returning from the second page to the first page in response to the return instruction and passing through the topmost view The new view control continues to play the video.
  • the added location may also be removed from the topmost view when the video playback that is still playing continues The new view control.
  • the method may further include: after returning from the second page to the first page, when detecting that the video view on the first page moves within the interface corresponding to the Activity Causing the new view control added to the topmost view to follow the video view seamlessly following the move operation such that the relative positional relationship of the new view control to the video view does not change during the move When the video view leaves the interface corresponding to the Activity, the added new view control is removed from the topmost view.
  • the display size of the new view control that has been added in the topmost view when switching to the second page is customized according to the application scenario.
  • the display size of the new view control that has been added in the topmost view when switching to the second page is the same as the corresponding view size displayed on the first page before switching.
  • the display size of the new view control that has been added to the topmost view when switching to the second page may also be different from the corresponding view size displayed on the first page before switching. , for example, greater than the corresponding view size displayed on the first page before switching.
  • the position of the view control added in the topmost view when switching to the second page is customized according to the application scenario, that is, may be arbitrary The view continues to be displayed in the set position.
  • the position of the view control that has been added in the topmost view when switching to the second page may be in the top area of the topmost view.
  • the page may include a page of a webpage class and a page of a non-webpage class.
  • the plurality of views displayed on the first page and the second page may be slidable.
  • the plurality of views on the first page or the second page displayed on the screen may follow up or down.
  • the first page is a main page
  • the second page is a detail page
  • the method may further include: displaying at least one view on the second page.
  • the at least one view displayed on the second page may include, but is not limited to, a text introduction of the play video, advertisement information, a plurality of videos related to the recommendation, and the like.
  • the method for keeping the video to continue playing after the page is switched according to the third embodiment of the present application can only have one Activity at the same time by means of the currently displayed screen, and an Activity only corresponds to the feature of the topmost view DecorView, and also the view is The view of the upper layer of the tree layout will cover the view of the next layer.
  • the topmost view DecorView is the root view of all windows, always at the top of the entire Window interface, so the first page and the second page are created in the same Activity. Wait for different pages, create a new view control for playing the video and add it to the topmost view, which ensures that the same view is always used to play the video that the user clicked before and after the page switch is executed, and is always in the window interface.
  • the top layer avoids the problem of page hierarchy that needs to be considered before and after page switching, and avoids the need to recreate the first page and the second page in different activities.
  • View control time spent reloading video data, not even To page record before switching play, save working time after switching to the fast-forward playback progress of record-keeping in order to achieve a seamless continuous playback after switching to different pages, but frustrated not occur or pause playback phenomenon.
  • FIG. 5 is a schematic block diagram of an apparatus for maintaining video playback after page switching according to a fourth embodiment of the present application, and the apparatus may also be stored in a memory of the smart mobile terminal (see FIG. 1).
  • an apparatus for maintaining video playback after page switching includes:
  • a first page display module configured to display at least one video view on a first page created by an Activity
  • the video playback instruction monitoring module is configured to monitor the user to click on one of the video views displayed on the first page to issue an instruction to play the video;
  • a video play instruction processing module configured to, in response to the play instruction, create a new view control for video playback and add it to a topmost view in the Activity, using the new view control on the topmost view To play the one video that the user clicked.
  • a page click monitoring module configured to listen to a user click operation on a specified location area associated with the playing video on the first page
  • a page switching command issuing module configured to issue an instruction to switch from the first page to the second page to play the video when the user clicks on the specified location area on the first page
  • a page switching command processing module configured to, in response to the switching instruction, create the second page in the same Activity, and continue over the second page by adding the new view control added to the topmost view Play the video.
  • the first page is constructed using a Fragment class
  • the second page is implemented by using a Fragment class or by a custom View.
  • the new view control for video playback created by the video play instruction processing module is the same size as the one video view clicked by the user, and the new view control for video playback is at the top level.
  • the position in the view is the same as the position of the video view clicked by the user on the first page, thereby achieving overlapping coverage.
  • the new view control for video playback is a VideoView control.
  • the display size of the new view control that has been added in the topmost view when switching to the second page is customized according to the application scenario.
  • the display size of the new view control that has been added in the topmost view when switching to the second page is the same as the corresponding view size displayed on the first page before switching.
  • the position of the view control that has been added in the topmost view when switching to the second page is customized according to the application scenario.
  • the position of the view control that has been added in the topmost view when switching to the second page is at the top area of the topmost view.
  • the smart mobile terminal may pre-store data of the related APP, where the data includes a display size and a position of the video view on the first page, and a display size on the second page. Position, when page switching is performed, the display size and position of the new video control may be determined according to the display size and position of the video view in the corresponding page (the first page or the second page).
  • the page may include a page of a webpage class and a page of a non-webpage class.
  • At least one view is displayed on the second page.
  • the plurality of views displayed on the first page and the second page may be slidable.
  • the first page may be a main page
  • the second page may be a detail page
  • the apparatus may further include: a top-level view obtaining module configured to acquire the top-level view in the Activity before adding the new view control to the top-level view in the Activity.
  • a top-level view obtaining module configured to acquire the top-level view in the Activity before adding the new view control to the top-level view in the Activity.
  • the apparatus may further include: a view scroll processing module configured to use the new view control on the topmost view to play the location of a video view on a first page clicked by the user Video, and before detecting the switching instruction, if it is detected that the one video view moves within the interface corresponding to the Activity, controlling the video view to follow the video view to perform a seamless following moving operation, Having the relative positional relationship of the new view control and the one video view unchanged during the movement; the first view control removal module is configured to be from the topmost layer when the video view is scrolled up or down off the screen The new view control added is removed from the view.
  • a view scroll processing module configured to use the new view control on the topmost view to play the location of a video view on a first page clicked by the user Video, and before detecting the switching instruction, if it is detected that the one video view moves within the interface corresponding to the Activity, controlling the video view to follow the video view to perform a seamless following moving operation, Having the relative positional relationship of the new view control and the one video
  • the device may further include: a second view control removal module configured to, when receiving an instruction to return from the second page to the first page, return to the first page from the second page in response to the return instruction The new view control added is removed from the topmost view.
  • a second view control removal module configured to, when receiving an instruction to return from the second page to the first page, return to the first page from the second page in response to the return instruction The new view control added is removed from the topmost view.
  • the device may further include: a location information recording module configured to record a video view associated with the specified location area according to a user clicking a specified location area on the first page before switching from the first page to the second page a location area information on the first page; the page returns an instruction listening module configured to listen to an instruction issued by the user to return from the second page to the first page; the page returns an instruction processing module configured to respond to the return instruction from the second page Returning to the first page and continuing to keep the new view control in the topmost view, adjusting the new for playing the video according to the location area information on the first page where the previously recorded video view is located The position of the view control in the topmost view overlaps with the original position on the first page of the video view before switching to the second page.
  • a location information recording module configured to record a video view associated with the specified location area according to a user clicking a specified location area on the first page before switching from the first page to the second page a location area information on the first page
  • the page returns an instruction listening module configured to listen to an instruction
  • the device may further include: a third view control removal module configured to return from the second page to the first page, when the user clicks on other non-video views, or when the video that is still playing continues to play The added new view control is removed from the topmost view.
  • a third view control removal module configured to return from the second page to the first page, when the user clicks on other non-video views, or when the video that is still playing continues to play The added new view control is removed from the topmost view.
  • the page return instruction processing module may be further configured to: in response to the monitored return instruction, query whether the new view control in the topmost view is still playing the video, if the topmost view is in use at this time The new view control is still playing the video, returning to the first page from the second page in response to the return instruction and continuing to play the video through the new view control in the topmost view.
  • the device may further include: a view scroll processing module, configured to return from the second page to the first page, and when detecting that the video view on the first page moves within the interface corresponding to the Activity, Having the new view control added to the topmost view follow the video view to seamlessly follow the move operation such that the relative positional relationship of the new view control to the video view does not change during the move;
  • the fourth view control removal module is configured to remove the added new view control from the topmost view when the video view leaves the interface corresponding to the Activity.
  • the apparatus for keeping the video playing after the page switching is provided by creating the first page, the second page, and the like in the same Activity by using the fourth embodiment of the present application. Play the video's new view control and add it to the topmost view, which ensures that the same view is always used to play the user's clicked video before and after the page switch is executed, and is always at the top of the window interface, avoiding the page
  • the page level problem that needs to be considered before and after switching, and avoids the case where the first page and the second page are respectively created in different activities, and the view control for playing the video needs to be re-created after the page is switched, and the video data is reloaded. The time spent, the recording progress is not required before the page is switched, and the working time of fast-forwarding to the playback progress of the saved record is saved, so that seamless continuous playback is achieved after switching between different pages without falling Or pause playback.
  • a computer program product for continuing to display a view after page switching and a method for maintaining video playback after page switching including a computer readable storage medium storing program code
  • the instructions included in the program code may be used to implement the method described in the foregoing method embodiments. For specific implementations, refer to the method embodiments, and details are not described herein.
  • the embodiment of the present application further provides a storage device in which a plurality of instructions are stored, the instructions being adapted to be loaded by a processor and executing the method described in the first embodiment above. Additionally, the instructions are further adapted to be loaded by a processor and to perform a plurality of examples in the first embodiment and a freely combined method of the preferred embodiment.
  • the embodiment of the present application further provides a storage device in which a plurality of instructions are stored, the instructions being adapted to be loaded by a processor and executing the method described in the third embodiment above. Additionally, the instructions are further adapted to be loaded by a processor and to perform the freely combined methods of the plurality of examples and preferred embodiments of the third embodiment.
  • the embodiment of the present application further provides a mobile terminal, including: a processor, configured to load and execute various instructions; and a storage device provided by the embodiment of the present application.
  • the functions may be stored in a computer readable storage medium if implemented in the form of a software functional unit and sold or used as a standalone product. Based on such understanding, the technical solution of the embodiments of the present application, or the part contributing to the prior art or the part of the technical solution, may be embodied in the form of a software product stored in a storage medium.
  • a number of instructions are included to cause a computer device (which may be a personal computer, smart tablet, smartphone, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present application.
  • the foregoing storage medium includes various media that can store program codes, such as a USB flash drive, a removable hard disk, a read only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
  • the method and device for continuing to display a view after page switching, and the method and device for keeping the video to continue playing after the page switching can avoid the page level problem that needs to be considered before and after the page switching, and can avoid the different activities in the activity provided by the embodiment of the present application.
  • it is necessary to re-create the view control for playing the video the time taken to reload the video data after the page is switched, and the recording progress is not required before the page switching, and the operation is omitted. After switching, fast forward to the working time of the saved recording progress, thus achieving seamless continuous playback after switching between different pages without frustration or pause playback.

Abstract

An embodiment of the present application provides a method and an apparatus for continuing to display a view after switching pages. The method comprises: displaying at least one view on a first page created by one activity; if a user click is heard in a specified location sector on the first page, issuing an instruction to switch one view of interest to the user displayed on the first page to a second page for display; and in response to the switching instruction, creating the second page in the same activity, creating a new view control for displaying the one view of interest to the user on the first page and adding the new view control into a top-most view, and then displaying the one view of interest to the user on the second page by means of the new view control added into the top-most view.

Description

一种在页面切换后继续显示视图的方法和装置Method and device for continuing to display view after page switching
相关申请的交叉引用Cross-reference to related applications
本申请要求于2017年07月07日提交中国专利局的申请号为2017105497419,名称为“一种在页面切换后继续显示视图的方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims priority to Chinese Patent Application No. 2017105497419, entitled "A Method and Apparatus for Continued Display of Views After Page Switching", filed on July 07, 2017, the entire contents of which are incorporated by reference. Combined in this application.
技术领域Technical field
本申请涉及计算机技术领域,具体而言,涉及一种在页面切换后继续显示视图的方法和装置。The present application relates to the field of computer technology, and in particular, to a method and apparatus for continuing to display a view after page switching.
背景技术Background technique
随着智能终端的广为使用,尤其是智能移动终端成为人们的日常使用的电子产品,伴随而来的是针对在智能移动终端上运行的各种APP的开发和应用,包括安卓系统和ios系统自身携带的各种应用功能,都已经被用户经常性的启动使用,而在使用过程中常常涉及页面切换。With the widespread use of smart terminals, especially smart mobile terminals have become the daily use of electronic products, accompanied by the development and application of various APPs running on smart mobile terminals, including Android and iOS systems. The various application functions carried by the user have been frequently used by the user, and the page switching is often involved in the use process.
例如,短视频在网络上非常流行,很多网络公司都在不遗余力地推出短视频内容,例如浏览器上提供的视频栏,如UC浏览器、360浏览器等,例如提供资讯类APP上提供的视频栏,如今日头条等,这很适合在移动智能终端上观看。通常,短视频可以在网页上直接播放,一般是在列表内播放,当然也可以全屏播放。除此之外,通过点击短视频窗口底部的详情栏可以进入该短视频的详情页面或者其他包含此短视频播放和详细内容的文字介绍或相似视频推荐信息内容等的新页面来继续播放该短视频,但是在这种网页切换的情况下,即当第一页面A1(例如提供多个短视频列表的网页)上播放短视频B,通过点击跳转到第二页面A2(例如该短视频B的详情页面)上来继续播放视频B时,都会出现顿挫或停顿播放的现象。其原因是:由于安卓系统自身的特性带来的对页面跳转的限制,目前在页面切换后保持原视频继续播放的方法是将第一页面A1上的视频B的播放进度记录保存,在切换至第二页面A2上重新播放视频B时,快进到之前所保存记录的播放进度,从而实现继续播放视频B的目的,而不是从头开始播放。但是,第二页面A2往往是在新的Activity中创建的,此时需要在新的Activity中重新创建用于播放视频的视图控件,需要重新加载视频数据,而在快进到之前所保存记录的播放进度的过程中,也需要花费一定时间,尤其是目前多数用户都喜欢使用智能终端来上网看短视频类资讯,在所使用的智能终端,如智能手机的运算能力较弱时,快进到之前所保存记录的播放进度所需要花费的时间更长,因此顿挫或停顿播放的现象更加明显。For example, short videos are very popular on the Internet, and many online companies are sparing no effort to launch short video content, such as video bars provided on browsers, such as UC browsers, 360 browsers, etc., such as video provided on information apps. Columns, today's headlines, etc., are very suitable for viewing on mobile smart terminals. Usually, short videos can be played directly on a web page, usually in a list, and of course can be played in full screen. In addition, by clicking on the details bar at the bottom of the short video window, you can enter the short page's details page or other new pages containing text descriptions of this short video play and detailed content or similar video recommendation information content to continue playing the short page. Video, but in the case of such web page switching, that is, when the first page A1 (for example, a web page providing a plurality of short video lists) plays the short video B, by clicking to jump to the second page A2 (for example, the short video B) The details page) will continue to play video B, there will be a setback or pause playback. The reason is: due to the limitation of the page jump caused by the characteristics of the Android system, the current method of keeping the original video to continue playing after the page switching is to save the playback progress record of the video B on the first page A1, and switch When the video B is replayed on the second page A2, the playback progress of the previously saved record is fast forwarded, thereby achieving the purpose of continuing to play the video B instead of playing from the beginning. However, the second page A2 is often created in the new Activity. In this case, the view control for playing the video needs to be recreated in the new Activity, and the video data needs to be reloaded, and the record is saved before the fast forward. In the process of playing the progress, it takes a certain amount of time. In particular, most users now like to use smart terminals to view short video information on the Internet. When the smart terminal used, such as a smart phone, has weak computing power, fast forward. It takes longer to play the progress of the previously saved record, so the phenomenon of frustration or pause playback is more obvious.
这种在页面切换后视频停顿式播放会打断用户的视觉体验,在第二页面A2上重新加载播放视频B的时间的不确定性使得用户对当前的视频播放的体验满意度大大降低,导致用户量的流失。This kind of video pause play after the page switch will interrupt the user's visual experience, and the uncertainty of the time of reloading the play video B on the second page A2 makes the user's satisfaction with the current video play experience greatly reduced, resulting in The loss of user volume.
除此之外,图片预览的应用场景,当涉及页面切换后继续显示原始图片时,过渡效果并不太流畅,尤其是在安卓系统下的应用。例如在安卓系统下的某款APP提供的朋友圈功能,当用户在该APP的朋友圈上发布了多张照片,该用户的好友在其朋友圈里首先看到的是这些照片的略缩图,想看照片的原图时需点击该照片的略缩图从而切换到另一个页面上显示该照片的原图,但是在页面切换后继续显示该照 片的原图时的过渡显示效果的流畅性明显不如ios系统下在相同操作的过渡显示效果的流畅性。出现上述现象的原因之一是:安卓系统自身的特性带来的对页面跳转的限制所导致的。In addition, the application scene of the image preview, when the original image is continuously displayed after the page switching is involved, the transition effect is not very smooth, especially in the application of the Android system. For example, in the Android circle, the friend circle function provided by an app, when the user posts a plurality of photos on the friend circle of the APP, the user's friend first sees a thumbnail of the photos in his friend circle. If you want to see the original image of the photo, you need to click on the thumbnail of the photo to switch to the original image of the photo displayed on another page, but the transitional display effect is smooth when the original image of the photo is displayed after the page is switched. It is obviously not as smooth as the transition effect of the same operation under the ios system. One of the reasons for the above phenomenon is caused by the limitations of the page jump caused by the characteristics of the Android system itself.
发明内容Summary of the invention
本申请实施例提供一种在页面切换后继续显示视图的方法和装置,以至少部分地改善上述问题。Embodiments of the present application provide a method and apparatus for continuing to display a view after page switching to at least partially improve the above problem.
本申请第一实施例提供了一种在页面切换后继续显示视图的方法,其包括:The first embodiment of the present application provides a method for continuing to display a view after page switching, including:
在通过一个Activity创建的第一页面上显示至少一个视图;Displaying at least one view on the first page created by an Activity;
当监听到用户点击第一页面上的指定位置区域时发出将第一页面上显示的该用户感兴趣的一个视图切换到第二页面上进行显示的指令;When listening to the user clicking the specified location area on the first page, issuing an instruction to switch a view of the user displayed on the first page to the second page for display;
响应所述切换指令,在该同一个Activity中创建所述第二页面,创建用于显示该用户感兴趣的第一页面上的所述一个视图的新视图控件并将该新视图控件添加到该Activity中的最顶层视图中,然后在该第二页面上方通过添加到所述最顶层视图中的所述新视图控件来显示该用户感兴趣的所述一个视图。Responsive to the switching instruction, creating the second page in the same Activity, creating a new view control for displaying the one view on the first page of interest to the user and adding the new view control to the The topmost view in the activity, and then the one view that is of interest to the user is displayed by the new view control added to the topmost view above the second page.
本申请第二实施例提供了一种在页面切换后保持视频继续播放的方法,其包括:The second embodiment of the present application provides a method for maintaining video playback after page switching, including:
在通过一个Activity创建的第一页面上显示至少一个视频视图;Displaying at least one video view on the first page created by an Activity;
当用户点击第一页面上显示的其中一个视频视图进而发出播放该视频的指令时,响应所述播放指令,创建用于视频播放的新视图控件并将其添加到该Activity中的最顶层视图中,在所述最顶层视图上使用所述新视图控件来播放该用户点击的所述一个视频;When the user clicks on one of the video views displayed on the first page to issue an instruction to play the video, in response to the play instruction, a new view control for video playback is created and added to the topmost view in the Activity. Using the new view control on the topmost view to play the one video clicked by the user;
当监听到所述用户点击所述第一页面上与所述正播放的视频相关联的指定位置区域时发出从第一页面切换到第二页面上进行播放所述视频的指令;An instruction to switch from the first page to the second page to play the video when the user is clicked on the specified location area associated with the playing video on the first page;
响应所述切换指令,在该同一个Activity中创建所述第二页面,在该第二页面上方通过添加到所述最顶层视图中的所述新视图控件来继续播放所述视频。In response to the switching instruction, the second page is created in the same Activity, and the video is continued to be played over the second page by the new view control added to the topmost view.
本申请第三实施例提供了一种在页面切换后继续显示视图的装置,其包括:The third embodiment of the present application provides an apparatus for continuing to display a view after page switching, including:
第一页面显示模块,配置成在通过一个Activity创建的第一页面上显示至少一个视图信息;a first page display module configured to display at least one view information on a first page created by an Activity;
页面点击监听模块,配置成监听用户对第一页面上的指定位置区域的点击操作;The page click monitoring module is configured to monitor the user's click operation on the specified location area on the first page;
页面切换命令发出模块,配置成在监听到用户点击第一页面上的指定位置区域时发出将第一页面上显示的该用户感兴趣的一个视图切换到第二页面上进行显示的指令;a page switching command issuing module configured to, when listening to the user clicking the specified location area on the first page, issue an instruction to switch a view of the user displayed on the first page to the second page for display;
页面切换命令处理模块,配置成响应所述切换指令,在该同一个Activity中创建所述第二页面,创建用于显示该用户感兴趣的第一页面上的所述一个视图的新视图控件并将该新视图控件添加到该Activity中的最顶层视图中,然后在该第二页面上方通过添加到所述最顶层视图中的所述新视图控件来显示该用户感兴趣的所述一个视图。a page switching command processing module configured to, in response to the switching instruction, create the second page in the same Activity, and create a new view control for displaying the one view on the first page of interest to the user and Adding the new view control to the topmost view in the Activity, and then displaying the one view of interest to the user by the new view control added to the topmost view above the second page.
本申请第四实施例提供了一种在页面切换后保持视频继续播放的装置,其包括:The fourth embodiment of the present application provides an apparatus for maintaining video playback after page switching, including:
第一页面显示模块,配置成在通过一个Activity创建的第一页面上显示至少一个视频视图;a first page display module configured to display at least one video view on a first page created by an Activity;
视频播放指令监听模块,配置成监听用户点击第一页面上显示的其中一个视频视图进而发出播放该 视频的指令;a video playback instruction monitoring module configured to listen to a user clicking an image view displayed on the first page to issue an instruction to play the video;
视频播放指令处理模块,配置成响应所述播放指令,创建用于视频播放的新视图控件并将其添加到该Activity中的最顶层视图中,在所述最顶层视图上使用所述新视图控件来播放该用户点击的所述一个视频。a video play instruction processing module configured to, in response to the play instruction, create a new view control for video playback and add it to a topmost view in the Activity, using the new view control on the topmost view To play the one video that the user clicked.
页面点击监听模块,配置成监听用户对所述第一页面上与所述正播放的视频相关联的指定位置区域的点击操作;a page click monitoring module configured to listen to a user click operation on a specified location area associated with the playing video on the first page;
页面切换命令发出模块,配置成在监听到用户点击第一页面上的所述指定位置区域时发出从第一页面切换到第二页面上进行播放所述视频的指令;a page switching command issuing module configured to issue an instruction to switch from the first page to the second page to play the video when the user clicks on the specified location area on the first page;
页面切换命令处理模块,配置成响应所述切换指令,在该同一个Activity中创建所述第二页面,在该第二页面上方通过添加到所述最顶层视图中的所述新视图控件来继续播放所述视频。a page switching command processing module configured to, in response to the switching instruction, create the second page in the same Activity, and continue over the second page by adding the new view control added to the topmost view Play the video.
本申请实施例还提供一种存储设备,其中存储有多条指令,该指令适于由处理器加载并执行如本申请第一实施例提供的在页面切换后继续显示视图的方法。The embodiment of the present application further provides a storage device, where a plurality of instructions are stored, the instruction being adapted to be loaded by a processor and performing a method for continuing to display a view after page switching as provided by the first embodiment of the present application.
本申请实施例还提供一种存储设备,其中存储有多条指令,该指令适于由处理器加载并执行如本申请第二实施例提供的在页面切换后保持视频继续播放的方法。The embodiment of the present application further provides a storage device, where a plurality of instructions are stored, the instruction being adapted to be loaded by a processor and performing a method for keeping the video playing after the page switching is provided by the second embodiment of the present application.
本申请实施例还提供一种智能移动终端,其包括:处理器,配置成加载并执行各种指令;以及本申请提供的存储设备。The embodiment of the present application further provides an intelligent mobile terminal, including: a processor configured to load and execute various instructions; and a storage device provided by the present application.
根据本申请实施例提供的在页面切换后继续显示视图的方法和装置,借助于当前显示的屏幕只能同时存在一个Activity,而一个Activity只对应一个最顶层视图DecorView的特点,还借助了在视图树布局时上一层的视图会覆盖遮挡下一层的视图,最顶层视图DecorView始终处于整个Window界面的最顶层,因此在同一Activity中创建第一页面、第二页面等不同页面,创建用于显示用户感兴趣视图信息的新视图控件并将其添加在最顶层视图中,这样确保了在一个Activity中无论怎么切换页面,都能保证显示效果的视图view始终是在最顶层上,避免了页面切换之前和之后需要考虑的页面层次问题,更避免了在不同Activity中分别创建第一页面、第二页面的情况下,在页面切换后需要重新加载、渲染、显示视图所花费的时间,从而在不同页面切换后实现了视图继续显示效果的平滑过渡等效果。对于在第一页面上播放视频的应用场景,创建用于播放视频的新视图控件并将其添加在最顶层视图中,更避免了在不同Activity中分别创建第一页面、第二页面的情况下,在页面切换后需要重新创建用于播放视频的视图控件、重新加载视频数据所花费的时间,更不需要页面切换之前记录播放进度,省却了切换后快进到所保存记录的播放进度的工作时间,从而在不同页面切换后实现了无缝连续播放,而不会发生顿挫或停顿播放的现象。According to the method and apparatus for continuing to display a view after page switching according to an embodiment of the present application, only one Activity can exist at the same time by means of the currently displayed screen, and an Activity only corresponds to the feature of a top-level view DecorView, and also utilizes the view. The view of the upper layer of the tree layout will cover the view of the next layer. The topmost view DecorView is always at the top of the entire Window interface, so different pages such as the first page and the second page are created in the same Activity, created for A new view control that displays the view information of the user's interest and adds it to the topmost view. This ensures that the view view that guarantees the display effect is always on the top level regardless of how the page is switched in an Activity, avoiding the page. The page level problem that needs to be considered before and after switching, and avoids the time it takes to reload, render, and display the view after the page is switched, when the first page and the second page are respectively created in different activities. After the different pages are switched, the view continues to display the smoothing effect. And other effects. For the application scene in which the video is played on the first page, a new view control for playing the video is created and added in the topmost view, and the first page and the second page are separately created in different activities. After the page is switched, it is necessary to re-create the view control for playing the video, the time taken to reload the video data, and not need to record the playback progress before the page switching, and save the work of fast-forwarding the playback progress of the saved record after switching. Time, which enables seamless continuous playback after switching between different pages without frustration or pause playback.
附图说明DRAWINGS
图1是本申请实施例提供的一种智能移动终端的方框示意图;FIG. 1 is a schematic block diagram of an intelligent mobile terminal according to an embodiment of the present application;
图2是本申请第一实施例提供的在页面切换后继续显示视图的方法的流程图;2 is a flowchart of a method for continuing to display a view after page switching according to the first embodiment of the present application;
图3是本申请第二实施例提供的在页面切换后继续显示视图的装置的示意性框图;3 is a schematic block diagram of an apparatus for continuing to display a view after page switching according to a second embodiment of the present application;
图4是本申请第三实施例提供的在页面切换后保持视频继续播放的方法的流程图;4 is a flowchart of a method for keeping a video to continue playing after a page switch according to a third embodiment of the present application;
图5是本申请第四实施例提供的在页面切换后保持视频继续播放的装置的示意性框图。FIG. 5 is a schematic block diagram of an apparatus for maintaining video playback after page switching according to a fourth embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例和附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅是本申请的一部分实施例,而不是全部的实施例。通常在此处附图中描述和示出的本申请实施例的组件可以以各种不同的配置来布置和设计。因此,以下对在附图中提供的本申请的实施例的详细描述并非旨在限制要求保护的本申请的范围,而是仅仅表示本申请的选定实施例。基于本申请的实施例,本领域技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application are clearly and completely described in the following with reference to the embodiments and the accompanying drawings. It is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. The components of the embodiments of the present application, which are generally described and illustrated in the figures herein, may be arranged and designed in various different configurations. The detailed description of the embodiments of the present application, which is set forth in the claims All other embodiments obtained by a person skilled in the art based on the embodiments of the present application without creative efforts are within the scope of the present application.
请参阅图1,图1示出了本申请实施例提供的一种智能移动终端的方框示意图。智能移动终端可以是智能手机、平板电脑等终端,该智能移动终端基于Android系统运行,并包括存储器、处理器、显示单元及通信单元,所述存储器、处理器、显示单元及通信单元各元件相互直接或间接地电性连接,以实现数据的传输或交互。例如,这些元件相互直接可以通过一条或多条通讯总线或信号线实现电性连接。存储器中存储有上述的在页面切换后继续显示视图的装置包括的至少一个功能模块,处理器配置成在接收到执行指令时,执行存储在存储器中的可执行模块。Please refer to FIG. 1. FIG. 1 is a block diagram showing an intelligent mobile terminal according to an embodiment of the present application. The smart mobile terminal may be a terminal such as a smart phone or a tablet computer, and the smart mobile terminal is operated based on the Android system, and includes a memory, a processor, a display unit, and a communication unit, and the components of the memory, the processor, the display unit, and the communication unit are mutually Directly or indirectly electrically connected to achieve data transmission or interaction. For example, these components can be electrically connected to each other directly through one or more communication buses or signal lines. The memory stores at least one functional module included in the apparatus for continuing to display the view after the page switching, and the processor is configured to execute the executable module stored in the memory upon receiving the execution instruction.
显示单元配置成提供与用户的交互界面,以及配置成显示待显示信息,例如页面文件中的视频信息等。通信单元配置成建立与外部设备之间的通信连接,例如,可以建立电子设备与服务器的通信连接,从而从服务器获得页面文件。The display unit is configured to provide an interactive interface with the user and configured to display information to be displayed, such as video information in a page file, and the like. The communication unit is configured to establish a communication connection with an external device, for example, a communication connection of the electronic device to the server can be established to obtain a page file from the server.
应当理解,图1所示的结构仅为示意,智能移动终端还可以包括比图1所示更多或更少的组件,或是具有与图1所示完全不同的配置,本实施例对此不做限制。此外,图1所示的各组件可以以硬件、软件或其组合实现。It should be understood that the structure shown in FIG. 1 is merely illustrative, and the smart mobile terminal may further include more or less components than those shown in FIG. 1 or have a completely different configuration from that shown in FIG. 1. No restrictions. Moreover, the components shown in FIG. 1 can be implemented in hardware, software, or a combination thereof.
图2是本申请第一实施例提供的在页面切换后继续显示视图的方法的流程图,该方法可以应用于图1所示的智能移动终端。如图2所示,本申请的一种在页面切换后继续显示视图的方法包括:FIG. 2 is a flowchart of a method for continuing to display a view after page switching according to the first embodiment of the present application, and the method can be applied to the smart mobile terminal shown in FIG. 1. As shown in FIG. 2, a method for continuing to display a view after page switching includes:
S1:在通过一个Activity创建的第一页面上显示至少一个视图。S1: Display at least one view on the first page created by an Activity.
Activity是Android组件中最基本的四大组件(Activity、Service服务、ContentProvider内容提供者、BroadcastReceiver广播接收器)之一。一个Activity是用于实现用户与程序进行交互的界面组件,如打电话、拍照片、发邮件、或看地图等。每个Activity就是一个用来描绘用户界面的接口,允许用户在其上创建一个用户界面,通常这个界面是全屏的,但是也可以比屏幕小,还可以浮动在其他窗口的上面。而在用户界面上显示的各种信息是通过View控件来实现的。视图(View)是一个矩形区域,它负责这个区域里的绘制和事件处理。Activity is one of the most basic four components of the Android component (Activity, Service Service, ContentProvider Content Provider, BroadcastReceiver Broadcast Receiver). An Activity is an interface component used to implement user interaction with a program, such as making a call, taking a photo, sending an email, or viewing a map. Each Activity is an interface for depicting the user interface, allowing the user to create a user interface on it. Usually this interface is full screen, but it can be smaller than the screen and can float on top of other windows. The various information displayed on the user interface is implemented by the View control. A View is a rectangular area that is responsible for drawing and event processing in this area.
所述第一页面上显示的至少一个视图信息包括但不限于:视频、图片和文本等。The at least one view information displayed on the first page includes, but is not limited to, a video, a picture, a text, and the like.
本申请第一实施例中所述的页面包括网页类的页面和非网页类的页面。网页类的页面例如可以包括各种浏览器APP上显示的页面,非网页类的页面例如可以包括视频播放器APP(例如优酷APP)上显示的页面、即时通讯类APP(例如钉钉和微信)上显示的页面等等,这里不过多列举。The page described in the first embodiment of the present application includes a page of a webpage type and a page of a non-webpage type. The webpage-like page may include, for example, a page displayed on various browser apps, and the non-page-like page may include, for example, a page displayed on a video player APP (eg, Youku APP), an instant messaging APP (eg, nail and WeChat). The pages displayed on the above, etc., are not listed here.
在通过一个Activity创建的第一页面上显示至少一个视图信息的具体实现方法可以采用本领域技术人员熟知的常规技术来实现,只要确保通过该技术可以在一个Activity上创建多个类似页面即可,例如可以使用Fragment类来构建,这里就不做过多介绍。S2:当监听到用户点击所述第一页面上的指定位置区域时,发出将所述第一页面上显示的该用户感兴趣的一个视图切换到第二页面上进行显示的指令。The specific implementation method of displaying at least one view information on the first page created by an Activity may be implemented by using a conventional technique well known to those skilled in the art, as long as it is ensured that multiple similar pages can be created on one Activity by using the technology. For example, you can use the Fragment class to build, so I won't go into too much here. S2: when listening to the user clicking the specified location area on the first page, issuing an instruction to switch a view of the user displayed on the first page to the second page for display.
系统内部会监听用户在智能移动终端的触摸屏上点击情况,尤其是用户在屏幕上的点击位置是否为第一页面上的指定位置区域,当监听到用户点击第一页面上的指定位置区域时发出将第一页面上显示的该用户感兴趣的一个视图切换到第二页面上进行显示的指令。对于不同第三方应用APP而言,基本上都是通过用户在智能移动终端的触摸屏上点击第一页面上的不同的指定位置区域来发出的,而在该APP中,通常会将用户感兴趣的需要被切换到第二页面上进行显示的所述一个视图与供用户点击的用于指示页面切换的指定位置区域是相关联的,即所述用户感兴趣的一个视图与供用户点击的用于指示页面切换的指定位置区域相关联,这样智能移动终端通过用户点击的指定位置区域就可以知道将要在第二页面上显示哪一个视图,即用户感兴趣的第一页面上显示的所述一个视图。换言之,所述该用户感兴趣的一个视图是所述第一页面上的与用户点击的所述指定位置区域对应的视图。下面举例对此进行说明。The system internally monitors the user's click on the touch screen of the smart mobile terminal, especially whether the click position of the user on the screen is the designated location area on the first page, and is sent when the user clicks on the specified location area on the first page. Switching a view of interest to the user displayed on the first page to an instruction for display on the second page. For different third-party application apps, basically, the user sends out a different specified location area on the first page on the touch screen of the smart mobile terminal, and in the APP, the user is usually interested. The one view that needs to be switched to display on the second page is associated with a specified location area for the user to click to indicate page switching, ie one view that the user is interested in is for the user to click on The specified location area indicating the page switching is associated, so that the smart mobile terminal can know which view is to be displayed on the second page by the specified location area clicked by the user, that is, the one view displayed on the first page of interest to the user. . In other words, the view that the user is interested in is a view on the first page corresponding to the specified location area clicked by the user. The following examples illustrate this.
例如,为了让用户能看到更多信息,提供视频播放或短视频播放的浏览器APP或者视频播放器APP的一个页面上往往会显示多个视图,每个视图上都会显示一个处于待播放状态(例如可以显示用于提示用户点击的
Figure PCTCN2018092828-appb-000001
图案)的视频略缩图,每个视频视图或短视频视图窗口底部为详情栏(详情栏与对应的视频或短视频是相关联的),当监听到用户点击该详情栏时则(通过发出页面切换指令)切换到另一个页面上,在该另一个页面的上部区域准备播放该视频或短视频,可以确定准备在另一个页面上播放的视频或短视频为用户感兴趣的视频或短视频,其与用户点击的详情栏(指定位置区域)是相关联的,同时在该另一个页面的下部区域显示与正播放的视频或短视频相关的详细内容(文字、图片等)或者还包括显示相似视频的推荐信息内容等。除了这种情况之外,在一些应用场景中,还可以通过监听到用户直接点击显示待播放的静态图片的视图(发出页面切换指令)来切换到另一个页面上播放视频或短视频,播放区域在该另一个页面的上部区域,同时在下部区域显示与正播放的视频或短视频相关的详细内容(文字、图片等)或者还包括显示相似视频的推荐信息内容等。
For example, in order to allow users to see more information, a page of a browser app or a video player APP that provides video playback or short video playback often displays multiple views, and each view displays a state to be played. (for example, it can be displayed to prompt the user to click
Figure PCTCN2018092828-appb-000001
Video thumbnail of the pattern), at the bottom of each video view or short video view window is the details bar (the details bar is associated with the corresponding video or short video), when the user is clicked on the details bar (by issuing The page switching instruction) switches to another page, and in the upper area of the other page, the video or short video is ready to be played, and it can be determined that the video or short video to be played on another page is a video or short video that is of interest to the user. , which is associated with the details bar (designated location area) clicked by the user, and displays detailed content (text, picture, etc.) related to the video or short video being played in the lower area of the other page or also includes display Recommended information content of similar videos, etc. In addition to this situation, in some application scenarios, it is also possible to switch to another page to play a video or short video by listening to the user directly clicking on the view of the still picture to be played (issuing a page switching instruction), the playing area. In the upper area of the other page, detailed content (text, picture, etc.) related to the video or short video being played is displayed in the lower area or also includes recommended information content showing similar videos.
再例如,在安卓系统下的能够提供朋友圈功能的即时通讯类APP,如微信,用户看到其好友在朋友圈上发布了多张照片信息时,此时的朋友圈页面上显示的仅仅是照片的略缩图,当监听到该用户点击其中一张略缩图则(通过发出页面切换指令)从当前显示朋友圈上的多个朋友视图的第一页面切换至用于显示所点击略缩图的完整原图的第二页面,即所点击略缩图的原图是在第二页面上绘制并显示的整张照片。For example, in the Android system, an instant messaging app that can provide a circle of friends, such as WeChat, when the user sees that his friend has posted a plurality of photo information on the circle of friends, only the friend circle page displayed at this time is only A thumbnail of the photo, when listening to the user clicking on one of the thumbnails (by issuing a page switching command), switching from the first page of the plurality of friends views currently displayed on the circle of friends to displaying the clicked thumbnail The second page of the complete original image of the figure, that is, the original image of the clicked thumbnail is the entire photo drawn and displayed on the second page.
除了上面通过举例来说明的点击视频视图显示的图片、视频视图窗口的详情栏、略缩图等位置区域可以发生页面切换之外,对于不同的应用场景还会涉及其他位置区域,具体的指定位置区域可以由不同APP开发商自行规定,与本申请实施例的技术方案的实现无关,只要通过监听到用户在第一页面上点击了指定位置区域就能够发出将第一页面上显示的该用户感兴趣(与点击的指定位置区域相关联)的一个视图切换到第二页面上进行显示的指令即可。In addition to the above-mentioned example, the image displayed by the click video view, the detail view bar of the video view window, the thumbnail view, and the like may cause page switching, and other location areas may be involved for different application scenarios, and specific designated locations. The area can be specified by different APP developers, and has nothing to do with the implementation of the technical solution of the embodiment of the present application. As long as the user clicks on the specified location area on the first page, the user can display the user feeling displayed on the first page. A view of the interest (associated with the specified location area of the click) is switched to the instruction displayed on the second page.
S3:响应所述切换指令,在该同一个Activity中创建所述第二页面,创建用于显示该用户感兴趣的第一页面上的所述一个视图的新视图控件并将该新视图控件添加到该Activity中的最顶层视图中,然后在该第二页面上方通过添加到所述最顶层视图中的所述新视图控件来显示该用户感兴趣的所述一个视图。S3: in response to the switching instruction, create the second page in the same Activity, create a new view control for displaying the one view on the first page of interest to the user, and add the new view control Going to the topmost view in the Activity, then displaying the one view that the user is interested in by the new view control added to the topmost view above the second page.
其中,所述切换指令是指步骤S2中的将所述第一页面上显示的该用户感兴趣的一个视图切换到第二页面上进行显示的指令。在该同一个Activity中创建所述第二页面的方法,可以采用本领域技术人员熟知的常规技术来实现,例如使用Fragment类构建第二页面,或者通过自定义View来实现,即自定义View,并使其继承View,重写onDraw()、onMesure()等,这里就不做过多介绍。The switching instruction refers to an instruction in step S2 to switch a view of the user displayed on the first page to a second page for display. The method for creating the second page in the same activity may be implemented by using a conventional technique well known to those skilled in the art, for example, constructing a second page by using a Fragment class, or implementing a custom View, that is, a custom View. And make it inherit View, rewrite onDraw (), onMesure (), etc., here will not be introduced too much.
正如上面而言,所述用户感兴趣的第一页面上的一个视图与该用户在该第一页面上点击的用于指示页面切换的指定位置区域是相关联的,通过用户所点击的指定位置区域就可以知道将要在第二页面上显示哪一个视图,即户感兴趣的第一页面上的所述一个视图。As above, a view on the first page of interest to the user is associated with a specified location area that the user clicked on the first page to indicate page switching, by the specified location clicked by the user. The area knows which view will be displayed on the second page, ie the one view on the first page of interest to the user.
在将所创建的用于显示用户感兴趣的第一页面上的所述一个视图的新视图控件添加到该Activity中的最顶层视图中之前,需要先获取该Activity中的最顶层视图。在本实施例中,可以通过Activity.getWindow().getDecorView()方法来获取该Activity中的最顶层视图(ViewGroup:DecorView)。用户界面中的所有视图是一个树形结构,整个视图树ViewTree的最顶层视图是DecorView。该DecorView也是整个视图树的根节点。DecorView作为整个应用窗口(window)中的最顶层的视图View或者根View,通常包括:状态栏、标题栏、和内容显示界面。在设计页面的视图布局时,通常在内容显示界面上布置自定义的视图显示布局。Before adding the created new view control for displaying the one view on the first page of interest to the user to the topmost view in the Activity, the topmost view in the Activity needs to be obtained first. In this embodiment, the topmost view (ViewGroup: DecorView) in the Activity can be obtained by the Activity.getWindow().getDecorView() method. All views in the user interface are a tree structure, and the topmost view of the entire view tree ViewTree is DecorView. The DecorView is also the root node of the entire view tree. DecorView is the top-level view view or root view in the entire application window. It usually includes: status bar, title bar, and content display interface. When designing the view layout of a page, a custom view display layout is usually placed on the content display interface.
下面将通过具体实例来介绍如何创建用于显示该用户感兴趣的第一页面上的所述一个视图的新视图控件,并将该新视图控件添加到Activity中的最顶层视图中,然后在该第二页面上方通过添加到所述最顶层视图中的所述新视图控件来显示该用户感兴趣的所述一个视图。The following will introduce how to create a new view control for displaying the one view on the first page that the user is interested in, and add the new view control to the topmost view in the Activity, and then The one view above the second page is displayed by the new view control added to the topmost view.
其中,创建用于显示该用户感兴趣的第一页面上的所述一个视图的新视图控件的方法可以采用本领域的常规技术来实现。例如,当用户感兴趣的在第一页面上显示的所述一个视图是图片时,创建用于显示该图片的新视图控件可以是ImageView控件;当用户感兴趣的在第一页面上显示的所述一个视图是文本时,创建用于显示该文本的新视图控件可以是TextView控件;当用户感兴趣的在第一页面上显示的所述一个视图是视频时,创建用于显示播放视频的新视图控件可以是VideoView控件。因为创建ImageView控件、TextView控件、VideoView控件等都是本领域的常规技术,这里不展开介绍了。将该 新视图控件添加到所述最顶层视图中,可以采用addView()方法来实现。这样,因为最后添加在所述最顶层视图中的视图会始终显示在屏幕上而不被遮挡,所以添加到所述最顶层视图中的所述新视图控件将在创建的第二页面上方显示用户感兴趣的所述一个视图。当所述新视图的尺寸小于第二页面时,可以在第二页面上没有被所述新视图遮挡的区域显示其他信息。Wherein, a method of creating a new view control for displaying the one view on the first page of interest to the user may be implemented using conventional techniques in the art. For example, when the one view displayed on the first page that the user is interested in is a picture, the new view control for creating the picture may be an ImageView control; when the user is interested in displaying on the first page When a view is text, a new view control for creating the text may be a TextView control; when the one of the views that the user is interested in displaying on the first page is a video, create a new one for displaying the played video. The view control can be a VideoView control. Because the creation of ImageView control, TextView control, VideoView control, etc. are all conventional techniques in the field, it is not introduced here. Adding this new view control to the topmost view can be done using the addView() method. In this way, because the view that was last added in the topmost view will always be displayed on the screen without being occluded, the new view control added to the topmost view will display the user above the created second page. The one view of interest. When the size of the new view is smaller than the second page, other information may be displayed on the second page that is not obscured by the new view.
这样,本申请第一实施例提供的方法的创新之处在于:在页面发生切换过程中,通过在同一Activity中创建第一页面、第二页面等不同页面,创建用于显示用户感兴趣的视图的新视图控件并将其添加在最顶层视图中,这样在一个Activity中无论怎么切换页面,都能保证显示效果的视图view始终是在最顶层上,避免了页面切换之前和之后需要考虑的页面层次问题,更避免了在不同Activity中分别创建第一页面、第二页面的情况下,在页面切换后需要重新加载、渲染、显示视图所花费的时间,从而在不同页面切换后实现了视图继续显示效果的平滑过渡等效果。In this way, the method provided by the first embodiment of the present application is innovative in that, during the page switching process, a view for displaying the user's interest is created by creating different pages such as the first page and the second page in the same Activity. The new view control and add it to the topmost view, so that in any Activity, no matter how you switch pages, the view view that guarantees the display effect is always on the top level, avoiding the pages that need to be considered before and after the page switch. Hierarchical problems, avoiding the time it takes to reload, render, and display the view after the page is switched, in the case of creating the first page and the second page in different activities, so that the view continues after the different pages are switched. Shows smooth transitions such as effects.
另外,因为所添加的所述新视图控件会遮挡页面上显示的内容,在从第二页面返回到第一页面时,为了避免发生遮挡,可以从最顶层视图中移除所添加的所述新视图控件。由此,在一个可选实施例中,本申请第一实施例提供的方法可以进一步包括:在收到从第二页面返回到第一页面的指令时,响应该返回指令从第二页面返回到第一页面并从最顶层视图中移除所添加的所述新视图控件。通常在第二页面上会显示返回箭头或返回按钮,当用户点击第二页面上显示的返回箭头或返回按钮(也可以称为退回)时,可以视作发出了从第二页面返回到第一页面的指令。从第二页面返回到第一页面为现有第三方应用APP的常见功能,因此其具体实施方法可以使用现有的常规技术来实现。In addition, since the added new view control occludes the content displayed on the page, in order to avoid occlusion when returning from the second page to the first page, the added new one may be removed from the topmost view. View control. Thus, in an optional embodiment, the method provided by the first embodiment of the present application may further include: returning from the second page to the returning instruction in response to the returning instruction from the second page to the first page The first page removes the added new view control from the topmost view. Usually, a return arrow or a return button is displayed on the second page. When the user clicks the return arrow or the return button (also referred to as a bounce) displayed on the second page, it can be regarded as returning from the second page to the first page. The instructions of the page. Returning from the second page to the first page is a common function of the existing third party application APP, so its specific implementation method can be implemented using existing conventional techniques.
下面以视频或短视频播放为例来进一步说明本申请第一实施例提供的方法。The following provides a video or short video playback as an example to further illustrate the method provided by the first embodiment of the present application.
尽管上面介绍了使用VideoView控件作为用于播放视频的视图控件,但是能够用于播放视频的任意视图控件都可以在本申请实施例里使用。为了描述方便,本文将用于视频或短视频播放的任意视图控件称为VideoPlayerView。Although the use of the VideoView control as a view control for playing video has been described above, any view control that can be used to play a video can be used in embodiments of the present application. For the convenience of description, this article refers to any view control for video or short video playback as VideoPlayerView.
在第一实例中,当用户进入某个页面想观看上面显示的视频或短视频时,根据本申请第一实施例提供的方法,首先通过一个Activity创建的第一页面,在该第一页面上显示一个或多个处于待播放状态(例如显示提示用户点击的
Figure PCTCN2018092828-appb-000002
图案)的视频略缩图。当用户想观看第一页面上显示的其中一个视频或短视频的播放和相关详情介绍时,会点击该视频或短视频窗口底部的详情栏,此时智能移动终端的系统可以监听到用户的该点击操作,进而发出切换到第二页面上播放该视频或短视频的切换指令。当然,在某些视频播放APP中可以直接点击视频略缩图实现相同的效果。响应所述切换指令,在该同一个Activity中创建第二页面(即详情页面),创建用于播放视频的新视图控件VideoPlayerView,通过decorView.addView(VideoPlayerView)方法将所创建的视图VideoPlayerView添加到该Activity中的最顶层视图DecorView中,在添加之前针对这个Activity通过Activity.getWindow().getDecorView()方法获取到该最顶层视图DecorView,因为视频或短视频窗口底部的详情栏与该视频或短视频相关联,用户点击详情栏相当于发出了在详情页面(第二页面)上播放该视频或短视频的指令,而所显示该视频或短视频 的视频略缩图包含了指向所述视频或短视频文件的超链接地址,因此在创建后展示给用户的详情页面(第二页面)上方通过添加到所述最顶层视图中的所述新视图控件VideoPlayerView来播放所述视频或短视频。
In the first example, when the user enters a certain page and wants to view the video or short video displayed above, according to the method provided by the first embodiment of the present application, the first page created by an Activity is first used on the first page. Display one or more of the states to be played (for example, the display prompts the user to click
Figure PCTCN2018092828-appb-000002
Video thumbnail of the pattern). When the user wants to watch the playback of one or the short video displayed on the first page and the related details, the user clicks on the details bar at the bottom of the video or short video window, and the system of the smart mobile terminal can monitor the user's Click to operate, and then switch to the second page to play the video or short video switching instructions. Of course, in some video playback apps, you can directly click on the video thumbnail to achieve the same effect. In response to the switching instruction, a second page (ie, a detail page) is created in the same Activity, a new view control VideoPlayerView for playing a video is created, and the created view VideoPlayerView is added to the videoViewer by the decorView.addView(VideoPlayerView) method. The top-level view in the Activity, DecorView, gets the top-level view DecorView for this Activity via the Activity.getWindow().getDecorView() method before adding, because the video or short video window has a detail bar with the video or short video. Correlation, the user clicks on the details bar to send an instruction to play the video or short video on the details page (the second page), and the video thumbnail of the displayed video or short video contains the pointing to the video or short The hyperlink address of the video file, so the video or short video is played over the details page (second page) presented to the user after creation by the new view control VideoPlayerView added to the topmost view.
通过上述过程,第一页面和第二页面位于同一Activity上,在从第一页面切换至第二页面时,用于播放所述视频视图对应的视频的新视图控件是在该同一Activity的最顶层视图创建的,如此,当需要从第二页面切换回第一页面时,可以直接对所述新视图控件的位置和显示尺寸进行改变,而不必再新建Activity、新建视图控件及重新加载正在播放的视频,可以避免页面切换过程中的卡顿问题。Through the above process, the first page and the second page are located on the same Activity. When switching from the first page to the second page, the new view control for playing the video corresponding to the video view is at the top level of the same Activity. The view is created, so that when it is required to switch back to the first page from the second page, the position and display size of the new view control can be directly changed without newly creating an Activity, creating a new view control, and reloading the being played. Video can avoid the jamming problem during page switching.
在第二实例中,用户可以是先在第一页面上点击其中一个视频或短视频进行播放。在播放过程中,点击该视频或短视频窗口底部的详情栏,在系统监听到该点击操作后发出切换到详情页面(第二页面)上播放该视频或短视频的指令。当用户点击的视频或短视频首先在第一页面上播放时,为了保证正在播放的视频或短视频在页面切换后会在第二页面上继续流畅地播放,此时在通过一个Activity创建的第一页面上显示至少一个视频视图;在监听到用户在第一页面上点击其中一个视频略缩图进而发出播放该视频的指令时,先创建用于播放视频的新视图控件VideoPlayerView,通过decorView.addView(VideoPlayerView)方法将所创建的视图控件VideoPlayerView添加到该Activity中的最顶层视图DecorView中,并在该第一页面上方播放用户所点击的视频或短视频。注意,在添加新视图控件VideoPlayerView之前针对这个Activity通过Activity.getWindow().getDecorView()方法获取到该最顶层视图DecorView。此时,为了实现用户从视觉上看到其点击的视频或短视频是在第一页面的原有位置上播放的效果,需要使得该VideoPlayerView的大小(即高度和宽度)与用户点击的视频或短视频的视图大小(即高度和宽度)相同,并且还需要获取该视频或短视频的视图view在第一页面的位置区域信息,根据获得的位置区域信息将播放该视频或短视频的VideoPlayerView放在所述最顶层视图DecorView的相应位置区域上,使得播放短视频的VideoPlayerView在所述最顶层视图DecorView中的位置与在用户在第一页面上点击的视频或短视频的视图view所在的位置重叠覆盖,这使得用户观看正在播放的视频或短视频的效果如同在第一页面的原有位置上播放一样,而不会认为是在另一页面上播放。另外,如果视频或短视频正在第一页面上方播放时,用户在触摸屏幕上做出滑动手势,使得第一页面向上或向下滚动,此时要使得添加在最顶层视图DecorView中的视图VideoPlayerView做无缝跟随滚动操作,以使其位置始终保持与正播放的视频或短视频的视图所在第一页面上的位置重叠覆盖。具体可以通过如下方式实现:In the second example, the user may first click on one of the videos or the short video to play on the first page. During playback, click on the details bar at the bottom of the video or short video window to issue an instruction to play the video or short video on the details page (second page) after the system listens to the click operation. When the video or short video clicked by the user is first played on the first page, in order to ensure that the currently playing video or short video continues to play smoothly on the second page after the page is switched, the first time created by an Activity is created. At least one video view is displayed on one page; when the user is prompted to click on one of the video thumbnails on the first page to issue an instruction to play the video, first create a new view control VideoPlayerView for playing the video, through decorView.addView The (VideoPlayerView) method adds the created view control VideoPlayerView to the topmost view DecorView in the Activity, and plays the video or short video clicked by the user above the first page. Note that the topmost view DecorView is obtained for this Activity via the Activity.getWindow().getDecorView() method before adding the new view control VideoPlayerView. At this time, in order to realize that the user visually sees that the clicked video or the short video is played on the original position of the first page, it is necessary to make the size (ie, height and width) of the VideoPlayerView and the video clicked by the user or The short video has the same view size (ie, height and width), and also needs to obtain the location area information of the view view of the video or short video on the first page, and the VideoPlayerView that plays the video or short video according to the obtained location area information. On the corresponding location area of the topmost view DecorView, the position of the VideoPlayerView playing the short video in the topmost view DecorView overlaps with the position of the view view of the video or short video clicked by the user on the first page Overlay, which allows the user to watch the video being played or the short video as if it were played on the original location of the first page, rather than being played on another page. In addition, if the video or short video is playing over the first page, the user makes a swipe gesture on the touch screen, causing the first page to scroll up or down, in order to make the view VideoPlayerView added in the topmost view DecorView do Seamlessly follow the scrolling operation so that its position remains overlapping with the position on the first page of the video being played or the view of the short video. This can be achieved by:
将所述新视图控件(视图VideoPlayerView)与所述第一页面中用户感兴趣的视频或短视频的视图view(为便于描述,约定为目标视图view)绑定;在系统中对第一页面中的所述目标视图view做全局监听,并为该全局监听注册一对应的回调函数,该回调函数用于在监听到所述目标视图view发生移动时,获取所述目标视图view的最新位置信息,并将所述最新位置信息发送给与所述目标视图view绑定的视图,即所述新视图控件,以触发所述新视图控件按照预定义的动作移动。在本实施例中,可以预定 为控制所述新视图控件移动至与所述目标视图view相同的位置。Binding the new view control (view VideoPlayerView) with a view view of the video or short video of the user in the first page (for the convenience of description, the agreement is the target view view); in the system, in the first page The target view view is globally monitored, and a corresponding callback function is registered for the global listener. The callback function is configured to acquire the latest location information of the target view view when the target view view is monitored. And sending the latest location information to a view bound to the target view view, that is, the new view control, to trigger the new view control to move according to a predefined action. In this embodiment, it may be predetermined to control the new view control to move to the same position as the target view view.
当用户点击正在播放的视频或短视频窗口底部的详情栏时,系统可以监听到用户的该点击操作,进而发出切换到详情页面(第二页面)上播放该视频或短视频的切换指令,响应该切换指令,在该同一个Activity中创建第二页面(即详情页面),在创建后展示给用户的详情页面(第二页面)上方通过添加到所述最顶层视图中的所述新视图控件VideoPlayerView来继续播放所述视频或短视频。根据本申请第一实施例提供的方法,这里执行的继续播放的效果可以实现无缝播放,即无间断、无停顿的继续流畅播放。When the user clicks on the video being played or the details bar at the bottom of the short video window, the system can listen to the user's click operation, and then issue a switching instruction to switch to the video or short video on the details page (second page). The instruction should be switched to create a second page (ie, a detail page) in the same Activity, by the new view control added to the topmost view above the details page (second page) presented to the user after creation VideoPlayerView to continue playing the video or short video. According to the method provided by the first embodiment of the present application, the effect of continuing playback performed here can achieve seamless playback, that is, continuous playback without interruption, without pause.
在上述的第一和第二实例中,在将视图VideoPlayerView添加到最顶层视图中时,该VideoPlayerView的大小(即高度和宽度)与用户感兴趣的在第一页面上的1个视图大小(即高度和宽度)相同。In the first and second examples described above, when the view VideoPlayerView is added to the topmost view, the size (ie, height and width) of the VideoPlayerView is the same as the size of the view on the first page that the user is interested in (ie, Height and width are the same.
另外,在切换到第二页面后,播放所述视频或短视频的VideoPlayerView可以在所述最顶层视图中的任意位置,这样从显示效果看也就位于第二页面上的任意位置。但在上述的第一和第二实例中,因为除了需要播放视频或短视频之外,还需要显示和该视频或短视频相关联的详情信息,所以优选位于屏幕顶部位置的显示区域,即播放所述视频或短视频的VideoPlayerView位于所述最顶层视图的顶部区域,更优选的为竖屏显示方式。In addition, after switching to the second page, the VideoPlayerView playing the video or the short video may be anywhere in the topmost view, so that it is located anywhere on the second page as seen from the display effect. However, in the first and second examples described above, since the detailed information associated with the video or the short video needs to be displayed in addition to the need to play the video or the short video, the display area located at the top position of the screen is preferably played. The VideoPlayerView of the video or short video is located in the top area of the topmost view, more preferably in portrait mode.
关于某一视图的位置区域信息的获取方法可以采用本领域公知的方法实现,例如通过ViewA.getLocationOnScreen(locA)来获取第一页面中视频或短视频的视图View A所在的区域位置,通过计算偏移量在最顶层视图中添加VideoPlayerView时将其放在与View A显示的位置相对应的位置上,从而实现位置上的重叠覆盖。The method for obtaining the location area information of a certain view may be implemented by a method well-known in the art, for example, by using ViewA.getLocationOnScreen(locA) to obtain the location of the video or short video view of the first page, where the view A is located. When the VideoPlayerView is added to the topmost view, it is placed at the position corresponding to the position displayed by View A, thus achieving overlapping coverage of the position.
在与第一或第二实例相结合的第三实例中,假设正在第二页面上方使用VideoPlayerView播放的视频或短视频尚未播放结束,用户指令从第二页面返回到第一页面,为了确保正在播放的视频或短视频在页面返回到第一页面后在第一页面上继续播放的效果,在从第一页面切换至第二页面之前根据用户点击第一页面上的指定位置区域,记录与该指定位置区域相关联(即用户感兴趣的)的视频视图所在第一页面上的位置区域信息;在收到从第二页面返回到第一页面的指令时,响应该返回指令从第二页面返回到第一页面并且继续保持所述新视图控件VideoPlayerView位于所述最顶层视图中,根据之前记录的所述视频视图所在第一页面上的位置区域信息,调整用于播放所述视频或短视频的VideoPlayerView在所述最顶层视图中的位置,以与切换至第二页面之前所述视频或短视频的视图所在第一页面上的原有位置重叠覆盖,这使得用户观看播放的视频或短视频的效果如同在第一页面的原有位置上播放一样。In a third example combined with the first or second instance, assuming that the video or short video being played using the VideoPlayerView above the second page has not finished playing, the user instruction returns from the second page to the first page, in order to ensure that the video is being played. The effect of the video or short video continuing to play on the first page after the page returns to the first page, before the user switches from the first page to the second page, according to the user clicking the specified location area on the first page, recording and specifying Position area information on the first page where the video view of the location area is associated (ie, of interest to the user); upon receiving an instruction to return from the second page to the first page, returning from the second page in response to the return instruction a first page and continue to maintain the new view control VideoPlayerView in the topmost view, and adjust a VideoPlayerView for playing the video or short video according to the previously recorded location area information on the first page of the video view. Position in the topmost view to switch to the second page before the video or short video FIG original position on the page where a first overlapping coverage, which enables a user viewing the video or short video play as played in the original position as on the first page.
在与第一或第二实例相结合的第四实例中,本实施例提供的方法可以进一步包括:当用户感兴趣的在第一页面上显示的所述一个视图是视频时,在从第一页面切换至第二页面之前根据用户点击第一页面上的指定位置区域,记录与该指定位置区域相关联的视频视图所在第一页面上的位置区域信息,在收到从第二页面返回到第一页面的指令时,响应该返回指令从第二页面返回到第一页面并且继续保持所述新视图控件位于所述最顶层视图中,根据之前记录的所述视频视图所在第一页面上的位置区域信息,调整 用于播放所述视频的所述新视图控件在所述最顶层视图中的位置,以与切换至第二页面之前所述视频视图所在第一页面上的原有位置重叠覆盖。In a fourth example in combination with the first or second example, the method provided by the embodiment may further include: when the one view displayed on the first page that is of interest to the user is a video, Before the page is switched to the second page, according to the user clicking the specified location area on the first page, the location area information on the first page of the video view associated with the specified location area is recorded, and the receipt returns from the second page to the first page. Responding to the return instruction from the second page to the first page and continuing to maintain the new view control in the topmost view, according to the previously recorded position on the first page of the video view The area information adjusts a position of the new view control for playing the video in the topmost view to overlap the original position on the first page where the video view is located before switching to the second page.
此外,该第四实例还可以包括:在收到从第二页面返回到第一页面的指令时,查询所述最顶层视图中的所述新视图控件是否还在播放所述视频,如果此时所述最顶层视图中的所述新视图控件还在播放所述视频,则响应该返回指令从第二页面返回到第一页面并且通过所述最顶层视图中的所述新视图控件继续播放所述视频。In addition, the fourth instance may further include: when receiving an instruction to return from the second page to the first page, query whether the new view control in the topmost view is still playing the video, if The new view control in the topmost view is still playing the video, returning to the first page from the second page in response to the return instruction and continuing to play through the new view control in the topmost view Said video.
可选地,在该第四实例描述的不同场景中,还包括:从第二页面返回到第一页面后,当用户点击其他非视频视图时、或者当还在继续播放的视频播放结束时,从所述最顶层视图中移除所添加的所述新视图控件,从而避免所述新视图控件遮挡住其他需要显示的信息。Optionally, in the different scenarios described in the fourth instance, the method further includes: when returning from the second page to the first page, when the user clicks on other non-video views, or when the video playback that is still playing continues, The added new view control is removed from the topmost view to prevent the new view control from obscuring other information that needs to be displayed.
此外,该第四实例还可以包括:从第二页面返回到第一页面后,当用户在屏幕上做出滑动手势以使被覆盖的第一页面上的所述视频视图跟随向上或向下滚动时,智能移动终端可以检测到所述第一页面上的所述视频视图发生移动,此时,所述智能移动终端可以监测所述视频视图是否离开所述Activity对应的界面,如果没有,则控制所述最顶层视图中的所述新视图控件跟随所述第一页面中的所述视频视图做无缝跟随移动操作(在此是与前述的向上或向下滚动操作一致的滚动操作);当所述视频视图向上或向下滚动离开屏幕时,所述智能移动终端可以检测到上所述视频视图离开了所述Activity对应的界面,此时可以从最顶层视图中移除所添加的所述新视图控件。In addition, the fourth example may further include: after returning from the second page to the first page, when the user makes a swipe gesture on the screen to cause the video view on the covered first page to scroll up or down The smart mobile terminal can detect that the video view on the first page is moved. At this time, the smart mobile terminal can monitor whether the video view leaves the interface corresponding to the activity, and if not, control The new view control in the topmost view follows the video view in the first page to perform a seamless follow move operation (here, a scroll operation consistent with the aforementioned up or down scroll operation); When the video view scrolls up or down the screen, the smart mobile terminal may detect that the video view leaves the interface corresponding to the Activity, and the added the top view may be removed from the top view. New view control.
下面再以用户点击缩略图进而在另一个页面上显示一张完整图片的实例来进行说明。The following is an explanation of the example in which the user clicks on the thumbnail and then displays a complete picture on another page.
在第五实例中,例如,在背景技术中提及的用户们早已使用的安卓系统下的某款APP提供的朋友圈上发布拍摄的照片,如风景照片,根据本申请第一实施例提供的方法,首先通过一个Activity创建朋友圈的第一页面,即通过点击朋友圈图标进入相应界面上的第一页面,该第一页面为显示有好友发布的信息的页面,所述发布的信息例如是文字信息、图片信息或文宇与图片信息,而这些信息都是以一个或多个视图进行显示的。当用户想在其智能移动终端上看某个好友在朋友圈上发布的风景照片时,因为在第一页面上显示的是发布的风景照片的略缩图,所以该用户需要在第一页面上点击要看的某张风景照片的略缩图,这样就发出了要切换到第二页面上显示该完整风景照片的切换指令。响应该切换指令,在该同一个Activity中创建第二页面,创建用于显示图片的视图控件,例如ImageView,并将该创建的新视图控件添加到该Activity中的最顶层视图DecorView中,该用于显示图片的新视图控件会读取用户所点击的略缩图所包含指向完整大小图片的超链接地址从而获得完整大小图片的数据,绘制和渲染该完整图片,最后在创建后展示给用户的第二页面上方显示该完整图片,即用户点击的略缩图指向的完整风景照片。另外,在将创建的新视图控件添加到所述最顶层视图DecorView之前,需要先通过Activity.getWindow().getDecorView()方法获取到该Activity中的最顶层的视图decorView。In a fifth example, for example, a photograph taken on a circle of friends provided by an APP under the Android system that has been used by users in the background art, such as a landscape photograph, is provided according to the first embodiment of the present application. The method firstly creates a first page of the circle of friends through an Activity, that is, by clicking a circle of friends icon to enter a first page on the corresponding interface, the first page is a page displaying information published by a friend, and the published information is, for example, Text information, picture information or text and image information, and these information are displayed in one or more views. When a user wants to view a landscape photo posted by a friend on a circle of friends on his smart mobile terminal, since the thumbnail of the published landscape photo is displayed on the first page, the user needs to be on the first page. Click on the thumbnail of a landscape photo you want to see, and you will be given a switch command to switch to the second page to display the full landscape photo. In response to the switching instruction, creating a second page in the same Activity, creating a view control for displaying a picture, such as an ImageView, and adding the created new view control to the topmost view DecorView in the Activity, The new view control for displaying the image reads the hyperlink address of the full-size image contained in the thumbnail image clicked by the user to obtain the data of the full-size image, draws and renders the complete image, and finally displays it to the user after creation. The full picture is displayed at the top of the second page, which is the complete landscape photo pointed by the thumbnail of the user click. In addition, before adding the created new view control to the top-level view DecorView, you need to get the top-level view decorView in the Activity through the Activity.getWindow().getDecorView() method.
关于页面切换后继续显示文本视图的过程,与该第五实例描述的过程类似,本领域技术人员在阅读以上内容后很容易实现,这里不再做过多介绍。The process of continuing to display the text view after the page switching is similar to the process described in the fifth example, and is easily implemented by those skilled in the art after reading the above content, and will not be described too much here.
在所述第一实施例提供的方法中,可选地,所述新视图控件的显示尺寸和位置与当前用户感兴趣的页面(第一页面或第二页面)对应,例如,当用户需要在第一页面上播放所述视频视图时,则所述新视频控件的显示尺寸及位置通常与所述视频视图在所述第一页面中的显示尺寸和位置对应相同(在某些场景下,也可以不同);又如,当用户需要在第二页面上播放所述视频视图时,则所述新视频控件的显示尺寸和位置通常与所述视频视图在所述第二页面中的显示尺寸和位置对应相同(在某些场景下,也可以不同)。在本申请的实施例中,所述移动智能终端的提供该第一页面和该第二页面的相关APP的数据中包括所述视频视图在所述第一页面的显示尺寸和位置,以及在所述第二页面的显示尺寸和位置,其具体数值随APP的具体设计变化而不同,所述智能移动终端可以从远端服务器获得所述APP的数据并保存在本终端的存储器中。在此值得说明的是,对于图片或文本显示,因为要显示更多信息,所以切换到第二页面时添加到所述最顶层视图中的所述新视图控件的显示尺寸,常与切换之前在第一页面上显示的相对应视图尺寸不相同。In the method provided by the first embodiment, optionally, the display size and location of the new view control correspond to a page (first page or second page) of current user interest, for example, when the user needs to When the video view is played on the first page, the display size and position of the new video control are generally the same as the display size and position of the video view in the first page (in some scenarios, Alternatively, when the user needs to play the video view on the second page, the display size and position of the new video control are generally the same as the display size of the video view in the second page. The locations correspond to the same (in some scenarios, they can be different). In the embodiment of the present application, the data of the mobile APP providing the first page and the related APP of the second page includes the display size and location of the video view on the first page, and The display size and location of the second page are different depending on the specific design of the APP. The smart mobile terminal can obtain the data of the APP from the remote server and save it in the memory of the terminal. It is worth noting here that for a picture or text display, because more information is to be displayed, the display size of the new view control added to the topmost view when switching to the second page is often The corresponding view size displayed on the first page is not the same.
在所述第一实施例提供的方法中,可选地,切换到第二页面时添加到所述最顶层视图中的所述新视图控件的显示尺寸,根据横屏显示或竖屏显示而自适应调整,所述新视图可以占据屏幕的一部分区域显示,也可以是全屏显示,例如显示的是完整图片或文本时,适合全屏显示。In the method provided by the first embodiment, optionally, the display size of the new view control added to the topmost view when switching to the second page is self-displayed according to the horizontal screen display or the vertical screen display. Adapting to the adjustment, the new view can occupy a part of the screen display, or can be full-screen display, for example, when displaying a complete picture or text, suitable for full-screen display.
在所述第一实施例提供的方法中,可选地,切换到第二页面时添加到所述最顶层视图中的所述新视图控件的位置根据应用场景不同而自定义设计,即可以在任意设置的位置上继续显示视图。在用户感兴趣的在第一页面上显示的一个视图信息例如是视频的应用场景中,在切换到第二页面时添加到所述最顶层视图中的用于显示播放该视频的所述新视图控件的位置优选在所述最顶层视图的顶部区域。In the method provided by the first embodiment, optionally, the location of the new view control added to the topmost view when switching to the second page is customized according to the application scenario, that is, Continue to display the view at any of the set positions. In a scenario in which a view information displayed on the first page that is of interest to the user is, for example, a video, the new view added to the topmost view for displaying the video when the second page is switched The position of the control is preferably at the top area of the topmost view.
在所述第一实施例提供的方法中,可以在所述第二页面上也可以显示至少一个视图。例如上述以视频播放为例描述的应用场景中,当第二页面为详情页时,在所述第二页面上可以显示出多个视图,包括但不限于:播放视频的文字介绍、广告信息、推荐相关的多个视频等等。而在显示图片或文本时,如果为非全屏显示,也可以在第二页面没有被遮挡的位置区域上显示多个视图,包括但不限于:对图片的文字介绍、广告信息、或者与文本内容相关联的推荐信息等等。In the method provided by the first embodiment, at least one view may also be displayed on the second page. For example, in the application scenario described by taking video playback as an example, when the second page is a detail page, multiple views may be displayed on the second page, including but not limited to: text introduction of the played video, advertisement information, Recommend related videos and more. When displaying a picture or text, if it is not full-screen display, multiple views may be displayed on the area where the second page is not occluded, including but not limited to: text introduction to the picture, advertisement information, or text content. Associated recommendation information and more.
在所述第一实施例提供的方法中,所述第一页面和第二页面上显示的多个视图可以为可滑动的。当用户在触摸屏上发出向上或向下的滑动手势时,屏幕上展示的所述第一页面或第二页面上的多个视图可以跟随向上或向下滑动。In the method provided by the first embodiment, the plurality of views displayed on the first page and the second page may be slidable. When the user issues an upward or downward swipe gesture on the touch screen, the plurality of views on the first page or the second page displayed on the screen may follow up or down.
在上述第一实施例提供的方法中,可选地,所述第一页面为主页面,所述第二页面为详情页面。In the method provided in the foregoing first embodiment, optionally, the first page is a main page, and the second page is a detail page.
以上以各种实例以及优选方式描述了所述第一实施例,本领域技术人员都知道,这些各种实例以及优选方式可以在不发生冲突的情况下进行任意组合,这里不对组合方式做一一列举了。The first embodiment has been described above in various examples and preferred manners, and those skilled in the art will appreciate that these various examples and preferred modes can be combined in any combination without conflict, and the combination is not made here. listed.
本申请第一实施例提供的在页面切换后继续显示视图的方法,借助于当前显示的屏幕只能同时存在一个Activity,而一个Activity只对应一个最顶层视图DecorView的特点,还借助了在视图树布局时上一层的视图会覆盖遮挡下一层的视图,最顶层视图DecorView是所有窗口的根View,始终处于整个 Window界面的最顶层,因此在同一Activity中创建第一页面、第二页面等不同页面,创建用于显示用户感兴趣视图信息的新视图控件并将其添加在最顶层视图中,这样确保了在一个Activity中无论怎么切换页面,都能保证显示效果的视图view始终是在最顶层上,避免了页面切换之前和之后需要考虑的页面层次问题,更避免了在不同Activity中分别创建第一页面、第二页面的情况下,在页面切换后需要重新加载、渲染、显示视图所花费的时间,从而在不同页面切换后实现了视图继续显示效果的平滑过渡等效果。对于在第一页面上播放的视频,在页面切换之后,因为始终使用同一个视图来播放该视频并且始终处于窗口界面的最上层,从而在不同页面切换后实现了无缝连续播放效果。The method for continuing to display a view after page switching according to the first embodiment of the present application can only have one Activity at the same time by means of the currently displayed screen, and an Activity only corresponds to the feature of a top-level view DecorView, and also uses the view tree. The layout of the upper layer will cover the view of the next layer. The topmost view DecorView is the root view of all windows, always at the top of the entire Window interface, so create the first page, the second page, etc. in the same Activity. Different pages, create a new view control for displaying the information of the user's interest and add it to the topmost view. This ensures that the view view that guarantees the display effect is always the most in any activity regardless of how the page is switched. On the top level, it avoids the problem of page hierarchy that needs to be considered before and after page switching, and avoids the need to reload, render, and display the view after page switching after creating the first page and the second page respectively in different activities. Time spent, so that the view continues to display after switching between different pages Smooth transitions such as effects. For the video played on the first page, after the page is switched, since the same view is always used to play the video and is always at the top of the window interface, seamless continuous playback is achieved after switching between different pages.
图3是本申请第二实施例提供的在页面切换后继续显示视图的装置的示意性框图。如图3所示,本申请的一种在页面切换后继续显示视图的装置包括:FIG. 3 is a schematic block diagram of an apparatus for continuing to display a view after page switching according to a second embodiment of the present application. As shown in FIG. 3, an apparatus for continuously displaying a view after page switching includes:
第一页面显示模块,配置成在通过一个Activity创建的第一页面上显示至少一个视图信息;a first page display module configured to display at least one view information on a first page created by an Activity;
页面点击监听模块,配置成监听用户对第一页面上的指定位置区域的点击操作;The page click monitoring module is configured to monitor the user's click operation on the specified location area on the first page;
页面切换命令发出模块,配置成在监听到用户点击第一页面上的指定位置区域时发出将第一页面上显示的该用户感兴趣的一个视图切换到第二页面上进行显示的指令;a page switching command issuing module configured to, when listening to the user clicking the specified location area on the first page, issue an instruction to switch a view of the user displayed on the first page to the second page for display;
页面切换命令处理模块,用于响应所述切换指令,在该同一个Activity中创建所述第二页面,创建用于显示该用户感兴趣的第一页面上的所述一个视图的新视图控件并将该新视图控件添加到该Activity中的最顶层视图中,然后在该第二页面上方通过添加到所述最顶层视图中的所述新视图控件来显示该用户感兴趣的所述一个视图。a page switching command processing module, configured to create the second page in the same Activity in response to the switching instruction, and create a new view control for displaying the one view on the first page of interest to the user and Adding the new view control to the topmost view in the Activity, and then displaying the one view of interest to the user by the new view control added to the topmost view above the second page.
其中,所述第一页面上显示至少一个视图信息可以包括但不限于:视频、图片和文本。The displaying the at least one view information on the first page may include, but is not limited to, a video, a picture, and a text.
其中,所述用户感兴趣的一个视图信息与该用户点击的用于指示页面切换的指定位置区域相关联。The view information that is of interest to the user is associated with a specified location area that the user clicks to indicate page switching.
可选地,所述第一页面是使用Fragment类构建的,所述第二页面是使用Fragment类构建或者通过自定义View来实现。Optionally, the first page is constructed using a Fragment class, and the second page is implemented by using a Fragment class or by a custom View.
其中,当用户感兴趣的在第一页面上显示的所述一个视图是图片时,创建用于显示该图片的新视图控件是ImageView控件;当用户感兴趣的在第一页面上显示的所述一个视图是文本时,创建用于显示该文本的新视图控件是TextView控件;当用户感兴趣的在第一页面上显示的所述一个视图是视频时,创建用于播放视频的新视图控件是VideoView控件。Wherein, when the one view displayed by the user on the first page is a picture, creating a new view control for displaying the picture is an ImageView control; when the user is interested in displaying the first page When a view is text, the new view control that is created to display the text is a TextView control; when the one of the views that the user is interested in displaying on the first page is a video, the new view control for playing the video is created. VideoView control.
其中,所述页面切换后继续显示视图的装置还可以包括:最顶层视图获取模块,配置成在将所述新视图控件添加到该Activity中的最顶层视图中之前,先获取该Activity中的最顶层视图。The device for continuing to display the view after the page switching may further include: a top-level view obtaining module configured to obtain the most of the activities before adding the new view control to the top-level view in the Activity Top view.
可选地,在智能移动终端中预存有所述视频视图在第一页面的显示尺寸和位置以及在第二页面的显示尺寸和位置,页面切换命令处理模块在从第一页面切换到第二页面时可以根据所述视频视图在第二页面中的显示尺寸和位置确定所述最顶层视图中的所述新视图控件的显示尺寸和位置。其中,智能移动终端中预存的显示尺寸和位置可以根据具体应用场景的不同而改变。Optionally, the display size and location of the video view in the first page and the display size and location of the second page are pre-stored in the smart mobile terminal, and the page switching command processing module switches from the first page to the second page. The display size and position of the new view control in the topmost view may be determined according to a display size and location of the video view in the second page. The display size and location pre-stored in the smart mobile terminal may be changed according to specific application scenarios.
可选地,切换到第二页面时添加到所述最顶层视图中的所述新视图控件的显示尺寸,可以根据横屏显示或竖屏显示而自适应调整。Optionally, the display size of the new view control added to the topmost view when switching to the second page may be adaptively adjusted according to the horizontal screen display or the vertical screen display.
其中,当用户感兴趣的在第一页面上显示的所述一个视图信息是视频时,在切换到第二页面时添加到所述最顶层视图中的用于显示播放该视频的所述新视图控件的位置可以在所述最顶层视图的顶部区域。Wherein, when the one view information displayed on the first page that is of interest to the user is a video, the new view added to the topmost view for displaying the video when the second page is switched The position of the control can be in the top area of the topmost view.
可选地,本申请第二实施例中所述的页面可以包括网页类的页面和非网页类的页面。Optionally, the page described in the second embodiment of the present application may include a page of a webpage type and a page of a non-webpage type.
可选地,在所述第二页面上显示至少一个视图。Optionally, at least one view is displayed on the second page.
可选地,所述第一页面和第二页面上显示的多个视图可以被配置为可滑动的。Optionally, the plurality of views displayed on the first page and the second page may be configured to be slidable.
可选地,所述第一页面为主页面,所述第二页面为详情页面。Optionally, the first page is a main page, and the second page is a detail page.
其中,所述装置可以进一步包括:第一视图控件移除模块,配置成在收到从第二页面返回到第一页面的指令时,响应该返回指令从第二页面返回到第一页面并从最顶层视图中移除所添加的所述新视图控件。The device may further include: a first view control removal module configured to, when receiving an instruction to return from the second page to the first page, return to the first page from the second page in response to the return instruction The new view control added is removed from the topmost view.
其中,所述装置还可以包括:位置信息记录模块,配置成当用户感兴趣的在第一页面上显示的所述一个视图信息是视频时,在从第一页面切换至第二页面之前根据用户点击第一页面上的指定位置区域,记录与该指定位置区域相关联的视频视图所在第一页面上的位置区域信息;The device may further include: a location information recording module configured to: when the one view information displayed on the first page that is of interest to the user is a video, according to the user before switching from the first page to the second page Clicking on the specified location area on the first page to record the location area information on the first page of the video view associated with the specified location area;
页面返回指令监听模块,配置成监听用户发出的从第二页面返回到第一页面的指令;The page returns an instruction listening module configured to listen to an instruction issued by the user to return from the second page to the first page;
页面返回指令处理模块,配置成响应监听到的返回指令,从第二页面返回到第一页面并且继续保持所述新视图控件位于所述最顶层视图中,根据之前记录的所述视频视图所在第一页面上的位置区域信息,调整用于播放所述视频的所述新视图控件在所述最顶层视图中的位置,以与切换至第二页面之前所述视频视图所在第一页面上的原有位置重叠覆盖。a page return instruction processing module configured to, in response to the monitored return instruction, return from the second page to the first page and continue to maintain the new view control in the topmost view, according to the previously recorded video view Position area information on a page, adjusting a position of the new view control for playing the video in the topmost view to be the same as on the first page of the video view before switching to the second page There is overlap in position coverage.
其中,所述装置可以进一步包括:第二视图控件移除模块,配置成从第二页面返回到第一页面后,当用户点击其他非视频视图时、或者当还在继续播放的视频播放结束时,从所述最顶层视图中移除所添加的所述新视图控件。The device may further include: a second view control removal module configured to return from the second page to the first page, when the user clicks on other non-video views, or when the video playback that is still playing continues Removing the added new view control from the topmost view.
其中,所述页面返回指令处理模块还可以配置成响应监听到的返回指令,查询所述最顶层视图中的所述新视图控件是否还在播放所述视频,如果此时所述最顶层视图中的所述新视图控件还在播放所述视频,则从第二页面返回到第一页面并且通过所述最顶层视图中的所述新视图控件继续播放所述视频。The page return instruction processing module may be further configured to: in response to the monitored return instruction, query whether the new view control in the topmost view is still playing the video, if the topmost view is in this case The new view control is still playing the video, returning from the second page to the first page and continuing to play the video through the new view control in the topmost view.
其中,所述装置还可以包括:视图滚动处理模块,配置成从第二页面返回到第一页面后,当检测到所述第一页面上的所述视频视图在所述Activity对应的界面内移动时,让添加到所述最顶层视图中的所述新视图控件跟随所述视频视图做无缝跟随移动操作,以使所述新视图控件与所述视频视图的相对位置关系在移动过程中不变;第三视图控件移除模块,配置成当所述视频视图向上或向下滚动离开所述Activity对应的界面时,从所述最顶层视图中移除所添加的所述新视图控件。The device may further include: a view scroll processing module, configured to move from the second page to the first page, and when the video view on the first page is detected to move within the interface corresponding to the activity And causing the new view control added to the topmost view to follow the video view to follow the moving operation seamlessly so that the relative positional relationship between the new view control and the video view is not during the moving process The third view control removes the module, configured to remove the added new view control from the topmost view when the video view scrolls up or down away from the interface corresponding to the Activity.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,在该第二实施例中描述的装置的具 体工作过程,可以参考前述第一实施例中描述的对应过程,前述第一实施例中列举的例子和相关描述,同样适用于解释装置的工作过程,在此不再重复描述。对于第一实施例中以各种实例以及优选方式描述的组合方案,也同样适应于在该第二实施例中描述的装置,即上述各种实例以及优选方式可以在不发生冲突的情况下进行任意组合,这里不对组合方式做一一列举了。A person skilled in the art can clearly understand that for the convenience and brevity of the description, in the specific working process of the device described in the second embodiment, reference may be made to the corresponding process described in the foregoing first embodiment, the foregoing first implementation. The examples and related descriptions listed in the examples are equally applicable to the operation of the interpreting device, and the description will not be repeated here. The combination scheme described in the various embodiments and in the preferred manner in the first embodiment is also adapted to the apparatus described in the second embodiment, that is, the above various examples and preferred modes can be carried out without collision Any combination, here is not a list of combinations.
与上述第一实施例的有益效果相同,本申请第二实施例提供的在页面切换后保持View继续显示的装置,通过在同一Activity中创建第一页面、第二页面等不同页面,创建用于显示用户感兴趣视图信息的新视图控件并将其添加在最顶层视图中,这样确保了在一个Activity中无论怎么切换页面,都能保证显示效果的视图view始终是在最顶层上,避免了页面切换之前和之后需要考虑的页面层次问题,更避免了在不同Activity中分别创建第一页面、第二页面的情况下,在页面切换后需要重新加载、渲染、显示视图所花费的时间,从而在不同页面切换后实现了视图继续显示效果的平滑过渡等效果。对于在第一页面上播放的视频,在页面切换之后,因为始终使用同一个视图来播放该视频并且始终处于窗口界面的最上层,从而在不同页面切换后实现了无缝连续播放效果。The device of the second embodiment of the present application is configured to keep the View from continuing to display after the page is switched, and creates a different page such as the first page and the second page in the same Activity, and is created for use in the second embodiment. A new view control that displays the view information of the user's interest and adds it to the topmost view. This ensures that the view view that guarantees the display effect is always on the top level regardless of how the page is switched in an Activity, avoiding the page. The page level problem that needs to be considered before and after switching, and avoids the time it takes to reload, render, and display the view after the page is switched, when the first page and the second page are respectively created in different activities. After the different pages are switched, the effect of the smooth transition of the view continues to be displayed. For the video played on the first page, after the page is switched, since the same view is always used to play the video and is always at the top of the window interface, seamless continuous playback is achieved after switching between different pages.
图4是本申请第三实施例提供的在页面切换后保持视频继续播放的方法的流程图。如图4所述,本申请的一种在页面切换后保持视频继续播放的方法包括:FIG. 4 is a flowchart of a method for keeping a video to continue playing after a page switch according to a third embodiment of the present application. As shown in FIG. 4, a method for maintaining video playback after page switching includes:
S21:在通过一个Activity创建的第一页面上显示至少一个视频视图。S21: Display at least one video view on the first page created by an Activity.
与第一实施例中的相应步骤S1类似,第一页面可以使用Fragment类来构建,所述第一页面包括网页类的页面和非网页类的页面。可以使用本领域的常规技术实现该步骤S21,这里不再赘述。Similar to the corresponding step S1 in the first embodiment, the first page can be constructed using a Fragment class, which includes pages of a web page class and pages of a non-web page class. This step S21 can be implemented using conventional techniques in the art, and will not be described again here.
S22:当用户点击第一页面上显示的其中一个视频视图进而发出播放该视频的指令时,响应所述播放指令,创建用于视频播放的新视图控件并将其添加到该Activity中的最顶层视图中,在所述最顶层视图上使用所述新视图控件来播放该用户点击的所述一个视频。S22: When the user clicks one of the video views displayed on the first page to issue an instruction to play the video, in response to the play instruction, create a new view control for video playback and add it to the topmost level of the activity. In the view, the new view control is used on the topmost view to play the one video clicked by the user.
针对智能移动终端,在不单独提供例如键盘或鼠标等输入装置的情况下,触摸屏就承担着信息输入和信息显示两项功能。用户想要观看页面上显示的视频,直接在触摸屏幕上点击该视频视图,即可发出播放该视频的指令。在本申请第三实施例的方法里,响应所述播放指令,可以采用本领域常规技术来创建用于视频播放的新视图控件并将其添加到该Activity中的最顶层视图中,这样就能够在所述最顶层视图上使用所述新视图控件来播放该用户点击的所述一个视频。所述用于视频播放的新视图控件可以是VideoView控件。For the smart mobile terminal, the touch screen assumes two functions of information input and information display without separately providing an input device such as a keyboard or a mouse. The user wants to watch the video displayed on the page and click on the video view directly on the touch screen to issue an instruction to play the video. In the method of the third embodiment of the present application, in response to the play instruction, a new view control for video playback can be created and added to the topmost view in the Activity using conventional techniques in the art, so that The new view control is used on the topmost view to play the one video clicked by the user. The new view control for video playback can be a VideoView control.
S23:当监听到所述用户点击所述第一页面上与所述正播放的视频相关联的指定位置区域时发出从第一页面切换到第二页面上进行播放所述视频的指令。S23: Send an instruction to switch the video from the first page to the second page to play the video when the user is clicked on the specified location area on the first page that is associated with the video being played.
与第一实施例中的步骤S2类似,常见的指定位置区域是所述正播放的视频窗口的周边位置,例如视频窗口底部的详情栏。该步骤的实现过程与第一实施例描述的相应过程相同或相似,故不再赘述。Similar to step S2 in the first embodiment, a common designated location area is a peripheral location of the video window being played, such as a detail bar at the bottom of the video window. The implementation process of this step is the same as or similar to the corresponding process described in the first embodiment, and therefore will not be described again.
S24:响应所述切换指令,在该同一个Activity中创建所述第二页面,在该第二页面上方通过添加 到所述最顶层视图中的所述新视图控件来继续播放所述视频。S24: responsive to the switching instruction, creating the second page in the same Activity, and continuing to play the video by adding the new view control added to the topmost view above the second page.
与第一实施例中的步骤S3类似,在该同一个Activity中创建所述第二页面的方法,可以采用本领域技术人员熟知的常规技术来实现,例如使用Fragment类构建第二页面,或者通过自定义View来实现,即自定义View,并使其继承View,重写onDraw()、onMesure()等。Similar to step S3 in the first embodiment, the method of creating the second page in the same Activity may be implemented by a conventional technique well known to those skilled in the art, for example, using the Fragment class to construct a second page, or by Custom View to achieve, that is, customize the View, and make it inherit View, override onDraw (), onMesure () and so on.
这样在切换到第二页面时添加到所述最顶层视图中的所述新视图控件会覆盖在第二页面上方,从而实现了在该第二页面上方通过添加到所述最顶层视图中的所述新视图控件来继续播放所述视频。The new view control added to the topmost view when switching to the second page is overlaid on the second page, thereby enabling the addition to the topmost view above the second page. The new view control is used to continue playing the video.
另外,正如在第一实施例中描述的那样,因为所添加的所述新视图控件会遮挡页面上显示的内容,在从第二页面返回到第一页面时,为了避免发生遮挡,可以从最顶层视图中移除所添加的所述新视图控件。由此,在一个优选实施例中,本申请第三实施例提供的方法进一步包括:在收到从第二页面返回到第一页面的切换指令时,响应该返回指令从第二页面返回到第一页面并从最顶层视图中移除所添加的所述新视图控件。通常在第二页面上会显示返回箭头或返回按钮,当用户点击第二页面上显示的返回箭头或返回按钮(也可以称为退回)时,意味着发出了从第二页面返回到第一页面的指令。从第二页面返回到第一页面为现有第三方应用APP的常见功能,因此其具体实施方法可以使用现有的常规技术来实现。In addition, as described in the first embodiment, since the added new view control occludes the content displayed on the page, when returning from the second page to the first page, in order to avoid occlusion, the most The new view control added is removed from the top-level view. Thus, in a preferred embodiment, the method provided by the third embodiment of the present application further includes: returning from the second page to the second page in response to the return instruction upon receiving the switching instruction returning from the second page to the first page One page and removes the added new view control from the topmost view. A return arrow or a back button is usually displayed on the second page. When the user clicks on the return arrow or the back button displayed on the second page (which may also be referred to as a fallback), it means that the return from the second page to the first page is issued. Instructions. Returning from the second page to the first page is a common function of the existing third party application APP, so its specific implementation method can be implemented using existing conventional techniques.
本申请第三实施例提供的方法的创新之处与第一实施例相类似:在页面发生切换过程中,通过在同一Activity中创建第一页面、第二页面等不同页面,创建用于播放视频的新视图控件并将其添加在最顶层视图中,这样确保了在一个Activity中无论怎么切换页面,都能保证始终使用同一个视图来播放所述视频并且始终处于窗口界面的最上层,避免了页面切换之前和之后需要考虑的页面层次问题,更避免了在不同Activity中分别创建第一页面、第二页面的情况下,在页面切换后需要重新创建用于播放视频的视图控件、重新加载视频数据所花费的时间,更不需要页面切换之前记录播放进度,省却了切换后快进到所保存记录的播放进度的工作时间,从而在不同页面切换后实现了无缝连续播放,而不会发生顿挫或停顿播放的现象。The innovation of the method provided by the third embodiment of the present application is similar to that of the first embodiment: in the process of page switching, creating a video for playing a video by creating different pages such as a first page and a second page in the same Activity. The new view control and add it to the topmost view, which ensures that no matter how you switch pages in an Activity, you can always use the same view to play the video and always be at the top of the window interface, avoiding The page level problem that needs to be considered before and after the page switching, and avoids the case where the first page and the second page are respectively created in different activities, and the view control for playing the video needs to be re-created after the page is switched, and the video is reloaded. The time spent on the data does not require the recording progress before the page is switched. It saves the working time of fast-forwarding to the playback progress of the saved record after switching, so that seamless continuous playback is achieved after switching between different pages without happening. Frustrated or paused.
在所述第三实施例中,对于页面切换之前和之后的视频播放,还存在多种应用情景,下面以具体实例来进行说明,但其中的一些情景与上述第一实施例中描述的情景相同时将不再做详细赘述。In the third embodiment, there are various application scenarios for video playback before and after page switching, which are described below with specific examples, but some of the scenarios are similar to those described in the first embodiment above. At the same time, we will not go into details.
在第一实例中,在响应所述播放指令创建用于视频播放的新视图控件并将其添加到该Activity中的所述最顶层视图中的步骤中,在将该新视图控件添加到该Activity中的最顶层视图中之前,先获取该Activity中的最顶层视图;可以通过Activity.getWindow().getDecorView()方法来获取该Activity中的最顶层视图(ViewGroup:DecorView)。在所述最顶层视图上使用添加的所述新视图控件来播放用户点击的所述一个视频的步骤中,所述用于视频播放的新视图控件与用户点击的所述一个视频视图的大小相同,所述用于视频播放的新视图控件在所述最顶层视图中的位置与用户点击的所述一个视频视图在第一页面上的位置相同,进而实现重叠覆盖。这样的好处是可以使得用户从视觉上看到其点击的视频与在第一页面的原有位置上播放的效果一样。In a first example, in the step of creating a new view control for video playback in response to the play instruction and adding it to the topmost view in the Activity, adding the new view control to the Activity Before the top-level view in the middle, first get the top-level view in the Activity; you can get the top-level view (ViewGroup: DecorView) in the Activity through the Activity.getWindow().getDecorView() method. In the step of playing the one video clicked by the user on the topmost view using the added new view control, the new view control for video playback is the same size as the one video view clicked by the user The position of the new view control for video playback in the topmost view is the same as the position of the one video view clicked by the user on the first page, thereby implementing overlapping coverage. This has the advantage that the user can visually see that the video he clicked has the same effect as playing on the original location of the first page.
在第二实例中,可以进一步包括:当在所述最顶层视图上使用所述新视图控件来在用户点击的第一 页面上的一个视频视图所在的位置上播放所述视频时,并且在发出所述切换指令之前,若检测到所述一个视频视图在所述Activity对应的界面内发生移动,则控制所述视频视图跟随所述一个视频视图做无缝跟随移动操作,以使所述新视图控件与所述一个视频视图的相对位置关系在移动过程中不变;当所述视频视图离开所述Activity对应的界面时,从最顶层视图中移除所添加的所述新视图控件。另外,该第二实例可以与第一实例结合实施。In a second example, the method further includes: when the new view control is used on the topmost view to play the video at a location where a video view on the first page clicked by the user is located, and is being issued Before the switching instruction, if it is detected that the one video view moves within the interface corresponding to the Activity, controlling the video view to follow the one video view to perform a seamless following moving operation, so that the new view The relative positional relationship between the control and the one video view is unchanged during the moving process; when the video view leaves the interface corresponding to the Activity, the added new view control is removed from the topmost view. Additionally, this second example can be implemented in conjunction with the first example.
在第三实例中,可以进一步包括:在从第一页面切换至第二页面之前根据用户点击第一页面上的指定位置区域,记录与该指定位置区域相关联的视频视图所在第一页面上的位置区域信息,在收到从第二页面返回到第一页面的指令时,响应该返回指令从第二页面返回到第一页面并且继续保持所述新视图控件位于所述最顶层视图中,根据之前记录的所述视频视图所在第一页面上的位置区域信息,调整用于播放所述视频的所述新视图控件在所述最顶层视图中的位置,以与切换至第二页面之前所述视频视图所在第一页面上的原有位置重叠覆盖。该第三实例的目的是方便用户在指令返回到第一页面后继续播放其他视频时,无需重新创建用于视频播放的视图控件,而且没有移除的所述新视图控件在所述最顶层视图中的位置与切换至第二页面之前所述用户点击的视频视图所在第一页面上的原有位置重叠覆盖,而不会遮挡其他视图。另外,该第三实例可以与第一和第二实例自由结合实施。In a third example, the method may further include: recording, on the first page of the video view associated with the specified location area, according to the user clicking on the specified location area on the first page before switching from the first page to the second page Location area information, upon receiving an instruction to return from the second page to the first page, returning from the second page to the first page in response to the return instruction and continuing to maintain the new view control in the topmost view, according to Positioning area information on the first page of the previously recorded video view, adjusting a position of the new view control for playing the video in the topmost view to be described before switching to the second page The original position on the first page of the video view overlaps. The purpose of the third example is to facilitate the user to continue to play other videos after the instruction returns to the first page, without re-creating the view control for video playback, and the new view control that is not removed is in the topmost view. The position in the overlap overlaps with the original position on the first page of the video view that the user clicked before switching to the second page, without obscuring other views. Additionally, this third example can be implemented freely in conjunction with the first and second examples.
在第三实例中,还可以进一步包括:从第二页面返回到第一页面后,当用户点击其他非视频视图时从所述最顶层视图中移除所添加的所述新视图控件,即当用户点击其他非视频视图时可以认为该用户不想继续观看视频了,此时需要从所述最顶层视图中移除所添加的所述新视图控件,以避免发生所述新视图遮挡其他视图的情况。In a third example, the method further includes: after returning from the second page to the first page, removing the added new view control from the topmost view when the user clicks on other non-video views, ie, when When the user clicks on other non-video views, the user may not think that the user does not want to continue watching the video. In this case, the added new view control needs to be removed from the topmost view to avoid the situation where the new view occludes other views. .
在第三实例中,在一个应用场景中,可以进一步包括:在收到从第二页面返回到第一页面的指令时,查询所述最顶层视图中的所述新视图控件是否还在播放所述视频,如果此时所述最顶层视图中的所述新视图控件还在播放所述视频,则响应该返回指令从第二页面返回到第一页面并且通过所述最顶层视图中的所述新视图控件继续播放所述视频。In a third example, in an application scenario, the method further includes: querying, when the instruction returns from the second page to the first page, whether the new view control in the topmost view is still playing Video, if the new view control in the topmost view is still playing the video at this time, returning from the second page to the first page in response to the return instruction and passing through the topmost view The new view control continues to play the video.
在第三实例中,在另一个应用场景中,从第二页面返回到第一页面后,还可以当还在继续播放的视频播放结束时,从所述最顶层视图中移除所添加的所述新视图控件。In a third example, in another application scenario, after returning from the second page to the first page, the added location may also be removed from the topmost view when the video playback that is still playing continues The new view control.
在第三实例中,在另一个应用场景中,可以进一步包括:从第二页面返回到第一页面后,当检测到第一页面上的所述视频视图在所述Activity对应的界面内移动时,让添加到所述最顶层视图中的所述新视图控件跟随所述视频视图做无缝跟随移动操作,以使所述新视图控件与所述视频视图的相对位置关系在移动过程中不变;当所述视频视图离开所述Activity对应的界面时,从最顶层视图中移除所添加的所述新视图控件。In a third example, in another application scenario, the method may further include: after returning from the second page to the first page, when detecting that the video view on the first page moves within the interface corresponding to the Activity Causing the new view control added to the topmost view to follow the video view seamlessly following the move operation such that the relative positional relationship of the new view control to the video view does not change during the move When the video view leaves the interface corresponding to the Activity, the added new view control is removed from the topmost view.
在上述第三实施例提供的方法中,可选地,切换到第二页面时已添加在所述最顶层视图中的所述新视图控件的显示尺寸,根据应用场景不同而自定义设计。可选地,切换到第二页面时已添加在所述最顶层视图中的所述新视图控件的显示尺寸,与切换之前在第一页面上显示的相应视图尺寸相同。在用户有 需求的应用场景中,切换到第二页面时已添加在所述最顶层视图中的所述新视图控件的显示尺寸也可以与切换之前在第一页面上显示的相应视图尺寸不相同,例如大于切换之前在第一页面上显示的相应视图尺寸。In the method provided by the foregoing third embodiment, optionally, the display size of the new view control that has been added in the topmost view when switching to the second page is customized according to the application scenario. Optionally, the display size of the new view control that has been added in the topmost view when switching to the second page is the same as the corresponding view size displayed on the first page before switching. In an application scenario where the user has a need, the display size of the new view control that has been added to the topmost view when switching to the second page may also be different from the corresponding view size displayed on the first page before switching. , for example, greater than the corresponding view size displayed on the first page before switching.
在上述第三实施例提供的方法中,可选地,切换到第二页面时已添加在所述最顶层视图中的所述视图控件的位置根据应用场景不同而自定义设计,即可以在任意设置的位置上继续显示视图。可选地,在切换到第二页面时已添加在所述最顶层视图中的所述视图控件的位置可以在所述最顶层视图的顶部区域。In the method provided in the foregoing third embodiment, optionally, the position of the view control added in the topmost view when switching to the second page is customized according to the application scenario, that is, may be arbitrary The view continues to be displayed in the set position. Alternatively, the position of the view control that has been added in the topmost view when switching to the second page may be in the top area of the topmost view.
在上述第三实施例提供的方法中,可选地,所述页面可以包括网页类的页面和非网页类的页面。In the method provided in the foregoing third embodiment, optionally, the page may include a page of a webpage class and a page of a non-webpage class.
在所述第一实施例提供的方法中,所述第一页面和第二页面上显示的多个视图可以为可滑动的。当用户在触摸屏上发出向上或向下的滑动手势时,屏幕上展示的所述第一页面或第二页面上的多个视图可以跟随向上或向下滑动。In the method provided by the first embodiment, the plurality of views displayed on the first page and the second page may be slidable. When the user issues an upward or downward swipe gesture on the touch screen, the plurality of views on the first page or the second page displayed on the screen may follow up or down.
在上述第一实施例提供的方法中,可选地,所述第一页面为主页面,所述第二页面为详情页面。In the method provided in the foregoing first embodiment, optionally, the first page is a main page, and the second page is a detail page.
在上述第三实施例提供的方法中,可选地,所述方法还可以包括:在所述第二页面上显示至少一个视图。当第二页面为详情页时,在所述第二页面上显示的至少一个视图可以包括但不限于:播放视频的文字介绍、广告信息、推荐相关的多个视频等等。In the method provided in the foregoing third embodiment, optionally, the method may further include: displaying at least one view on the second page. When the second page is a detail page, the at least one view displayed on the second page may include, but is not limited to, a text introduction of the play video, advertisement information, a plurality of videos related to the recommendation, and the like.
以上以各种实例以及优选方式描述了所述第三实施例,本领域技术人员都知道,这些各种实例以及优选方式可以在不发生冲突的情况下进行任意组合,这里不对组合方式做一一列举了。The third embodiment has been described above in various examples and preferred manners, and those skilled in the art will appreciate that these various examples and preferred modes can be combined in any combination without conflict, and the combination is not made here. listed.
本申请第三实施例提供的在页面切换后保持视频继续播放的方法,借助于当前显示的屏幕只能同时存在一个Activity,而一个Activity只对应一个最顶层视图DecorView的特点,还借助了在视图树布局时上一层的视图会覆盖遮挡下一层的视图,最顶层视图DecorView是所有窗口的根View,始终处于整个Window界面的最顶层,因此在同一Activity中创建第一页面、第二页面等不同页面,创建用于播放视频的新视图控件并将其添加在最顶层视图中,这样保证了在执行页面切换之前和之后始终使用同一个视图来播放用户点击的视频,并且始终处于窗口界面的最上层,避免了页面切换之前和之后需要考虑的页面层次问题,更避免了在不同Activity中分别创建第一页面、第二页面的情况下,在页面切换后需要重新创建用于播放视频的视图控件、重新加载视频数据所花费的时间,更不需要页面切换之前记录播放,省却了切换后快进到所保存记录的播放进度的工作时间,从而在不同页面切换后实现了无缝连续播放,而不会发生顿挫或停顿播放的现象。The method for keeping the video to continue playing after the page is switched according to the third embodiment of the present application can only have one Activity at the same time by means of the currently displayed screen, and an Activity only corresponds to the feature of the topmost view DecorView, and also the view is The view of the upper layer of the tree layout will cover the view of the next layer. The topmost view DecorView is the root view of all windows, always at the top of the entire Window interface, so the first page and the second page are created in the same Activity. Wait for different pages, create a new view control for playing the video and add it to the topmost view, which ensures that the same view is always used to play the video that the user clicked before and after the page switch is executed, and is always in the window interface. The top layer avoids the problem of page hierarchy that needs to be considered before and after page switching, and avoids the need to recreate the first page and the second page in different activities. View control, time spent reloading video data, not even To page record before switching play, save working time after switching to the fast-forward playback progress of record-keeping in order to achieve a seamless continuous playback after switching to different pages, but frustrated not occur or pause playback phenomenon.
图5是本申请第四实施例提供的在页面切换后保持视频继续播放的装置的示意性框图,该装置也可以存储在所述智能移动终端的存储器中(见图1)。如图5所示,本申请的一种在页面切换后保持视频继续播放的装置包括:FIG. 5 is a schematic block diagram of an apparatus for maintaining video playback after page switching according to a fourth embodiment of the present application, and the apparatus may also be stored in a memory of the smart mobile terminal (see FIG. 1). As shown in FIG. 5, an apparatus for maintaining video playback after page switching includes:
第一页面显示模块,配置成在通过一个Activity创建的第一页面上显示至少一个视频视图;a first page display module configured to display at least one video view on a first page created by an Activity;
视频播放指令监听模块,配置成监听用户点击第一页面上显示的其中一个视频视图进而发出播放该视频的指令;The video playback instruction monitoring module is configured to monitor the user to click on one of the video views displayed on the first page to issue an instruction to play the video;
视频播放指令处理模块,配置成响应所述播放指令,创建用于视频播放的新视图控件并将其添加到该Activity中的最顶层视图中,在所述最顶层视图上使用所述新视图控件来播放该用户点击的所述一个视频。a video play instruction processing module configured to, in response to the play instruction, create a new view control for video playback and add it to a topmost view in the Activity, using the new view control on the topmost view To play the one video that the user clicked.
页面点击监听模块,配置成监听用户对所述第一页面上与所述正播放的视频相关联的指定位置区域的点击操作;a page click monitoring module configured to listen to a user click operation on a specified location area associated with the playing video on the first page;
页面切换命令发出模块,配置成在监听到用户点击第一页面上的所述指定位置区域时发出从第一页面切换到第二页面上进行播放所述视频的指令;a page switching command issuing module configured to issue an instruction to switch from the first page to the second page to play the video when the user clicks on the specified location area on the first page;
页面切换命令处理模块,配置成响应所述切换指令,在该同一个Activity中创建所述第二页面,在该第二页面上方通过添加到所述最顶层视图中的所述新视图控件来继续播放所述视频。a page switching command processing module configured to, in response to the switching instruction, create the second page in the same Activity, and continue over the second page by adding the new view control added to the topmost view Play the video.
可选地,所述第一页面是使用Fragment类构建的,所述第二页面是使用Fragment类构建或者通过自定义View来实现。Optionally, the first page is constructed using a Fragment class, and the second page is implemented by using a Fragment class or by a custom View.
可选地,在所述视频播放指令处理模块创建的用于视频播放的新视图控件与用户点击的所述一个视频视图的大小相同,所述用于视频播放的新视图控件在所述最顶层视图中的位置与用户点击的所述一个视频视图在第一页面上的位置相同,进而实现重叠覆盖。Optionally, the new view control for video playback created by the video play instruction processing module is the same size as the one video view clicked by the user, and the new view control for video playback is at the top level. The position in the view is the same as the position of the video view clicked by the user on the first page, thereby achieving overlapping coverage.
可选地,所述用于视频播放的新视图控件是VideoView控件。Optionally, the new view control for video playback is a VideoView control.
可选地,切换到第二页面时已添加在所述最顶层视图中的所述新视图控件的显示尺寸,根据应用场景不同而自定义设计。对应地,切换到第二页面时已添加在所述最顶层视图中的所述新视图控件的显示尺寸,与切换之前在第一页面上显示的相应视图尺寸相同。可选地,切换到第二页面时已添加在所述最顶层视图中的所述视图控件的位置根据应用场景不同而自定义设计。对应地,切换到第二页面时已添加在所述最顶层视图中的所述视图控件的位置在所述最顶层视图的顶部区域。Optionally, the display size of the new view control that has been added in the topmost view when switching to the second page is customized according to the application scenario. Correspondingly, the display size of the new view control that has been added in the topmost view when switching to the second page is the same as the corresponding view size displayed on the first page before switching. Optionally, the position of the view control that has been added in the topmost view when switching to the second page is customized according to the application scenario. Correspondingly, the position of the view control that has been added in the topmost view when switching to the second page is at the top area of the topmost view.
在本实施例中,智能移动终端中可以预存有相关APP的数据,该数据包括所述视频视图在所述第一页面上的显示尺寸和位置,以及在所述第二页面上的显示尺寸和位置,在进行页面切换时,可以根据相应页面(第一页面或第二页面)中的所述视频视图的显示尺寸和位置确定所述新视频控件的显示尺寸和位置。In this embodiment, the smart mobile terminal may pre-store data of the related APP, where the data includes a display size and a position of the video view on the first page, and a display size on the second page. Position, when page switching is performed, the display size and position of the new video control may be determined according to the display size and position of the video view in the corresponding page (the first page or the second page).
可选地,所述页面可以包括网页类的页面和非网页类的页面。Optionally, the page may include a page of a webpage class and a page of a non-webpage class.
可选地,在所述第二页面上显示至少一个视图。Optionally, at least one view is displayed on the second page.
可选地,所述第一页面和第二页面上显示的多个视图可以为可滑动的。Optionally, the plurality of views displayed on the first page and the second page may be slidable.
可选地,所述第一页面可以为主页面,所述第二页面可以为详情页面。Optionally, the first page may be a main page, and the second page may be a detail page.
其中,所述装置可以进一步包括:最顶层视图获取模块,配置成在将该新视图控件添加到该Activity中的最顶层视图中之前,先获取该Activity中的最顶层视图。The apparatus may further include: a top-level view obtaining module configured to acquire the top-level view in the Activity before adding the new view control to the top-level view in the Activity.
其中,所述装置可以进一步包括:视图滚动处理模块,配置成当在所述最顶层视图上使用所述新视图控件来在用户点击的第一页面上的一个视频视图所在的位置上播放所述视频时,并且在发出所述切换指令之前,若检测到所述一个视频视图在所述Activity对应的界面内发生移动,则控制所述视频视图跟随所述视频视图做无缝跟随移动操作,以使所述新视图控件与所述一个视频视图的相对位置关系在移动过程中不变;第一视图控件移除模块,配置成当所述视频视图向上或向下滚动离开屏幕时,从最顶层视图中移除所添加的所述新视图控件。Wherein, the apparatus may further include: a view scroll processing module configured to use the new view control on the topmost view to play the location of a video view on a first page clicked by the user Video, and before detecting the switching instruction, if it is detected that the one video view moves within the interface corresponding to the Activity, controlling the video view to follow the video view to perform a seamless following moving operation, Having the relative positional relationship of the new view control and the one video view unchanged during the movement; the first view control removal module is configured to be from the topmost layer when the video view is scrolled up or down off the screen The new view control added is removed from the view.
其中,所述装置还可以包括:第二视图控件移除模块,配置成在收到从第二页面返回到第一页面的指令时,响应该返回指令从第二页面返回到第一页面并从最顶层视图中移除所添加的所述新视图控件。The device may further include: a second view control removal module configured to, when receiving an instruction to return from the second page to the first page, return to the first page from the second page in response to the return instruction The new view control added is removed from the topmost view.
其中,所述装置还可以包括:位置信息记录模块,配置成在从第一页面切换至第二页面之前根据用户点击第一页面上的指定位置区域,记录与该指定位置区域相关联的视频视图所在第一页面上的位置区域信息;页面返回指令监听模块,配置成监听用户发出的从第二页面返回到第一页面的指令;页面返回指令处理模块,配置成响应该返回指令从第二页面返回到第一页面并且继续保持所述新视图控件位于所述最顶层视图中,根据之前记录的所述视频视图所在第一页面上的位置区域信息,调整用于播放所述视频的所述新视图控件在所述最顶层视图中的位置,以与切换至第二页面之前所述视频视图所在第一页面上的原有位置重叠覆盖。The device may further include: a location information recording module configured to record a video view associated with the specified location area according to a user clicking a specified location area on the first page before switching from the first page to the second page a location area information on the first page; the page returns an instruction listening module configured to listen to an instruction issued by the user to return from the second page to the first page; the page returns an instruction processing module configured to respond to the return instruction from the second page Returning to the first page and continuing to keep the new view control in the topmost view, adjusting the new for playing the video according to the location area information on the first page where the previously recorded video view is located The position of the view control in the topmost view overlaps with the original position on the first page of the video view before switching to the second page.
其中,所述装置还可以进一步包括:第三视图控件移除模块,配置成从第二页面返回到第一页面后,当用户点击其他非视频视图时、或者当还在继续播放的视频播放结束时,从所述最顶层视图中移除所添加的所述新视图控件。The device may further include: a third view control removal module configured to return from the second page to the first page, when the user clicks on other non-video views, or when the video that is still playing continues to play The added new view control is removed from the topmost view.
其中,页面返回指令处理模块还可以配置成响应监听到的返回指令,查询所述最顶层视图中的所述新视图控件是否还在播放所述视频,如果此时所述最顶层视图中的所述新视图控件还在播放所述视频,则响应该返回指令从第二页面返回到第一页面并且通过所述最顶层视图中的所述新视图控件继续播放所述视频。The page return instruction processing module may be further configured to: in response to the monitored return instruction, query whether the new view control in the topmost view is still playing the video, if the topmost view is in use at this time The new view control is still playing the video, returning to the first page from the second page in response to the return instruction and continuing to play the video through the new view control in the topmost view.
其中,所述装置还可以包括:视图滚动处理模块,配置成从第二页面返回到第一页面后,当检测到第一页面上的所述视频视图在所述Activity对应的界面内移动时,让添加到所述最顶层视图中的所述新视图控件跟随所述视频视图做无缝跟随移动操作,以使所述新视图控件与所述视频视图的相对位置关系在移动过程中不变;第四视图控件移除模块,配置成当所述视频视图离开所述Activity对应的界面时,从最顶层视图中移除所添加的所述新视图控件。The device may further include: a view scroll processing module, configured to return from the second page to the first page, and when detecting that the video view on the first page moves within the interface corresponding to the Activity, Having the new view control added to the topmost view follow the video view to seamlessly follow the move operation such that the relative positional relationship of the new view control to the video view does not change during the move; The fourth view control removal module is configured to remove the added new view control from the topmost view when the video view leaves the interface corresponding to the Activity.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,在该第四实施例中描述的装置的具体工作过程,可以参考前述第三实施例中描述的对应过程,前述第三实施例中列举的例子和相关描述同样适用于解释装置的工作过程,在此不再重复描述。对于第三实施例中以各种实例以及优选方式描述的组合方案,也同样适应于在该第四实施例中描述的装置,即上述各种实例以及优选方式可以在不发生冲突的情况下进行任意组合,这里不对组合方式做一一列举了。A person skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the device described in the fourth embodiment can refer to the corresponding process described in the foregoing third embodiment, the foregoing third implementation. The examples and related descriptions listed in the examples are equally applicable to the operation of the interpreting device, and the description will not be repeated here. The combination scheme described in the various embodiments and the preferred manner in the third embodiment is also applicable to the apparatus described in the fourth embodiment, that is, the above various examples and preferred modes can be performed without collision Any combination, here is not a list of combinations.
与上述第三实施例的有益效果相同,本申请第四实施例提供的在页面切换后保持视频继续播放的装置,通过在同一Activity中创建第一页面、第二页面等不同页面,创建用于播放视频的新视图控件并将其添加在最顶层视图中,这样保证了在执行页面切换之前和之后始终使用同一个视图来播放用户点击的视频,并且始终处于窗口界面的最上层,避免了页面切换之前和之后需要考虑的页面层次问题,更避免了在不同Activity中分别创建第一页面、第二页面的情况下,在页面切换后需要重新创建用于播放视频的视图控件、重新加载视频数据所花费的时间,更不需要页面切换之前记录播放进度,省却了切换后快进到所保存记录的播放进度的工作时间,从而在不同页面切换后实现了无缝连续播放,而不会发生顿挫或停顿播放的现象。The apparatus for keeping the video playing after the page switching is provided by creating the first page, the second page, and the like in the same Activity by using the fourth embodiment of the present application. Play the video's new view control and add it to the topmost view, which ensures that the same view is always used to play the user's clicked video before and after the page switch is executed, and is always at the top of the window interface, avoiding the page The page level problem that needs to be considered before and after switching, and avoids the case where the first page and the second page are respectively created in different activities, and the view control for playing the video needs to be re-created after the page is switched, and the video data is reloaded. The time spent, the recording progress is not required before the page is switched, and the working time of fast-forwarding to the playback progress of the saved record is saved, so that seamless continuous playback is achieved after switching between different pages without falling Or pause playback.
本申请实施例所提供的一种在页面切换后继续显示视图的方法以及一种在页面切换后保持视频继续播放的方法的计算机程序产品,包括存储了程序代码的计算机可读存储介质,所述程序代码包括的指令可用于执行前面方法实施例中所述的方法,具体实现可参见方法实施例,在此不再赘述。A computer program product for continuing to display a view after page switching and a method for maintaining video playback after page switching, including a computer readable storage medium storing program code, The instructions included in the program code may be used to implement the method described in the foregoing method embodiments. For specific implementations, refer to the method embodiments, and details are not described herein.
由此,本申请实施例还提供了一种存储设备,其中存储有多条指令,所述指令适于由处理器加载并执行上述第一实施例所述的方法。另外,所述指令还适于由处理器加载并执行第一实施例中的多个实例和优选实施例的自由组合后的方法。Thus, the embodiment of the present application further provides a storage device in which a plurality of instructions are stored, the instructions being adapted to be loaded by a processor and executing the method described in the first embodiment above. Additionally, the instructions are further adapted to be loaded by a processor and to perform a plurality of examples in the first embodiment and a freely combined method of the preferred embodiment.
本申请实施例还提供了一种存储设备,其中存储有多条指令,所述指令适于由处理器加载并执行上述第三实施例所述的方法。另外,所述指令还适于由处理器加载并执行第三实施例中的多个实例和优选实施例的自由组合后的方法。The embodiment of the present application further provides a storage device in which a plurality of instructions are stored, the instructions being adapted to be loaded by a processor and executing the method described in the third embodiment above. Additionally, the instructions are further adapted to be loaded by a processor and to perform the freely combined methods of the plurality of examples and preferred embodiments of the third embodiment.
本申请实施例还提供了一种移动终端,其包括:处理器,用于加载并执行各种指令;以及本申请实施例提供的存储设备。The embodiment of the present application further provides a mobile terminal, including: a processor, configured to load and execute various instructions; and a storage device provided by the embodiment of the present application.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,智能平板电脑,智能手机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM)、随机存取存储器(RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The functions may be stored in a computer readable storage medium if implemented in the form of a software functional unit and sold or used as a standalone product. Based on such understanding, the technical solution of the embodiments of the present application, or the part contributing to the prior art or the part of the technical solution, may be embodied in the form of a software product stored in a storage medium. A number of instructions are included to cause a computer device (which may be a personal computer, smart tablet, smartphone, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present application. The foregoing storage medium includes various media that can store program codes, such as a USB flash drive, a removable hard disk, a read only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
以上所述,仅为本申请实施例的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请实施例揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The foregoing is only a specific embodiment of the embodiments of the present application, but the scope of protection of the present application is not limited thereto, and any person skilled in the art can easily think of changes within the technical scope disclosed in the embodiments of the present application. Or, replacement, should be covered by the scope of protection of this application. Therefore, the scope of protection of the present application should be determined by the scope of the claims.
工业实用性Industrial applicability
本申请实施例提供的在页面切换后继续显示视图的方法和装置,以及在页面切换后保持视频继续播 放的方法和装置,能够避免页面切换前后需要考虑的页面层次问题,以及能够避免在不同Activity中分别创建第一页面、第二页面的情况下,在页面切换后需要重新创建用于播放视频的视图控件、重新加载视频数据所花费的时间,也不需要页面切换之前记录播放进度,省却了切换后快进到所保存记录的播放进度的工作时间,从而在不同页面切换后实现了无缝连续播放,而不会发生顿挫或停顿播放的现象。The method and device for continuing to display a view after page switching, and the method and device for keeping the video to continue playing after the page switching, can avoid the page level problem that needs to be considered before and after the page switching, and can avoid the different activities in the activity provided by the embodiment of the present application. In the case where the first page and the second page are respectively created, it is necessary to re-create the view control for playing the video, the time taken to reload the video data after the page is switched, and the recording progress is not required before the page switching, and the operation is omitted. After switching, fast forward to the working time of the saved recording progress, thus achieving seamless continuous playback after switching between different pages without frustration or pause playback.

Claims (35)

  1. 一种在页面切换后继续显示视图的方法,其特征在于,该方法包括:A method for continuing to display a view after page switching, wherein the method comprises:
    在通过一个Activity创建的第一页面上显示至少一个视图;Displaying at least one view on the first page created by an Activity;
    当监听到用户点击所述第一页面上的指定位置区域时,发出将所述第一页面上显示的该用户感兴趣的一个视图切换到第二页面上进行显示的指令;When it is monitored that the user clicks on the specified location area on the first page, an instruction to switch a view of the user displayed on the first page to the second page for display is issued;
    响应所述切换指令,在该同一个Activity中创建所述第二页面,创建用于显示该用户感兴趣的所述第一页面上的所述一个视图的新视图控件并将该新视图控件添加到该Activity中的最顶层视图中,然后在该第二页面上方通过添加到所述最顶层视图中的所述新视图控件来显示该用户感兴趣的所述一个视图。Responsive to the switching instruction, creating the second page in the same Activity, creating a new view control for displaying the one view on the first page of interest to the user and adding the new view control Going to the topmost view in the Activity, then displaying the one view that the user is interested in by the new view control added to the topmost view above the second page.
  2. 根据权利要求1所述的方法,其特征在于,所述方法应用于智能移动终端,所述智能移动终端中预存有所述用户感兴趣的一个视图与该用户点击的用于指示页面切换的所述指定位置区域的关联关系。The method according to claim 1, wherein the method is applied to an intelligent mobile terminal, wherein the smart mobile terminal prestores a view that is of interest to the user and a location that the user clicks to indicate page switching. The relationship of the specified location area.
  3. 根据权利要求2所述的方法,其特征在于,所述智能移动终端中还预存有所述一个视图在所述第二页面中的显示尺寸和位置;在该第二页面上方通过添加到所述最顶层视图中的所述新视图控件来显示该用户感兴趣的所述一个视图,包括:将所述新视图控件调整为所述一个视图在所述第二页面中的显示尺寸,并将调整后的新视图控件移动到所述一个视图在所述第二页面的位置,以对该用户感兴趣的所述一个视图进行显示。The method according to claim 2, wherein the smart mobile terminal further prestores a display size and a position of the one view in the second page; by adding to the second page The new view control in the topmost view to display the one view that the user is interested in, including: adjusting the new view control to a display size of the one view in the second page, and adjusting The subsequent new view control moves to the location of the one view at the second page to display the one view of interest to the user.
  4. 根据权利要求1-3中任一项所述的方法,其特征在于,所述方法还包括:在将所述新视图控件添加到该Activity中的最顶层视图中之前,先获取该Activity中的最顶层视图。The method according to any one of claims 1 to 3, wherein the method further comprises: obtaining the new view control before adding it to the topmost view in the Activity The topmost view.
  5. 根据权利要求1所述的方法,其特征在于,切换到第二页面时添加到所述最顶层视图中的所述新视图控件的显示尺寸,根据应用场景不同而自定义设计;切换到第二页面时添加到所述最顶层视图中的所述新视图控件的位置根据应用场景不同而自定义设计。The method according to claim 1, wherein the display size of the new view control added to the topmost view when switching to the second page is customized according to the application scenario; switching to the second The position of the new view control added to the topmost view at the time of the page is customized according to the application scenario.
  6. 根据权利要求1-5中任一项所述的方法,其特征在于,该方法还包括:在收到从所述第二页面返回到所述第一页面的指令时,响应该返回指令从所述第二页面返回到所述第一页面并从所述最顶层视图中移除所添加的所述新视图控件。A method according to any one of claims 1 to 5, further comprising: responding to the return instruction from the instruction upon receiving an instruction to return from the second page to the first page The second page returns to the first page and removes the added new view control from the topmost view.
  7. 根据权利要求1-6中任一项所述的方法,其特征在于,该方法还包括:当用户感兴趣的在第一页面上显示的所述一个视图是视频时,在从所述第一页面切换至所述第二页面之前,根据用户点击所述第一页面上的指定位置区域,记录与该指定位置区域相关联的视频视图所在第一页面上的位置区域信息;在收到从所述第二页面返回到所述第一页面的指令时,响应该返回指令从所述第二页面返回到所述第一页面并且继续保持所述新视图控件位于所述最顶层视图中,根据之前记录的所述视频视图所在第一页面上的位置区域信息,调整用于播放所述视频的所述新视图控件在所述最顶层视图中的位置,以与切换至第二页面之前所述视频视图所在第一页面上的原有位置重叠覆盖。The method according to any one of claims 1 to 6, wherein the method further comprises: when the one view displayed on the first page of interest by the user is a video, from the first Before the page is switched to the second page, according to the user clicking the specified location area on the first page, the location area information on the first page where the video view associated with the specified location area is located is recorded; Returning the second page to the instruction of the first page, returning from the second page to the first page in response to the return instruction, and continuing to keep the new view control in the topmost view, according to Recording location area information on the first page where the video view is located, adjusting a position of the new view control for playing the video in the topmost view, and the video before switching to the second page The original location on the first page of the view overlaps.
  8. 根据权利要求7所述的方法,其特征在于,该方法还包括:在收到从所述第二页面返回到所述第一页面的指令时,查询所述最顶层视图中的所述新视图控件是否还在播放所述视频,如果此时所述最顶层视图中的所述新视图控件还在播放所述视频,则响应该返回指令从所述第二页面返回到所述第一页面并且通过所述最顶层视图中的所述新视图控件继续播放所述视频。The method of claim 7, further comprising: querying said new view in said topmost view upon receiving an instruction to return from said second page to said first page Whether the control is still playing the video, and if the new view control in the topmost view is still playing the video at this time, returning from the second page to the first page in response to the return instruction The video continues to be played through the new view control in the topmost view.
  9. 根据权利要求7所述的方法,其特征在于,该方法还包括:从所述第二页面返回到所述第一页面后,当检测到所述第一页面上的所述视频视图在所述Activity对应的界面内移动时,控制所述新视图控件跟随所述视频视图做无缝跟随移动操作,以使所述新视图控件与所述视频视图的相对位置关系在移动过程中不变;当检测到所述视频视图离开所述Activity对应的界面时,从最顶层视图中移除所添加的所述新视图控件。The method according to claim 7, further comprising: after returning from the second page to the first page, when detecting that the video view on the first page is in the When moving in the interface corresponding to the activity, controlling the new view control to follow the video view to seamlessly follow the moving operation, so that the relative positional relationship between the new view control and the video view does not change during the moving process; When it is detected that the video view leaves the interface corresponding to the Activity, the added new view control is removed from the topmost view.
  10. 一种在页面切换后保持视频继续播放的方法,其特征在于,该方法包括:A method for keeping a video playing after a page switch is characterized in that the method includes:
    在通过一个Activity创建的第一页面上显示至少一个视频视图;Displaying at least one video view on the first page created by an Activity;
    当用户点击第一页面上显示的其中一个视频视图进而发出播放该视频的指令时,响应所述播放指令,创建用于视频播放的新视图控件并将其添加到该Activity中的最顶层视图中,在所述最顶层视图上使用所述新视图控件来播放该用户点击的所述一个视频;When the user clicks on one of the video views displayed on the first page to issue an instruction to play the video, in response to the play instruction, a new view control for video playback is created and added to the topmost view in the Activity. Using the new view control on the topmost view to play the one video clicked by the user;
    当监听到所述用户点击所述第一页面上与所述正播放的视频相关联的指定位置区域时发出从所述第一页面切换到第二页面上进行播放所述视频的指令;An instruction to switch from the first page to the second page to play the video when the user is clicked on the specified location area associated with the playing video on the first page;
    响应所述切换指令,在该同一个Activity中创建所述第二页面,在该第二页面上方通过添加到所述最顶层视图中的所述新视图控件来继续播放所述视频。In response to the switching instruction, the second page is created in the same Activity, and the video is continued to be played over the second page by the new view control added to the topmost view.
  11. 根据权利要求10所述的方法,其特征在于,响应所述播放指令创建用于视频播放的新视图控件并将其添加到该Activity中的所述最顶层视图中,包括:在将该新视图控件添加到该Activity中的最顶层视图中之前,先获取该Activity中的最顶层视图;The method of claim 10, wherein creating a new view control for video playback in response to the play instruction and adding it to the topmost view in the Activity comprises: in the new view Before the control is added to the topmost view in the Activity, the topmost view in the Activity is obtained first;
    在所述最顶层视图上使用添加的所述新视图控件来播放用户点击的所述一个视频,包括:所述用于视频播放的新视图控件与用户点击的所述一个视频视图的大小相同,所述用于视频播放的新视图控件在所述最顶层视图中的位置与用户点击的所述一个视频视图在第一页面上的位置相同,进而实现重叠覆盖。Playing the one video clicked by the user on the topmost view using the added new view control, including: the new view control for video playback is the same size as the one video view clicked by the user, The position of the new view control for video playback in the topmost view is the same as the position of the one video view clicked by the user on the first page, thereby achieving overlapping coverage.
  12. 根据权利要求10或11所述的方法,其特征在于,该方法应用于智能终端,所述智能移动终端中还预存有所述一个视图在所述第二页面中的显示尺寸和位置;在该第二页面上方通过添加到所述最顶层视图中的所述新视图控件来显示该用户感兴趣的所述一个视图,包括:将所述新视图控件调整为所述一个视图在所述第二页面中的显示尺寸,并将调整后的新视图控件移动到所述一个视图在所述第二页面的位置,以对该用户感兴趣的所述一个视图进行显示。The method according to claim 10 or 11, wherein the method is applied to a smart terminal, and the smart mobile terminal further prestores a display size and a position of the one view in the second page; Displaying the one view of interest to the user by the new view control added to the topmost view above the second page includes: adjusting the new view control to the one view at the second The display size in the page, and the adjusted new view control is moved to the position of the one view at the second page to display the one view of interest to the user.
  13. 根据权利要求10所述的方法,其特征在于,切换到第二页面时已添加在所述最顶层视图中的所述新视图控件的显示尺寸,根据应用场景不同而自定义设计;切换到第二页面时已添加在所述最顶层 视图中的所述视图控件的位置根据应用场景不同而自定义设计。The method according to claim 10, wherein the display size of the new view control that has been added in the topmost view when switching to the second page is customized according to the application scenario; The position of the view control that has been added in the topmost view at the time of two pages is customized according to the application scenario.
  14. 根据权利要求10-13中任一项所述的方法,其特征在于,该方法还包括:在收到从所述第二页面返回到所述第一页面的返回指令时,响应该返回指令从所述第二页面返回到所述第一页面并从最顶层视图中移除所添加的所述新视图控件。The method according to any one of claims 10 to 13, wherein the method further comprises: in response to the returning instruction from the second page returning to the first page, responding to the returning instruction The second page returns to the first page and removes the added new view control from the topmost view.
  15. 根据权利要求10-14中任一项所述的方法,其特征在于,该方法还包括:在从所述第一页面切换至所述第二页面之前,根据用户在所述第一页面上点击的指定位置区域,记录与该指定位置区域相关联的视频视图在所述第一页面上的位置区域信息;在收到从所述第二页面返回到所述第一页面的返回指令时,响应该返回指令从所述第二页面返回到所述第一页面并且继续保持所述新视图控件位于所述最顶层视图中,根据之前记录的所述视频视图所在第一页面上的位置区域信息,调整用于播放所述视频的所述新视图控件在所述最顶层视图中的位置,以与切换至第二页面之前所述视频视图所在第一页面上的原有位置重叠覆盖。The method according to any one of claims 10 to 14, wherein the method further comprises: clicking on the first page according to the user before switching from the first page to the second page a specified location area, recording location area information of the video view associated with the specified location area on the first page; upon receiving a return instruction returning from the second page to the first page, Returning instructions to return from the second page to the first page and continuing to maintain the new view control in the topmost view, based on location area information on the first page on which the previously recorded video view is located, Adjusting a position of the new view control for playing the video in the topmost view to overlap the original position on the first page where the video view is located before switching to the second page.
  16. 根据权利要求15所述的方法,其特征在于,该方法还包括:在收到从所述第二页面返回到所述第一页面的返回指令时,查询所述最顶层视图中的所述新视图控件是否还在播放所述视频,如果此时所述最顶层视图中的所述新视图控件还在播放所述视频,则响应该返回指令从所述第二页面返回到所述第一页面并且通过所述最顶层视图中的所述新视图控件继续播放所述视频。The method of claim 15 further comprising: querying said new in said topmost view upon receipt of a return instruction returning from said second page to said first page Whether the view control is still playing the video, and if the new view control in the topmost view is still playing the video at this time, returning from the second page to the first page in response to the return instruction And continuing to play the video through the new view control in the topmost view.
  17. 根据权利要求11-16中任一项所述的方法,其特征在于,该方法还包括:当在所述最顶层视图上使用所述新视图控件来在用户点击的第一页面上的一个视频视图所在的位置上播放所述视频时,并且在发出所述切换指令之前,若检测到所述一个视频视图在所述Activity对应的界面内发生移动,则控制所述新视图控件跟随所述一个视频视图做无缝跟随移动操作,以使所述新视图控件与所述一个视频视图的相对位置关系在移动过程中不变;当所述一个视频视图离开所述Activity对应的界面时,从最顶层视图中移除所添加的所述新视图控件。The method of any of claims 11-16, further comprising: using the new view control on the topmost view to view a video on a first page clicked by a user Controlling the new view control to follow the one when the video is played in the location where the view is located, and before the switching instruction is issued, if it is detected that the video view moves within the interface corresponding to the Activity The video view seamlessly follows the moving operation so that the relative positional relationship between the new view control and the one video view does not change during the moving process; when the one video view leaves the interface corresponding to the Activity, the most The new view control added is removed from the top-level view.
  18. 一种在页面切换后继续显示视图的装置,其特征在于,包括:An apparatus for continuing to display a view after a page switch is characterized by comprising:
    第一页面显示模块,配置成在通过一个Activity创建的第一页面上显示至少一个视图信息;a first page display module configured to display at least one view information on a first page created by an Activity;
    页面点击监听模块,配置成监听用户对所述第一页面上的指定位置区域的点击操作;a page click monitoring module configured to monitor a user's click operation on a specified location area on the first page;
    页面切换命令发出模块,配置成在监听到用户点击所述第一页面上的指定位置区域时发出将所述第一页面上显示的该用户感兴趣的一个视图切换到所述第二页面上进行显示的指令;a page switching command issuing module configured to switch a view of the user displayed on the first page to the second page when the user clicks on the specified location area on the first page Displayed instruction;
    页面切换命令处理模块,配置成响应所述切换指令,在该同一个Activity中创建所述第二页面,创建用于显示该用户感兴趣的所述第一页面上的所述一个视图的新视图控件并将该新视图控件添加到该Activity中的最顶层视图中,然后在该第二页面上方通过添加到所述最顶层视图中的所述新视图控件来显示该用户感兴趣的所述一个视图。a page switching command processing module configured to, in response to the switching instruction, create the second page in the same Activity, and create a new view for displaying the one view on the first page of interest to the user Controls and adds the new view control to the topmost view in the Activity, and then displays the one of the user's interests by the new view control added to the topmost view above the second page view.
  19. 根据权利要求18所述的装置,其特征在于,所述用户感兴趣的一个视图与该用户点击的用于指示页面切换的指定位置区域相关联。The apparatus of claim 18 wherein a view of interest to the user is associated with a designated location area clicked by the user to indicate page switching.
  20. 根据权利要求18或19所述的装置,其特征在于,该装置还包括:最顶层视图获取模块,配置成在将所述新视图控件添加到该Activity中的最顶层视图中之前,先获取该Activity中的最顶层视图。The apparatus according to claim 18 or 19, further comprising: a topmost view obtaining module configured to acquire the new view control before adding it to the topmost view in the Activity The topmost view in the Activity.
  21. 根据权利要求18所述的装置,其特征在于,切换到第二页面时添加到所述最顶层视图中的所述新视图控件的显示尺寸,根据应用场景不同而自定义设计;The device according to claim 18, wherein the display size of the new view control added to the topmost view when switching to the second page is customized according to the application scenario;
    切换到第二页面时添加到所述最顶层视图中的所述新视图控件的位置根据应用场景不同而自定义设计。The position of the new view control added to the topmost view when switching to the second page is customized according to the application scenario.
  22. 根据权利要求18-21中任一项所述的装置,其特征在于,该装置还包括:The device according to any one of claims 18 to 21, further comprising:
    视图控件移除模块,配置成在收到从第二页面返回到第一页面的指令时,响应该返回指令从第二页面返回到第一页面并从最顶层视图中移除所添加的所述新视图控件。a view control removal module configured to, upon receiving an instruction to return from the second page to the first page, return to the first page from the second page in response to the return instruction and remove the added from the topmost view New view control.
  23. 根据权利要求18-22中任一项所述的装置,其特征在于,该装置还包括:The device according to any one of claims 18 to 22, further comprising:
    位置信息记录模块,配置成当用户感兴趣的在所述第一页面上显示的所述一个视图是视频时,在从所述第一页面切换至所述第二页面之前根据用户在所述第一页面上点击的指定位置区域,记录与该指定位置区域相关联的视频视图在所述第一页面上的位置区域信息;a location information recording module configured to: when the one view displayed on the first page that is of interest to the user is a video, according to the user before switching from the first page to the second page a specified location area clicked on a page, and recording location area information of the video view associated with the specified location area on the first page;
    页面返回指令监听模块,配置成监听用户发出的从所述第二页面返回到所述第一页面的指令;The page returns an instruction listening module configured to listen to an instruction issued by the user to return from the second page to the first page;
    页面返回指令处理模块,配置成响应监听到的返回指令,从所述第二页面返回到所述第一页面并且继续保持所述新视图控件位于所述最顶层视图中,根据之前记录的所述视频视图所在所述第一页面上的位置区域信息,调整用于播放所述视频的所述新视图控件在所述最顶层视图中的位置,以与切换至所述第二页面之前所述视频视图所在所述第一页面上的原有位置重叠覆盖。a page return instruction processing module configured to, in response to the monitored return instruction, return from the second page to the first page and continue to maintain the new view control in the topmost view, according to the previously recorded Position area information on the first page of the video view, adjusting a position of the new view control for playing the video in the topmost view, and the video before switching to the second page The original location on the first page of the view overlaps.
  24. 根据权利要求23所述的装置,其特征在于,所述页面返回指令处理模块还配置成响应监听到的返回指令,查询所述最顶层视图中的所述新视图控件是否还在播放所述视频,如果此时所述最顶层视图中的所述新视图控件还在播放所述视频,则从所述第二页面返回到所述第一页面并且通过所述最顶层视图中的所述新视图控件继续播放所述视频。The apparatus of claim 23, wherein the page return instruction processing module is further configured to query whether the new view control in the topmost view is still playing the video in response to the monitored return instruction Returning to the first page from the second page and passing the new view in the topmost view if the new view control in the topmost view is still playing the video at this time The control continues to play the video.
  25. 根据权利要求23或24所述的装置,其特征在于,该装置还包括:The device according to claim 23 or 24, further comprising:
    视图滚动处理模块,配置成从所述第二页面返回到所述第一页面后,当检测到所述第一页面上的所述视频视图在所述Activity对应的界面内移动时,让添加到所述最顶层视图中的所述新视图控件跟随所述视频视图做无缝跟随移动操作,以使所述新视图控件与所述视频视图的相对位置关系在移动过程中不变;The view scroll processing module is configured to, after returning from the second page to the first page, when it is detected that the video view on the first page moves within the interface corresponding to the Activity, The new view control in the topmost view follows the video view to perform a seamless follow move operation such that the relative positional relationship between the new view control and the video view does not change during the movement;
    视图控件移除模块,配置成当所述视频视图离开所述Activity对应的界面时,从最顶层视图中移除所添加的所述新视图控件。The view control removal module is configured to remove the added new view control from the topmost view when the video view leaves the interface corresponding to the Activity.
  26. 一种在页面切换后保持视频继续播放的装置,其特征在于,该装置包括:A device for keeping a video playing after a page switch, characterized in that the device comprises:
    第一页面显示模块,配置成在通过一个Activity创建的第一页面上显示至少一个视频视图;a first page display module configured to display at least one video view on a first page created by an Activity;
    视频播放指令监听模块,配置成监听用户点击所述第一页面上显示的其中一个视频视图进而发出播 放该视频的指令;a video playback instruction monitoring module configured to listen to a user clicking an image view displayed on the first page to issue an instruction to play the video;
    视频播放指令处理模块,配置成响应所述播放指令,创建用于视频播放的新视图控件并将其添加到该Activity中的最顶层视图中,在所述最顶层视图上使用所述新视图控件来播放该用户点击的所述一个视频;a video play instruction processing module configured to, in response to the play instruction, create a new view control for video playback and add it to a topmost view in the Activity, using the new view control on the topmost view To play the one video clicked by the user;
    页面点击监听模块,配置成监听用户对所述第一页面上与所述正播放的视频相关联的指定位置区域的点击操作;a page click monitoring module configured to listen to a user click operation on a specified location area associated with the playing video on the first page;
    页面切换命令发出模块,配置成在监听到用户点击所述第一页面上的所述指定位置区域时发出从所述第一页面切换到所述第二页面上进行播放所述视频的指令;a page switching command issuing module configured to issue an instruction to switch from the first page to the second page to play the video when the user clicks on the specified location area on the first page;
    页面切换命令处理模块,配置成响应所述切换指令,在该同一个Activity中创建所述第二页面,在该第二页面上方通过添加到所述最顶层视图中的所述新视图控件来继续播放所述视频。a page switching command processing module configured to, in response to the switching instruction, create the second page in the same Activity, and continue over the second page by adding the new view control added to the topmost view Play the video.
  27. 根据权利要求26所述的装置,其特征在于,所述视频播放指令处理模块创建的用于视频播放的新视图控件与用户点击的所述一个视频视图的大小相同,所述用于视频播放的新视图控件在所述最顶层视图中的位置与用户点击的所述一个视频视图在第一页面上的位置相同,进而实现重叠覆盖。The apparatus according to claim 26, wherein the new view control for video playback created by the video play instruction processing module is the same size as the one video view clicked by the user, and the video view is used for video playback. The position of the new view control in the topmost view is the same as the position of the one video view clicked by the user on the first page, thereby achieving overlapping coverage.
  28. 根据权利要求26或27所述的装置,其特征在于,该装置还包括:最顶层视图获取模块,配置成在将所述新视图控件添加到该Activity中的最顶层视图中之前,先获取该Activity中的最顶层视图。The apparatus according to claim 26 or 27, further comprising: a topmost view obtaining module configured to acquire the new view control before adding it to the topmost view in the Activity The topmost view in the Activity.
  29. 根据权利要求26-28中任一项所述的装置,其特征在于,切换到第二页面时已添加在所述最顶层视图中的所述新视图控件的显示尺寸,根据应用场景不同而自定义设计;切换到第二页面时已添加在所述最顶层视图中的所述视图控件的位置根据应用场景不同而自定义设计。The device according to any one of claims 26 to 28, wherein the display size of the new view control that has been added in the topmost view when switching to the second page is different according to the application scenario. Defining the design; the position of the view control that has been added in the topmost view when switching to the second page is customized according to the application scenario.
  30. 根据权利要求26-29中任一项所述的装置,其特征在于,该装置还包括:The device according to any one of claims 26 to 29, further comprising:
    视图控件移除模块,配置成在收到从所述第二页面返回到所述第一页面的指令时,响应该返回指令从所述第二页面返回到所述第一页面并从最顶层视图中移除所添加的所述新视图控件。a view control removal module configured to, upon receiving an instruction to return from the second page to the first page, return to the first page from the second page and from a topmost view in response to the return instruction Remove the new view control that was added.
  31. 根据权利要求26-30中任一项所述的装置,其特征在于,该装置还包括:The device according to any one of claims 26 to 30, further comprising:
    位置信息记录模块,配置成在从所述第一页面切换至所述第二页面之前根据用户在所述第一页面上点击的指定位置区域,记录与该指定位置区域相关联的视频视图在所述第一页面上的位置区域信息;a location information recording module configured to record a video view associated with the specified location area according to a specified location area clicked by the user on the first page before switching from the first page to the second page The location area information on the first page;
    页面返回指令监听模块,配置成监听用户发出的从所述第二页面返回到所述第一页面的指令;The page returns an instruction listening module configured to listen to an instruction issued by the user to return from the second page to the first page;
    页面返回指令处理模块,配置成响应该返回指令从所述第二页面返回到所述第一页面并且继续保持所述新视图控件位于所述最顶层视图中,根据之前记录的所述视频视图所在所述第一页面上的位置区域信息,调整用于播放所述视频的所述新视图控件在所述最顶层视图中的位置,以与切换至所述第二页面之前所述视频视图在所述第一页面上的原有位置重叠覆盖。a page return instruction processing module configured to return from the second page to the first page in response to the return instruction and to continue to maintain the new view control in the topmost view, according to the previously recorded video view Position area information on the first page, adjusting a position of the new view control for playing the video in the topmost view, and the video view is in front of switching to the second page The original position on the first page overlaps.
  32. 根据权利要求31所述的装置,其特征在于,所述页面返回指令处理模块还配置成响应监听到的返回指令,查询所述最顶层视图中的所述新视图控件是否还在播放所述视频,如果此时所述最顶层视图中的所述新视图控件还在播放所述视频,则响应该返回指令从所述第二页面返回到所述第一页面并且 通过所述最顶层视图中的所述新视图控件继续播放所述视频。The apparatus of claim 31, wherein the page return instruction processing module is further configured to query whether the new view control in the topmost view is still playing the video in response to the monitored return instruction If the new view control in the topmost view is still playing the video at this time, returning from the second page to the first page and passing through the topmost view in response to the return instruction The new view control continues to play the video.
  33. 一种存储设备,其特征在于,该存储设备中存储有多条指令,所述指令适于由处理器加载并执行如权利要求1-9中任一项所述的方法。A storage device, characterized in that a plurality of instructions are stored in the storage device, the instructions being adapted to be loaded by a processor and to perform the method of any one of claims 1-9.
  34. 一种存储设备,其特征在于,该存储设备中存储有多条指令,所述指令适于由处理器加载并执行如权利要求10-17中任一项所述的方法。A storage device, characterized in that a plurality of instructions are stored in the storage device, the instructions being adapted to be loaded by a processor and to perform the method of any one of claims 10-17.
  35. 一种智能移动终端,其包括:An intelligent mobile terminal includes:
    处理器,配置成加载并执行各种指令;以及a processor configured to load and execute various instructions;
    如权利要求33或34所述的存储设备。A storage device as claimed in claim 33 or 34.
PCT/CN2018/092828 2017-07-07 2018-06-26 Method and apparatus for continuing to display view after switching pages WO2019007227A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710549741.9 2017-07-07
CN201710549741.9A CN107341018B (en) 2017-07-07 2017-07-07 Method and device for continuously displaying view after page switching

Publications (1)

Publication Number Publication Date
WO2019007227A1 true WO2019007227A1 (en) 2019-01-10

Family

ID=60219538

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/092828 WO2019007227A1 (en) 2017-07-07 2018-06-26 Method and apparatus for continuing to display view after switching pages

Country Status (2)

Country Link
CN (1) CN107341018B (en)
WO (1) WO2019007227A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023197920A1 (en) * 2022-04-11 2023-10-19 北京字跳网络技术有限公司 Video processing method and apparatus, device and storage medium

Families Citing this family (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107341018B (en) * 2017-07-07 2020-12-29 阿里巴巴(中国)有限公司 Method and device for continuously displaying view after page switching
CN109857489B (en) * 2017-11-30 2022-05-27 阿里巴巴集团控股有限公司 Development system based on Android system, decoupling method and device
CN108495169A (en) * 2018-03-23 2018-09-04 北京焦点新干线信息技术有限公司 Information displaying method and device
CN109271220A (en) * 2018-08-16 2019-01-25 广州优视网络科技有限公司 Method, calculating equipment and the storage medium that the page returns are controlled by gesture operation
CN110929189A (en) * 2018-09-19 2020-03-27 北京国双科技有限公司 View processing method and device
CN110971953B (en) * 2018-09-29 2022-06-21 腾讯科技(深圳)有限公司 Video playing method, device, terminal and storage medium
CN109309859A (en) * 2018-09-30 2019-02-05 广州虎牙信息科技有限公司 Direct broadcasting room method for showing interface, framework and correlation technique, device and equipment
CN109587547B (en) * 2018-12-30 2021-07-23 北京奇艺世纪科技有限公司 Advertisement playing control method and device
CN109729412A (en) * 2019-01-11 2019-05-07 广州酷狗计算机科技有限公司 A kind of method and device playing video
CN109756785B (en) * 2019-01-16 2022-05-20 上海哔哩哔哩科技有限公司 Video switching playing method and device and storage medium
CN109947546B (en) * 2019-03-13 2021-08-20 北京乐我无限科技有限责任公司 Task execution method and device, electronic equipment and storage medium
CN109933401B (en) * 2019-03-22 2023-01-24 北京城市网邻信息技术有限公司 Display method and device of suspended window view
CN111935527B (en) * 2019-05-13 2023-01-03 浙江天猫技术有限公司 Information display method, video playing method and equipment
CN112241296B (en) * 2019-07-17 2024-03-22 北京密境和风科技有限公司 Page switching method and device in application
CN110267088B (en) * 2019-07-18 2021-09-07 北京字节跳动网络技术有限公司 Video playing control method and device, electronic equipment and storage medium
CN110650352B (en) * 2019-09-06 2020-12-08 四川天邑康和通信股份有限公司 Video processing method of IPTV browser
CN113568688B (en) * 2020-04-29 2023-06-06 RealMe重庆移动通信有限公司 View switching method and device, electronic equipment and storage medium
CN111857481A (en) * 2020-07-24 2020-10-30 京东方科技集团股份有限公司 Image display method, apparatus and storage medium
CN112087654B (en) * 2020-07-28 2023-01-10 智享众联科技有限公司 Information display method and device
CN112181556B (en) * 2020-09-21 2024-04-19 北京字跳网络技术有限公司 Terminal control processing method and device, electronic equipment and storage medium
CN116775916A (en) * 2022-03-08 2023-09-19 腾讯科技(深圳)有限公司 Multimedia content playing method, device, equipment and storage medium
CN116962832B (en) * 2023-07-28 2024-02-27 加客云科技(河北)有限公司 Multi-page switching continuous video playing method, terminal and medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130067331A1 (en) * 2011-09-09 2013-03-14 Screenovate Technologies Ltd. Method and System of Simultaneous Display of Multiple Screens on a Target Display
CN103686456A (en) * 2013-12-10 2014-03-26 乐视网信息技术(北京)股份有限公司 Method and video client side for video playing
CN105979339A (en) * 2016-05-25 2016-09-28 腾讯科技(深圳)有限公司 Window display method and client
CN107341018A (en) * 2017-07-07 2017-11-10 广州优视网络科技有限公司 A kind of method and apparatus for continuing to show view after page layout switch

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130088518A1 (en) * 2011-10-10 2013-04-11 Net Power And Light, Inc. Methods and systems for providing a graphical user interface
CN103970526A (en) * 2013-11-21 2014-08-06 成都力淼科技有限公司 Android based single-activity view switching technology
CN105094683A (en) * 2015-06-30 2015-11-25 北京金山安全软件有限公司 Data display method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130067331A1 (en) * 2011-09-09 2013-03-14 Screenovate Technologies Ltd. Method and System of Simultaneous Display of Multiple Screens on a Target Display
CN103686456A (en) * 2013-12-10 2014-03-26 乐视网信息技术(北京)股份有限公司 Method and video client side for video playing
CN105979339A (en) * 2016-05-25 2016-09-28 腾讯科技(深圳)有限公司 Window display method and client
CN107341018A (en) * 2017-07-07 2017-11-10 广州优视网络科技有限公司 A kind of method and apparatus for continuing to show view after page layout switch

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023197920A1 (en) * 2022-04-11 2023-10-19 北京字跳网络技术有限公司 Video processing method and apparatus, device and storage medium

Also Published As

Publication number Publication date
CN107341018A (en) 2017-11-10
CN107341018B (en) 2020-12-29

Similar Documents

Publication Publication Date Title
WO2019007227A1 (en) Method and apparatus for continuing to display view after switching pages
US20230022781A1 (en) User interfaces for viewing and accessing content on an electronic device
US11816303B2 (en) Device, method, and graphical user interface for navigating media content
CN112153288B (en) Method, apparatus, device and medium for distributing video or image
US10565288B2 (en) Video streaming in a web browser
WO2020000972A1 (en) Video access method, client, video access apparatus, terminal, server, and storage medium
US20190073101A1 (en) Method and device for switching pages of applications in a terminal device
JP6469313B2 (en) Information processing method, terminal, and computer storage medium
CN115509398A (en) Method for displaying emoticons using instant messaging service and user device thereof
US20150100885A1 (en) Video streaming on a mobile device
US20140380375A1 (en) Page turning method, page turning apparatus and terminal as well as computer readable medium
US20160071491A1 (en) Multitasking and screen sharing on portable computing devices
US20150278174A1 (en) Method and apparatus for playing multimedia in browser
CN103702214A (en) Video playing method and electronic equipment
US11392287B2 (en) Method, device, and storage mediumfor switching among multimedia resources
US20150248722A1 (en) Web based interactive multimedia system
CN109218819B (en) Video preview method and mobile terminal
CN111935527A (en) Information display method, video playing method and equipment
WO2016112791A1 (en) Method and device for displaying interface of application program on mobile terminal
CN110753251A (en) Video switching method and device and electronic equipment
WO2022199406A1 (en) Hot event presentation method for application, and electronic device
CN115550741A (en) Video management method and device, electronic equipment and readable storage medium
CN105812890B (en) Information display method and client
CN112653931B (en) Control method and device for resource information playing, storage medium and electronic equipment
US20160104507A1 (en) Method and Apparatus for Capturing Still Images and Truncated Video Clips from Recorded Video

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18827956

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18827956

Country of ref document: EP

Kind code of ref document: A1