Class MobileUILayout

    • Constructor Detail

      • MobileUILayout

        public MobileUILayout​(@Nonnull UIViewController viewController,
                              @Nonnull io.nevernull.mobileui.LayoutConfig layoutConfig)
        Constructs a MobileUI layout with a LayoutConfig that determines the layout resource and binding context.
        Parameters:
        viewController - the view controller
        layoutConfig - the layout config
        Since:
        0.4.0
      • MobileUILayout

        public MobileUILayout​(@Nonnull UIViewController viewController,
                              @Nonnull String layoutResource)
        Creates a layout from the given XML-resource without binding context. This can be used for completely static layouts.
        Parameters:
        viewController - the UIViewController giving the lifecycle events for a possible LifecycleAware bindingContext
        layoutResource - path of the MobileUI layout within the assets folder
      • MobileUILayout

        public MobileUILayout​(@Nonnull UIViewController viewController,
                              @Nonnull String layoutResource,
                              boolean bindToTestObject)
        Creates a layout for a given XML-resource and optionally binds to the testObject that is embedded within the layout XML file.
        Parameters:
        viewController - the UIViewController giving the lifecycle events for a possible LifecycleAware bindingContext
        layoutResource - path of the MobileUI layout within the assets folder
        bindToTestObject - flag to enable testObject-binding
      • MobileUILayout

        public MobileUILayout​(@Nonnull UIViewController viewController,
                              @Nonnull String layoutResource,
                              @Nonnull Object bindingContext)
        Creates a layout from the given XML-resource binding to the given bindingContext using the given as source for lifecycle events. The bindingContext can be any object that implements the properties and methods used in the layout file.
        Parameters:
        viewController - the UIViewController giving the lifecycle events for a possible LifecycleAware bindingContext
        layoutResource - path of the MobileUI layout within the assets folder
        bindingContext - object to use as bindingContext for the given layout
    • Method Detail

      • removeFromController

        public void removeFromController()
      • didMoveToWindow

        public void didMoveToWindow()
        Internal API
        Overrides:
        didMoveToWindow in class UIView
      • onResourceUpdate

        public void onResourceUpdate​(String absoluteResourceName)
        Internal API
        Specified by:
        onResourceUpdate in interface io.nevernull.mobileui.core.ResourceUpdateListener
        Parameters:
        absoluteResourceName - internal
      • triggerReload

        public void triggerReload()
      • firePropertyChanged

        public void firePropertyChanged​(@Nonnull String... properties)
        Fire a property change for this layout and bindingContext.
        Specified by:
        firePropertyChanged in interface io.nevernull.mobileui.core.PropertyFireListener
        Parameters:
        properties - list of property names that have been changed
      • getNativeView

        public <T extends UIView> @Nullable T getNativeView​(String id)
        Returns the UIView that is the delegate of the View carrying the given ID. The ID has been given in the XML file with the id attribute.
        Type Parameters:
        T - This implementation will automatically cast to the return type. Please be aware, that the internal implementation of MobileUI might possibly change, leading to ClassCastException.
        Parameters:
        id - ID as given in the XML file (id attribute)
        Returns:
        the UIView belonging to the View that is marked with the ID or null.
        Throws:
        ClassCastException - if you try to assign the result to a wrong type.
      • onTemplateVariableChanged

        public void onTemplateVariableChanged()
        Specified by:
        onTemplateVariableChanged in interface io.nevernull.mobileui.core.TemplateVariableChangeListener