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

[WIP] GH-923 Implement AppTheme for iOS/tvOS/Android/UWP (Need Tizen Still) #927

Open
wants to merge 1 commit into
base: master
from

Conversation

@jamesmontemagno
Copy link
Collaborator

jamesmontemagno commented Oct 13, 2019

Description of Change

Implement AppTheme for Light/Dark/Unspecified !

Bugs Fixed

  • Related to issue #923

Provide links to issues here. Ensure that a GitHub issue was created for your feature or bug fix before sending PR.

API Changes

List all API changes here (or just put None), example:

Added:

enum AppTheme => Light, Dark, Unspecified

Changed:

  • AppTheme AppInfo.RequestedAppTheme { get; }

Behavioral Changes

none

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of master at time of PR
  • Changes adhere to coding standard
  • Updated documentation (see walkthrough)
@VSC-Service-Account

This comment has been minimized.

Copy link
Collaborator

VSC-Service-Account commented Oct 13, 2019

Docs Build status updates of commit cee79c0:

⚠️ Validation status: warnings

File Status Preview URL Details
⚠️Warning Details
Xamarin.Essentials/AppInfo/AppInfo.android.cs Succeeded
Xamarin.Essentials/AppInfo/AppInfo.ios.tvos.watchos.cs Succeeded
Xamarin.Essentials/AppInfo/AppInfo.netstandard.cs Succeeded
Xamarin.Essentials/AppInfo/AppInfo.shared.cs Succeeded
Xamarin.Essentials/AppInfo/AppInfo.tizen.cs Succeeded
Xamarin.Essentials/AppInfo/AppInfo.uwp.cs Succeeded
Xamarin.Essentials/AppInfo/AppTheme.shared.cs Succeeded
Xamarin.Essentials/Xamarin.Essentials.csproj Succeeded
docs/en/Xamarin.Essentials/SizeExtensions.xml Succeeded
docs/en/Xamarin.Essentials/RectangleExtensions.xml Succeeded
docs/en/Xamarin.Essentials/PointExtensions.xml Succeeded
docs/en/Xamarin.Essentials/ColorExtensions.xml Succeeded

  • [Warning] Uid(Xamarin.Essentials.PointExtensions.ToPlatformPoint(System.Drawing.Point)_m) has already been defined in api/Xamarin.Essentials.PointExtensions.ToPlatformPoint.yml#Xamarin_Essentials_PointExtensions_ToPlatformPoint_System_Drawing_Point__m.
  • [Warning] Uid(Xamarin.Essentials.SizeExtensions.ToPlatformSize(System.Drawing.Size)_m) has already been defined in api/Xamarin.Essentials.SizeExtensions.ToPlatformSize.yml#Xamarin_Essentials_SizeExtensions_ToPlatformSize_System_Drawing_Size__m.
  • [Warning] Uid(Xamarin.Essentials.ColorExtensions.ToPlatformColor(System.Drawing.Color)_m) has already been defined in api/Xamarin.Essentials.ColorExtensions.ToPlatformColor.yml#Xamarin_Essentials_ColorExtensions_ToPlatformColor_System_Drawing_Color__m.
  • [Warning] Uid(Xamarin.Essentials.RectangleExtensions.ToPlatformRectangle(System.Drawing.Rectangle)_m) has already been defined in api/Xamarin.Essentials.RectangleExtensions.ToPlatformRectangle.yml#Xamarin_Essentials_RectangleExtensions_ToPlatformRectangle_System_Drawing_Rectangle__m.

For more details, please refer to the build report.

Note: If you changed an existing file name or deleted a file, broken links in other files to the deleted or renamed file are listed only in the full build report.


static AppTheme PlatformRequestedTheme()
{
return (Platform.AppContext.Resources.Configuration.UiMode & UiMode.NightMask) switch

This comment has been minimized.

Copy link
@VladislavAntonyuk

VladislavAntonyuk Oct 18, 2019

Ensure the device is running Android Froyo or higher because UIMode was added in Android Froyo, API 8.0
if (Build.VERSION.SdkInt >= BuildVersionCodes.Froyo)

This comment has been minimized.

Copy link
@jamesmontemagno

jamesmontemagno Oct 19, 2019

Author Collaborator

Xamarin.Essentials only supports KitKat and above, so no need to check it was my thinking

static AppTheme PlatformRequestedTheme()
{
if (!Platform.HasOSVersion(13, 0))
return AppTheme.Unspecified;

This comment has been minimized.

Copy link
@sparkist97

sparkist97 Oct 24, 2019

shouldn't it be AppTheme.Light? since it is what the OS used pre-13

@Redth Redth added this to the 1.4.0 milestone Oct 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.