-
Notifications
You must be signed in to change notification settings - Fork 470
Made the changes to Remove the PiP implementation #395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,62 +89,63 @@ class PiPSampleActivity : ComponentActivity() { | |
| binding.clear.setOnClickListener { viewModel.clear() } | ||
| binding.startOrPause.setOnClickListener { viewModel.startOrPause() } | ||
| binding.pip.setOnClickListener { | ||
| enterPictureInPictureMode(updatePictureInPictureParams(viewModel.started.value == true)) | ||
| // enterPictureInPictureMode(updatePictureInPictureParams(viewModel.started.value == true)) | ||
praneethatchana marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| // Observe data from the viewModel. | ||
| viewModel.time.observe(this) { time -> binding.time.text = time } | ||
| viewModel.started.observe(this) { started -> | ||
| binding.startOrPause.setImageResource( | ||
| if (started) R.drawable.ic_pause_24dp else R.drawable.ic_play_arrow_24dp, | ||
| ) | ||
| updatePictureInPictureParams(started) | ||
| // updatePictureInPictureParams(started) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
|
|
||
| // Use trackPipAnimationHint view to make a smooth enter/exit pip transition. | ||
| // See https://android.devsite.corp.google.com/develop/ui/views/picture-in-picture#smoother-transition | ||
| lifecycleScope.launch { | ||
| /* lifecycleScope.launch { | ||
| repeatOnLifecycle(Lifecycle.State.STARTED) { | ||
| trackPipAnimationHintView(binding.stopwatchBackground) | ||
| } | ||
| } | ||
| }*/ | ||
|
Comment on lines
+105
to
+109
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| // Handle events from the action icons on the picture-in-picture mode. | ||
| ActivityCompat.registerReceiver( | ||
| /*ActivityCompat.registerReceiver( | ||
| this, | ||
| broadcastReceiver, | ||
| IntentFilter(ACTION_STOPWATCH_CONTROL), | ||
| ContextCompat.RECEIVER_NOT_EXPORTED | ||
| ) | ||
| )*/ | ||
|
Comment on lines
+112
to
+117
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
|
|
||
| // This is called when the activity gets into or out of the picture-in-picture mode. | ||
| override fun onPictureInPictureModeChanged( | ||
| /*override fun onPictureInPictureModeChanged( | ||
| isInPictureInPictureMode: Boolean, | ||
| newConfig: Configuration, | ||
| ) { | ||
| super.onPictureInPictureModeChanged(isInPictureInPictureMode, newConfig) | ||
| // Toggle visibility of in-app buttons. They cannot be interacted in the picture-in-picture | ||
| // mode, and their features are provided as the action icons. | ||
| toggleControls(if (isInPictureInPictureMode) View.GONE else View.VISIBLE) | ||
| } | ||
| }*/ | ||
|
Comment on lines
+121
to
+129
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| private fun toggleControls(view: Int) { | ||
| binding.clear.visibility = view | ||
| binding.startOrPause.visibility = view | ||
| } | ||
|
|
||
| @RequiresApi(35) | ||
| /* @RequiresApi(35) | ||
| override fun onPictureInPictureUiStateChanged(pipState: PictureInPictureUiState) { | ||
| super.onPictureInPictureUiStateChanged(pipState) | ||
| if (pipState.isTransitioningToPip) { | ||
| toggleControls(View.GONE) | ||
| } | ||
| } | ||
| }*/ | ||
|
Comment on lines
+136
to
+142
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| /** | ||
| * Updates the parameters of the picture-in-picture mode for this activity based on the current | ||
| * [started] state of the stopwatch. | ||
| */ | ||
| /* | ||
| private fun updatePictureInPictureParams(started: Boolean): PictureInPictureParams { | ||
| val params = PictureInPictureParams.Builder() | ||
| // Set action items for the picture-in-picture mode. These are the only custom controls | ||
|
|
@@ -191,6 +192,7 @@ class PiPSampleActivity : ComponentActivity() { | |
| setPictureInPictureParams(it) | ||
| } | ||
| } | ||
| */ | ||
|
|
||
| /** | ||
| * Creates a [RemoteAction]. It is used as an action icon on the overlay of the | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.