Skip to content

Commit b0c5ef5

Browse files
Made the changes to Remove the PiP implementation
1 parent f02e8e9 commit b0c5ef5

File tree

3 files changed

+22
-20
lines changed

3 files changed

+22
-20
lines changed

samples/user-interface/picture-in-picture/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
android:name=".PiPSampleActivity"
2424
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
2525
android:exported="true"
26-
android:supportsPictureInPicture="true"
26+
android:supportsPictureInPicture="false"
2727
android:launchMode="singleTask"
2828
android:theme="@style/PiPAppTheme"
2929
tools:targetApi="26" />
3030

3131
<activity
3232
android:name=".PiPMovieActivity"
3333
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
34-
android:supportsPictureInPicture="true"
34+
android:supportsPictureInPicture="false"
3535
android:launchMode="singleTask"
3636
android:theme="@style/PiPAppTheme"
3737
tools:targetApi="o" />

samples/user-interface/picture-in-picture/src/main/java/com/example/android/pip/PiPMovieActivity.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class PiPMovieActivity : ComponentActivity() {
111111

112112
// Configure parameters for the picture-in-picture mode. We do this at the first layout of
113113
// the MovieView because we use its layout position and size.
114-
binding.movie.doOnLayout { updatePictureInPictureParams() }
114+
// binding.movie.doOnLayout { updatePictureInPictureParams() }
115115

116116
// Set up the video; it automatically starts.
117117
binding.movie.setMovieListener(movieListener)
@@ -175,7 +175,7 @@ class PiPMovieActivity : ComponentActivity() {
175175
}
176176
}
177177

178-
override fun onPictureInPictureModeChanged(
178+
/*override fun onPictureInPictureModeChanged(
179179
isInPictureInPictureMode: Boolean, newConfig: Configuration,
180180
) {
181181
super.onPictureInPictureModeChanged(isInPictureInPictureMode, newConfig)
@@ -188,18 +188,18 @@ class PiPMovieActivity : ComponentActivity() {
188188
binding.movie.showControls()
189189
}
190190
}
191-
}
191+
}*/
192192

193-
@RequiresApi(35)
193+
/*@RequiresApi(35)
194194
override fun onPictureInPictureUiStateChanged(pipState: PictureInPictureUiState) {
195195
super.onPictureInPictureUiStateChanged(pipState)
196196
if (pipState.isTransitioningToPip) {
197197
binding.movie.hideControls()
198198
}
199-
}
199+
}*/
200200

201201

202-
private fun updatePictureInPictureParams(): PictureInPictureParams {
202+
/*private fun updatePictureInPictureParams(): PictureInPictureParams {
203203
// Calculate the aspect ratio of the PiP screen.
204204
val aspectRatio = Rational(binding.movie.width, binding.movie.height)
205205
// The movie view turns into the picture-in-picture mode.
@@ -219,13 +219,13 @@ class PiPMovieActivity : ComponentActivity() {
219219
return params.build().also {
220220
setPictureInPictureParams(it)
221221
}
222-
}
222+
}*/
223223

224224
/**
225225
* Enters Picture-in-Picture mode.
226226
*/
227227
private fun minimize() {
228-
enterPictureInPictureMode(updatePictureInPictureParams())
228+
// enterPictureInPictureMode(updatePictureInPictureParams())
229229
}
230230

231231
/**

samples/user-interface/picture-in-picture/src/main/java/com/example/android/pip/PiPSampleActivity.kt

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,62 +89,63 @@ class PiPSampleActivity : ComponentActivity() {
8989
binding.clear.setOnClickListener { viewModel.clear() }
9090
binding.startOrPause.setOnClickListener { viewModel.startOrPause() }
9191
binding.pip.setOnClickListener {
92-
enterPictureInPictureMode(updatePictureInPictureParams(viewModel.started.value == true))
92+
// enterPictureInPictureMode(updatePictureInPictureParams(viewModel.started.value == true))
9393
}
9494
// Observe data from the viewModel.
9595
viewModel.time.observe(this) { time -> binding.time.text = time }
9696
viewModel.started.observe(this) { started ->
9797
binding.startOrPause.setImageResource(
9898
if (started) R.drawable.ic_pause_24dp else R.drawable.ic_play_arrow_24dp,
9999
)
100-
updatePictureInPictureParams(started)
100+
// updatePictureInPictureParams(started)
101101
}
102102

103103
// Use trackPipAnimationHint view to make a smooth enter/exit pip transition.
104104
// See https://android.devsite.corp.google.com/develop/ui/views/picture-in-picture#smoother-transition
105-
lifecycleScope.launch {
105+
/* lifecycleScope.launch {
106106
repeatOnLifecycle(Lifecycle.State.STARTED) {
107107
trackPipAnimationHintView(binding.stopwatchBackground)
108108
}
109-
}
109+
}*/
110110

111111
// Handle events from the action icons on the picture-in-picture mode.
112-
ActivityCompat.registerReceiver(
112+
/*ActivityCompat.registerReceiver(
113113
this,
114114
broadcastReceiver,
115115
IntentFilter(ACTION_STOPWATCH_CONTROL),
116116
ContextCompat.RECEIVER_NOT_EXPORTED
117-
)
117+
)*/
118118
}
119119

120120
// This is called when the activity gets into or out of the picture-in-picture mode.
121-
override fun onPictureInPictureModeChanged(
121+
/*override fun onPictureInPictureModeChanged(
122122
isInPictureInPictureMode: Boolean,
123123
newConfig: Configuration,
124124
) {
125125
super.onPictureInPictureModeChanged(isInPictureInPictureMode, newConfig)
126126
// Toggle visibility of in-app buttons. They cannot be interacted in the picture-in-picture
127127
// mode, and their features are provided as the action icons.
128128
toggleControls(if (isInPictureInPictureMode) View.GONE else View.VISIBLE)
129-
}
129+
}*/
130130

131131
private fun toggleControls(view: Int) {
132132
binding.clear.visibility = view
133133
binding.startOrPause.visibility = view
134134
}
135135

136-
@RequiresApi(35)
136+
/* @RequiresApi(35)
137137
override fun onPictureInPictureUiStateChanged(pipState: PictureInPictureUiState) {
138138
super.onPictureInPictureUiStateChanged(pipState)
139139
if (pipState.isTransitioningToPip) {
140140
toggleControls(View.GONE)
141141
}
142-
}
142+
}*/
143143

144144
/**
145145
* Updates the parameters of the picture-in-picture mode for this activity based on the current
146146
* [started] state of the stopwatch.
147147
*/
148+
/*
148149
private fun updatePictureInPictureParams(started: Boolean): PictureInPictureParams {
149150
val params = PictureInPictureParams.Builder()
150151
// Set action items for the picture-in-picture mode. These are the only custom controls
@@ -191,6 +192,7 @@ class PiPSampleActivity : ComponentActivity() {
191192
setPictureInPictureParams(it)
192193
}
193194
}
195+
*/
194196

195197
/**
196198
* Creates a [RemoteAction]. It is used as an action icon on the overlay of the

0 commit comments

Comments
 (0)