Esempio n. 1
0
 protected override void OnElementChanged(ElementChangedEventArgs <Image> e)
 {
     base.OnElementChanged(e);
     if (Control != null && e.NewElement != null && e.OldElement == null)
     {
         _portableControl = e.NewElement as CustomImageView;
         _portableControl.PropertyChanged += _portableControl_PropertyChanged;
     }
 }
Esempio n. 2
0
        public ViewHelper(Activity activity, View view)
        {
            mView     = view;
            mActivity = activity;

            Icon            = mView.FindViewById <TextView>(Resource.Id.icon);
            ImageFilterName = mView.FindViewById <TextView>(Resource.Id.filterName);
            Image           = mView.FindViewById <CustomImageView>(Resource.Id.image);

            Icon.Typeface = Typeface.CreateFromAsset(mActivity.Assets, "kinepolis.ttf");

            mProgressbar = mView.FindViewById <ProgressBar>(Resource.Id.progressbar);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Activity_Camera);

            btnCamera       = FindViewById <Button>(Resource.Id.btnCamera);
            btnEnlargeImage = FindViewById <Button>(Resource.Id.btnEnlargeImage);
            picture         = FindViewById <CustomImageView>(Resource.Id.picture);



            if (savedInstanceState != null)
            {
                //With SavedInstance

                /*
                 * bitmap = (Bitmap)savedInstanceState.GetParcelable("picture");
                 * if (bitmap != null)
                 * {
                 *  picture.SetImageBitmap(bitmap);
                 *  attacher = new PhotoViewAttacher(picture);
                 * }
                 */

                //Static dictionary

                /*
                 * strGuid = savedInstanceState.GetString("pictureGUID");
                 * if (!string.IsNullOrEmpty(strGuid))
                 * {
                 *  bitmap = (Bitmap)myDictionary[strGuid];
                 *  if (bitmap != null)
                 *  {
                 *      picture.SetImageBitmap(bitmap);
                 *      attacher = new PhotoViewAttacher(picture);
                 *  }
                 * }
                 */
            }

            //With internal storage
            //LoadImageFromInternalStorage("/data/data/ImagePlay3_Droid.ImagePlay3_Droid/app_pictures");


            if (CanDeviceTakePictures())
            {
                btnCamera.Click += btnCamera_StartCamera;
            }

            btnEnlargeImage.Click += btnEnlargeImage_Click;
        }
Esempio n. 4
0
        public void ApplyFilter(CustomImageView imageView, ImageFilter imageFilter, Activity activity, ProgressBar progressbar)
        {
            ITransformation transform = null;

            switch (imageFilter.FilterName)
            {
            case "Circle crop":
                transform = new CropCircleTransformation(activity);
                break;

            case "Grayscale":
                transform = new GrayscaleTransformation();
                break;

            case "Inverted colors":
                transform = new InvertColorsTransformation();
                break;

            case "Blurred":
                transform = new BlurTransformation(activity);
                break;

            case "Alpha fade":
                transform = new AlphaFade(activity);
                break;

            case "Inverse circle crop":
                transform = new InvertCropCircleTransformation(activity);
                break;

            default:
                break;
            }

            Action onSucces = delegate {
                Animation fadeOut = new AlphaAnimation(0, 1);
                fadeOut.Interpolator = new AccelerateInterpolator();
                fadeOut.Duration     = 1000;
                imageView.StartAnimation(fadeOut);
                progressbar.Visibility = ViewStates.Gone;
            };

            Action onError = delegate {
            };


            if (transform != null)
            {
                Picasso.With(activity.ApplicationContext)
                .Load(imageFilter.ImageUrl)
                .Resize(IMAGE_SIZE, IMAGE_SIZE)
                .Transform(transform)
                .NoFade()
                .Into(imageView, onSucces, onError);
            }
            else
            {
                Picasso.With(activity.ApplicationContext)
                .Load(imageFilter.ImageUrl)
                .Resize(IMAGE_SIZE, IMAGE_SIZE)
                .NoFade()
                .Into(imageView, onSucces, onError);
            }
        }
