Exemplo n.º 1
0
        public DemoPage()
        {
            this.Padding = 0;
            var mainStack = new StackLayout () {
                Padding = new Thickness(0,20,0,0),
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };

            listView = new ListView () {};
            listView.ItemsSource = items;
            mainStack.Children.Add (listView);

            textEntry = new Entry () {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Placeholder = "Type something...",
            };

            var textStack = new StackLayout () {
                Orientation = StackOrientation.Horizontal,
                Padding = 10,
                BackgroundColor = Color.White,
            };
            textStack.Children.Add (textEntry);

            var textButton = new Button () {
                Text = "Post",
                FontAttributes = FontAttributes.Bold,
                FontSize = 16,
                HorizontalOptions = LayoutOptions.End,
            };

            textButton.Clicked += (object sender, EventArgs e) => {
                System.Diagnostics.Debug.WriteLine ("listview height: " + listView.Height);
                items.Add(textEntry.Text);
                textEntry.Text = string.Empty;
                listView.ScrollTo(items.Last(), ScrollToPosition.MakeVisible, true);
            };
            textStack.Children.Add (textButton);
            mainStack.Children.Add (textStack);

            // This works nicely with stacklayouts but causes issues on listviews as they automatically adjust their size
            //			var spacer = new BoxView () {
            //				HorizontalOptions = LayoutOptions.FillAndExpand,
            //				HeightRequest = 0,
            //			};
            //			mainStack.Children.Add (spacer);

            KeyboardHelper.KeyboardChanged += (sender, e) => {
                bottomOffset = mainStack.Bounds.Bottom - textStack.Bounds.Bottom;	// This offset allows us to only raise the stack by the amount required to stay above the keyboard.
                var ty = e.Visible ? -e.Height : -1;
                textStack.TranslateTo(textStack.TranslationX, ty, e.Duration, Easing.CubicInOut);
            //				spacer.HeightRequest = e.Visible ? e.Height : -1;
            };
            this.Content = mainStack;
        }
