void CreatePopup()
        {
            var rect = XForms.NativeParent.Geometry;

            var root = FindWindow(XForms.NativeParent);

            _editorPopup = new Background(root)
            {
                Geometry = rect
            };

            var layout = new ELayout(_editorPopup);
            layout.SetTheme("layout", "entry", "default");
            layout.Show();

            _editorPopup.SetPartContent("overlay", layout);

            _editor = new Xamarin.Forms.Platform.Tizen.Native.Entry(layout);
            _editor.IsSingleLine = true;
            _editor.Scrollable = true;
            _editor.SetInputPanelEnabled(false);
            _editor.AllowFocus(true);
            _editor.PrependMarkUpFilter(PopupEntryMaxLengthFilter);
            _editor.Show();

            _editor.SetInputPanelReturnKeyType(Element.ReturnType.ToInputPanelReturnKeyType());

            _editor.UpdateKeyboard(Element.Keyboard, Element.IsSpellCheckEnabled, Element.IsTextPredictionEnabled);

            _editorPopup.BackButtonPressed += (s, e) => HidePopup();

            _editor.Activated += (s, e) => HidePopup();

            IntPtr entryHandle = Interop.EFL.elm_entry_imf_context_get(_editor.RealHandle);

            _editorStateChanged = EditorStateChanged;
            Interop.EFL.ecore_imf_context_input_panel_event_callback_add(entryHandle, Interop.EFL.InputPanelEventType.State, _editorStateChanged, IntPtr.Zero);

            layout.SetPartContent("elm.swallow.content", _editor);
        }
        void OnRealized()
        {
            _box = new ObservableBox(XForms.NativeParent);
            _box.SetLayoutCallback(OnLayout);

            _bgColorObject = new ElmSharp.Rectangle(_box)
            {
                Color = ElmSharp.Color.Transparent
            };
            _bgImageObject = new EvasImage(_box);
            _surfaceLayout = new ElmSharp.Layout(_box);
            _surface       = new ElmSharp.Wearable.CircleSurface(_surfaceLayout);


            _toolbarItemMap     = new Dictionary <XToolbarItem, ElmSharp.Wearable.MoreOptionItem>();
            _circleSurfaceItems = new Dictionary <ICircleSurfaceItem, ICircleWidget>();

            _box.PackEnd(_bgColorObject);
            _box.PackEnd(_bgImageObject);
            _box.PackEnd(_surfaceLayout);

            _bgColorObject.Show();
            _bgImageObject.Hide();
            _surfaceLayout.Show();

            if (Element.ToolbarItems.Count > 0)
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    SetVisibleMoreOption(true);

                    foreach (var item in Element.ToolbarItems)
                    {
                        AddToolbarItem(item);
                    }
                });
            }

            SetNativeView(_box);
        }
Example #3
0
        public ProgressbarPopupRenderer()
        {
            _popUp = new Popup(Forms.NativeParent)
            {
                Style       = "circle",
                Orientation = PopupOrientation.Center,
            };
            _popUp.BackButtonPressed     += BackButtonPressedHandler;
            _popUp.TimedOut              += ProgressbarPopup_TimedOutHandler;
            _popUp.Dismissed             += _popUp_Dismissed;
            _popUp.ShowAnimationFinished += _popUp_ShowAnimationFinished;

            _layout = new ElmSharp.Layout(_popUp);
            _layout.SetTheme("layout", "popup", "content/circle");
            _popUp.SetContent(_layout);

            _progressbar = new ElmSharp.ProgressBar(Forms.NativeParent)
            {
                Color = ElmSharp.Color.FromRgb(77, 207, 255),
                //BackgroundColor = Color.FromRgb(100, 255, 0),
                //SpanSize = 50,
                Style       = "process",
                IsPulseMode = true,
            };
            _progressbar.Deleted += _progressbar_Deleted;
            _popUp.SetPartContent("elm.swallow.progress", _progressbar);

            ///////////////
            _popUp2 = new Popup(Forms.NativeParent)
            {
                Style       = "toast/circle/check",
                Orientation = PopupOrientation.Bottom,
                //Timeout = Duration,
            };
            //_popUp2.SetPartText("elm.text", Text);
            _popUp2.TimedOut  += TimedOutHandler;
            _popUp2.Dismissed += _popUp2_Dismissed;
        }
