зеркало из https://github.com/jsuarezruiz/HotUI.git
Fixed a crash on android
This commit is contained in:
Родитель
87742eac9b
Коммит
5633dbddda
|
@ -82,10 +82,12 @@ namespace HotUI.Android.Handlers
|
||||||
foreach (var child in children)
|
foreach (var child in children)
|
||||||
{
|
{
|
||||||
var cview = child.ToView();
|
var cview = child.ToView();
|
||||||
|
if (cview != null)
|
||||||
|
{
|
||||||
views.Add(cview);
|
views.Add(cview);
|
||||||
//cview.ContentMode = UIViewContentMode.Top;
|
|
||||||
base.AddView(cview);
|
base.AddView(cview);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -6,32 +6,39 @@ namespace HotUI.Android
|
||||||
{
|
{
|
||||||
public static class UI
|
public static class UI
|
||||||
{
|
{
|
||||||
static bool hasInit;
|
static bool _hasInitialized;
|
||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
if (hasInit)
|
if (_hasInitialized) return;
|
||||||
return;
|
_hasInitialized = true;
|
||||||
hasInit = true;
|
|
||||||
|
// Controls
|
||||||
Registrar.Handlers.Register<Button, ButtonHandler>();
|
Registrar.Handlers.Register<Button, ButtonHandler>();
|
||||||
Registrar.Handlers.Register<Toggle, ToggleHandler>();
|
Registrar.Handlers.Register<Image, ImageHandler>();
|
||||||
Registrar.Handlers.Register<TextField, TextFieldHandler>();
|
Registrar.Handlers.Register<TextField, TextFieldHandler>();
|
||||||
Registrar.Handlers.Register<Text, TextHandler>();
|
Registrar.Handlers.Register<Text, TextHandler>();
|
||||||
Registrar.Handlers.Register<VStack, VStackHandler>();
|
Registrar.Handlers.Register<Toggle, ToggleHandler>();
|
||||||
Registrar.Handlers.Register<HStack, HStackHandler>();
|
|
||||||
//Registrar.Handlers.Register<WebView, WebViewHandler> ();
|
//Registrar.Handlers.Register<WebView, WebViewHandler> ();
|
||||||
|
|
||||||
|
// Containers
|
||||||
Registrar.Handlers.Register<ScrollView, ScrollViewHandler>();
|
Registrar.Handlers.Register<ScrollView, ScrollViewHandler>();
|
||||||
Registrar.Handlers.Register<Image, ImageHandler> ();
|
|
||||||
Registrar.Handlers.Register<ListView, ListViewHandler> ();
|
Registrar.Handlers.Register<ListView, ListViewHandler> ();
|
||||||
Registrar.Handlers.Register<View, ViewHandler>();
|
Registrar.Handlers.Register<View, ViewHandler>();
|
||||||
Registrar.Handlers.Register<ContentView, ContentViewHandler>();
|
Registrar.Handlers.Register<ContentView, ContentViewHandler>();
|
||||||
Registrar.Handlers.Register<ViewRepresentable, ViewRepresentableHandler>();
|
Registrar.Handlers.Register<ViewRepresentable, ViewRepresentableHandler>();
|
||||||
|
|
||||||
Device.PerformInvokeOnMainThread = (a) => AndroidContext.CurrentContext.RunOnUiThread(a);
|
// Native Layouts
|
||||||
Device.GraphicsService = new AndroidGraphicsService();
|
Registrar.Handlers.Register<HStack, HStackHandler>();
|
||||||
|
Registrar.Handlers.Register<VStack, VStackHandler>();
|
||||||
|
|
||||||
|
// Modal SUpport
|
||||||
ModalView.PerformPresent = ModalManager.ShowModal;
|
ModalView.PerformPresent = ModalManager.ShowModal;
|
||||||
ModalView.PerformDismiss = ModalManager.DismisModal;
|
ModalView.PerformDismiss = ModalManager.DismisModal;
|
||||||
|
|
||||||
|
// Device Services
|
||||||
|
Device.PerformInvokeOnMainThread = (a) => AndroidContext.CurrentContext.RunOnUiThread(a);
|
||||||
|
Device.GraphicsService = new AndroidGraphicsService();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Загрузка…
Ссылка в новой задаче