sweet home

This commit is contained in:
2017-02-25 17:45:44 +01:00
parent b1973cae5f
commit a0db230603
28 changed files with 569 additions and 168 deletions

View File

@ -53,9 +53,9 @@ namespace ZicMoove.Droid
using Xamarin.Forms;
[Activity(
Name = Constants.ApplicationName+".MainActivity",
Label = Constants.ApplicationLabel,
Theme = "@style/MainTheme",
Name = Constants.ApplicationName + ".MainActivity",
Label = Constants.ApplicationLabel,
Theme = "@style/MainTheme",
Icon = "@drawable/icon",
MainLauncher = true,
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
@ -74,8 +74,8 @@ namespace ZicMoove.Droid
.LanguageOrLocale("fr")
.RememberUser(true)
.AcceptCreditCards(true) // needs card.io
// TODO .MerchantPrivacyPolicyUri(new Uri("http://"))
// TODO .MerchantUserAgreementUri(new Uri("http://"))
// TODO .MerchantPrivacyPolicyUri(new Uri("http://"))
// TODO .MerchantUserAgreementUri(new Uri("http://"))
.ClientId(Constants.PaypalClientId)
.SandboxUserPassword(Constants.PaypalClientSecret)
;
@ -85,7 +85,7 @@ namespace ZicMoove.Droid
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(bundle);
XamSvg.Setup.InitSvgLib();
// FIXME usefull?
SetPersistent(true);
// global::Xamarin.Forms.Forms.SetTitleBarVisibility(Xamarin.Forms.AndroidTitleBarVisibility.Never);
@ -152,7 +152,8 @@ namespace ZicMoove.Droid
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults)
{
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == Constants.AllowBeATarget) {
if (requestCode == Constants.AllowBeATarget)
{
if (grantResults.Length > 0)
{
if (grantResults[0] == Android.Content.PM.Permission.Granted)
@ -279,7 +280,7 @@ namespace ZicMoove.Droid
{
Task.Run(async () =>
{
var query = DataManager.Instance.BookQueries.LocalGet(queryId);
var query = DataManager.Instance.BookQueries.LocalGet(queryId);
App.ShowBookQuery(query);
});
}
@ -315,7 +316,7 @@ namespace ZicMoove.Droid
return manager.FindAccountsForService(Constants.ApplicationLabel);
});
}
public void AddAccount()
{
var auth = new YaOAuth2Authenticator(
@ -392,9 +393,9 @@ namespace ZicMoove.Droid
// TODO handle
}
public T Resolve<T>()
{
@ -441,7 +442,7 @@ namespace ZicMoove.Droid
}
}
public void Pay(double amount, PayMethod method, string name= null )
public void Pay(double amount, PayMethod method, string name = null)
{
if (name == null) name = $"Votre commande {Constants.ApplicationLabel}";
var payment = new PayPalPayment(new BigDecimal(amount), "EUR", "the item",
@ -450,40 +451,40 @@ namespace ZicMoove.Droid
var intent = new Intent(this, typeof(PaymentActivity));
intent.PutExtra(PayPalService.ExtraPaypalConfiguration, config);
intent.PutExtra(PaymentActivity.ExtraPayment, payment);
this.StartActivityForResult(intent, (int) RequestCode.PayImmediate);
this.StartActivityForResult(intent, (int)RequestCode.PayImmediate);
}
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
{
if (requestCode == (int) RequestCode.PayDelayed)
if (resultCode == Result.Ok)
{
var confirm = data.GetParcelableExtra(PaymentActivity.ExtraResultConfirmation);
if (confirm != null)
if (requestCode == (int)RequestCode.PayDelayed)
if (resultCode == Result.Ok)
{
try
var confirm = data.GetParcelableExtra(PaymentActivity.ExtraResultConfirmation);
if (confirm != null)
{
Log.Info("xam.paypal.test", confirm.ToString());
try
{
Log.Info("xam.paypal.test", confirm.ToString());
// TODO: send 'confirm' to your server for verification.
// see https://developer.paypal.com/webapps/developer/docs/integration/mobile/verify-mobile-payment/
// for more details.
// TODO: send 'confirm' to your server for verification.
// see https://developer.paypal.com/webapps/developer/docs/integration/mobile/verify-mobile-payment/
// for more details.
}
catch (JSONException e)
{
Log.Error("xam.paypal.test", "something went really wrong here: ", e);
}
catch (JSONException e)
{
Log.Error("xam.paypal.test", "something went really wrong here: ", e);
}
}
}
}
else if (resultCode == Result.Canceled)
{
Log.Info("xam.paypal.test", "Canceled.");
}
else if ((int)resultCode == PaymentActivity.ResultExtrasInvalid)
{
Log.Info("xam.paypal.test", "Invalid Payment or PayPalConfiguration.");
}
else if (resultCode == Result.Canceled)
{
Log.Info("xam.paypal.test", "Canceled.");
}
else if ((int)resultCode == PaymentActivity.ResultExtrasInvalid)
{
Log.Info("xam.paypal.test", "Invalid Payment or PayPalConfiguration.");
}
}
@ -493,11 +494,61 @@ namespace ZicMoove.Droid
base.OnDestroy();
}
enum RequestCode : int {
enum RequestCode : int
{
PayImmediate = 1,
PayDelayed
}
private static string imagesFolder = null;
public static string ImagesFolder
{
get
{
if (imagesFolder != null) return imagesFolder;
var appData =
System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData);
imagesFolder = System.IO.Path.Combine(appData, Constants.ImagePath);
DirectoryInfo di = new DirectoryInfo(imagesFolder);
if (!di.Exists) di.Create();
return imagesFolder;
}
}
public void UpdateAppImages()
{
var images = ImagesFolder;
using (var client = new HttpClient())
{
client.BaseAddress = new Uri(Constants.YavscHomeUrl);
var targets = DataManager.Instance.Activities.Select(
a => new string[2] { a.Photo, a.Code }
).ToArray();
foreach (var photo in targets)
{
if (photo[0] != null)
{
var streamtask = client.GetStreamAsync(photo[0]);
streamtask.Wait();
if (streamtask.IsCompleted)
{
using (streamtask.Result)
{
FileInfo fi = new FileInfo(Path.Combine(images, $"{photo[1]}.svg"));
using (var ostr = fi.OpenWrite())
{
streamtask.Result.CopyTo(ostr);
}
}
}
}
}
foreach (var act in DataManager.Instance.Activities)
{ act.LocalPhoto = Path.Combine(images, $"{act.Code}.svg"); }
DataManager.Instance.Activities.SaveEntity();
}
}
}
}

