* Apply tint to Button image on Android and Windows
* Update sample app to add a reproduction of the problem being fixed
* use pattern matching for null check
* Use curly braces with if statements
* Try again to add curly brace for if statement
* Add interactive logic to new button
* Refactor logic
* `dotnet format`
* Remove comment
* Fix Button Height
* Update Windows Logic
---------
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
* Fix for AvatarView child UriImageSource dimensions not being correctly applied.
* Added sample to show AvatarView with an image, border and padding.
* Update Unit Test
* Fix `ImageSourceParentSize_WhenStrokeShapeSet` Test
---------
Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
* Reverted previous commit change to LoadAndApplyImageTintColor to fix tint not applying to URIs
* Use `sender`
* Swap the order of checks to prevent an unnecessary exception (#1926)
* Swap the order of checks to prevent an unnecessary exception from being thrown
* Tidy up usage
---------
Co-authored-by: Shaun Lawrence <17139988+bijington@users.noreply.github.com>
Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
* Added UriImageSource check to change wImage source from being null when given a URL
* Fixed formatting
* Fix compiler errors
* Add UriImageSource to `IconTintColorBehaviorPage`
* Update formatting
* Update IconTintColorBehaviorPage.xaml
* Fix Column Numbers
* Add Support for SVG
* Use `Path.GetExtension`
* Add note about MAUI bug not support
---------
Co-authored-by: Megan Yi <300613@hubbell.com>
Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Co-authored-by: Shaun Lawrence <shaunrlawrence@gmail.com>
Co-authored-by: Shaun Lawrence <17139988+bijington@users.noreply.github.com>
* Swap the order of checks to prevent an unnecessary exception from being thrown
* Tidy up usage
---------
Co-authored-by: Shaun Lawrence <17139988+bijington@users.noreply.github.com>
Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
* Set unloaded event to make sure popup is shown on Windows.
* Fix memory leak
* Use latest stable version of `Microsoft.Maui.Controls` and `Microsoft.Maui.Controls.Compatibility` in Sample App
* Fix `UpdatingPopup` height
* Refactor code to use `sender`
---------
Co-authored-by: Guido Neele <guido@neele.dev>
Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
* CameraView and sample app initial commit
* Added analyzer projects for CameraView
* CameraView update
* Add exception handling when AvailableCameras is empty
* Use expression body
* Remove nullable in CameraInfo
* Remove CommunityToolkit.Mvvm
* Add in the initial XML docs
* Improve handler example
* Add MacCatalyst Support, Make CameraInfo Immutable, Update Formatting
* Update async/await
* Reduce public API surface, Update Namespaces, Implement `CameraViewException`
* Update ICameraView + CameraViewHandler for async/await, Update Sample App
* `donet format`
* Update Property Name
* re-enable `WarningsAsErrors`
* Update `info.plist`
* Change `CameraViewExtensions` to `internal`, Fix async/await on `CameraViewExtensions.windows.cs`
* Resolve Dereference of Null
* Fix async/await for UpdateAvailability on Windows
* Reduce scope of `CameraProvider` to `internal`
* Add InitializeCameraForCameraView Extension Method
* Add Cancellation Token
* Extensions xml docs
* Further XML docs tidy up
* Swap to auto mode
* Initial 'support' for Tizen
* Move comma to allow for no more parameters for Tizen
* Use `.OfType<ImageEncodingProperties>()`
* `dotnet format`
* Remove `.GetAwaiter().GetResult()`, Use CancellationToken
* Include the camera view details in the toolkits xmlns
* Add CameraView to build pipeline
* Disable Tizen target
* Disable Tizen target for the right project
* Expose commands to support capture image, start and stop preview
* Reinstate Tizen
* Opt for full names
* Update file names and add dummy Tizen implementation
* Add dummy Tizen CameraViewExtensions
* Fix namespace for partial class
* Update CameraManager.tizen.cs
* Add missing methods
* Finally fix Tizen
* Update CameraProvider.tizen.cs
* Update AppBuilderExtensions.shared.cs
* Add XML
* Fix CameraView on Windows
* Fix Android Bug
* Update Tizen Method Declarations
* Update Sample
* Rename `CameraView` -> `Camera`
* Remove `IAvailability`
* Refactor
* Fix Build Pipeline
* Fix Project References
* Revert to Xcode 15.2.0
* Fix Analyzer
* Update CameraViewHandler.shared.cs
* Add Global Usings for Tizen
* Change `ICommand` -> `Command<CancellationToken> `
* Update Sample App to use CancellationToken
* `dotnet format`
* Update GlobalUsings.shared.cs
* Update GlobalUsings.shared.cs
* Fix Tizen Build Errors
* Add CameraViewDefaults
* Add Unit Tests
* Remove duplicate Unit Tests
* Update src/CommunityToolkit.Maui.Camera/CameraManager.android.cs
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
* Update src/CommunityToolkit.Maui.Camera/CameraManager.android.cs
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
* Update src/CommunityToolkit.Maui.Camera/CameraManager.android.cs
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
* Update src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
* fix `ToList` call
* add alias for System.Math
* use ArrayPool on CameraManager
* use ArrayPool on CameraManager.macios
* Fix formatting
* Remove Null Forgiving Operator
* Incorporate Pedro's Review Comments
* `CameraViewException` -> `CameraException`
* `dotnet format`
* Code tidy up and make CameraProvider public
* Remove the call to UpdateCameraInfo
* Add remarks to `CameraProvider.AvailableCameras`
* Revert `CameraProvider` to `Internal`, Add `ICameraProvider` Example to Sample App
`ICameraProvder` is public and can be accessed via Dependency Injection (or IPlatformApplication.Current.Services.GetRequiredService<ICameraProvider>()
* Revert CTS causing TaskCancellationException
* Inherit xml docs from interface
* Update ICameraProvider.shared.cs
---------
Co-authored-by: Gerald Versluis <gerald@verslu.is>
Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>
Co-authored-by: Shaun Lawrence <17139988+bijington@users.noreply.github.com>
Co-authored-by: Jay Cho <chojoong@gmail.com>
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
* The most significant changes involve the addition of new metadata properties to the `MediaElement` class and the creation of a new `MediaElementSourceType.cs` file. The metadata properties allow the media player to display more information about the media being played, such as title, album, artist, genre, artwork, and source type. The `MediaElementSourceType.cs` file introduces a new `enum` type that represents different types of media sources.
1. Added new properties to the `MediaElement` class to support metadata such as title, album, artist, genre, artwork, and source type. This allows the media player to display more information about the media being played.
2. Updated the `MediaElementPage.xaml` and `MediaElementPage.xaml.cs` files to use the new metadata properties in the `MediaElement` class.
3. Added new code in the `MediaManager.macios.cs` and `MediaManager.windows.cs` files to handle the metadata properties when playing media.
4. Added new code in the `Info.plist` file to allow the app to play audio in the background on iOS.
5. Added a new `MetaDataExtensions` class to handle setting the metadata for the system media controls on iOS and Windows.
6. Updated the `IMediaElement` interface to include the new metadata properties.
7. Updated the `MediaElement.shared.cs` file to include the new bindable properties for the metadata.
8. Updated the `MediaManager` class to handle the metadata when the media source is changed.
9. Updated the `MediaManager` class to update the metadata when the media state changes.
10. Updated the `MediaManager` class to clear the metadata when the media source is reset.
11. Created a new file named `MediaElementSourceType.cs` in the `CommunityToolkit.Maui.Primitives` namespace. This file defines a new `enum` type named `MediaElementSourceType` that represents different types of media sources, including `Video`, `Audio`, and `Unknown`.
* The most significant changes involve updates to various project files, the addition of new permissions and services, changes to the launch mode, and the addition of new vector graphics and shapes. The `CommunityToolkit.Maui.Sample.csproj` and `CommunityToolkit.Maui.MediaElement.csproj` files were updated to include new `PropertyGroup` and `PackageReference`. The `AndroidManifest.xml` file was updated to include new permissions and a new service was added to the application. The `MainActivity.cs` file was updated to change the `LaunchMode` from `SingleTask` to `SingleInstance`. Several new XML files were added, which define various vector graphics and shapes used in the application's UI.
Here is a list of the changes:
1. `CommunityToolkit.Maui.Sample.csproj` file was updated to include a new `PropertyGroup` and a new `PackageReference` was added.
2. `AndroidManifest.xml` file was updated to include new permissions and a new service was added to the application.
3. `MainActivity.cs` file was updated to change the `LaunchMode` from `SingleTask` to `SingleInstance`.
4. `AppBuilderExtensions.shared.cs` file was updated to include new using directives and a new service was added to the `MauiAppBuilder`.
5. `CommunityToolkit.Maui.MediaElement.csproj` file was updated to include a new `PackageReference`.
6. `MediaManager.android.cs` file was updated to include new using directives, new properties, and new methods. The `Dispose` method was also overridden to include additional cleanup logic.
7. New permissions were added in the `AndroidPermissions.android.cs` file.
8. Several new XML files were added, which define various vector graphics and shapes used in the application's UI.
9. The `ic_forward_30_black_32dp.xml` file was updated to include a new path data for the vector graphic.
10. Added Apache License 2.0 to multiple XML files.
11. Added new vector XML files for various icons.
12. Added Apache License, Version 2.0 to the source files.
13. Added vector graphics for a thumb up icon in `ic_thumb_up_black_32dp.xml`.
14. Added a gradient background shape in `media_controls_mask_background.xml`.
15. Added a solid color shape with stroke, corners, and padding in `media_details_mask_background.xml`.
16. Added a selector for tab indicator in `tab_indicator.xml`.
17. Added a shape for test result divider in `test_result_divider.xml`.
18. Added a gradient background shape with padding and size in `tv_bg.xml`.
19. Added color resources in `colors.xml`.
20. Added dimension resources in `dimens.xml`.
21. Added string resources in `strings.xml`.
22. Added styles in `styles.xml`.
23. Changes in `testing_strings.xml` involve the addition of a large number of string resources.
24. Changes in `MediaControlsService.android.cs` involve the creation of a new `MediaControlsService` class.
* The most significant changes involve the refactoring of the `MediaControlsService` and `MediaManager` classes in the `MediaControlsService.android.cs` and `MediaManager.android.cs` files respectively. Both classes have been updated to use new methods from the `MetaDataExtensions` class for setting notifications and metadata, instead of using the `MediaMetadataCompat.Builder` and `AndroidX.Core.App.NotificationCompat.Builder` classes directly. Additionally, the `startForegroundService` method in `MediaControlsService.android.cs` was renamed to `startForegroundServiceAsync`, made asynchronous, and had its parameters updated. A new file, `MetaDataExtensions.android.cs`, was also added, containing extension methods for setting notifications and metadata.
1. Unused `using` directives were removed from `MediaControlsService.android.cs` and `MediaManager.android.cs`, and new ones were added to `MetaDataExtensions.android.cs`.
2. The `startForegroundService` method in `MediaControlsService.android.cs` was renamed to `startForegroundServiceAsync`, made asynchronous, and had its parameters changed.
3. The `MediaControlsService` constructor was modified to initialize `bitmap` and `stateBuilder` to `null`.
4. The `MediaControlsService` and `MediaManager` classes were updated to use the new `MetaDataExtensions` methods for setting notifications and metadata.
5. The `MediaControlsService` and `MediaManager` classes no longer use the `MediaMetadataCompat.Builder` and `AndroidX.Core.App.NotificationCompat.Builder` classes directly.
6. The `OnMediaSessionStop` method was removed from `MediaManager.android.cs`.
7. The `CheckAndRequestForeGroundPermission` method in `MediaManager.android.cs` was made static and no longer returns a status.
8. The `StartService` and `StopService` methods in `MediaManager.android.cs` were made protected, and `StopService` was made static.
9. A new file, `MetaDataExtensions.android.cs`, was added, containing extension methods for setting notifications and metadata, as well as a method for getting a `Bitmap` from a URL.
* The most significant changes involve the addition of a new parameter `duration` to several methods in different files. This parameter is used to set the duration of the media in various contexts. Additionally, the `SetMetadata` method now includes a `position` parameter. The keys used in the `SetMetadata` method have also been updated.
1. The `SetNotifications` method in `MetaDataExtensions.android.cs` now includes a `duration` parameter, which is used to set the duration of the media in the notification. (See `MetaDataExtensions.android.cs`)
2. The `SetMetadata` method in `MetaDataExtensions.android.cs` now includes `duration` and `position` parameters, which are used to set the duration and position of the media in the metadata. (See `MetaDataExtensions.android.cs`)
3. The `startForegroundServiceAsync` method in `MediaControlsService.android.cs` now includes a `duration` parameter, which is used when calling the `SetNotifications` and `SetMetadata` methods. (See `MediaControlsService.android.cs`)
4. The `OnStartCommand` method in `MediaControlsService.android.cs` has been updated to retrieve the `duration` from the intent extras and pass it to the `startForegroundServiceAsync` method. (See `MediaControlsService.android.cs`)
5. The `StartService` method in `MediaManager.android.cs` now puts the `duration` into the intent extras, and the `position` and `currentTime` values are now being cast to `long` instead of `int`. (See `MediaManager.android.cs`)
6. The keys used in the `SetMetadata` method in `MetaDataExtensions.android.cs` have been updated to `MediaMetadata.MetadataKeyAlbumArtist`, `MediaMetadata.MetadataKeyArtist`, `MediaMetadata.MetadataKeyTitle`, and `MediaMetadata.MetadataKeyAlbumArt`. (See `MetaDataExtensions.android.cs`)
* The most significant changes were made to the `MediaControlsService.android.cs` and `MediaManager.android.cs` files. In `MediaControlsService.android.cs`, new functionality related to audio focus and volume control was added, and the `startForegroundServiceAsync` method was significantly refactored to include these new features. The `createNotificationChannel` method was also renamed to `CreateNotificationChannel` to adhere to C# naming conventions.
Changes:
1. In `MetaDataExtensions.macios.cs`, a redundant return statement was removed from the `SetMetaData` method.
2. In `MetaDataExtensions.shared.cs`, the summary comments for the `MetaDataExtensions` class and its constructor were updated to provide a more detailed explanation of the class's purpose.
3. In `MediaControlsService.android.cs`, two new `using` directives were added for `Android.Media` and `Stream = Android.Media.Stream`. The `MediaControlsService` class was updated to include new functionality related to audio focus and volume control. The `startForegroundServiceAsync` method was refactored to include these new features, and the `createNotificationChannel` method was renamed to `CreateNotificationChannel`.
* The most significant changes involve the addition of new media control actions, the replacement of `Android.Support.V4.Media.Session.PlaybackStateCompat.Builder` with `PlaybackStateCompat.Builder`, and the inclusion of the `System.Net` namespace in the `MediaManager.android.cs` file.
1. The `AndroidManifest.xml` file has been updated to include a new permission for `MEDIA_CONTENT_CONTROL`. This change allows the application to control media content within its environment.
2. The `SetNotifications` method in `MetaDataExtensions.android.cs` has been updated to include additional media control actions such as "Previous", "Pause", "Play", "Next", "FastForward", and "Rewind". The notification icon has also been changed from `exo_ic_audiotrack` to `exo_styled_controls_audiotrack`.
3. The `MediaControlsService.android.cs` file has been updated to replace `Android.Support.V4.Media.Session.PlaybackStateCompat.Builder` with `PlaybackStateCompat.Builder`. This change simplifies the code and improves compatibility. Additionally, a new task has been added to asynchronously fetch the bitmap from a URL.
4. The `startForegroundServiceAsync` method in `MediaControlsService.android.cs` has been updated to change the actions set in the `PlaybackStateCompat.Builder`. This change allows the application to control the playback state.
5. The `MediaManager.android.cs` file has been updated to include the `System.Net` namespace. This change allows the application to use classes and methods for sending data to and receiving data from a resource identified by a URI. The `MediaManager` class has been updated to set the enabled playback actions in the `MediaSessionConnector` and to add the `FlagHandlesQueueCommands` flag to the `MediaSessionCompat`.
6. The `PlayerView` in `MediaManager.android.cs` has been updated to disable the controller auto show and use controller options. This change gives the application more control over the player view.
* Add permissions and background modes for MacCatalyst app
Update now playing info with avplayer to true if using Mac. False for IOS.
* Fix playback rate type conversion in MetaDataExtensions.macios.cs and handle UpdatesNowPlayingInfoCenter based on platform in MediaManager.macios.cs
* The most significant changes involve the removal of the `MetaDataExtensions` class from several files and the addition of new namespaces and objects in `MediaControlsService.android.cs` and `MediaManager.android.cs`. The `startForegroundServiceAsync` and `StartService` methods in these files were also modified, and a `Dispose` method was added to `MediaControlsService.android.cs`.
1. The `MetaDataExtensions` class was removed from `MetaDataExtensions.android.cs` and `MetaDataExtensions.shared.cs`, and its methods were moved to other classes. It was also changed from a partial class to a regular class in `MetaDataExtensions.macios.cs` and `MetaDataExtensions.windows.cs`.
2. The `MediaControlsService.android.cs` file saw the addition of `System.Runtime.InteropServices` and `Microsoft.Win32.SafeHandles` namespaces, and a rearrangement of the order of namespaces. A `SafeHandle` object and an `AudioManager` object were also added to this file.
3. The `startForegroundServiceAsync` method in `MediaControlsService.android.cs` was modified to remove parameters and change the implementation. A `Dispose` method was also added to this file to dispose of resources.
4. The `MediaManager.android.cs` file saw the addition of `Android.Content.Res`, `Android.Graphics`, `Android.Support.V4.Media`, and `Resource` namespaces, and a rearrangement of the order of namespaces. The `GetBitmapFromUrl` method was moved from `MetaDataExtensions.android.cs` to this file.
5. The `StartService` method in `MediaManager.android.cs` was modified to remove parameters and change the implementation. The `assetFilePath` in the `OnVolumeChanged` method was changed to use `System.IO.Path.PathSeparator` instead of `Path.PathSeparator`, and the `StartService` method call was changed to be asynchronous.
* The most significant changes were made to the `MediaControlsService.android.cs` and `MediaManager.android.cs` files. In `MediaControlsService.android.cs`, the `MediaControlsService` class was updated to be enabled by default and the `startForegroundServiceAsync` method was modified to accept an `Intent` object instead of a `MediaSessionCompat.Token` object. The `OnStartCommand` method was updated to handle different media actions and the `Dispose` method was updated to abandon audio focus. In `MediaManager.android.cs`, a static `MediaControllerCompat` object was added to the `MediaManager` class and the constructor was updated to set the media session to active. The `CheckAndRequestForeGroundPermission` method was updated to display an alert if the notification permission is denied and the `StartService` method was updated to put extra information into the intent.
Changes:
1. In `AndroidManifest.xml`, an intent filter was added to the `CommunityToolkit.Maui.Services` service to handle `android.intent.action.MEDIA_BUTTON` actions.
2. In `MediaControlsService.android.cs`, the `MediaControlsService` class was updated to be enabled by default.
3. The `startForegroundServiceAsync` method in `MediaControlsService.android.cs` was updated to accept an `Intent` object instead of a `MediaSessionCompat.Token` object.
4. The `OnStartCommand` method in `MediaControlsService.android.cs` was updated to handle different media actions.
5. The `Dispose` method in `MediaControlsService.android.cs` was updated to abandon audio focus and set the audio manager's parameters to "Ducking=false".
6. In `MediaManager.android.cs`, a static `MediaControllerCompat` object was added to the `MediaManager` class.
7. The `MediaManager` constructor in `MediaManager.android.cs` was updated to set the media session to active.
8. The `CheckAndRequestForeGroundPermission` method in `MediaManager.android.cs` was updated to display an alert if the notification permission is denied.
9. The `StartService` method in `MediaManager.android.cs` was updated to put extra information into the intent.
* The most significant changes to the `MediaControlsService` class involve the addition of new fields and methods, and the refactoring of existing methods to improve readability and maintainability. The new fields `notification` and `pendingIntentFlags` have been added, and the `startForegroundServiceAsync` method has been broken down into three new methods: `OnSetupAudioServices`, `OnSetContent`, and `OnSetIntents`. The `OnStartCommand` method has been refactored to use a switch statement for better readability. A new static method `CreateNotificationChannel` has also been added.
List of changes:
1. Addition of a new `NotificationCompat.Builder?` field named `notification` and a `PendingIntentFlags` field named `pendingIntentFlags` to the `MediaControlsService` class.
2. Refactoring of the `startForegroundServiceAsync` method to improve readability. The setup of audio services, setting of content, and setting of intents have been moved to their own methods: `OnSetupAudioServices`, `OnSetContent`, and `OnSetIntents`.
3. Refactoring of the `OnStartCommand` method to use a switch statement instead of multiple if-else statements for better readability.
4. Addition of a new static method `CreateNotificationChannel` to create a notification channel.
5. The `Dispose` method remains unchanged.
These changes adhere to the Single Responsibility Principle of SOLID design principles, making the code easier to understand and maintain.
* minor cosmetic fixes
* The most significant changes involve renaming and redefining certain properties related to media metadata in a media player application. The properties `MetadataTitle`, `MetadataAlbum`, `MetadataArtist`, `MetadataGenre`, and `MetadataArtwork` have been replaced with `ContentTitle`, `ContentText`, and `LargeImageUrl` respectively. These changes have been implemented across multiple files, including the interface `IMediaElement` and the media element's metadata properties in `MediaElementPage.xaml` and `MediaElementPage.xaml.cs`.
List of changes:
1. Renamed and redefined media metadata properties from `MetadataTitle`, `MetadataAlbum`, `MetadataArtist`, `MetadataGenre`, and `MetadataArtwork` to `ContentTitle`, `ContentText`, and `LargeImageUrl` across multiple files.
2. Updated the media element's metadata properties in `MediaElementPage.xaml` to use the new properties.
3. Set the media element's metadata properties to new values based on the source of the media in `MediaElementPage.xaml.cs`.
4. Updated the media metadata to use the new properties in `MetaDataExtensions.macios.cs` and `MetaDataExtensions.windows.cs`.
5. Updated the interface `IMediaElement` to include the new properties in `IMediaElement.cs`.
6. Updated the bindable properties and their getters and setters to reflect the new properties in `MediaElement.shared.cs`.
7. Updated the media metadata to use the new properties when starting the service in `MediaManager.android.cs`.
* The most significant changes involve renaming and redefining certain properties related to media metadata in a media player application. The properties `ContentTitle`, `ContentText`, and `LargeImageUrl` have been renamed to `MetaDataTitle`, `MetaDataArtist`, and `MetaDataArtworkUrl` respectively. These changes have been implemented across multiple files.
1. In `MediaElementPage.xaml`, the properties `LargeImageUrl`, `ContentTitle`, and `ContentText` have been replaced with `MetaDataArtworkUrl`, `MetaDataTitle`, and `MetaDataArtist` respectively. (See `MediaElementPage.xaml` changes)
2. The `ChangeSourceClicked` method in `MediaElementPage.xaml.cs` has been updated to use the new property names for different cases including `loadOnlineMp4`, `loadHls`, `resetSource`, and `loadLocalResource`. (See `MediaElementPage.xaml.cs` changes)
3. The `SetMetaData` method in `MetaDataExtensions.macios.cs` and `MetaDataExtensions.windows.cs` has been updated to use the new property names. (See `MetaDataExtensions.macios.cs` and `MetaDataExtensions.windows.cs` changes)
4. The interface `IMediaElement` in `IMediaElement.cs` has been updated to reflect the new property names. (See `IMediaElement.cs` changes)
5. The bindable properties and their getters and setters in `MediaElement.shared.cs` have been updated to reflect the new property names. (See `MediaElement.shared.cs` changes)
6. The `StartService` method in `MediaManager.android.cs` has been updated to use the new property names. (See `MediaManager.android.cs` changes)
* The most significant change is the removal of a line of code from the `startForegroundServiceAsync` method in the `MediaControlsService.android.cs` file. This line was setting the session activity for the media session, but it was deemed unnecessary as the same line of code is present later in the method.
Changes:
- Removed the line `mediaSession?.SetSessionActivity(pendingIntent);` from the `startForegroundServiceAsync` method in the `MediaControlsService.android.cs` file. This change was made because the same line of code is present later in the method, making this line redundant. (Reference: `MediaControlsService.android.cs`)
* The most significant change is the modification of the `Dispose` method in `MediaControlsService.android.cs`. This change is aimed at enhancing resource management and preventing potential memory leaks.
Changes:
- The `Dispose` method in `MediaControlsService.android.cs` has been updated. A new line of code has been added to release the `mediaSession` before it is disposed of. This is a crucial change as it ensures that any resources held by the `mediaSession` are properly released, thereby preventing potential memory leaks or other resource management issues.
Reference to the code changes:
- Modification of `Dispose` method in `MediaControlsService.android.cs` to include a line of code that releases the `mediaSession` before disposing it.
* The most significant changes in the code involve the refactoring of the `MediaControlsService` and `MediaManager` classes, the removal of content from several XML files, and the addition of new classes to handle updates and notifications.
1. The `MediaControlsService` class in `MediaControlsService.android.cs` has been extensively refactored. New constants for media actions have been added, and methods have been updated to handle media actions and notification events differently. A new `ReceiveUpdates` class has been added to listen for updates from the `MediaManager`. The `Dispose` method has been updated to unregister and dispose the `ReceiveUpdates` object.
2. The `MediaManager` class in `MediaManager.android.cs` has been updated to create and register a new `UIUpdateReceiver` object. The `StartService` and `OnPlaybackStateChanged` methods have been updated to send broadcasts with the current action and start the service when the player is ready. The `Dispose` method has been updated to unregister and dispose the `UIUpdateReceiver` object. A new `UIUpdateReceiver` class has been added to listen for updates from the `MediaControlsService`.
3. The entire content of several XML files, including `strings.xml`, `styles.xml`, `testing_strings.xml`, and various icon and background files, have been removed. This suggests a significant refactoring or restructuring of the project, or the removal of unused or deprecated resources.
References to the code changes can be found in the `MediaControlsService.android.cs`, `MediaManager.android.cs`, `strings.xml`, `styles.xml`, `testing_strings.xml`, and various other XML files.
* The most significant changes in the code include the removal of unused namespaces in `MediaControlsService.android.cs`, the addition of new methods for handling notification events, setting up audio services, broadcasting updates, and disposing resources. Additionally, the accessibility of certain methods in `MediaControlsService.android.cs` and `MediaManager.android.cs` has been limited by changing them from public or protected to private. Error handling has been improved with the addition of null checks and the replacement of a null check with `ArgumentNullException.ThrowIfNull(intent)`.
Here are the changes in detail:
1. Removed the usage of `Android.Views` and `Com.Google.Android.Exoplayer2` namespaces in `MediaControlsService.android.cs` as they are no longer needed.
2. The `startForegroundServiceAsync` method was changed from public to private in `MediaControlsService.android.cs` to limit its accessibility.
3. The null check for `intent` in `OnStartCommand` method was replaced with `ArgumentNullException.ThrowIfNull(intent)` in `MediaControlsService.android.cs` for better error handling.
4. A new method `HandleNotificationEvent` was added in `MediaControlsService.android.cs` to handle notification events.
5. A new method `OnSetupAudioServices` was added in `MediaControlsService.android.cs` to setup audio services.
6. A new method `BroadcastUpdate` was added in `MediaControlsService.android.cs` to broadcast updates.
7. A `Dispose` method was added in `MediaControlsService.android.cs` to properly dispose resources.
8. A `PropertyChanged` event was added in `MediaControlsService.android.cs` to notify when a property has changed.
9. The `GetAction` method in `MediaControlsService.android.cs` was changed to return `Action` directly instead of `Action ?? string.Empty`.
10. Null checks for `mediaSessionConnector`, `Platform.CurrentActivity`, and `mediaSession.SessionToken` were added in `MediaManager.android.cs` to prevent null reference exceptions.
11. The `CheckAndRequestForeGroundPermission` method was changed from protected to private in `MediaManager.android.cs` to limit its accessibility.
12. The `StopService` method was changed from protected to private in `MediaManager.android.cs` to limit its accessibility.
* The `LaunchMode` attribute in `MainActivity.cs` was changed from `SingleInstance` to `SingleTask`. Lastly, the `OnReceive` method in `MediaManager.android.cs` was refactored to use a switch statement and the `player` field was assigned directly in the constructor.
1. `MainActivity.cs`: The `LaunchMode` attribute of the `Activity` annotation was changed from `SingleInstance` to `SingleTask`.
2. `MediaManager.android.cs`: The `OnReceive` method was refactored to use a switch statement instead of multiple if-else statements. The `player` field was assigned directly in the `UIUpdateReceiver` constructor.
The changes in `MediaElementPage.xaml`, `CommunityToolkit.Maui.MediaElement.csproj`, and `MediaManager.windows.cs` were minor and did not affect the functionality of the code.
* The most significant changes involve the `MediaControlsService` and `MediaManager` classes. In `MediaControlsService`, the `startForegroundServiceAsync` method has been updated to include a call to a new method `InitializeNotification`. The `ReceiveUpdates_PropertyChanged` method has also been updated. In `MediaManager`, the `CreatePlatformView` method now includes a call to `InitializeMediaSession`, and the `InitializeMediaSession` method itself has been updated.
Changes:
1. The `MediaControlsService` class now includes a new `PendingIntentFlags` field.
2. The `startForegroundServiceAsync` method in the `MediaControlsService` class has been updated to include a call to `InitializeNotification`.
3. The `ReceiveUpdates_PropertyChanged` method in the `MediaControlsService` class has been updated.
4. The `MediaManager` class now includes a call to `InitializeMediaSession` in the `CreatePlatformView` method.
5. The `InitializeMediaSession` method in the `MediaManager` class has been updated.
* The most significant changes involve the addition of new actions to the media controls and media session in the Android application. The compact view of the media notification will now display four actions instead of three due to changes in the `InitializeNotification` method in `MediaControlsService.android.cs`. The media session now supports seeking to a specific position in the media and toggling between play and pause with a single action due to changes in the `InitializeMediaSession` method in `MediaManager.android.cs`.
Changes:
1. The `SetShowActionsInCompactView` method of the `style` object in the `InitializeNotification` method in `MediaControlsService.android.cs` has been updated to include an additional action at index 0. This allows the compact view of the media notification to show four actions instead of three.
2. The `SetEnabledPlaybackActions` method of the `mediaSessionConnector` object in the `InitializeMediaSession` method in `MediaManager.android.cs` has been updated to include the `PlaybackStateCompat.ActionSeekTo` action and replace the `PlaybackStateCompat.ActionPlay` and `PlaybackStateCompat.ActionPause` actions with the `PlaybackStateCompat.ActionPlayPause` action. This enables the media session to support seeking to a specific position in the media and toggling between play and pause with a single action.
3. In another instance of the `InitializeMediaSession` method in `MediaManager.android.cs`, the `SetActions` method of the `stateBuilder` object has been updated in the same way as the `SetEnabledPlaybackActions` method. Additionally, the `stateBuilder` object is now being created with the `var` keyword instead of explicitly specifying the `PlaybackStateCompat.Builder` type. This doesn't change the functionality of the code, but it does make it a bit more concise.
* The most significant changes involve the refactoring of the `MetaDataExtensions` class in both `MetaDataExtensions.macios.cs` and `MetaDataExtensions.windows.cs` files. The properties `NowPlayingInfo`, `Player`, `mediaElement`, and `systemMediaControls` have been changed from public mutable to readonly, and the constructors have been updated to initialize these properties. The class methods have also been updated to use these new readonly properties and their visibility has been changed from `protected` to `public`.
In addition, the `SetMetaData` method in both files has been refactored for simplification and to use the new readonly properties. The `GetArtwork` and `GetImage` methods have been updated to return a default image when the provided `ImageUri` is not valid or an error occurs.
The `MediaManager` class in `MediaManager.macios.cs` has been updated to use a readonly `MetaDataExtensions` instance, replacing the `MetaData` property with a readonly `metaData` field. The `Dispose`, `TimeControlStatusChanged`, and `RateChanged` methods in this class have been updated to use the new readonly `metaData` field.
Changes:
1. Refactored `MetaDataExtensions` class in `MetaDataExtensions.macios.cs` and `MetaDataExtensions.windows.cs` files, changing properties from public mutable to readonly and updating constructors (MetaDataExtensions.macios.cs, MetaDataExtensions.windows.cs).
2. Updated `MetaDataExtensions` class methods to use new readonly properties and changed visibility from `protected` to `public` (MetaDataExtensions.macios.cs, MetaDataExtensions.windows.cs).
3. Refactored `SetMetaData` method in `MetaDataExtensions.macios.cs` and `MetaDataExtensions.windows.cs` to simplify artwork assignment and use new readonly properties (MetaDataExtensions.macios.cs, MetaDataExtensions.windows.cs).
4. Updated `GetArtwork` and `GetImage` methods to return a default image when `ImageUri` is not valid or an error occurs (MetaDataExtensions.macios.cs).
5. Updated `MediaManager` class in `MediaManager.macios.cs` to use a readonly `MetaDataExtensions` instance and replaced `MetaData` property with a readonly `metaData` field (MediaManager.macios.cs).
6. Updated `Dispose`, `TimeControlStatusChanged`, and `RateChanged` methods in `MediaManager.macios.cs` to use new readonly `metaData` field (MediaManager.macios.cs).
* The most significant changes involve the display of album name and artist name in the media metadata and notification. The album name will no longer be displayed in the notification due to a code change in `MediaControlsService.android.cs`. Meanwhile, the artist name will now be correctly displayed in the media metadata due to a correction in `MediaManager.android.cs`.
Changes:
1. The code that retrieves the album name from the intent extras and sets it as the subtext of the notification has been removed from the `OnSetContent(Intent mediaManagerIntent)` method in `MediaControlsService.android.cs`. This means the album name will no longer be displayed in the notification.
2. The metadata for the artist is now correctly set to `MediaElement.MetaDataArtist` instead of `MediaElement.MetaDataTitle` in the `CheckAndRequestForeGroundPermission()` method of `MediaManager.android.cs`. This means the artist name will now be correctly displayed in the media metadata.
* The most significant changes involve the removal of the `SourceType` property and the `MediaElementSourceType` enum from the `MediaElement` class and its interface `IMediaElement`. This suggests that the distinction between different types of media sources is no longer necessary or is handled differently. The `SourceType` property has also been removed from the `ChangeSourceClicked` method and the `SetMetaData` method, affecting how these methods function. The `SetMetaData` method now treats all media as music for the purposes of displaying metadata. The `SourceType` attribute has also been removed from the `MediaElement` element in the `MediaElementPage.xaml` file. Lastly, the file `MediaElementSourceType.cs`, which contained the `MediaElementSourceType` enum, has been deleted.
List of changes:
1. Removal of `SourceType` property and `MediaElementSourceType` enum from `MediaElement` class and `IMediaElement` interface. This property was used to specify the type of media source.
2. Removal of `SourceType` property from `ChangeSourceClicked` method in `MediaElementPage.xaml.cs`. This method handled the event of changing the media source.
3. Changes to `SetMetaData` method in `MetaDataExtensions.windows.cs`. The code that set the `Type`, `Title`, and `Artist` properties of `systemMediaControls.DisplayUpdater` based on the `SourceType` has been removed. Instead, all media is now treated as music for displaying metadata.
4. Removal of `SourceType` attribute from `MediaElement` element in `MediaElementPage.xaml`. This attribute was used to set the `SourceType` property of the `MediaElement` in the XAML markup.
5. Removal of `SourceType` property from `MediaElement` class and `IMediaElement` interface in `MediaElement.shared.cs`. This property was used to get or set the type of the media source.
6. Deletion of `MediaElementSourceType.cs` file. This file contained the `MediaElementSourceType` enum, which represented different types of media sources.
Note: Removing SourceType affects windows only and is not longer relevent because it is no longer a factor in metadata and was only there for when we had more than two pieces of metadata that were text to display and they had different names depending on source type.
* The most significant change is the reorganization of services related to media under a specific namespace. This change enhances clarity and organization of the code.
Changes:
1. The namespace `CommunityToolkit.Maui.Services` has been replaced with `CommunityToolkit.Maui.Media.Services` in the file `AppBuilderExtensions.shared.cs`. This indicates a reorganization of media-related services under a specific namespace for better clarity and organization (Reference: `AppBuilderExtensions.shared.cs`).
2. The same namespace change has been applied to the file `MediaControlsService.android.cs`, further emphasizing the reorganization of media services (Reference: `MediaControlsService.android.cs`).
3. The namespace change has also been implemented in the file `MediaManager.android.cs`, consolidating the shift of media services to a specific namespace (Reference: `MediaManager.android.cs`).
* The most significant changes include the conditional inclusion of permissions in the `AndroidPermissions` class, the addition of a `Dispose` method in the `MetaDataExtensions` class, the change in return type in the `MediaControlsService` class, and the inclusion of a static `HttpClient` instance in the `MediaManager` class.
1. The `AndroidPermissions` class in `AndroidPermissions.android.cs` now includes the permissions `ForegroundService` and `PostNotifications` only for Android versions 28.0 or greater and 33.0 or greater respectively. This change ensures that the application only requests necessary permissions based on the Android version.
2. The `MetaDataExtensions` class in `MetaDataExtensions.macios.cs` has been made disposable with the addition of a `Dispose` method. This method helps in cleaning up resources used by the class. Other changes in this class include simplification of the `ClearNowPlaying` method, modification of the `GetArtwork` method to return a default image if the image is null, and an update to the `ToggleCommand` method to call the `Play` method directly.
3. The `MediaControlsService` class in `MediaControlsService.android.cs` now returns `StartCommandResult.Sticky` instead of `StartCommandResult.NotSticky`. This change ensures that the service remains running until it is explicitly stopped. The `startForegroundServiceAsync` method now uses `ConfigureAwait(false)` to avoid deadlocks, and the `ReceiveUpdates_PropertyChanged` method directly accesses the `Action` property, eliminating the need for the `GetAction` method.
4. The `MediaManager` class in `MediaManager.android.cs` now includes a static `HttpClient` instance. The `GetBitmapFromUrl` method uses this instance to make requests, improving the efficiency of the method. The `MediaManager` class in `MediaManager.macios.cs` has been made disposable, and the initialization of the `UIApplication.SharedApplication.BeginReceivingRemoteControlEvents` method now uses the `Dispatcher` to ensure it runs on the main thread.
* The most significant changes involve modifications to the `MediaControlsService.android.cs` file. The first change is in the `Dispose` method where the discarding of the result of the `AbandonAudioFocus` method call has been removed. The second change is the sealing of the `ReceiveUpdates` class, preventing it from being inherited from.
Changes:
1. In the `Dispose` method of the `MediaControlsService.android.cs` file, the line `_ = (audioManager?.AbandonAudioFocus(null));` has been replaced with `audioManager?.AbandonAudioFocus(null);`. This change removes the discarding of the result of the `AbandonAudioFocus` method call, meaning the result of the method call is no longer being explicitly ignored.
2. The `ReceiveUpdates` class in the `MediaControlsService.android.cs` file has been made `sealed`. This means that the `ReceiveUpdates` class cannot be inherited from. The `sealed` keyword in C# is used to prevent inheritance of a class or override of a method.
* The most significant changes involve the `MetaDataExtensions` class in both `MetaDataExtensions.macios.cs` and `MetaDataExtensions.windows.cs` files. In the former, the `Artwork` property has been altered to create a `defaultImage` instead of a new `MPMediaItemArtwork` with a new `UIImage`. In the latter, a new `IDispatcher` field named `dispatcher` has been added, and the constructor has been updated to accept an `IDispatcher` parameter. The `SystemMediaControls_ButtonPressed` method has also been updated to use the `dispatcher` for dispatching `Play` and `Pause` methods of `mediaElement` when necessary. Additionally, in `MediaManager.windows.cs`, the instantiation of `metaDataExtensions` in the `UpdateMetaData` method now includes the `Dispatcher` as a parameter.
Changes:
1. In `MetaDataExtensions.macios.cs`, the `Artwork` property now creates a `defaultImage` instead of a new `MPMediaItemArtwork` with a new `UIImage`.
2. In `MetaDataExtensions.windows.cs`, a new `IDispatcher` field named `dispatcher` has been added to the `MetaDataExtensions` class. The constructor of the class has been updated to accept an `IDispatcher` parameter and assign it to the `dispatcher` field.
3. The `SystemMediaControls_ButtonPressed` method in `MetaDataExtensions.windows.cs` has been updated to use the `dispatcher` to dispatch the `Play` and `Pause` methods of `mediaElement` if dispatching is required.
4. In `MediaManager.windows.cs`, the instantiation of `metaDataExtensions` in the `UpdateMetaData` method now passes the `Dispatcher` as a parameter.
* The most significant changes in the code are the refactoring of condition checks in `MetaDataExtensions.macios.cs`, the update of the `GetArtwork` method in the same file, and the changes in `MediaControlsService.android.cs` and `MediaManager.android.cs` files. The refactoring simplifies the code and makes it easier to read, while the updates to the `GetArtwork` method and the `MediaControlsService.android.cs` and `MediaManager.android.cs` files enhance functionality and improve error handling.
1. The `MetaDataExtensions.macios.cs` file has been refactored to check if either `player` or `commandEvent` is null at the start of the method and return `MPRemoteCommandHandlerStatus.CommandFailed` if so. This simplifies the code and improves readability.
2. The `GetArtwork` method in `MetaDataExtensions.macios.cs` now returns a new `MPMediaItemArtwork` object created with the `image` if it is not null, instead of returning `defaultImage`.
3. The `MediaControlsService.android.cs` file has been updated with renamed and new string constants. The `OnStartCommand` method now broadcasts an update with the action from the intent if `receiveUpdates` is not null. The `startForegroundServiceAsync` method now takes a `CancellationToken` parameter and uses it when initializing the notification.
4. The `MediaManager.android.cs` file has several changes. The `CreatePlatformView` method now logs an error if the foreground permission check fails. The `StartService` method starts the service in the background if the Android version is less than Oreo. The `BroadcastUpdate` method logs an error if the Android version is Tiramisu or higher.
5. The `UIUpdateReceiver` class in `MediaManager.android.cs` now takes an `IExoPlayer` parameter in its constructor. The `OnReceive` method checks if the action from the intent equals `MediaControlsService.ACTION_UPDATE_PLAYER` and performs the appropriate action on the player.
6. The `TimeControlStatusChanged` method in `MediaManager.macios.cs` now calls the `SetMetaData` method on `metaData` with `PlayerItem` and `MediaElement` as parameters.
* Fix potential security issue with having `android:exported` by not exporting the class.
The most significant change is the modification of the `android:exported` attribute and the `Exported` property in the `AndroidManifest.xml` and `MediaControlsService.android.cs` files respectively. This change restricts the accessibility of the `CommunityToolkit.Maui.Services` service to only the application that declares it, preventing its use by other applications.
List of Changes:
1. The `android:exported` attribute in the `service` tag of the `AndroidManifest.xml` file has been changed from `true` to `false`. This restricts the `CommunityToolkit.Maui.Services` service to the application that declares it (Reference: `AndroidManifest.xml`).
2. The `Exported` property in the `Service` attribute of the `MediaControlsService.android.cs` file has been changed from `true` to `false`. This also limits the accessibility of the `CommunityToolkit.Maui.Services` service to the declaring application (Reference: `MediaControlsService.android.cs`).
* Update src/CommunityToolkit.Maui.MediaElement/Extensions/MetaDataExtensions.macios.cs
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
* Update src/CommunityToolkit.Maui.MediaElement/Extensions/MetaDataExtensions.windows.cs
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
* Update src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.android.cs
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
* Update src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.android.cs
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
* The most significant changes are in the `MetaDataExtensions.macios.cs` file where the `MetaDataExtensions` class and its methods have been refactored. The initialization of `nowPlayingInfoDefault` and `defaultImage` has been moved to separate methods, and a new static readonly field `defaultUIImage` has been added. The `GetArtwork` method has been made static and the `GetImage` method now returns `defaultUIImage` when the `ImageUri` is not a valid URL. The `MetaDataExtensions` constructor has been updated to initialize `nowPlayingInfoDefault` and `defaultImage` with the new methods. The `SetMetaData` method now calls the static `GetArtwork` method.
In the `MetaDataExtensions.windows.cs` file, the `SystemMediaControls_ButtonPressed` method has been renamed to `OnSystemMediaControlsButtonPressed`.
In the `MediaManager.android.cs` file, the `client` field in `MediaManager` class has been made readonly and the `BroadcastUpdate` method now initializes the `Intent` instance inline when calling the constructor.
Changes:
1. Refactored `MetaDataExtensions` class in `MetaDataExtensions.macios.cs` file. Added `defaultUIImage` static readonly field and made `GetArtwork` method static. Added `disposedValue` field.
2. Updated `MetaDataExtensions` constructor in `MetaDataExtensions.macios.cs` file. Initialized `nowPlayingInfoDefault` and `defaultImage` with new methods. Stored `MPRemoteCommandCenter.Shared` instance in `commandCenter` variable.
3. Updated `SetMetaData` method in `MetaDataExtensions.macios.cs` file to call static `GetArtwork` method.
4. Renamed `SystemMediaControls_ButtonPressed` method to `OnSystemMediaControlsButtonPressed` in `MetaDataExtensions.windows.cs` file.
5. Made `client` field readonly in `MediaManager` class in `MediaManager.android.cs` file.
6. Updated `BroadcastUpdate` method in `MediaManager.android.cs` file to initialize `Intent` instance inline when calling the constructor.
* The most significant changes involve the addition of four new fields in the `MediaManager` class and updates to the `MediaManager` constructor, `PlaybackStateCompat.StateSkippingToQueueItem` method, and `Dispose` method. These changes are aimed at managing tasks and cancellation tokens for checking permissions and starting services.
1. Four new fields have been added to the `MediaManager` class in `MediaManager.android.cs`. These fields, namely `checkPermissions`, `startService`, `checkPermissionSourceToken`, and `startServiceSourceToken`, are used to manage tasks and cancellation tokens for checking permissions and starting services.
2. The `MediaManager` constructor has been updated. The code for checking foreground permissions now creates a cancellation token from `checkPermissionSourceToken` and uses it to start the `checkPermissions` task, instead of directly calling `CheckAndRequestForeGroundPermission` and logging an error if it fails.
3. The `PlaybackStateCompat.StateSkippingToQueueItem` method has been updated. The code for starting the service now creates a cancellation token from `startServiceSourceToken` and uses it to start the `startService` task, instead of directly calling `StartService` and logging an error if it fails.
4. The `Dispose` method has been updated to dispose of the `checkPermissionSourceToken` and `startServiceSourceToken` to clean up resources.
* The `Dispose(bool disposing)` method has been updated to remove the event handler `OnMediaPlayerElementPointerMoved` from the `PointerMoved` event of `mediaPlayerElement` when the `Dispose` method is called with `disposing` set to `true`. This change is crucial as it ensures that the event handler is unregistered when the object is disposed, thereby preventing potential memory leaks.
Changes:
1. Update of the method `Dispose(bool disposing)` in `MauiMediaElement.windows.cs` to remove the event handler `OnMediaPlayerElementPointerMoved` from the `PointerMoved` event of `mediaPlayerElement` when the object is disposed.
* reverting last change. Outside scope of PR. Change is needed but is not related to this PR.
* cache the android permissions
* adjust player to work better with async code
* removed cast
* updated tokens to be optional and add a timeout on TCS
* adjust async call with ContinueWith
* inline action since will be used just once
* update event name
* use string instead of String
* fix build error
* Fix build error - class name was changed but filename was not.
* The most significant changes involve the refactoring of the `GetBitmapFromUrl` method in `MediaManager.android.cs` and `MediaControlsService.android.cs`. The `Resources` parameter was removed and the method of creating a default bitmap was altered. This change simplifies the method and removes its dependency on `Resources` and `Resource.Drawable.exo_ic_default_album_image`. Additionally, the `using Resource = Microsoft.Maui.Resource;` statement was removed from `MediaManager.android.cs`, likely due to the `Resource` no longer being needed after the refactoring. Lastly, the calls to `GetBitmapFromUrl` in `OnSetContent` and `StartService` methods were updated to match the new signature of `GetBitmapFromUrl`, with the `Resources` argument being removed.
Changes:
1. Refactoring of `GetBitmapFromUrl` method in `MediaManager.android.cs` and `MediaControlsService.android.cs` to remove `Resources` parameter and change the way a default bitmap is created.
2. Removal of `using Resource = Microsoft.Maui.Resource;` statement from `MediaManager.android.cs`.
3. Update of calls to `GetBitmapFromUrl` in `OnSetContent` and `StartService` methods in `MediaControlsService.android.cs` and `MediaManager.android.cs` to match the new signature of `GetBitmapFromUrl`, removing the `Resources` argument.
* The most significant changes involve the update of the URL for the `MetaDataArtworkUrl` property of the `MediaElement` object and attribute in the `MediaElementPage.xaml.cs` and `MediaElementPage.xaml` files respectively. The previous URL has been replaced with a new one.
Changes:
1. In the `MediaElementPage.xaml.cs` file, the URL for the `MetaDataArtworkUrl` property of the `MediaElement` object has been updated in three places within the `ChangeSourceClicked` method. The new URL is "https://lh3.googleusercontent.com/pw/AP1GczNRrebWCJvfdIau1EbsyyYiwAfwHS0JXjbioXvHqEwYIIdCzuLodQCZmA57GADIo5iB3yMMx3t_vsefbfoHwSg0jfUjIXaI83xpiih6d-oT7qD_slR0VgNtfAwJhDBU09kS5V2T5ZML-WWZn8IrjD4J-g=w1792-h1024-s-no-gm".
2. The `MetaDataArtworkUrl` attribute of the `toolkit:MediaElement` element in the `MediaElementPage.xaml` file has been updated with the same new URL.
* The most significant change is the renaming of the service in the AndroidManifest.xml and MediaControlsService.android.cs files. The service name has been changed from "CommunityToolkit.Maui.Services" to "CommunityToolkit.Maui.Media.Services", indicating a more specific focus on media functionality within the CommunityToolkit.Maui application.
List of Changes:
1. The service name in the AndroidManifest.xml file has been changed from "CommunityToolkit.Maui.Services" to "CommunityToolkit.Maui.Media.Services". This change reflects the service's new focus on media functionality within the CommunityToolkit.Maui application. (Reference: AndroidManifest.xml)
2. Similarly, the service name in the MediaControlsService.android.cs file has been updated from "CommunityToolkit.Maui.Services" to "CommunityToolkit.Maui.Media.Services", further emphasizing the service's media-specific role. (Reference: MediaControlsService.android.cs)
* Update Naming + Formatting
* Fix naming violation
* `dotnet format`
* Remove `NSAppTransportSecurity`
---------
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
The most significant changes in the code include the removal of the `WidthRequest` attribute in `MediaElementPage.xaml`, the addition of the `ResizeableActivity = true` attribute in `MainActivity.cs`, and the modification of the `OnFullscreenButtonClick` method in the `MauiMediaElement` class.
1. The `WidthRequest` attribute of the `MediaElement` toolkit was removed from `MediaElementPage.xaml`. This attribute was previously used to set the width of the media element based on the device type (tablet or default).
2. The `Activity` attribute in `MainActivity.cs` was modified to include `ResizeableActivity = true`. This change allows the activity to be resizable.
3. In `MauiMediaElement.android.cs`, the `Android.Util` namespace was added to the import statements. Two new integer variables `playerHeight` and `playerWidth` were added to the `MauiMediaElement` class. These variables are used to store the height and width of the player view.
4. The `OnFullscreenButtonClick` method of the `MauiMediaElement` class was updated. The new code stores the current player view's height and width, retrieves the display metrics, removes the player view from its current layout, and adds it to a new layout with updated parameters. The code for exiting fullscreen mode was also updated to restore the player view to its original size and layout.
5. In `MediaManager.android.cs`, the import statement for `AndroidX.CoordinatorLayout.Widget` was removed. The `LayoutParameters` attribute of the `PlayerView` object was changed from `FrameLayout.LayoutParams` to `RelativeLayout.LayoutParams`. This change aligns with the updates made in the `MauiMediaElement` class, where the player view is now added to a `RelativeLayout` instead of a `FrameLayout`.
Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
* Add additional generic type definition to allow for the ComparingValue to be defined
* Update the sample application to make use of the ability to simplify XAML usage
* Remove broken cref in xml docs
---------
Co-authored-by: Shaun Lawrence <17139988+bijington@users.noreply.github.com>
Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
* Replace `FrozenSet` with `IReadOnlyList`
* Remove unused namespace
* Replace `children` with `Children`
---------
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
Implementing Fix for Issue #1807. Modify Windows Map Pins Page sample show user. Updated MapHandler.Windows RemoveAllPins() to add back user location if showing user.
Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
* Add `BasePlatformBehavior`
* Create BaseBehaviorTest
* Use BaseBehaviorTest
* Update Binding Logic
* `dotnet format`
* Move + Rename Files
* Add Missing Calls to Base Virtual Methods
* Remove Manual BindingContexts
* Update Unit Tests
* Use `View` for `Element`
* `dotnet format`
* `dotnet format`
* Update src/CommunityToolkit.Maui/Behaviors/BaseBehavior.shared.cs
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
* Use `PropertyName`
* Use `OnViewPropertyChanged`
* Use Trace.Writeline on failure
* Add `private protected` constructors
* Change `OnViewPropertyChanged` from `internal` -> `protected`
* Update to CollectionExpressions
* Update All Unit Test to use Collection Expressions
* Fix XML Comments
* Use Collection Expressions
* `dotnet format`
* `dotnet format`
* Use Collection Expressions
---------
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
* Add `BasePlatformBehavior`
* Create BaseBehaviorTest
* Use BaseBehaviorTest
* Update Binding Logic
* `dotnet format`
* Move + Rename Files
* Add Missing Calls to Base Virtual Methods
* Remove Manual BindingContexts
* Update Unit Tests
* Use `View` for `Element`
* `dotnet format`
* `dotnet format`
* Update src/CommunityToolkit.Maui/Behaviors/BaseBehavior.shared.cs
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
* Use `PropertyName`
* Use `OnViewPropertyChanged`
* Use Trace.Writeline on failure
* Add `private protected` constructors
* Change `OnViewPropertyChanged` from `internal` -> `protected`
* Update to CollectionExpressions
* Update All Unit Test to use Collection Expressions
* Fix XML Comments
---------
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
* init
* code style
* android bits
* code style
* dumb sample to test
* added a11y and initialization
* code style
* improved sample
* code style
* protect against NRE
* windows implementation
* code style
* Added comments to all public methods to enable builds without errors
* Missed some docs required for building
* Touch effect maui (#1326)
* Fixed some issues in Android implementation
* Added iOS implementation for TouchBehavior
* Reformatted code
* Removed duplicated extension methods
---------
Co-authored-by: Christian Rendl <cr@mutor.at>
* Bringing touch-effect up to date with main (#1383)
* Popup v6 windows (#1086)
Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
Co-authored-by: Shaun Lawrence <shaunrlawrence@gmail.com>
* ♻️ [Housekeeping] Fixed GravatarImageSourceTests.TestDefaultStream (#1335)
* [housekeeping] Automated PR to fix formatting errors (#1327)
* Fix popup margin on iOS (#1329)
* Bump NuGet.Protocol from 6.6.1 to 6.7.0 in /samples (#1330)
* Use fully qualified namespace for Color reference in TextToColorGenerator (#1332)
* Use fully qualified namespace for Color reference in TextToColorGenerator to prevent collisions
This change should prevent "ambiguous reference" error to occur when other packages are included in a MAUI project that provide their own Color objects
* added global prefix to be safer
---------
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
* Code cleanup and preparation for the next release (breaking changes) (#1324)
* Code cleanup and preparation for .net 8
* Update CompareConverter.shared.cs
* Revert global.json
* More CleanUps
* Remove redundant TrySetCanceled and rely on speech recognition result
* Update Formatting
---------
Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
* Fix Gestures on Popup on ios (#1342)
* Fix Gestures on Popup on ios
* don't query type cast directly
* Code for AddLogicalChild (.NET 8)
* reduce changes
* setting the parent fixes the BindingContext of the view
* Revert "setting the parent fixes the BindingContext of the view"
This reverts commit 0a64b56ca5.
* reduce changes
* simplify code
* fixing build
* assigned Element to contentPage.Parent
---------
Co-authored-by: pedrojesus <pedrojesus.cefet@gmail.com>
* `global.json`: Change `"rollForward": "latestMajor",` -> `"rollForward": "latestFeature"`. (#1338)
Update global.json
* Bump Microsoft.NET.Test.Sdk from 17.7.0 to 17.7.1 in /samples (#1348)
Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.7.0 to 17.7.1.
- [Release notes](https://github.com/microsoft/vstest/releases)
- [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md)
- [Commits](https://github.com/microsoft/vstest/compare/v17.7.0...v17.7.1)
---
updated-dependencies:
- dependency-name: Microsoft.NET.Test.Sdk
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* 632 bug avatar view clipping on windows (#1344)
* Resolves issue on Windows where the splash screen icon is not found.
* Resolves an issue with the 'Ratings' sample for AvatarView.
* Spaces and not tabs
* Spaces and not tabs
* Changed MauiImage to point to Images folder.
* Changed splash for Windows to be Resize=False
* Typo in name of MauiImage
* Try to prevent locking.
* Bump Microsoft.CodeAnalysis from 4.6.0 to 4.7.0 in /samples (#1355)
* Bump Microsoft.CodeAnalysis.CSharp.Workspaces from 4.6.0 to 4.7.0 in /samples (#1357)
* Bump FluentAssertions from 6.11.0 to 6.12.0 in /samples (#1365)
* fix IconTintColorBehavior for Windows (#1370)
fix IconTintColorBehavior for windows
Co-authored-by: Oleksii <sokol@managed-code.com>
* Add `MemoryAnalyzer` roslyn analyzer (#1371)
* Add NuGet Package + Update `WarningsAsErrors`
* Fix MA0002
* Fix `MauiDrawingView`
* Fix `MauiPopup`
* Fix Naming
* return `null` for nullable references
* Use Ternary Operator
* `dotnet format`
* iOS popup fix with Shell or TabbedPage (#1343)
* Fix Issue #1256
Better fix
* Fixed Popup on Multiple Level Pages (#822)
---------
Co-authored-by: Vladislav Antonyuk <33021114+VladislavAntonyuk@users.noreply.github.com>
Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
* [housekeeping] Automated PR to fix formatting errors (#1373)
* Bump Microsoft.NET.Test.Sdk from 17.7.1 to 17.7.2 in /samples (#1378)
---------
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Vladislav Antonyuk <33021114+VladislavAntonyuk@users.noreply.github.com>
Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
Co-authored-by: Shaun Lawrence <shaunrlawrence@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: cat0363 <125236133+cat0363@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Wolf <132034537+wolfgang-ironsoftware@users.noreply.github.com>
Co-authored-by: Thomas Stocker <thomas.stocker@gmail.com>
Co-authored-by: George Leithead <github@internetwideworld.com>
Co-authored-by: Sokol2001 <53799292+Sokol2001@users.noreply.github.com>
Co-authored-by: Oleksii <sokol@managed-code.com>
Co-authored-by: Andrey Onishchenko <100789522+cucumber-sp@users.noreply.github.com>
* Added MacOS and brought across the sample page style from XCT
* Added TouchBehavior Unit Tests
* Fixed issue with hover
* Fix Rebase Issues
Git didnt pick up all the changes and the rebase left some files in a wierd way. I have restored broken files to their state on main
* Manual fixes for rebase collisions
Some changes from the rebase had to be manually backed out by hand, I've restored the file from main which should be enough to revert the changes.
* Moved sample page to gallery
The sample page is now in the proper location, all of the shell wiring has been done. I have refactored the command code to live in the viewmodel and use the source generators. The sample isn't binding at this current time, I will have to investigate.
* Fixed behavior binding
The binding context wasnt being set on the platform behavior. We will need to understand the impact of this going forwards, see https://github.com/CommunityToolkit/Maui/issues/795
* Fixed binding in sample
Updated to remove the binding context from the platform behavior, we use a relative binding to talk to the viewmodel now
* Added input transparency test case
There is now an example of the control design that fails to register inputs, even when transparency is opted into
* Fix issue with input transparency
The issue I discovered where iOS would not set input transparency if the first child was a layout has now been resolved.
* Fixed Parent Child Taps
There was an issue in the sample where when tapping the parent/child view inside the child, both commands would execute. I have fixed this aswell as making sure the other behaviors arent affected
* Fixed Hover
The hovering now works correctly, we missed one area to force the ui to update
* Fixed Ripple View Positioning
The ripple view now positions correctly when there are child views in a layout.
* Code styling
Removing private & internal everywhere it can be removed. Removed some unused properties and cleaned up some nullable bits
* Dotnet format
Ran dotnet format, only checked in files related to touch behavior
* Replaced Console with Trace
As requested in the code review
* Update GestureManager.cs
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
* Code review changes
Updating null checks to pattern matching, some tweaks & implementing suggestions from Pedro
* Code Review
- Use `static` when possible
- Use `TimeSpan` for Duration
- Properly Implement Async/Await
- Properly Dispose
- Use PatternMatching for Enum
- Move Primatives to CommunityToolkit.Maui.Core
* Remove duplicate `ColorTo` extension
* Fix Windows
The touch behavior was token by the cancellation token changes. I'm not sure if passing none is the best idea, we possibly need to generate a real one?
* Fixed unit tests
* Use `uint` for Duration
* Use `int` for Duration
* Add TouchBehaviorDefaults
* Update Unit Tests
* Remove duplicate calls to `ConfigureAwaitOptions.ForceYielding`
* `dotnet format`
* Add nullability to `PressedBackgroundColor`
* Remove Unused Internal Properties
* Resolve Windows Compiler Errors
* `dotnet format`
* Remove duplicate `splash.svg`
* Update formatting
* Update Formatting
* Fix Find + Replace Error
* Use Primary Constructors
* Fix find + replace error
* Update StatusBarBehavior.shared.cs
* Fix Splash Screen
* Fix LongPress Gesture
* Update Unit Tests
* Fix Build Errors on Windows
* `dotnet format`
* Fix duplicate SplashScreen
* Revert splashscreen svg
* Update CommunityToolkit.Maui.Sample.csproj
* Add Unit Tests for CurrentStateChanged
* Add `CanExecuteTest`
* Add Unit Tests
* Update src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/TouchBehavior.android.cs
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
* remove the ShouldUseNativeAnimation check in order to make it work
* throw ObjectDisposedException
* Big Fixes + Performance Improvements
* Remove `IsToggled`
* Update GestureManager.cs
* Rename `PulseCount` -> `RepeatAnimationCount`
* Prevent animations from happening immediately when the TouchBehavior is attached
* Rename `Normal` -> `Default`
* Cerate `ImageTouchBehavior`
* Move `SafeFireAndForgotExtensions`
* Update XML Documentation
* Fix Windows Build Errors
* Remove White Box
* `Normal` -> `Default`
* Fix Touch + Hover logic for ImageSource
* Remove `RepeatAnimationCount`
* Remove `RepeatAnimationCount`
* Fix `SetImageSource`
* `ContentVIew` -> `BoxView`
* Indicate Pressed and Released are Handled
Set e.Handled on PointerPressed and PointerReleased to stop passing to child controls on windows.
* Remove BoxView
* FIx Hover / Touch Logic in SetImageSource
* Refactor GestureManager, Add StateMachine tests
* Remove Unused + Duplicate Code
* Rename TouchBeahavior.methods.shared.cs
* Remove NativeAnimation Logic
* Remove NativeAnimation from Sample
* Fix Windows Build Errors
* Rename file
* Update ImageTouchBehaviorTests.cs
* Update ImageTouchBehaviorTests.cs
* Update ImageTouchBehaviorTests.cs
* Update ImageTouchBehaviorTests.cs
* Update ImageTouchBehaviorTests.cs
* Fix merge conflicts
* Fix build error
---------
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
Co-authored-by: Kym Phillpotts <kphillpotts@gmail.com>
Co-authored-by: Christian Rendl <10274479+christianrr@users.noreply.github.com>
Co-authored-by: Christian Rendl <cr@mutor.at>
Co-authored-by: Vladislav Antonyuk <33021114+VladislavAntonyuk@users.noreply.github.com>
Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Co-authored-by: Shaun Lawrence <shaunrlawrence@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: cat0363 <125236133+cat0363@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Wolf <132034537+wolfgang-ironsoftware@users.noreply.github.com>
Co-authored-by: Thomas Stocker <thomas.stocker@gmail.com>
Co-authored-by: George Leithead <github@internetwideworld.com>
Co-authored-by: Sokol2001 <53799292+Sokol2001@users.noreply.github.com>
Co-authored-by: Oleksii <sokol@managed-code.com>
Co-authored-by: Andrey Onishchenko <100789522+cucumber-sp@users.noreply.github.com>
Co-authored-by: Gerald Versluis <gerald@verslu.is>
* Updated StatusBarBehavior to use the NavigatedTo event for setting the color and style and updated the Sample app.
* Added fact to verify expected exception on NavigatedTo event.
* Update src/CommunityToolkit.Maui.UnitTests/Behaviors/StatusBarBehaviorTests.cs
It wasn't inside the if before so forgot to remove it after wrapping it :)
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
* Removed unit test I do not know how to trigger OnAttachedTo without using reflection.
* Added enum StatusBarApplyOn to control when the StatusBarBehavior applies its configured color and style.
* Updated sample to use the new enum
---------
Co-authored-by: Mikael Nensén <mikael.nensen@datema.se>
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
Co-authored-by: Shaun Lawrence <shaunrlawrence@gmail.com>
* Windows Snackbar rewrite
Replaces ToastNotification with AppNotificationManager. Fixes Snackbar and Toast execute new instance of the app
* reverted to use maui-package-name-placeholder
* Update Xcode version for net8.0-maccatalyst
---------
Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
Co-authored-by: Gerald Versluis <gerald@verslu.is>
* Fix IOS bug in media Element when using Popup
* removed unused usings
* Remove accidental IOS build info
* remove extra line added by mistake
* Add Popup Media Element
* Fix Xaml layout
* more xaml fixes
* Rework Shell detection and get Current ViewController
* Update view controller logic to fix Navigation Page CTD
* Remove unused variables and method logic
* Fix for CollectionViewController
* revert breaking changes and mark ctor as [Obsolete]
* Hides the Obsolete ctor from showing up
* Update to fix breaking changes
* fix missing close bracket
---------
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
* Removed the transparent color that was being set on Android when the icon tint color is set to null.
* Add `null` Color to IconTintColorBehavior in Sample App
* Update Sample
---------
Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com>