material-components / material-components/material-components-android
[ProgressIndicator] Doesn't show up on PopupWindow when opening the window again using enter/hide transition
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 17.4k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
**Description:**
When implementing a popup with a progress indicator based on `CircularProgressIndicator` or `LinearProgressIndicator`, the indicator is only appears the first time the popup is shown when using the popup show/hide transition (`enterTransition`, `exitTransition`).
If transition animation is not used, the progress indicator is displayed correctly.
**Expected behavior:**
CircularProgressIndicator or LinearProgressIndicator should always be visible unless we explicitly hide it.
**Source code:**
ProgressPopup snippet:
```kotlin
fun show() {
if (mPopup.isShowing) {
mPopup.update()
} else {
mPopup.showAtLocation(parent, popupGravity, x, y)
}
}
fun hide() {
if (mPopup.isShowing) {
mPopup.dismiss()
}
}
init {
mPopup = PopupWindow(
contentView,
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.MATCH_PARENT
)
// Set show/hide animation
// ... causing the problem ...
mPopup.enterTransition = Fade(Fade.IN)
mPopup.exitTransition = Fade(Fade.OUT)
mPopup.isTouchable = false
mPopup.isFocusable = false
mProgressBar = contentView.findViewById(R.id.progressIndicator)
mProgressValueText = contentView.findViewById(R.id.progress_value_text)
mProgressTaskText = contentView.findViewById(R.id.progress_task_text)
}
```
layout snippet:
```xml
```
usage:
```kotlin
val progressView = layoutInflater.inflate(R.layout.progress, null)
val progressPopup = ProgressPopup(mainView, progressView).also { it.popupGravity = Gravity.FILL }
val button = findViewById(R.id.button)
button.setOnClickListener {
progressPopup.progress = 50
handler.postDelayed({ progressPopup.hide() }, 2000)
}
```
On the second and subsequent clicks of the button, a pop-up window appears with an invisible progress indicator.
**Minimal sample app repro:**
[PopupIndicatorTest.zip](https://github.com/material-components/material-components-android/files/12776254/PopupIndicatorTest.zip)
**Android API version:** API31
**Material Library version:** Tested on 1.8.0, 1.9.0, 1.10.0-rc01, 1.11.0-alpha03
**Device:** Android emulator API 31 arm64
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked PopupIndicatorTest.zip minimal sample and reproduce the issue on Android API 31. Inspect the PopupWindow show/hide flow using enterTransition and exitTransition, comparing the first display with later displays and the behavior without transitions. Done means the CircularProgressIndicator or LinearProgressIndicator remains visible on every popup display unless explicitly hidden.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100