Example #1
0
        protected override void OnCreate(Android.OS.Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.TEditorActivity);

            _topToolBar       = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.TopToolbar);
            _topToolBar.Title = CrossTEditor.PageTitle;
            _topToolBar.InflateMenu(Resource.Menu.TopToolbarMenu);
            _topToolBar.MenuItemClick += async(sender, e) =>
            {
                if (SetOutput != null)
                {
                    if (e.Item.TitleFormatted.ToString() == "Save")
                    {
                        var html = await _editorWebView.GetHTML();

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

                Finish();
            };

            _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();

            var htmlString = Intent.GetStringExtra("HTMLString") ?? "<p></p>";

            _editorWebView.SetHTML(htmlString);

            var autoFocusInput = Intent.GetBooleanExtra("AutoFocusInput", false);

            _editorWebView.SetAutoFocusInput(autoFocusInput);
        }
        protected override void OnCreate(Android.OS.Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.TEditorActivity);

            _topToolBar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.TopToolbar);

            _topToolBar.Title = CrossTEditor.PageTitle;

            SetSupportActionBar(_topToolBar);

            if (SupportActionBar != null)
            {
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                SupportActionBar.SetDisplayShowHomeEnabled(true);
                SupportActionBar.SetDisplayShowCustomEnabled(true);
            }

            _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 = Intent.GetStringExtra("HTMLString") ?? "<p></p>";

            _editorWebView.SetHTML(htmlString);

            bool autoFocusInput = Intent.GetBooleanExtra("AutoFocusInput", false);

            _editorWebView.SetAutoFocusInput(autoFocusInput);


            _macros       = Intent.GetStringArrayListExtra("macroKeys");
            _macrosValues = Intent.GetStringArrayListExtra("macroValues");
        }