From 6116a0a9f73e4509f6d1e2c9751dece40d966ad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=AF=BC=EC=84=B1=ED=98=84/Common=20Platform=20Lab=28SR?= =?UTF-8?q?=29/Staff=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Wed, 1 Sep 2021 20:06:50 +0900 Subject: [PATCH] Reomve internal UIExtensions compoments for Shell (#147) --- .../SearchBarExtensions.cs | 2 +- .../Tizen/Extensions/ShellExtensions.cs | 2 +- .../Platform/Tizen/Shell/ShellItemView.cs | 3 +- .../Core/Platform/Tizen/Shell/ShellNavBar.cs | 2 +- .../Platform/Tizen/Shell/ShellSearchView.cs | 1 - .../Platform/Tizen/Shell/ShellSectionView.cs | 1 - .../Core/Platform/Tizen/Shell/ShellView.cs | 6 +- .../Tizen.UIExtensions/INavigationView.cs | 24 -- .../Tizen/Shell/Tizen.UIExtensions/ITabs.cs | 30 --- .../Tizen.UIExtensions/NavigationView.cs | 205 ------------------ .../Tizen/Shell/Tizen.UIExtensions/Tabs.cs | 35 --- .../Tizen.UIExtensions/ThemeConstants.cs | 25 --- 12 files changed, 7 insertions(+), 329 deletions(-) rename src/Controls/src/Core/Platform/Tizen/{Shell/Tizen.UIExtensions => Extensions}/SearchBarExtensions.cs (92%) delete mode 100644 src/Controls/src/Core/Platform/Tizen/Shell/Tizen.UIExtensions/INavigationView.cs delete mode 100644 src/Controls/src/Core/Platform/Tizen/Shell/Tizen.UIExtensions/ITabs.cs delete mode 100644 src/Controls/src/Core/Platform/Tizen/Shell/Tizen.UIExtensions/NavigationView.cs delete mode 100644 src/Controls/src/Core/Platform/Tizen/Shell/Tizen.UIExtensions/Tabs.cs delete mode 100644 src/Controls/src/Core/Platform/Tizen/Shell/Tizen.UIExtensions/ThemeConstants.cs diff --git a/src/Controls/src/Core/Platform/Tizen/Shell/Tizen.UIExtensions/SearchBarExtensions.cs b/src/Controls/src/Core/Platform/Tizen/Extensions/SearchBarExtensions.cs similarity index 92% rename from src/Controls/src/Core/Platform/Tizen/Shell/Tizen.UIExtensions/SearchBarExtensions.cs rename to src/Controls/src/Core/Platform/Tizen/Extensions/SearchBarExtensions.cs index c49eb6095309..2ab7fa8f7705 100644 --- a/src/Controls/src/Core/Platform/Tizen/Shell/Tizen.UIExtensions/SearchBarExtensions.cs +++ b/src/Controls/src/Core/Platform/Tizen/Extensions/SearchBarExtensions.cs @@ -1,7 +1,7 @@ using Microsoft.Maui.Controls; using TFontAttributes = Tizen.UIExtensions.Common.FontAttributes; -namespace Tizen.UIExtensions.Shell +namespace Microsoft.Maui.Controls.Platform { public static class SearchBarExtensions { diff --git a/src/Controls/src/Core/Platform/Tizen/Extensions/ShellExtensions.cs b/src/Controls/src/Core/Platform/Tizen/Extensions/ShellExtensions.cs index d8e86a15b88e..012c1d01108b 100644 --- a/src/Controls/src/Core/Platform/Tizen/Extensions/ShellExtensions.cs +++ b/src/Controls/src/Core/Platform/Tizen/Extensions/ShellExtensions.cs @@ -1,5 +1,5 @@ using Tizen.UIExtensions.Common; -using TINavigtaionView = Tizen.UIExtensions.Shell.INavigationView; +using TINavigtaionView = Tizen.UIExtensions.ElmSharp.INavigationView; namespace Microsoft.Maui.Controls.Platform { diff --git a/src/Controls/src/Core/Platform/Tizen/Shell/ShellItemView.cs b/src/Controls/src/Core/Platform/Tizen/Shell/ShellItemView.cs index ac13803518c9..613e9e7045ce 100644 --- a/src/Controls/src/Core/Platform/Tizen/Shell/ShellItemView.cs +++ b/src/Controls/src/Core/Platform/Tizen/Shell/ShellItemView.cs @@ -6,13 +6,12 @@ using ElmSharp; using Microsoft.Extensions.DependencyInjection; using Tizen.UIExtensions.ElmSharp; -using Tizen.UIExtensions.Shell; using EBox = ElmSharp.Box; using EColor = ElmSharp.Color; using EToolbarItem = ElmSharp.ToolbarItem; using EToolbarItemEventArgs = ElmSharp.ToolbarItemEventArgs; using TImage = Tizen.UIExtensions.ElmSharp.Image; -using TThemeConstants = Tizen.UIExtensions.Shell.ThemeConstants; +using TThemeConstants = Tizen.UIExtensions.ElmSharp.ThemeConstants; namespace Microsoft.Maui.Controls.Platform { diff --git a/src/Controls/src/Core/Platform/Tizen/Shell/ShellNavBar.cs b/src/Controls/src/Core/Platform/Tizen/Shell/ShellNavBar.cs index 2663239e3ab8..92f3c5b8e6f9 100644 --- a/src/Controls/src/Core/Platform/Tizen/Shell/ShellNavBar.cs +++ b/src/Controls/src/Core/Platform/Tizen/Shell/ShellNavBar.cs @@ -8,7 +8,7 @@ using TButton = Tizen.UIExtensions.ElmSharp.Button; using TImage = Tizen.UIExtensions.ElmSharp.Image; using TLabel = Tizen.UIExtensions.ElmSharp.Label; -using TThemeConstants = Tizen.UIExtensions.Shell.ThemeConstants; +using TThemeConstants = Tizen.UIExtensions.ElmSharp.ThemeConstants; namespace Microsoft.Maui.Controls.Platform { diff --git a/src/Controls/src/Core/Platform/Tizen/Shell/ShellSearchView.cs b/src/Controls/src/Core/Platform/Tizen/Shell/ShellSearchView.cs index 9d90a1128c09..86865cc05a59 100644 --- a/src/Controls/src/Core/Platform/Tizen/Shell/ShellSearchView.cs +++ b/src/Controls/src/Core/Platform/Tizen/Shell/ShellSearchView.cs @@ -3,7 +3,6 @@ using System; using System.ComponentModel; using ElmSharp; -using Tizen.UIExtensions.Shell; using EColor = ElmSharp.Color; using TSearchBar = Tizen.UIExtensions.ElmSharp.SearchBar; using TTextChangedEventArgs = Tizen.UIExtensions.Common.TextChangedEventArgs; diff --git a/src/Controls/src/Core/Platform/Tizen/Shell/ShellSectionView.cs b/src/Controls/src/Core/Platform/Tizen/Shell/ShellSectionView.cs index 8ecd27799ed1..306b0809134a 100644 --- a/src/Controls/src/Core/Platform/Tizen/Shell/ShellSectionView.cs +++ b/src/Controls/src/Core/Platform/Tizen/Shell/ShellSectionView.cs @@ -4,7 +4,6 @@ using System.ComponentModel; using ElmSharp; using Tizen.UIExtensions.ElmSharp; -using Tizen.UIExtensions.Shell; using EBox = ElmSharp.Box; using EColor = ElmSharp.Color; using EToolbarItem = ElmSharp.ToolbarItem; diff --git a/src/Controls/src/Core/Platform/Tizen/Shell/ShellView.cs b/src/Controls/src/Core/Platform/Tizen/Shell/ShellView.cs index eab36c79a4c8..cc0d6afeb99b 100644 --- a/src/Controls/src/Core/Platform/Tizen/Shell/ShellView.cs +++ b/src/Controls/src/Core/Platform/Tizen/Shell/ShellView.cs @@ -5,9 +5,9 @@ using Tizen.UIExtensions.Common; using Tizen.UIExtensions.ElmSharp; using EColor = ElmSharp.Color; -using TINavigationView = Tizen.UIExtensions.Shell.INavigationView; -using TNavigationView = Tizen.UIExtensions.Shell.NavigationView; -using TThemeConstants = Tizen.UIExtensions.Shell.ThemeConstants; +using TINavigationView = Tizen.UIExtensions.ElmSharp.INavigationView; +using TNavigationView = Tizen.UIExtensions.ElmSharp.NavigationView; +using TThemeConstants = Tizen.UIExtensions.ElmSharp.ThemeConstants; using TCollectionView = Tizen.UIExtensions.ElmSharp.CollectionView; using TSelectedItemChangedEventArgs = Tizen.UIExtensions.ElmSharp.SelectedItemChangedEventArgs; diff --git a/src/Controls/src/Core/Platform/Tizen/Shell/Tizen.UIExtensions/INavigationView.cs b/src/Controls/src/Core/Platform/Tizen/Shell/Tizen.UIExtensions/INavigationView.cs deleted file mode 100644 index 8a89f957ee94..000000000000 --- a/src/Controls/src/Core/Platform/Tizen/Shell/Tizen.UIExtensions/INavigationView.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using ElmSharp; -using Tizen.UIExtensions.Common; -using EColor = ElmSharp.Color; - -namespace Tizen.UIExtensions.Shell -{ - public interface INavigationView - { - EvasObject TargetView { get; } - - EvasObject Header { get; set; } - - EvasObject Footer { get; set; } - - EvasObject Content { get; set; } - - EColor BackgroundColor { get; set; } - - EvasObject BackgroundImage { get; set; } - - event EventHandler LayoutUpdated; - } -} diff --git a/src/Controls/src/Core/Platform/Tizen/Shell/Tizen.UIExtensions/ITabs.cs b/src/Controls/src/Core/Platform/Tizen/Shell/Tizen.UIExtensions/ITabs.cs deleted file mode 100644 index 2f7c7c1c6223..000000000000 --- a/src/Controls/src/Core/Platform/Tizen/Shell/Tizen.UIExtensions/ITabs.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using ElmSharp; -using EColor = ElmSharp.Color; -using EToolbarItemEventArgs = ElmSharp.ToolbarItemEventArgs; - -namespace Tizen.UIExtensions.Shell -{ - public interface ITabs - { - TabsType Scrollable { get; set; } - - EColor BackgroundColor { get; set; } - - ToolbarItem SelectedItem { get; } - - event EventHandler Selected; - - ToolbarItem Append(string label, string icon); - - ToolbarItem Append(string label); - - ToolbarItem InsertBefore(ToolbarItem before, string label, string icon); - } - - public enum TabsType - { - Fixed, - Scrollable - } -} diff --git a/src/Controls/src/Core/Platform/Tizen/Shell/Tizen.UIExtensions/NavigationView.cs b/src/Controls/src/Core/Platform/Tizen/Shell/Tizen.UIExtensions/NavigationView.cs deleted file mode 100644 index 72fcb594a9ca..000000000000 --- a/src/Controls/src/Core/Platform/Tizen/Shell/Tizen.UIExtensions/NavigationView.cs +++ /dev/null @@ -1,205 +0,0 @@ -using ElmSharp; -using System; -using Tizen.UIExtensions.Common; -using Tizen.UIExtensions.ElmSharp; -using EColor = ElmSharp.Color; -using EBox = ElmSharp.Box; - -namespace Tizen.UIExtensions.Shell -{ - /// - /// The native widget that is configured with an header and an list of items to be used in NavigationDrawer. - /// - public class NavigationView : Background, INavigationView - { - static readonly EColor s_defaultBackgroundColor = ElmSharp.ThemeConstants.Shell.ColorClass.DefaultNavigationViewBackgroundColor; - - EBox _mainLayout; - - EvasObject _header; - EvasObject _footer; - EvasObject _content; - - EvasObject _backgroundImage; - EColor _backgroundColor; - - /// - /// Initializes a new instance of the class. - /// - /// Parent evas object. - public NavigationView(EvasObject parent) : base(parent) - { - InitializeComponent(parent); - } - - /// - /// Gets or sets the background color of the NavigtiaonView. - /// - public override EColor BackgroundColor - { - get => _backgroundColor; - set - { - _backgroundColor = value; - EColor effectiveColor = _backgroundColor.IsDefault ? s_defaultBackgroundColor : _backgroundColor; - base.BackgroundColor = effectiveColor; - } - } - - /// - /// Gets or sets the background image of the NavigtiaonView. - /// - public EvasObject BackgroundImage - { - get => _backgroundImage; - set - { - _backgroundImage = value; - this.SetBackgroundPart(_backgroundImage); - } - } - - /// - /// Gets or sets the header view of the NavigtiaonView. - /// - public EvasObject Header - { - get => _header; - set => UpdateHeader(value); - } - - /// - /// Gets or sets the footer view of the NavigtiaonView. - /// - public EvasObject Footer - { - get => _footer; - set => UpdateFooter(value); - } - - public EvasObject Content - { - get => _content; - set => UpdateContent(value); - } - - /// - /// Gets or sets the target view of the NavigtiaonView. - /// - public EvasObject TargetView => this; - - /// - /// Notifies that the layout has been updated. - /// - public event EventHandler LayoutUpdated; - - void InitializeComponent(EvasObject parent) - { - base.BackgroundColor = s_defaultBackgroundColor; - - _mainLayout = new EBox(parent) - { - AlignmentX = -1, - AlignmentY = -1, - WeightX = 1, - WeightY = 1 - }; - _mainLayout.SetLayoutCallback(OnLayout); - _mainLayout.Show(); - - SetContent(_mainLayout); - } - - void OnLayout() - { - if (Geometry.Width == 0 || Geometry.Height == 0) - return; - - var bound = Geometry; - int headerHeight = 0; - int footerHeight = 0; - - if (_header != null) - { - var headerBound = bound; - headerHeight = _header.MinimumHeight; - headerBound.Height = headerHeight; - _header.Geometry = headerBound; - } - - if (_footer != null) - { - var footerbound = bound; - footerHeight = _footer.MinimumHeight; - footerbound.Y = bound.Y + bound.Height - footerHeight; - footerbound.Height = footerHeight; - _footer.Geometry = footerbound; - } - - if (_content != null) - { - bound.Y += headerHeight; - bound.Height = bound.Height - headerHeight - footerHeight; - _content.Geometry = bound; - } - - NotifyOnLayout(); - } - - void NotifyOnLayout() - { - LayoutUpdated?.Invoke(this, new LayoutEventArgs() { Geometry = Geometry.ToCommon() }); - } - - void UpdateHeader(EvasObject header) - { - if (_header != null) - { - _mainLayout.UnPack(_header); - _header.Unrealize(); - _header = null; - } - - if (header != null) - { - _mainLayout.PackStart(header); - } - _header = header; - _header?.Show(); - } - - void UpdateFooter(EvasObject footer) - { - if (_footer != null) - { - _mainLayout.UnPack(_footer); - _footer.Unrealize(); - _footer = null; - } - - if (footer != null) - { - _mainLayout.PackEnd(footer); - } - _footer = footer; - _footer?.Show(); - } - - void UpdateContent(EvasObject content) - { - if (_content != null) - { - _mainLayout.UnPack(_content); - _content.Unrealize(); - _content = null; - } - - if (content != null) - { - _mainLayout.PackEnd(content); - } - _content = content; - _content?.Show(); - } - } -} diff --git a/src/Controls/src/Core/Platform/Tizen/Shell/Tizen.UIExtensions/Tabs.cs b/src/Controls/src/Core/Platform/Tizen/Shell/Tizen.UIExtensions/Tabs.cs deleted file mode 100644 index 0046969b13cb..000000000000 --- a/src/Controls/src/Core/Platform/Tizen/Shell/Tizen.UIExtensions/Tabs.cs +++ /dev/null @@ -1,35 +0,0 @@ -using ElmSharp; -using Tizen.UIExtensions.ElmSharp; -using EToolbar = ElmSharp.Toolbar; - -namespace Tizen.UIExtensions.Shell -{ - public class Tabs : EToolbar, ITabs - { - TabsType _type; - - public Tabs(EvasObject parent) : base(parent) - { - Style = ElmSharp.ThemeConstants.Toolbar.Styles.Material; - SelectionMode = ToolbarSelectionMode.Always; - } - - public TabsType Scrollable - { - get => _type; - set - { - switch (value) - { - case TabsType.Fixed: - this.ShrinkMode = ToolbarShrinkMode.Expand; - break; - case TabsType.Scrollable: - this.ShrinkMode = ToolbarShrinkMode.Scroll; - break; - } - _type = value; - } - } - } -} diff --git a/src/Controls/src/Core/Platform/Tizen/Shell/Tizen.UIExtensions/ThemeConstants.cs b/src/Controls/src/Core/Platform/Tizen/Shell/Tizen.UIExtensions/ThemeConstants.cs deleted file mode 100644 index b91c87d53211..000000000000 --- a/src/Controls/src/Core/Platform/Tizen/Shell/Tizen.UIExtensions/ThemeConstants.cs +++ /dev/null @@ -1,25 +0,0 @@ -using EColor = ElmSharp.Color; - -namespace Tizen.UIExtensions.Shell -{ - public class ThemeConstants - { - public class Shell - { - public class ColorClass - { - public static readonly EColor DefaultBackgroundColor = EColor.FromRgb(33, 150, 243); - public static readonly EColor DefaultForegroundColor = EColor.White; - public static readonly EColor DefaultTitleColor = EColor.White; - } - - public class Resources - { - // The source of icon resources is https://materialdesignicons.com/ - public const string MenuIcon = "Platform.Tizen.Resources.menu.png"; - public const string BackIcon = "Platform.Tizen.Resources.arrow_left.png"; - public const string DotsIcon = "Platform.Tizen.Resources.dots_horizontal.png"; - } - } - } -}