Example #1
0
    /// <summary>
    /// Sets the web view invisible from screen.
    /// </summary>
    /// <param name="fade">Whether hide with a fade in animation. Default is `false`.</param>
    /// <param name="edge">The edge from which the web view hiding. It simulates a modal effect when hiding a web view. Default is `UniWebViewTransitionEdge.None`.</param>
    /// <param name="duration">Duration of hiding animation. Default is `0.4f`.</param>
    /// <param name="completionHandler">Completion handler which will be called when hiding finishes. Default is `null`.</param>
    /// <returns>A bool value indicates whether the hiding operation started.</returns>
    public bool Hide(bool fade      = false, UniWebViewTransitionEdge edge = UniWebViewTransitionEdge.None,
                     float duration = 0.4f, Action completionHandler       = null)
    {
        var identifier  = Guid.NewGuid().ToString();
        var hideStarted = UniWebViewInterface.Hide(listener.Name, fade, (int)edge, duration, identifier);

        if (hideStarted && completionHandler != null)
        {
            var hasAnimation = (fade || edge != UniWebViewTransitionEdge.None);
            if (hasAnimation)
            {
                actions.Add(identifier, completionHandler);
            }
            else
            {
                completionHandler();
            }
        }
        if (hideStarted && useToolbar)
        {
            var top = (toolbarPosition == UniWebViewToolbarPosition.Top);
            SetShowToolbar(false, false, top, fullScreen);
        }
        return(hideStarted);
    }
Example #2
0
        /// <summary>
        /// Hides the webview window.
        /// </summary>
        public void Hide()
        {
#if UNIWEBVIEW3_SUPPORTED
            UniWebViewInterface.Hide(listener.Name, false, 0, 0f, string.Empty);
#elif UNIWEBVIEW2_SUPPORTED
            UniWebViewPlugin.Hide(listener.Name, false, 0, 0f);
#else
            WWebViewPlugin.Hide(listener.Name, false, 0, 0f);
#endif
        }
Example #3
0
    /// <summary>
    /// Sets the web view invisible from screen.
    /// </summary>
    /// <param name="fade">Whether hide with a fade in animation. Default is `false`.</param>
    /// <param name="edge">The edge from which the web view hiding. It simulates a modal effect when hiding a web view. Default is `UniWebViewTransitionEdge.None`.</param>
    /// <param name="duration">Duration of hiding animation. Default is `0.4f`.</param>
    /// <param name="completionHandler">Completion handler which will be called when hiding finishes. Default is `null`.</param>
    /// <returns>A bool value indicates whether the hiding operation started.</returns>
    public bool Hide(bool fade      = false, UniWebViewTransitionEdge edge = UniWebViewTransitionEdge.None,
                     float duration = 0.4f, Action completionHandler       = null)
    {
        var identifier  = Guid.NewGuid().ToString();
        var hideStarted = UniWebViewInterface.Hide(listener.Name, fade, (int)edge, duration, identifier);

        if (hideStarted && completionHandler != null)
        {
            actions.Add(identifier, completionHandler);
        }
        return(hideStarted);
    }