<commit_before>﻿using System;
using System.Linq;
using PartyUp.DependencyService;
using PartyUp.Model.Enum;
using PartyUp.Model.Model;
using Xamarin.Forms;
using Xamarin.Forms.Maps;

namespace PartyUp.CustomView
{
    public class PartyPreviewView : PreviewView
    {
        private readonly Party _party;

      

        public PartyPreviewView(Party party, double parentHeight, double parentWidth)
        { 
            BackgroundColor = Color.White;
             
            _party = party;
            //Title label
            var titleLabel = new Label {Text = party.Name};

            //Close label
            var closeLabel = new Label {Text = "Close", HorizontalOptions = LayoutOptions.Start};
            TapGestureRecognizer closeTapGestureRecognizer = new TapGestureRecognizer();
            closeLabel.GestureRecognizers.Add(closeTapGestureRecognizer);
            closeTapGestureRecognizer.Tapped += CloseTapGestureRecognizerOnTapped;
            var bla = Xamarin.Forms.DependencyService.Get<IUserLocationService>();
            Coordinates s = bla.GetUserCoordinates();
            //TODO Set coordinates, customize the map
            Map map = new Map(MapSpan.FromCenterAndRadius(
                new Position((double)s.Latitude, (double)s.Longitude), Distance.FromMiles(0.3)))
            {
                IsShowingUser = true
            };

            Grid layoutGrid = new Grid
            {
                RowDefinitions =
                {
                    new RowDefinition { Height = new GridLength(40, GridUnitType.Absolute) },
                    new RowDefinition { Height = new GridLength(parentWidth / 2, GridUnitType.Absolute) }
                },
                Children =
                {
                    titleLabel,
                    closeLabel,
                    {map, 0, 1 }
                }
            };
            Content = layoutGrid;

            //TODO Add more party information

            HeightRequest = layoutGrid.RowDefinitions.Sum(o => o.Height.Value);
        }

        private void CloseTapGestureRecognizerOnTapped(object sender, EventArgs eventArgs)
        {
            CloseView();
        } 
    }
}<commit_msg>Modify PartyPreviewPage<commit_after>﻿using System;
using System.Linq;
using PartyUp.DependencyService;
using PartyUp.Model.Enum;
using PartyUp.Model.Model;
using Xamarin.Forms;
using Xamarin.Forms.Maps;

namespace PartyUp.CustomView
{
    public class PartyPreviewView : PreviewView
    {
        private readonly Party _party;
        private readonly IUserLocationService _userLocationService = Xamarin.Forms.DependencyService.Get<IUserLocationService>();
        private readonly TapGestureRecognizer _closeTapGestureRecognizer = new TapGestureRecognizer();

        public PartyPreviewView(Party party, double parentHeight, double parentWidth)
        {
            BackgroundColor = Color.White;
            _party = party;
            //Title label
            var titleLabel = new Label {Text = party.Name};
            //Close label
            var closeLabel = new Label {Text = "Close", HorizontalOptions = LayoutOptions.Start};
            //Set TabGesture
            closeLabel.GestureRecognizers.Add(_closeTapGestureRecognizer);
            _closeTapGestureRecognizer.Tapped += CloseTapGestureRecognizerOnTapped;
            // TODO Shows the current Position
            Coordinates userCoordinates = _userLocationService.GetUserCoordinates();
            Map map = new Map(MapSpan.FromCenterAndRadius(
                new Position(userCoordinates.Latitude, userCoordinates.Longitude),
                Distance.FromMiles(0.3)))
            {
                IsShowingUser = true
            };

            var layoutGrid = new Grid
            {
                RowDefinitions =
                {
                    new RowDefinition {Height = new GridLength(40, GridUnitType.Absolute)},
                    new RowDefinition {Height = new GridLength(parentWidth/2, GridUnitType.Absolute)}
                },
                Children =
                {
                    titleLabel,
                    closeLabel,
                    {map, 0, 1}
                }
            };
            //TODO Implments informations
            var stackLayout = new StackLayout
            {
                Children =
                {
                    layoutGrid,
                    new Grid
                    {
                        ColumnDefinitions = new ColumnDefinitionCollection
                        {
                            new ColumnDefinition {Width = new GridLength(50, GridUnitType.Star)},
                            new ColumnDefinition {Width = new GridLength(50, GridUnitType.Star)},
                        },
                        Children =
                        {
                            {new Label
                            {
                                Text = "Name",
                                HorizontalOptions = LayoutOptions.Start,
                            },0,0},
                            {new Label
                            {
                                Text = _party.Name,
                                HorizontalOptions = LayoutOptions.End,
                            },1,0}
                        }
                    }
                }
            };

            HeightRequest = layoutGrid.RowDefinitions.Sum(o => o.Height.Value);
            Content = new ScrollView
            {
                Content = stackLayout
            };
        }

        private void CloseTapGestureRecognizerOnTapped(object sender, EventArgs eventArgs)
        {
            CloseView();
        }
    }
}
{'fraction_non_alphanumeric': 0.0691414496833216, 'fraction_numerical': 0.0038705137227304713, 'mean_word_length': 1.4088983050847457, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7580719', 'n_tokens_mistral': 1401, 'n_tokens_neox': 1285, 'n_words': 290}