public PagerReaderFragment(string html, bool highlight, string chapter)
        {
            this.html = html;
            this.highlight = highlight;
            this.chapter = chapter;

            client = new NWTBibleWebView(Activity, ThisApp.Language, highlight, null, chapter);
        }
예제 #2
0
        public Dialog PresentationDialog(Activity activity, string title, string message = "", bool save = true)
        {
            LayoutInflater inflater = (LayoutInflater)activity.GetSystemService(Context.LayoutInflaterService);
            View layout = inflater.Inflate(Resource.Layout.HTMLWebView, null);

            AlertDialog.Builder dialog = new AlertDialog.Builder(activity, Android.Resource.Style.ThemeDeviceDefaultNoActionBarFullscreen);
            dialog.SetTitle(title);
            dialog.SetIcon(Resource.Drawable.Icon);
            dialog.SetNegativeButton("X",
                (o, args) =>
                {
                    // Do something
                });

            NotesDbAdapter dbHelper = new NotesDbAdapter(activity);
            dbHelper.Open();

            if (save)
            {
                dialog.SetPositiveButton("Save",
                    (o, args) =>
                    {
                        AlertDialog.Builder alert = new AlertDialog.Builder(activity, Android.Resource.Style.ThemeDeviceDefaultNoActionBarFullscreen);
                        EditText input = new EditText(activity);
                        input.Hint = "favorite title";

                        alert.SetTitle("Add Favorite - " + title);
                        alert.SetMessage(Html.FromHtml("<i>Favorite Title:</i>"));
                        alert.SetView(input);

                        alert.SetPositiveButton("Save",
                            (o2, args2) =>
                            {
                                long id = dbHelper.CreateNote(title, message, input.Text, " ", "GEMFAVORITE");
                            });

                        alert.SetNegativeButton("X",
                           (o2, args2) =>
                           {

                           });
                        alert.Show();
                    });
            }

            //TextView textview = layout.FindViewById<TextView>(Resource.Id.htmltextbox);
            //textview.MovementMethod = LinkMovementMethod.Instance;
            //textview.SetText(Html.FromHtml(message), TextView.BufferType.Normal);

            WebView PresentationWebView = layout.FindViewById<WebView>(Resource.Id.htmlWebView);
            var client = new NWTBibleWebView(activity, Language);
            PresentationWebView.SetWebViewClient(client);
            PresentationWebView.Settings.JavaScriptEnabled = true;
            PresentationWebView.Settings.PluginsEnabled = true;
            PresentationWebView.Settings.BuiltInZoomControls = true;
            PresentationWebView.Settings.DefaultFontSize = UserFontSize(activity);
            PresentationWebView.LoadDataWithBaseURL("file:///android_asset/", message, "text/html", "utf-8", null);

            dialog.SetView(layout);

            return dialog.Create();
        }