public ScrollerView(Context context, Scroller scroll, string path, ViewerScreen docView, RectF frame, float scale) : base(context) { _Scroller = scroll; _BasePath = path; _DocView = docView; _initFrame = new RectangleF(0, 0, frame.Width() + frame.Left, frame.Height() + frame.Top); _parentFrame = new RectangleF(frame.Left, frame.Top, frame.Width(), frame.Height()); _scale = scale; this.Esclusivo = !_Scroller.MantieniPopUp; this.IsPopUp = _Scroller.PopUp; //HorizontalScrollBarEnabled = true; //VerticalScrollBarEnabled = true; if (!_Scroller.PopUp || (_Scroller.PopUp && _Scroller.Visible)) { LoadContent(); PopUpVisible = true; } this.RequestDisallowInterceptTouchEvent(true); this.ScrollEnabled = _Scroller.Scroll; //this.SetBackgroundColor(Android.Graphics.Color.Green); }
public NotaInlineView(Context context, NotaUtente nota, ViewerScreen docView) : base(context) { _docView = docView; _nota = nota; View.Inflate(this.Context, Resource.Layout.NotaInlineView, this); NoteManager noteMan = new NoteManager(docView.Pubblicazione); noteMan.LoadNota(nota); _txtNota = FindViewById <EditText>(Resource.Id.txtNota); //txtNota.SetBackgroundColor(Color.Red); _txtNota.SetText(nota.Testo, TextView.BufferType.Normal); SetTextStyle(); _docView.ReaderView.OnSingleTap += OnParentTap; _txtNota.TextChanged += delegate { nota.Testo = _txtNota.Text; noteMan.EditNota(nota); }; }
public string Setear(string nombre, string ruta, ViewerScreen _stateManager) { txtBtn.text = nombre; path = ruta; stateManager = _stateManager; Debug.Log(ruta); return(ruta); }
public MultistatoView(Context context, Multistato multi, string path, ViewerScreen doc, RectF frame) : base(context) { _multistato = multi; _basePath = path; _docView = doc; _frame = frame; LoadMultistato(); }
public MuPageAdapter(Context context, FilePicker.IFilePickerSupport filePickerSupport, MuPDFCore core, Documento doc, ViewerScreen docView) : base(context, filePickerSupport, core) { _doc = doc; mCore = core; mContext = context; _docView = docView; _pages = new SparseArray <MuPageView> (); // new MuPageView[core.CountPages()]; mPageSizes = new SparseArray <PointF>(); }
public AudioView(Context context, Audio audio, string path, ViewerScreen docView) : base(context) { _audio = audio; _basePath = path; _docView = docView; _audioView = new Android.Widget.VideoView(context); ViewGroup.LayoutParams param = new ViewGroup.LayoutParams(1, 1); _audioView.LayoutParameters = param; if (!File.Exists(System.IO.Path.Combine(_basePath, _audio.Link))) { return; } _audioView.SetVideoPath(System.IO.Path.Combine(_basePath, _audio.Link)); var time = _audioView.CurrentPosition; this.AddView(_audioView); _audioView.RequestFocus(); //playstopclick if (_audio.PlayStopClick) { this.Click += (sender, e) => { this.PlayStop(); }; } //autoplay if (this._audio.Autoplay) { //_audioView.Prepared -= Autoplay; //_audioView.Prepared += Autoplay; _audioView.Prepared += (sender, e) => { _isReady = true; }; } //loop if (_audio.Loop) { _audioView.Completion += (sender, e) => { _audioView.Start(); }; } }
protected ViewerScreen SpawnAndPlaceViewerScreen() { ViewerScreen vs = (Instantiate(_viewerScreenPrefab.gameObject)).GetComponent <ViewerScreen>(); vs.GetComponent <RectTransform>().SetParent(GetComponent <Transform>(), false); //// calculate and apply offset //float offset = _viewerScreens.Count * _currentCanvas.pixelRect.width * 2.0f; //Vector3 currentPos = Vector3.zero; //vs.GetComponent<RectTransform>().anchoredPosition = new Vector3(currentPos.x + offset, currentPos.y + 80.0f, currentPos.z); vs.GetComponent <RectTransform>().localScale = Vector3.one; return(vs); }
public SliderView(Context context, Slider slider, string path, ViewerScreen doc, RectF frame, float scale) : base(context) { _Slider = slider; _BasePath = path; _DocView = doc; _scale = scale; /*_Slider.PlayStopClick = true; * _Slider.Autoplay = true; * _Slider.Delay = 3000; * _Slider.TransitionDuration = 500;*/ //_Slider.Swipe = true; //autoplay if (_Slider.Autoplay) { _AutoplayTimer = new Timer(_Slider.Delay); _AutoplayTimer.Elapsed += (sender, e) => { _DocView.RunOnUiThread(() => { if (_isRunning) { this.NextState(); } }); }; } //gesture if (_Slider.Swipe || _Slider.PlayStopClick) { _gestureDetector = new GestureDetector(this.Context, new GestureListener(this)); } //scorrimento temporizzato _changeHandler = new Handler(Looper.MainLooper); _changeRunnable = new Runnable(() => { try { this.NextState(); } finally { _changeHandler.PostDelayed(_changeRunnable, _Slider.Delay); } }); LoadContent(); }
public VideoEmbedView(ViewerScreen docView, VideoEmbed video, string path) : base(docView) { this.Settings.JavaScriptEnabled = true; this.Settings.JavaScriptEnabled = true; this.Settings.UseWideViewPort = true; this.Settings.LoadWithOverviewMode = true; this.Settings.JavaScriptCanOpenWindowsAutomatically = true; this.Settings.DomStorageEnabled = true; this.Settings.SetRenderPriority(WebSettings.RenderPriority.High); this.Settings.BuiltInZoomControls = false; this.Settings.AllowFileAccess = true; this.Settings.SetPluginState(WebSettings.PluginState.On); this.SetInitialScale(1); this.SetWebChromeClient(new MyWebClient(docView)); /*string html = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"; * html += "<html xmlns=\"http://www.w3.org/1999/xhtml\">"; * html += "<head>"; * html += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"; * html += "<title>Documento senza titolo</title>"; * html += "<style>"; * html += "html,body {margin:0; padding: 0; height: 100%;}"; * html += "</style>"; * html += "</head>"; * html += "<body>"; * html += "<iframe width='" + "100%" + "' height='" + "100%" + "' src='https://www.youtube.com/embed/" + video.YoutubeID + "' frameborder='0' allowfullscreen></iframe>"; * html += "</body>"; * html += "</html>"; * * //this.LoadData(html, "text/html", "UTF-8");*/ if (video.YoutubeID != "") { this.LoadUrl("https://www.youtube.com/embed/" + video.YoutubeID + "?rel=0"); } else if (video.VimeoID != "") { this.LoadUrl("https://player.vimeo.com/video/" + video.VimeoID); } //this.LoadUrl("https://www.youtube.com/embed/" + video.YoutubeID); //this.LoadUrl("https://player.vimeo.com/video/122786580"); }
public void ChangeScreen(ViewerScreen screen) { for (int i = 0; i < _viewerScreens.Count; ++i) { if (_viewerScreens[i] == screen) { //if(!_viewerScreens[i].gameObject.activeSelf) //{ _viewerScreens[i].Show(); //} _currentViewerScreenPosition = i; } else /*if(_viewerScreens[i].gameObject.activeSelf)*/ { _viewerScreens[i].Hide(); } } }
protected ViewerChangeButton SpawnAndPlaceViewerChangeButton(ViewerScreen associatedScreen, int numberBegin, int numberEnd, int offsetMplier) { ViewerChangeButton vcb = (Instantiate(_viewerChangeButtonPrefab.gameObject)).GetComponent <ViewerChangeButton>(); vcb.Screen = associatedScreen; vcb.ViewerRef = this; vcb.GetComponent <RectTransform>().SetParent(GetComponent <Transform>(), false); float offset = offsetMplier * vcb.GetComponent <RectTransform>().sizeDelta.x; Vector3 currentPos = vcb.GetComponent <RectTransform>().anchoredPosition; currentPos.x -= offset; vcb.GetComponent <RectTransform>().anchoredPosition = currentPos; Text txt = vcb.GetComponentInChildren <Text>(); txt.text = string.Format("{0} - {1}", numberBegin, numberEnd); vcb.AllButtons = _changeButtons; return(vcb); }
public MappaView(Context context, Mappa map, ViewerScreen docView) : base(context) { _mappa = map; _docView = docView; //LoadMap(); GoogleMapOptions mapOptions = new GoogleMapOptions() .InvokeMapType(GoogleMap.MapTypeNormal) .InvokeZoomControlsEnabled(false) .InvokeCompassEnabled(true); _mapView = new MapView(context, mapOptions); this.AddView(_mapView); _mapView.OnCreate(null); _mapView.OnResume(); _googleMap = _mapView.Map; SetupMapIfNeeded(); }
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(); } }; }
public BrowserView(Context context, Browser browser, string path, ViewerScreen docView = null) : base(context) { _browser = browser; _docView = docView; //_Context = context; //this.FocusableInTouchMode = true; //this.Settings.LoadsImagesAutomatically = true; //this.Settings.DomStorageEnabled = true; /*mWebView.getSettings().setUserAgentString("Mozilla/5.0 (Linux; U; Android 2.0; en-us; Droid Build/ESD20) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17"); * mWebView.getSettings().setJavaScriptEnabled(true); * mWebView.getSettings().setPluginsEnabled(true); * mWebView.getSettings().setPluginState(PluginState.ON_DEMAND); * mWebView.getSettings().setAllowFileAccess(true); * mWebView.getSettings().setAppCacheEnabled(true); * mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);*/ //this.Settings.UserAgentString = "Mozilla/5.0 (Linux; U; Android 2.0; en-us; Droid Build/ESD20) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17"; //this.SetInitialScale(1); this.Settings.JavaScriptEnabled = true; this.Settings.DomStorageEnabled = true; this.Settings.SetPluginState(WebSettings.PluginState.OnDemand); this.Settings.AllowFileAccess = true; this.Settings.SetAppCacheEnabled(false); this.Settings.JavaScriptCanOpenWindowsAutomatically = true; this.Settings.DomStorageEnabled = true; this.Settings.SetRenderPriority(WebSettings.RenderPriority.High); this.SetBackgroundColor(Android.Graphics.Color.Transparent); this.ScrollBarStyle = ScrollbarStyles.OutsideOverlay; this.Settings.LoadWithOverviewMode = browser.PageFit; this.Settings.UseWideViewPort = browser.PageFit; this.Settings.BuiltInZoomControls = browser.PageFit; this.Settings.DisplayZoomControls = false; this.VerticalScrollBarEnabled = !_browser.ScrollDisable; this.HorizontalScrollBarEnabled = !_browser.ScrollDisable; this.SetWebChromeClient(new WebChromeClient()); this.Settings.AllowUniversalAccessFromFileURLs = true; LoadingWebViewClient webClient = new LoadingWebViewClient(context); /*webClient.OnStart = () => { * this.ShowLoadingOverlay(); * };*/ webClient.OnComplete = () => { this.HideLoadingOverlay(); }; webClient.OverrideUrlLoading = HandleUIWebLoaderControl; /*webClient.OverrideUrlLoading = (WebView view, string reqUrl) => * { * if (reqUrl.Contains("applink://")) * { * reqUrl = reqUrl.Replace("applink://", ""); * var reqParts = reqUrl.Split('?'); * * var action = reqParts[0]; * * if(context is ViewerScreen) * { * var docView = context as ViewerScreen; * docView.OpenPopUp(new string[] { "crediti" }); * } * * return true; * } * * return false; * };*/ this.SetWebViewClient(webClient); string url; bool overlay = true; if (this._browser.Tipo == "embed") { string html = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"; html += "<html xmlns=\"http://www.w3.org/1999/xhtml\">"; html += "<head>"; html += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"; //html += "<meta name=\"viewport\" content=\"initial-scale=1\">"; html += "<title>Documento senza titolo</title>"; html += "<style>"; html += "html,body {margin:0; padding: 0; height: 100%;}"; html += "</style>"; html += "</head>"; html += "<body>"; html += this._browser.HTML; html += "</body>"; html += "</html>"; this.LoadData(html, "text/html", "UTF-8"); } else if (_browser.Tipo == "gif") { //this.Settings.LoadWithOverviewMode = true; //this.Settings.UseWideViewPort = true; string pa = Path.GetFullPath(Path.Combine(path, System.Web.HttpUtility.UrlDecode(this._browser.UrlStream))); FileInfo fi = new FileInfo(pa); string html = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"; html += "<html xmlns=\"http://www.w3.org/1999/xhtml\">"; html += "<head>"; html += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"; //html += "<meta name=\"viewport\" content=\"initial-scale=0.5\" />"; html += "<title>Documento senza titolo</title>"; html += "<style>"; html += "html,body {margin:0; padding: 0; height: 100%;}"; html += "</style>"; html += "</head>"; html += "<body>"; html += "<img width='100%' src='" + fi.Name + "'/>"; html += "</body>"; html += "</html>"; this.LoadDataWithBaseURL("file:///" + fi.Directory.FullName + "/", html, "text/html", "UTF-8", null); overlay = false; } else if (_browser.Tipo == "web" && _browser.UrlStream.EndsWith(".mp4")) { string html = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"; html += "<html xmlns=\"http://www.w3.org/1999/xhtml\">"; html += "<head>"; html += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"; //html += "<meta name=\"viewport\" content=\"initial-scale=0.5\" />"; html += "<title>Documento senza titolo</title>"; html += "<style>"; html += "html,body {margin:0; padding: 0; height: 100%;}"; html += "</style>"; html += "</head>"; html += "<body>"; html += "<video controls autoplay width='100%' height='100%' src='" + _browser.UrlStream + "'></video>"; html += "</body>"; html += "</html>"; this.LoadData(html, "text/html", "UTF-8"); } else { if (_browser.Tipo == "htm") { string pa = Path.GetFullPath(Path.Combine(path, System.Web.HttpUtility.UrlDecode(this._browser.UrlStream))); url = "file://" + pa; } else if (this._browser.Tipo == "pdf") { string pa = Path.GetFullPath(Path.Combine(path, System.Web.HttpUtility.UrlDecode(this._browser.UrlStream))); if ((int)Android.OS.Build.VERSION.SdkInt < 19) { url = "javascript:void(0);"; } else { if (_browser.Fullscreen) { url = string.Format("file:///android_asset/pdfjs/web/viewer.html?file={0}#0", pa); } else { this.SetInitialScale(1); url = string.Format("file:///android_asset/pdfjs/web/viewer_nobarre.html?file={0}#0", pa); } } } else { if (this._browser.UrlStream.Contains("http://maps")) { //url = "http://maps.google.com/maps?q="+mostRecentLocation.Latitude+","+mostRecentLocation.Longitude; // url = "http://maps.google.com/maps?q=47.404376,8.601478"; url = this._browser.UrlStream.Replace("&output=embed", "").Replace("&output=svembed", ""); } else { url = this._browser.UrlStream; } overlay = true; } if (this._browser.Autostart) { this.LoadUrl(url); if (overlay) { this.ShowLoadingOverlay(); } } } }
public MyWebClient(ViewerScreen docView) { _docView = docView; }
// Use this for initialization void Start() { _fullscreenImage.Initialize(_resources); _fullscreenImage.gameObject.SetActive(false); int maxImagesPerScreen = ViewerScreen.MAX_BUTTONS_PER_LINE * ViewerScreen.MAX_BUTTON_LINES; ViewerScreen vs = SpawnAndPlaceViewerScreen(); int totalImgsCount = 0; int wideImgCounter = 0; List <ImageMiniaturePair> tempImages = new List <ImageMiniaturePair>(); for (int i = 0; i < _resources.Count; ++i) { tempImages.Add(_resources[i]); ++totalImgsCount; if (_resources[i].IsWide) { // it is wide miniature ++wideImgCounter; } if (wideImgCounter >= 2) { wideImgCounter = 0; ++totalImgsCount; } if (totalImgsCount >= maxImagesPerScreen) { wideImgCounter = 0; totalImgsCount = 0; vs.Initialize(tempImages, _fullscreenImage); tempImages.Clear(); _viewerScreens.Add(vs); vs = SpawnAndPlaceViewerScreen(); } } if (totalImgsCount <= maxImagesPerScreen) { _viewerScreens.Add(vs); vs.Initialize(tempImages, _fullscreenImage); } if (_viewerScreens.Count > 1) { for (int i = 1; i < _viewerScreens.Count; ++i) { _viewerScreens[i].gameObject.SetActive(false); } } // create button for each viewer screen for (int i = 0; i < _viewerScreens.Count; ++i) { int offset = _viewerScreens.Count - i - 1; int numberFirst = 0, numberLast = 0; if (i > 0) { for (int j = i - 1; j >= 0; --j) { numberFirst += _viewerScreens[j].GetButtonCount(); } ++numberFirst; } else { numberFirst = 1; } numberLast = numberFirst + _viewerScreens[i].GetButtonCount() - 1; ViewerChangeButton vcb = SpawnAndPlaceViewerChangeButton(_viewerScreens[i], numberFirst, numberLast, offset); vcb.ColorCurrent = _color; _changeButtons.Add(vcb); } _changeButtons[0].MakeCurrent(); }
public MuPageView(Context c, FilePicker.IFilePickerSupport filePickerSupport, MuPDFCore muPdfCore, Point parentSize, Bitmap sharedHqBm, Documento doc, ViewerScreen docView) : base(c, filePickerSupport, muPdfCore, parentSize, sharedHqBm) { _documento = doc; //_parentSize = parentSize; _docView = docView; }