diff options
author | Kangho Hur <kangho.hur@samsung.com> | 2017-06-19 14:14:53 +0900 |
---|---|---|
committer | Kangho Hur <kangho.hur@samsung.com> | 2017-10-23 13:34:36 +0900 |
commit | 82e7a27eb4a352f50c0b62ab16c9b4729f94633b (patch) | |
tree | f9e7d9c225b24cd09f99b78fc941ff8bc3bd2cb0 | |
parent | c7037cc9e42caa73dc2ea4b1347ce5a7a5e5e93d (diff) | |
download | xamarin-forms-82e7a27eb4a352f50c0b62ab16c9b4729f94633b.tar.gz xamarin-forms-82e7a27eb4a352f50c0b62ab16c9b4729f94633b.tar.bz2 xamarin-forms-82e7a27eb4a352f50c0b62ab16c9b4729f94633b.zip |
Apply TizenSpecifics only if available
- Nothing to happen if Xamarin.Forms.dll doesn't have Xamarin.Forms.PlatformConfiguration.TizenSpecific.
Change-Id: I4586178a0eb97610c88bfb272e26e3e0a43b5169
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs | 5 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/Renderers/ImageRenderer.cs | 6 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/Renderers/LabelRenderer.cs | 5 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/Renderers/NavigationPageRenderer.cs | 8 | ||||
-rw-r--r--[-rwxr-xr-x] | Xamarin.Forms.Platform.Tizen/Renderers/ProgressBarRenderer.cs | 7 | ||||
-rw-r--r--[-rwxr-xr-x] | Xamarin.Forms.Platform.Tizen/Renderers/TabbedPageRenderer.cs | 0 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs | 25 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs | 9 |
8 files changed, 46 insertions, 19 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs index ba6a15a1..f269869e 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs @@ -17,7 +17,10 @@ namespace Xamarin.Forms.Platform.Tizen RegisterPropertyHandler(Entry.KeyboardProperty, UpdateKeyboard); RegisterPropertyHandler(Entry.PlaceholderProperty, UpdatePlaceholder); RegisterPropertyHandler(Entry.PlaceholderColorProperty, UpdatePlaceholderColor); - RegisterPropertyHandler(Specific.FontWeightProperty, UpdateFontWeight); + if(TizenPlatformServices.AppDomain.IsTizenSpecificAvailable) + { + RegisterPropertyHandler("FontWeight", UpdateFontWeight); + } } protected override void OnElementChanged(ElementChangedEventArgs<Entry> e) diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/ImageRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/ImageRenderer.cs index f402178b..63fb327a 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/ImageRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/ImageRenderer.cs @@ -43,7 +43,7 @@ namespace Xamarin.Forms.Platform.Tizen { UpdateIsOpaque(); } - else if (e.PropertyName == Specific.BlendColorProperty.PropertyName) + else if (TizenPlatformServices.AppDomain.IsTizenSpecificAvailable && e.PropertyName == "BlendColor") { UpdateBlendColor(); } @@ -72,7 +72,9 @@ namespace Xamarin.Forms.Platform.Tizen protected virtual void UpdateAfterLoading() { UpdateIsOpaque(); - UpdateBlendColor(); + { + UpdateBlendColor(); + } } void UpdateAspect() diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/LabelRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/LabelRenderer.cs index d1d9c96d..876e7f8c 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/LabelRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/LabelRenderer.cs @@ -17,7 +17,10 @@ namespace Xamarin.Forms.Platform.Tizen RegisterPropertyHandler(Label.HorizontalTextAlignmentProperty, UpdateTextAlignment); RegisterPropertyHandler(Label.VerticalTextAlignmentProperty, UpdateTextAlignment); RegisterPropertyHandler(Label.FormattedTextProperty, UpdateFormattedText); - RegisterPropertyHandler(Specific.FontWeightProperty, UpdateFontWeight); + if (TizenPlatformServices.AppDomain.IsTizenSpecificAvailable) + { + RegisterPropertyHandler("FontWeight", UpdateFontWeight); + } } protected override void OnElementChanged(ElementChangedEventArgs<Label> e) diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/NavigationPageRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/NavigationPageRenderer.cs index d43fea8e..edcba08f 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/NavigationPageRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/NavigationPageRenderer.cs @@ -127,8 +127,9 @@ namespace Xamarin.Forms.Platform.Tizen // Tizen does not support 'Tint', but only 'BarBackgroundColor' else if (e.PropertyName == NavigationPage.BarBackgroundColorProperty.PropertyName) UpdateBarBackgroundColor(CurrentNaviItem); - else if (e.PropertyName == PlatformConfiguration.TizenSpecific.NavigationPage.HasBreadCrumbsBarProperty.PropertyName) + else if (TizenPlatformServices.AppDomain.IsTizenSpecificAvailable && e.PropertyName == "HasBreadCrumbsBar") UpdateBreadCrumbsBar(CurrentNaviItem); + } void PageCollectionChangedHandler(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) @@ -156,7 +157,7 @@ namespace Xamarin.Forms.Platform.Tizen UpdateHasBackButton(sender as Page); else if (e.PropertyName == Page.TitleProperty.PropertyName) UpdateTitle(sender as Page); - else if (e.PropertyName == PlatformConfiguration.TizenSpecific.Page.BreadCrumbProperty.PropertyName) + else if (TizenPlatformServices.AppDomain.IsTizenSpecificAvailable && e.PropertyName == "BreadCrumb") UpdateBreadCrumbsBar(GetNaviItemForPage(sender as Page)); } @@ -171,7 +172,8 @@ namespace Xamarin.Forms.Platform.Tizen item.TitleBarVisible = (bool)page.GetValue(NavigationPage.HasNavigationBarProperty); UpdateToolbarItem(page, item); UpdateBarBackgroundColor(item); - UpdateBreadCrumbsBar(item); + if(TizenPlatformServices.AppDomain.IsTizenSpecificAvailable) + UpdateBreadCrumbsBar(item); } void UpdateToolbarItem(Page page, NaviItem item = null) diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/ProgressBarRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/ProgressBarRenderer.cs index d7471b43..5c7a4231 100755..100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/ProgressBarRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/ProgressBarRenderer.cs @@ -47,7 +47,7 @@ namespace Xamarin.Forms.Platform.Tizen { UpdateProgress(); } - else if (e.PropertyName == Specific.ProgressBarPulsingStatusProperty.PropertyName) + else if (TizenPlatformServices.AppDomain.IsTizenSpecificAvailable && e.PropertyName == "ProgressBarPulsingStatus") { UpdatePulsingStatus(); } @@ -63,7 +63,10 @@ namespace Xamarin.Forms.Platform.Tizen void UpdateAll() { UpdateProgress(); - UpdatePulsingStatus(); + if (TizenPlatformServices.AppDomain.IsTizenSpecificAvailable) + { + UpdatePulsingStatus(); + } } void UpdateProgress() diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/TabbedPageRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/TabbedPageRenderer.cs index 34e0235e..34e0235e 100755..100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/TabbedPageRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/TabbedPageRenderer.cs diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs index a3282a3f..f40ece7e 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs @@ -56,16 +56,21 @@ namespace Xamarin.Forms.Platform.Tizen RegisterPropertyHandler(VisualElement.IsEnabledProperty, UpdateIsEnabled); RegisterPropertyHandler(VisualElement.InputTransparentProperty, UpdateInputTransparent); RegisterPropertyHandler(VisualElement.BackgroundColorProperty, UpdateBackgroundColor); - RegisterPropertyHandler(Specific.StyleProperty, UpdateThemeStyle); - RegisterPropertyHandler(Specific.IsFocusAllowedProperty, UpdateFocusAllowed); - RegisterPropertyHandler(Specific.NextFocusDirectionProperty, UpdateFocusDirection); - RegisterPropertyHandler(Specific.NextFocusUpViewProperty, UpdateFocusUpView); - RegisterPropertyHandler(Specific.NextFocusDownViewProperty, UpdateFocusDownView); - RegisterPropertyHandler(Specific.NextFocusLeftViewProperty, UpdateFocusLeftView); - RegisterPropertyHandler(Specific.NextFocusRightViewProperty, UpdateFocusRightView); - RegisterPropertyHandler(Specific.NextFocusBackViewProperty, UpdateFocusBackView); - RegisterPropertyHandler(Specific.NextFocusForwardViewProperty, UpdateFocusForwardView); - RegisterPropertyHandler(Specific.ToolTipProperty, UpdateToolTip); + + // Use TizenSpecific APIs only if available + if (TizenPlatformServices.AppDomain.IsTizenSpecificAvailable) + { + RegisterPropertyHandler("ThemeStyle", UpdateThemeStyle); + RegisterPropertyHandler("IsFocusAllowed", UpdateFocusAllowed); + RegisterPropertyHandler("NextFocusDirection", UpdateFocusDirection); + RegisterPropertyHandler("NextFocusUpView", UpdateFocusUpView); + RegisterPropertyHandler("NextFocusDownView", UpdateFocusDownView); + RegisterPropertyHandler("NextFocusLeftView", UpdateFocusLeftView); + RegisterPropertyHandler("NextFocusRightView", UpdateFocusRightView); + RegisterPropertyHandler("NextFocusBackView", UpdateFocusBackView); + RegisterPropertyHandler("NextFocusForwardView", UpdateFocusForwardView); + RegisterPropertyHandler("ToolTip", UpdateToolTip); + } RegisterPropertyHandler(VisualElement.AnchorXProperty, ApplyTransformation); RegisterPropertyHandler(VisualElement.AnchorYProperty, ApplyTransformation); diff --git a/Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs b/Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs index 3be1c95a..449b0938 100644 --- a/Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs +++ b/Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs @@ -184,6 +184,8 @@ namespace Xamarin.Forms.Platform.Tizen List<Assembly> _assemblies; + public static bool IsTizenSpecificAvailable { get; private set; } + static AppDomain() { CurrentDomain = new AppDomain(); @@ -212,6 +214,13 @@ namespace Xamarin.Forms.Platform.Tizen { Assembly refAsm = Assembly.Load(refName); RegisterAssemblyRecursively(refAsm); + if (refName.Name == "Xamarin.Forms.Core") + { + if (refAsm.GetType("Xamarin.Forms.PlatformConfiguration.TizenSpecific.VisualElement") != null) + { + IsTizenSpecificAvailable = true; + } + } } catch { |