Home | History | Annotate | only in /developers/build/prebuilts/gradle/PictureInPicture/kotlinApp
Up to higher level directory
NameDateSize
.google/05-Oct-2017
app/05-Oct-2017
build.gradle05-Oct-2017371
CONTRIBUTING.md05-Oct-20171.5K
gradle/05-Oct-2017
gradle.properties05-Oct-2017730
gradlew05-Oct-20174.9K
gradlew.bat05-Oct-20172.3K
LICENSE05-Oct-201731.5K
NOTICE05-Oct-2017614
proguard-rules.pro05-Oct-2017672
README.md05-Oct-20174.4K
screenshots/05-Oct-2017
settings.gradle05-Oct-201715

README.md

      1 Android PictureInPicture Sample (Kotlin)
      2 ===================================
      3 
      4 This sample demonstrates basic usage of Picture-in-Picture mode for handheld devices.
      5 The sample plays a video. The video keeps on playing when the app is turned in to
      6 Picture-in-Picture mode. On Picture-in-Picture screen, the app shows an action item to
      7 pause or resume the video.
      8 
      9 Introduction
     10 ------------
     11 
     12 The O Developer Preview allows activities to launch in Picture-in-Picture (PiP) mode. PiP is a
     13 special type of [multi-window][1] mode mostly used for video playback. PiP mode is already available
     14 for [Android TV][2]; the O Developer Preview makes the feature available on other Android devices.
     15 
     16 The app is *paused* when it enters PiP mode, but it should continue showing content. For this
     17 reason, you should make sure your app does not pause playback in its [onPause()][3]
     18 handler. Instead, you should pause video in [onStop()][4]. For more information, see [Multi-Window
     19 Lifecycle][5].
     20 
     21 To specify that your activity can use PIP mode, set `android:supportsPictureInPicture` to `true` in
     22 the manifest. (Beginning with the O Developer Preview, you do not need to set
     23 `android:resizeableActivity` to `true` if you are supporting PIP mode, either on Android TV or on
     24 other Android devices; you only need to `setrandroid:resizeableActivity` if your activity supports
     25 other multi-window modes.)
     26 
     27 You can pass a [PictureInPictureArgs][6] to [enterPictureInPictureMode()][7] to specify how an
     28 activity should behave when it is in PiP mode. You can also use it to call
     29 [setPictureInPictureArgs()][8] and update the current behavior. If the app is in not PiP mode, it
     30 will be used for later call of [enterPictureInPictureMode()][7].
     31 
     32 With a [PictureInPictureArgs][6], you can specify aspect ratio of PiP activity and action items
     33 available for PiP mode. The aspect ratio is used when the activity is in PiP mode. The action items
     34 are used as menu items in PiP mode. You can use a [PendingIntent][9] to specify what to do when the
     35 item is selected.
     36 
     37 [1]: https://developer.android.com/guide/topics/ui/multi-window.html
     38 [2]: https://developer.android.com/training/tv/playback/picture-in-picture.html
     39 [3]: https://developer.android.com/reference/android/app/Activity.html#onPause()
     40 [4]: https://developer.android.com/reference/android/app/Activity.html#onStop()
     41 [5]: https://developer.android.com/guide/topics/ui/multi-window.html#lifecycle
     42 [6]: https://developer.android.com/reference/android/app/PictureInPictureArgs.html
     43 [7]: https://developer.android.com/reference/android/app/Activity.html#enterPictureInPictureMode(android.app.PictureInPictureArgs)
     44 [8]: https://developer.android.com/reference/android/app/Activity.html#setPictureInPictureArgs(android.app.PictureInPictureArgs)
     45 [9]: https://developer.android.com/reference/android/app/PendingIntent.html
     46 
     47 Pre-requisites
     48 --------------
     49 
     50 - Android SDK 25
     51 - Android Build Tools v25.0.3
     52 - Android Support Repository
     53 
     54 Screenshots
     55 -------------
     56 
     57 <img src="screenshots/1-main.png" height="400" alt="Screenshot"/> <img src="screenshots/2-pip.png" height="400" alt="Screenshot"/> 
     58 
     59 Getting Started
     60 ---------------
     61 
     62 This sample uses the Gradle build system. To build this project, use the
     63 "gradlew build" command or use "Import Project" in Android Studio.
     64 
     65 Support
     66 -------
     67 
     68 - Google+ Community: https://plus.google.com/communities/105153134372062985968
     69 - Stack Overflow: http://stackoverflow.com/questions/tagged/android
     70 
     71 If you've found an error in this sample, please file an issue:
     72 https://github.com/googlesamples/android-PictureInPicture
     73 
     74 Patches are encouraged, and may be submitted by forking this project and
     75 submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details.
     76 
     77 License
     78 -------
     79 
     80 Copyright 2017 The Android Open Source Project, Inc.
     81 
     82 Licensed to the Apache Software Foundation (ASF) under one or more contributor
     83 license agreements.  See the NOTICE file distributed with this work for
     84 additional information regarding copyright ownership.  The ASF licenses this
     85 file to you under the Apache License, Version 2.0 (the "License"); you may not
     86 use this file except in compliance with the License.  You may obtain a copy of
     87 the License at
     88 
     89 http://www.apache.org/licenses/LICENSE-2.0
     90 
     91 Unless required by applicable law or agreed to in writing, software
     92 distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
     93 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
     94 License for the specific language governing permissions and limitations under
     95 the License.
     96