Example #4
0
        protected override void OnElementChanged(ElementChangedEventArgs <CircleSurfaceView> e)
        {
            if (Control == null)
            {
                var box = new Box(XForms.NativeParent);
                box.SetLayoutCallback(OnLayout);
                _surfaceLayout      = new ELayout(box);
                _circleSurface      = new CircleSurface(_surfaceLayout);
                _circleSurfaceItems = new Dictionary <ICircleSurfaceItem, ICircleWidget>();
                box.PackEnd(_surfaceLayout);
                _surfaceLayout.Show();
                SetNativeControl(box);
            }

            if (e.NewElement != null)
            {
                e.NewElement.CircleSurface = _circleSurface;
                var items = e.NewElement.CircleSurfaceItems as ObservableCollection <ICircleSurfaceItem>;
                items.CollectionChanged += OnCircleSurfaceItemsChanged;
                foreach (var item in items)
                {
                    AddCircleSurfaceItem(item);
                }
            }

            if (e.OldElement != null)
            {
                var items = e.OldElement.CircleSurfaceItems as ObservableCollection <ICircleSurfaceItem>;
                foreach (var item in items)
                {
                    RemoveCircleSurfaceItem(item);
                }
                items.CollectionChanged -= OnCircleSurfaceItemsChanged;
            }

            base.OnElementChanged(e);
        }
Example #5
0
        protected override void OnPreCreate()
        {
            base.OnPreCreate();
            Application.ClearCurrent();
            var type = typeof(Window);
            // Use reflection to avoid breaking compatibility. ElmSharp.Window.CreateWindow() is has been added since API6.
            var    methodInfo = type.GetMethod("CreateWindow", BindingFlags.NonPublic | BindingFlags.Static);
            Window window     = null;

            if (methodInfo != null)
            {
                window     = (Window)methodInfo.Invoke(null, new object[] { "FormsWindow" });
                BaseLayout = (ELayout)window.GetType().GetProperty("BaseLayout").GetValue(window);
            }
            else
            {
                window = PreloadedWindow.GetInstance() ?? new Window("FormsWindow");
                if (window is PreloadedWindow precreated)
                {
                    BaseLayout = precreated.BaseLayout;
                }
            }
            MainWindow = window;
        }
Example #6
0
 public static bool SetOverlayPart(this ELayout layout, EvasObject content, bool preserveOldContent = false)
 {
     return(layout.SetPartContent(ThemeConstants.Layout.Parts.Overlay, content, preserveOldContent));
 }
Example #7
0
 public static bool SetTextPart(this ELayout layout, string text)
 {
     return(layout.SetPartText(ThemeConstants.Layout.Parts.Text, text));
 }
Example #8
0
 public static EdjeTextPartObject GetTextPartEdjeObject(this ELayout layout)
 {
     return(layout?.EdjeObject[ThemeConstants.Layout.Parts.Text]);
 }
