Remove the TargetIdiom and Profile (#137)
author윤정현/Common Platform Lab(SR)/Staff Engineer/삼성전자 <jh0506.yun@samsung.com>
Tue, 14 Jan 2020 08:16:17 +0000 (17:16 +0900)
committer부정균/Common Platform Lab(SR)/Staff Engineer/삼성전자 <jk.pu@samsung.com>
Tue, 14 Jan 2020 08:16:17 +0000 (17:16 +0900)
12 files changed:
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Cells/ImageCellRenderer.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Cells/SwitchCellRenderer.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Cells/TextCellRenderer.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Forms.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Native/Dialog.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Platform.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Renderers/ButtonRenderer.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Renderers/EditorRenderer.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Renderers/FrameRenderer.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Renderers/SwitchRenderer.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Shell/ShellNavBar.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs

index 36fee0d..707f23d 100644 (file)
@@ -7,7 +7,7 @@ namespace Xamarin.Forms.Platform.Tizen
        {
                const int _defaultHeight = 55;
 
-               public ImageCellRenderer() : this(Device.Idiom == TargetIdiom.Watch ? "1icon_2text" : (Device.Idiom == TargetIdiom.Phone ? "double_label" : "default"))
+               public ImageCellRenderer() : this("1icon_2text")
                {
                        ImagePart = "elm.swallow.icon";
                }
index 3bc6c3d..4089f4c 100644 (file)
@@ -45,20 +45,9 @@ namespace Xamarin.Forms.Platform.Tizen
                                toggle.SetBinding(Switch.OnColorProperty, new Binding(SwitchCell.OnColorProperty.PropertyName));
                                var nativeView = Platform.GetOrCreateRenderer(toggle).NativeView;
 
-                               if (Device.Idiom == TargetIdiom.Watch)
-                               {
-                                       nativeView.MinimumWidth += 8;
-                               }
-
-                               //It is a temporary way to prevent that the check of the Cell gets focus until the UX about views in the Cell for TV is defined.
-                               if (Device.Idiom == TargetIdiom.TV)
-                               {
-                                       ((Check)nativeView).AllowFocus(false);
-                               }
-                               else
-                               {
-                                       nativeView.PropagateEvents = false;
-                               }
+                               nativeView.MinimumWidth += 8;
+                               nativeView.PropagateEvents = false;
+                               
                                return nativeView;
                        }
                        return null;
index 998844f..fc9f091 100644 (file)
@@ -6,8 +6,8 @@ namespace Xamarin.Forms.Platform.Tizen
        public class TextCellRenderer : CellRenderer
        {
                bool _groupMode = false;
-               // TextCell.Detail property is not supported on TV profile due to UX limitation.
-               public TextCellRenderer() : this(Device.Idiom == TargetIdiom.Phone || Device.Idiom == TargetIdiom.Watch ? "double_label" : "default") { }
+               
+               public TextCellRenderer() : this("double_label") { }
 
                protected TextCellRenderer(string style) : base(style)
                {
@@ -33,7 +33,7 @@ namespace Xamarin.Forms.Platform.Tizen
                        else
                        {
                                Class = null;
-                               Style = Device.Idiom == TargetIdiom.Phone ? "double_label" : "default";
+                               Style = "default";
                                DetailPart = "elm.text.sub";
                        }
                }
index f71923c..6298396 100644 (file)
@@ -102,20 +102,9 @@ namespace Xamarin.Forms
 
        public static class Forms
        {
-               static Lazy<string> s_profile = new Lazy<string>(() =>
-               {
-                       //TODO : Fix me if elm_config_profile_get() unavailable
-                       return Elementary.GetProfile();
-               });
-
                static Lazy<int> s_dpi = new Lazy<int>(() =>
                {
                        int dpi = 0;
-                       if (s_profile.Value == "tv")
-                       {
-                               // Use fixed DPI value (72) if TV profile
-                               return 72;
-                       }
                        TSystemInfo.TryGetValue<int>("http://tizen.org/feature/screen.dpi", out dpi);
                        return dpi;
                });
@@ -134,8 +123,6 @@ namespace Xamarin.Forms
 
                        readonly double scalingFactor;
 
-                       readonly string profile;
-
                        public override Size PixelScreenSize
                        {
                                get
@@ -160,14 +147,6 @@ namespace Xamarin.Forms
                                }
                        }
 
-                       public string Profile
-                       {
-                               get
-                               {
-                                       return this.profile;
-                               }
-                       }
-
                        public TizenDeviceInfo() : this(getScreenWidth(), getScreenHeight())
                        {
                        }
@@ -205,7 +184,6 @@ namespace Xamarin.Forms
                                }
 
                                scaledScreenSize = new Size(width / scalingFactor, height / scalingFactor);
-                               profile = s_profile.Value;
                        }
 
                        public TizenDeviceInfo RefreshByDIP()
