Skip to content
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

[Android] Fix gif animation initial state #14295

Merged
merged 42 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
a25644e
Fix gifs initial animation state on Android
jsuarezruiz Mar 30, 2023
b917881
Device tests
jsuarezruiz Mar 30, 2023
964a463
Auto-format source code
Mar 30, 2023
baede13
Updated sample
jsuarezruiz Mar 30, 2023
e4c0515
Merge branch 'fix-7019' of https://github.com/dotnet/maui into fix-7019
jsuarezruiz Mar 30, 2023
32cd083
Merge branch 'main' into fix-7019
jsuarezruiz Apr 3, 2023
4850e65
Updated device tests
jsuarezruiz Apr 3, 2023
4339578
Merge branch 'main' into fix-7019
jsuarezruiz Apr 12, 2023
ab1e1c2
Merge branch 'main' into fix-7019
jsuarezruiz Apr 14, 2023
d0e4c17
Refactor code
jsuarezruiz Apr 14, 2023
fcee3ac
Merge branch 'main' into fix-7019
jsuarezruiz Apr 20, 2023
518073a
Merge branch 'main' into fix-7019
jsuarezruiz May 3, 2023
37226da
Merge branch 'main' into fix-7019
jsuarezruiz May 8, 2023
1076201
Merge branch 'main' into fix-7019
jsuarezruiz May 31, 2023
9101c9d
Merge branch 'main' into fix-7019
jsuarezruiz Jun 6, 2023
392bfb8
Update src/Core/src/Handlers/Image/ImageHandler.Android.cs
jsuarezruiz Jun 14, 2023
882d368
Merge branch 'main' into fix-7019
jsuarezruiz Jun 14, 2023
2415826
Merge branch 'fix-7019' of https://github.com/dotnet/maui into fix-7019
jsuarezruiz Jun 14, 2023
48ef08d
Remove unnecessary change
jsuarezruiz Jun 14, 2023
ee620d7
Merge branch 'main' into fix-7019
jsuarezruiz Jun 19, 2023
1682a58
Fix build errors
jsuarezruiz Jun 22, 2023
a35161e
Merge branch 'main' into fix-7019
jsuarezruiz Jun 26, 2023
fad12cc
Merge branch 'main' into fix-7019
jsuarezruiz Jul 5, 2023
2d9bcd8
Merge branch 'main' into fix-7019
jsuarezruiz Jul 11, 2023
a2e207c
Merge branch 'main' into fix-7019
jsuarezruiz Jul 18, 2023
4a5dbf2
Merge branch 'main' into fix-7019
jsuarezruiz Jul 25, 2023
375345d
Merge branch 'main' into fix-7019
jsuarezruiz Aug 3, 2023
3ecd591
Merge branch 'main' into fix-7019
jsuarezruiz Aug 8, 2023
cc11d0c
Merge branch 'main' into fix-7019
jsuarezruiz Aug 8, 2023
42e07ca
Merge branch 'main' into fix-7019
jsuarezruiz Aug 10, 2023
b63105a
Merge branch 'main' into fix-7019
jsuarezruiz Aug 16, 2023
aec4154
Merge branch 'main' into fix-7019
jfversluis Sep 5, 2023
4c1331f
Fix merge mistake
jfversluis Sep 5, 2023
2c0cb0a
Merge branch 'main' into fix-7019
jsuarezruiz Sep 12, 2023
dce29d6
Merge branch 'main' into fix-7019
jsuarezruiz Sep 21, 2023
4b57cbc
Merge branch 'main' into fix-7019
jsuarezruiz Oct 11, 2023
526c417
Merge branch 'main' into fix-7019
jsuarezruiz Oct 17, 2023
7b01b8c
Merge branch 'main' into fix-7019
jsuarezruiz Oct 18, 2023
63afc63
Merge branch 'main' into fix-7019
jsuarezruiz Nov 14, 2023
4cc7eb9
Merge branch 'main' into fix-7019
jsuarezruiz Dec 12, 2023
984c9c5
Merge branch 'main' into fix-7019
jsuarezruiz Jan 15, 2024
d5513e2
Merge branch 'main' into fix-7019
jsuarezruiz Jan 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@
</FontImageSource>
</Image.Source>
</Image>
<Label
Text="Animating a gif"
Style="{StaticResource Headline}"/>
<Switch
x:Name="IsAnimationPlayingSwitch"
IsToggled="True"/>
<Image
Source="animated_heart.gif"
WidthRequest="200"
IsAnimationPlaying="{Binding Source={x:Reference IsAnimationPlayingSwitch},Path=IsToggled}" />
<Label
Text="Opacity (0.5)"
Style="{StaticResource Headline}"/>
Expand Down
9 changes: 7 additions & 2 deletions src/Core/src/Handlers/Image/ImageHandler.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,13 @@ public static void MapIsAnimationPlaying(IImageHandler handler, IImage image) =>
public static void MapSource(IImageHandler handler, IImage image) =>
MapSourceAsync(handler, image).FireAndForget(handler);

public static Task MapSourceAsync(IImageHandler handler, IImage image) =>
handler.SourceLoader.UpdateImageSourceAsync();
public static Task MapSourceAsync(IImageHandler handler, IImage image)
Copy link
Member

Choose a reason for hiding this comment

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

Should we just make this an async Task and then await each? Not sure if this may have issues with the ContinueWith... Are we sure the threads will be correct when the source finishes?

{
return handler
.SourceLoader
.UpdateImageSourceAsync()
.ContinueWith((action) => handler.PlatformView.UpdateIsAnimationPlaying(image));
jsuarezruiz marked this conversation as resolved.
Show resolved Hide resolved
}

void OnSetImageSource(Drawable? obj) =>
PlatformView.SetImageDrawable(obj);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ await InvokeOnMainThreadAsync(async () =>
}

[Theory(
#if __IOS__ || __ANDROID__
Skip = "Animated GIFs are not yet supported on iOS. Test failing on ANDROID"
#if __IOS__ || __ANDROID_30__
Skip = "Animated GIFs are not yet supported on iOS."
jsuarezruiz marked this conversation as resolved.
Show resolved Hide resolved
#endif
)]
[InlineData("animated_heart.gif", true)]
Expand Down