-
Notifications
You must be signed in to change notification settings - Fork 356
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
Fix Media Element Android Layout #1814
Merged
brminnick
merged 7 commits into
CommunityToolkit:main
from
ne0rrmatrix:MediaElementAndroidLayoutFix
Apr 29, 2024
Merged
Fix Media Element Android Layout #1814
brminnick
merged 7 commits into
CommunityToolkit:main
from
ne0rrmatrix:MediaElementAndroidLayoutFix
Apr 29, 2024
Conversation
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
…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`.
brminnick
reviewed
Apr 27, 2024
brminnick
approved these changes
Apr 29, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
approved
This Proposal has been approved and is ready to be added to the Toolkit
pending documentation
This feature requires documentation
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.
Bug fix
Description of Change
Fixes the android layout issue that has been present since full screen support was added. We had switched layouts to use a frame layout. Now we have switched back to using a relative layout. This should fix the issue of layouts not behaving correctly.
Linked Issues
PR Checklist
approved
(bug) orChampioned
(feature/proposal)main
at time of PRAdditional information
The
WidthRequest
attribute of theMediaElement
toolkit was removed fromMediaElementPage.xaml
. This attribute was previously used to set the width of the media element based on the device type (tablet or default).The
Activity
attribute inMainActivity.cs
was modified to includeResizeableActivity = true
. This change allows the activity to be resizable.In
MauiMediaElement.android.cs
, theAndroid.Util
namespace was added to the import statements. Two new integer variablesplayerHeight
andplayerWidth
were added to theMauiMediaElement
class. These variables are used to store the height and width of the player view.The
OnFullscreenButtonClick
method of theMauiMediaElement
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.In
MediaManager.android.cs
, the import statement forAndroidX.CoordinatorLayout.Widget
was removed. TheLayoutParameters
attribute of thePlayerView
object was changed fromFrameLayout.LayoutParams
toRelativeLayout.LayoutParams
. This change aligns with the updates made in theMauiMediaElement
class, where the player view is now added to aRelativeLayout
instead of aFrameLayout
.