Ejemplo n.º 1
0
        public MainView(Context context) : base(context)
        {
            MapView = new MapView(context);
            AddView(MapView);

            // Just use close icon for both images,
            // as back icon is not used in this application
            int close = Resource.Drawable.icon_close;

            Popup = new SlideInPopup(context, close, close);
            AddView(Popup);

            Content = new PopupContent(context);
            Popup.SetPopupContent(Content);
            Popup.Header.Text = "SUBMIT A NEW LOCATION";

            Done = new ActionButton(context, Resource.Drawable.icon_done);
            Done.SetBackground(Colors.CartoGreen);
            AddView(Done);

            Cancel = new ActionButton(context, Resource.Drawable.icon_remove);
            Cancel.SetBackground(Colors.LocationRed);
            AddView(Cancel);

            Add = new ActionButton(context, Resource.Drawable.icon_add);
            Add.SetBackground(Colors.AppleBlue);
            AddView(Add);

            Crosshair = new ImageView(Context);
            Crosshair.SetImageResource(Resource.Drawable.icon_crosshair);
            Crosshair.SetScaleType(ImageView.ScaleType.CenterCrop);
            Crosshair.SetAdjustViewBounds(true);
            AddView(Crosshair);

            Attachment       = new AttachmentImage(context);
            Attachment.Alpha = 0;
            AddView(Attachment);

            /*
             * Frame setting.
             * Everything should be initialized before this point
             */
            SetMainViewFrame();

            var layer = new CartoOnlineVectorTileLayer(CartoBaseMapStyle.CartoBasemapStyleVoyager);

            MapView.Layers.Add(layer);

            Popup.BringToFront();
            Banner.BringToFront();

            Crosshair.Visibility = ViewStates.Gone;

            Popup.SetPopupContent(Content);
        }
        public PopupContent(Context context) : base(context)
        {
            TitleField            = new TextEntry(context, "TITLE", true);
            TitleField.ImeOptions = ImeAction.Next;
            AddView(TitleField);

            DescriptionField = new TextEntry(context, "DESCRIPTION", true);
            AddView(DescriptionField);

            CameraField = new ImageEntry(context, "TAKE PHOTO", Resource.Drawable.icon_camera);
            AddView(CameraField);

            Done = new ActionButton(context, Resource.Drawable.icon_done);
            Done.SetBackground(Colors.AppleBlue);
            AddView(Done);

            TitleField.Field.SetCornerRadius((int)(5 * Density));
            DescriptionField.Field.SetCornerRadius((int)(5 * Density));

            Click += (sender, e) =>
            {
                // Click event just so it wouldn't close on click
            };
        }