Exemplo n.º 1
0
        private void CurrentLocationTapped(object sender, EventArgs e)
        {
            if (!_isNearByExpanded)
            {
                return;
            }

            var pageHeight = Height;

            var isLocationLabelVisible = LblLocation.IsVisible;

            var recentLocationStackSize      = RecentLocationStack.Measure(double.PositiveInfinity, double.PositiveInfinity);
            var currentAndRecentLocationSize = CurrentAndRecentLocationStack.Measure(double.PositiveInfinity, double.PositiveInfinity);
            var suggestionHeight             = LocationSuggestionStack.Measure(double.PositiveInfinity, double.PositiveInfinity);

            var suggestionMinHeight = Height * 0.28;
            var heighToBeSet        = Math.Max(suggestionMinHeight, suggestionHeight.Request.Height);

            LocationSuggestionStack.HeightRequest = heighToBeSet;

            var locationStackSize   = LocationStack.Measure(double.PositiveInfinity, double.PositiveInfinity);
            var locationStackHeight = Math.Max(currentAndRecentLocationSize.Request.Height + heighToBeSet + 90, locationStackSize.Request.Height);

            FrNearBy.TranslateTo(0, pageHeight - ((pageHeight * _topPosition) + (isLocationLabelVisible ? 71 : 0)), AppThemeConstants.AnimationSpeed, Easing.SinInOut);
            Thickness bottomGridMargin = BottomContainerGrid.Margin;

            bottomGridMargin.Bottom   += isLocationLabelVisible ? -71 : 71;
            BottomContainerGrid.Margin = bottomGridMargin;

            System.Diagnostics.Debug.WriteLine($"Location Stack Height : {locationStackHeight}, {isLocationLabelVisible}");
            if (isLocationLabelVisible)
            {
                LblLocation.TranslateTo(-80, 30, AppThemeConstants.AnimationSpeed, Easing.SinInOut);
                LblLocationSymbol.TranslateTo(-80, 30, AppThemeConstants.AnimationSpeed, Easing.SinInOut);
                SvBottomContainer.TranslateTo(0, locationStackHeight, AppThemeConstants.AnimationSpeed, Easing.SinInOut);
                LblLocation.IsVisible = false;
                LocationStack.Animate("ShowLocationStack", (x) =>
                {
                    LocationStack.HeightRequest = locationStackHeight * x;
                });
                LocationWithZipCodeStack.TranslateTo(0, 0, AppThemeConstants.AnimationSpeed, Easing.SinInOut);
            }
            else
            {
                LocationWithZipCodeStack.TranslateTo(80, -30, AppThemeConstants.AnimationSpeed, Easing.SinInOut);
                SvBottomContainer.TranslateTo(0, 0, AppThemeConstants.AnimationSpeed, Easing.SinInOut);
                LocationStack.Animate("HideLocationStack", (x) =>
                {
                    LocationStack.HeightRequest = locationStackHeight * (1 - x);
                }, finished: (x, y) =>
                {
                    System.Diagnostics.Debug.WriteLine($"Finished callback : {x}, {y}");
                    LblLocation.IsVisible = true;
                });
                LblLocationSymbol.TranslateTo(0, 0, AppThemeConstants.AnimationSpeed, Easing.SinInOut);
                LblLocation.TranslateTo(0, 0, AppThemeConstants.AnimationSpeed, Easing.SinInOut);
            }
        }
Exemplo n.º 2
0
        private void ShowCurrentAndRecentLocationStack()
        {
            CurrentAndRecentLocationStack.IsVisible = true;
            var currentAndRecentLocationSize = CurrentAndRecentLocationStack.Measure(double.PositiveInfinity, double.PositiveInfinity);

            var heightToBeSet = Math.Max(currentAndRecentLocationSize.Request.Height, _currentAndRecentLocationStackSizeRequest.Request.Height);

            CurrentAndRecentLocationStack.Animate("ShowCurrentAndRecentLocationStack", (x) =>
            {
                CurrentAndRecentLocationStack.HeightRequest = heightToBeSet * x;
            }, length: AppThemeConstants.AnimationSpeed, easing: Easing.SinInOut);
        }
Exemplo n.º 3
0
        private void HideCurrentAndRecentLocationStack()
        {
            var currentAndRecentLocationSize = CurrentAndRecentLocationStack.Measure(double.PositiveInfinity, double.PositiveInfinity);

            if (currentAndRecentLocationSize.Request.Height > _currentAndRecentLocationStackSizeRequest.Request.Height)
            {
                _currentAndRecentLocationStackSizeRequest = currentAndRecentLocationSize;
            }

            CurrentAndRecentLocationStack.Animate("HideCurrentAndRecentLocationStack", (x) =>
            {
                CurrentAndRecentLocationStack.HeightRequest = currentAndRecentLocationSize.Request.Height * (1 - x);
            }, length: AppThemeConstants.AnimationSpeed, easing: Easing.SinInOut, finished: (x, y) =>
            {
                CurrentAndRecentLocationStack.IsVisible = false;
            });
        }