parent
82399e7454
commit
22e2b551c2
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:id="@+id/copy"
|
||||||
|
android:title="@string/copy"/>
|
||||||
|
<group android:id="@+id/group">
|
||||||
|
<item android:id="@+id/past"
|
||||||
|
android:title="@string/past"
|
||||||
|
android:showAsAction="ifRoom|withText"/>
|
||||||
|
</group>
|
||||||
|
<item android:id="@+id/submenu_character"
|
||||||
|
android:title="@string/character" >
|
||||||
|
<menu>
|
||||||
|
<item android:id="@+id/bold"
|
||||||
|
android:title="@string/bold" />
|
||||||
|
<item android:id="@+id/italic"
|
||||||
|
android:title="@string/italic" />
|
||||||
|
<item android:id="@+id/underline"
|
||||||
|
android:title="@string/underline" />
|
||||||
|
</menu>
|
||||||
|
</item>
|
||||||
|
<item android:id="@+id/submenu_paragraph"
|
||||||
|
android:title="@string/paragraph" >
|
||||||
|
<menu>
|
||||||
|
|
||||||
|
<item android:id="@+id/header1"
|
||||||
|
android:onClick="onGroupItemClick"
|
||||||
|
android:title="@string/header1" />
|
||||||
|
<item android:id="@+id/header2"
|
||||||
|
android:onClick="onGroupItemClick"
|
||||||
|
android:title="@string/header2" />
|
||||||
|
</menu>
|
||||||
|
</item>
|
||||||
|
</menu>
|
||||||
Loading…
Reference in New Issue