Пример #1
0
        bool HandleUIWebLoaderControl(WebView view, string reqUrl)
        {
            //if (navigationType == UIWebViewNavigationType.LinkClicked)
            {
                Uri uri   = new Uri(reqUrl);
                var param = System.Web.HttpUtility.ParseQueryString(uri.Query);

                if (uri.Scheme == "http" || uri.Scheme == "https")
                {
                    if (param["inpPopUp"] != null && (param["inpPopUp"] == "true" || param["inpPopUp"] == "1"))
                    {
                        Browser browser = new Browser();

                        browser.UrlStream = uri.AbsoluteUri;
                        browser.Tipo      = "http";
                        browser.PageFit   = true;

                        Intent i = new Intent();
                        i.SetClass(Application.Context, typeof(BrowserViewScreen));
                        i.PutExtra("url", uri.OriginalString);
                        i.PutExtra("tipo", "http");
                        i.PutExtra("pageFit", true);
                        i.PutExtra("basePath", "");
                        _docView.StartActivity(i);

                        return(true);
                    }
                    if (param["inpExternal"] != null && (param["inpExternal"] == "true" || param["inpExternal"] == "1"))
                    {
                        var intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse(uri.OriginalString));
                        _docView.StartActivity(intent);

                        return(true);
                    }
                }
                else if (uri.Scheme == "inpdo")
                {
                    string action = uri.OriginalString.Split(new[] { '?' })[0];

                    action = action.Replace(uri.Scheme + "://", "");

                    doLinkAction(action, param);

                    return(true);
                }
            }

            return(false);
        }
Пример #2
0
        private void MapOnInfoWindowClick(object sender, GoogleMap.InfoWindowClickEventArgs e)
        {
            Marker marker = e.Marker;

            var placemarks = _Placemarks.Where(x => x["id"] == marker.Id);

            if (placemarks != null && placemarks.Count() > 0)
            {
                var placemark = placemarks.First();

                Intent i = new Intent();
                i.SetClass(Application.Context, typeof(MappaDetailsScreen));

                i.PutExtra("placemark", JsonConvert.SerializeObject(placemark));

                //ActivitiesBringe.SetObject(placemark);

                _docView.StartActivity(i);
            }

            /*string lat = marker.Position.Latitude.ToString().Replace(".", "").Replace(",", ".");
             * string lon = marker.Position.Longitude.ToString().Replace(".", "").Replace(",", ".");
             *
             * Intent intent = new Intent(Intent.ActionView,  Android.Net.Uri.Parse("google.navigation:q=" + lat + "," + lon));
             *
             * StartActivity(intent);*/



            //this.OverridePendingTransition(Resource.Animation.SlideInRight, Resource.Animation.SlideOutLeft);
        }
Пример #3
0
        public VideoView(Context context, Video video, string path, ViewerScreen docView) : base(context)
        {
            _video    = video;
            _basePath = path;
            _docView  = docView;
            //this.SetBackgroundColor(Color.Aqua);

            View.Inflate(this.Context, Resource.Layout.VideoView, this);



            try
            {
                _videoView = FindViewById <Android.Widget.VideoView>(Resource.Id.videoView);
                _btnFull   = FindViewById <ImageButton>(Resource.Id.btnFull);

                if (video.Link != "")
                {
                    if (!File.Exists(System.IO.Path.Combine(_basePath, _video.Link)))
                    {
                        return;
                    }

                    _videoView.SetVideoPath(System.IO.Path.Combine(_basePath, _video.Link));
                }
                else if (_video.UrlStream != "")
                {
                    _videoView.SetVideoURI(Android.Net.Uri.Parse(_video.UrlStream));
                }

                /*MediaController mc = new MediaController(context);
                 * mc.SetMediaPlayer(_videoView);
                 * mc.SetAnchorView(_videoView);
                 *
                 * _videoView.SetMediaController(mc);*/
                _videoView.RequestFocus();
            }
            catch (Exception ex)
            {
                Utils.WriteLog("Errore video", ex.Message);
                return;
            }

            _videoView.Error += (sender, e) =>
            {
                return;
            };

            //playstopclick
            if (this._video.PlayStopClick)
            {
                this.Click += (sender, e) =>
                {
                    this.PlayStop();
                };
            }

            if (_video.Fullscreen)
            {
                _btnFull.Click += (sender, e) =>
                {
                    Intent i = new Intent();
                    i.SetClass(this.Context, typeof(VideoViewScreen));

                    i.PutExtra("path", _basePath);
                    i.PutExtra("video", JsonConvert.SerializeObject(_video));
                    //ActivitiesBringe.SetObject(zoom);
                    this.Stop();
                    docView.StartActivity(i);
                };
            }
            else
            {
                _btnFull.Visibility = ViewStates.Invisible;
            }

            //autoplay
            if (this._video.Autoplay)
            {
                //_videoView.Prepared -= Autoplay;
                //_videoView.Prepared += Autoplay;
                _videoView.Prepared += (sender, e) =>
                {
                    _isReady = true;
                };

                if (_video.Delay > 0)
                {
                    this.Hide();
                    _isReady = true;
                }
            }
            else
            {
                this.Hide();
            }

            //loop
            if (_video.Loop)
            {
                _videoView.Completion += (sender, e) =>
                {
                    _videoView.Start();
                };
            }

            //finish
            _videoView.Completion += (sender, e) =>
            {
                if (OnFinish != null)
                {
                    OnFinish();
                }
            };
        }