maui-linux/Xamarin.Forms.Material.Android/MaterialProgressBarRenderer.cs

172 строки
4.8 KiB
C#
Исходник Обычный вид История

Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
#if __ANDROID_28__
using System;
using System.ComponentModel;
using Android.Content;
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
using Android.Support.V4.View;
using Android.Views;
using Xamarin.Forms;
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
using Xamarin.Forms.Platform.Android.FastRenderers;
using Xamarin.Forms.Material.Android;
using AProgressBar = Android.Widget.ProgressBar;
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
using AView = Android.Views.View;
using Xamarin.Forms.Platform.Android;
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
namespace Xamarin.Forms.Material.Android
{
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
public class MaterialProgressBarRenderer : AProgressBar,
IVisualElementRenderer, IViewRenderer, ITabStop
{
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
const int MaximumValue = 10000;
int? _defaultLabelFor;
bool _disposed;
ProgressBar _element;
VisualElementTracker _visualElementTracker;
VisualElementRenderer _visualElementRenderer;
MotionEventHelper _motionEventHelper;
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
public MaterialProgressBarRenderer(Context context)
: base(MaterialContextThemeWrapper.Create(context), null, Resource.Attribute.materialProgressBarHorizontalStyle)
{
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
Indeterminate = false;
Max = MaximumValue;
_visualElementRenderer = new VisualElementRenderer(this);
_motionEventHelper = new MotionEventHelper();
}
public override bool OnTouchEvent(MotionEvent e)
{
if (_visualElementRenderer.OnTouchEvent(e) || base.OnTouchEvent(e))
return true;
return _motionEventHelper.HandleMotionEvent(Parent, e);
}
public event EventHandler<VisualElementChangedEventArgs> ElementChanged;
public event EventHandler<PropertyChangedEventArgs> ElementPropertyChanged;
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
protected AProgressBar Control => this;
protected ProgressBar Element
{
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
get { return _element; }
set
{
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
if (_element == value)
return;
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
var oldElement = _element;
_element = value;
OnElementChanged(new ElementChangedEventArgs<ProgressBar>(oldElement, _element));
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
_element?.SendViewInitialized(this);
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
_motionEventHelper.UpdateElement(_element);
}
}
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
protected override void Dispose(bool disposing)
{
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
if (_disposed)
return;
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
_disposed = true;
if (disposing)
{
_visualElementTracker?.Dispose();
_visualElementTracker = null;
_visualElementRenderer?.Dispose();
_visualElementRenderer = null;
if (Element != null)
{
Element.PropertyChanged -= OnElementPropertyChanged;
if (Platform.Android.Platform.GetRenderer(Element) == this)
Element.ClearValue(Platform.Android.Platform.RendererProperty);
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
}
}
base.Dispose(disposing);
}
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
protected virtual void OnElementChanged(ElementChangedEventArgs<ProgressBar> e)
{
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
ElementChanged?.Invoke(this, new VisualElementChangedEventArgs(e.OldElement, e.NewElement));
if (e.OldElement != null)
{
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
e.OldElement.PropertyChanged -= OnElementPropertyChanged;
}
if (e.NewElement != null)
{
this.EnsureId();
if (_visualElementTracker == null)
_visualElementTracker = new VisualElementTracker(this);
e.NewElement.PropertyChanged += OnElementPropertyChanged;
UpdateProgress();
UpdateColors();
ElevationHelper.SetElevation(this, e.NewElement);
}
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
}
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
protected virtual void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
ElementPropertyChanged?.Invoke(this, e);
if (e.PropertyName == ProgressBar.ProgressProperty.PropertyName)
UpdateProgress();
else if (e.PropertyName == ProgressBar.ProgressColorProperty.PropertyName || e.PropertyName == VisualElement.BackgroundColorProperty.PropertyName)
UpdateColors();
}
void UpdateColors()
{
if (Element == null || Control == null)
return;
this.ApplyProgressBarColors(Element.ProgressColor, Element.BackgroundColor);
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
}
void UpdateProgress() => Control.Progress = (int)(Element.Progress * MaximumValue);
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
// IVisualElementRenderer
VisualElement IVisualElementRenderer.Element => Element;
VisualElementTracker IVisualElementRenderer.Tracker => _visualElementTracker;
ViewGroup IVisualElementRenderer.ViewGroup => null;
AView IVisualElementRenderer.View => this;
void IVisualElementRenderer.SetElement(VisualElement element) =>
Element = (element as ProgressBar) ?? throw new ArgumentException("Element must be of type ProgressBar.");
void IVisualElementRenderer.UpdateLayout() =>
_visualElementTracker?.UpdateLayout();
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
SizeRequest IVisualElementRenderer.GetDesiredSize(int widthConstraint, int heightConstraint)
{
Measure(widthConstraint, heightConstraint);
return new SizeRequest(new Size(Control.MeasuredWidth, Context.ToPixels(4)), new Size(Context.ToPixels(4), Context.ToPixels(4)));
}
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
void IVisualElementRenderer.SetLabelFor(int? id)
{
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
if (_defaultLabelFor == null)
_defaultLabelFor = ViewCompat.GetLabelFor(this);
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
ViewCompat.SetLabelFor(this, (int)(id ?? _defaultLabelFor));
}
Material Design Renderers for the Material Visual (#4733) * Use the auto-generated constants * [Visual] Work on the Material Frame * Improving the code for the sample * Added a controller to help with frames that have additional padding - Android MaterialCardView does not use the default padding to determine where the content starts, rather it uses the content padding of the view because there is a border that does not affect the content * [Visual] Added a few extra checks on Android to reduce unnecessary interop * [Visual] A few more frame changes and some button tweaks * [Visual] use the themers on iOS and save default properties * [Visual] Add placeholders for themer and cache defaults * [Visual] Added the material slider for iOS - Android does not have a custom control, so uses the existing renderer * [enhancements] Move from duplicate LoadImageAsync code to GetNativeImageAsync * [visual] Updated the controls to use the new iOS bits * [visual] some fixes for material components * [visual] Added hacks for material alerts * [visual] removing the alert changes for the main branch * [visual] Update the MaterialComponents NuGet * [visual] Rework the theming/customization of Material controls on iOS * [visual] fix the places where the user colors were being changed * [visual] Improve the ColorStateList management for Android * [visual] Re-implemented the Android ProgressBar as a fast, material renderer * Material Entry * [visual] Add Android ActivityIndicator * filter out material layouts for 8.1 * remove folder * fix __ANDROID_28__ * MaterialContextThemeWrapper * [visual] remove the `IFrameController` interface * [visual] reverting the changes to the Frame layout * [visual] reverting whitespace * [visual] make sure to raise both property changed * formatting changes * fixing colors on android to match with ios themes * Update Xamarin.Forms.Platform.Android/Material/MaterialButtonRenderer.cs Co-Authored-By: mattleibow <mattleibow@live.com> * fix sizing of entry with infinite width size request * update to release 28 of support * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Platform.Android/Resources/values/styles.xml Co-Authored-By: PureWeen <shane94@hotmail.com> * PR Comment changes
2019-01-08 03:07:50 +03:00
// IViewRenderer
void IViewRenderer.MeasureExactly() =>
ViewRenderer.MeasureExactly(this, Element, Context);
// ITabStop
AView ITabStop.TabStop => this;
}
}
#endif