@@ -536,55 +514,13 @@ namespace Xamarin.Forms
 
                        if (!Forms.IsInitialized)
                        {
-                               string profile = ((TizenDeviceInfo)Device.Info).Profile;
-                               if (profile == "mobile")
-                               {
-                                       Device.SetIdiom(TargetIdiom.Phone);
-                               }
-                               else if (profile == "tv")
-                               {
-                                       Device.SetIdiom(TargetIdiom.TV);
-                               }
-                               else if (profile == "desktop")
-                               {
-                                       Device.SetIdiom(TargetIdiom.Desktop);
-                               }
-                               else if (profile == "wearable")
-                               {
-                                       Device.SetIdiom(TargetIdiom.Watch);
-                               }
-                               else
-                               {
-                                       Device.SetIdiom(TargetIdiom.Unsupported);
-                               }
-                               Color.SetAccent(GetAccentColor(profile));
+                               Device.SetIdiom(TargetIdiom.Watch);
+                               Color.SetAccent(Color.FromRgba(10, 27, 41, 255)); // Theme A (Default) 1st HSB: 207 75 16
                                ExpressionSearch.Default = new TizenExpressionSearch();
                                IsInitialized = true;
                        }
                }
 
-               static Color GetAccentColor(string profile)
-               {
-                       // On Windows Phone, this is the complementary color chosen by the user.
-                       // Good Windows Phone applications use this as part of their styling to provide a native look and feel.
-                       // On iOS and Android this instance is set to a contrasting color that is visible on the default
-                       // background but is not the same as the default text color.
-
-                       switch (profile)
-                       {
-                               case "mobile":
-                                       // [Tizen_3.0]Basic_Interaction_GUI_[REF].xlsx Theme 001 (Default) 1st HSB: 188 70 80
-                                       return Color.FromRgba(61, 185, 204, 255);
-                               case "tv":
-                                       return Color.FromRgba(15, 15, 15, 230);
-                               case "wearable":
-                                       // Theme A (Default) 1st HSB: 207 75 16
-                                       return Color.FromRgba(10, 27, 41, 255);
-                               default:
-                                       return Color.Black;
-                       }
-               }
-
                /// <summary>
                /// Converts the dp into pixel considering current DPI value.
                /// </summary>
@@ -658,15 +594,6 @@ namespace Xamarin.Forms
                        return eflPt / s_elmScale.Value;
                }
 
-               /// <summary>
-               /// Get the EFL's profile
-               /// </summary>
-               /// <returns></returns>
-               public static string GetProfile()
-               {
-                       return s_profile.Value;
-               }
-
                // for internal use only
                [EditorBrowsable(EditorBrowsableState.Never)]
                public static void Preload()
