예제 #1
0
        private void InitializeComponent(string htmlStringvalue, bool autoFocusInputvalue)
        {
            _topToolBar       = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.TopToolbar);
            _topToolBar.Title = CrossTEditor.PageTitle;
            _topToolBar.SetNavigationIcon(Resource.Drawable.backbutton);
            _topToolBar.SetTitleTextColor(Android.Graphics.Color.White);
            _topToolBar.SetOnClickListener(new BackClicked(DecoreView, this));
            _topToolBar.InflateMenu(Resource.Menu.TopToolbarMenu);
            _topToolBar.MenuItemClick += async(sender, e) =>
            {
                if (SetOutput != null)
                {
                    if (e.Item.TitleFormatted.ToString() == "Save")
                    {
                        string html = await _editorWebView.GetHTML();

                        SetOutput.Invoke(true, html);
                    }
                    else
                    {
                        SetOutput.Invoke(false, null);
                    }
                }

                DecoreView.RemoveView(this);
            };

            _rootLayout    = FindViewById <LinearLayoutDetectsSoftKeyboard>(Resource.Id.RootRelativeLayout);
            _editorWebView = FindViewById <TEditorWebView>(Resource.Id.EditorWebView);
            _toolbarLayout = FindViewById <LinearLayout>(Resource.Id.ToolbarLayout);

            _rootLayout.onKeyboardShown += HandleSoftKeyboardShwon;
            _editorWebView.SetOnCreateContextMenuListener(this);
            BuildToolbar();

            string htmlString = htmlStringvalue;

            _editorWebView.SetHTML(htmlString);

            bool autoFocusInput = autoFocusInputvalue;

            _editorWebView.SetAutoFocusInput(autoFocusInput);
        }
예제 #2
0
 public void OnClick(View v)
 {
     TEditorView.SetOutput.Invoke(false, null);
     DecoreView.RemoveView(EditorView);
 }