View File

@ -67,7 +67,7 @@ namespace ZicMoove.Rendering
_density = Resources.DisplayMetrics.Density;
var targetButton = Control;
if (targetButton != null) targetButton.SetOnTouchListener(TouchListener.Instance.Value);
if (targetButton != null) targetButton.SetOnTouchListener(ImageButtonTouchListener.Instance.Value);
if (Element != null && Element.Font != Font.Default && targetButton != null) targetButton.Typeface = Element.Font.ToExtendedTypeface(Context);
@ -274,14 +274,14 @@ namespace ZicMoove.Rendering
}
//Hot fix for the layout positioning issue on Android as described in http://forums.xamarin.com/discussion/20608/fix-for-button-layout-bug-on-android
class TouchListener : Java.Lang.Object, View.IOnTouchListener
class ImageButtonTouchListener : Java.Lang.Object, View.IOnTouchListener
{
public static readonly Lazy<TouchListener> Instance = new Lazy<TouchListener>(() => new TouchListener());
public static readonly Lazy<ImageButtonTouchListener> Instance = new Lazy<ImageButtonTouchListener>(() => new ImageButtonTouchListener());
/// <summary>
/// Make TouchListener a singleton.
/// </summary>
private TouchListener()
private ImageButtonTouchListener()
{ }
public bool OnTouch(View v, MotionEvent e)

View File

@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Http;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.Graphics;
using Xamarin.Forms;
using ZicMoove.Views;
using XamSvg;
using Xamarin.Forms.Platform.Android;
[assembly: ExportRenderer(typeof(SvgImage), typeof(ZicMoove.Droid.Rendering.SvgRenderer))]
namespace ZicMoove.Droid.Rendering
{
class SvgRenderer : Xamarin.Forms.Platform.Android.AppCompat.ViewRenderer<SvgImage, ImageView>
{
private ImageView view;
private ImageView CreateNativeControl()
{
view = new ImageView(Context);
view.LayoutParameters = new Gallery.LayoutParams(LayoutParams.WrapContent, LayoutParams.FillParent);
return view;
}
protected override void OnElementChanged(ElementChangedEventArgs<SvgImage> e)
{
base.OnElementChanged(e);
if (Control == null)
{
// Init
SetNativeControl(CreateNativeControl());
}
if (e.OldElement != null)
{
// Unsubscribe
}
if (e.NewElement != null) if (e.NewElement.Svg != null)
{
// Subscribe
if (!e.NewElement.Svg.EndsWith(".svg"))
throw new NotSupportedException("Source must end width '.svg'");
var fi = new System.IO.FileInfo(e.NewElement.Svg);
if (fi.Exists)
{
using (var stream = fi.OpenRead())
{
var svg = SvgFactory.GetSvg(System.Threading.CancellationToken.None,
stream);
var drawable = XamSvg.SvgFactory.GetDrawable(svg, XamSvg.Shared.Cross.SvgFillMode.Fill);
view.SetImageDrawable(drawable);
}
}
}
}
}
}

View File

@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.Graphics;
using Android.OS;
using Android.Runtime;
using Android.Util;
using Android.Views;
using Android.Widget;
namespace ZicMoove.Droid.Rendering
{
public class YaSvgImageView : ImageView
{
Bitmap currentBitmap;
public YaSvgImageView(Context context, IAttributeSet attrs) :
base(context, attrs)
{
Initialize();
}
public YaSvgImageView(Context context) : base(context)
{
Initialize();
}
public YaSvgImageView(Context context, IAttributeSet attrs, int defStyle) :
base(context, attrs, defStyle)
{
Initialize();
}
private void Initialize()
{
}
XamSvg.Svg svg;
XamSvg.SvgPictureDrawable drawable;
public void SetSvg(XamSvg.Svg svg)
{
this.svg = svg;
this.drawable = XamSvg.SvgFactory.GetDrawable(svg, XamSvg.Shared.Cross.SvgFillMode.Fill);
this.SetImageDrawable(drawable);
}
}
}

View File

@ -29,6 +29,17 @@ namespace ZicMoove.Droid
global::SQLite.Net.Platform.XamarinAndroid.Resource.String.ApplicationName = global::ZicMoove.Droid.Resource.String.ApplicationName;
global::SQLite.Net.Platform.XamarinAndroid.Resource.String.Hello = global::ZicMoove.Droid.Resource.String.Hello;
global::Xamarin.Forms.Platform.Android.Resource.Attribute.actionBarSize = global::ZicMoove.Droid.Resource.Attribute.actionBarSize;
global::XamSvg.Resource.Attribute.colorMapping = global::ZicMoove.Droid.Resource.Attribute.colorMapping;
global::XamSvg.Resource.Attribute.colorMappingSelected = global::ZicMoove.Droid.Resource.Attribute.colorMappingSelected;
global::XamSvg.Resource.Attribute.loadAsync = global::ZicMoove.Droid.Resource.Attribute.loadAsync;
global::XamSvg.Resource.Attribute.svg = global::ZicMoove.Droid.Resource.Attribute.svg;
global::XamSvg.Resource.Attribute.traceEnabled = global::ZicMoove.Droid.Resource.Attribute.traceEnabled;
global::XamSvg.Resource.Styleable.SvgImageView = global::ZicMoove.Droid.Resource.Styleable.SvgImageView;
global::XamSvg.Resource.Styleable.SvgImageView_colorMapping = global::ZicMoove.Droid.Resource.Styleable.SvgImageView_colorMapping;
global::XamSvg.Resource.Styleable.SvgImageView_colorMappingSelected = global::ZicMoove.Droid.Resource.Styleable.SvgImageView_colorMappingSelected;
global::XamSvg.Resource.Styleable.SvgImageView_loadAsync = global::ZicMoove.Droid.Resource.Styleable.SvgImageView_loadAsync;
global::XamSvg.Resource.Styleable.SvgImageView_svg = global::ZicMoove.Droid.Resource.Styleable.SvgImageView_svg;
global::XamSvg.Resource.Styleable.SvgImageView_traceEnabled = global::ZicMoove.Droid.Resource.Styleable.SvgImageView_traceEnabled;
global::XLabs.Forms.Droid.Resource.Animation.abc_fade_in = global::ZicMoove.Droid.Resource.Animation.abc_fade_in;
global::XLabs.Forms.Droid.Resource.Animation.abc_fade_out = global::ZicMoove.Droid.Resource.Animation.abc_fade_out;
global::XLabs.Forms.Droid.Resource.Animation.abc_grow_fade_in_from_bottom = global::ZicMoove.Droid.Resource.Animation.abc_grow_fade_in_from_bottom;
@ -2229,6 +2240,12 @@ namespace ZicMoove.Droid
// aapt resource value: 0x7f0100b9
public const int colorControlNormal = 2130772153;
// aapt resource value: 0x7f010157
public const int colorMapping = 2130772311;
// aapt resource value: 0x7f010158
public const int colorMappingSelected = 2130772312;
// aapt resource value: 0x7f0100b6
public const int colorPrimary = 2130772150;
@ -2520,6 +2537,9 @@ namespace ZicMoove.Droid
// aapt resource value: 0x7f010006
public const int liteMode = 2130771974;
// aapt resource value: 0x7f01015a
public const int loadAsync = 2130772314;
// aapt resource value: 0x7f01004a
public const int logo = 2130772042;
@ -2760,6 +2780,9 @@ namespace ZicMoove.Droid
// aapt resource value: 0x7f0100f3
public const int suggestionRowLayout = 2130772211;
// aapt resource value: 0x7f010156
public const int svg = 2130772310;
// aapt resource value: 0x7f0100f9
public const int switchMinWidth = 2130772217;
@ -2898,6 +2921,9 @@ namespace ZicMoove.Droid
// aapt resource value: 0x7f01009e
public const int toolbarStyle = 2130772126;
// aapt resource value: 0x7f010159
public const int traceEnabled = 2130772313;
// aapt resource value: 0x7f0100f6
public const int track = 2130772214;
@ -5482,6 +5508,9 @@ namespace ZicMoove.Droid
// aapt resource value: 0x7f070000
public const int gtm_analytics = 2131165184;
// aapt resource value: 0x7f070001
public const int it = 2131165185;
static Raw()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
@ -8523,6 +8552,28 @@ namespace ZicMoove.Droid
// aapt resource value: 4
public const int Spinner_popupTheme = 4;
public static int[] SvgImageView = new int[] {
2130772310,
2130772311,
2130772312,
2130772313,
2130772314};
// aapt resource value: 1
public const int SvgImageView_colorMapping = 1;
// aapt resource value: 2
public const int SvgImageView_colorMappingSelected = 2;
// aapt resource value: 4
public const int SvgImageView_loadAsync = 4;
// aapt resource value: 0
public const int SvgImageView_svg = 0;
// aapt resource value: 3
public const int SvgImageView_traceEnabled = 3;
public static int[] SwitchCompat = new int[] {
16843044,
16843045,

View File

@ -10,7 +10,7 @@
android:layout_height="wrap_content"
android:id="@+id/relativeLayout1" />
<TextView
android:text="Validation de votre solvabilité (le retrait n'est effectué qu'un fois la préstation executée et validée par vos soins)"
android:text="Validation de votre solvabilité (le retrait n'est effectué qu'une fois la préstation executée et validée par vos soins)"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -0,0 +1,156 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.w3.org/2000/svg"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:ns1="http://sozi.baierouge.fr"
xmlns:xlink="http://www.w3.org/1999/xlink"
id="svg2"
sodipodi:docname="mobile phone.svg"
viewBox="0 0 212.6 212.6"
version="1.1"
inkscape:version="0.48.3.1 r9886"
>
<sodipodi:namedview
id="base"
fit-margin-left="0"
inkscape:showpageshadow="false"
inkscape:zoom="0.59451925"
borderopacity="1.0"
inkscape:current-layer="layer1"
inkscape:cx="278.72629"
inkscape:cy="-120.86787"
borderlayer="true"
inkscape:window-maximized="0"
showgrid="false"
fit-margin-right="0"
units="mm"
inkscape:document-units="mm"
bordercolor="#666666"
inkscape:window-x="258"
inkscape:window-y="156"
fit-margin-bottom="0"
inkscape:window-width="676"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
pagecolor="#ffffff"
inkscape:window-height="697"
fit-margin-top="0"
/>
<g
id="layer1"
inkscape:label="Ebene 1"
inkscape:groupmode="layer"
transform="translate(49.578 -405.14)"
>
<path
id="path4240"
style="fill:#939a99"
inkscape:connector-curvature="0"
d="m138.46 518.1c-3.3948 42.183-38.678 75.363-81.735 75.363-24.407 0-46.312-10.671-61.338-27.589 0 0 24.644 3.4644 24.644 3.4644 9.5709 1.3452 18.421-5.3223 19.766-14.894l4.0045-28.501c1.2787-9.0991-4.6893-17.529-13.503-19.498 9.082 0.62988 17.237-5.8496 18.524-15.006l4.0051-28.497c1.3452-9.5715-5.3229-18.422-14.893-19.767 0 0-21.721-3.053-21.721-3.053 11.954-6.8054 25.773-10.712 40.511-10.712 45.303 0 82.028 36.724 82.028 82.026 0 2.1643-0.10988 4.3018-0.27404 6.4233-0.006 0.0794-0.0125 0.15991-0.0182 0.24049zm-157.48 24.854s44.728 6.2854 44.728 6.2854-1.3898 9.8889-1.3898 9.8889-37.839-5.3174-37.839-5.3174c-2.0917-3.4595-3.9294-7.0886-5.4993-10.857zm-4.9982-17.115l7.6074 1.0693s-1.3898 9.8889-1.3898 9.8889-3.6627-0.51513-3.6627-0.51513c-1.076-3.3887-1.9232-6.8787-2.5549-10.443zm1.1762-16.166s14.086 1.98 14.086 1.98-1.3898 9.8889-1.3898 9.8889-14.085-1.98-14.085-1.98l1.3892-9.8889zm37.587 15.367s1.3892-9.8877 1.3892-9.8877 14.086 1.98 14.086 1.98l-1.3898 9.8877s-14.085-1.98-14.085-1.98zm-6.2652 5.3674s14.087 1.98 14.087 1.98l-1.3892 9.8865s-14.086-1.98-14.086-1.98 1.3886-9.8865 1.3886-9.8865zm-5.4022-0.75927l-1.3892 9.8865-14.086-1.9788s1.3898-9.8889 1.3898-9.8889l14.086 1.9812zm-7.821-7.3462l1.3898-9.8901 14.085 1.9812-1.3898 9.8877-14.085-1.9788zm6.5247-71.766s27.39 3.8501 27.39 3.8501l-5.448 38.76s-45.251-6.3611-45.251-6.3611c4.4409-14.11 12.592-26.573 23.31-36.249zm54.942-45.398c-58.707 0-106.3 47.59-106.3 106.3 0 58.708 47.592 106.3 106.3 106.3 58.707 0 106.3-47.59 106.3-106.3 0-58.708-47.592-106.3-106.3-106.3zm35.055 69.49c0.62439-4.4409-0.61524-8.7121-3.1207-12.028l-8.2513 15.372-7.5653 0.23681s-3.985-6.4355-3.985-6.4355l8.3325-15.526c-8.5565-0.7788-16.307 5.2686-17.515 13.868-0.88868 6.3232 2.0111 12.291 6.9556 15.657 0 0-11.881 84.541-11.881 84.541l14.232 1.9983 4.4104-31.383 7.4762-53.196c5.6384-1.8945 10.028-6.814 10.912-13.105zm-6.8634 19.672l12.874 9.9072s3.0158 0.42358 3.0158 0.42358l-7.1362 50.776 14.232 1.9983 7.1362-50.774 8.54 1.2 2.2333-15.885s-25.789-3.6243-25.789-3.6243-15.106 5.9778-15.106 5.9778z"
/>
</g
>
<metadata
>
<rdf:RDF
>
<cc:Work
>
<dc:format
>image/svg+xml</dc:format
>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage"
/>
<cc:license
rdf:resource="http://creativecommons.org/licenses/publicdomain/"
/>
<dc:publisher
>
<cc:Agent
rdf:about="http://openclipart.org/"
>
<dc:title
>Openclipart</dc:title
>
</cc:Agent
>
</dc:publisher
>
<dc:title
>Web 2.0</dc:title
>
<dc:date
>2013-01-18T05:56:20</dc:date
>
<dc:description
>Icon for web 2.0</dc:description
>
<dc:source
>https://openclipart.org/detail/174317/web-2.0-by-fallerton-174317</dc:source
>
<dc:creator
>
<cc:Agent
>
<dc:title
>Fallerton</dc:title
>
</cc:Agent
>
</dc:creator
>
<dc:subject
>
<rdf:Bag
>
<rdf:li
>2.0</rdf:li
>
<rdf:li
>extended</rdf:li
>
<rdf:li
>web</rdf:li
>
<rdf:li
>wide</rdf:li
>
<rdf:li
>world</rdf:li
>
<rdf:li
>www</rdf:li
>
</rdf:Bag
>
</dc:subject
>
</cc:Work
>
<cc:License
rdf:about="http://creativecommons.org/licenses/publicdomain/"
>
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction"
/>
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution"
/>
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks"
/>
</cc:License
>
</rdf:RDF
>
</metadata
>
</svg
>

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -20,10 +20,8 @@ namespace ZicMoove.Droid
static object locker = new object();
public GcmRegistrationIntentService() : base("RegistrationIntentService") {
}
static PowerManager.WakeLock sWakeLock;
static object LOCK = new object();
@ -102,9 +100,9 @@ namespace ZicMoove.Droid
{
var pubSub = GcmPubSub.GetInstance(this);
pubSub.Subscribe(token, "/topics/global", null);
if (MainSettings.CurrentUser.Roles.Contains("Performer"))
///if (MainSettings.CurrentUser.Roles.Contains("Performer"))
// TODO add activity codes in the bundle
pubSub.Subscribe(token, "/topics/jobs", null);
//pubSub.Subscribe(token, "/topics/jobs", null);
// TODO if a Activity is specified,
// and general annonces in this activity are accepted:
// pubSub.Subscribe(token, "/topics/jobs/"+ActivityCode, null);

View File

@ -394,6 +394,14 @@
<HintPath>..\..\packages\Xamarin.PayPal.Android.CardIO.1.0.0\lib\MonoAndroid10\Xamarin.PayPal.Android.CardIO.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="XamSvg.Droid, Version=2.3.2.5, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Softlion.XamSvg.Free.2.3.2.5\lib\MonoAndroid44\XamSvg.Droid.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="XamSvg.Shared, Version=2.3.2.5, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Softlion.XamSvg.Free.2.3.2.5\lib\MonoAndroid44\XamSvg.Shared.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="XLabs.Caching, Version=2.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\XLabs.Caching.2.3.0-pre02\lib\portable-net45+netcore45+wpa81+wp8+monoandroid+monotouch+xamarinios10+xamarinmac\XLabs.Caching.dll</HintPath>
<Private>True</Private>
@ -463,6 +471,8 @@
<Compile Include="Markdown\MDWebView.cs" />
<Compile Include="OAuth2\YaOAuth2Authenticator.cs" />
<Compile Include="Rendering\ImageButtonRenderer.cs" />
<Compile Include="Rendering\YaSvgImageView.cs" />
<Compile Include="Rendering\SvgRenderer.cs" />
<Compile Include="Resources\Resource.Designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SendFileActivity.cs" />
@ -645,6 +655,7 @@
<ItemGroup>
<Content Include="GeofenceAppStarter.txt" />
<Content Include="Helpers\GeofenceService.txt" />
<AndroidResource Include="Resources\raw\it.svg" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

View File

@ -8,6 +8,7 @@
<package id="Plugin.CurrentActivity" version="1.0.1" targetFramework="monoandroid70" />
<package id="Plugin.Permissions" version="1.1.7" targetFramework="monoandroid70" />
<package id="Plugin.Share" version="3.0.1" targetFramework="monoandroid70" />
<package id="Softlion.XamSvg.Free" version="2.3.2.5" targetFramework="monoandroid70" />
<package id="SQLite.Net.Async-PCL" version="3.1.1" targetFramework="monoandroid70" />
<package id="SQLite.Net.Core-PCL" version="3.1.1" targetFramework="monoandroid70" />
<package id="SQLite.Net.Platform.XamarinAndroid" version="2.5.1" targetFramework="monoandroid70" />

View File

@ -379,8 +379,6 @@ namespace ZicMoove
public void SetupHubConnection()
{
if (chatHubConnection != null)
chatHubConnection.Dispose();
chatHubConnection = new HubConnection(Constants.SignalRHubsUrl);
chatHubConnection.Error += ChatHubConnection_Error;
@ -452,9 +450,11 @@ namespace ZicMoove
}
}
public static async Task PostDeviceInfo()
public static async Task<bool> PostDeviceInfo()
{
var info = GetDeviceInfo();
bool updateImages = false;
if (!string.IsNullOrWhiteSpace(info.GCMRegistrationId))
{
if (MainSettings.CurrentUser != null)
@ -479,7 +479,7 @@ namespace ZicMoove
if ((bool)jvalue["UpdateActivities"])
{
DataManager.Instance.Activities.Execute(null);
DataManager.Instance.Activities.SaveEntity();
updateImages = true;
}
}
}
@ -491,7 +491,9 @@ namespace ZicMoove
}
}
}
return (updateImages);
}
public static GCMRegIdDeclaration GetDeviceInfo()
{
var devinfo = CrossDeviceInfo.Current;
@ -511,7 +513,6 @@ namespace ZicMoove
};
}
public static void ShowBookQuery(BookQuery query)
{
var page = new BookQueryPage

View File

@ -28,6 +28,6 @@ namespace ZicMoove
public const string PermissionMapReceive = Constants.ApplicationName + ".permission.MAPS_RECEIVE";
public const string PermissionC2DMessage = Constants.ApplicationName + ".permission.C2D_MESSAGE";
public const string ImagePath = "images";
}
}