Esempio n. 5
0
        public newItemPage(int fbla_id)
        {
            Title = "New Item For sale";

            this.fbla_id = fbla_id;

            Button postBtn = new Button
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Text            = "Put item for sale!",
                VerticalOptions = LayoutOptions.End
            };

            postBtn.Clicked += postBtnClicked;


            Button cameraBtn = new Button
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.End,
                Text = "Add A picture",
            };

            cameraBtn.Clicked += cameraBtnClicked;

            name = new ExtendedEntry
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Placeholder       = "Enter item Name"
            };

            desc = new ExtendedEditor
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.StartAndExpand,
                HeightRequest     = 50
            };

            condition = new Label
            {
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                VerticalOptions         = LayoutOptions.End,
                HorizontalTextAlignment = TextAlignment.Center,
                BackgroundColor         = Constants.palette.primary_variant,
                Text          = "Select Condition",
                FontSize      = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                HeightRequest = 30
            };
            condition.GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(async() =>
                {
                    var action = await DisplayActionSheet("Select Condition", "Cancel", null, "\u2605", "\u2605\u2605", "\u2605\u2605\u2605", "\u2605\u2605\u2605\u2605", "\u2605\u2605\u2605\u2605\u2605");
                    switch (action)
                    {
                    case "Cancel":
                        condition.Text = "\u2605\u2605\u2605";
                        break;

                    default:
                        condition.Text = action;
                        break;
                    }
                }),
            });

            image = new CustomImageView
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HeightRequest     = 100,
                //Aspect = Aspect.AspectFit,
            };

            price = new ExtendedEntry
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.End,
                Placeholder       = "Enter Price",
                Keyboard          = Keyboard.Numeric
            };

            baseStack = new StackLayout
            {
                Padding           = new Thickness(25),
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill,
                Children          =
                {
                    name,

                    new Label {
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        Text = "Item Description"
                    },

                    desc,
                    image,
                    price,
                    condition,
                    cameraBtn,
                    postBtn
                }
            };

            Content = baseStack;
        }
Esempio n. 6
0
        public fblaChapterListView()
        {
            SeparatorColor = Constants.palette.divider;
            Label schoolLabel = null;
            Label locLabel    = null;

            // Source of data items.
            VerticalOptions   = LayoutOptions.FillAndExpand;
            HorizontalOptions = LayoutOptions.FillAndExpand;

            RowHeight = 75;
            // Define template for displaying each item.
            // (Argument of DataTemplate constructor is called for
            //      each item; it must return a Cell derivative.)
            ItemTemplate = new DataTemplate(() =>
            {
                // Create views with bindings for displaying each property.
                schoolLabel = new Label {
                    FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label))
                };
                locLabel = new Label();
                schoolLabel.SetBinding(Label.TextProperty, "school");

                imageView = new CustomImageView
                {
                    HeightRequest = 75,
                    WidthRequest  = 75,
                };


                // Return an assembled ViewCell.
                return(new ViewCell
                {
                    View = new StackLayout
                    {
                        Padding = new Thickness(5, 5, 5, 5),
                        Orientation = StackOrientation.Horizontal,
                        Children =
                        {
                            imageView,
                            new StackLayout
                            {
                                //VerticalOptions = LayoutOptions.Center,
                                Spacing = 5,
                                Children =
                                {
                                    schoolLabel,
                                    locLabel,
                                }
                            }
                        }
                    }
                });
            });

            this.ItemSelected += ((sender, eventArgs) =>
            {
                if (this.SelectedItem != null)
                {
                    var c = SelectedItem as myDataTypes.fblaChapter;
                    var chapterView = new fblaChapterPage(c);
                    this.SelectedItem = null;
                    Navigation.PushAsync(chapterView);
                }
            });

            ItemAppearing += async(s, e) =>
            {
                if (e.Item == null)
                {
                    return;
                }

                myDataTypes.fblaChapter i = e.Item as myDataTypes.fblaChapter;


                locLabel.Text    = i.city + ", " + i.state;
                schoolLabel.Text = i.school;

                IImageProcessing processer = DependencyService.Get <IImageProcessing>();
                imageView.SetImageBitmap(await processer.ScaleBitmap(i.picture, await processer.GetBitmapOptionsOfImageAsync(i.picture), 200, 200));
            };
        }
