Skip to content

Fix deprecated ProgressView for Android #137

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pacient
Copy link

@pacient pacient commented Mar 2, 2025

There seems to be a deprecated use of Android's LinearProgressIndicator. I did a fix to look same as it did before for when there is a value. Let me know if I should update to include same change for when the progress is indeterminate.

Before After
Screenshot 2025-03-02 at 11 32 44 Screenshot 2025-03-02 at 11 40 28

Thank you for contributing to the Skip project! Please use this space to describe your change and add any labels (bug, enhancement, documentation, etc.) to help categorize your contribution.

Skip Pull Request Checklist:

Copy link

cla-bot bot commented Mar 2, 2025

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Vasil Blanco-Nunev.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email email@example.com
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@marcprux
Copy link
Contributor

marcprux commented Mar 2, 2025

Why -8.dp? This does change the appearance of the progress indicator, like the bottommost one in your screenshot where the "Before" indicator has a visible gap, and the "After" one doesn't.

Also, if you are just trying to get rid of a deprecation warning, could we just use this constructor instead: https://developer.android.com/reference/com/google/android/material/progressindicator/LinearProgressIndicator#LinearProgressIndicator(android.content.Context,%20android.util.AttributeSet)

@pacient
Copy link
Author

pacient commented Mar 2, 2025

Looking at the ProgresView page I could see that the way progress indicator looked like is different. I added -8.dp so it over laps the progress with the background, otherwise you still see a bit of a gap even with 0, maybe It could be reduced to 4. Also, it's not about the deprecation warning. It's also the dot at the end, which drawStopIndicator fixes. With the changes the ProgressView matches how the iOS looks like

@marcprux marcprux requested a review from aabewhite March 17, 2025 13:19
@@ -95,7 +95,13 @@ public struct ProgressView : View {
if value == nil || total == nil {
LinearProgressIndicator(modifier: modifier, color: color)
} else {
LinearProgressIndicator(progress: Float(value! / total!), modifier: modifier, color: color)
LinearProgressIndicator(
progress: { Float(value! / total!) },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the deprecated API fix. I'd like to leave everything else as using default values (i.e. just exclude the gapSize and drawStopIndicator parameters) for the normal Compose look. We can eventually add custom modifiers to change the Material view, as we've done for other components.

And could you also make the fix for CircularProgressIndicator?

@pacient pacient force-pushed the fix-deprecated-progress-view branch from 608db8e to 9d31f76 Compare May 1, 2025 13:55
Copy link

cla-bot bot commented May 1, 2025

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Vasil Blanco-Nunev.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email email@example.com
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants