diff --git a/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj b/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj
index a1d532a7..9903e7bc 100644
--- a/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj
+++ b/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj
@@ -343,6 +343,8 @@
+
+
@@ -374,6 +376,9 @@
Designer
+
+ Designer
+
@@ -383,7 +388,9 @@
-
+
+ Designer
+
Designer
diff --git a/BookAStar/BookAStar.Droid/Markdown/MDContextMenu.cs b/BookAStar/BookAStar.Droid/Markdown/MDContextMenu.cs
new file mode 100644
index 00000000..d5196466
--- /dev/null
+++ b/BookAStar/BookAStar.Droid/Markdown/MDContextMenu.cs
@@ -0,0 +1,73 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using Android.App;
+using Android.Content;
+using Android.OS;
+using Android.Runtime;
+using Android.Views;
+using Android.Widget;
+using Android.Support.V7.App;
+using XLabs.Ioc;
+using XLabs.Platform.Mvvm;
+using XLabs.Forms;
+using static Android.Views.View;
+
+namespace BookAStar.Droid.Markdown
+{
+ class MDContextMenu : AppCompatDialog
+ {
+ private ActionMode mActionMode = null;
+ public MDContextMenu(Context context) : base(context)
+ {
+
+ }
+ public override void OnActionModeStarted(ActionMode mode)
+ {
+ if (mActionMode == null)
+ {
+ mActionMode = mode;
+ var menu = mode.Menu;
+ // Remove the default menu items (select all, copy, paste, search)
+ menu.Clear();
+
+ // If you want to keep any of the defaults,
+ // remove the items you don't want individually:
+ // menu.removeItem(android.R.id.[id_of_item_to_remove])
+
+ // Inflate your own menu items
+ mode.MenuInflater.Inflate(Resource.Menu.md_menu, menu);
+
+ }
+ mActionMode = mode;
+ base.OnActionModeStarted(mode);
+ }
+ public override void OnActionModeFinished(ActionMode mode)
+ {
+ base.OnActionModeFinished(mode);
+ }
+ protected override void OnCreate(Bundle savedInstanceState)
+ {
+ base.OnCreate(savedInstanceState);
+ }
+ public void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo)
+ {
+ /* if (menuInfo!=null)
+ {
+ var info = menuInfo.ToString();
+ }
+ menu.Add(0, 0, 0, "test");
+ var subMenu = menu.AddSubMenu(
+ 0, 1, 1, "...");
+ subMenu.Add(0, 3, 0, "nkjnkjn");
+ var app = Resolver.Resolve() as IXFormsApp;
+
+ var mgr = ClipboardManager.FromContext(app.AppContext);
+ if (mgr.HasText)
+ menu.Add(0, 0, 0, "Coller!");*/
+ //base.OnCreateContextMenu(menu, v, menuInfo);
+ }
+ }
+}
\ No newline at end of file
diff --git a/BookAStar/BookAStar.Droid/Markdown/MDWebView.cs b/BookAStar/BookAStar.Droid/Markdown/MDWebView.cs
new file mode 100644
index 00000000..c567807d
--- /dev/null
+++ b/BookAStar/BookAStar.Droid/Markdown/MDWebView.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using Android.App;
+using Android.Content;
+using Android.OS;
+using Android.Runtime;
+using Android.Views;
+using Android.Widget;
+using Android.Webkit;
+
+namespace BookAStar.Droid.Markdown
+{
+ class MDWebView : WebView
+ {
+ public MDWebView (Context context) : base (context)
+ {
+ }
+
+ public override ActionMode StartActionMode(ActionMode.ICallback callback)
+ {
+ return base.StartActionMode(callback);
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/BookAStar/BookAStar.Droid/Markdown/MarkdownViewRenderer.cs b/BookAStar/BookAStar.Droid/Markdown/MarkdownViewRenderer.cs
index 9480e863..7ebdfef9 100644
--- a/BookAStar/BookAStar.Droid/Markdown/MarkdownViewRenderer.cs
+++ b/BookAStar/BookAStar.Droid/Markdown/MarkdownViewRenderer.cs
@@ -12,6 +12,11 @@ using Android.Views;
namespace BookAStar.Droid
{
using Markdown;
+ using XLabs.Forms;
+ using XLabs.Ioc;
+ using XLabs.Platform.Mvvm;
+ using static View;
+
public class MarkdownViewRenderer : ViewRenderer
{
private WebView editorView;
@@ -35,7 +40,9 @@ namespace BookAStar.Droid
{
if (view == null || xview == null) return;
var vch = view.ContentHeight;
- xview.HeightRequest = vch > xview.MinimumHeightRequest ? vch : xview.MinimumHeightRequest;
+ // var oldH = xview.Height;
+ var newH = vch > xview.MinimumHeightRequest ? vch : xview.MinimumHeightRequest;
+ xview.HeightRequest = newH;
}
protected override void OnElementChanged(ElementChangedEventArgs e)
@@ -73,7 +80,7 @@ namespace BookAStar.Droid
Control.LoadUrl(string.Format("javascript: {0}", script));
}
}
-
+ MDContextMenu contextMenu;
private WebView CreateNativeControl()
{
editorView = new WebView(Context);
@@ -93,9 +100,18 @@ namespace BookAStar.Droid
EditorView.Settings.DomStorageEnabled = true;
EditorView.AddJavascriptInterface(new JsBridgeMarkdown(this), "jsBridge");
EditorView.ViewTreeObserver.PreDraw += ViewTreeObserver_PreDraw;
+ //var app = Resolver.Resolve() as IXFormsApp;
+ //contextMenu = new MDContextMenu(app.AppContext);
+ //EditorView.SetOnCreateContextMenuListener(contextMenu);
+
return EditorView;
}
+ private void EditorView_Touch(object sender, TouchEventArgs e)
+ {
+
+ }
+
private void ViewTreeObserver_PreDraw(object sender, ViewTreeObserver.PreDrawEventArgs e)
{
AdjustHeightRequest(Element, Control);
diff --git a/BookAStar/BookAStar.Droid/Resources/menu/md_menu.axml b/BookAStar/BookAStar.Droid/Resources/menu/md_menu.axml
new file mode 100644
index 00000000..a6f00e51
--- /dev/null
+++ b/BookAStar/BookAStar.Droid/Resources/menu/md_menu.axml
@@ -0,0 +1,33 @@
+
+
diff --git a/BookAStar/BookAStar.Droid/Resources/values/strings.xml b/BookAStar/BookAStar.Droid/Resources/values/strings.xml
index a4a8abad..2699fd6f 100644
--- a/BookAStar/BookAStar.Droid/Resources/values/strings.xml
+++ b/BookAStar/BookAStar.Droid/Resources/values/strings.xml
@@ -17,6 +17,19 @@
325408689282
Comptes Booking Star
Comptes Booking Star
+
+ Copier
+ Coller
+
+ Caractère
+ Gras
+ Italique
+ Sousligné
+
+ Paragraphe
+ Titre
+ Sous-titre
+
Comptes