<commit_before>﻿using System;
using App2Night.CustomView.View;
using App2Night.Model.Model;
using App2Night.ValueConverter;
using Xamarin.Forms;

namespace App2Night.CustomView.Template
{
    public class QuadraticPartyTemplate : Frame
    {
        #region Views
        Label _distanceLabel = new Label
        {
            TextColor = Color.White
        };

        Label _titleLabel = new Label()
        {
            FontSize = 20,
            HorizontalTextAlignment = TextAlignment.Start
        };

        CustomButton _likeButton = new CustomButton
        {
            Text = "\uf006",
            FontFamily = "FontAwesome",
            HorizontalOptions = LayoutOptions.End,
            VerticalOptions = LayoutOptions.Start,
            Margin = 10,
            FontSize = 50,
            ButtonLabel = {TextColor = Color.White}
        };

        CustomButton _shareIconLabel = new CustomButton
        {
            FontFamily = "FontAwesome",
            Text = "\uf1e0",
            HorizontalOptions = LayoutOptions.Center,
            Margin = new Thickness(8, 0),
            ButtonLabel = { FontSize = 35}
        };

        Image _image = new Image
        {
            Aspect = Aspect.AspectFill,
            InputTransparent = true,
            Source = ImageSource.FromResource("App2Night.Data.IconCode.icon.png"),
            IsOpaque = false
        };
        #endregion

        readonly TapGestureRecognizer _tapGestureRecognizer = new TapGestureRecognizer();
        private CommitmentState _commitmentState = CommitmentState.Rejected;
        public QuadraticPartyTemplate()
        {
            BackgroundColor = Color.White;
            Padding = 8;
            HasShadow = true;

            _titleLabel.SetBinding(Label.TextProperty, "Name");
            _distanceLabel.SetBinding(IsVisibleProperty, "Date", converter: new DateInFutureConverter());
            _shareIconLabel.SetBinding(IsVisibleProperty, "Date", converter: new DateInFutureConverter());
            _likeButton.SetBinding(IsVisibleProperty, "Date", converter: new DateInFutureConverter());

            _tapGestureRecognizer.Tapped += TappedLikeBtn;
            _likeButton.GestureRecognizers.Add(_tapGestureRecognizer);
            Content = CreateInputColumns();
        }

        private Grid CreateInputColumns()
        {
           return new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {Height = new GridLength(5, GridUnitType.Star)},
                    new RowDefinition {Height = new GridLength(1, GridUnitType.Star)}
                },
                Children =
                {
                    //_image,
                    new BoxView {Color = Color.Green.MultiplyAlpha(0.9), InputTransparent = true},
                    _distanceLabel,
                    _likeButton,
                    {new Grid
                    {
                        ColumnDefinitions = new ColumnDefinitionCollection
                        {
                           new ColumnDefinition { Width = new GridLength(5, GridUnitType.Star)},
                           new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star)},
                        },
                        Children =
                        {
                            {_titleLabel,0,0},
                            {_shareIconLabel,1,0}
                        }
                    },0,1}
                }
            };
        }

        /// <summary>
        /// Sets <see cref="_likeButton"/> to CommimentState. <commit_msg>Remove useless code.<commit_after>﻿using System;
using App2Night.CustomView.View;
using App2Night.Model.Model;
using App2Night.ValueConverter;
using Xamarin.Forms;

namespace App2Night.CustomView.Template
{
    public class QuadraticPartyTemplate : Frame
    {
        #region Views
        Label _distanceLabel = new Label
        {
            TextColor = Color.White
        };

        Label _titleLabel = new Label()
        {
            FontSize = 20,
            HorizontalTextAlignment = TextAlignment.Start
        };

        CustomButton _likeButton = new CustomButton
        {
            Text = "\uf006",
            FontFamily = "FontAwesome",
            HorizontalOptions = LayoutOptions.End,
            VerticalOptions = LayoutOptions.Start,
            Margin = 10,
            FontSize = 50,
            ButtonLabel = {TextColor = Color.White}
        };

        CustomButton _shareIconLabel = new CustomButton
        {
            FontFamily = "FontAwesome",
            Text = "\uf1e0",
            HorizontalOptions = LayoutOptions.Center,
            Margin = new Thickness(8, 0),
            ButtonLabel = { FontSize = 35}
        };
        #endregion

        readonly TapGestureRecognizer _tapGestureRecognizer = new TapGestureRecognizer();
        private CommitmentState _commitmentState = CommitmentState.Rejected;
        public QuadraticPartyTemplate()
        {
            BackgroundColor = Color.White;
            Padding = 8;
            HasShadow = true;

            _titleLabel.SetBinding(Label.TextProperty, "Name");
            _distanceLabel.SetBinding(IsVisibleProperty, "Date", converter: new DateInFutureConverter());
            _shareIconLabel.SetBinding(IsVisibleProperty, "Date", converter: new DateInFutureConverter());
            _likeButton.SetBinding(IsVisibleProperty, "Date", converter: new DateInFutureConverter());

            _tapGestureRecognizer.Tapped += TappedLikeBtn;
            _likeButton.GestureRecognizers.Add(_tapGestureRecognizer);
            Content = CreateInputColumns();
        }

        private Grid CreateInputColumns()
        {
           return new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {Height = new GridLength(5, GridUnitType.Star)},
                    new RowDefinition {Height = new GridLength(1, GridUnitType.Star)}
                },
                Children =
                {
                    new BoxView {Color = Color.Green.MultiplyAlpha(0.9), InputTransparent = true},
                    _distanceLabel,
                    _likeButton,
                    {new Grid
                    {
                        ColumnDefinitions = new ColumnDefinitionCollection
                        {
                           new ColumnDefinition { Width = new GridLength(5, GridUnitType.Star)},
                           new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star)},
                        },
                        Children =
                        {
                            {_titleLabel,0,0},
                            {_shareIconLabel,1,0}
                        }
                    },0,1}
                }
            };
        }

        /// <summary>
        /// Sets <see cref="_likeButton"/> to CommimentState. 
{'fraction_non_alphanumeric': 0.07754049018202666, 'fraction_numerical': 0.009316325068080836, 'mean_word_length': 1.5073661516349264, 'pattern_counts': {'":': 0, '<': 7, '<?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': '6987207', 'n_tokens_mistral': 1766, 'n_tokens_neox': 1602, 'n_words': 345}