private void InitSwitchers() { _temperatureSwitcher = FindViewById <TextSwitcher>(R.Id.ts_temperature); _temperatureSwitcher.SetFactory(new TextViewFactory(this, R.Style.TemperatureTextView, true)); _temperatureSwitcher.SetCurrentText(_temperatures[0]); _placeSwitcher = FindViewById <TextSwitcher>(R.Id.ts_place); _placeSwitcher.SetFactory(new TextViewFactory(this, R.Style.PlaceTextView, false)); _placeSwitcher.SetCurrentText(_places[0]); _clockSwitcher = FindViewById <TextSwitcher>(R.Id.ts_clock); _clockSwitcher.SetFactory(new TextViewFactory(this, R.Style.ClockTextView, false)); _clockSwitcher.SetCurrentText(_times[0]); _descriptionsSwitcher = FindViewById <TextSwitcher>(R.Id.ts_description); _descriptionsSwitcher.SetInAnimation(this, Android.Resource.Animation.FadeIn); _descriptionsSwitcher.SetOutAnimation(this, Android.Resource.Animation.FadeOut); _descriptionsSwitcher.SetFactory(new TextViewFactory(this, R.Style.DescriptionTextView, false)); _descriptionsSwitcher.SetCurrentText(GetString(_descriptions[0])); _mapSwitcher = FindViewById <ImageSwitcher>(R.Id.ts_map); _mapSwitcher.SetInAnimation(this, R.Animation.fade_in); _mapSwitcher.SetOutAnimation(this, R.Animation.fade_out); _mapSwitcher.SetFactory(new ImageViewFactory(this)); _mapSwitcher.SetImageResource(_maps[0]); _mapLoadListener = new DecodeBitmapTask.Listener( bmp => { (_mapSwitcher.NextView as ImageView)?.SetImageBitmap(bmp); _mapSwitcher.ShowNext(); } ); }
public static void DisplayDiskImage(string imgPath, ImageSwitcher imgSwitch, PointF size = null, bool cache = true) { if (!System.IO.File.Exists(imgPath)) { Utils.WriteLog("Immagine non esistente - " + imgPath); return; } Uri uri = new Uri(imgPath); if (cache) { Java.IO.File cacheFile = ImageLoader.Instance.DiskCache.Get(uri.ToString()); if (cacheFile != null) { Java.IO.File file = new Java.IO.File(imgPath); if (file.LastModified() > cacheFile.LastModified()) { ImageLoader.Instance.DiskCache.Remove(uri.ToString()); } } } var options = new DisplayImageOptions.Builder() .CacheInMemory(false) .CacheOnDisk(cache) .ConsiderExifParams(true) .BitmapConfig(Bitmap.Config.Rgb565) .DelayBeforeLoading(0) .Build(); var targetSize = (size == null) ? null : new ImageSize((int)Math.Round(size.X), (int)Math.Round(size.Y)); //ImageLoader.Instance.DisplayImage(); NonViewAware nonViewAware = new NonViewAware(targetSize, ViewScaleType.FitInside); Action <string, View, Bitmap> loadingComplete = (imageUri, v, loadedImage) => { using (var h = new Handler(Looper.MainLooper)) { h.Post(() => { try { imgSwitch.SetImageDrawable(new BitmapDrawable(loadedImage)); } catch (Exception ex) { Utils.WriteLog("DisplayDiskImage", ex.Message); } }); } }; LoadingListener listener = new LoadingListener(loadingComplete); ImageLoader.Instance.DisplayImage(uri.ToString(), nonViewAware, options, listener); }
private void InitSwitchers(ImageSwitcher imageSwitcher, TextSwitcher textSwitcher) { imageSwitcher.SetFactory(new ViewFactory()); imageSwitcher.SetInAnimation(Activity, anim[0]); imageSwitcher.SetOutAnimation(Activity, anim[1]); imageSwitcher.SetImageResource(Resource.Drawable.driver_pablo); textSwitcher.SetFactory(this); textSwitcher.SetInAnimation(Activity, anim[0]); textSwitcher.SetOutAnimation(Activity, anim[1]); textSwitcher.SetCurrentText(GetString(Resource.String.partner_desc_txt)); }
public void ComputeItems() { if (GraphicController.Selected != null && GraphicController.Selected.Graphic is ImageSwitcher) { imageSelector.Items.Clear(); imageSelector.Items.Add(new KeyValuePair <string, string>("None", string.Empty)); ImageSwitcher imageSwitcher = (ImageSwitcher)GraphicController.Selected.Graphic; foreach (string image in imageSwitcher.Images) { imageSelector.Items.Add(new KeyValuePair <string, string>(Path.GetFileName(image), image)); } imageSelector.SelectedIndex = Array.FindIndex(imageSwitcher.Images, x => x == imageSwitcher.ActiveImage) + 1; } }
private void LoadMultistato() { if (_multistato.Stati.Count() == 0) { return; } _imgSwitcher = new ImageSwitcher(this.Context); _imgSwitcher.SetFactory(this); string imgPath = System.IO.Path.Combine(_basePath, _multistato.Stati[0].Path); MBImageLoader.DisplayDiskImage(imgPath, _imgSwitcher, new PointF(_frame.Width(), _frame.Height())); this.AddView(_imgSwitcher, new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent)); //transizione this.SetAnimation(); //scorrimento temporizzato _changeHandler = new Handler(Looper.MainLooper); _changeRunnable = new Runnable(() => { try { this.NextState(); } finally { _changeHandler.PostDelayed(_changeRunnable, _multistato.Delay); } }); //gesture if (_multistato.Swipe || _multistato.SwipeContinuo || _multistato.ZoomEnabled) { _gestureDetector = new GestureDetector(this.Context, new GestureListener(this)); } //loop this._partialLoop = _multistato.Loop; //autoplay /*if(_multistato.Autoplay) * { * this.Start(); * }*/ this.SetOnClick(); }
private void SetConnectionState(ImageSwitcher connectionStateImageSwitcher, ConnectionState connectionState) { switch (connectionState) { case ConnectionState.Offline: connectionStateImageSwitcher.SetImageResource(Resource.Drawable.OfflineIcon); break; case ConnectionState.Connecting: connectionStateImageSwitcher.SetImageResource(Resource.Drawable.ConnectingIcon); break; case ConnectionState.Online: connectionStateImageSwitcher.SetImageResource(Resource.Drawable.OnlineIcon); break; default: break; } }
private void OnSelectedChanged(object sender, GraphicController selected) { if (selected != null && selected.Graphic is ImageSwitcher) { Visibility = Visibility.Visible; ImageSwitcher imageSwitcher = (ImageSwitcher)GraphicController.Selected.Graphic; folder.Text = imageSwitcher.Folder; if (imageSwitcher.SwitcherImage.Stretch == Stretch.Fill) { fill.IsChecked = true; } else { fit.IsChecked = true; } } else { Visibility = Visibility.Collapsed; } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetCancelable(false); SetContentView(Resource.Layout.Tutorial); _imageAnimation = AnimationUtils.LoadAnimation(Context, Android.Resource.Animation.FadeIn); // load an animation _imageAnimation.Duration = 1000; _imageSwitcher = (ImageSwitcher)FindViewById(Resource.Id.tutorialImageSwitcher); _imageSwitcher.SetOnClickListener(this); _imageSwitcher.SetFactory(this); _checkBoxDontShowAgain = (CheckBox)FindViewById(Resource.Id.checkBoxDontShowAgain); _checkBoxDontShowAgain.SetOnClickListener(this); _hintTextView = (TextView)FindViewById(Resource.Id.tutorialHintText); DisplayPage(_index); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.ticketSwitcher); back = FindViewById<Button> (Resource.Id.buttonback); back.SetOnClickListener (this); string text = Intent.GetStringExtra ("idTicket") ?? "Data not available"; //Toast.MakeText (this, text + " Clicked!", ToastLength.Short).Show (); images = FindViewById<ImageSwitcher> (Resource.Id.imageSwitcher1); images.SetInAnimation(this.ApplicationContext,Android.Resource.Animation.SlideInLeft); images.SetOutAnimation(this.ApplicationContext,Android.Resource.Animation.SlideOutRight); imageIndex = 0; images.SetFactory (this); int i = Convert.ToInt32 (text); images.SetImageResource(imageResources[i%3]); //images.SetOnTouchListener (this); //images.SetImageResource( }