예제 #1
0
        protected override View CreateContent()
        {
            var searchBarHeight       = MainPage.PageHeight * 0.07;
            var peopleListHeight      = MainPage.PageHeight * 0.15;
            var currentLocationHeight = MainPage.PageHeight * 0.06;
            var placesHeight          = MainPage.PageHeight * 0.20;
            var morePlacesHeight      = MainPage.PageHeight * 0.34;



            var searchImageSize         = MainPage.PageHeight / 25.001;
            var searchContentleftOffset = MainPage.PageHeight / 68.342;
            var searchContenttopOffset  = MainPage.PageHeight / 17.855;

            var addPeopleLabelFontSize    = MainPage.PageHeight / 60.6364;
            var addPeopleImageWidthHeight = MainPage.PageHeight / 18.5;
            var addPeopleConytentWidth    = MainPage.PageHeight / 6.8342;
            // var peopleListHeight = 130;

            var currentLocationImageWidthHeight        = MainPage.PageHeight / 30.171;
            var currentLocationLabelSize               = MainPage.PageHeight / 45.636;
            var currentLocationContentDetailLeftOffset = MainPage.PageHeight / 38.342;
            var currentLocationContentLeftRightOffset  = MainPage.PageHeight / 68.342;

            var placesLabelFontSize = MainPage.PageHeight / 45.636;
            var placesImageWidth    = MainPage.PageHeight / 30.171;
            var placesImageHeight   = MainPage.PageHeight / 30.171;
            var placesOffset        = MainPage.PageHeight / 38.342;

            var placesContentOffset = MainPage.PageHeight / 68.342;

            var searchImageWidth  = MainPage.PageHeight / 30.171;
            var searchImageHeight = MainPage.PageHeight / 30.171;
            var searchOffset      = MainPage.PageHeight / 68.342;

            var morePlacesSearchOffset = MainPage.PageHeight / 32.345;


            #region Page Background
            this.BackgroundColor = Color.LightGray;
            this.Opacity         = 1.0;


            #endregion


            #region Сontent

            #region SearchBar

            var searchEntry = new AppSearchEntryEditor
            {
                ImageSize         = searchImageSize,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Placeholder       = "Search People and Places",
                WidthRequest      = 280,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
            };


            searchPeopleContent = new StackLayout
            {
                Margin          = new Thickness(searchContentleftOffset, searchContenttopOffset, 10, 0),
                BackgroundColor = Color.White,
                HeightRequest   = searchBarHeight,
                Children        =
                {
                    searchEntry
                }
            };


            #endregion



            #region People List
            var addPeopleLabel = new AppLabel
            {
                FontSize = addPeopleLabelFontSize,
                Text     = "Add People",
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.End,
            };



            var addPeopleImage = new AppImageCommand
            {
                Source        = "plus_gray",
                WidthRequest  = addPeopleImageWidthHeight,
                HeightRequest = addPeopleImageWidthHeight,
            };

            addPeopleImage.SetBinding(AppImageCommand.CommandProperty, "AddPeopleCommand");



            var addPeopleContent = new StackLayout
            {
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions   = LayoutOptions.Center,
                WidthRequest      = addPeopleConytentWidth,
                Children          =
                {
                    addPeopleImage, addPeopleLabel
                }
            };

            var dataHScroll2 = new HScrollViewCell2Data[] {
                new HScrollViewCell2Data {
                    name = "jamie luna", profileImage = "default_user", strokeColor = Color.Red
                },
                new HScrollViewCell2Data {
                    name = "barde luna", profileImage = "default_user", strokeColor = Color.Yellow
                },
                new HScrollViewCell2Data {
                    name = "gerald luna", profileImage = "default_user"
                },
                new HScrollViewCell2Data {
                    name = "jamie luna", profileImage = "default_user"
                },
                new HScrollViewCell2Data {
                    name = "gerald luna", profileImage = "default_user"
                },
                new HScrollViewCell2Data {
                    name = "barde luna", profileImage = "default_user"
                },
            };



            HorizontalScrollLayout peopleList = new HorizontalScrollLayout
            {
                ItemSource    = dataHScroll2,
                ItemTemplate  = new DataTemplate(typeof(HScrollViewCell2)),
                HeightRequest = 130,
                //WidthRequest = 170,
                SelectionBackGroundColor = Color.FromHex("#0040FF"),
                MultiSelection           = false,
            };



            peopleListContent = new StackLayout
            {
                BackgroundColor = Color.White,
                HeightRequest   = peopleListHeight,
                Orientation     = StackOrientation.Horizontal,
                Children        =
                {
                    addPeopleContent, peopleList
                }
            };



            #endregion


            #region CurrentLocation


            currentLocationImage = new AppImageCommand
            {
                Source        = "map_gray",
                HeightRequest = currentLocationImageWidthHeight,
                WidthRequest  = currentLocationImageWidthHeight,
            };

            currentLocationImage.SetBinding(AppImageCommand.CommandProperty, "CurrentLocationCommand");

            currentLocationLabel = new AppLabel
            {
                Text = "Current Location",
                VerticalTextAlignment = TextAlignment.Center,
                FontSize = currentLocationLabelSize,
            };



            currentLocationContentDetails = new StackLayout
            {
                Orientation     = StackOrientation.Horizontal,
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Padding         = new Thickness(currentLocationContentDetailLeftOffset, 0, 0, 0),
                Children        =
                {
                    currentLocationImage, currentLocationLabel
                }
            };


            currentLocationContent = new StackLayout
            {
                Margin          = new Thickness(currentLocationContentLeftRightOffset, 0, currentLocationContentLeftRightOffset, 0),
                BackgroundColor = Color.White,
                HeightRequest   = currentLocationHeight,
                Children        =
                {
                    currentLocationContentDetails
                }
            };

            #endregion

            #region  Places

            schoolImage = new AppImage
            {
                Source        = "star_gray",
                HeightRequest = placesImageHeight,
                WidthRequest  = placesImageHeight,
            };

            schoolLabel = new AppLabel
            {
                Text = "School",
                VerticalTextAlignment = TextAlignment.Center,
                FontSize = placesLabelFontSize,
            };

            schoolContent = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Children    =
                {
                    schoolImage, schoolLabel
                }
            };

            homeLabel = new AppLabel
            {
                Text = "Home",
                VerticalTextAlignment = TextAlignment.Center,
                FontSize = placesLabelFontSize,
            };

            homeImage = new AppImage
            {
                Source        = "star_gray",
                HeightRequest = placesImageHeight,
                WidthRequest  = placesImageWidth,
            };

            homeContent = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Children    =
                {
                    homeImage, homeLabel
                }
            };

            workLabel = new AppLabel
            {
                Text = "Work",
                VerticalTextAlignment = TextAlignment.Center,
                FontSize = placesLabelFontSize,
            };

            workImage = new AppImage
            {
                Source        = "star_gray",
                HeightRequest = placesImageHeight,
                WidthRequest  = placesImageWidth,
            };

            workContent = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Children    =
                {
                    workImage, workLabel
                }
            };


            moreStarredPlacesLabel = new AppTextCommand
            {
                Text = "More Starred Places",
                VerticalTextAlignment = TextAlignment.Center,
                FontSize = placesLabelFontSize,
            };

            moreStarredPlacesLabel.SetBinding(AppCommand.TextProperty, new Binding("MoreStarredPlaces", BindingMode.OneWay, null, null, null, AppLanguages.CurrentLanguage));

            moreStarredPlacesLabel.SetBinding(AppTextCommand.CommandProperty, "MoreStarredPlacesCommand");



            moreStarredPlacesImage = new AppImage
            {
                Source        = "star_gray",
                HeightRequest = placesImageHeight,
                WidthRequest  = placesImageWidth,
            };

            moreStarredPlacesContent = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Children    =
                {
                    moreStarredPlacesImage, moreStarredPlacesLabel
                }
            };


            placesWrapperContent = new StackLayout
            {
                Padding  = new Thickness(placesOffset, placesContentOffset, 0, 0),
                Children =
                {
                    schoolContent, homeContent, workContent, moreStarredPlacesContent
                }
            };

            placesContent = new StackLayout
            {
                Margin          = new Thickness(placesContentOffset, 0, placesContentOffset, 0),
                BackgroundColor = Color.White,
                HeightRequest   = placesHeight,
                Children        =
                {
                    placesWrapperContent
                }
            };

            #endregion


            #region Search



            searchListView = new ListView
            {
                Margin         = new Thickness(searchOffset, 0, searchOffset, 0),
                HasUnevenRows  = true,
                ItemTemplate   = new DataTemplate(typeof(SearchesTemplate)),
                ItemsSource    = SearchData.GetData(),
                SeparatorColor = Color.White,
            };

            searchListView.HasUnevenRows = true;



            morePreviousSerchesImage = new AppImage
            {
                Source        = "clock_gray",
                WidthRequest  = searchImageWidth,
                HeightRequest = searchImageHeight,
            };

            morePreviousSearchesLabel = new AppTextCommand
            {
                Text = "More Previous Searches"
            };

            morePreviousSearchesLabel.SetBinding(AppTextCommand.CommandProperty, "MoreStarredPlacesCommand");

            morePreviousSearchesContent = new StackLayout
            {
                Padding     = new Thickness(morePlacesSearchOffset, 0, 0, searchOffset),
                Orientation = StackOrientation.Horizontal,
                Children    =
                {
                    morePreviousSerchesImage, morePreviousSearchesLabel
                }
            };



            searchContent = new StackLayout
            {
                Margin          = new Thickness(searchOffset, 0, searchOffset, 0),
                BackgroundColor = Color.White,
                HeightRequest   = morePlacesHeight,
                Children        =
                {
                    searchListView, morePreviousSearchesContent
                }
            };



            #endregion

            finalContent = new StackLayout
            {
                Spacing = searchOffset,

                Children =
                {
                    searchPeopleContent, peopleListContent, currentLocationContent, placesContent, searchContent
                }
            };


            #endregion



            _scroll = new ScrollView
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill,
                Content           = finalContent
            };

            return(_scroll);
        }
