-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Implement ProgressColor property in ProgressBarHandlers #600
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
d4103c0
Implement ProgressColor property in ProgressBarHandlers
jsuarezruiz 82c3c74
Add PortHandler attributes
jsuarezruiz 7f1c7b9
Merge branch 'main' into progressbar-progressbarcolor
jsuarezruiz 38949fc
Implemented on WinUI too
jsuarezruiz 083a662
Fixed build error
jsuarezruiz 47bd4c6
Fixed build errors
jsuarezruiz c5c2487
Merge branch 'main' into progressbar-progressbarcolor
jsuarezruiz d7460f5
Added sample
jsuarezruiz b422ad7
Merge branch 'main' into progressbar-progressbarcolor
jsuarezruiz e580328
Fix build error
jsuarezruiz ad7ab64
Merge branch 'main' into progressbar-progressbarcolor
jsuarezruiz bfdf383
Merge branch 'main' into progressbar-progressbarcolor
29b08df
Delete unnecessary netstandard extensions
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 19 additions & 3 deletions
22
src/Core/tests/DeviceTests/Handlers/ProgressBar/ProgressBarTests.Android.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,30 @@ | ||
using Microsoft.Maui.Handlers; | ||
using System; | ||
using System.Threading.Tasks; | ||
using Microsoft.Maui.Graphics; | ||
using Microsoft.Maui.Handlers; | ||
using AProgressBar = Android.Widget.ProgressBar; | ||
|
||
namespace Microsoft.Maui.DeviceTests | ||
{ | ||
public partial class ProgressBarHandlerTests | ||
{ | ||
AProgressBar GetNativeProgressBar(ProgressBarHandler progressBarHandler) => | ||
(AProgressBar)progressBarHandler.NativeView; | ||
progressBarHandler.NativeView; | ||
|
||
double GetNativeProgress(ProgressBarHandler progressBarHandler) => | ||
(double)GetNativeProgressBar(progressBarHandler).Progress / ProgressBarExtensions.Maximum; | ||
} | ||
|
||
Task ValidateNativeProgressColor(IProgress progressBar, Color color, Action action = null) => | ||
ValidateHasColor(progressBar, color, action); | ||
|
||
Task ValidateHasColor(IProgress progressBar, Color color, Action action = null) | ||
{ | ||
return InvokeOnMainThreadAsync(() => | ||
{ | ||
var nativeProgressBar = GetNativeProgressBar(CreateHandler(progressBar)); | ||
action?.Invoke(); | ||
nativeProgressBar.AssertContainsColor(color); | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 18 additions & 3 deletions
21
src/Core/tests/DeviceTests/Handlers/ProgressBar/ProgressBarTests.iOS.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,29 @@ | ||
using Microsoft.Maui.Handlers; | ||
using System; | ||
using System.Threading.Tasks; | ||
using Microsoft.Maui.Graphics; | ||
using Microsoft.Maui.Handlers; | ||
using UIKit; | ||
using Xunit; | ||
|
||
namespace Microsoft.Maui.DeviceTests | ||
{ | ||
public partial class ProgressBarHandlerTests | ||
{ | ||
UIProgressView GetNativeProgressBar(ProgressBarHandler progressBarHandler) => | ||
(UIProgressView)progressBarHandler.NativeView; | ||
progressBarHandler.NativeView; | ||
|
||
double GetNativeProgress(ProgressBarHandler progressBarHandler) => | ||
GetNativeProgressBar(progressBarHandler).Progress; | ||
} | ||
|
||
async Task ValidateNativeProgressColor(IProgress progressBar, Color color, Action action = null) | ||
{ | ||
var expected = await GetValueAsync(progressBar, handler => | ||
{ | ||
var native = GetNativeProgressBar(handler); | ||
action?.Invoke(); | ||
return native.ProgressTintColor.ToColor(); | ||
}); | ||
Assert.Equal(expected, color); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This should be a Brush.
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.
Totally agree. However, can we make it progressive? Start by merging this and other PRs related to Color, in order to complete Handlers and allow in Previews to work and port code in a simple way, and as we have to do with other important properties such as convert TextColor to Foreground, update little by little .
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.
Yeah i think we could, i added a issue for this #2403