/*void Handle_Activated(object sender, System.EventArgs e){ * * if (FontButton.currentSize == 2) * { * FontButton.currentSize = 0; * } * else * { * FontButton.currentSize += 1; * } * * fontSetting.Text = "Font: " + FontButton.textSize[FontButton.currentSize + 1].ToString(); * * SetAboutTextSize(); * * MessagingCenter.Send(Application.Current, "Hi"); * * }*/ /*void Handle_Activated(object sender, System.EventArgs e){ * * FontButton.Handle_Activated(); * * SetAboutSize(); * * }*/ void SetAboutSize() { AboutUsTitle.FontSize = Device.GetNamedSize(FontButton.GetTextSize(1), typeof(Label)); AboutLabel.FontSize = Device.GetNamedSize(FontButton.GetTextSize(0), typeof(Label)); FindUsLabel.FontSize = Device.GetNamedSize(FontButton.GetTextSize(1), typeof(Label)); AddressLabel.FontSize = Device.GetNamedSize(FontButton.GetTextSize(0), typeof(Label)); ContactUsLabel.FontSize = Device.GetNamedSize(FontButton.GetTextSize(1), typeof(Label)); OfficeHoursTitle.FontSize = Device.GetNamedSize(FontButton.GetTextSize(0), typeof(Label)); OfficeHoursLabel.FontSize = Device.GetNamedSize(FontButton.GetTextSize(0), typeof(Label)); NumberLabel.FontSize = Device.GetNamedSize(FontButton.GetTextSize(0), typeof(Label)); TimesTitle.FontSize = Device.GetNamedSize(FontButton.GetTextSize(1), typeof(Label)); TimesLabel.FontSize = Device.GetNamedSize(FontButton.GetTextSize(0), typeof(Label)); switch (FontButton.GetTextSize(0)) { case NamedSize.Micro: Pastor.HeightRequest = 125; break; case NamedSize.Small: Pastor.HeightRequest = 150; break; case NamedSize.Medium: Pastor.HeightRequest = 175; break; default: Pastor.HeightRequest = 150; break; } }
void SetSizes() { Thanks.FontSize = Device.GetNamedSize(FontButton.GetTextSize(0), typeof(Label)); TabsTitle.FontSize = Device.GetNamedSize(FontButton.GetTextSize(1), typeof(Label)); Tabs.FontSize = Device.GetNamedSize(FontButton.GetTextSize(0), typeof(Label)); Home.FontSize = Device.GetNamedSize(FontButton.GetTextSize(0), typeof(Label)); Notes.FontSize = Device.GetNamedSize(FontButton.GetTextSize(0), typeof(Label)); News.FontSize = Device.GetNamedSize(FontButton.GetTextSize(0), typeof(Label)); Videos.FontSize = Device.GetNamedSize(FontButton.GetTextSize(0), typeof(Label)); FontChangeTitle.FontSize = Device.GetNamedSize(FontButton.GetTextSize(1), typeof(Label)); FontChange.FontSize = Device.GetNamedSize(FontButton.GetTextSize(0), typeof(Label)); Dismiss.FontSize = Device.GetNamedSize(FontButton.GetTextSize(0), typeof(Label)); //FontImage.Scale = (1 + (FontButton.currentSize * 0.01)); switch (FontButton.currentSize) { case 0: FontImage.Margin = 5; break; case 1: FontImage.Margin = 10; break; case 2: FontImage.Margin = 15; break; default: FontImage.Margin = 10; break; } switch (FontButton.currentSize) { case 0: tutHome.HeightRequest = 45; tutNotes.HeightRequest = 45; tutNews.HeightRequest = 45; tutVideos.HeightRequest = 45; FontImage.HeightRequest = 25; FontImage.WidthRequest = 25; FontImageStack.HeightRequest = 40; FontImageStack.WidthRequest = 40; break; case 1: tutHome.HeightRequest = 55; tutNotes.HeightRequest = 55; tutNews.HeightRequest = 55; tutVideos.HeightRequest = 55; FontImage.HeightRequest = 35; FontImage.WidthRequest = 35; FontImageStack.HeightRequest = 50; FontImageStack.WidthRequest = 50; break; case 2: tutHome.HeightRequest = 65; tutNotes.HeightRequest = 65; tutNews.HeightRequest = 65; tutVideos.HeightRequest = 65; FontImage.HeightRequest = 45; FontImage.WidthRequest = 45; FontImageStack.HeightRequest = 60; FontImageStack.WidthRequest = 60; break; default: tutHome.HeightRequest = 55; tutNotes.HeightRequest = 55; tutNews.HeightRequest = 55; tutVideos.HeightRequest = 55; FontImage.HeightRequest = 35; FontImage.WidthRequest = 35; FontImageStack.HeightRequest = 50; FontImageStack.WidthRequest = 50; break; } }
void SetSizes(int btnHeight) { Welcome.FontSize = Device.GetNamedSize(FontButton.GetTextSize(1), typeof(Label)); WelcomeLabel.FontSize = Device.GetNamedSize(FontButton.GetTextSize(0), typeof(Label)); connectLabel.FontSize = Device.GetNamedSize(FontButton.GetTextSize(1), typeof(Label)); btnAboutUs.FontSize = Device.GetNamedSize(FontButton.GetTextSize(0), typeof(Button)); btnLocation.FontSize = Device.GetNamedSize(FontButton.GetTextSize(0), typeof(Button)); btnAboutUs.HeightRequest = btnHeight + (FontButton.currentSize * 5); btnLocation.HeightRequest = btnHeight + (FontButton.currentSize * 5); btnFBlogo.Scale = 1 + (FontButton.currentSize * 0.1); btnJBClogo.Scale = 1 + (FontButton.currentSize * 0.1); }
public YoutubeViewPage() { new FontButton(this); Title = "Youtube"; var youtubeViewModel = new YoutubeViewModel(); BindingContext = youtubeViewModel; /*var label = new Label * { * Text = "Youtube", * TextColor = Color.Gray, * FontSize = 24 * };*/ var dataTemplate = new DataTemplate(() => { var channelTitleLabel = new Label { TextColor = Color.Maroon, FontSize = Device.GetNamedSize(FontButton.GetTextSize(1), typeof(Label)) }; var titleLabel = new Label { TextColor = Color.Black, FontSize = Device.GetNamedSize(FontButton.GetTextSize(0), typeof(Label)) }; var descriptionLabel = new Label { TextColor = Color.Gray, FontSize = Device.GetNamedSize(FontButton.GetTextSize(-1), typeof(Label)) }; /*var viewCountLabel = new Label * { * TextColor = Color.FromHex("#0D47A1"), * FontSize = 14 * }; * var likeCountLabel = new Label * { * TextColor = Color.FromHex("#2196F3"), * FontSize = 14 * }; * var dislikeCountLabel = new Label * { * TextColor = Color.FromHex("#0D47A1"), * FontSize = 14 * }; * var favoriteCountLabel = new Label * { * TextColor = Color.FromHex("#2196F3"), * FontSize = 14 * }; * var commentCountLabel = new Label * { * TextColor = Color.FromHex("#0D47A1"), * FontSize = 14 * };*/ var mediaImage = new Image { HeightRequest = GetImageHeight(FontButton.GetTextSize(0)) }; /*MessagingCenter.Subscribe<Application>(this, "Hi", (sender) => { * * channelTitleLabel.FontSize = Device.GetNamedSize(FontButton.GetTextSize(1), typeof(Label)); * * titleLabel.FontSize = Device.GetNamedSize(FontButton.GetTextSize(0), typeof(Label)); * * descriptionLabel.FontSize = Device.GetNamedSize(FontButton.GetTextSize(-1), typeof(Label)); * * mediaImage.HeightRequest = GetImageHeight(FontButton.GetTextSize(0)); * * });*/ channelTitleLabel.SetBinding(Label.TextProperty, new Binding("ChannelTitle")); titleLabel.SetBinding(Label.TextProperty, new Binding("Title")); descriptionLabel.SetBinding(Label.TextProperty, new Binding("Description")); mediaImage.SetBinding(Image.SourceProperty, new Binding("HighThumbnailUrl")); /*viewCountLabel.SetBinding(Label.TextProperty, new Binding("ViewCount", BindingMode.Default, null, null, "{0:n0} views")); * likeCountLabel.SetBinding(Label.TextProperty, new Binding("LikeCount", BindingMode.Default, null, null, "{0:n0} likes")); * dislikeCountLabel.SetBinding(Label.TextProperty, new Binding("DislikeCount", BindingMode.Default, null, null, "{0:n0} dislike")); * commentCountLabel.SetBinding(Label.TextProperty, new Binding("CommentCount", BindingMode.Default, null, null, "{0:n0} comments")); * favoriteCountLabel.SetBinding(Label.TextProperty, new Binding("FavoriteCount", BindingMode.Default, null, null, "{0:n0} favorite"));*/ var viewCell = new ViewCell { View = new StackLayout { BackgroundColor = Color.FromHex("#e6e6e6"), Children = { new Frame { BackgroundColor = Color.FromHex("#FFFFFF"), CornerRadius = 2, HasShadow = false, Margin = new Thickness(10, 5, 10, 5), Content = new StackLayout { VerticalOptions = LayoutOptions.Center, Orientation = StackOrientation.Horizontal, //Padding = new Thickness(0, 0, 0, 20), Children = { //channelTitleLabel, /*new StackLayout * { * Orientation = StackOrientation.Horizontal, * Children = * { * viewCountLabel, * likeCountLabel, * dislikeCountLabel, * } * }, * new StackLayout * { * Orientation = StackOrientation.Horizontal, * TranslationY = -7, * Children = * { * favoriteCountLabel, * commentCountLabel * } * },*/ mediaImage, new StackLayout { Padding = new Thickness(10, 0, 0, 0), VerticalOptions = LayoutOptions.Center, Orientation = StackOrientation.Vertical, Children = { titleLabel, descriptionLabel } } } } } } } }; MessagingCenter.Subscribe <Application>(this, "Hi", (sender) => { channelTitleLabel.FontSize = Device.GetNamedSize(FontButton.GetTextSize(1), typeof(Label)); titleLabel.FontSize = Device.GetNamedSize(FontButton.GetTextSize(0), typeof(Label)); descriptionLabel.FontSize = Device.GetNamedSize(FontButton.GetTextSize(-1), typeof(Label)); mediaImage.HeightRequest = GetImageHeight(FontButton.GetTextSize(0)); viewCell.ForceUpdateSize(); }); return(viewCell); }); var listView = new ListView { HasUnevenRows = true }; listView.SetBinding(ListView.ItemsSourceProperty, "YoutubeItems"); listView.ItemTemplate = dataTemplate; listView.ItemTapped += ListViewOnItemTapped; //listView.SeparatorColor = Color.Gray; listView.SeparatorVisibility = SeparatorVisibility.None; listView.BackgroundColor = Color.FromHex("#e6e6e6"); Content = new StackLayout { Children = { //label, listView } }; }
//public ObservableCollection<Data> AccountItems = new ObservableCollection<Data>(); public News() { new FontButton(this); /* * FacebookViewModel fbItems = new FacebookViewModel(); * BindingContext = fbItems; * InitializeComponent(); * * var itemsListView = new ListView(); * itemsListView.ItemsSource = fbItems; * Content = itemsListView; * * * /* * ButtonGetItems.Clicked += async (sender, e) => * { * ButtonGetItems.IsEnabled = false; * GetAccountItemsAsync(); * ButtonGetItems.IsEnabled = true; * };*//* * } * } * } */ var facebookViewModel = new FacebookViewModel(); BindingContext = facebookViewModel; var dataTemplate = new DataTemplate(() => { var messageLabel = new Label { TextColor = Color.Black, FontSize = Device.GetNamedSize(FontButton.GetTextSize(0), typeof(Label)) }; var created_timeLabel = new Label { TextColor = Color.Gray, FontSize = Device.GetNamedSize(FontButton.GetTextSize(0), typeof(Label)) }; var fbMediaImage = new Image { HeightRequest = GetImageHeight(FontButton.GetTextSize(0)), WidthRequest = GetImageHeight(FontButton.GetTextSize(0)) }; /* * var channelTitleLabel = new Label * { * TextColor = Color.Maroon, * FontSize = 22 * * }; * var titleLabel = new Label * { * TextColor = Color.Black, * FontSize = 16 * }; * var descriptionLabel = new Label * { * TextColor = Color.Gray, * FontSize = 14 * };*/ messageLabel.SetBinding(Label.TextProperty, new Binding("Message")); created_timeLabel.SetBinding(Label.TextProperty, new Binding("Created_Time")); fbMediaImage.SetBinding(Image.SourceProperty, new Binding("Picture")); var viewCell = new ViewCell { View = new StackLayout { BackgroundColor = Color.FromHex("#e6e6e6"), Children = { new Frame { BackgroundColor = Color.FromHex("#FFFFFF"), CornerRadius = 2, HasShadow = false, Margin = new Thickness(10, 5, 10, 5), Padding = new Thickness(20, 8, 20, 8), Content = new StackLayout { VerticalOptions = LayoutOptions.Center, Orientation = StackOrientation.Horizontal, //Padding = new Thickness(0, 10, 0, 10), Children = { fbMediaImage, new StackLayout { Padding = new Thickness(10, 0, 0, 0), VerticalOptions = LayoutOptions.Center, Orientation = StackOrientation.Vertical, Children = { messageLabel, new StackLayout { HorizontalOptions = LayoutOptions.FillAndExpand, Orientation = StackOrientation.Vertical, Children = { created_timeLabel, } } } } } } } } } }; MessagingCenter.Subscribe <Application>(this, "Hi", (sender) => { messageLabel.FontSize = Device.GetNamedSize(FontButton.GetTextSize(0), typeof(Label)); created_timeLabel.FontSize = Device.GetNamedSize(FontButton.GetTextSize(0), typeof(Label)); fbMediaImage.HeightRequest = GetImageHeight(FontButton.GetTextSize(0)); fbMediaImage.WidthRequest = GetImageHeight(FontButton.GetTextSize(0)); viewCell.ForceUpdateSize(); }); return(viewCell); }); var listView = new ListView { HasUnevenRows = true }; listView.SetBinding(ListView.ItemsSourceProperty, new Binding("FacebookItems")); listView.ItemTemplate = dataTemplate; //listView.ItemTapped += ListViewOnItemTapped; //listView.SeparatorColor = Color.Gray; listView.SeparatorVisibility = SeparatorVisibility.None; listView.BackgroundColor = Color.FromHex("#e6e6e6"); Content = new StackLayout { //Padding = new Thickness(5, 10), Children = { //label, listView } }; }