-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Feat (Progress Dialog): Compat to add new progress bar #19970
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
base: main
Are you sure you want to change the base?
Conversation
9ac8ea1 to
f94dfb1
Compare
| } | ||
| } | ||
|
|
||
| fun setMax(max: Int) = runOnUi { setMaxInternal(max) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused variable
| circularIndicator?.max = max | ||
| } | ||
|
|
||
| fun setProgress(value: Int) = runOnUi { setProgressInternal(value) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused variable
| } | ||
| } | ||
|
|
||
| fun incrementProgressBy(diff: Int) = runOnUi { setProgressInternal(progress + diff) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused variable
|
|
||
| fun incrementProgressBy(diff: Int) = runOnUi { setProgressInternal(progress + diff) } | ||
|
|
||
| var isIndeterminate: Boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused variable
| } | ||
| } | ||
|
|
||
| private fun dismissDialogIfShowing(dialog: Dialog) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason there's so many unused functions and variables is because I wanted it to be very similar to progressdialog since it is a compat wrapper. I thought this was best practice but if it's better to remove all the unused parts, I can
f94dfb1 to
5900d22
Compare
|
I implemented the changes which David had mentioned starting here: I'm not sure if I understood it in the right way, so if I'm wrong do let me know |
Purpose / Description
This changes the UI of existing progress dialogs (deprecated in api 26) to newer material ui progress circles.
Fixes
Approach
Created a new compat class ProgressCompat.kt to easily change all the existing progressdialogs to the new ones. We use this class in CoroutineHelpers.kt to change all the withProgress dialogs. The compat class uses regex to check for values like x/y and updates the dialog with a progress circle (defined in a new xml) automatically, if not we use an indeterminate spinner.
How Has This Been Tested?
Screen_recording_20251229_200048.webm
I struggled to test this normally, using one-way sync was the best way I found. If anyone has larger decks, or a better place to test, please let me know.
Learning (optional, can help others)
Referred:
https://developer.android.com/reference/android/app/ProgressDialog
ActionProviderCompat.kt for documentation help
https://m2.material.io/components/progress-indicators/android#circular-progress-indicators : for design (not sure if we want to use m3 since I believe it was still under discussion in the discord)
Checklist
Please, go through these checks before submitting the PR.