예제 #2
0
        protected override View CreateContent()
        {
            this.BackgroundColor = Color.White;


            var navigationContentHeight = MainPage.PageHeight * 0.1;
            var mainLabelContentHeight  = MainPage.PageHeight * 0.3;
            var placesContentHeight     = MainPage.PageHeight * 0.38;
            var bottomMenuHeight        = MainPage.PageHeight * 0.18;


            var navigationTopOffset     = MainPage.PageHeight / 68.342;
            var navigationLabelFontSize = MainPage.PageHeight / 56.951;
            var arrowWidth  = MainPage.PageHeight / 34.171;
            var arrowHeight = MainPage.PageHeight / 34.171;

            var plusWidth         = MainPage.PageHeight / 34.171;
            var plusHeight        = MainPage.PageHeight / 34.171;
            var navigationPadding = MainPage.PageHeight / 68.342;


            var mainLabelFontSize  = MainPage.PageHeight / 45.561;
            var mainLabelTopOffset = MainPage.PageHeight / 68.342;
            var mainLabelPadding   = MainPage.PageHeight / 34.171;


            var placesListLabelFontSize = MainPage.PageHeight / 45.561;
            var placesListTopOffset     = MainPage.PageHeight / 34.171;

            var placesListImageHeight = MainPage.PageHeight / 45.561;
            var placesListImageWidth  = MainPage.PageHeight / 45.561;
            var placesListFontSize    = MainPage.PageHeight / 45.561;


            var bottomMenuIconHeight       = MainPage.PageHeight * 0.13;
            var bottomMenuIconWidth        = MainPage.PageWidth * 0.25;
            var bottomMenuIconBottomOffset = MainPage.PageHeight / 136.684;

            var bottomMenuImageHeight    = MainPage.PageHeight / 22.780;
            var bottomMenuImageWidth     = MainPage.PageWidth * 0.10;
            var bottomMenuImageTopOffset = MainPage.PageHeight * 0.03;

            var bottomMenuContentTopOffset = -MainPage.PageHeight * 0.09;

            var bottomMenuBackgroundImageHeight = MainPage.PageHeight * 0.10;
            var bottomMenuBackgroundImageWidth  = MainPage.PageWidth * 0.70;



            #region TopNavigationBar


            var arrow = new AppImageCommand
            {
                WidthRequest  = arrowWidth,
                HeightRequest = arrowHeight,
                Source        = "back"
            };

            arrow.SetBinding(AppImageCommand.CommandProperty, "BackCommand");

            var arrowContent = new ContentView
            {
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions   = LayoutOptions.End,

                //Padding = new Thickness(0, navigationTopOffset, 0, 0),
                Content = arrow
            };

            var navigationLabel = new AppLabel
            {
                AppFont               = AppFonts.Quicksand,
                FontSize              = navigationLabelFontSize,
                TextColor             = Color.White,
                VerticalTextAlignment = TextAlignment.Center
            };
            navigationLabel.SetBinding(AppLabel.TextProperty, new Binding("StarredPlacesNavigationTitleText", BindingMode.OneWay, null, null, null, AppLanguages.CurrentLanguage));


            var navigationLabelContent = new ContentView
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.End,

                //Padding = new Thickness(0, navigationTopOffset, 0, 0),
                Content = navigationLabel
            };

            var plus = new AppImageCommand
            {
                WidthRequest  = plusWidth,
                HeightRequest = plusHeight,
                Source        = "plus_gray"
            };

            plus.SetBinding(AppImageCommand.CommandProperty, "plusCommand");

            var plusContent = new ContentView
            {
                HorizontalOptions = LayoutOptions.EndAndExpand,
                //Padding = new Thickness(0, navigationTopOffset, 0, 0),
                Content         = plus,
                VerticalOptions = LayoutOptions.End,
            };

            var navigationContent = new StackLayout
            {
                BackgroundColor = Color.FromHex("#1BA4A8"),
                HeightRequest   = navigationContentHeight,
                Padding         = new Thickness(0, 0, 0, navigationPadding),
                Orientation     = StackOrientation.Horizontal,

                //Margin = new Thickness(0, 20, 0, 0),
                Children =
                {
                    arrowContent, navigationLabelContent, plusContent
                }
            };


            #endregion

            #region MainText

            var mainLabel = new AppLabel
            {
                HorizontalOptions       = LayoutOptions.Center,
                VerticalOptions         = LayoutOptions.CenterAndExpand,
                HorizontalTextAlignment = TextAlignment.Center,
                AppFont   = AppFonts.Quicksand,
                FontSize  = mainLabelFontSize,
                TextColor = Color.White
            };
            mainLabel.SetBinding(AppLabel.TextProperty, new Binding("StarredPlacesMainText", BindingMode.OneWay, null, null, null, AppLanguages.CurrentLanguage));


            var mainLabelContent = new StackLayout
            {
                BackgroundColor = Color.FromHex("#32848B"),
                HeightRequest   = mainLabelContentHeight,

                Padding  = new Thickness(mainLabelPadding, 0, mainLabelPadding, 0),
                Children =
                {
                    mainLabel
                }
            };


            #endregion



            #region Places List

            var placeListLabel = new AppLabel
            {
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions   = LayoutOptions.Start,
                AppFont           = AppFonts.Quicksand,
                FontSize          = placesListLabelFontSize,
            };
            placeListLabel.SetBinding(AppLabel.TextProperty, new Binding("StarredPlacesListTitleText", BindingMode.OneWay, null, null, null, AppLanguages.CurrentLanguage));


            var placeListContent = new StackLayout
            {
                HeightRequest = 20,
                //Padding = new Thickness(10, 0, 0, 0),
                Children =
                {
                    placeListLabel
                }
            };

            var schoolImage = new AppImage
            {
                Source        = "star_gray",
                HeightRequest = placesListImageHeight,
                WidthRequest  = placesListImageWidth,
            };

            var schoolLabel = new AppLabel
            {
                Text = "School",
                VerticalTextAlignment = TextAlignment.Center,
                FontSize = placesListFontSize,
            };

            var schoolContent = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Children    =
                {
                    schoolImage, schoolLabel
                }
            };

            var homeLabel = new AppLabel
            {
                Text = "Home",
                VerticalTextAlignment = TextAlignment.Center,
                FontSize = placesListFontSize,
            };

            var homeImage = new AppImage
            {
                Source        = "star_gray",
                HeightRequest = placesListImageHeight,
                WidthRequest  = placesListImageWidth,
            };

            var homeContent = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Children    =
                {
                    homeImage, homeLabel
                }
            };

            var workLabel = new AppLabel
            {
                Text = "Work",
                VerticalTextAlignment = TextAlignment.Center,
                FontSize = placesListFontSize,
            };

            var workImage = new AppImage
            {
                Source        = "star_gray",
                HeightRequest = placesListImageHeight,
                WidthRequest  = placesListImageWidth,
            };

            var workContent = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Children    =
                {
                    workImage, workLabel
                }
            };



            var addStarredPlacesLabel = new AppLabel
            {
                VerticalTextAlignment = TextAlignment.Center,
                FontSize = placesListLabelFontSize,

                AppFont = AppFonts.Quicksand,
            };
            addStarredPlacesLabel.SetBinding(AppLabel.TextProperty, new Binding("AddStarredPlacesLabel", BindingMode.OneWay, null, null, null, AppLanguages.CurrentLanguage));



            var addStarredPlacesImage = new AppImageCommand
            {
                Source        = "plus_gray",
                HeightRequest = placesListImageHeight,
                WidthRequest  = placesListImageWidth,
            };

            addStarredPlacesImage.SetBinding(AppImageCommand.CommandProperty, "AddStarredPlacesCommand");

            var addStarredPlacesContent = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Children    =
                {
                    addStarredPlacesImage, addStarredPlacesLabel
                }
            };


            var placesWrapperContent = new StackLayout
            {
                BackgroundColor = Color.White,

                Children =
                {
                    placeListContent, schoolContent, homeContent, workContent, addStarredPlacesContent
                }
            };

            var placesContent = new StackLayout
            {
                Padding = new Thickness(placesListTopOffset, placesListTopOffset, 0, 0),

                HeightRequest = placesContentHeight,
                Children      =
                {
                    placesWrapperContent
                }
            };


            #endregion



            #region  Bottom menu


            var icon = new AppImage
            {
                Source        = "emergency",
                HeightRequest = bottomMenuIconHeight,
                WidthRequest  = bottomMenuIconWidth,
            };

            var iconContent = new StackLayout
            {
                Padding           = new Thickness(0, 0, 0, bottomMenuIconBottomOffset),
                HorizontalOptions = LayoutOptions.Start,
                Orientation       = StackOrientation.Horizontal,
                Children          =
                {
                    icon
                }
            };

            var group = new AppImageCommand
            {
                Source        = "profile_gray",
                HeightRequest = bottomMenuImageHeight,
                WidthRequest  = bottomMenuImageWidth,
            };

            group.SetBinding(AppImageCommand.CommandProperty, "profileCommand");

            var groupContent = new StackLayout
            {
                VerticalOptions = LayoutOptions.EndAndExpand,
                Children        =
                {
                    group
                }
            };


            var location = new AppImageCommand
            {
                Source        = "home",
                HeightRequest = bottomMenuImageHeight,
                WidthRequest  = bottomMenuImageWidth,
            };

            location.SetBinding(AppImageCommand.CommandProperty, "locationCommand");

            var locationContent = new StackLayout
            {
                VerticalOptions = LayoutOptions.EndAndExpand,
                Children        =
                {
                    location
                }
            };

            var notification = new AppImageCommand
            {
                Source        = "bell_gray",
                HeightRequest = bottomMenuImageHeight,
                WidthRequest  = bottomMenuImageWidth,
            };

            notification.SetBinding(AppImageCommand.CommandProperty, "notificationCommand");

            var notificationContent = new StackLayout
            {
                VerticalOptions = LayoutOptions.EndAndExpand,
                Children        =
                {
                    notification
                }
            };

            var menuIcon = new AppImageCommand
            {
                Source        = "account_green",
                HeightRequest = bottomMenuImageHeight,

                WidthRequest = bottomMenuImageWidth,
            };

            menuIcon.SetBinding(AppImageCommand.CommandProperty, "menuCommand");

            var menuIconContent = new StackLayout
            {
                VerticalOptions = LayoutOptions.EndAndExpand,
                Children        =
                {
                    menuIcon
                }
            };

            var menuBackground = new Image
            {
                Aspect = Aspect.Fill,

                HeightRequest = bottomMenuBackgroundImageHeight,
                Source        = "Menu_Background"
            };

            var menuBackgroundContent = new StackLayout
            {
                VerticalOptions = LayoutOptions.EndAndExpand,
                Children        =
                {
                    menuBackground
                }
            };

            var bottomMenuContent = new StackLayout
            {
                Spacing           = 40,
                Padding           = new Thickness(0, 0, 10, 10),
                HorizontalOptions = LayoutOptions.EndAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                Orientation       = StackOrientation.Horizontal,
                HeightRequest     = bottomMenuHeight,
                Children          =
                {
                    groupContent, locationContent, notificationContent, menuIconContent
                }
            };

            var menuContent = new Grid
            {
                HeightRequest = 50,
                WidthRequest  = 360,

                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.End,
                RowSpacing        = 0,
                ColumnSpacing     = 0
            };
            menuContent.Children.Add(menuBackground);
            menuContent.Children.Add(bottomMenuContent);



            var menuContentFinal = new StackLayout
            {
                Spacing = -43,

                VerticalOptions = LayoutOptions.End,
                Orientation     = StackOrientation.Horizontal,
                Children        =
                {
                    iconContent, menuContent
                }
            };

            #endregion


            #region  Places



            var finalContent = new StackLayout
            {
                VerticalOptions = LayoutOptions.End,
                Spacing         = 0,
                Children        =
                {
                    navigationContent, mainLabelContent, placesContent, menuContentFinal
                }
            };


            #endregion



            _scroll = new ScrollView
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill,
                Content           = finalContent
            };

            return(_scroll);
        }