private void ChangeIcon(Android.Widget.ImageButton imageButton, int id) { if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Lollipop) { imageButton.SetImageDrawable(Context.GetDrawable(id)); } imageButton.SetImageResource(id); }
protected override void OnElementChanged(ElementChangedEventArgs <Image> e) { base.OnElementChanged(e); if (this.Control == null) { var imageView = new Android.Widget.ImageButton(Context); this.SetNativeControl(imageView); } Control.Touch += OnTouch; }
// Constructors public ListEntryViewHolder(View itemView, ListActivity <T> activity, ListAdapter <T> adapter) : base(itemView) { this.activity = activity; this.adapter = adapter; itemView.SetOnClickListener(this); itemView.SetOnLongClickListener(this); // Assign local references to GUI elements Label = itemView.FindViewById <TextView>(Resource.Id.ListEntryNameLbl); PopupButton = itemView.FindViewById <ImageButton>(Resource.Id.ListEntryPopupBtn); // Assign events to GUI elements PopupButton.Click += PopupButton_Click; }
/// <summary> /// Sets the navigation arrows. /// </summary> private void SetNavigationArrows() { if (_leftArrow == null) { _leftArrow = _containerView.FindViewById <Android.Widget.ImageButton>(Resource.Id.left_arrow); _leftArrow.Click += (object sender, EventArgs e) => { SelectMonth(_picker.CurrentItem - 1, true); }; } if (_rightArrow == null) { _rightArrow = _containerView.FindViewById <Android.Widget.ImageButton>(Resource.Id.right_arrow); _rightArrow.Click += (object sender, EventArgs e) => { SelectMonth(_picker.CurrentItem + 1, true); }; } if (Element.ShowNavigationArrows) { _rightArrow.Visibility = _picker.CurrentItem + 1 != _picker.MonthCount ? ViewStates.Visible : ViewStates.Invisible; _leftArrow.Visibility = _picker.CurrentItem != 0 ? ViewStates.Visible : ViewStates.Invisible; } else { _leftArrow.Visibility = ViewStates.Gone; _rightArrow.Visibility = ViewStates.Gone; } }
private void BuildPageObjects() { var btnSize = Device.GetNamedSize(NamedSize.Large, typeof(Button)); var lblSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)); var entrySize = Device.GetNamedSize(NamedSize.Large, typeof(Entry)); stackLayout = new StackLayout(); entryLayout = new StackLayout(); buttonGrid = new Grid { RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } }, ColumnDefinitions = new ColumnDefinitionCollection { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) } } }; #if __ANDROID__ var pd = new PaintDrawable(Android.Graphics.Color.Rgb(58, 93, 174)); pd.SetCornerRadius(100); outerGrid = new Grid { RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } } }; innerGrid = new Grid { RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } } }; androidHeaderLbl = new Android.Widget.TextView(MainApplication.ActivityContext); androidHeaderLbl.Text = "Forgot Password"; androidHeaderLbl.Typeface = Constants.COMMONFONT; androidHeaderLbl.SetTextSize(Android.Util.ComplexUnitType.Fraction, 100); androidHeaderLbl.SetTextColor(Android.Graphics.Color.Black); androidHeaderLbl.Gravity = Android.Views.GravityFlags.Center; androidEmailLbl = new Android.Widget.TextView(MainApplication.ActivityContext); androidEmailLbl.Text = "E-Mail Address"; androidEmailLbl.Typeface = Constants.COMMONFONT; androidEmailLbl.SetTextSize(Android.Util.ComplexUnitType.Fraction, 100); androidEmailLbl.SetTextColor(Android.Graphics.Color.Black); androidEmailLbl.Gravity = Android.Views.GravityFlags.Center; androidEmailEntry = new Android.Widget.EditText(MainApplication.ActivityContext); androidEmailEntry.Hint = "Enter E-Mail"; androidEmailEntry.Typeface = Constants.COMMONFONT; androidEmailEntry.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75); androidEmailEntry.SetTextColor(Android.Graphics.Color.Black); androidEmailEntry.Gravity = Android.Views.GravityFlags.Center; androidEmailEntry.InputType = Android.Text.InputTypes.TextVariationEmailAddress; androidNextBtn = new Android.Widget.Button(MainApplication.ActivityContext); androidNextBtn.Text = "Next"; androidNextBtn.Typeface = Constants.COMMONFONT; androidNextBtn.SetAutoSizeTextTypeWithDefaults(Android.Widget.AutoSizeTextType.Uniform); androidNextBtn.SetTextColor(Android.Graphics.Color.Rgb(242, 253, 255)); androidNextBtn.Gravity = Android.Views.GravityFlags.Center; androidNextBtn.SetBackground(pd); androidNextBtn.Click += async(object sender, EventArgs e) => { ToggleButtons(); await CheckIfUserExists(sender, e); ToggleButtons(); }; androidNextImgBtn = new Android.Widget.ImageButton(MainApplication.ActivityContext); androidNextImgBtn.SetImageResource(2130837802); androidNextImgBtn.SetAdjustViewBounds(true); androidNextImgBtn.SetBackground(pd); androidNextImgBtn.Click += async(object sender, EventArgs e) => { ToggleButtons(); await CheckIfUserExists(sender, e); ToggleButtons(); }; contentViewHeaderLbl = new ContentView(); contentViewHeaderLbl.Content = androidHeaderLbl.ToView(); contentViewEmailLbl = new ContentView(); contentViewEmailLbl.Content = androidEmailLbl.ToView(); contentViewEmailEntry = new ContentView(); contentViewEmailEntry.Content = androidEmailEntry.ToView(); contentViewNextBtn = new ContentView(); contentViewNextBtn.Content = androidNextImgBtn.ToView(); #endif headerLbl = new Label { Text = "Forgot Password", #if __IOS__ FontFamily = "AmericanTypewriter-Bold", FontSize = lblSize * 1.5, #endif #if __ANDROID__ FontFamily = "Roboto Bold", FontSize = lblSize, #endif VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center, VerticalOptions = LayoutOptions.StartAndExpand }; emailLbl = new Label { Text = "E-Mail Address", #if __IOS__ FontFamily = "AmericanTypewriter-Bold", FontSize = lblSize * 1.5, #endif #if __ANDROID__ FontFamily = "Roboto Bold", FontSize = lblSize * .75, #endif VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center }; emailEntry = new Entry { #if __IOS__ FontFamily = "AmericanTypewriter-Bold", FontSize = entrySize * 1.25, #endif #if __ANDROID__ FontFamily = "Roboto Bold", FontSize = entrySize * .75, #endif Placeholder = "Enter E-Mail" }; backBtn = new Button { Image = "back.png", Style = (Style)Application.Current.Resources["common-red-btn"] }; nextBtn = new Button { Style = (Style)Application.Current.Resources["common-blue-btn"], Image = "next.png", VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; //events backBtn.Clicked += async(object sender, EventArgs e) => { ToggleButtons(); await Navigation.PopModalAsync(); ToggleButtons(); }; nextBtn.Clicked += async(object sender, EventArgs e) => { ToggleButtons(); await CheckIfUserExists(sender, e); ToggleButtons(); }; //building layouts #if __ANDROID__ innerGrid.Children.Add(contentViewHeaderLbl, 0, 0); innerGrid.Children.Add(contentViewEmailLbl, 0, 3); innerGrid.Children.Add(contentViewEmailEntry, 0, 4); innerGrid.Children.Add(contentViewNextBtn, 0, 7); outerGrid.Children.Add(innerGrid, 0, 0); Content = outerGrid; #endif #if __IOS__ buttonGrid.Children.Add(backBtn, 0, 0); buttonGrid.Children.Add(nextBtn, 1, 0); entryLayout.Children.Add(emailLbl); entryLayout.Children.Add(emailEntry); entryLayout.HorizontalOptions = LayoutOptions.FillAndExpand; entryLayout.VerticalOptions = LayoutOptions.FillAndExpand; stackLayout.Children.Add(headerLbl); stackLayout.Children.Add(entryLayout); stackLayout.Children.Add(buttonGrid); Content = stackLayout; #endif }
//Functions public void SetContent(Video video, PlayList playlist) { var lblSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)); var btnSize = Device.GetNamedSize(NamedSize.Large, typeof(Button)); //view objects #if __IOS__ innerGrid = new Grid { RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = new GridLength(4, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(4, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } }, ColumnDefinitions = new ColumnDefinitionCollection { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) } } }; #endif #if __ANDROID__ innerGrid = new Grid { RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = new GridLength(4, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(5, GridUnitType.Star) } } }; buttonGrid = new Grid { ColumnDefinitions = new ColumnDefinitionCollection { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) } } }; #endif outerGrid = new Grid { RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } } }; #if __ANDROID__ var pd = new PaintDrawable(Android.Graphics.Color.Rgb(58, 93, 174)); pd.SetCornerRadius(100); var pdRed = new PaintDrawable(Android.Graphics.Color.Red); pdRed.SetCornerRadius(100); androidVideoNameLbl = new Android.Widget.TextView(MainApplication.ActivityContext); androidVideoNameLbl.Text = video.Name; androidVideoNameLbl.Typeface = Constants.COMMONFONT; androidVideoNameLbl.SetTextSize(Android.Util.ComplexUnitType.Fraction, 100); androidVideoNameLbl.SetTextColor(Android.Graphics.Color.AntiqueWhite); androidVideoNameLbl.Gravity = Android.Views.GravityFlags.Center; androidVideoNameLbl.SetTypeface(androidVideoNameLbl.Typeface, Android.Graphics.TypefaceStyle.Bold); androidVideoDescriptionLbl = new Android.Widget.TextView(MainApplication.ActivityContext); androidVideoDescriptionLbl.Text = video.Description; androidVideoDescriptionLbl.Typeface = Constants.COMMONFONT; androidVideoDescriptionLbl.SetTextSize(Android.Util.ComplexUnitType.Fraction, 50); androidVideoDescriptionLbl.SetTextColor(Android.Graphics.Color.Black); androidVideoDescriptionLbl.Gravity = Android.Views.GravityFlags.Start; androidPlayImgBtn = new Android.Widget.ImageButton(MainApplication.ActivityContext); androidPlayImgBtn.SetAdjustViewBounds(true); androidPlayImgBtn.SetImageResource(2130837817); androidPlayImgBtn.SetBackground(pd); androidPlayImgBtn.Click += async(object sender, EventArgs e) => { ToggleButtons(); await PlayAndroidVideo(sender, e); ToggleButtons(); }; androidImgDeleteBtn = new Android.Widget.ImageButton(MainApplication.ActivityContext); androidImgDeleteBtn.SetAdjustViewBounds(true); androidImgDeleteBtn.SetImageResource(2130837823); androidImgDeleteBtn.SetBackground(pdRed); androidImgDeleteBtn.Click += async(object sender, EventArgs e) => { ToggleButtons(); await DeleteFromPlaylist(sender, e); ToggleButtons(); }; androidQualityBtn = new Android.Widget.Button(MainApplication.ActivityContext); androidQualityBtn.Text = "SD"; androidQualityBtn.Typeface = Constants.COMMONFONT; androidQualityBtn.SetAutoSizeTextTypeWithDefaults(Android.Widget.AutoSizeTextType.Uniform); androidQualityBtn.SetTextColor(Android.Graphics.Color.Rgb(242, 253, 255)); androidQualityBtn.SetBackground(pd); androidQualityBtn.Gravity = Android.Views.GravityFlags.Center; androidQualityBtn.SetAllCaps(false); androidQualityBtn.Click += async(object sender, EventArgs e) => { ToggleButtons(); await ChangeVideoQuality(sender, e); ToggleButtons(); }; contentViewNameLbl = new ContentView(); contentViewNameLbl.Content = androidVideoNameLbl.ToView(); contentViewDescriptionLbl = new ContentView(); contentViewDescriptionLbl.Content = androidVideoDescriptionLbl.ToView(); contentViewPlayBtn = new ContentView(); contentViewPlayBtn.Content = androidPlayImgBtn.ToView(); contentViewDeleteBtn = new ContentView(); contentViewDeleteBtn.Content = androidImgDeleteBtn.ToView(); contentViewQualityBtn = new ContentView(); contentViewQualityBtn.Content = androidQualityBtn.ToView(); #endif backBtn = new Button { Style = (Style)Application.Current.Resources["common-red-btn"], Image = "back.png" }; videoNameLbl = new Label { Text = video.Name, FontFamily = "AmericanTypewriter-Bold", FontSize = lblSize, VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center, TextColor = Color.White }; videoDescription = new Label { Text = video.Description, FontFamily = "AmericanTypewriter-Bold", VerticalTextAlignment = TextAlignment.Start, HorizontalTextAlignment = TextAlignment.Start, FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), LineBreakMode = LineBreakMode.WordWrap, }; videoDescriptionScrollView = new ScrollView { Padding = 0, Orientation = ScrollOrientation.Vertical, #if __ANDROID__ Content = contentViewDescriptionLbl, IsClippedToBounds = true #endif #if __IOS__ Content = videoDescription, #endif }; videoImage = new Image { Source = video.Image, Aspect = Aspect.AspectFill }; videoFrame = new Frame { Content = videoImage, BorderColor = Color.Black, BackgroundColor = Color.Black, HasShadow = false, Padding = 3 }; playBtn = new Button { Style = (Style)Application.Current.Resources["common-blue-btn"], Image = "play.png" }; deleteBtn = new Button { Style = (Style)Application.Current.Resources["common-delete-btn"] }; qualityBtn = new Button { Style = (Style)Application.Current.Resources["common-blue-btn"], Text = "SD", FontFamily = "AmericanTypewriter-Bold", FontSize = btnSize * 2, }; //Events backBtn.Clicked += async(object sender, EventArgs e) => { ToggleButtons(); await Navigation.PopModalAsync(); ToggleButtons(); }; deleteBtn.Clicked += async(object sender, EventArgs e) => { ToggleButtons(); await DeleteFromPlaylist(sender, e); ToggleButtons(); }; qualityBtn.Clicked += async(object sender, EventArgs e) => { ToggleButtons(); await ChangeVideoQuality(sender, e); ToggleButtons(); }; #if __IOS__ playBtn.Clicked += PlayIOSVideo; #endif #if __ANDROID__ //building grid buttonGrid.Children.Add(contentViewPlayBtn, 0, 0); buttonGrid.Children.Add(contentViewDeleteBtn, 1, 0); buttonGrid.Children.Add(contentViewQualityBtn, 2, 0); innerGrid.Children.Add(videoFrame, 0, 0); innerGrid.Children.Add(contentViewNameLbl, 0, 0); innerGrid.Children.Add(buttonGrid, 0, 1); //XAMARIN BUG - ADDING SCROLLVIEW BEFORE OTHER ELEMENTS WILL CAUSE CONTENTS TO OVERFLOW.. ADD TO END OF LAYOUT.. innerGrid.Children.Add(videoDescriptionScrollView, 0, 2); #endif #if __IOS__ //building grid innerGrid.Children.Add(videoFrame, 0, 0); Grid.SetColumnSpan(videoFrame, 4); innerGrid.Children.Add(videoNameLbl, 0, 0); Grid.SetColumnSpan(videoNameLbl, 4); innerGrid.Children.Add(playBtn, 0, 1); Grid.SetColumnSpan(playBtn, 3); innerGrid.Children.Add(qualityBtn, 3, 1); innerGrid.Children.Add(videoDescriptionScrollView, 0, 2); Grid.SetColumnSpan(videoDescriptionScrollView, 4); innerGrid.Children.Add(deleteBtn, 3, 3); innerGrid.Children.Add(backBtn, 0, 3); Grid.SetColumnSpan(backBtn, 3); #endif outerGrid.Children.Add(innerGrid, 0, 0); Content = outerGrid; }
//functions private void SetContent() { var btnSize = Device.GetNamedSize(NamedSize.Large, typeof(Button)); var lblSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)); var entrySize = Device.GetNamedSize(NamedSize.Large, typeof(Entry)); //View objects beltLbl = new Label { Text = "Belt", #if __IOS__ FontFamily = "AmericanTypewriter-Bold", FontSize = lblSize * 1.5, #endif #if __ANDROID__ FontFamily = "Roboto Bold", FontSize = lblSize, Margin = new Thickness(0, -5, 0, -5), #endif VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; beltList = new ObservableCollection <string>(); beltList.Add("White"); beltList.Add("Blue"); beltList.Add("Purple"); beltList.Add("Brown"); beltList.Add("Black"); beltPicker = new Picker { Title = "Choose Your Rank", ItemsSource = beltList }; nameLbl = new Label { #if __IOS__ FontFamily = "AmericanTypewriter-Bold", FontSize = lblSize * 1.5, #endif #if __ANDROID__ FontFamily = "Roboto Bold", FontSize = lblSize, Margin = new Thickness(0, -5, 0, -5), #endif Text = "Name", VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; nameEntry = new Entry { #if __IOS__ FontFamily = "AmericanTypewriter-Bold", FontSize = entrySize, #endif #if __ANDROID__ FontFamily = "Roboto Bold", FontSize = entrySize * .5, Margin = new Thickness(0, -5, 0, -5), #endif Placeholder = "Brian Mahecha", VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; emailAddressLbl = new Label { #if __IOS__ FontFamily = "AmericanTypewriter-Bold", FontSize = lblSize * 1.5, #endif #if __ANDROID__ FontFamily = "Roboto Bold", FontSize = lblSize, Margin = new Thickness(0, -5, 0, -5), #endif Text = "E-Mail Address", VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; emailAddressEntry = new Entry { #if __IOS__ FontFamily = "AmericanTypewriter-Bold", FontSize = entrySize, #endif #if __ANDROID__ FontFamily = "Roboto Bold", Margin = new Thickness(0, -5, 0, -5), FontSize = entrySize * .5, #endif Placeholder = "*****@*****.**", VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; passWordLbl = new Label { #if __IOS__ FontFamily = "AmericanTypewriter-Bold", FontSize = lblSize * 1.5, #endif #if __ANDROID__ FontFamily = "Roboto Bold", Margin = new Thickness(0, -5, 0, -5), FontSize = lblSize, #endif Text = "Password", VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; passWordEntry = new Entry { #if __IOS__ FontFamily = "AmericanTypewriter-Bold", FontSize = entrySize, #endif #if __ANDROID__ FontFamily = "Roboto Bold", Margin = new Thickness(0, -5, 0, -5), FontSize = entrySize * .5, #endif IsPassword = true, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; secretQuestionLbl = new Label { #if __IOS__ FontFamily = "AmericanTypewriter-Bold", FontSize = lblSize * 1.5, #endif #if __ANDROID__ FontFamily = "Roboto Bold", Margin = new Thickness(0, -5, 0, -5), FontSize = lblSize, #endif Text = "Secret Questions", VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; secretQuestionList = new ObservableCollection <String>(); secretQuestionList.Add("What city were you born in?"); secretQuestionList.Add("What city was your high school?"); secretQuestionList.Add("Name of favorite instructor."); secretQuestionPicker = new Picker { Title = "Select a secret question to answer!", ItemsSource = secretQuestionList }; secretQuestionEntry = new Entry { #if __IOS__ FontFamily = "AmericanTypewriter-Bold", FontSize = entrySize, #endif #if __ANDROID__ FontFamily = "Roboto Bold", Margin = new Thickness(0, -5, 0, -5), FontSize = entrySize * .5, #endif Placeholder = "Answer for your own security!", VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; nextBtn = new Button { Style = (Style)Application.Current.Resources["common-blue-btn"], Image = "next.png", VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; backBtn = new Button { Style = (Style)Application.Current.Resources["common-red-btn"], Image = "back.png", VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; clearBtn = new Button { Style = (Style)Application.Current.Resources["common-red-btn"], #if __IOS__ FontFamily = "AmericanTypewriter-Bold", #endif #if __ANDROID__ FontFamily = "Roboto Bold", #endif Text = "Clear", FontSize = btnSize }; #if __ANDROID__ var pd = new PaintDrawable(Android.Graphics.Color.Rgb(58, 93, 174)); pd.SetCornerRadius(100); androidNameEntry = new Android.Widget.EditText(MainApplication.ActivityContext); androidNameEntry.Hint = "Name"; androidNameEntry.Typeface = Constants.COMMONFONT; androidNameEntry.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75); androidNameEntry.SetTextColor(Android.Graphics.Color.Black); androidNameEntry.Gravity = Android.Views.GravityFlags.Start; androidNameEntry.InputType = Android.Text.InputTypes.TextVariationPersonName; androidBeltLbl = new Android.Widget.TextView(MainApplication.ActivityContext); androidBeltLbl.Text = "Belt"; androidBeltLbl.Typeface = Constants.COMMONFONT; androidBeltLbl.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75); androidBeltLbl.SetTextColor(Android.Graphics.Color.Black); androidBeltLbl.Gravity = Android.Views.GravityFlags.Start; androidEmailAddressEntry = new Android.Widget.EditText(MainApplication.ActivityContext); androidEmailAddressEntry.Hint = "E-Mail Address"; androidEmailAddressEntry.Typeface = Constants.COMMONFONT; androidEmailAddressEntry.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75); androidEmailAddressEntry.SetTextColor(Android.Graphics.Color.Black); androidEmailAddressEntry.Gravity = Android.Views.GravityFlags.Start; androidEmailAddressEntry.InputType = Android.Text.InputTypes.TextVariationEmailAddress; androidPassWordEntry = new Android.Widget.EditText(MainApplication.ActivityContext); androidPassWordEntry.Hint = "Password"; androidPassWordEntry.Typeface = Constants.COMMONFONT; androidPassWordEntry.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75); androidPassWordEntry.SetTextColor(Android.Graphics.Color.Black); androidPassWordEntry.Gravity = Android.Views.GravityFlags.Start; androidPassWordEntry.InputType = Android.Text.InputTypes.TextVariationPassword; androidPassWordEntry.TransformationMethod = new PasswordTransformationMethod(); androidSecretQuestionsLbl = new Android.Widget.TextView(MainApplication.ActivityContext); androidSecretQuestionsLbl.Text = "Secret Questions"; androidSecretQuestionsLbl.Typeface = Constants.COMMONFONT; androidSecretQuestionsLbl.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75); androidSecretQuestionsLbl.SetTextColor(Android.Graphics.Color.Black); androidSecretQuestionsLbl.Gravity = Android.Views.GravityFlags.Start; androidSecretQuestionEntry = new Android.Widget.EditText(MainApplication.ActivityContext); androidSecretQuestionEntry.Hint = "Answer for your own security!"; androidSecretQuestionEntry.Typeface = Constants.COMMONFONT; androidSecretQuestionEntry.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75); androidSecretQuestionEntry.SetTextColor(Android.Graphics.Color.Black); androidSecretQuestionEntry.Gravity = Android.Views.GravityFlags.Start; androidSecretQuestionEntry.InputType = Android.Text.InputTypes.TextVariationShortMessage; androidNextImgBtn = new Android.Widget.ImageButton(MainApplication.ActivityContext); androidNextImgBtn.SetImageResource(2130837802); androidNextImgBtn.SetAdjustViewBounds(true); androidNextImgBtn.SetBackground(pd); androidNextImgBtn.Click += async(object sender, EventArgs e) => { ToggleButtons(); await Validate(); ToggleButtons(); }; #endif //Events nextBtn.Clicked += async(object sender, EventArgs e) => { ToggleButtons(); await Validate(); ToggleButtons(); }; backBtn.Clicked += async(object sender, EventArgs e) => { ToggleButtons(); await Navigation.PopModalAsync(); ToggleButtons(); }; //passWordRepeatEntry.Unfocused += PasswordMatch; //TODO add specific validation events to make sure entries are correct. tableView = new TableView(); tableView.BackgroundColor = Color.FromHex("#F1ECCE"); tableView.Intent = TableIntent.Form; tableView.Root = new TableRoot() { new TableSection() { new ViewCell { View = nameLbl }, new ViewCell { View = nameEntry }, new ViewCell { View = emailAddressLbl }, new ViewCell { View = emailAddressEntry }, new ViewCell { View = beltLbl }, new ViewCell { View = beltPicker }, new ViewCell { View = passWordLbl }, new ViewCell { View = passWordEntry }, new ViewCell { View = secretQuestionLbl }, new ViewCell { View = secretQuestionPicker }, new ViewCell { View = secretQuestionEntry } } }; #if __IOS__ buttonGrid = new Grid { RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } }, ColumnDefinitions = new ColumnDefinitionCollection { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) } } }; buttonGrid.Children.Add(backBtn, 0, 0); buttonGrid.Children.Add(nextBtn, 1, 0); #endif #if __ANDROID__ buttonGrid = new Grid { RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } } }; buttonGrid.Children.Add(androidNextImgBtn.ToView(), 0, 0); #endif scrollView = new ScrollView(); #if __IOS__ stackLayout = new StackLayout { Children = { tableView } }; #endif #if __ANDROID__ stackLayout = new StackLayout { Children = { androidNameEntry.ToView(), androidEmailAddressEntry.ToView(), androidBeltLbl.ToView(), beltPicker, androidPassWordEntry.ToView(), androidSecretQuestionsLbl.ToView(), secretQuestionPicker, androidSecretQuestionEntry.ToView() } }; #endif scrollView.Content = stackLayout; #if __ANDROID__ scrollView.IsClippedToBounds = true; #endif #if __IOS__ innerGrid = new Grid { RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = new GridLength(9, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } } }; #endif #if __ANDROID__ innerGrid = new Grid { RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = new GridLength(9, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } } }; #endif outerGrid = new Grid { RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } } }; innerGrid.Children.Add(scrollView, 0, 0); innerGrid.Children.Add(buttonGrid, 0, 1); outerGrid.Children.Add(innerGrid); Content = outerGrid; }
//functions private void BuildPageObjects() { var btnSize = Device.GetNamedSize(NamedSize.Large, typeof(Button)); var lblSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)); var entrySize = Device.GetNamedSize(NamedSize.Large, typeof(Entry)); scrollView = new ScrollView(); stackLayout = new StackLayout(); buttonLayout = new StackLayout(); emailLayout = new StackLayout(); passwordLayout = new StackLayout(); innerStackLayout = new StackLayout(); innerStackLayout.Spacing = 50; //View objects innerGrid = new Grid { RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = new GridLength(7, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(2, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(2, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(2, GridUnitType.Star) } } }; outerGrid = new Grid { RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } } }; buttonGrid = new Grid { ColumnDefinitions = new ColumnDefinitionCollection { new ColumnDefinition { Width = new GridLength(3, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) } } }; emailGrid = new Grid { RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } }, ColumnDefinitions = new ColumnDefinitionCollection { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(3, GridUnitType.Star) } } }; passwordGrid = new Grid { RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } }, ColumnDefinitions = new ColumnDefinitionCollection { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(3, GridUnitType.Star) } } }; mahechaLogo = new Image { Source = ImageSource.FromResource("mahechabjjlogo.png"), Aspect = Aspect.AspectFit }; emailImg = new Image { Source = "mail.png", Aspect = Aspect.AspectFit }; emailLbl = new Label { Text = "E-Mail Address", #if __IOS__ FontFamily = "AmericanTypewriter-Bold", FontSize = lblSize * 2, #endif #if __ANDROID__ FontFamily = "Roboto Bold", FontSize = lblSize, Margin = -5, #endif VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center }; emailEntry = new Entry { #if __IOS__ FontFamily = "AmericanTypewriter-Bold", #endif #if __ANDROID__ FontFamily = "Roboto Bold", Placeholder = "E-Mail Address", #endif FontSize = entrySize, HorizontalOptions = LayoutOptions.FillAndExpand }; passwordImg = new Image { Source = "password.png", Aspect = Aspect.AspectFit }; passwordLbl = new Label { Text = "Password", #if __IOS__ FontFamily = "AmericanTypewriter-Bold", FontSize = lblSize * 2, #endif #if __ANDROID__ FontFamily = "Roboto Bold", FontSize = lblSize, Margin = -5, #endif VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center }; passwordEntry = new Entry { IsPassword = true, #if __IOS__ FontFamily = "AmericanTypewriter-Bold", #endif #if __ANDROID__ FontFamily = "Roboto Bold", Placeholder = "Password", #endif FontSize = entrySize, HorizontalOptions = LayoutOptions.FillAndExpand }; loginBtn = new Button { Text = "Login", FontFamily = "AmericanTypewriter-Bold", FontSize = btnSize * 2, Style = (Style)Application.Current.Resources["common-blue-btn"], VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; backBtn = new Button { Image = "back.png", Style = (Style)Application.Current.Resources["common-red-btn"], VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; forgotPasswordBtn = new Button { Image = "forgotpassword.png", Style = (Style)Application.Current.Resources["common-blue-btn"], VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; #if __ANDROID__ var pd = new PaintDrawable(Android.Graphics.Color.Rgb(58, 93, 174)); pd.SetCornerRadius(100); var pdTwo = new PaintDrawable(Android.Graphics.Color.Rgb(124, 37, 41)); pdTwo.SetCornerRadius(100); androidLoginBtn = new Android.Widget.Button(MainApplication.ActivityContext); androidLoginBtn.Text = "Login"; androidLoginBtn.Typeface = Constants.COMMONFONT; androidLoginBtn.SetAutoSizeTextTypeWithDefaults(Android.Widget.AutoSizeTextType.Uniform); androidLoginBtn.SetBackground(pd); androidLoginBtn.SetTextColor(Android.Graphics.Color.Rgb(242, 253, 255)); androidLoginBtn.Gravity = Android.Views.GravityFlags.Center; androidLoginBtn.SetAllCaps(false); androidForgotPasswordBtn = new Android.Widget.Button(MainApplication.ActivityContext); androidForgotPasswordBtn.Text = "?"; androidForgotPasswordBtn.Typeface = Constants.COMMONFONT; androidForgotPasswordBtn.SetAutoSizeTextTypeWithDefaults(Android.Widget.AutoSizeTextType.Uniform); androidForgotPasswordBtn.SetBackground(pdTwo); androidForgotPasswordBtn.SetTextColor(Android.Graphics.Color.Rgb(242, 253, 255)); androidForgotPasswordBtn.Gravity = Android.Views.GravityFlags.Center; androidForgotPasswordBtn.SetAllCaps(false); androidForgetPasswordImgBtn = new Android.Widget.ImageButton(MainApplication.ActivityContext); androidForgetPasswordImgBtn.SetImageResource(2130837598); androidForgetPasswordImgBtn.SetAdjustViewBounds(true); androidForgetPasswordImgBtn.SetBackground(pdTwo); androidEmailEntry = new Android.Widget.EditText(MainApplication.ActivityContext); androidEmailEntry.Typeface = Constants.COMMONFONT; androidEmailEntry.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75); androidEmailEntry.SetPadding(0, 10, 0, 10); androidEmailEntry.SetTextColor(Android.Graphics.Color.Black); androidEmailEntry.InputType = Android.Text.InputTypes.TextVariationEmailAddress; androidImageEmail = new Android.Widget.ImageView(MainApplication.ActivityContext); androidImageEmail.SetImageResource(2130837780); androidImageEmail.SetAdjustViewBounds(true); androidPasswordEntry = new Android.Widget.EditText(MainApplication.ActivityContext); androidPasswordEntry.Typeface = Constants.COMMONFONT; androidPasswordEntry.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75); androidPasswordEntry.SetPadding(0, 0, 0, 0); androidPasswordEntry.SetTextColor(Android.Graphics.Color.Black); androidPasswordEntry.SetHighlightColor(Android.Graphics.Color.Transparent); androidPasswordEntry.InputType = Android.Text.InputTypes.TextVariationWebPassword; androidPasswordEntry.TransformationMethod = new PasswordTransformationMethod(); androidImagePassword = new Android.Widget.ImageView(MainApplication.ActivityContext); androidImagePassword.SetImageResource(2130837816); androidImagePassword.SetAdjustViewBounds(true); #endif //Events loginBtn.Clicked += async(object sender, EventArgs e) => { ToggleButtons(); await Validate(sender, e); ToggleButtons(); }; backBtn.Clicked += async(object sender, EventArgs e) => { ToggleButtons(); await Navigation.PopModalAsync(); ToggleButtons(); }; forgotPasswordBtn.Clicked += async(object sender, EventArgs e) => { ToggleButtons(); await Navigation.PushModalAsync(new ForgotPasswordPage()); ToggleButtons(); }; #if __ANDROID__ androidLoginBtn.Click += async(object sender, EventArgs e) => { ToggleButtons(); await Validate(sender, e); ToggleButtons(); }; androidForgetPasswordImgBtn.Click += async(object sender, EventArgs e) => { ToggleButtons(); await Navigation.PushModalAsync(new ForgotPasswordPage()); ToggleButtons(); }; #endif #if __IOS__ buttonLayout.Children.Add(backBtn); buttonLayout.Children.Add(loginBtn); buttonLayout.Children.Add(forgotPasswordBtn); buttonLayout.Orientation = StackOrientation.Horizontal; emailLayout.Children.Add(emailImg); emailLayout.Children.Add(emailEntry); emailLayout.Orientation = StackOrientation.Horizontal; passwordLayout.Children.Add(passwordImg); passwordLayout.Children.Add(passwordEntry); passwordLayout.Orientation = StackOrientation.Horizontal; innerStackLayout.Children.Add(emailLayout); innerStackLayout.Children.Add(passwordLayout); //innerStackLayout.Children.Add(emailImg); //innerStackLayout.Children.Add(emailEntry); //innerStackLayout.Children.Add(passwordImg); //innerStackLayout.Children.Add(passwordEntry); innerStackLayout.Children.Add(buttonLayout); stackLayout.Children.Add(mahechaLogo); stackLayout.Children.Add(innerStackLayout); stackLayout.Orientation = StackOrientation.Vertical; stackLayout.VerticalOptions = LayoutOptions.CenterAndExpand; stackLayout.HorizontalOptions = LayoutOptions.CenterAndExpand; scrollView.Content = stackLayout; Content = scrollView; #endif #if __ANDROID__ buttonGrid.Children.Add(androidLoginBtn.ToView(), 0, 0); buttonGrid.Children.Add(androidForgetPasswordImgBtn.ToView(), 1, 0); emailGrid.Children.Add(androidImageEmail.ToView(), 0, 0); emailGrid.Children.Add(androidEmailEntry.ToView(), 1, 0); emailGrid.Padding = new Thickness(10, 0); passwordGrid.Children.Add(androidImagePassword.ToView(), 0, 0); passwordGrid.Children.Add(androidPasswordEntry.ToView(), 1, 0); passwordGrid.Padding = new Thickness(10, 0); innerGrid.Children.Add(mahechaLogo, 0, 0); innerGrid.Children.Add(emailGrid, 0, 2); innerGrid.Children.Add(passwordGrid, 0, 4); innerGrid.Children.Add(buttonGrid, 0, 6); outerGrid.Children.Add(innerGrid, 0, 0); Content = outerGrid; #endif }
public void SetContent() { var lblSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)); var btnSize = Device.GetNamedSize(NamedSize.Large, typeof(Button)); //view objects #if __IOS__ innerGrid = new Grid { RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = new GridLength(4, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(3, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } }, ColumnDefinitions = new ColumnDefinitionCollection { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) } } }; #endif #if __ANDROID__ innerGrid = new Grid { RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = new GridLength(4, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(4, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } } }; if (userHasAccount) { buttonGrid = new Grid { ColumnDefinitions = new ColumnDefinitionCollection { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) } } }; } else { buttonGrid = new Grid { ColumnDefinitions = new ColumnDefinitionCollection { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) } } }; } #endif outerGrid = new Grid { RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } } }; #if __ANDROID__ var pd = new PaintDrawable(Android.Graphics.Color.Rgb(58, 93, 174)); pd.SetCornerRadius(100); androidVideoNameLbl = new Android.Widget.TextView(MainApplication.ActivityContext); androidVideoNameLbl.Text = videoTechnique.name; androidVideoNameLbl.Typeface = Constants.COMMONFONT; androidVideoNameLbl.SetTextSize(Android.Util.ComplexUnitType.Fraction, 100); androidVideoNameLbl.SetTextColor(Android.Graphics.Color.Rgb(241, 236, 206)); androidVideoNameLbl.Gravity = Android.Views.GravityFlags.Center; androidVideoNameLbl.SetTypeface(androidVideoNameLbl.Typeface, Android.Graphics.TypefaceStyle.Bold); androidVideoDescriptionLbl = new Android.Widget.TextView(MainApplication.ActivityContext); androidVideoDescriptionLbl.Text = videoTechnique.description; androidVideoDescriptionLbl.Typeface = Constants.COMMONFONT; androidVideoDescriptionLbl.SetTextSize(Android.Util.ComplexUnitType.Fraction, 50); androidVideoDescriptionLbl.SetTextColor(Android.Graphics.Color.Black); androidVideoDescriptionLbl.Gravity = Android.Views.GravityFlags.Start; androidPlayImgBtn = new Android.Widget.ImageButton(MainApplication.ActivityContext); androidPlayImgBtn.SetAdjustViewBounds(true); androidPlayImgBtn.SetImageResource(2130837817); androidPlayImgBtn.SetBackground(pd); androidPlayImgBtn.Click += async(object sender, EventArgs e) => { ToggleButtons(); await PlayAndroidVideo(sender, e); ToggleButtons(); }; androidAddBtn = new Android.Widget.Button(MainApplication.ActivityContext); androidAddBtn.Text = "+"; androidAddBtn.Typeface = Constants.COMMONFONT; androidAddBtn.SetAutoSizeTextTypeWithDefaults(Android.Widget.AutoSizeTextType.Uniform); androidAddBtn.SetTextColor(Android.Graphics.Color.Rgb(242, 253, 255)); androidAddBtn.SetBackground(pd); androidAddBtn.Gravity = Android.Views.GravityFlags.Center; androidAddBtn.SetAllCaps(false); androidAddBtn.Click += async(object sender, EventArgs e) => { ToggleButtons(); await AddVideoToPlaylist(sender, e); ToggleButtons(); }; androidQualityBtn = new Android.Widget.Button(MainApplication.ActivityContext); androidQualityBtn.Text = "SD"; androidQualityBtn.Typeface = Constants.COMMONFONT; androidQualityBtn.SetAutoSizeTextTypeWithDefaults(Android.Widget.AutoSizeTextType.Uniform); androidQualityBtn.SetTextColor(Android.Graphics.Color.Rgb(242, 253, 255)); androidQualityBtn.SetBackground(pd); androidQualityBtn.Gravity = Android.Views.GravityFlags.Center; androidQualityBtn.SetAllCaps(false); androidQualityBtn.Click += async(object sender, EventArgs e) => { ToggleButtons(); await ChangeVideoQuality(sender, e); ToggleButtons(); }; contentViewNameLbl = new ContentView(); contentViewNameLbl.Content = androidVideoNameLbl.ToView(); contentViewDescriptionLbl = new ContentView(); contentViewDescriptionLbl.Content = androidVideoDescriptionLbl.ToView(); contentViewPlayBtn = new ContentView(); contentViewPlayBtn.Content = androidPlayImgBtn.ToView(); contentViewAddBtn = new ContentView(); contentViewAddBtn.Content = androidAddBtn.ToView(); contentViewQualityBtn = new ContentView(); contentViewQualityBtn.Content = androidQualityBtn.ToView(); #endif backBtn = new Button { Image = "back.png", Style = (Style)Application.Current.Resources["common-red-btn"] }; videoNameLbl = new Label { Style = (Style)Application.Current.Resources["common-technique-lbl"], Text = videoTechnique.name, #if __IOS__ FontFamily = "AmericanTypewriter-Bold", FontSize = lblSize, #endif #if __ANDROID__ FontFamily = "Roboto Bold", FontSize = lblSize * .75, #endif }; videoDescription = new Label { Text = videoTechnique.description, #if __IOS__ FontFamily = "AmericanTypewriter-Bold", FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), #endif #if __ANDROID__ FontFamily = "Roboto Bold", FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), TextColor = Color.Black, #endif VerticalTextAlignment = TextAlignment.Start, HorizontalTextAlignment = TextAlignment.Start, LineBreakMode = LineBreakMode.WordWrap, }; videoDescriptionScrollView = new ScrollView { Padding = 0, #if __ANDROID__ Content = contentViewDescriptionLbl, IsClippedToBounds = true, #endif #if __IOS__ Content = videoDescription, #endif Orientation = ScrollOrientation.Vertical }; videoImage = new Image { Source = videoTechnique.pictures.sizes[4].link, Aspect = Aspect.AspectFill }; videoFrame = new Frame { Content = videoImage, BorderColor = Color.Black, BackgroundColor = Color.Black, HasShadow = false, Padding = 3 }; playBtn = new Button { Style = (Style)Application.Current.Resources["common-blue-btn"], Image = "play.png" }; addBtn = new Button { Style = (Style)Application.Current.Resources["common-blue-btn"], Text = "+", #if __IOS__ FontFamily = "AmericanTypewriter-Bold", FontSize = btnSize * 3, #endif #if __ANDROID__ FontFamily = "Roboto Bold", FontSize = btnSize, Margin = -5, #endif }; qualityBtn = new Button { Style = (Style)Application.Current.Resources["common-blue-btn"], Text = "SD", FontFamily = "AmericanTypewriter-Bold", FontSize = btnSize * 2, }; //Events backBtn.Clicked += async(object sender, EventArgs e) => { ToggleButtons(); await Navigation.PopModalAsync(); ToggleButtons(); }; addBtn.Clicked += async(object sender, EventArgs e) => { ToggleButtons(); await AddVideoToPlaylist(sender, e); ToggleButtons(); }; qualityBtn.Clicked += async(object sender, EventArgs e) => { ToggleButtons(); await ChangeVideoQuality(sender, e); ToggleButtons(); }; #if __IOS__ playBtn.Clicked += PlayIOSVideo; #endif #if __ANDROID__ playBtn.Clicked += async(object sender, EventArgs e) => { ToggleButtons(); await PlayAndroidVideo(sender, e); ToggleButtons(); }; #endif if (userHasAccount) { //building grid innerGrid.Children.Add(videoFrame, 0, 0); #if __IOS__ Grid.SetColumnSpan(videoFrame, 4); innerGrid.Children.Add(videoNameLbl, 0, 0); Grid.SetColumnSpan(videoNameLbl, 4); innerGrid.Children.Add(playBtn, 0, 1); Grid.SetColumnSpan(playBtn, 2); innerGrid.Children.Add(addBtn, 2, 1); innerGrid.Children.Add(qualityBtn, 3, 1); innerGrid.Children.Add(videoDescriptionScrollView, 0, 2); Grid.SetColumnSpan(videoDescriptionScrollView, 4); innerGrid.Children.Add(backBtn, 0, 3); Grid.SetColumnSpan(backBtn, 4); #endif #if __ANDROID__ buttonGrid.Children.Add(contentViewPlayBtn, 0, 0); buttonGrid.Children.Add(contentViewAddBtn, 1, 0); buttonGrid.Children.Add(contentViewQualityBtn, 2, 0); innerGrid.Children.Add(contentViewNameLbl, 0, 0); innerGrid.Children.Add(buttonGrid, 0, 1); innerGrid.Children.Add(videoDescriptionScrollView, 0, 2); Grid.SetRowSpan(videoDescriptionScrollView, 2); #endif } else { //building grid #if __ANDROID__ buttonGrid.Children.Add(contentViewPlayBtn, 0, 0); buttonGrid.Children.Add(contentViewQualityBtn, 1, 0); innerGrid.Children.Add(videoFrame, 0, 0); innerGrid.Children.Add(contentViewNameLbl, 0, 0); innerGrid.Children.Add(buttonGrid, 0, 1); innerGrid.Children.Add(videoDescriptionScrollView, 0, 2); #endif #if __IOS__ innerGrid.Children.Add(videoFrame, 0, 0); Grid.SetColumnSpan(videoFrame, 4); innerGrid.Children.Add(videoNameLbl, 0, 0); Grid.SetColumnSpan(videoNameLbl, 4); innerGrid.Children.Add(playBtn, 0, 1); Grid.SetColumnSpan(playBtn, 2); innerGrid.Children.Add(qualityBtn, 2, 1); Grid.SetColumnSpan(qualityBtn, 2); innerGrid.Children.Add(videoDescriptionScrollView, 0, 2); Grid.SetColumnSpan(videoDescriptionScrollView, 4); #endif #if __ANDROID__ Grid.SetRowSpan(videoDescriptionScrollView, 2); #endif #if __IOS__ innerGrid.Children.Add(backBtn, 0, 3); Grid.SetColumnSpan(backBtn, 4); #endif } outerGrid.Children.Add(innerGrid, 0, 0); Content = outerGrid; }