Exemplo n.º 2
0
		public myimagomenu ()
		{
			//http://facchini-ts.it/imagobe/DATABASE/imagolight.txt
			//HttpWebRequest a;
			//HttpClient b = new HttpClient ();
			currentPlataform = DependencyService.Get<platformSpecific> ();

			b1 = new StackLayout {
				BackgroundColor = Color.FromRgb (40, 40, 40),
				//VerticalOptions = LayoutOptions.Center

			};
			b2 = new StackLayout {

				BackgroundColor = Color.FromRgb (60, 60, 60),
			};
			b3 = new StackLayout {

				BackgroundColor = Color.FromRgb (80, 80, 80),
			};

		


			btn1 = new Button (){ Text = "btn1" };
			//b1.Children.Add (btn1);

			btn2 = new Button (){ Text = "btn2" };
			//b2.Children.Add (btn2);


			#region "open"
			btn1.Clicked += async delegate(object sender, EventArgs e) {
				b2.IsVisible = true;
				b3.IsVisible = false;
				await b2.TranslateTo (0, -this.b1H);
			};
			btn2.Clicked += async delegate(object sender, EventArgs e) {
				b1.IsVisible = false;
				b2.IsVisible = true;
				b3.IsVisible = true;
				await b2.TranslateTo (0, 0);
				await b3.TranslateTo (0, -this.b2H);
			};

			#endregion

			#region "close"
			var mygest = new TapGestureRecognizer ();
			mygest.Tapped += async (object sender, EventArgs e) => {
				//b2 b1
				await b2.TranslateTo (0, 0);
				b2.IsVisible = false;
			};
			b1.GestureRecognizers.Add (mygest);


			var mygest2 = new TapGestureRecognizer ();
			mygest2.Tapped += async (object sender, EventArgs e) => {
				if (b1.IsVisible) {
					//b2,b1
					await b2.TranslateTo (0, 0);
				} else {
					//b3 b2
					b3.IsVisible = false;
					b1.IsVisible = true;
					await b2.TranslateTo (0, -this.b1H);
				}
			};
			b2.GestureRecognizers.Add (mygest2);

			var mygest3 = new TapGestureRecognizer ();
			mygest3.Tapped += async (object sender, EventArgs e) => {
				//b3 b2
				b3.IsVisible = false;
				b1.IsVisible = true;
				await b2.TranslateTo (0, -this.b1H);
			};
			b3.GestureRecognizers.Add (mygest3);



			#endregion

			al = new AbsoluteLayout ();

			Content = al;

			this.SizeChanged += async delegate(object sender, EventArgs e) {

				var hMenu = this.Height;
				hMenu += 1;
				//568
				var half = Convert.ToInt32 (hMenu / 2);
				var delta = hMenu - (half * 2);
				b1H = half;
				//b3H += delta;
				b2H = half - 100;
				b3H = half - 200;

				/*
				b1H = (hMenu / 2);
				b2H = (hMenu / 2) - 100;
				b3H = (hMenu / 2) - 200;
*/

				al.Children.Add (b3, new Point (0, hMenu - b3H)); 
				al.Children.Add (b2, new Point (0, hMenu - b2H)); 
				al.Children.Add (b1, new Point (0, hMenu - b1H)); 


				b1.HeightRequest = b1H;
				b2.HeightRequest = b2H;
				b3.HeightRequest = b3H;
			


				/*
				myba.Children.Add (b3, new Point (0, (hMenu / 2))); 
				myba.Children.Add (b2, new Point (0, (hMenu / 2))); 
				myba.Children.Add (b1, new Point (0, (hMenu / 2))); 

				b1.HeightRequest = (hMenu / 2);
				b2.HeightRequest = (hMenu / 2);
				b3.HeightRequest = hMenu / 2;
				b1H = (hMenu / 2) ;
				b2H = (hMenu / 2) ;
				b3H = hMenu / 2;
				*/
				b1.WidthRequest = this.Width;
				b2.WidthRequest = this.Width;
				b3.WidthRequest = this.Width;
			};


		}
        public AddEventsSituationsOrThoughts(string title, DetailsPageModel detailsPageModel = null)
        {
            NavigationPage.SetHasNavigationBar(this, false);
            masterLayout = new CustomLayout();
            audioRecorder = DependencyService.Get<PurposeColor.interfaces.IAudioRecorder>();
            //deviceSpec = DependencyService.Get<IDeviceSpec>();
            screenHeight = App.screenHeight;
            screenWidth = App.screenWidth;

            masterLayout.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY;
            pageTitle = title;
            lattitude = string.Empty;
            longitude = string.Empty;
            currentAddress = string.Empty;
            int devWidth = (int)screenWidth;
            App.MediaArray = new List<MediaItem>();
            App.ContactsArray = new List<string>();
            App.PreviewListSource.Clear();
            int textInputWidth = (int)(devWidth * .80);
			contactSelectAction = OnContactSelected;

            #region TITLE BARS
            TopTitleBar = new StackLayout
            {
                BackgroundColor = Constants.BLUE_BG_COLOR,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions = LayoutOptions.StartAndExpand,
                Padding = 0,
                Spacing = 0,
                Children = { new BoxView { WidthRequest = screenWidth } }
            };
            masterLayout.AddChildToLayout(TopTitleBar, 0, 0);
            
            string trimmedPageTitle = string.Empty;

            int titleMaxLength = 24;
            if (App.screenDensity > 1.5)
            {
                titleMaxLength = 24;
            }
            else
            {
                titleMaxLength = 22;
            }

            if (title.Length > titleMaxLength)
            {
                trimmedPageTitle = title.Substring(0, titleMaxLength);
                trimmedPageTitle += "..";
            }
            else
            {
                trimmedPageTitle = pageTitle;
            }

            subTitleBar = new PurposeColorBlueSubTitleBar(Constants.SUB_TITLE_BG_COLOR, trimmedPageTitle, true, true);
            masterLayout.AddChildToLayout(subTitleBar, 0, 1);
            subTitleBar.BackButtonTapRecognizer.Tapped += OnBackButtonTapRecognizerTapped;
            subTitleBar.NextButtonTapRecognizer.Tapped += NextButtonTapRecognizer_Tapped;
            #endregion

            #region EVENT TITLE - CUSTOM ENTRY

            eventTitle = new CustomEntry
            {
                VerticalOptions = LayoutOptions.StartAndExpand,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                BackgroundColor = Color.White,
                Placeholder = "Title",
                TextColor = Color.FromHex("#424646"),
                HeightRequest = Device.OnPlatform(50,50,73),
                WidthRequest = (int)(devWidth * .90) // 90% of screen,
            };
			eventTitle.TextChanged += EventTitle_TextChanged;

            
            //if (App.screenDensity > 1.5)
            //{
            //    eventTitle.HeightRequest = screenHeight * 6 / 100;
            //}
            //else
            //{
            //    eventTitle.HeightRequest = screenHeight * 9 / 100;
            //}
            masterLayout.AddChildToLayout(eventTitle, 5, 11);

            #endregion

            #region EVENT DESCRIPTION

            eventDescription = new CustomEditor
            {
                VerticalOptions = LayoutOptions.StartAndExpand,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                HeightRequest = 100,
                Placeholder = pageTitle,
                BackgroundColor = Color.White
            };
			eventDescription.TextChanged += EventDescription_TextChanged;
				

            eventDescription.WidthRequest = textInputWidth;

            if (detailsPageModel != null)
            {
				if (detailsPageModel.IsCopyingGem) {
					isUpdatePage = false;
				}
				else
				{
					isUpdatePage = true;
				}

                currentGemId = detailsPageModel.gemId;
                if (detailsPageModel.gemType != null)
                {
                    currentGemType = detailsPageModel.gemType;
                    switch (currentGemType)
                    {
                        case GemType.Goal:
                            pageTitle = Constants.EDIT_GOALS;
                            break;
                        case GemType.Event:
                            pageTitle = Constants.EDIT_EVENTS;
                            break;
                        case GemType.Action:
                            pageTitle = Constants.EDIT_ACTIONS;
                            break;
                        default:
                            break;
                    }
                }
                
                if (detailsPageModel.titleVal != null)
                {
                    eventTitle.Text = detailsPageModel.titleVal;
                }
                if ( detailsPageModel.description != null)
	            {
		             eventDescription.Text = detailsPageModel.description;
	            }
            }

            #endregion

            #region MEDIA INPUTS

            Image pinButton = new Image
            {
                BackgroundColor = Color.Transparent,
                VerticalOptions = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center,
                Source = Device.OnPlatform("icn_attach.png", "icn_attach.png", "//Assets//icn_attach.png"),

            };
            StackLayout pinButtonHolder = new StackLayout
            {
                Padding = 10,
                VerticalOptions = LayoutOptions.Start,
                Children = { pinButton }
            };
            TapGestureRecognizer pinButtonTapRecognizer = new TapGestureRecognizer();
            pinButtonHolder.GestureRecognizers.Add(pinButtonTapRecognizer);
            pinButtonTapRecognizer.Tapped += (s, e) =>
            {
                iconContainerGrid.IsVisible = !iconContainerGrid.IsVisible;
            };

            Image audioRecodeOnButton = new Image
            {
                BackgroundColor = Color.Transparent,
                VerticalOptions = LayoutOptions.Center,
                Source = Device.OnPlatform("mic.png", "mic.png", "//Assets//mic.png"),
            };
            audioRecodeOnHolder = new StackLayout
            {
                Padding = 10,
                VerticalOptions = LayoutOptions.End,
                Children = { audioRecodeOnButton }
            };
            TapGestureRecognizer RecodeOnTapRecognizer = new TapGestureRecognizer();
            audioRecodeOnHolder.GestureRecognizers.Add(RecodeOnTapRecognizer);

            audioRecodeOffButton = new Image
            {
                BackgroundColor = Color.Transparent,
                VerticalOptions = LayoutOptions.Center,
                Source = Device.OnPlatform("turn_off_mic.png", "turn_off_mic.png", "//Assets//turn_off_mic.png"),
            };
            audioRecodeOffHolder = new StackLayout
            {
                BackgroundColor = Color.Transparent,
                Padding = 10,
                VerticalOptions = LayoutOptions.End,
                IsVisible = false,
                Children = { audioRecodeOffButton }
            };
            TapGestureRecognizer RecodeOffTapRecognizer = new TapGestureRecognizer();
            audioRecodeOffHolder.GestureRecognizers.Add(RecodeOffTapRecognizer);

            audioRecodeOffHolder.TranslateTo(0, Device.OnPlatform(audioRecodeOffButton.Y + 60, audioRecodeOffButton.Y + 60, audioRecodeOffButton.Y + 50), 5, null);
            audioRecodeOnHolder.TranslateTo(0, Device.OnPlatform(audioRecodeOffButton.Y + 60, audioRecodeOffButton.Y + 60, audioRecodeOffButton.Y + 50), 5, null);

            RecodeOnTapRecognizer.Tapped += RecodeOnTapRecognizer_Tapped;
            RecodeOffTapRecognizer.Tapped += RecodeOffTapRecognizer_Tapped;

            StackLayout menuPinContainer = new StackLayout
            {
                BackgroundColor = Color.White,
                Orientation = StackOrientation.Vertical,
                HeightRequest = 140,
                WidthRequest = (int)(devWidth * .10),
                Children = {
                    pinButtonHolder, 
                    audioRecodeOnHolder, 
                    audioRecodeOffHolder
                }
            };


            TapGestureRecognizer locationlabelTap = new TapGestureRecognizer();

            locationInfo = new Label();
            locationInfo.TextColor = Constants.BLUE_BG_COLOR;
            locationInfo.BackgroundColor = Color.Transparent;
            locationInfo.FontSize = 12;
            locationInfo.HeightRequest = Device.OnPlatform(15, 25, 25);
            locationInfo.GestureRecognizers.Add(locationlabelTap);
            locationlabelTap.Tapped += OnEditLocationInfo;

            editLocationAndContactsStack = new StackLayout();
            editLocationAndContactsStack.Padding = new Thickness(1, 1, 1, 1);
            editLocationAndContactsStack.BackgroundColor = Color.FromRgb(30, 126, 210);
            editLocationAndContactsStack.WidthRequest = App.screenWidth * 90 / 100;
            editLocationAndContactsStack.IsVisible = false;
            editLocationAndContactsStack.Orientation = StackOrientation.Horizontal;


            locAndContactsEntry = new Entry();
            locAndContactsEntry.TextColor = Color.Black;
            locAndContactsEntry.BackgroundColor = Color.White;
            locAndContactsEntry.VerticalOptions = LayoutOptions.Center;
            locAndContactsEntry.WidthRequest = App.screenWidth * 80 / 100;
            locAndContactsEntry.HeightRequest = 50;

            editLocationDoneButton = new CustomImageButton();
            editLocationDoneButton.VerticalOptions = LayoutOptions.Center;
            editLocationDoneButton.ImageName = "icn_done.png";
            editLocationDoneButton.HeightRequest = 25;
            editLocationDoneButton.WidthRequest = 25;
            editLocationDoneButton.Clicked += OnLocationEditCompleted;


            editLocationAndContactsStack.Children.Add(locAndContactsEntry);
            editLocationAndContactsStack.Children.Add(editLocationDoneButton);

            if (Device.OS == TargetPlatform.iOS)
            {
                editLocationAndContactsStack.TranslationY = -30;
            }

            locLayout = new StackLayout();
            locLayout.Orientation = StackOrientation.Vertical;
            locLayout.BackgroundColor = Color.Transparent;



            locLayout.Children.Add(locationInfo);

            TapGestureRecognizer contactsLabelTap = new TapGestureRecognizer();
            contactInfo = new Label();
            contactInfo.TextColor = Constants.BLUE_BG_COLOR;
            contactInfo.BackgroundColor = Color.Transparent;
            contactInfo.FontSize = 12;
            contactInfo.HeightRequest = Device.OnPlatform(15, 25, 25);
            contactInfo.GestureRecognizers.Add(contactsLabelTap);
            contactsLabelTap.Tapped += async (object sender, EventArgs e) =>
            {
                editLocationAndContactsStack.ClassId = "contactedit";
                string spanContacts = "";
                if (contactInfo.FormattedText != null && contactInfo.FormattedText.Spans.Count > 1)
                    spanContacts = contactInfo.FormattedText.Spans[1].Text;
                locAndContactsEntry.Text = spanContacts;
                editLocationAndContactsStack.IsVisible = true;
                contactInfo.IsVisible = false;
                iconContainerGrid.IsVisible = false;
                locationInfo.IsVisible = true;

                await editLocationAndContactsStack.TranslateTo(100, 0, 300, Easing.SinInOut);
                await editLocationAndContactsStack.TranslateTo(0, 0, 300, Easing.SinIn);

            };

            locLayout.IsVisible = false;
            contactInfo.IsVisible = false;
            
            #endregion

            if(detailsPageModel != null)
            {
                if (detailsPageModel.eventMediaArray!= null && detailsPageModel.eventMediaArray.Count > 0)
                {
                    foreach (EventMedia eventObj in detailsPageModel.eventMediaArray)
                    {
						if (eventObj.event_media != null && !eventObj.event_media.Contains("default")) {
							AddFilenameToMediaList(eventObj.event_media);
						}
                    }
                }

                if (detailsPageModel.goal_media != null && detailsPageModel.goal_media.Count > 0)
                {
                    foreach (SelectedGoalMedia goalObj in detailsPageModel.goal_media)
                    {
						if (goalObj.goal_media != null && !goalObj.goal_media.Contains("default")) {
							AddFilenameToMediaList(goalObj.goal_media);
						}
                    }
                }

                if (detailsPageModel.actionMediaArray != null && detailsPageModel.actionMediaArray.Count > 0)
                {
                    foreach (ActionMedia actionObj in detailsPageModel.actionMediaArray)
                    {
						if (actionObj.action_media != null && !actionObj.action_media.Contains("default")) {
							AddFilenameToMediaList(actionObj.action_media);
						}
                    }
                }

            }



            StackLayout entryAndLocContainer = new StackLayout();
            entryAndLocContainer.Orientation = StackOrientation.Vertical;
            entryAndLocContainer.BackgroundColor = Color.White;
            entryAndLocContainer.Children.Add( eventDescription );
			entryAndLocContainer.Children.Add(contactInfo);
            entryAndLocContainer.Children.Add(locLayout);

            textInputContainer = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Spacing = 0,
                Padding = 0,
                Children = { entryAndLocContainer, menuPinContainer }
            };

            #region ICONS

            audioInput = new Image()
            {
                Source = Device.OnPlatform("ic_music.png", "ic_music.png", "//Assets//ic_music.png"),
                Aspect = Aspect.AspectFit
            };

            int ICON_SIZE = 8;

            if( Device.OS == TargetPlatform.WinPhone )
            {
                audioInput.WidthRequest = screenWidth * ICON_SIZE / 100;
                audioInput.HeightRequest = screenWidth * ICON_SIZE / 100;
            }
            audioInputStack = new StackLayout
            {
                Padding = new Thickness(5, 10, 5, 10),
                //BackgroundColor = Constants.STACK_BG_COLOR_GRAY,
                //HorizontalOptions = LayoutOptions.Center,
                Spacing = 0,
                Children = { audioInput 
                                /*, new Label { Text = "Audio", TextColor = Constants.TEXT_COLOR_GRAY, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) }*/ 
                           }
            };

            cameraInput = new Image()
            {
                Source = Device.OnPlatform("icn_camera.png", "icn_camera.png", "//Assets//icn_camera.png"),
                Aspect = Aspect.AspectFit
            };



            if (Device.OS == TargetPlatform.WinPhone)
            {
                cameraInput.WidthRequest = screenWidth * ICON_SIZE / 100;
                cameraInput.HeightRequest = screenWidth * ICON_SIZE / 100;
            }


            cameraInputStack = new StackLayout
            {
                Padding = new Thickness(5, 10, 5, 10),
                //BackgroundColor = Constants.STACK_BG_COLOR_GRAY,
                //HorizontalOptions = LayoutOptions.Center,
                Spacing = 0,
                Children = { cameraInput
                                /*, new Label { Text = "Camera", TextColor = Constants.TEXT_COLOR_GRAY, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) } 
                                 */
                            }
            };
            cameraInputStack.ClassId = "camera";

            #region CAMERA TAP RECOGNIZER
            CameraTapRecognizer = new TapGestureRecognizer();
            cameraInputStack.GestureRecognizers.Add(CameraTapRecognizer);
            CameraTapRecognizer.Tapped += async (s, e) =>
            {
                try
                {
					await ApplyAnimation( cameraInputStack );
                    StackLayout send = s as StackLayout;
                    MediaSourceChooser chooser = new MediaSourceChooser(this, masterLayout, send.ClassId);
                    chooser.ClassId = "mediachooser";
                    masterLayout.AddChildToLayout(chooser, 0, 0);
                   
                }
                catch (System.Exception ex)
                {
                    DisplayAlert("Camera", ex.Message + " Please try again later", "ok");
                }

                /*
                try
                {
                    StackLayout send = s as StackLayout;
                    MediaSourceChooser chooser = new MediaSourceChooser(this, masterLayout, send.ClassId);
                    chooser.ClassId = "mediachooser";
                    masterLayout.AddChildToLayout(chooser, 0, 0);
                }
                catch (System.Exception ex)
                {
                    DisplayAlert("Camera", ex.Message + " Please try again later", "ok");
                }
                */
            };

            #endregion

            galleryInput = new Image()
            {
                Source = Device.OnPlatform("icn_gallery.png", "icn_gallery.png", "//Assets//icn_gallery.png"),
                Aspect = Aspect.AspectFit
            };

            if (Device.OS == TargetPlatform.WinPhone)
            {
                galleryInput.WidthRequest = screenWidth * ICON_SIZE / 100;
                galleryInput.HeightRequest = screenWidth * ICON_SIZE / 100;
            }

            galleryInputStack = new StackLayout
            {
                Padding = new Thickness(5, 10, 5, 10),
                Spacing = 0,
                Children = { galleryInput 
                                //new Label { Text = "Gallery", TextColor = Constants.TEXT_COLOR_GRAY, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) } 
                            }
            };
            galleryInputStack.ClassId = "gallery";

            #region GALLERY  TAP RECOGNIZER

            TapGestureRecognizer galleryInputStackTapRecognizer = new TapGestureRecognizer();
            galleryInputStack.GestureRecognizers.Add(galleryInputStackTapRecognizer);
            galleryInputStackTapRecognizer.Tapped += async (s, e) =>
            {
				await ApplyAnimation( galleryInputStack );
                StackLayout send = s as StackLayout;
                MediaSourceChooser chooser = new MediaSourceChooser(this, masterLayout, send.ClassId);
                chooser.ClassId = "mediachooser";
                masterLayout.AddChildToLayout(chooser, 0, 0);

            };

            #endregion

            locationInput = new Image()
            {
                Source = Device.OnPlatform("icn_location.png", "icn_location.png", "//Assets//icn_location.png"),
                Aspect = Aspect.AspectFit
            };

            if (Device.OS == TargetPlatform.WinPhone)
            {
                locationInput.WidthRequest = screenWidth * ICON_SIZE / 100;
                locationInput.HeightRequest = screenWidth * ICON_SIZE / 100;
            }


            locationInputStack = new StackLayout
            {
                Padding = new Thickness(5, 10, 5, 10),
                //BackgroundColor = Constants.STACK_BG_COLOR_GRAY,
                //HorizontalOptions = LayoutOptions.Center,
                Spacing = 0,
                Children = { locationInput
                                //, new Label { Text = "Location", TextColor = Constants.TEXT_COLOR_GRAY, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) } 
                            }
            };

            #region LOCATION TAP RECOGNIZER

            TapGestureRecognizer locationInputTapRecognizer = new TapGestureRecognizer();
            locationInputStack.GestureRecognizers.Add(locationInputTapRecognizer);
            locationInputTapRecognizer.Tapped += LocationInputTapRecognizer_Tapped;

            #endregion

            contactInput = new Image()
            {
                Source = Device.OnPlatform("icn_contact.png", "icn_contact.png", "//Assets//icn_contact.png"),
                Aspect = Aspect.AspectFit
            };

            if (Device.OS == TargetPlatform.WinPhone)
            {
                contactInput.WidthRequest = screenWidth * ICON_SIZE / 100;
                contactInput.HeightRequest = screenWidth * ICON_SIZE / 100;
            }

            contactInputStack = new StackLayout
            {
                Padding = new Thickness(5, 10, 0, 10),
                Spacing = 0,
                Children = { contactInput
                    //new Label { Text = "Contact", TextColor = Constants.TEXT_COLOR_GRAY, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) }
                     }
            };

            #region CONTACTS TAP RECOGNIZER

            TapGestureRecognizer contactsInputTapRecognizer = new TapGestureRecognizer();
            contactInputStack.GestureRecognizers.Add(contactsInputTapRecognizer);

            contactsInputTapRecognizer.Tapped += async (s, e) =>
            {
				await ApplyAnimation( contactInputStack );

				try
				{
					if( Device.OS == TargetPlatform.Android  || Device.OS == TargetPlatform.iOS )
					{
						IContactPicker testicker = DependencyService.Get< IContactPicker >();
						testicker.ShowContactPicker();
					}	
				}
				catch (Exception ex)
                {
                    DisplayAlert("contactsInputTapRecognizer: ", ex.Message, "ok");
                }
                 
            };

            #endregion

            #endregion

            #region ICON CONTAINER GRID

            iconContainerGrid = new Grid
            {
                IsVisible = false,
                VerticalOptions = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                RowDefinitions = 
            {
                    new RowDefinition { Height = GridLength.Auto }
                },
                ColumnDefinitions = 
            {
                    new ColumnDefinition { Width = new GridLength(((screenWidth * .80) )/4, GridUnitType.Absolute) }, // icon container x = 3 //new ColumnDefinition { Width = GridLength.Auto },
                  //  new ColumnDefinition { Width = new GridLength(((screenWidth * .80)) /5, GridUnitType.Absolute) },
                    new ColumnDefinition { Width = new GridLength(((screenWidth * .80))/4, GridUnitType.Absolute) },
                    new ColumnDefinition { Width = new GridLength(((screenWidth * .80))/4, GridUnitType.Absolute) },
                    new ColumnDefinition { Width = new GridLength(((screenWidth * .80))/4, GridUnitType.Absolute) },
            }
            };

            iconContainerGrid.Children.Add(galleryInputStack, 0, 0);
            iconContainerGrid.Children.Add(cameraInputStack, 1, 0);
          //  iconContainerGrid.Children.Add(audioInputStack, 2, 0);
            iconContainerGrid.Children.Add(locationInputStack, 2, 0);
            iconContainerGrid.Children.Add(contactInputStack, 3, 0);

            textinputAndIconsHolder = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.Center,
                Spacing = 0,
                Padding = 0,
				Children = { textInputContainer, iconContainerGrid, editLocationAndContactsStack }
            };

            Button createEvent = new Button();
            if (pageTitle == Constants.ADD_ACTIONS || pageTitle == Constants.ADD_GOALS || pageTitle == Constants.EDIT_ACTIONS || pageTitle == Constants.EDIT_GOALS)
            {
                createEvent.BackgroundColor = Color.Transparent;
                createEvent.TextColor = Constants.BLUE_BG_COLOR;
                createEvent.Text = "Create Reminder";
                createEvent.FontSize = 12;
                createEvent.BorderWidth = 0;
                createEvent.BorderColor = Color.Transparent;
                createEvent.Clicked += createEvent_Clicked;
				if( Device.OS == TargetPlatform.iOS )
				createEvent.TranslationY = -8;
                textinputAndIconsHolder.Children.Add(createEvent);

            }
            masterLayout.AddChildToLayout(textinputAndIconsHolder, 5, 21);


            #region PREVIEW LIST
            listContainer = new StackLayout();
            listContainer.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY;
            listContainer.WidthRequest = screenWidth * 90 / 100;
            listContainer.HeightRequest = screenHeight * 25 / 100;
            listContainer.ClassId = "preview";

            previewListView = new ListView();
            previewListView.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY;
            PreviewListViewCellItem.addEvntObject = this;
            previewListView.ItemTemplate = new DataTemplate(typeof(PreviewListViewCellItem));
            previewListView.SeparatorVisibility = SeparatorVisibility.None;
            previewListView.Opacity = 1;
            previewListView.ItemsSource = App.PreviewListSource;
			previewListView.ItemSelected += (object sender, SelectedItemChangedEventArgs e) => 
			{
              /*  PreviewItem items = previewListView.SelectedItem as PreviewItem;
                if( items != null )
                App.Navigator.PushModalAsync( new VideoPlayerView( items.Path ) );*/
				previewListView.SelectedItem = null;
			};
            listContainer.Children.Add(previewListView);
            masterLayout.AddChildToLayout(listContainer, 5, Device.OnPlatform( 63, 63, 50 ));
            #endregion

			//masterLayout.AddChildToLayout(locationEditStack, 5, 30 );
            #endregion

            Content = masterLayout;
        }
		private async Task<bool> ApplyAnimation( StackLayout layout )
		{
			await layout.TranslateTo(0, -30, 250, Easing.CubicOut);
			await layout.TranslateTo(0, 0, 250, Easing.CubicOut);
			return true;
		}