Example #9
0
 public static void SetBaseLayout(this Window window, ELayout layout)
 {
     s_windowBaseLayout[window] = layout;
 }
        /// <summary>
        /// Initialize ThumbnailIndex View
        /// </summary>
        private void Initialize()
        {
            Console.WriteLine("Initialize");
            _isFirstItem = true;

            _pbox = new PaddingBox(Forms.NativeParent)
            {
                Padding = new Thickness {
                    Left = 0, Right = 0, Top = 22, Bottom = 0
                },
                HeaderSize = new ElmSharp.Size(200, 19),
                HeaderGap  = 38
            };
            _pbox.Show();

            _index = new ElmSharp.Index(_pbox)
            {
                Style        = "thumbnail",
                AutoHide     = false,
                IsHorizontal = true,
                AlignmentX   = 0.5,
                AlignmentY   = 0.5,
            };
            _index.Show();
            _pbox.Header = _index;
            //index.Geometry = new Rect(0, 22, 200, 19);

            _scroller = new ElmSharp.Scroller(_pbox)
            {
                HorizontalLoop = false,
                VerticalLoop   = false,
                HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible,
                VerticalScrollBarVisiblePolicy   = ScrollBarVisiblePolicy.Invisible,
                HorizontalPageScrollLimit        = 1,
                VerticalPageScrollLimit          = 0,
            };

            _scroller.PageScrolled += (s, e) =>
            {
                Console.WriteLine($" _scroller PageScrolled");
                var pageIndex = _scroller.HorizontalPageIndex;
                _items[pageIndex].Select(true);
            };
            _scroller.Show();
            _pbox.Content = _scroller;
            //_scroller.Geometry = new Rect(0, 79, 360, 281);

            var box = new ElmSharp.Box(_scroller)
            {
                IsHorizontal = true,
                AlignmentX   = 0.5,
                AlignmentY   = 0.5,
            };

            _scroller.SetContent(box);
            box.Show();

            // Create Rectangle for layout center align in Box
            var padder = new ElmSharp.Rectangle(box);

            box.PackEnd(padder);
            _items.Clear();

            // Initialize ThumbnailItems
            foreach (var item in Element.ThumbnailItems)
            {
                // create layout
                var page = new ElmSharp.Layout(box)
                {
                    WeightX    = 1.0,
                    WeightY    = 1.0,
                    AlignmentX = -1.0,
                    AlignmentY = 0.5
                };
                page.SetTheme("layout", "body_thumbnail", "default");
                page.Show();

                // set icon
                var img  = new ElmSharp.Image(page);
                var icon = item.Image;
                Console.WriteLine($"item.Image File:{icon.File}");
                img.LoadAsync(ResourcePath.GetPath(icon.File));
                page.SetPartContent("elm.icon", img);

                var indexItem = _index.Append(null);
                _items.Add(indexItem);

                // first item case
                if (_isFirstItem)
                {
                    Console.WriteLine($"_isFirstItem is true");
                    page.Resized += (s, e) =>
                    {
                        var g  = _scroller.Geometry;
                        var pg = page.Geometry;
                        padder.MinimumWidth  = (g.Width - pg.Width) / 2;
                        padder.MinimumHeight = g.Height / 2;
                        _scroller.SetPageSize(pg.Width, pg.Height);
                    };
                    indexItem.Select(true);
                }

                _isFirstItem = false;
                box.PackEnd(page);
            }

            box.PackEnd(padder);
            _index.Update(0);
        }
        void InitializeComponent()
        {
            _outterBox.SetLayoutCallback(OnLayout);

            _surfaceLayout = new ELayout(this);
            _surfaceLayout.Show();
            _surface = new CircleSurface(_surfaceLayout);

            _naviMenu = new CircleGenList(this, _surface)
            {
                Homogeneous     = true,
                BackgroundColor = ElmSharp.Color.Gray
            };
            _naviMenu.Show();

            _draggedUpCallback     = new SmartEvent(_naviMenu, "drag,start,up");
            _draggedUpCallback.On += (s, e) =>
            {
                if (_footer.TrackObject.IsVisible)
                {
                    Dragged?.Invoke(this, new DraggedEventArgs(DraggedState.EdgeBottom));
                }
                else
                {
                    Dragged?.Invoke(this, new DraggedEventArgs(DraggedState.Up));
                }
            };

            _draggedDownCallback     = new SmartEvent(_naviMenu, "drag,start,down");
            _draggedDownCallback.On += (s, e) =>
            {
                if (_header.TrackObject.IsVisible)
                {
                    Dragged?.Invoke(this, new DraggedEventArgs(DraggedState.EdgeTop));
                }
                else
                {
                    Dragged?.Invoke(this, new DraggedEventArgs(DraggedState.Down));
                }
            };

            _outterBox.PackEnd(_naviMenu);
            _outterBox.PackEnd(_surfaceLayout);

            _surfaceLayout.StackAbove(_naviMenu);

            _defaultClass = new GenItemClass("1icon_1text")
            {
                GetTextHandler = (obj, part) =>
                {
                    if (part == "elm.text")
                    {
                        return((obj as Item).Text);
                    }
                    return(null);
                },
                GetContentHandler = (obj, part) =>
                {
                    if (part == "elm.swallow.icon" && obj is Item menuItem && !string.IsNullOrEmpty(menuItem.Icon))
                    {
                        var icon = new ElmSharp.Image(Xamarin.Forms.Forms.NativeParent)
                        {
                            AlignmentX    = -1,
                            AlignmentY    = -1,
                            WeightX       = 1.0,
                            WeightY       = 1.0,
                            MinimumWidth  = _dafaultIconSize,
                            MinimumHeight = _dafaultIconSize,
                        };
                        icon.Show();
                        icon.Load(menuItem.Icon);
                        return(icon);
                    }
                    return(null);
                }
            };

            _naviMenu.ItemSelected += OnItemSelected;
        }

        void OnItemSelected(object sender, GenListItemEventArgs e)
        {
            ItemSelected?.Invoke(this, new SelectedItemChangedEventArgs((e.Item.Data as Item).Source, -1));
        }

        void OnLayout()
        {
            _surfaceLayout.Geometry = Geometry;
            _naviMenu.Geometry      = Geometry;
        }

        bool IsUpdated(List <List <Element> > items)
        {
            if (_itemCache == null)
            {
                return(true);
            }

            if (_itemCache.Count != items.Count)
            {
                return(true);
            }

            for (int i = 0; i < items.Count; i++)
            {
                if (_itemCache[i].Count != items[i].Count)
                {
                    return(true);
                }

                for (int j = 0; j < items[i].Count; j++)
                {
                    if (_itemCache[i][j] != items[i][j])
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
    }
Example #12
0
 public static bool SetBackgroundPart(this ELayout layout, EvasObject?content, bool preserveOldContent = false)
 {
     return(layout.SetPartContent(ThemeConstants.Layout.Parts.Background, content, preserveOldContent));
 }
Example #13
0
        protected override void OnElementChanged(ElementChangedEventArgs <CarouselPage> e)
        {
            if (NativeView == null)
            {
                _outterLayout = new Native.ApplicationLayout(Forms.NativeParent)
                {
                    AlignmentX = -1,
                    AlignmentY = -1,
                    WeightX    = 1,
                    WeightY    = 1,
                };
                _outterLayout.Show();

                _index = new Index(Forms.NativeParent)
                {
                    IsHorizontal = true,
                    AutoHide     = false,
                };
                _index.Changed += OnIndexChanged;
                _index.Show();
                _outterLayout.SetContentPart(_index);

                _scroller = new Scroller(Forms.NativeParent)
                {
                    HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible,
                    VerticalScrollBarVisiblePolicy   = ScrollBarVisiblePolicy.Invisible,
                    HorizontalPageScrollLimit        = 1,
                    PageWidth  = 1,
                    PageHeight = 1,
                    AlignmentX = -1,
                    AlignmentY = -1,
                    WeightX    = 1,
                    WeightY    = 1,
                };
                _scroller.PageScrolled += OnPageScrolled;
                _scroller.Show();

                _innerContainer = new Box(Forms.NativeParent)
                {
                    AlignmentX = -1,
                    AlignmentY = -1,
                    WeightX    = 1,
                    WeightY    = 1,
                };
                _innerContainer.SetLayoutCallback(OnInnerLayoutUpdate);
                _innerContainer.Show();
                _scroller.SetContent(_innerContainer);

                _outterLayout.SetBackgroundPart(_scroller);

                SetNativeView(_outterLayout);
            }

            if (e.OldElement != null)
            {
                e.OldElement.CurrentPageChanged -= OnCurrentPageChanged;
                e.OldElement.PagesChanged       -= OnPagesChanged;
                _isInitalized = false;
            }

            if (e.NewElement != null)
            {
                Element.CurrentPageChanged += OnCurrentPageChanged;
                Element.PagesChanged       += OnPagesChanged;
            }

            base.OnElementChanged(e);
        }