diff --git a/picture_in_picture/app/src/main/java/com/firework/example/pictureinpicture/MainActivity.kt b/picture_in_picture/app/src/main/java/com/firework/example/pictureinpicture/MainActivity.kt
index 1d01ce4..8a2840d 100644
--- a/picture_in_picture/app/src/main/java/com/firework/example/pictureinpicture/MainActivity.kt
+++ b/picture_in_picture/app/src/main/java/com/firework/example/pictureinpicture/MainActivity.kt
@@ -89,7 +89,19 @@ class MainActivity : AppCompatActivity() {
}
}
+ override fun onStop() {
+ Log.i(TAG, "onStop - isFinishing: $isFinishing")
+ if (binding.closePipOnStop.isChecked && isFinishing) {
+ FireworkSdk.closePip()
+ }
+ super.onStop()
+ }
+
override fun onDestroy() {
+ Log.i(TAG, "onDestroy")
+ if (binding.closePipOnDestroy.isChecked) {
+ FireworkSdk.closePip()
+ }
binding.fwVideoFeedView.destroy()
super.onDestroy()
}
diff --git a/picture_in_picture/app/src/main/res/layout/activity_main.xml b/picture_in_picture/app/src/main/res/layout/activity_main.xml
index c9d9e8e..dfd1dde 100644
--- a/picture_in_picture/app/src/main/res/layout/activity_main.xml
+++ b/picture_in_picture/app/src/main/res/layout/activity_main.xml
@@ -26,15 +26,31 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/close_pip_mode"
- app:layout_constraintBottom_toTopOf="@id/details"
+ app:layout_constraintBottom_toTopOf="@id/closePipOnStop"
app:layout_constraintTop_toBottomOf="@id/enterPip" />
+
+
+
+
+ app:layout_constraintTop_toBottomOf="@id/closePipOnDestroy" />
diff --git a/picture_in_picture/app/src/main/res/values/strings.xml b/picture_in_picture/app/src/main/res/values/strings.xml
index 0287828..0ff7010 100644
--- a/picture_in_picture/app/src/main/res/values/strings.xml
+++ b/picture_in_picture/app/src/main/res/values/strings.xml
@@ -7,4 +7,6 @@
Enter PiP mode in 5 sec
Close PiP mode
+ Close PiP mode onStop
+ Close PiP mode onDestroy