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

30 строки
745 B
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 Android.Content;
using Android.Views;
using Xamarin.Forms.Platform.Android;
using AndroidAppCompat = Android.Support.V7.Content.Res.AppCompatResources;
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 MaterialContextThemeWrapper : ContextThemeWrapper
{
public MaterialContextThemeWrapper(Context context) : this(context, Resource.Style.XamarinFormsMaterialTheme)
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
{
}
MaterialContextThemeWrapper(Context context, int themeResId) : base(context, themeResId)
{
}
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 static MaterialContextThemeWrapper Create(Context context)
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 (context is MaterialContextThemeWrapper materialContext)
return materialContext;
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
return new MaterialContextThemeWrapper(context);
}
}
}
#endif