From d2f61b83fa720b6b3a95536fcd0460d16c5188ac Mon Sep 17 00:00:00 2001 From: Umar Date: Thu, 8 Jun 2017 16:09:48 +0100 Subject: [PATCH] Fixing Demos as some Classes and APIs are internal only Made ViewRegistry class public for now as it provides an API which allows Custom controls to get register themselves with DALi NUI. In upcoming patches, this class will be split into two classes (internal - Animatable/Object Registry and public - ViewRegistry). Change-Id: I965594a20156cdcefbad962f55e4d73d74feca80 --- .../examples/control-dashboard.cs | 48 +++++++++----- .../NUISamples.TizenTV/examples/dali-test.cs | 6 +- .../NUISamples.TizenTV/examples/date-picker.cs | 73 ---------------------- Tizen.NUI/src/internal/ViewRegistry.cs | 8 +-- 4 files changed, 39 insertions(+), 96 deletions(-) diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/control-dashboard.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/control-dashboard.cs index 456085e..d876810 100644 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/control-dashboard.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/control-dashboard.cs @@ -348,22 +348,38 @@ namespace ControlDashboard button.PivotPoint = PivotPoint.Center; button.Clicked += (obj, ee) => { - TypeInfo typeInfo = new TypeInfo(TypeRegistry.Get().GetTypeInfo("PopupToast")); - if (typeInfo) - { - BaseHandle baseHandle = typeInfo.CreateInstance(); - if (baseHandle) - { - Popup toast = Popup.DownCast(baseHandle); - TextLabel text = new TextLabel("This is a Toast.\nIt will auto-hide itself"); - text.TextColor = Color.White; - text.MultiLine = true; - text.HorizontalAlignment = HorizontalAlignment.Center; - toast.SetTitle(text); - _window.Add(toast); - toast.SetDisplayState(Popup.DisplayStateType.Shown); - } - } + Popup toast = new Popup(); + toast.SizeModeFactor = new Vector3(0.75f, 0.75f, 0.75f); + toast.WidthResizePolicy = ResizePolicyType.SizeRelativeToParent; + toast.HeightResizePolicy = ResizePolicyType.UseNaturalSize; + toast.ContextualMode = Popup.ContextualModeType.NonContextual; + toast.AnimationDuration = 0.65f; + toast.TailVisibility = false; + + // Disable the dimmed backing. + toast.BackingEnabled = false; + + // The toast popup should fade in (not zoom). + toast.AnimationMode = Popup.AnimationModeType.Fade; + + // The toast popup should auto-hide. + toast.AutoHideDelay = 3000; + + // Align to the bottom of the screen. + toast.ParentOrigin = new Position(0.5f, 0.94f, 0.5f); + toast.PivotPoint = PivotPoint.BottomCenter; + + // Let events pass through the toast popup. + toast.TouchTransparent = true; + + TextLabel text = new TextLabel("This is a Toast.\nIt will auto-hide itself"); + text.TextColor = Color.White; + text.MultiLine = true; + text.HorizontalAlignment = HorizontalAlignment.Center; + toast.SetTitle(text); + _window.Add(toast); + toast.DisplayState = Popup.DisplayStateType.Shown; + return true; }; _contentContainer.AddChild(button, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5)); diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/dali-test.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/dali-test.cs index 2bc07ab..2171d74 100755 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/dali-test.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/dali-test.cs @@ -642,7 +642,7 @@ namespace DaliTest background = spin.Background; Color backgroundColor = new Color(); - background.Find(ColorVisualProperty.MixColor)?.Get(backgroundColor); + background.Find(ColorVisualProperty.MixColor, "mixColor")?.Get(backgroundColor); if( backgroundColor == Color.Red ) { Tizen.Log.Debug("NUI", "Custom View Background property : test passed"); @@ -691,7 +691,7 @@ namespace DaliTest View container = new View(); container.Position = new Position(-800.0f, -800.0f, 0.0f); Window.Instance.Add(container); - Tizen.Log.Debug("NUI", "winow layer count is "+Window.Instance.GetLayerCount()); + Tizen.Log.Debug("NUI", "winow layer count is "+Window.Instance.LayerCount); Tizen.Log.Debug("NUI", "winow default layer child at 0 is "+Window.Instance.GetDefaultLayer().GetChildAt(0)); // Test downcast for native control TextLabel myLabel = new TextLabel(); @@ -845,7 +845,7 @@ namespace DaliTest button.BackgroundColor = Color.White; View parentView = new View(); parentView.Add(button); - PushButton view = PushButton.DownCast(parentView.GetChildAt(0)); + PushButton view = parentView.GetChildAt(0) as PushButton; if (view) { Tizen.Log.Debug("NUI", "NUI view GetTypeName= " + view.GetTypeName()); diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/date-picker.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/date-picker.cs index 4e6c98a..8b5f53c 100644 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/date-picker.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/date-picker.cs @@ -33,11 +33,6 @@ namespace DatePickerTest private Spin _spinMonth; // spin control for month private Spin _spinDay; // spin control for day - private ImfManager _imfMgr; - private TextField _textField; - private PushButton _pushButton; - public bool _toggle; - public Example() : base() { @@ -119,51 +114,6 @@ namespace DatePickerTest FocusManager keyboardFocusManager = FocusManager.Instance; keyboardFocusManager.PreFocusChange += OnKeyboardPreFocusChange; keyboardFocusManager.FocusedViewActivated += OnFocusedViewActivated; - - //////////////////////////////////////////////////////////////////////// - _imfMgr = ImfManager.Get(); - _imfMgr.ImfManagerActivated += _imfMgr_ImfManagerActivated; - - _textField = new TextField(); - _textField.Position2D = new Position2D(100, 100); - _textField.Size2D = new Size2D(900, 100); - _textField.Text = "imf manager test!"; - _textField.BackgroundColor = Color.Blue; - _textField.TextColor = Color.White; - window.Add(_textField); - - keyboardFocusManager.SetCurrentFocusView(_textField); - - _pushButton = new PushButton(); - _pushButton.Position2D = new Position2D(100, 210); - _pushButton.Size2D = new Size2D(900, 100); - _pushButton.LabelText = "imf activate"; - _pushButton.Clicked += _pushButton_Clicked; - window.Add(_pushButton); - } - - private bool _pushButton_Clicked(object source, EventArgs e) - { - Tizen.Log.Fatal("NUI", "_pushButton_Clicked event comes!"); - - if (_toggle) - { - _imfMgr.Activate(); - _pushButton.LabelText = "imf activated"; - _toggle = false; - } - else - { - _imfMgr.Deactivate(); - _pushButton.LabelText = "imf deactivated"; - _toggle = true; - } - return true; - } - - private void _imfMgr_ImfManagerActivated(object sender, ImfManager.ImfManagerActivatedEventArgs e) - { - Tizen.Log.Fatal("NUI", "_imfMgr_ImfManagerActivated event comes!"); } private View OnKeyboardPreFocusChange(object source, FocusManager.PreFocusChangeEventArgs e) @@ -205,30 +155,7 @@ namespace DatePickerTest private void OnFocusedViewActivated(object source, FocusManager.FocusedViewEnterKeyEventArgs e) { - // Make the text field in the current focused spin to take the key input - KeyInputFocusManager manager = KeyInputFocusManager.Get(); - if (e.View == _spinYear.SpinText) - { - if (manager.GetCurrentFocusControl() != _spinYear.SpinText) - { - manager.SetFocus(_spinYear.SpinText); - } - } - else if (e.View == _spinMonth.SpinText) - { - if (manager.GetCurrentFocusControl() != _spinMonth.SpinText) - { - manager.SetFocus(_spinMonth.SpinText); - } - } - else if (e.View == _spinDay.SpinText) - { - if (manager.GetCurrentFocusControl() != _spinDay.SpinText) - { - manager.SetFocus(_spinDay.SpinText); - } - } } /// diff --git a/Tizen.NUI/src/internal/ViewRegistry.cs b/Tizen.NUI/src/internal/ViewRegistry.cs index 141c58d..67abc4b 100755 --- a/Tizen.NUI/src/internal/ViewRegistry.cs +++ b/Tizen.NUI/src/internal/ViewRegistry.cs @@ -123,7 +123,7 @@ namespace Tizen.NUI /// /// /// - internal sealed class ViewRegistry + public sealed class ViewRegistry { /// /// ViewRegistry is a singleton @@ -178,7 +178,7 @@ namespace Tizen.NUI }; - public ViewRegistry() + private ViewRegistry() { _createCallback = new CreateControlDelegate(CreateControl); _getPropertyCallback = new GetPropertyDelegate(GetProperty); @@ -240,7 +240,7 @@ namespace Tizen.NUI /// Store the mapping between this instance of control (View) and native part. /// /// The instance of control (View) - public static void RegisterView(View view) + internal static void RegisterView(View view) { // We store a pointer to the RefObject for the control RefObject refObj = view.GetObjectPtr(); @@ -261,7 +261,7 @@ namespace Tizen.NUI /// Remove the this instance of control (View) and native part from the mapping table. /// /// The instance of control (View) - public static void UnregisterView(View view) + internal static void UnregisterView(View view) { RefObject refObj = view.GetObjectPtr(); IntPtr refCptr = (IntPtr)RefObject.getCPtr(refObj); -- 2.7.4