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/Resource.Designer.cs b/BookAStar/BookAStar.Droid/Resources/Resource.Designer.cs index 2fbcc1b4..94a27d8e 100644 --- a/BookAStar/BookAStar.Droid/Resources/Resource.Designer.cs +++ b/BookAStar/BookAStar.Droid/Resources/Resource.Designer.cs @@ -4553,6 +4553,9 @@ namespace BookAStar.Droid // aapt resource value: 0x7f0d0026 public const int beginning = 2131558438; + // aapt resource value: 0x7f0d00ba + public const int bold = 2131558586; + // aapt resource value: 0x7f0d0035 public const int bottom = 2131558453; @@ -4601,6 +4604,9 @@ namespace BookAStar.Droid // aapt resource value: 0x7f0d0055 public const int contentPanel = 2131558485; + // aapt resource value: 0x7f0d00b6 + public const int copy = 2131558582; + // aapt resource value: 0x7f0d005b public const int custom = 2131558491; @@ -4673,6 +4679,15 @@ namespace BookAStar.Droid // aapt resource value: 0x7f0d00b2 public const int fullscreen = 2131558578; + // aapt resource value: 0x7f0d00b7 + public const int group = 2131558583; + + // aapt resource value: 0x7f0d00be + public const int header1 = 2131558590; + + // aapt resource value: 0x7f0d00bf + public const int header2 = 2131558591; + // aapt resource value: 0x7f0d0005 public const int home = 2131558405; @@ -4697,6 +4712,9 @@ namespace BookAStar.Droid // aapt resource value: 0x7f0d00a6 public const int info = 2131558566; + // aapt resource value: 0x7f0d00bb + public const int italic = 2131558587; + // aapt resource value: 0x7f0d0000 public const int item_touch_helper_previous_elevation = 2131558400; @@ -4832,6 +4850,9 @@ namespace BookAStar.Droid // aapt resource value: 0x7f0d0051 public const int parentPanel = 2131558481; + // aapt resource value: 0x7f0d00b8 + public const int past = 2131558584; + // aapt resource value: 0x7f0d00ad public const int pause = 2131558573; @@ -4955,6 +4976,12 @@ namespace BookAStar.Droid // aapt resource value: 0x7f0d009d public const int status_bar_latest_event_content = 2131558557; + // aapt resource value: 0x7f0d00b9 + public const int submenu_character = 2131558585; + + // aapt resource value: 0x7f0d00bd + public const int submenu_paragraph = 2131558589; + // aapt resource value: 0x7f0d0070 public const int submit_area = 2131558512; @@ -5006,6 +5033,9 @@ namespace BookAStar.Droid // aapt resource value: 0x7f0d0078 public const int touch_outside = 2131558520; + // aapt resource value: 0x7f0d00bc + public const int underline = 2131558588; + // aapt resource value: 0x7f0d0009 public const int up = 2131558409; @@ -5319,6 +5349,22 @@ namespace BookAStar.Droid } } + public partial class Menu + { + + // aapt resource value: 0x7f100000 + public const int md_menu = 2131755008; + + static Menu() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Menu() + { + } + } + public partial class Raw { @@ -5425,8 +5471,8 @@ namespace BookAStar.Droid // aapt resource value: 0x7f08006a public const int account_authenticator_label = 2131230826; - // aapt resource value: 0x7f08006b - public const int accounts = 2131230827; + // aapt resource value: 0x7f080074 + public const int accounts = 2131230836; // aapt resource value: 0x7f08005a public const int app_name = 2131230810; @@ -5440,8 +5486,11 @@ namespace BookAStar.Droid // aapt resource value: 0x7f080000 public const int auth_google_play_services_client_google_display_name = 2131230720; - // aapt resource value: 0x7f08006c - public const int bookingstar_accounts_pref_screen_summary = 2131230828; + // aapt resource value: 0x7f08006e + public const int bold = 2131230830; + + // aapt resource value: 0x7f080075 + public const int bookingstar_accounts_pref_screen_summary = 2131230837; // aapt resource value: 0x7f080049 public const int bottom_sheet_behavior = 2131230793; @@ -5449,6 +5498,9 @@ namespace BookAStar.Droid // aapt resource value: 0x7f08005e public const int cancel = 2131230814; + // aapt resource value: 0x7f08006d + public const int character = 2131230829; + // aapt resource value: 0x7f08004a public const int character_counter_pattern = 2131230794; @@ -5539,6 +5591,9 @@ namespace BookAStar.Droid // aapt resource value: 0x7f08001e public const int common_signin_button_text_long = 2131230750; + // aapt resource value: 0x7f08006b + public const int copy = 2131230827; + // aapt resource value: 0x7f080024 public const int create_calendar_message = 2131230756; @@ -5560,9 +5615,18 @@ namespace BookAStar.Droid // aapt resource value: 0x7f080068 public const int google_app_id = 2131230824; + // aapt resource value: 0x7f080072 + public const int header1 = 2131230834; + + // aapt resource value: 0x7f080073 + public const int header2 = 2131230835; + // aapt resource value: 0x7f08004f public const int invalid_date = 2131230799; + // aapt resource value: 0x7f08006f + public const int italic = 2131230831; + // aapt resource value: 0x7f08004d public const int library_name = 2131230797; @@ -5620,6 +5684,12 @@ namespace BookAStar.Droid // aapt resource value: 0x7f080054 public const int overflow = 2131230804; + // aapt resource value: 0x7f080071 + public const int paragraph = 2131230833; + + // aapt resource value: 0x7f08006c + public const int past = 2131230828; + // aapt resource value: 0x7f080055 public const int pause = 2131230805; @@ -5653,6 +5723,9 @@ namespace BookAStar.Droid // aapt resource value: 0x7f080059 public const int time_duration = 2131230809; + // aapt resource value: 0x7f080070 + public const int underline = 2131230832; + // aapt resource value: 0x7f080065 public const int url = 2131230821; diff --git a/BookAStar/BookAStar.Droid/Resources/layout/Tabbar.axml b/BookAStar/BookAStar.Droid/Resources/layout/Tabbar.axml index ad1f87d8..97cb27ad 100644 --- a/BookAStar/BookAStar.Droid/Resources/layout/Tabbar.axml +++ b/BookAStar/BookAStar.Droid/Resources/layout/Tabbar.axml @@ -8,4 +8,4 @@ android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" app:tabIndicatorColor="@android:color/white" app:tabGravity="fill" - app:tabMode="fixed" /> + app:tabMode="fixed" /> \ No newline at end of file diff --git a/BookAStar/BookAStar.Droid/Resources/layout/Toolbar.axml b/BookAStar/BookAStar.Droid/Resources/layout/Toolbar.axml index 5e2b4cbb..fdc40808 100644 --- a/BookAStar/BookAStar.Droid/Resources/layout/Toolbar.axml +++ b/BookAStar/BookAStar.Droid/Resources/layout/Toolbar.axml @@ -7,7 +7,7 @@ android:layout_height="wrap_content" android:background="?attr/colorPrimary" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" - android:popupTheme="@style/ThemeOverlay.AppCompat.Light" + android:popupTheme="@style/ThemeOverlay.AppCompat.Dark" tools:context=".MainActivity" app:layout_scrollFlags="scroll|enterAlways" /> \ No newline at end of file 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 diff --git a/BookAStar/BookAStar/Pages/EstimatePages/BookQueriesPage.xaml.cs b/BookAStar/BookAStar/Pages/EstimatePages/BookQueriesPage.xaml.cs index 2fe06982..909d3ca2 100644 --- a/BookAStar/BookAStar/Pages/EstimatePages/BookQueriesPage.xaml.cs +++ b/BookAStar/BookAStar/Pages/EstimatePages/BookQueriesPage.xaml.cs @@ -14,16 +14,30 @@ namespace BookAStar.Pages public BookQueriesPage() { InitializeComponent(); - var model = new BookQueriesViewModel(); - model.RefreshQueries = - new Command( () => { - DataManager.Instance.BookQueries.Execute(null); - this.list.EndRefresh(); - }); - + BindingContext = new BookQueriesViewModel(); + } + + public BookQueriesPage(BookQueriesViewModel model) + { + InitializeComponent(); BindingContext = model; } + protected override void OnBindingContextChanged() + { + BookQueriesViewModel model = (BookQueriesViewModel) BindingContext; + if (model!=null) + { + model.RefreshQueries = + new Command(() => + { + DataManager.Instance.BookQueries.Execute(null); + this.list.EndRefresh(); + }); + } + base.OnBindingContextChanged(); + } + private void OnViewDetail(object sender, ItemTappedEventArgs e) { var item = e.Item as BookQueryViewModel; diff --git a/BookAStar/BookAStar/Pages/EstimatePages/EstimateSigningPage.xaml b/BookAStar/BookAStar/Pages/EstimatePages/EstimateSigningPage.xaml index 65faecfb..10c56a79 100644 --- a/BookAStar/BookAStar/Pages/EstimatePages/EstimateSigningPage.xaml +++ b/BookAStar/BookAStar/Pages/EstimatePages/EstimateSigningPage.xaml @@ -70,7 +70,7 @@ HorizontalOptions="FillAndExpand" BackgroundColor="White" CaptionText="Caption This" CaptionTextColor="Black" - ClearText="Clear Me!" ClearTextColor="Red" + ClearText="Effacer!" ClearTextColor="Red" PromptText="Prompt Here" PromptTextColor="Red" SignatureLineColor="Aqua" StrokeColor="Black" StrokeWidth="2" />