View File

@ -3,18 +3,17 @@ using System.Linq;
namespace ZicMoove.Data
{
/// <summary>
/// Use to not try and update any remote data ...
/// TODO implementation ...
/// </summary>
/// <typeparam name="V"></typeparam>
/// <typeparam name="K"></typeparam>
public class RemoteEntityRO<V,K>: RemoteEntity<V,K> where K: IEquatable<K>
{
public RemoteEntityRO (string controllerName,
Func<V,K> getKey) : base(controllerName,getKey)
{
}
public override void Merge(V item)
{
var key = GetKey(item);
if (this.Any(x => GetKey(x).Equals(key))) { return; }
Add(item);
}
}
}

View File

@ -21,6 +21,7 @@ namespace ZicMoove.Interfaces
void Pay(double amount, PayMethod method, string paymentName);
void UpdateAppImages();
}
}

View File

@ -74,5 +74,6 @@ namespace ZicMoove.Model.Workflow
get;
set;
}
public string LocalPhoto { get; set; }
}
}

View File

@ -3,6 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="ZicMoove.Pages.ClientPages.ActivityPage"
xmlns:local="clr-namespace:ZicMoove;assembly=ZicMoove"
xmlns:views="clr-namespace:ZicMoove.Views;assembly=ZicMoove"
>
<CarouselPage.ItemTemplate>
<DataTemplate>
@ -13,22 +14,32 @@
<ScrollView>
<StackLayout>
<Label Text="{Binding Name}" FontSize="Medium" HorizontalOptions="Center" />
<Image Source="{Binding PhotoUri}" Margin="10,10,10,10" HorizontalOptions="Center" VerticalOptions="CenterAndExpand" />
<Label Text="{Binding Descrition}" HorizontalOptions="Center" />
<ListView ItemsSource="{Binding Forms}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout>
<Button Text="{Binding Title}" CommandParameter="{Binding Action}"/>
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<Frame HasShadow="True">
<StackLayout>
<StackLayout Orientation="Horizontal">
<views:SvgImage Svg="{Binding LocalPhoto}" HorizontalOptions="Start" HeightRequest="100" WidthRequest="100"/>
<Label Text="{Binding Name}" FontSize="Medium" HorizontalOptions="Center" />
</StackLayout>
<Label Text="{Binding Description}" HorizontalOptions="Center" />
<ListView ItemsSource="{Binding Forms}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout>
<Button Text="{Binding Title}" CommandParameter="{Binding Action}"/>
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</Frame>
</StackLayout>
</ScrollView>
</ContentPage>

