Bug Fixes & Layout
This commit is contained in:
parent
84a4b04122
commit
6a211566d3
11 changed files with 181 additions and 92 deletions
|
|
@ -297,6 +297,7 @@ namespace XLabs.Forms
|
||||||
|
|
||||||
base.OnStop();
|
base.OnStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -334,8 +335,10 @@ namespace XLabs.Forms
|
||||||
this.AppContext.Stop += (o, e) => this.OnClosing();
|
this.AppContext.Stop += (o, e) => this.OnClosing();
|
||||||
this.AppContext.Pause += (o, e) => this.OnSuspended();
|
this.AppContext.Pause += (o, e) => this.OnSuspended();
|
||||||
this.AppContext.Resume += (o, e) => this.OnResumed();
|
this.AppContext.Resume += (o, e) => this.OnResumed();
|
||||||
|
|
||||||
this.AppDataDirectory = Environment.ExternalStorageDirectory.AbsolutePath;
|
this.AppDataDirectory = Environment.ExternalStorageDirectory.AbsolutePath;
|
||||||
|
this.Orientation = AppContext.RequestedOrientation == Android.Content.PM.ScreenOrientation.Portrait ?
|
||||||
|
Enums.Orientation.Portrait : Enums.Orientation.None;
|
||||||
if (initServices)
|
if (initServices)
|
||||||
{
|
{
|
||||||
DependencyService.Register<TextToSpeechService>();
|
DependencyService.Register<TextToSpeechService>();
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,8 @@ namespace BookAStar.Droid
|
||||||
ToolbarResource = Resource.Layout.Toolbar;
|
ToolbarResource = Resource.Layout.Toolbar;
|
||||||
|
|
||||||
base.OnCreate(bundle);
|
base.OnCreate(bundle);
|
||||||
|
SetPersistent(true);
|
||||||
global::Xamarin.Forms.Forms.SetTitleBarVisibility(Xamarin.Forms.AndroidTitleBarVisibility.Never);
|
// global::Xamarin.Forms.Forms.SetTitleBarVisibility(Xamarin.Forms.AndroidTitleBarVisibility.Never);
|
||||||
|
|
||||||
//var tb = FindViewById<Android.Support.V7.Widget.Toolbar>(ToolbarResource);
|
//var tb = FindViewById<Android.Support.V7.Widget.Toolbar>(ToolbarResource);
|
||||||
// FIXME tb is null
|
// FIXME tb is null
|
||||||
|
|
@ -73,7 +73,8 @@ namespace BookAStar.Droid
|
||||||
IXFormsApp<XFormsCompatApplicationDroid> app =null;
|
IXFormsApp<XFormsCompatApplicationDroid> app =null;
|
||||||
if (!Resolver.IsSet)
|
if (!Resolver.IsSet)
|
||||||
{
|
{
|
||||||
this.SetIoc();
|
var xfapp = new XFormsCompatAppDroid();
|
||||||
|
this.SetIoc(xfapp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -93,8 +94,8 @@ namespace BookAStar.Droid
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var fapp = new BookAStar.App(this);
|
||||||
LoadApplication(new BookAStar.App(this));
|
LoadApplication(fapp);
|
||||||
// TabLayoutResource = Resource.Layout.Tabbar;
|
// TabLayoutResource = Resource.Layout.Tabbar;
|
||||||
// ToolbarResource = Resource.Layout.Toolbar;
|
// ToolbarResource = Resource.Layout.Toolbar;
|
||||||
/*
|
/*
|
||||||
|
|
@ -108,11 +109,10 @@ namespace BookAStar.Droid
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetIoc()
|
private SimpleContainer SetIoc(XFormsCompatAppDroid app)
|
||||||
{
|
{
|
||||||
var resolverContainer = new SimpleContainer();
|
var resolverContainer = new SimpleContainer();
|
||||||
|
|
||||||
var app = new XFormsCompatAppDroid();
|
|
||||||
|
|
||||||
app.Init(this);
|
app.Init(this);
|
||||||
|
|
||||||
|
|
@ -133,6 +133,7 @@ namespace BookAStar.Droid
|
||||||
t => new SQLiteSimpleCache(new SQLitePlatformAndroid(),
|
t => new SQLiteSimpleCache(new SQLitePlatformAndroid(),
|
||||||
new SQLiteConnectionString(pathToDatabase, true), t.Resolve<IJsonSerializer>()));
|
new SQLiteConnectionString(pathToDatabase, true), t.Resolve<IJsonSerializer>()));
|
||||||
Resolver.SetResolver(resolverContainer.GetResolver());
|
Resolver.SetResolver(resolverContainer.GetResolver());
|
||||||
|
return resolverContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool EnablePushNotifications(bool enable)
|
public bool EnablePushNotifications(bool enable)
|
||||||
|
|
@ -425,18 +426,25 @@ namespace BookAStar.Droid
|
||||||
|
|
||||||
public T Resolve<T>()
|
public T Resolve<T>()
|
||||||
{
|
{
|
||||||
|
return (T) Resolver.Resolve(typeof(T));
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public object Resolve(Type t)
|
public object Resolve(Type t)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
return Resolver.Resolve(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Init(App context, bool initServices = true)
|
protected override void OnSaveInstanceState(Bundle outState)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
base.OnSaveInstanceState(outState);
|
||||||
|
}
|
||||||
|
public override void OnStateNotSaved()
|
||||||
|
{
|
||||||
|
base.OnStateNotSaved();
|
||||||
|
}
|
||||||
|
public override void OnRestoreInstanceState(Bundle savedInstanceState, PersistableBundle persistentState)
|
||||||
|
{
|
||||||
|
base.OnRestoreInstanceState(savedInstanceState, persistentState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ using BookAStar.Droid;
|
||||||
using System;
|
using System;
|
||||||
using Java.Interop;
|
using Java.Interop;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using Android.Views;
|
||||||
|
|
||||||
[assembly: Xamarin.Forms.ExportRenderer(typeof(MarkdownView), typeof(MarkdownViewRenderer))]
|
[assembly: Xamarin.Forms.ExportRenderer(typeof(MarkdownView), typeof(MarkdownViewRenderer))]
|
||||||
namespace BookAStar.Droid
|
namespace BookAStar.Droid
|
||||||
|
|
@ -27,9 +28,13 @@ namespace BookAStar.Droid
|
||||||
|
|
||||||
if (hybridWebViewRenderer != null && hybridWebViewRenderer.TryGetTarget(out hybridRenderer))
|
if (hybridWebViewRenderer != null && hybridWebViewRenderer.TryGetTarget(out hybridRenderer))
|
||||||
{
|
{
|
||||||
hybridRenderer.Element.Markdown=data;
|
hybridRenderer.Element.Markdown = data;
|
||||||
|
MarkdownViewRenderer.OnPageFinished(hybridRenderer.Element,
|
||||||
|
hybridRenderer.EditorView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MarkdownViewRenderer : ViewRenderer<MarkdownView, WebView>
|
public class MarkdownViewRenderer : ViewRenderer<MarkdownView, WebView>
|
||||||
|
|
@ -39,12 +44,30 @@ namespace BookAStar.Droid
|
||||||
private MarkdownDeep.Markdown markdown = new MarkdownDeep.Markdown();
|
private MarkdownDeep.Markdown markdown = new MarkdownDeep.Markdown();
|
||||||
const string JavaScriptFunction = "function invokeCSharpAction(data){jsBridge.invokeAction(data);}";
|
const string JavaScriptFunction = "function invokeCSharpAction(data){jsBridge.invokeAction(data);}";
|
||||||
|
|
||||||
|
public WebView EditorView
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return editorView;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async void OnPageFinished(MarkdownView xview, WebView view)
|
||||||
|
{
|
||||||
|
int i = 10;
|
||||||
|
while (view.ContentHeight == 0 && i-- > 0) // wait here till content is rendered
|
||||||
|
await System.Threading.Tasks.Task.Delay(100);
|
||||||
|
xview.BatchBegin();
|
||||||
|
xview.HeightRequest = view.ContentHeight;
|
||||||
|
xview.BatchCommit();
|
||||||
|
}
|
||||||
private void SetMDEditorText(string text)
|
private void SetMDEditorText(string text)
|
||||||
{
|
{
|
||||||
editorTemplate.Model = (text == null) ? null : markdown.Transform(text);
|
editorTemplate.Model = (text == null) ? null : markdown.Transform(text);
|
||||||
var html = editorTemplate.GenerateString();
|
var html = editorTemplate.GenerateString();
|
||||||
editorView.LoadDataWithBaseURL("file:///android_asset/",
|
EditorView.LoadDataWithBaseURL("file:///android_asset/",
|
||||||
html, "text/html", "utf-8", null);
|
html, "text/html", "utf-8", null);
|
||||||
|
OnPageFinished(Element, editorView);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnElementChanged(ElementChangedEventArgs<MarkdownView> e)
|
protected override void OnElementChanged(ElementChangedEventArgs<MarkdownView> e)
|
||||||
|
|
@ -63,7 +86,7 @@ namespace BookAStar.Droid
|
||||||
// Subscribe
|
// Subscribe
|
||||||
var viewclient = new MarkdownWebViewClient(
|
var viewclient = new MarkdownWebViewClient(
|
||||||
md => { e.NewElement.Markdown = md; });
|
md => { e.NewElement.Markdown = md; });
|
||||||
editorView.SetWebViewClient(viewclient);
|
EditorView.SetWebViewClient(viewclient);
|
||||||
Control.AddJavascriptInterface(new JSBridge(this), "jsBridge");
|
Control.AddJavascriptInterface(new JSBridge(this), "jsBridge");
|
||||||
SetMDEditorText(e.NewElement.Markdown);
|
SetMDEditorText(e.NewElement.Markdown);
|
||||||
InjectJS(JavaScriptFunction);
|
InjectJS(JavaScriptFunction);
|
||||||
|
|
@ -81,33 +104,40 @@ namespace BookAStar.Droid
|
||||||
private WebView CreateNativeControl()
|
private WebView CreateNativeControl()
|
||||||
{
|
{
|
||||||
editorView = new WebView(Context);
|
editorView = new WebView(Context);
|
||||||
editorView.Settings.BuiltInZoomControls = true;
|
EditorView.Settings.BuiltInZoomControls = false;
|
||||||
editorView.Settings.JavaScriptEnabled = true;
|
EditorView.Settings.JavaScriptEnabled = true;
|
||||||
editorView.Settings.LoadsImagesAutomatically = true;
|
EditorView.Settings.LoadsImagesAutomatically = true;
|
||||||
editorView.Settings.SetAppCacheEnabled(true);
|
EditorView.Settings.SetAppCacheEnabled(true);
|
||||||
editorView.Settings.AllowContentAccess = true;
|
EditorView.Settings.AllowContentAccess = true;
|
||||||
editorView.Settings.AllowFileAccess = true;
|
EditorView.Settings.AllowFileAccess = true;
|
||||||
editorView.Settings.AllowFileAccessFromFileURLs = true;
|
EditorView.Settings.AllowFileAccessFromFileURLs = true;
|
||||||
editorView.Settings.AllowUniversalAccessFromFileURLs = true;
|
EditorView.Settings.AllowUniversalAccessFromFileURLs = true;
|
||||||
editorView.Settings.BlockNetworkImage = false;
|
EditorView.Settings.BlockNetworkImage = false;
|
||||||
editorView.Settings.BlockNetworkLoads = false;
|
EditorView.Settings.BlockNetworkLoads = false;
|
||||||
editorView.Settings.DomStorageEnabled = true;
|
EditorView.Settings.DomStorageEnabled = true;
|
||||||
|
|
||||||
// editorView.SetMinimumHeight(300);
|
// editorView.SetMinimumHeight(300);
|
||||||
return editorView;
|
return EditorView;
|
||||||
}
|
}
|
||||||
|
// FIXME no impact...
|
||||||
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.PropertyName == "Markdown")
|
|
||||||
{
|
|
||||||
SetMDEditorText(((MarkdownView)Element).Markdown);
|
|
||||||
}
|
|
||||||
base.OnElementPropertyChanged(sender, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec)
|
protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec)
|
||||||
{
|
{
|
||||||
base.OnMeasure(widthMeasureSpec, editorView.ContentHeight);
|
MeasureSpecMode widthMode = MeasureSpec.GetMode(widthMeasureSpec);
|
||||||
|
MeasureSpecMode heightMode = MeasureSpec.GetMode(heightMeasureSpec);
|
||||||
|
int widthSize = MeasureSpec.GetSize(widthMeasureSpec);
|
||||||
|
int heightSize = MeasureSpec.GetSize(heightMeasureSpec);
|
||||||
|
int pxHeight = (int)ContextExtensions.ToPixels(Context, Element.HeightRequest);
|
||||||
|
int pxWidth = (int)ContextExtensions.ToPixels(Context, Element.WidthRequest);
|
||||||
|
var measuredWidth = widthMode != MeasureSpecMode.Exactly ? (widthMode != MeasureSpecMode.AtMost ? pxHeight : Math.Min(pxHeight, widthSize)) : widthSize;
|
||||||
|
var measuredHeight = heightMode != MeasureSpecMode.Exactly ? (heightMode != MeasureSpecMode.AtMost ? pxWidth : Math.Min(pxWidth, heightSize)) : heightSize;
|
||||||
|
SetMeasuredDimension(measuredWidth, measuredHeight< Element.HeightRequest ? (int) Element.HeightRequest : measuredHeight);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
protected override void OnLayout(bool changed, int left, int top, int right, int bottom)
|
||||||
|
{
|
||||||
|
Element.Layout(new Xamarin.Forms.Rectangle(0, 0, ContextExtensions.FromPixels(Context, right - left), ContextExtensions.FromPixels(Context, bottom - top)));
|
||||||
|
base.OnLayout(changed, left, top, right, bottom);
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4952,8 +4952,8 @@ namespace BookAStar.Droid
|
||||||
// aapt resource value: 0x7f0c00b3
|
// aapt resource value: 0x7f0c00b3
|
||||||
public const int subtitles = 2131493043;
|
public const int subtitles = 2131493043;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0c00b6
|
// aapt resource value: 0x7f0c00b5
|
||||||
public const int surface_view = 2131493046;
|
public const int surface_view = 2131493045;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0c0019
|
// aapt resource value: 0x7f0c0019
|
||||||
public const int tabMode = 2131492889;
|
public const int tabMode = 2131492889;
|
||||||
|
|
@ -4985,9 +4985,6 @@ namespace BookAStar.Droid
|
||||||
// aapt resource value: 0x7f0c0053
|
// aapt resource value: 0x7f0c0053
|
||||||
public const int title_template = 2131492947;
|
public const int title_template = 2131492947;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0c00b5
|
|
||||||
public const int toolbar = 2131493045;
|
|
||||||
|
|
||||||
// aapt resource value: 0x7f0c003d
|
// aapt resource value: 0x7f0c003d
|
||||||
public const int top = 2131492925;
|
public const int top = 2131492925;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,13 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
|
<android.support.v7.widget.Toolbar
|
||||||
android:id="@+id/toolbar"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/colorPrimary"
|
android:background="?attr/colorPrimary"
|
||||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||||
android:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
|
android:popupTheme="@style/ThemeOverlay.AppCompat.Light"
|
||||||
|
tools:context=".MainActivity"
|
||||||
|
app:layout_scrollFlags="scroll|enterAlways"
|
||||||
|
/>
|
||||||
|
|
@ -1,14 +1,8 @@
|
||||||
using BookAStar.Helpers;
|
using BookAStar.Interfaces;
|
||||||
using BookAStar.Interfaces;
|
|
||||||
using BookAStar.Model;
|
using BookAStar.Model;
|
||||||
using BookAStar.Model.Workflow;
|
|
||||||
using BookAStar.Pages;
|
using BookAStar.Pages;
|
||||||
using BookAStar.ViewModels;
|
using BookAStar.ViewModels;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
using XLabs.Forms.Mvvm;
|
using XLabs.Forms.Mvvm;
|
||||||
using XLabs.Forms.Pages;
|
using XLabs.Forms.Pages;
|
||||||
|
|
@ -17,6 +11,8 @@ using XLabs.Ioc;
|
||||||
using XLabs.Platform.Mvvm;
|
using XLabs.Platform.Mvvm;
|
||||||
using XLabs.Platform.Services;
|
using XLabs.Platform.Services;
|
||||||
using XLabs.Settings;
|
using XLabs.Settings;
|
||||||
|
using XLabs;
|
||||||
|
using XLabs.Enums;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Glyphish icons from
|
Glyphish icons from
|
||||||
|
|
@ -56,14 +52,59 @@ namespace BookAStar
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Configure(app);
|
Configure(app);
|
||||||
app.Closing += (o, e) => Debug.WriteLine("Application Closing");
|
app.Closing += OnClosing;
|
||||||
app.Error += (o, e) => Debug.WriteLine("Application Error");
|
app.Error += OnError;
|
||||||
app.Initialize += (o, e) => Debug.WriteLine("Application Initialized");
|
app.Initialize += OnInitialize;
|
||||||
app.Resumed += (o, e) => Debug.WriteLine("Application Resumed");
|
app.Resumed += OnAppResumed;
|
||||||
app.Rotation += (o, e) => Debug.WriteLine("Application Rotated");
|
app.Rotation += OnRotation;
|
||||||
app.Startup += (o, e) => Debug.WriteLine("Application Startup");
|
app.Startup += OnStartup;
|
||||||
app.Suspended += (o, e) => Debug.WriteLine("Application Suspended");
|
app.Suspended += OnSuspended;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// omg
|
||||||
|
private void OnError(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called on rotation after OnSuspended
|
||||||
|
private void OnClosing(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME Not called
|
||||||
|
private void OnInitialize(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// called on app startup, not on rotation
|
||||||
|
private void OnStartup(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// TODO special starup pages as
|
||||||
|
// notification details or wizard setup page
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called on rotation
|
||||||
|
private void OnSuspended(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// TODO the navigation stack persistence (save)
|
||||||
|
}
|
||||||
|
|
||||||
|
// called on app startup, after OnStartup, not on rotation
|
||||||
|
private void OnAppResumed(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// TODO the navigation stack persistence (restore)
|
||||||
|
base.OnResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME Not called ... see OnSuspended
|
||||||
|
private void OnRotation(object sender, EventArgs<Orientation> e)
|
||||||
|
{
|
||||||
|
// TODO the navigation stack persistence (restore?)
|
||||||
|
}
|
||||||
|
|
||||||
public static GenericConfigSettingsMgr ConfigManager { protected set; get; }
|
public static GenericConfigSettingsMgr ConfigManager { protected set; get; }
|
||||||
|
|
||||||
private void Configure(IXFormsApp app)
|
private void Configure(IXFormsApp app)
|
||||||
|
|
@ -84,13 +125,19 @@ namespace BookAStar
|
||||||
|
|
||||||
public App(IPlatform instance)
|
public App(IPlatform instance)
|
||||||
{
|
{
|
||||||
|
// This declaration became obsolete by introduction
|
||||||
|
// of the XLabs App that
|
||||||
|
// refers this instance with
|
||||||
|
// its application context property
|
||||||
|
// and is obtained using the `Resolver`
|
||||||
PlatformSpecificInstance = instance;
|
PlatformSpecificInstance = instance;
|
||||||
|
// Xaml
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
// Static properties construction
|
||||||
Init();
|
Init();
|
||||||
|
// Builds the Main page
|
||||||
BuildMainPage();
|
BuildMainPage();
|
||||||
|
|
||||||
NavigationPage.SetHasNavigationBar(MainPage, false);
|
|
||||||
NavigationPage.SetHasBackButton(MainPage, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BookQueriesPage bQueriesPage;
|
BookQueriesPage bQueriesPage;
|
||||||
|
|
@ -149,13 +196,11 @@ namespace BookAStar
|
||||||
navPage.ToolbarItems.Add(tiSetts);
|
navPage.ToolbarItems.Add(tiSetts);
|
||||||
*/
|
*/
|
||||||
this.MainPage = masterDetail;
|
this.MainPage = masterDetail;
|
||||||
|
|
||||||
Resolver.Resolve<IDependencyContainer>()
|
Resolver.Resolve<IDependencyContainer>()
|
||||||
.Register<INavigationService>(t => new NavigationService(masterDetail.Detail.Navigation))
|
.Register<INavigationService>(t => new NavigationService(masterDetail.Detail.Navigation))
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void PostDeviceInfo()
|
public void PostDeviceInfo()
|
||||||
{
|
{
|
||||||
var res = PlatformSpecificInstance.InvokeApi(
|
var res = PlatformSpecificInstance.InvokeApi(
|
||||||
|
|
@ -171,7 +216,7 @@ namespace BookAStar
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO système de persistance de l'état de l'appli
|
// TODO système de persistance de l'état de l'appli
|
||||||
|
/*
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shows a page asynchronously by locating the default constructor, creating the page,
|
/// Shows a page asynchronously by locating the default constructor, creating the page,
|
||||||
/// the pushing it onto the navigation stack.
|
/// the pushing it onto the navigation stack.
|
||||||
|
|
@ -192,7 +237,7 @@ namespace BookAStar
|
||||||
await parentPage.Navigation.PushAsync(page);
|
await parentPage.Navigation.PushAsync(page);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using BookAStar.Helpers;
|
using BookAStar.Helpers;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
|
@ -80,6 +81,7 @@ namespace BookAStar.Model.Auth.Account
|
||||||
OnPropertyChanged("Avatar");
|
OnPropertyChanged("Avatar");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
[JsonIgnore]
|
||||||
public ImageSource AvatarSource
|
public ImageSource AvatarSource
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@
|
||||||
<ListView.ItemTemplate HeightRequest="60" VerticalOptions="StartAndExpand">
|
<ListView.ItemTemplate HeightRequest="60" VerticalOptions="StartAndExpand">
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<ViewCell>
|
<ViewCell>
|
||||||
<lc:GesturesContentView>
|
|
||||||
<Grid Padding="5"
|
<Grid Padding="5"
|
||||||
ColumnSpacing="10"
|
ColumnSpacing="10"
|
||||||
RowSpacing="2" >
|
RowSpacing="2" >
|
||||||
|
|
@ -34,12 +33,6 @@
|
||||||
|
|
||||||
</Label>
|
</Label>
|
||||||
</Grid>
|
</Grid>
|
||||||
<lb:Gestures.Interests>
|
|
||||||
<lb:GestureCollection>
|
|
||||||
<lb:GestureInterest GestureType="Swipe" Direction="Left" GestureCommand="{Binding DumpParam}" GestureParameter="{Binding UserName}"/>
|
|
||||||
</lb:GestureCollection>
|
|
||||||
</lb:Gestures.Interests>
|
|
||||||
</lc:GesturesContentView>
|
|
||||||
</ViewCell>
|
</ViewCell>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListView.ItemTemplate>
|
</ListView.ItemTemplate>
|
||||||
|
|
|
||||||
|
|
@ -15,18 +15,20 @@
|
||||||
</Style>
|
</Style>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</ContentPage.Resources>
|
</ContentPage.Resources>
|
||||||
|
<ScrollView>
|
||||||
<StackLayout Padding="10,10,10,10">
|
<StackLayout Padding="10,10,10,10">
|
||||||
<StackLayout Orientation="Horizontal" Padding="10,10,10,10">
|
<StackLayout Orientation="Horizontal" Padding="10,10,10,10" View.VerticalOptions="CenterAndExpand">
|
||||||
<Label Text="{Binding Client.UserName}" LineBreakMode="WordWrap"></Label>
|
<Label Text="{Binding Client.UserName}" LineBreakMode="WordWrap" View.VerticalOptions="CenterAndExpand"></Label>
|
||||||
<Label Text="{Binding Query.Location.Address}" LineBreakMode="WordWrap"></Label>
|
<Label Text="{Binding Query.Location.Address}" LineBreakMode="WordWrap" View.VerticalOptions="CenterAndExpand"></Label>
|
||||||
<Label Text="{Binding Query.EventDate, StringFormat='{0:dddd d MMMM yyyy à hh:mm}'}" LineBreakMode="WordWrap"></Label>
|
<Label Text="{Binding Query.EventDate, StringFormat='{0:dddd d MMMM yyyy à hh:mm}'}" LineBreakMode="WordWrap" View.VerticalOptions="CenterAndExpand"></Label>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
|
|
||||||
<views:MarkdownView x:Name="mdview"
|
<views:MarkdownView x:Name="mdview"
|
||||||
Edited="OnDescriptionChanged"
|
Modified="OnDescriptionChanged"
|
||||||
HorizontalOptions="FillAndExpand"
|
HorizontalOptions="FillAndExpand"
|
||||||
VerticalOptions="FillAndExpand" MinimumHeightRequest="160" HeightRequest="250"
|
View.VerticalOptions="CenterAndExpand"
|
||||||
Markdown="{Binding Description, Mode=TwoWay}"
|
Markdown="{Binding Description, Mode=TwoWay}"
|
||||||
|
MinimumHeightRequest="160"
|
||||||
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent,
|
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent,
|
||||||
Property=Height,
|
Property=Height,
|
||||||
Factor=.6}"
|
Factor=.6}"
|
||||||
|
|
@ -35,8 +37,7 @@
|
||||||
Factor=1}"
|
Factor=1}"
|
||||||
></views:MarkdownView>
|
></views:MarkdownView>
|
||||||
|
|
||||||
<ListView RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=.2}"
|
<ListView HeightRequest="80" View.VerticalOptions="End">
|
||||||
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}">
|
|
||||||
<ListView.ItemTemplate>
|
<ListView.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<ViewCell>
|
<ViewCell>
|
||||||
|
|
@ -50,4 +51,5 @@
|
||||||
<Label FormattedText="{Binding FormattedTotal}"/>
|
<Label FormattedText="{Binding FormattedTotal}"/>
|
||||||
<Button Text="Valider ce devis"></Button>
|
<Button Text="Valider ce devis"></Button>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
|
</ScrollView>
|
||||||
</ContentPage>
|
</ContentPage>
|
||||||
|
|
@ -9,6 +9,7 @@ using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
using Xamarin.Forms.Internals;
|
||||||
using XLabs.Forms.Services;
|
using XLabs.Forms.Services;
|
||||||
using XLabs.Ioc;
|
using XLabs.Ioc;
|
||||||
using XLabs.Platform.Services;
|
using XLabs.Platform.Services;
|
||||||
|
|
@ -28,14 +29,16 @@ namespace BookAStar.Pages
|
||||||
{
|
{
|
||||||
base.OnBindingContextChanged();
|
base.OnBindingContextChanged();
|
||||||
// FIXME WAZA
|
// FIXME WAZA
|
||||||
if (BindingContext != null)
|
if (BindingContext != null) {
|
||||||
mdview.Markdown = ((EstimateViewModel)BindingContext).Description;
|
mdview.Markdown = ((EstimateViewModel)BindingContext).Description;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void OnDescriptionChanged (object sender, EventArgs e)
|
protected void OnDescriptionChanged (object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// FIXME Why the Binding don't work?
|
// FIXME Why the Binding don't work?
|
||||||
((EstimateViewModel)BindingContext).Description = mdview.Markdown;
|
((EstimateViewModel)BindingContext).Description = mdview.Markdown;
|
||||||
|
InvalidateMeasure();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void OnNewCommanLine(object sender, EventArgs e)
|
protected void OnNewCommanLine(object sender, EventArgs e)
|
||||||
|
|
@ -43,7 +46,7 @@ namespace BookAStar.Pages
|
||||||
var com = new BillingLine();
|
var com = new BillingLine();
|
||||||
Resolver.Resolve<INavigationService>().NavigateTo<EditBillingLinePage>(
|
Resolver.Resolve<INavigationService>().NavigateTo<EditBillingLinePage>(
|
||||||
true,
|
true,
|
||||||
new object[] { new BillingLineViewModel((Estimate)this.BindingContext,com) } );
|
new object[] { new BillingLineViewModel(((EstimateViewModel)this.BindingContext).Data,com) } );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,20 +23,21 @@ namespace BookAStar.Views
|
||||||
{
|
{
|
||||||
return markdown;
|
return markdown;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
if (markdown != value)
|
if (markdown != value)
|
||||||
if (Edited != null)
|
{
|
||||||
|
markdown = value;
|
||||||
|
if (Modified != null)
|
||||||
{
|
{
|
||||||
markdown = value;
|
Modified.Invoke(this, new EventArgs());
|
||||||
Edited.Invoke(this, new EventArgs());
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
markdown = value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public event EventHandler<EventArgs> Edited;
|
public event EventHandler<EventArgs> Modified;
|
||||||
|
|
||||||
protected override SizeRequest OnMeasure(double widthConstraint, double heightConstraint)
|
protected override SizeRequest OnMeasure(double widthConstraint, double heightConstraint)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue