Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Window Specific Orientation Extensions (#7338)
* Create Window Specific Orientation Extensions * Update src/Core/src/Platform/Tizen/WindowExtensions.cs Co-authored-by: Kangho Hur <kangho.hur@samsung.com> * Update src/Core/src/Platform/Tizen/WindowExtensions.cs Co-authored-by: Kangho Hur <kangho.hur@samsung.com> Co-authored-by: Kangho Hur <kangho.hur@samsung.com>
- Loading branch information
1 parent
da75bff
commit 7efa74c
Showing
7 changed files
with
80 additions
and
3 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Android.App; | ||
using Android.Content.Res; | ||
using Microsoft.Maui.Devices; | ||
using Microsoft.Maui.Platform; | ||
|
||
namespace Microsoft.Maui | ||
{ | ||
public static partial class WindowExtensions | ||
{ | ||
internal static DisplayOrientation GetOrientation(this IWindow? window) | ||
{ | ||
if (window == null) | ||
return DeviceDisplay.Current.MainDisplayInfo.Orientation; | ||
|
||
return window.Handler?.MauiContext?.GetPlatformWindow()?.Resources?.Configuration?.Orientation switch | ||
{ | ||
Orientation.Landscape => DisplayOrientation.Landscape, | ||
Orientation.Portrait => DisplayOrientation.Portrait, | ||
Orientation.Square => DisplayOrientation.Portrait, | ||
_ => DisplayOrientation.Unknown | ||
}; | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Microsoft.Maui.Devices; | ||
|
||
namespace Microsoft.Maui | ||
{ | ||
public static partial class WindowExtensions | ||
{ | ||
internal static DisplayOrientation GetOrientation(this IWindow? window) => | ||
DeviceDisplay.Current.MainDisplayInfo.Orientation; | ||
} | ||
} |
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