View File

@ -89,7 +89,7 @@
Grid.Row="0" Grid.Column="3"
FontFamily="Monospace"></Label>
<Image Grid.Row="0" Grid.Column="4" Style="{Binding
Path=ViewModelState.IsValid,
Path=ModelState.IsValid,
Converter={StaticResource boolToStyleImage}}" ></Image>
</Grid>
</ViewCell.View>

View File

@ -17,7 +17,7 @@
</ContentPage.Resources>
<ContentPage.Content>
<StackLayout Padding="10,10,10,10" x:Name="mainLayout">
<ScrollView>
<ScrollView VerticalOptions="Start">
<StackLayout>
<Grid MinimumHeightRequest="12">
<Grid.RowDefinitions>
@ -82,11 +82,11 @@
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand"
BackgroundColor="White"
CaptionText="{Binding Data.Owner?.UserName}" CaptionTextColor="Black"
CaptionText="{Binding CaptionText}" CaptionTextColor="Black"
ClearText="Effacer!" ClearTextColor="Red"
PromptText="Prompt Here" PromptTextColor="Red"
SignatureLineColor="Aqua" StrokeColor="Black" StrokeWidth="2" />
<Button Clicked="OnValidate" Text="Valider cette signature" x:Name="btnValidate" />
PromptText="{Binding PromptText}" PromptTextColor="Red"
SignatureLineColor="Green" StrokeColor="Black" StrokeWidth="3" />
<Button Clicked="OnValidate" Text="Valider cette signature" x:Name="btnValidate" VerticalOptions="End" />
</StackLayout>
</ContentPage.Content>

View File

@ -32,21 +32,8 @@ namespace ZicMoove.Pages.EstimatePages
var evm = (EditEstimateViewModel)BindingContext;
var estimate = evm.Data;
using (var stream = await padView.GetImageStreamAsync(SignatureImageFormat.Png))
{
/*
var signatureMemoryStream = pngStream as MemoryStream;
if (signatureMemoryStream == null)
{
signatureMemoryStream = new MemoryStream();
pngStream.CopyTo(signatureMemoryStream);
}
var byteArray = signatureMemoryStream.ToArray();
var base64String = Convert.ToBase64String(byteArray)
*/
stream.Seek(0, SeekOrigin.Begin);
await DataManager.Instance.Estimates.SignAsProvider(estimate, stream);
DataManager.Instance.Estimates.SaveEntity();
@ -60,33 +47,6 @@ namespace ZicMoove.Pages.EstimatePages
}
private async void OnChangeTheme(object sender, EventArgs e)
{
var action = await DisplayActionSheet("Change Theme", "Cancel", null, "White", "Black", "Aqua");
switch (action)
{
case "White":
padView.BackgroundColor = Color.White;
padView.StrokeColor = Color.Black;
padView.ClearTextColor = Color.Black;
padView.ClearText = "Clear Markers";
break;
case "Black":
padView.BackgroundColor = Color.Black;
padView.StrokeColor = Color.White;
padView.ClearTextColor = Color.White;
padView.ClearText = "Clear Chalk";
break;
case "Aqua":
padView.BackgroundColor = Color.Aqua;
padView.StrokeColor = Color.Red;
padView.ClearTextColor = Color.Black;
padView.ClearText = "Clear The Aqua";
break;
}
}
}
}

View File

@ -12,6 +12,7 @@ namespace ZicMoove.Settings
using Model.Social;
using Model.Auth.Account;
using Model.Musical;
using System.Threading.Tasks;
/// <summary>
/// This is the Settings static class that can be used in your Core solution or in any
@ -92,7 +93,13 @@ namespace ZicMoove.Settings
// Inform the server of it.
if (oldregid != value)
{
App.PostDeviceInfo();
var dit = App.PostDeviceInfo();
dit.Wait();
if (dit.IsCompleted)
{
if (dit.Result)
App.PlatformSpecificInstance.UpdateAppImages();
}
}
}
get { return AppSettings.GetValueOrDefault<string>(GoogleRegIdKey); }

View File

@ -187,6 +187,24 @@ namespace ZicMoove {
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Bon pour accord et execution.
/// </summary>
public static string EstimateSigningCaption {
get {
return ResourceManager.GetString("EstimateSigningCaption", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Signez ici.
/// </summary>
public static string EstimateSigningPrompt {
get {
return ResourceManager.GetString("EstimateSigningPrompt", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Star.
/// </summary>

View File

@ -233,4 +233,10 @@
<data name="ProviderContracts" xml:space="preserve">
<value>Contrats fournisseur</value>
</data>
<data name="EstimateSigningCaption" xml:space="preserve">
<value>Bon pour accord et execution</value>
</data>
<data name="EstimateSigningPrompt" xml:space="preserve">
<value>Signez ici</value>
</data>
</root>

View File

@ -64,5 +64,20 @@ namespace ZicMoove.ViewModels.Signing
}
}
}
public string CaptionText
{
get
{
return Strings.EstimateSigningCaption;
}
}
public string PromptText
{
get
{
return Strings.EstimateSigningPrompt;
}
}
}
}

View File

@ -9,9 +9,9 @@
<signature:SignaturePadView x:Name="padView"
HeightRequest="150" WidthRequest="240"
BackgroundColor="White"
CaptionText="Caption This" CaptionTextColor="Black"
ClearText="Efface moi!" ClearTextColor="Red"
PromptText="Prompt Here" PromptTextColor="Red"
CaptionText="{Binding CaptionText}" CaptionTextColor="Black"
ClearText="{Binding ClearText}" ClearTextColor="Red"
PromptText="{Binding PromptText}" PromptTextColor="Red"
SignatureLineColor="Aqua" StrokeColor="Black" StrokeWidth="2" />
<Button Clicked="OnChangeTheme" Text="Changer le Theme" />
<Button Clicked="OnGetStats" Text="Obtenir les stats de la signature " />

View File

@ -11,53 +11,19 @@ namespace ZicMoove.Views
{
public partial class MDSigningView : ContentView
{
public static readonly BindableProperty SignForProperty = BindableProperty.Create(
"SignFor", typeof(string), typeof(MDSigningView), null, BindingMode.OneWay
);
public MDSigningView()
{
InitializeComponent();
}
private async void OnChangeTheme(object sender, EventArgs e)
public string SignFor
{
var action = await App.DisplayActionSheet(
"Change Theme", "Cancel", null,
new string[] { "White", "Black", "Aqua" } );
switch (action)
{
case "White":
padView.BackgroundColor = Color.White;
padView.StrokeColor = Color.Black;
padView.ClearTextColor = Color.Black;
padView.ClearText = "Clear Markers";
break;
case "Black":
padView.BackgroundColor = Color.Black;
padView.StrokeColor = Color.White;
padView.ClearTextColor = Color.White;
padView.ClearText = "Clear Chalk";
break;
case "Aqua":
padView.BackgroundColor = Color.Aqua;
padView.StrokeColor = Color.Red;
padView.ClearTextColor = Color.Black;
padView.ClearText = "Clear The Aqua";
break;
get {
return GetValue(SignForProperty) as string;
}
}
private async void OnGetStats(object sender, EventArgs e)
{
var points = padView.Points.ToArray();
var image = await padView.GetImageStreamAsync(SignatureImageFormat.Png);
var pointCount = points.Count();
var imageSize = image.Length / 1000;
var linesCount = points.Count(p => p == Point.Zero) + (points.Length > 0 ? 1 : 0);
image.Dispose();
await App.DisplayAlert("Stats", $"The signature has {linesCount} lines or {pointCount} points, and is {imageSize:#,###.0}KB (in memory) when saved as a PNG.", "Cool");
}
}
}

View File

@ -0,0 +1,23 @@
using Xamarin.Forms;
namespace ZicMoove.Views
{
public class SvgImage : View
{
public string Svg
{
get
{
return GetValue(SvgProperty) as string;
}
set
{
SetValue(SvgProperty, value);
}
}
public static readonly BindableProperty SvgProperty =
BindableProperty.Create("Svg", typeof(string), typeof(SvgImage),
null, BindingMode.TwoWay);
}
}

View File

@ -277,6 +277,7 @@
<Compile Include="Views\RatingView.xaml.cs">
<DependentUpon>RatingView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\SvgImage.cs" />
<Compile Include="Views\UserListView.xaml.cs">
<DependentUpon>UserListView.xaml</DependentUpon>
</Compile>
@ -389,6 +390,9 @@
<Reference Include="System.Web.Services">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Web.Services.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.Vector.Drawable">
<HintPath>..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Vector.Drawable.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.2.3.2.127\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Core.dll</HintPath>
<Private>True</Private>
@ -409,6 +413,13 @@
<HintPath>..\..\packages\XamForms.Controls.Calendar.1.0.7\lib\portable-net45+wp8+win8+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10+UAP10\XamForms.Controls.Calendar.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="XamSvg.Droid">
<HintPath>..\..\packages\Softlion.XamSvg.Free.2.3.2.5\lib\MonoAndroid44\XamSvg.Droid.dll</HintPath>
</Reference>
<Reference Include="XamSvg.Shared, Version=2.3.2.5, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Softlion.XamSvg.Free.2.3.2.5\lib\portable-win8+net45+wpa81+MonoAndroid44+Xamarin.iOS10\XamSvg.Shared.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="XLabs.Caching, Version=2.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\XLabs.Caching.2.3.0-pre02\lib\portable-net45+netcore45+wpa81+wp8+monoandroid+monotouch+xamarinios10+xamarinmac\XLabs.Caching.dll</HintPath>
<Private>True</Private>

View File

@ -8,6 +8,7 @@
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="portable45-net45+win8+wpa81" />
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="portable45-net45+win8+wpa81" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="portable45-net45+win8+wpa81" />
<package id="Softlion.XamSvg.Free" version="2.3.2.5" targetFramework="portable45-net45+win8+wpa81" />
<package id="SQLite.Net.Core-PCL" version="3.1.1" targetFramework="portable45-net45+win8+wpa81" />
<package id="SQLite.Net-PCL" version="3.1.1" targetFramework="portable45-net45+win8+wpa81" />
<package id="Xam.Plugin.Geofence" version="1.1.2" targetFramework="portable45-net45+win8+wpa81" developmentDependency="true" />