public ArticleFrame() { this.Visual = VisualMarker.Material; this.HeightRequest = 60; this.CornerRadius = 20; this.HeadlineLabel = new PartemLabelBold { Text = "The quick brown fox jumped over the lazy dog.", FontSize = 15, LineBreakMode = LineBreakMode.TailTruncation, MaxLines = 2 }; this.HeadlineLabel.SetBinding(Label.TextProperty, new Binding("Headline")); this.SourceLabel = new PartemLabelLight { Text = "Roblox.com", FontSize = 13 }; this.SourceLabel.SetBinding(Label.TextProperty, new Binding("Source")); this.ArticleImage = new CachedImage { Source = ImageSource.FromResource("Error.png"), HeightRequest = 35, WidthRequest = 35, Aspect = Aspect.AspectFill, ErrorPlaceholder = ImageSource.FromResource("Error.png"), CacheDuration = TimeSpan.FromDays(1), DownsampleToViewSize = true, RetryCount = 0, RetryDelay = 250, }; //this.ArticleImage.SetBinding(CachedImage.SourceProperty, new Binding("ArticleImage")); this.Content = new Grid { RowDefinitions = { new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(0.7, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(0.3, GridUnitType.Star) } }, Children = { { new StackLayout { Children = { this.HeadlineLabel, this.SourceLabel } }, 0, 0 }, { this.ArticleImage, 1, 0 } }, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center }; }
public ResultFrame() { this.Visual = VisualMarker.Material; Margin = new Thickness(20, 25, 20, 10); CornerRadius = 20; this.TitleLabel = new PartemLabelBold { Text = "Here's what we found:", LineBreakMode = Xamarin.Forms.LineBreakMode.WordWrap }; this.BiasIcon = new BiasIcon(); this.BiasLabel = new PartemLabelBold { Text = "Center", VerticalOptions = LayoutOptions.Center, FontSize = 35 }; this.ArticleFrame = new ArticleFrame(); this.BiasStatementLabel = new PartemLabelLight { Text = "Using the power of AI, we determined that this article contains little to no bias.", LineBreakMode = Xamarin.Forms.LineBreakMode.WordWrap, Margin = new Thickness(0, 0, 0, 15) }; this.GraphLabel = new PartemLabelLight { Text = "Here’s how confident we are on each bias side:", LineBreakMode = Xamarin.Forms.LineBreakMode.WordWrap }; this.Graph = new ConfidenceGraph(); this.ShareButton = new SfButton { Text = "Share", FontFamily = Device.RuntimePlatform == Device.iOS ? "Nexa-Bold" : null, FontSize = 20, TextColor = Color.White, CornerRadius = 20, HeightRequest = 50, BackgroundGradient = new SfLinearGradientBrush { GradientStops = { new SfGradientStop { Color = Color.FromHex("#2980B9"), Offset = 0 }, new SfGradientStop { Color = Color.FromHex("#6DD5FA"), Offset = 0.5 }, new SfGradientStop { Color = Color.FromHex("#DDF4FC"), Offset = 1 } } }, HasShadow = true, }; this.Content = new StackLayout { Children = { this.TitleLabel, new StackLayout { Orientation = StackOrientation.Horizontal, Children = { this.BiasIcon, this.BiasLabel } }, this.ArticleFrame, this.BiasStatementLabel, this.GraphLabel, this.Graph, this.ShareButton } }; this.BindingContextChanged += ResultFrame_BindingContextChanged; }
public AnalyzeFrame() { this.Visual = VisualMarker.Material; this.CornerRadius = 20; this.DirectionsLabel = new PartemLabelLight { Text = "Enter the Url of an article to analyze its political bias.", Margin = new Thickness(0, 0, 0, 15), LineBreakMode = Xamarin.Forms.LineBreakMode.WordWrap }; this.URLTextBox = new SfTextInputLayout { Hint = "Article Url", InputView = new Entry(), Margin = new Thickness(0, 0, 0, 15), Visual = VisualMarker.Default, HintLabelStyle = new LabelStyle { FontFamily = Device.RuntimePlatform == Device.iOS ? "Nexa-Light" : null, FontSize = 20 }, ErrorText = "Entered Url is invalid." }; this.AnalyzeButton = new SfButton { Text = "Analyze", FontFamily = Device.RuntimePlatform == Device.iOS ? "Nexa-Bold" : null, FontSize = 20, TextColor = Color.White, CornerRadius = 20, HeightRequest = 50, BackgroundGradient = new SfLinearGradientBrush { GradientStops = { new SfGradientStop { Color = Color.FromHex("#12C2E9"), Offset = 0 }, new SfGradientStop { Color = Color.FromHex("#C471ED"), Offset = 0.5 }, new SfGradientStop { Color = Color.FromHex("#F64F59"), Offset = 1 } } }, HasShadow = true, }; Content = new StackLayout { Children = { this.DirectionsLabel, this.URLTextBox, this.AnalyzeButton } }; Padding = new Thickness(20, 40); Margin = new Thickness(20, 10, 20, 10); }