Esempio n. 7
0
        public itemListView()
        {
            SeparatorColor = Constants.palette.divider;

            Label           conditionLabel = null;
            Label           priceLabel     = null;
            CustomImageView imageView      = null;

            // Source of data items.

            RowHeight = 80;
            // Define template for displaying each item.
            // (Argument of DataTemplate constructor is called for
            //      each item; it must return a Cell derivative.)
            ItemTemplate = new DataTemplate(() =>
            {
                // Create views with bindings for displaying each property.
                Label nameLabel = new Label()
                {
                    LineBreakMode = LineBreakMode.TailTruncation
                }, descLabel = new Label()
                {
                    LineBreakMode = LineBreakMode.TailTruncation
                };
                priceLabel     = new Label();
                conditionLabel = new Label();
                nameLabel.SetBinding(Label.TextProperty, "name");
                descLabel.SetBinding(Label.TextProperty, "description");



                //&#9734
                imageView = new CustomImageView
                {
                    HeightRequest = 100,
                    WidthRequest  = 100,
                };

                // Return an assembled ViewCell.
                return(new ViewCell
                {
                    View = new StackLayout
                    {
                        Padding = new Thickness(5, 5, 5, 5),
                        Orientation = StackOrientation.Horizontal,
                        Children =
                        {
                            imageView,
                            new StackLayout
                            {
                                VerticalOptions = LayoutOptions.Center,
                                //Spacing = 0,
                                Children =
                                {
                                    nameLabel,
                                    descLabel,
                                    new StackLayout {
                                        //Spacing = 0,
                                        Orientation = StackOrientation.Horizontal,
                                        Children =
                                        {
                                            priceLabel,
                                            conditionLabel
                                        }
                                    }
                                }
                            }
                        }
                    }
                });
            });

            ItemAppearing += async(s, e) =>
            {
                myDataTypes.item item = e.Item as myDataTypes.item;
                //formatting price to money
                CultureInfo culture = new CultureInfo("en-us");
                culture.NumberFormat.CurrencyNegativePattern = 1;

                priceLabel.Text = string.Format(culture, "{0:c2}", item.price);

                //giving stars to rating
                string st = "";
                for (int i = 0; i < item.quality; i++)
                {
                    st += "\u2605";
                }
                conditionLabel.Text = st;

                IImageProcessing processer = DependencyService.Get <IImageProcessing>();
                imageView.SetImageBitmap(await processer.ScaleBitmap(item.picture, await processer.GetBitmapOptionsOfImageAsync(item.picture), 200, 200));
            };

            this.ItemSelected += ((sender, eventArgs) =>
            {
                if (this.SelectedItem != null)
                {
                    var itemView = new itemPage(SelectedItem as myDataTypes.item);

                    this.SelectedItem = null;
                    Navigation.PushAsync(itemView);
                }
            });
        }
Esempio n. 8
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.ActivityImage);

            _imageContainer = FindViewById <LinearLayout>(Resource.Id.ActivityImage_LinearLayout_ImageContainer);

            var useCustomImageViews = false;

            if (Intent?.HasExtra(UseCustomImageviewKey) == true)
            {
                useCustomImageViews = Intent.GetBooleanExtra(UseCustomImageviewKey, false);
            }

            for (int i = 0; i < 5; i++)
            {
                ImageView imageView = null;

                if (useCustomImageViews)
                {
                    imageView = new CustomImageView(this);
                }
                else
                {
                    imageView = new ImageView(this);
                }

                imageView.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent)
                {
                    Gravity     = GravityFlags.CenterHorizontal,
                    TopMargin   = 20,
                    LeftMargin  = 20,
                    RightMargin = 20
                };

                imageView.SetScaleType(ImageView.ScaleType.FitXy);

                var resId = 0;

                switch (i)
                {
                case 0:
                    resId = Resource.Drawable.Techorama;
                    break;

                case 1:
                    resId = Resource.Drawable.Xamarin;
                    break;

                case 2:
                    resId = Resource.Drawable.Os;
                    break;

                case 3:
                    resId = Resource.Drawable.Ordina;
                    break;

                case 4:
                    resId = Resource.Drawable.Microsoft;
                    break;
                }

                imageView.SetImageResource(resId);

                _imageContainer.AddView(imageView);
            }
        }
Esempio n. 9
0
 public UrlImageViewImageUrlTargetBinding(CustomImageView target)
     : base(target)
 {
 }