index 00fc747..fd754f9 100644 (file)
@@ -35,14 +35,7 @@ namespace Xamarin.Forms.Platform.Tizen.Native
                /// </summary>
                public static Dialog CreateDialog(EvasObject parent, bool hasAcceptButton = false)
                {
-                       if (Device.Idiom == TargetIdiom.Watch)
-                       {
-                               return new Watch.WatchDialog(Forms.NativeParent, hasAcceptButton);
-                       }
-                       else
-                       {
-                               return new Dialog(Forms.NativeParent);
-                       }
+                       return new Watch.WatchDialog(Forms.NativeParent, hasAcceptButton);
                }
 
                /// <summary>
@@ -241,7 +234,7 @@ namespace Xamarin.Forms.Platform.Tizen.Native
 
                protected virtual void ApplyTitleColor(EColor color)
                {
-                       SetPartColor(Device.Idiom == TargetIdiom.TV ? "text_title" : "text_maintitle", color);
+                       SetPartColor("text_maintitle", color);
                }
 
                /// <summary>
index 76db94e..882db45 100644 (file)
@@ -414,15 +414,7 @@ namespace Xamarin.Forms.Platform.Tizen
                                        BackgroundColor = EColor.Transparent
                                };
 
-                               if (Device.Idiom == TargetIdiom.Phone)
-                               {
-                                       _pageBusyDialog.SetPartColor("bg_title", EColor.Transparent);
-                                       _pageBusyDialog.SetPartColor("bg_content", EColor.Transparent);
-                               }
-                               else if (Device.Idiom == TargetIdiom.Watch)
-                               {
-                                       _pageBusyDialog.Style = "circle";
-                               }
+                               _pageBusyDialog.Style = "circle";
 
                                var activity = new EProgressBar(_pageBusyDialog)
                                {
index cd1bb61..71d6d8a 100644 (file)
@@ -32,10 +32,7 @@ namespace Xamarin.Forms.Platform.Tizen
 
                protected virtual EButton CreateNativeControl()
                {
-                       if (Device.Idiom == TargetIdiom.Watch)
-                               return new Native.Watch.WatchButton(Forms.NativeParent);
-                       else
-                               return new Native.Button(Forms.NativeParent);
+                       return new Native.Watch.WatchButton(Forms.NativeParent);
                }
 
                protected override Size MinimumSize()
index dd57006..98ad7a3 100644 (file)
@@ -24,7 +24,7 @@ namespace Xamarin.Forms.Platform.Tizen
                        if (Control == null)
                        {
                                // Multiline EditField style is only available on Mobile and TV profile
-                               var entry = Device.Idiom == TargetIdiom.Phone || Device.Idiom == TargetIdiom.TV ? new Native.EditfieldEntry(Forms.NativeParent, "multiline") : new Native.Entry(Forms.NativeParent)
+                               var entry = new Native.Entry(Forms.NativeParent)
                                {
                                        IsSingleLine = false,
                                };
index 1db24c8..fe7fea1 100644 (file)
@@ -9,7 +9,7 @@ namespace Xamarin.Forms.Platform.Tizen
                const int _shadow_shift = 2;
                const int _shadow_thickness = _thickness + 2;
 
-               static readonly EColor s_DefaultColor = Device.Idiom == TargetIdiom.TV || Device.Idiom == TargetIdiom.Watch ? EColor.Gray : EColor.Black;
+               static readonly EColor s_DefaultColor = EColor.Gray;
                static readonly EColor s_ShadowColor = EColor.FromRgba(80, 80, 80, 50);
 
                Polygon _shadow = null;
index 14398f5..af9f131 100644 (file)
@@ -9,13 +9,11 @@ namespace Xamarin.Forms.Platform.Tizen
        public class SwitchRenderer : ViewRenderer<Switch, Check>
        {
                readonly string _onColorPart;
-               readonly bool _isTV;
                string _onColorEdjePart;
 
                public SwitchRenderer()
                {
-                       _isTV = Device.Idiom == TargetIdiom.TV;
-                       _onColorPart = _isTV ? "slider_on" : Device.Idiom == TargetIdiom.Watch ? "outer_bg_on" : "bg_on";
+                       _onColorPart = "outer_bg_on";
                        RegisterPropertyHandler(Switch.IsToggledProperty, HandleToggled);
                        RegisterPropertyHandler(Switch.OnColorProperty, UpdateOnColor);
                }
@@ -85,15 +83,11 @@ namespace Xamarin.Forms.Platform.Tizen
                        if (Element.OnColor.IsDefault)
                        {
                                Control.EdjeObject.DeleteColorClass(_onColorEdjePart);
-                               if (_isTV)
-                                       Control.EdjeObject.DeleteColorClass(_onColorEdjePart.Replace(_onColorPart, "slider_focused_on"));
                        }
                        else
                        {
                                EColor color = Element.OnColor.ToNative();
                                Control.SetPartColor(_onColorPart, color);
-                               if (_isTV)
-                                       Control.SetPartColor("slider_focused_on", color);
                        }
                }
        }
index 5bcb66a..72f9cc3 100644 (file)
@@ -41,7 +41,7 @@ namespace Xamarin.Forms.Platform.Tizen
 
                        _title = new Native.Label(Forms.NativeParent)
                        {
-                               FontSize = Device.Idiom == TargetIdiom.TV ? 60 : 23,
+                               FontSize = 23,
                                VerticalTextAlignment = Native.TextAlignment.Center,
                                TextColor = _backgroudColor,
                                FontAttributes = FontAttributes.Bold,
index 9550490..51e03ad 100644 (file)
@@ -57,32 +57,32 @@ namespace Xamarin.Forms.Platform.Tizen
                        switch (size)
                        {
                                case NamedSize.Micro:
-                                       pt = Device.Idiom == TargetIdiom.TV || Device.Idiom == TargetIdiom.Watch ? 24 : 19;
+                                       pt = 24;
                                        break;
                                case NamedSize.Small:
-                                       pt = Device.Idiom == TargetIdiom.TV ? 26 : (Device.Idiom == TargetIdiom.Watch ? 30 : 22);
+                                       pt = 30;
                                        break;
                                case NamedSize.Default:
                                case NamedSize.Medium:
-                                       pt = Device.Idiom == TargetIdiom.TV ? 28 : (Device.Idiom == TargetIdiom.Watch ? 32 : 25);
+                                       pt = 32;
                                        break;
                                case NamedSize.Large:
-                                       pt = Device.Idiom == TargetIdiom.TV ? 32 : (Device.Idiom == TargetIdiom.Watch ? 36 : 31);
+                                       pt = 36;
                                        break;
                                case NamedSize.Body:
-                                       pt = Device.Idiom == TargetIdiom.TV ? 30 : (Device.Idiom == TargetIdiom.Watch ? 32 : 28);
+                                       pt = 32;
                                        break;
                                case NamedSize.Caption:
-                                       pt = Device.Idiom == TargetIdiom.TV ? 26 : (Device.Idiom == TargetIdiom.Watch ? 24 : 22);
+                                       pt = 24;
                                        break;
                                case NamedSize.Header:
-                                       pt = Device.Idiom == TargetIdiom.TV ? 84 : (Device.Idiom == TargetIdiom.Watch ? 36 : 138);
+                                       pt = 36;
                                        break;
                                case NamedSize.Subtitle:
-                                       pt = Device.Idiom == TargetIdiom.TV ? 30 : (Device.Idiom == TargetIdiom.Watch ? 30 : 28);
+                                       pt = 30;
                                        break;
                                case NamedSize.Title:
-                                       pt = Device.Idiom == TargetIdiom.TV ? 42 : (Device.Idiom == TargetIdiom.Watch ? 36 : 40);
+                                       pt = 36;
                                        break;
                                default:
                                        throw new ArgumentOutOfRangeException(nameof(size));