un positionnement de paramètre workflow des pros
This commit is contained in:
parent
fbd352e788
commit
96746fcc0b
322 changed files with 25893 additions and 3844 deletions
73
BookAStar/BookAStar.Droid/Markdown/MDContextMenu.cs
Normal file
73
BookAStar/BookAStar.Droid/Markdown/MDContextMenu.cs
Normal file
|
|
@ -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<IXFormsApp>() as IXFormsApp<XFormsCompatApplicationDroid>;
|
||||
|
||||
var mgr = ClipboardManager.FromContext(app.AppContext);
|
||||
if (mgr.HasText)
|
||||
menu.Add(0, 0, 0, "Coller!");*/
|
||||
//base.OnCreateContextMenu(menu, v, menuInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
28
BookAStar/BookAStar.Droid/Markdown/MDWebView.cs
Normal file
28
BookAStar/BookAStar.Droid/Markdown/MDWebView.cs
Normal file
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@ using System.Linq;
|
|||
using System.Text;
|
||||
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorTemplatePreprocessor", "4.2.0.703")]
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorTemplatePreprocessor", "4.2.1.62")]
|
||||
public partial class MarkdownEditor : MarkdownEditorBase
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ using Android.OS;
|
|||
using Android.Runtime;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
using Android.Graphics;
|
||||
|
||||
namespace BookAStar.Droid.Markdown
|
||||
{
|
||||
|
|
@ -17,6 +18,7 @@ namespace BookAStar.Droid.Markdown
|
|||
protected static MarkdownDeep.Markdown markdown = new MarkdownDeep.Markdown();
|
||||
public string Content { get; set; }
|
||||
public bool Editable { get; set; }
|
||||
|
||||
public string GetHtml()
|
||||
{
|
||||
return markdown.Transform(Content);
|
||||
|
|
|
|||
|
|
@ -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<MarkdownView, WebView>
|
||||
{
|
||||
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<MarkdownView> e)
|
||||
|
|
@ -55,10 +62,14 @@ namespace BookAStar.Droid
|
|||
{
|
||||
// Subscribe
|
||||
editorTemplate.Model = new Markdown.MarkdownViewModel
|
||||
{ Content = e.NewElement.Markdown, Editable = e.NewElement.Editable };
|
||||
{
|
||||
Content = e.NewElement.Markdown, Editable = e.NewElement.Editable
|
||||
};
|
||||
var html = editorTemplate.GenerateString();
|
||||
EditorView.LoadDataWithBaseURL("file:///android_asset/",
|
||||
html, "text/html", "utf-8", null);
|
||||
EditorView.SetBackgroundColor(e.NewElement.BackgroundColor.ToAndroid());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +80,7 @@ namespace BookAStar.Droid
|
|||
Control.LoadUrl(string.Format("javascript: {0}", script));
|
||||
}
|
||||
}
|
||||
|
||||
MDContextMenu contextMenu;
|
||||
private WebView CreateNativeControl()
|
||||
{
|
||||
editorView = new WebView(Context);
|
||||
|
|
@ -89,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<IXFormsApp>() as IXFormsApp<XFormsCompatApplicationDroid>;
|
||||
//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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue