Merge pull request #2841 from JimWilcox3/develop

Use legacy properties on the Android TimePicker for versions 5.1 and …
This commit is contained in:
Martijn van Dijk 2018-05-07 14:05:35 +02:00 коммит произвёл GitHub
Родитель ba9dee8adc 28f632f73e
Коммит 7b817949e8
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 26 добавлений и 6 удалений

Просмотреть файл

@ -1,9 +1,10 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MS-PL license.
// See the LICENSE file in the project root for more information.
using System;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Util;
using Android.Widget;
@ -39,7 +40,11 @@ namespace MvvmCross.Platforms.Android.Binding.Views
{
get
{
return new TimeSpan(Hour, Minute, 0);
if (Build.VERSION.SdkInt <= BuildVersionCodes.LollipopMr1)
#pragma warning disable CS0618
return new TimeSpan((int)CurrentHour, (int)CurrentMinute, 0);
else
return new TimeSpan(Hour, Minute, 0);
}
set
{
@ -49,13 +54,28 @@ namespace MvvmCross.Platforms.Android.Binding.Views
_initialized = true;
}
if (Hour != value.Hours)
if (Build.VERSION.SdkInt <= BuildVersionCodes.LollipopMr1)
{
Hour = value.Hours;
#pragma warning disable CS0618
if ((int)CurrentHour != value.Hours)
{
CurrentHour = (Java.Lang.Integer)value.Hours;
}
if ((int)CurrentMinute != value.Minutes)
{
CurrentMinute = (Java.Lang.Integer)value.Minutes;
}
}
if (Minute != value.Minutes)
else
{
Minute = value.Minutes;
if (Hour != value.Hours)
{
Hour = value.Hours;
}
if (Minute != value.Minutes)
{
Minute = value.Minutes;
}
}
}
}