public ItemViewHolder(View itemView)
     : base(itemView)
 {
     icon     = itemView.FindViewById <ImageView>(Resource.Id.icon);
     title    = itemView.FindViewById <TextView>(Resource.Id.title);
     subTitle = itemView.FindViewById <TextView>(Resource.Id.subtitle);
 }
        public void UpdateTextColor(Android.Widget.TextView control, Color color, bool active)
        {
            if (color == _currentTextColor && active == wasActive)
            {
                return;
            }

            _currentTextColor = color;
            wasActive         = active;

            ColorStateList colors;

            if (active)
            {
                colors = new ColorStateList(s_colorStates, new int[] { Ao3TrackReader.Resources.Colors.Highlight.High.ToAndroid(), Ao3TrackReader.Resources.Colors.Highlight.High.ToAndroid() });
            }
            else if (color.IsDefault)
            {
                colors = new ColorStateList(s_colorStates, _defaultTextColors);
            }
            else
            {
                // Set the new enabled state color, preserving the default disabled state color
                colors = new ColorStateList(s_colorStates, new int[] { color.ToAndroid().ToArgb(), _defaultTextColors[1], Ao3TrackReader.Resources.Colors.Highlight.High.ToAndroid(), Ao3TrackReader.Resources.Colors.Highlight.High.ToAndroid() });
            }

            control.SetTextColor(colors);
            if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.M)
            {
                control.CompoundDrawableTintList = colors;
            }
        }
        public void ChangeFont(Android.Widget.TextView control, string fontFamily)
        {
            control.TransformationMethod = null;
            var typeface = string.IsNullOrEmpty(fontFamily) ?
                           Typeface.Default :
                           GetTypeface(fontFamily);

            control.Typeface = typeface;
        }
Example #4
0
        public static void ApplyFont(Android.Widget.TextView target, string fontName)
        {
            Guard.ThrowIfNull(target, "target");

            string fontFileName = GetFontFileName(fontName);

            if (!string.IsNullOrEmpty(fontFileName))
            {
                target.Typeface = FontCache.Get("fonts/" + fontFileName, target.Context);
            }
        }
Example #5
0
        public static void ApplyFont(Android.Widget.TextView target, IAttributeSet attrs)
        {
            Guard.ThrowIfNull(target, "target");

            TypedArray a        = target.Context.ObtainStyledAttributes(attrs, Resource.Styleable.Fonts);
            string     fontName = a.GetString(Resource.Styleable.Fonts_font);

            ApplyFont(target, fontName);

            a.Recycle();
        }
 /// <summary>
 /// A convenience method for setting text appearance.
 /// </summary>
 /// <param name="textView">TextView which textAppearance to modify.</param>
 /// <param name="resId">style resource for the text appearance.</param>
 public static void SetTextAppearance(Android.Widget.TextView textView, int resId)
 {
     if (Build.VERSION.SdkInt >= BuildVersionCodes.M)
     {
         textView.SetTextAppearance(resId);
     }
     else
     {
         textView.SetTextAppearance(textView.Context, resId);
     }
 }
Example #7
0
 public void SetFontSettings(IControl <View> control, TextView view, float height)
 {
     using (Typeface font = Font(control))
     {
         if (font != null)
         {
             view.SetTypeface(font, TypefaceStyle.Normal);
             view.SetTextSize(ComplexUnitType.Px, FontSize(control, height));
         }
     }
 }
Example #8
0
        public static void SetTextUnderline(this Android.Widget.TextView textView, int resId)
        {
            Guard.ThrowIfNull(textView, nameof(textView));

            textView.SetText(resId);

            var span = new SpannableString(textView.Text);

            span.SetSpan(new UnderlineSpan(), 0, textView.Text.Length, 0);

            textView.SetText(span, TextView.BufferType.Spannable);
        }
Example #9
0
 protected override void OnAttached()
 {
     try {
         control = Control as Android.Widget.TextView;
         UpdateRadius();
         UpdateColor();
         UpdateOffset();
         UpdateControl();
     } catch (Exception ex) {
         Console.WriteLine("Cannot set property on attached control. Error: ", ex.Message);
     }
 }
		protected override void OnAttached ()
		{
			try {
				control = Control as Android.Widget.TextView;
				UpdateRadius ();
				UpdateColor ();
				UpdateOffset ();
				UpdateControl ();
			} catch (Exception ex) {
				Console.WriteLine ("Cannot set property on attached control. Error: ", ex.Message);
			}
		}
Example #11
0
        /// <summary>
        /// Se realiza la consulta a la base de datos para obtener un string y llenar un textView con la informacion obtenida
        /// </summary>
        /// <param name="consulta"></param>
        /// <param name="context"></param>
        /// <param name="texto"></param>
        public void consultaDatos(string consulta, Android.Content.Context context, ref Android.Widget.TextView texto)
        {
            loadConnection();                                //Se abre la conección con la base de datos
            string  resultado = "";                          //String que va a contener el resultado obtenido
            ICursor cursor    = db.RawQuery(consulta, null); //Se realiza la consulta a la base de datos

            if (cursor.MoveToFirst())                        //Se posiciona el cursor en la primera fila obtenida
            {
                resultado = cursor.GetString(0);             //Se carga el resultado
            }

            texto.Text = resultado;//Se asigna el resultado al textView que se quiere cargar
        }
Example #12
0
 Android.Graphics.Paint.FontMetrics FontMetrics(string fontFamily, double fontSize, FontAttributes fontAttributes)
 {
     var typeface = FontManagment.TypefaceForFontFamily(fontFamily);
     var label = new Android.Widget.TextView(Settings.Context);
     Android.Graphics.TypefaceStyle style = Android.Graphics.TypefaceStyle.Normal;
     if (fontAttributes == FontAttributes.Bold)
         style = Android.Graphics.TypefaceStyle.Bold;
     else if (fontAttributes == FontAttributes.Italic)
         style = Android.Graphics.TypefaceStyle.Italic;
     else if (fontAttributes != FontAttributes.None)
         style = Android.Graphics.TypefaceStyle.BoldItalic;
     label.SetTypeface(typeface, style);
     var fontMetrics = label.Paint.GetFontMetrics();
     return fontMetrics;
 }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            View view = inflater.Inflate(Resource.Layout.fragment_weather_alerts, container, false);

            // Setup Actionbar
            toolbar = view.FindViewById <Toolbar>(Resource.Id.toolbar);
            toolbar.NavigationClick += (sender, e) =>
            {
                AppCompatActivity?.OnBackPressed();
            };

            locationHeader = view.FindViewById <Android.Widget.TextView>(Resource.Id.location_name);
            recyclerView   = view.FindViewById <RecyclerView>(Resource.Id.recycler_view);

            return(view);
        }
Example #14
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Set the view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.Title = "Slot Toolbar";

            RequestPermissions(permissionGroup, 0);

            SupportMapFragment mapFragment = (SupportMapFragment)SupportFragmentManager.FindFragmentById(Resource.Id.map);

            mapFragment.GetMapAsync(this);

            placeTextView = (Android.Widget.TextView)FindViewById(Resource.Id.placeTextView);
        }
Example #15
0
        /// <inheritdoc/>
        public void BindToNative(object nativeView, BindOptions options = BindOptions.None)
        {
            if (nativeView == null)
            {
                throw new ArgumentNullException("nativeView");
            }

            UnbindFromNative();

            textView = ViewHelpers.GetView <Android.Widget.TextView> (nativeView);

            if (options.HasFlag(BindOptions.PreserveNativeProperties))
            {
                text = textView.Text;
            }
            else
            {
                textView.Text = text;
            }
        }
Example #16
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            //SupportActionBar.SetDisplayHomeAsUpEnabled(false);
            SetContentView(Resource.Layout.MyProfileView);

            Toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            if (Toolbar != null)
            {
                SetSupportActionBar(Toolbar);
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                SupportActionBar.SetHomeButtonEnabled(true);
            }

            Android.Widget.TextView lblTitleScreen = FindViewById <Android.Widget.TextView>(Resource.Id.lblTitleScreen);

            var set = this.CreateBindingSet <MyProfileView, MyProfileViewModel>();

            set.Bind(lblTitleScreen).To(vm => vm.ScreenTitle);
            set.Apply();
        }
Example #17
0
#pragma warning disable IDE0060 // Remove unused parameter
        Android.Graphics.Paint.FontMetrics FontMetrics(string fontFamily, double fontSize, FontAttributes fontAttributes)
#pragma warning restore IDE0060 // Remove unused parameter
        {
            using (var typeface = FontManagment.TypefaceForFontFamily(fontFamily))
                using (var label = new Android.Widget.TextView(Settings.Context))
                {
                    Android.Graphics.TypefaceStyle style = Android.Graphics.TypefaceStyle.Normal;
                    if (fontAttributes == FontAttributes.Bold)
                    {
                        style = Android.Graphics.TypefaceStyle.Bold;
                    }
                    else if (fontAttributes == FontAttributes.Italic)
                    {
                        style = Android.Graphics.TypefaceStyle.Italic;
                    }
                    else if (fontAttributes != FontAttributes.None)
                    {
                        style = Android.Graphics.TypefaceStyle.BoldItalic;
                    }
                    label.SetTypeface(typeface, style);
                    var fontMetrics = label.Paint.GetFontMetrics();
                    return(fontMetrics);
                }
        }
Example #18
0
        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
        }
Example #19
0
        //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;
        }
Example #20
0
 /// <inheritdoc/>
 public void UnbindFromNative()
 {
     textView = null;
 }
        //functions
        public void BuildPageObjects()
        {
            var btnSize = Device.GetNamedSize(NamedSize.Large, typeof(Button));
            var lblSize = Device.GetNamedSize(NamedSize.Large, typeof(Label));

            //view objects
            innerGrid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = new GridLength(3, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(6, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                }
            };
            outerGrid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                }
            };

            blogImage = new Image
            {
                Aspect = Aspect.Fill,
                Source = globalBlogPost.photos[0].alt_sizes[1].url
            };
            blogFrame = new Frame
            {
                BackgroundColor = Color.Black,
                HasShadow       = false,
                BorderColor     = Color.Black,
                Padding         = 3,
                Content         = blogImage
            };
            blogContentLbl = new Label
            {
                Text = blogString,
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
#endif
                VerticalTextAlignment   = TextAlignment.Start,
                HorizontalTextAlignment = TextAlignment.Start,
                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label))
            };

            backBtn = new Button
            {
                Image = "back.png",
                Style = (Style)Application.Current.Resources["common-red-btn"]
            };

#if __ANDROID__
            androidBlogContentLbl          = new Android.Widget.TextView(MainApplication.ActivityContext);
            androidBlogContentLbl.Text     = blogString;
            androidBlogContentLbl.Typeface = Constants.COMMONFONT;
            androidBlogContentLbl.SetTextSize(Android.Util.ComplexUnitType.Fraction, 50);
            androidBlogContentLbl.SetTextColor(Android.Graphics.Color.Black);
            androidBlogContentLbl.Gravity = Android.Views.GravityFlags.Start;
#endif

            scrollView = new ScrollView
            {
#if __ANDROID__
                Content           = androidBlogContentLbl.ToView(),
                IsClippedToBounds = true
#endif
#if __IOS__
                Content = blogContentLbl
#endif
            };

            //Events
            backBtn.Clicked += GoBack;

            //building Grid
            innerGrid.Children.Add(blogFrame, 0, 0);
#if __ANDROID__
            innerGrid.Children.Add(scrollView, 0, 1);
            Grid.SetRowSpan(scrollView, 2);
#endif
#if __IOS__
            innerGrid.Children.Add(scrollView, 0, 1);
            innerGrid.Children.Add(backBtn, 0, 2);
#endif

            outerGrid.Children.Add(innerGrid, 0, 0);

            Content = outerGrid;
        }
        private void SetContent(bool hasUser)
        {
            var btnSize   = Device.GetNamedSize(NamedSize.Large, typeof(Button));
            var lblSize   = Device.GetNamedSize(NamedSize.Large, typeof(Label));
            var entrySize = Device.GetNamedSize(NamedSize.Large, typeof(Entry));

            outerGrid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                }
            };

#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)
                    }
                }
            };
#endif
#if __ANDROID__
            buttonGrid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                }
            };
#endif

#if __ANDROID__
            var pd = new PaintDrawable(Android.Graphics.Color.Rgb(58, 93, 174));
            pd.SetCornerRadius(100);

            androidSummaryLbl          = new Android.Widget.TextView(MainApplication.ActivityContext);
            androidSummaryLbl.Text     = "Summary";
            androidSummaryLbl.Typeface = Constants.COMMONFONT;
            androidSummaryLbl.SetTextSize(Android.Util.ComplexUnitType.Fraction, 100);
            androidSummaryLbl.SetTextColor(Android.Graphics.Color.Black);
            androidSummaryLbl.Gravity = Android.Views.GravityFlags.Start;
            androidSummaryLbl.SetTypeface(androidSummaryLbl.Typeface, Android.Graphics.TypefaceStyle.Bold);

            androidPackageLbl          = new Android.Widget.TextView(MainApplication.ActivityContext);
            androidPackageLbl.Text     = $"Package: {packageName}";
            androidPackageLbl.Typeface = Constants.COMMONFONT;
            androidPackageLbl.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75);
            androidPackageLbl.SetTextColor(Android.Graphics.Color.Black);
            androidPackageLbl.Gravity = Android.Views.GravityFlags.Start;

            androidPriceLbl          = new Android.Widget.TextView(MainApplication.ActivityContext);
            androidPriceLbl.Text     = $"Price: {packagePrice}";
            androidPriceLbl.Typeface = Constants.COMMONFONT;
            androidPriceLbl.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75);
            androidPriceLbl.SetTextColor(Android.Graphics.Color.Black);
            androidPriceLbl.Gravity = Android.Views.GravityFlags.Start;

            androidSignUpBtn          = new Android.Widget.Button(MainApplication.ActivityContext);
            androidSignUpBtn.Text     = "Sign Up";
            androidSignUpBtn.Typeface = Constants.COMMONFONT;
            androidSignUpBtn.SetTextColor(Android.Graphics.Color.Rgb(242, 253, 255));
            androidSignUpBtn.SetBackground(pd);
            androidSignUpBtn.SetAutoSizeTextTypeWithDefaults(Android.Widget.AutoSizeTextType.Uniform);
            androidSignUpBtn.Gravity = Android.Views.GravityFlags.Center;
            androidSignUpBtn.Click  += async(object sender, EventArgs e) =>
            {
                ToggleButtons();
                await SignUp();

                ToggleButtons();
            };
            androidSignUpBtn.SetAllCaps(false);

            if (hasUser)
            {
                androidUserDetailsLbl          = new Android.Widget.TextView(MainApplication.ActivityContext);
                androidUserDetailsLbl.Text     = "User Details";
                androidUserDetailsLbl.Typeface = Constants.COMMONFONT;
                androidUserDetailsLbl.SetTextSize(Android.Util.ComplexUnitType.Fraction, 100);
                androidUserDetailsLbl.SetTextColor(Android.Graphics.Color.Black);
                androidUserDetailsLbl.Gravity = Android.Views.GravityFlags.Start;
                androidUserDetailsLbl.SetTypeface(androidUserDetailsLbl.Typeface, Android.Graphics.TypefaceStyle.Bold);

                androidNameLbl          = new Android.Widget.TextView(MainApplication.ActivityContext);
                androidNameLbl.Text     = $"Name: {user.Name}";
                androidNameLbl.Typeface = Constants.COMMONFONT;
                androidNameLbl.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75);
                androidNameLbl.SetTextColor(Android.Graphics.Color.Black);
                androidNameLbl.Gravity = Android.Views.GravityFlags.Start;

                androidEmailLbl          = new Android.Widget.TextView(MainApplication.ActivityContext);
                androidEmailLbl.Text     = $"E-Mail: {user.Email}";
                androidEmailLbl.Typeface = Constants.COMMONFONT;
                androidEmailLbl.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75);
                androidEmailLbl.SetTextColor(Android.Graphics.Color.Black);
                androidEmailLbl.Gravity = Android.Views.GravityFlags.Start;

                androidBeltLbl          = new Android.Widget.TextView(MainApplication.ActivityContext);
                androidBeltLbl.Text     = $"Belt: {user.Belt}";
                androidBeltLbl.Typeface = Constants.COMMONFONT;
                androidBeltLbl.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75);
                androidBeltLbl.SetTextColor(Android.Graphics.Color.Black);
                androidBeltLbl.Gravity = Android.Views.GravityFlags.Start;

                androidSecretQuestionLbl          = new Android.Widget.TextView(MainApplication.ActivityContext);
                androidSecretQuestionLbl.Text     = $"Secret Question: {user.SecretQuestion}";
                androidSecretQuestionLbl.Typeface = Constants.COMMONFONT;
                androidSecretQuestionLbl.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75);
                androidSecretQuestionLbl.SetTextColor(Android.Graphics.Color.Black);
                androidSecretQuestionLbl.Gravity = Android.Views.GravityFlags.Start;

                androidSecretQuestionAnswerLbl          = new Android.Widget.TextView(MainApplication.ActivityContext);
                androidSecretQuestionAnswerLbl.Text     = $"Answer: {user.SecretQuestionAnswer}";
                androidSecretQuestionAnswerLbl.Typeface = Constants.COMMONFONT;
                androidSecretQuestionAnswerLbl.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75);
                androidSecretQuestionAnswerLbl.SetTextColor(Android.Graphics.Color.Black);
                androidSecretQuestionAnswerLbl.Gravity = Android.Views.GravityFlags.Start;
            }
#endif

            backBtn = new Button
            {
                Style             = (Style)Application.Current.Resources["common-red-btn"],
                Image             = "back.png",
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            backBtn.Clicked += async(sender, e) =>
            {
                ToggleButtons();
                await Navigation.PopModalAsync();

                ToggleButtons();
            };

            signUpBtn = new Button
            {
                Style = (Style)Application.Current.Resources["common-blue-btn"],
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = btnSize * 1.5,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = btnSize,
#endif
                Text              = "Sign Up",
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };
            signUpBtn.Clicked += async(sender, e) =>
            {
                ToggleButtons();
                await SignUp();

                ToggleButtons();
            };

#if __IOS__
            buttonGrid.Children.Add(backBtn, 0, 0);
            buttonGrid.Children.Add(signUpBtn, 1, 0);
#endif

            summaryLbl = new Label
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize * 1.5,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = lblSize,
#endif
                Text                    = "Summary",
                LineBreakMode           = LineBreakMode.WordWrap,
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalOptions         = LayoutOptions.FillAndExpand,
                HorizontalOptions       = LayoutOptions.FillAndExpand
            };

            userDetailsLbl = new Label
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize * 1.5,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = lblSize,
#endif
                Text                    = "User Details",
                LineBreakMode           = LineBreakMode.WordWrap,
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalOptions         = LayoutOptions.FillAndExpand,
                HorizontalOptions       = LayoutOptions.FillAndExpand
            };



            packageLbl = new Label
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = lblSize * .75,
#endif
                Text                    = $"Package: {packageName}",
                LineBreakMode           = LineBreakMode.WordWrap,
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Start,
                VerticalOptions         = LayoutOptions.FillAndExpand,
                HorizontalOptions       = LayoutOptions.FillAndExpand
            };

            priceLbl = new Label
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = lblSize * .75,
#endif
                Text                    = $"Price: {packagePrice}",
                LineBreakMode           = LineBreakMode.WordWrap,
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Start,
                VerticalOptions         = LayoutOptions.FillAndExpand,
                HorizontalOptions       = LayoutOptions.FillAndExpand
            };

            packageImage = new Image();
            if (packageName.Equals("Gi Jiu-Jitsu Package"))
            {
                packageImage.Source = "gi.jpg";
            }
            else if (packageName.Equals("No-Gi Jiu-Jitsu Package"))
            {
                packageImage.Source = "nogi6.jpeg";
            }
            else
            {
                packageImage.Source = "sweep.JPG";
            }
            packageImage.Aspect = Aspect.AspectFit;

            if (hasUser)
            {
                nameLbl = new Label
                {
#if __IOS__
                    FontFamily = "AmericanTypewriter-Bold",
                    FontSize   = lblSize,
#endif
#if __ANDROID__
                    FontFamily = "Roboto Bold",
                    FontSize   = lblSize * .75,
#endif
                    Text                    = $"Name: {user.Name}",
                    LineBreakMode           = LineBreakMode.WordWrap,
                    VerticalTextAlignment   = TextAlignment.Center,
                    HorizontalTextAlignment = TextAlignment.Start,
                    VerticalOptions         = LayoutOptions.FillAndExpand,
                    HorizontalOptions       = LayoutOptions.FillAndExpand
                };

                emailLbl = new Label
                {
#if __IOS__
                    FontFamily = "AmericanTypewriter-Bold",
                    FontSize   = lblSize,
#endif
#if __ANDROID__
                    FontFamily = "Roboto Bold",
                    FontSize   = lblSize * .75,
#endif
                    Text                    = $"E-Mail: {user.Email}",
                    LineBreakMode           = LineBreakMode.WordWrap,
                    VerticalTextAlignment   = TextAlignment.Center,
                    HorizontalTextAlignment = TextAlignment.Start,
                    VerticalOptions         = LayoutOptions.FillAndExpand,
                    HorizontalOptions       = LayoutOptions.FillAndExpand
                };

                beltLbl = new Label
                {
#if __IOS__
                    FontFamily = "AmericanTypewriter-Bold",
                    FontSize   = lblSize,
#endif
#if __ANDROID__
                    FontFamily = "Roboto Bold",
                    FontSize   = lblSize * .75,
#endif
                    Text                    = $"Belt: {user.Belt}",
                    LineBreakMode           = LineBreakMode.WordWrap,
                    VerticalTextAlignment   = TextAlignment.Center,
                    HorizontalTextAlignment = TextAlignment.Start,
                    VerticalOptions         = LayoutOptions.FillAndExpand,
                    HorizontalOptions       = LayoutOptions.FillAndExpand
                };

                secretQuestionLbl = new Label
                {
#if __IOS__
                    FontFamily = "AmericanTypewriter-Bold",
                    FontSize   = lblSize,
#endif
#if __ANDROID__
                    FontFamily = "Roboto Bold",
                    FontSize   = lblSize * .75,
#endif
                    Text                    = $"Secret Question: {user.SecretQuestion}",
                    LineBreakMode           = LineBreakMode.WordWrap,
                    VerticalTextAlignment   = TextAlignment.Center,
                    HorizontalTextAlignment = TextAlignment.Start,
                    VerticalOptions         = LayoutOptions.FillAndExpand,
                    HorizontalOptions       = LayoutOptions.FillAndExpand
                };

                secretQuestionAnswerLbl = new Label
                {
#if __IOS__
                    FontFamily = "AmericanTypewriter-Bold",
                    FontSize   = lblSize,
#endif
#if __ANDROID__
                    FontFamily = "Roboto Bold",
                    FontSize   = lblSize * .75,
#endif
                    Text                    = $"Answer: {user.SecretQuestionAnswer}",
                    LineBreakMode           = LineBreakMode.WordWrap,
                    VerticalTextAlignment   = TextAlignment.Center,
                    HorizontalTextAlignment = TextAlignment.Start,
                    VerticalOptions         = LayoutOptions.FillAndExpand,
                    HorizontalOptions       = LayoutOptions.FillAndExpand
                };

#if __IOS__
                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)
                        },
                        new RowDefinition {
                            Height = new GridLength(1, GridUnitType.Star)
                        },
                        new RowDefinition {
                            Height = new GridLength(2, 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

#if __ANDROID__
                stackLayout = new StackLayout
                {
                    Children =
                    {
                        androidSummaryLbl.ToView(),
                        androidPackageLbl.ToView(),
                        androidPriceLbl.ToView(),
                        androidUserDetailsLbl.ToView(),
                        androidNameLbl.ToView(),
                        androidEmailLbl.ToView(),
                        androidBeltLbl.ToView(),
                        androidSecretQuestionLbl.ToView(),
                        androidSecretQuestionAnswerLbl.ToView()
                    }
                };
                stackLayout.VerticalOptions   = LayoutOptions.CenterAndExpand;
                stackLayout.HorizontalOptions = LayoutOptions.CenterAndExpand;
                scrollView = new ScrollView
                {
                    Content = stackLayout,
                #if __ANDROID__
                    IsClippedToBounds = true
#endif
                };
#endif
#if __IOS__
                innerGrid.Children.Add(summaryLbl, 0, 0);
                innerGrid.Children.Add(packageLbl, 0, 1);
                innerGrid.Children.Add(priceLbl, 0, 2);
                innerGrid.Children.Add(userDetailsLbl, 0, 3);
                innerGrid.Children.Add(nameLbl, 0, 4);
                innerGrid.Children.Add(emailLbl, 0, 5);
                innerGrid.Children.Add(beltLbl, 0, 6);
                innerGrid.Children.Add(secretQuestionLbl, 0, 7);
                innerGrid.Children.Add(secretQuestionAnswerLbl, 0, 8);
                innerGrid.Children.Add(buttonGrid, 0, 9);
#endif
#if __ANDROID__
                buttonGrid.Children.Add(androidSignUpBtn.ToView(), 0, 0);

                innerGrid.Children.Add(scrollView, 0, 0);
                innerGrid.Children.Add(buttonGrid, 0, 1);
#endif
            }
            else
            {
                innerGrid = new Grid();
                innerGrid.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Star)
                });
                innerGrid.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Star)
                });
                innerGrid.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Star)
                });
                innerGrid.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(4, GridUnitType.Star)
                });
                innerGrid.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Star)
                });
#if __IOS__
                innerGrid.Children.Add(summaryLbl, 0, 0);
                innerGrid.Children.Add(packageLbl, 0, 1);
                innerGrid.Children.Add(priceLbl, 0, 2);
                innerGrid.Children.Add(packageImage, 0, 3);
                innerGrid.Children.Add(buttonGrid, 0, 4);
#endif
#if __ANDROID__
                buttonGrid.Children.Add(androidSignUpBtn.ToView(), 0, 0);

                innerGrid.Children.Add(androidSummaryLbl.ToView(), 0, 0);
                innerGrid.Children.Add(androidPackageLbl.ToView(), 0, 1);
                innerGrid.Children.Add(androidPriceLbl.ToView(), 0, 2);
                innerGrid.Children.Add(packageImage, 0, 3);
                innerGrid.Children.Add(buttonGrid, 0, 4);
#endif
            }

            outerGrid.Children.Add(innerGrid, 0, 0);

            Content = outerGrid;
        }
Example #23
0
        //Functions
        private void SetContent()
        {
            var lblSize = Device.GetNamedSize(NamedSize.Large, typeof(Label));
            var btnSize = Device.GetNamedSize(NamedSize.Large, typeof(Button));

            innerGrid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = new GridLength(3, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(2, GridUnitType.Star)
                    }
                }
            };

            outerGrid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                }
            };

            stackLayout = new StackLayout();
            scrollView  = new ScrollView();

            #if __ANDROID__
            androidBlogLbl          = new Android.Widget.TextView(MainApplication.ActivityContext);
            androidBlogLbl.Text     = "Blog";
            androidBlogLbl.Typeface = Constants.COMMONFONT;
            androidBlogLbl.SetAutoSizeTextTypeWithDefaults(Android.Widget.AutoSizeTextType.Uniform);
            androidBlogLbl.SetTextColor(Android.Graphics.Color.Rgb(241, 236, 206));
            androidBlogLbl.Gravity = Android.Views.GravityFlags.Center;
            androidBlogLbl.Click  += async(object sender, EventArgs e) =>
            {
                ToggleButtons();
                await Navigation.PushModalAsync(new BlogViewPage());

                ToggleButtons();
            };
#endif

            sweepLbl = new Label
            {
                Style = (Style)Application.Current.Resources["common-blue-lbl"],
                Text  = "Sweep",
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize
#endif
#if __ANDROID__
                FontFamily     = "american_typewriter_bold_bt.ttf#american_typewriter_bold_bt",
                FontSize       = lblSize * 1.5,
                FontAttributes = FontAttributes.Bold
#endif
            };

            sweepTap         = new TapGestureRecognizer();
            sweepTap.Tapped += async(sender, e) =>
            {
                ToggleButtons();
                account = _baseViewModel.GetAccountInformation();

                if (account.Properties["Package"] == "Gi")
                {
                    await Navigation.PushModalAsync(new SearchPage(Album.GiSweep));
                }
                else if (account.Properties["Package"] == "NoGi")
                {
                    await Navigation.PushModalAsync(new SearchPage(Album.NoGiSweep));
                }
                else
                {
                    await Navigation.PushModalAsync(new SearchPage(Album.Sweep));
                }
                ToggleButtons();
            };
            sweepLbl.GestureRecognizers.Add(sweepTap);

            sweepFrame = new Frame
            {
                BackgroundColor = Color.FromRgb(58, 93, 174),
                HasShadow       = false,
                BorderColor     = Color.Black,
                Content         = sweepLbl,
                Padding         = new Thickness(10, 10, 10, 10)
            };

            takeDownLbl = new Label
            {
                Style = (Style)Application.Current.Resources["common-blue-lbl"],
                Text  = "Take Down",
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize
#endif
#if __ANDROID__
                FontFamily     = "american_typewriter_bold_bt.ttf#american_typewriter_bold_bt",
                FontSize       = lblSize * 1.5,
                FontAttributes = FontAttributes.Bold
#endif
            };

            takeDownTap         = new TapGestureRecognizer();
            takeDownTap.Tapped += async(sender, e) =>
            {
                ToggleButtons();
                account = _baseViewModel.GetAccountInformation();

                if (account.Properties["Package"] == "Gi")
                {
                    await Navigation.PushModalAsync(new SearchPage(Album.GiTakeDown));
                }
                else if (account.Properties["Package"] == "NoGi")
                {
                    await Navigation.PushModalAsync(new SearchPage(Album.NoGiTakeDown));
                }
                else
                {
                    await Navigation.PushModalAsync(new SearchPage(Album.TakeDown));
                }
                ToggleButtons();
            };
            takeDownLbl.GestureRecognizers.Add(takeDownTap);


            takeDownFrame = new Frame
            {
                BackgroundColor = Color.FromRgb(58, 93, 174),
                HasShadow       = false,
                BorderColor     = Color.Black,
                Content         = takeDownLbl,
                Padding         = new Thickness(10, 10, 10, 10)
            };

            submissionLbl = new Label
            {
                Style = (Style)Application.Current.Resources["common-blue-lbl"],
                Text  = "Submission",
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize
#endif
#if __ANDROID__
                FontFamily     = "american_typewriter_bold_bt.ttf#american_typewriter_bold_bt",
                FontSize       = lblSize * 1.5,
                FontAttributes = FontAttributes.Bold
#endif
            };

            submissionTap         = new TapGestureRecognizer();
            submissionTap.Tapped += async(sender, e) =>
            {
                ToggleButtons();
                account = _baseViewModel.GetAccountInformation();

                if (account.Properties["Package"] == "Gi")
                {
                    await Navigation.PushModalAsync(new SearchPage(Album.GiSubmission));
                }
                else if (account.Properties["Package"] == "NoGi")
                {
                    await Navigation.PushModalAsync(new SearchPage(Album.NoGiSubmission));
                }
                else
                {
                    await Navigation.PushModalAsync(new SearchPage(Album.Submission));
                }
                ToggleButtons();
            };
            submissionLbl.GestureRecognizers.Add(submissionTap);


            submissionFrame = new Frame
            {
                BackgroundColor = Color.FromRgb(58, 93, 174),
                HasShadow       = false,
                BorderColor     = Color.Black,
                Content         = submissionLbl,
                Padding         = new Thickness(10, 10, 10, 10)
            };

            guardPassLbl = new Label
            {
                Style = (Style)Application.Current.Resources["common-blue-lbl"],
                Text  = "Guard Pass",
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize
#endif
#if __ANDROID__
                FontFamily     = "american_typewriter_bold_bt.ttf#american_typewriter_bold_bt",
                FontSize       = lblSize * 1.5,
                FontAttributes = FontAttributes.Bold
#endif
            };

            guardPassTap         = new TapGestureRecognizer();
            guardPassTap.Tapped += async(sender, e) =>
            {
                ToggleButtons();
                account = _baseViewModel.GetAccountInformation();

                if (account.Properties["Package"] == "Gi")
                {
                    await Navigation.PushModalAsync(new SearchPage(Album.GiGuardPass));
                }
                else if (account.Properties["Package"] == "NoGi")
                {
                    await Navigation.PushModalAsync(new SearchPage(Album.NoGiGuardPass));
                }
                else
                {
                    await Navigation.PushModalAsync(new SearchPage(Album.GuardPass));
                }
                ToggleButtons();
            };
            guardPassLbl.GestureRecognizers.Add(guardPassTap);


            guardPassFrame = new Frame
            {
                BackgroundColor = Color.FromRgb(58, 93, 174),
                HasShadow       = false,
                BorderColor     = Color.Black,
                Content         = guardPassLbl,
                Padding         = new Thickness(10, 10, 10, 10)
            };

            defenseLbl = new Label
            {
                Style = (Style)Application.Current.Resources["common-blue-lbl"],
                Text  = "Defense",
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize
#endif
#if __ANDROID__
                FontFamily     = "american_typewriter_bold_bt.ttf#american_typewriter_bold_bt",
                FontSize       = lblSize * 1.5,
                FontAttributes = FontAttributes.Bold
#endif
            };

            defenseTap         = new TapGestureRecognizer();
            defenseTap.Tapped += async(sender, e) =>
            {
                ToggleButtons();
                account = _baseViewModel.GetAccountInformation();

                if (account.Properties["Package"] == "Gi")
                {
                    await Navigation.PushModalAsync(new SearchPage(Album.GiDefense));
                }
                else if (account.Properties["Package"] == "NoGi")
                {
                    await Navigation.PushModalAsync(new SearchPage(Album.NoGiDefense));
                }
                else
                {
                    await Navigation.PushModalAsync(new SearchPage(Album.Defense));
                }
                ToggleButtons();
            };
            defenseLbl.GestureRecognizers.Add(defenseTap);


            defenseFrame = new Frame
            {
                BackgroundColor = Color.FromRgb(58, 93, 174),
                HasShadow       = false,
                BorderColor     = Color.Black,
                Content         = defenseLbl,
                Padding         = new Thickness(10, 10, 10, 10)
            };

            backTakeLbl = new Label
            {
                Style = (Style)Application.Current.Resources["common-blue-lbl"],
                Text  = "Back Take",
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize
#endif
#if __ANDROID__
                FontFamily     = "american_typewriter_bold_bt.ttf#american_typewriter_bold_bt",
                FontSize       = lblSize * 1.5,
                FontAttributes = FontAttributes.Bold
#endif
            };

            backTakeTap         = new TapGestureRecognizer();
            backTakeTap.Tapped += async(sender, e) =>
            {
                ToggleButtons();
                account = _baseViewModel.GetAccountInformation();

                if (account.Properties["Package"] == "Gi")
                {
                    await Navigation.PushModalAsync(new SearchPage(Album.GiBackTake));
                }
                else if (account.Properties["Package"] == "NoGi")
                {
                    await Navigation.PushModalAsync(new SearchPage(Album.NoGiBackTake));
                }
                else
                {
                    await Navigation.PushModalAsync(new SearchPage(Album.BackTake));
                }
                ToggleButtons();
            };
            backTakeLbl.GestureRecognizers.Add(backTakeTap);


            backTakeFrame = new Frame
            {
                BackgroundColor = Color.FromRgb(58, 93, 174),
                HasShadow       = false,
                BorderColor     = Color.Black,
#if __ANDROID__
                Content = backTakeLbl,
#endif
#if __IOS__
                Content = backTakeLbl,
#endif
                Padding = new Thickness(10, 10, 10, 10)
            };

            drillsLbl = new Label
            {
                Style = (Style)Application.Current.Resources["common-blue-lbl"],
                Text  = "Drills",
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize
#endif
#if __ANDROID__
                FontFamily     = "american_typewriter_bold_bt.ttf#american_typewriter_bold_bt",
                FontSize       = lblSize * 1.5,
                FontAttributes = FontAttributes.Bold
#endif
            };

            drillsTap         = new TapGestureRecognizer();
            drillsTap.Tapped += async(object sender, EventArgs e) =>
            {
                ToggleButtons();
                account = _baseViewModel.GetAccountInformation();

                if (account.Properties["Package"] == "Gi")
                {
                    await Navigation.PushModalAsync(new SearchPage(Album.GiDrills));
                }
                else if (account.Properties["Package"] == "NoGi")
                {
                    await Navigation.PushModalAsync(new SearchPage(Album.NoGiDrills));
                }
                else
                {
                    await Navigation.PushModalAsync(new SearchPage(Album.Drills));
                }
                ToggleButtons();
            };
            drillsLbl.GestureRecognizers.Add(drillsTap);

            drillsFrame = new Frame
            {
                BackgroundColor = Color.FromRgb(58, 93, 174),
                HasShadow       = false,
                BorderColor     = Color.Black,
                Content         = drillsLbl,
                Padding         = new Thickness(10, 10, 10, 10)
            };

            //blog objects
            blogLbl = new Label
            {
                Style = (Style)Application.Current.Resources["common-technique-lbl"],
                Text  = "Blog",
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
#endif
                FontSize = lblSize * 2
            };
            blogTap         = new TapGestureRecognizer();
            blogTap.Tapped += async(sender, e) =>
            {
                ToggleButtons();
                await Navigation.PushModalAsync(new BlogViewPage());

                ToggleButtons();
            };
            blogLbl.GestureRecognizers.Add(blogTap);
            blogImage = new Image
            {
                Aspect = Aspect.AspectFill,
                Source = ImageSource.FromFile("blog.jpg")
            };
            blogFrame = new Frame
            {
                Content         = blogImage,
                BorderColor     = Color.Black,
                BackgroundColor = Color.Black,
                HasShadow       = false,
                Padding         = 3
            };

            //Events
            //adding children
            stackLayout.Children.Add(sweepFrame);
            stackLayout.Children.Add(takeDownFrame);
            stackLayout.Children.Add(submissionFrame);
            stackLayout.Children.Add(guardPassFrame);
            stackLayout.Children.Add(defenseFrame);
            stackLayout.Children.Add(backTakeFrame);
            stackLayout.Children.Add(drillsFrame);
            scrollView.Content = stackLayout;
#if __ANDROID__
            scrollView.IsClippedToBounds = true;
#endif

            innerGrid.Children.Add(scrollView, 0, 0);
            innerGrid.Children.Add(blogFrame, 0, 1);
#if __ANDROID__
            innerGrid.Children.Add(androidBlogLbl.ToView(), 0, 1);
#endif
#if __IOS__
            innerGrid.Children.Add(blogLbl, 0, 1);
#endif
            outerGrid.Children.Add(innerGrid, 0, 0);

            Content = outerGrid;
        }
Example #24
0
        public static void ApplyOswaldFont([NotNull] this Android.Widget.TextView target)
        {
            Guard.ThrowIfNull(target, nameof(target));

            CustomFontUtils.ApplyFont(target, CustomFontUtils.Oswald);
        }
Example #25
0
        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));

            outerGrid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                }
            };

            innerGrid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
#if __ANDROID__
                    new RowDefinition {
                        Height = new GridLength(6, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
#endif
#if __IOS__
                    new RowDefinition {
                        Height = new GridLength(9, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
#endif
                }
            };

            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)
                    }
                }
            };

            giStackLayout   = new StackLayout();
            noGiStackLayout = new StackLayout();

            #region GI
#if __ANDROID__
            androidGiTitle          = new Android.Widget.TextView(MainApplication.ActivityContext);
            androidGiTitle.Text     = "Gi";
            androidGiTitle.Typeface = Constants.COMMONFONT;
            androidGiTitle.SetTextSize(Android.Util.ComplexUnitType.Fraction, 100);
            androidGiTitle.SetTextColor(Android.Graphics.Color.Black);
            androidGiTitle.Gravity = Android.Views.GravityFlags.Start;
            androidGiTitle.SetTypeface(androidGiTitle.Typeface, Android.Graphics.TypefaceStyle.Bold);
            contentViewGiTitle         = new ContentView();
            contentViewGiTitle.Content = androidGiTitle.ToView();

            androidGiPrice          = new Android.Widget.TextView(MainApplication.ActivityContext);
            androidGiPrice.Text     = "$19.99";
            androidGiPrice.Typeface = Constants.COMMONFONT;
            androidGiPrice.SetTextSize(Android.Util.ComplexUnitType.Fraction, 100);
            androidGiPrice.SetTextColor(Android.Graphics.Color.Black);
            androidGiPrice.Gravity = Android.Views.GravityFlags.Start;
            androidGiPrice.SetTypeface(androidGiPrice.Typeface, Android.Graphics.TypefaceStyle.Bold);
            contentViewGiPrice         = new ContentView();
            contentViewGiPrice.Content = androidGiPrice.ToView();

            androidGiBody          = new Android.Widget.TextView(MainApplication.ActivityContext);
            androidGiBody.Text     = "This library is growing constantly and there is no end in sight. The beauty of this package is that you get to follow our system as we develop and implement new transitions and positions. We’re constantly pushing the barrier in terms of our style and approach to Jiu-Jitsu. Every position that gets posted has been drilled to death and executed at the highest levels of competition. We’re proud of this; something I see wrong with other instructional resources is positions are shown that I know they have never ever hit in a competition or anything. You never have to worry about that with our techniques. One of the biggest advantages of our app is that you have direct access to us, if you have any questions or concerns; contacting us is a click away. Let’s grow and develop our Jiu Jitsu together!";
            androidGiBody.Typeface = Constants.COMMONFONT;
            androidGiBody.SetTextSize(Android.Util.ComplexUnitType.Fraction, 50);
            androidGiBody.SetTextColor(Android.Graphics.Color.Black);
            androidGiBody.Gravity = Android.Views.GravityFlags.Start;
            androidGiBody.SetTypeface(androidGiBody.Typeface, Android.Graphics.TypefaceStyle.Bold);

            contentViewGiTitle         = new ContentView();
            contentViewGiTitle.Content = androidGiBody.ToView();
            contentViewGiPrice         = new ContentView();
            contentViewGiPrice.Content = androidGiPrice.ToView();
            contentViewGiBody          = new ContentView();
            contentViewGiBody.Content  = androidGiBody.ToView();
#endif

            giTitle = new Label
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
#endif
                Text           = "Gi",
                FontSize       = lblSize * 2,
                TextColor      = Color.Black,
                FontAttributes = FontAttributes.Bold
            };

            giPrice = new Label
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
#endif
                Text           = "$19.99 (One Time Purchase)",
                FontSize       = lblSize * 1.5,
                TextColor      = Color.Black,
                FontAttributes = FontAttributes.Bold
            };

            giBody = new Label
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
#endif
                Text           = "This library is growing constantly and there is no end in sight. The beauty of this package is that you get to follow our system as we develop and implement new transitions and positions. We’re constantly pushing the barrier in terms of our style and approach to Jiu-Jitsu. Every position that gets posted has been drilled to death and executed at the highest levels of competition. We’re proud of this; something I see wrong with other instructional resources is positions are shown that I know they have never ever hit in a competition or anything. You never have to worry about that with our techniques. One of the biggest advantages of our app is that you have direct access to us, if you have any questions or concerns; contacting us is a click away. Let’s grow and develop our Jiu Jitsu together!",
                FontSize       = lblSize,
                TextColor      = Color.Black,
                FontAttributes = FontAttributes.Bold
            };

            giImage = new Image
            {
                Source = "gi.jpg",
                Aspect = Aspect.AspectFit
            };

            giImageFrame = new Frame
            {
                BorderColor     = Color.Black,
                BackgroundColor = Color.Black,
                Padding         = 2,
                Content         = giImage,
                HasShadow       = false
            };

            giScrollView = new ScrollView
            {
                BackgroundColor = Color.FromRgb(57, 172, 166),
                Content         = giStackLayout,
#if __ANDROID__
                IsClippedToBounds = true
#endif
            };

            giFrame = new Frame
            {
                BorderColor     = Color.Black,
                BackgroundColor = Color.Black,
                #if __ANDROID__
                Padding = 0,
#endif
#if __IOS__
                Padding = 5,
#endif
                Content   = giScrollView,
                HasShadow = false
            };
            #endregion
            #region NOGI
#if __ANDROID__
            androidNoGiTitle          = new Android.Widget.TextView(MainApplication.ActivityContext);
            androidNoGiTitle.Text     = "No-Gi";
            androidNoGiTitle.Typeface = Constants.COMMONFONT;
            androidNoGiTitle.SetTextSize(Android.Util.ComplexUnitType.Fraction, 100);
            androidNoGiTitle.SetTextColor(Android.Graphics.Color.Black);
            androidNoGiTitle.Gravity = Android.Views.GravityFlags.Start;
            androidNoGiTitle.SetTypeface(androidNoGiTitle.Typeface, Android.Graphics.TypefaceStyle.Bold);

            androidNoGiPrice          = new Android.Widget.TextView(MainApplication.ActivityContext);
            androidNoGiPrice.Text     = "$19.99";
            androidNoGiPrice.Typeface = Constants.COMMONFONT;
            androidNoGiPrice.SetTextSize(Android.Util.ComplexUnitType.Fraction, 100);
            androidNoGiPrice.SetTextColor(Android.Graphics.Color.Black);
            androidNoGiPrice.Gravity = Android.Views.GravityFlags.Start;
            androidNoGiPrice.SetTypeface(androidNoGiPrice.Typeface, Android.Graphics.TypefaceStyle.Bold);

            androidNoGiBody          = new Android.Widget.TextView(MainApplication.ActivityContext);
            androidNoGiBody.Text     = "Just like the other packages, the No-Gi library is constantly being updated. So that means you’ll grow along with us. As we come up with new tweaks and transitions you’ll see it first as we are constantly updating our libraries. Through these techniques and positions your game will be brought to a new technical level. All the while being exposed to a unique point of view on approaching Jiu Jitsu. Some of the biggest advantages of this package is that you have direct access to us, the ones who implement and recorded these techniques. We love to hear from our members and never ignore anyone. Lets grow together!";
            androidNoGiBody.Typeface = Constants.COMMONFONT;
            androidNoGiBody.SetTextSize(Android.Util.ComplexUnitType.Fraction, 50);
            androidNoGiBody.SetTextColor(Android.Graphics.Color.Black);
            androidNoGiBody.Gravity = Android.Views.GravityFlags.Start;
            androidNoGiBody.SetTypeface(androidNoGiBody.Typeface, Android.Graphics.TypefaceStyle.Bold);

            contentViewNoGiTitle         = new ContentView();
            contentViewNoGiTitle.Content = androidNoGiTitle.ToView();
            contentViewNoGiPrice         = new ContentView();
            contentViewNoGiPrice.Content = androidNoGiPrice.ToView();
            contentViewNoGiBody          = new ContentView();
            contentViewNoGiBody.Content  = androidNoGiBody.ToView();
#endif

            noGiTitle = new Label
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
#endif
                Text           = "No-Gi",
                FontSize       = lblSize * 2,
                TextColor      = Color.Black,
                FontAttributes = FontAttributes.Bold
            };

            noGiPrice = new Label
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
#endif
                Text           = "$19.99 (One Time Purchase)",
                FontSize       = lblSize * 1.5,
                TextColor      = Color.Black,
                FontAttributes = FontAttributes.Bold
            };

            noGiBody = new Label
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
#endif
                Text           = "Just like the other packages, the No-Gi library is constantly being updated. So that means you’ll grow along with us. As we come up with new tweaks and transitions you’ll see it first as we are constantly updating our libraries. Through these techniques and positions your game will be brought to a new technical level. All the while being exposed to a unique point of view on approaching Jiu Jitsu. Some of the biggest advantages of this package is that you have direct access to us, the ones who implement and recorded these techniques. We love to hear from our members and never ignore anyone. Lets grow together!",
                FontSize       = lblSize,
                TextColor      = Color.Black,
                FontAttributes = FontAttributes.Bold
            };

            noGiImage = new Image
            {
                Source = "nogi6.jpeg",
                Aspect = Aspect.AspectFit
            };

            noGiImageFrame = new Frame
            {
                BorderColor     = Color.Black,
                BackgroundColor = Color.Black,
                Padding         = 2,
                Content         = noGiImage,
                HasShadow       = false
            };

            noGiScrollView = new ScrollView
            {
                BackgroundColor = Color.FromRgb(57, 172, 166),
                Content         = noGiStackLayout,
#if __ANDROID__
                IsClippedToBounds = true,
                Padding           = new Thickness(5, 5, 5, 0)
#endif
            };

            noGiFrame = new Frame
            {
                BorderColor     = Color.Black,
                BackgroundColor = Color.Black,
#if __ANDROID__
                Padding = 0,
#endif
#if __IOS__
                Padding = 5,
#endif
                Content   = noGiScrollView,
                HasShadow = false
            };
            #endregion

            backBtn = new Button
            {
                Image = "back.png",
                Style = (Style)Application.Current.Resources["common-red-btn"]
            };

            purchaseBtn = new Button
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = btnSize * 1.5,
#endif
                Text              = "Purchase",
                BackgroundColor   = Color.FromRgb(58, 93, 174),
                TextColor         = Color.Black,
                BorderWidth       = 3,
                BorderColor       = Color.Black,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

#if __ANDROID__
            var pd = new PaintDrawable(Android.Graphics.Color.Rgb(58, 93, 174));
            pd.SetCornerRadius(100);

            androidPurchaseBtn          = new Android.Widget.Button(MainApplication.ActivityContext);
            androidPurchaseBtn.Text     = "Purchase";
            androidPurchaseBtn.Typeface = Constants.COMMONFONT;
            androidPurchaseBtn.SetBackground(pd);
            androidPurchaseBtn.SetTextColor(Android.Graphics.Color.Rgb(242, 253, 255));
            androidPurchaseBtn.SetAutoSizeTextTypeWithDefaults(Android.Widget.AutoSizeTextType.Uniform);
            androidPurchaseBtn.Gravity = Android.Views.GravityFlags.Center;
            androidPurchaseBtn.SetAllCaps(false);
            androidPurchaseBtn.Click += async(object sender, EventArgs e) =>
            {
                ToggleButtons();
                await PurchasePackage();

                ToggleButtons();
            };

            contentViewPurchaseBtn         = new ContentView();
            contentViewPurchaseBtn.Content = androidPurchaseBtn.ToView();
#endif

            //events
            backBtn.Clicked += (object sender, EventArgs e) =>
            {
                ToggleButtons();
                Navigation.PopModalAsync();
                ToggleButtons();
            };
            purchaseBtn.Clicked += async(object sender, EventArgs e) =>
            {
                ToggleButtons();
                await PurchasePackage();

                ToggleButtons();
            };

#if __ANDROID__
            giStackLayout.Children.Add(contentViewGiTitle);
            giStackLayout.Children.Add(contentViewGiPrice);
            giStackLayout.Children.Add(contentViewGiBody);
            giStackLayout.Children.Add(giImageFrame);
            giStackLayout.Orientation = StackOrientation.Vertical;
            noGiStackLayout.Children.Add(contentViewNoGiTitle);
            noGiStackLayout.Children.Add(contentViewNoGiPrice);
            noGiStackLayout.Children.Add(contentViewNoGiBody);
            noGiStackLayout.Children.Add(noGiImageFrame);
            noGiStackLayout.Orientation = StackOrientation.Vertical;
#endif
#if __IOS__
            buttonGrid.Children.Add(backBtn, 0, 0);
            buttonGrid.Children.Add(purchaseBtn, 1, 0);

            giStackLayout.Children.Add(giTitle);
            giStackLayout.Children.Add(giPrice);
            giStackLayout.Children.Add(giBody);
            giStackLayout.Children.Add(giImageFrame);
            giStackLayout.Orientation = StackOrientation.Vertical;
            noGiStackLayout.Children.Add(noGiTitle);
            noGiStackLayout.Children.Add(noGiPrice);
            noGiStackLayout.Children.Add(noGiBody);
            noGiStackLayout.Children.Add(noGiImageFrame);
            noGiStackLayout.Orientation = StackOrientation.Vertical;
#endif

            if (this.package == Package.Gi)
            {
                innerGrid.Children.Add(giFrame, 0, 0);
            }
            else
            {
                innerGrid.Children.Add(noGiFrame, 0, 0);
            }

#if __ANDROID__
            innerGrid.Children.Add(contentViewPurchaseBtn, 0, 1);
            outerGrid.Children.Add(innerGrid, 0, 0);
#endif
#if __IOS__
            innerGrid.Children.Add(buttonGrid, 0, 1);
            outerGrid.Children.Add(innerGrid, 0, 0);
#endif

            Content = outerGrid;
        }
Example #26
0
 public CustomSimpleMultiPurposeListener(TextView mTvContent)
 {
     this.mTvContent = mTvContent;
 }
Example #27
0
        public static void ApplySourceSansProFont([NotNull] this Android.Widget.TextView target)
        {
            Guard.ThrowIfNull(target, nameof(target));

            CustomFontUtils.ApplyFont(target, CustomFontUtils.SourceSansPro);
        }
Example #28
0
        private void BuildPageObjects()
        {
            var lblSize = Device.GetNamedSize(NamedSize.Large, typeof(Label));
            var btnSize = Device.GetNamedSize(NamedSize.Large, typeof(Button));


            innerGrid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection {
                    new RowDefinition {
                        Height = new GridLength(1, 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(1, GridUnitType.Star)
                    }
                },
                ColumnDefinitions = new ColumnDefinitionCollection {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    }
                }
            };
            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);

            androidVideo1Lbl          = new Android.Widget.TextView(MainApplication.ActivityContext);
            androidVideo1Lbl.Text     = "Spider Guard Stuff!";
            androidVideo1Lbl.Typeface = Constants.COMMONFONT;
            androidVideo1Lbl.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75);
            androidVideo1Lbl.SetTextColor(Android.Graphics.Color.Rgb(241, 236, 206));
            androidVideo1Lbl.Gravity = Android.Views.GravityFlags.Center;
            androidVideo1Lbl.Click  += async(object sender, EventArgs e) =>
            {
                ToggleButtons();
                VideoData video = VimeoInfo.data[0];
                await Navigation.PushModalAsync(new VideoDetailPage(video));

                ToggleButtons();
            };
            androidVideo1Lbl.SetTypeface(androidVideo1Lbl.Typeface, Android.Graphics.TypefaceStyle.Bold);

            contentViewVideo1Lbl         = new ContentView();
            contentViewVideo1Lbl.Content = androidVideo1Lbl.ToView();

            androidVideo2Lbl          = new Android.Widget.TextView(MainApplication.ActivityContext);
            androidVideo2Lbl.Text     = "Spider Guard Stuff!";
            androidVideo2Lbl.Typeface = Constants.COMMONFONT;
            androidVideo2Lbl.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75);
            androidVideo2Lbl.SetTextColor(Android.Graphics.Color.Rgb(241, 236, 206));
            androidVideo2Lbl.Gravity = Android.Views.GravityFlags.Center;
            androidVideo2Lbl.Click  += async(object sender, EventArgs e) =>
            {
                ToggleButtons();
                VideoData video = VimeoInfo.data[1];
                await Navigation.PushModalAsync(new VideoDetailPage(video));

                ToggleButtons();
            };
            androidVideo2Lbl.SetTypeface(androidVideo2Lbl.Typeface, Android.Graphics.TypefaceStyle.Bold);


            contentViewVideo2Lbl         = new ContentView();
            contentViewVideo2Lbl.Content = androidVideo2Lbl.ToView();

            androidWhatsNewLbl          = new Android.Widget.TextView(MainApplication.ActivityContext);
            androidWhatsNewLbl.Text     = "What's New";
            androidWhatsNewLbl.Typeface = Constants.COMMONFONT;
            androidWhatsNewLbl.SetAutoSizeTextTypeWithDefaults(Android.Widget.AutoSizeTextType.Uniform);
            androidWhatsNewLbl.SetTextColor(Android.Graphics.Color.Black);
            androidWhatsNewLbl.Gravity = Android.Views.GravityFlags.Center;

            contenViewWhatsNewLbl         = new ContentView();
            contenViewWhatsNewLbl.Content = androidWhatsNewLbl.ToView();

            androidPlayListLbl          = new Android.Widget.TextView(MainApplication.ActivityContext);
            androidPlayListLbl.Text     = "Playlists";
            androidPlayListLbl.Typeface = Constants.COMMONFONT;
            androidPlayListLbl.SetAutoSizeTextTypeWithDefaults(Android.Widget.AutoSizeTextType.Uniform);
            androidPlayListLbl.SetTextColor(Android.Graphics.Color.Black);
            androidPlayListLbl.Gravity = Android.Views.GravityFlags.Center;

            contentViewPlayListLbl         = new ContentView();
            contentViewPlayListLbl.Content = androidPlayListLbl.ToView();

            androidAddPlaylistBtn          = new Android.Widget.Button(MainApplication.ActivityContext);
            androidAddPlaylistBtn.Text     = "Create";
            androidAddPlaylistBtn.Typeface = Constants.COMMONFONT;
            androidAddPlaylistBtn.SetAutoSizeTextTypeWithDefaults(Android.Widget.AutoSizeTextType.Uniform);
            androidAddPlaylistBtn.SetBackground(pd);
            androidAddPlaylistBtn.SetTextColor(Android.Graphics.Color.Rgb(242, 253, 255));
            androidAddPlaylistBtn.Gravity = Android.Views.GravityFlags.Center;
            androidAddPlaylistBtn.SetAllCaps(false);
            androidAddPlaylistBtn.Click += async(object sender, EventArgs e) =>
            {
                ToggleButtons();
                await Navigation.PushModalAsync(new PlaylistCreatePage());

                ToggleButtons();
            };

            androidViewPlaylistBtn          = new Android.Widget.Button(MainApplication.ActivityContext);
            androidViewPlaylistBtn.Text     = "View";
            androidViewPlaylistBtn.Typeface = Constants.COMMONFONT;
            androidViewPlaylistBtn.SetAutoSizeTextTypeWithDefaults(Android.Widget.AutoSizeTextType.Uniform);
            androidViewPlaylistBtn.SetBackground(pd);
            androidViewPlaylistBtn.SetTextColor(Android.Graphics.Color.Rgb(242, 253, 255));
            androidViewPlaylistBtn.Gravity = Android.Views.GravityFlags.Center;
            androidViewPlaylistBtn.SetAllCaps(false);
            androidViewPlaylistBtn.Click += async(object sender, EventArgs e) =>
            {
                ToggleButtons();
                await Navigation.PushModalAsync(new PlaylistViewPage());

                ToggleButtons();
            };
#endif
            whatsNewLbl = new Label
            {
                Text = "What's New",
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize * 2,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = lblSize,
#endif
                VerticalTextAlignment   = TextAlignment.End,
                HorizontalTextAlignment = TextAlignment.Center
            };
            video1Image = new Image
            {
                Aspect = Aspect.AspectFill
            };
            video1Frame = new Frame
            {
                Content         = video1Image,
                BorderColor     = Color.Black,
                BackgroundColor = Color.Black,
                HasShadow       = false,
                Padding         = 3
            };
            video1Lbl = new Label
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = lblSize * .75,
#endif
                Text  = "Spider Guard Stuff!",
                Style = (Style)Application.Current.Resources["common-technique-lbl"]
            };
            video1Tap         = new TapGestureRecognizer();
            video1Tap.Tapped += async(sender, e) =>
            {
                ToggleButtons();
                VideoData video = VimeoInfo.data[0];
                await Navigation.PushModalAsync(new VideoDetailPage(video));

                ToggleButtons();
            };
            video1Lbl.GestureRecognizers.Add(video1Tap);
            video2Image = new Image
            {
                Aspect = Aspect.AspectFill
            };
            video2Frame = new Frame
            {
                Content         = video2Image,
                BorderColor     = Color.Black,
                BackgroundColor = Color.Black,
                HasShadow       = false,
                Padding         = 3
            };
            video2Lbl = new Label
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = lblSize * .75,
#endif
                Text  = "Spider Guard Stuff!",
                Style = (Style)Application.Current.Resources["common-technique-lbl"]
            };
            video2Tap         = new TapGestureRecognizer();
            video2Tap.Tapped += async(sender, e) =>
            {
                ToggleButtons();
                VideoData video = VimeoInfo.data[1];
                await Navigation.PushModalAsync(new VideoDetailPage(video));

                ToggleButtons();
            };
            video2Lbl.GestureRecognizers.Add(video2Tap);

            playListLbl = new Label
            {
                Text = "Playlists",
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize * 2,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = lblSize,
#endif
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center,
            };

            addPlaylistBtn = new Button
            {
                Style = (Style)Application.Current.Resources["common-blue-btn"],
                Text  = "Create",
#if __IOS__
                FontSize = btnSize * 1.5,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = btnSize * .75,
                Margin     = -5,
#endif
            };
            viewPlaylistBtn = new Button
            {
                Style = (Style)Application.Current.Resources["common-blue-btn"],
                Text  = "View",
#if __IOS__
                FontSize = btnSize * 1.5,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = btnSize * .75,
                Margin     = -5,
#endif
            };

            timeOutLbl = new Label
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
#endif
                Text                    = "Network Has Timed Out! \n Click To Try Again!",
                LineBreakMode           = LineBreakMode.WordWrap,
                FontSize                = lblSize,
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                HorizontalOptions       = LayoutOptions.CenterAndExpand,
                VerticalOptions         = LayoutOptions.CenterAndExpand,
                TextColor               = Color.White
            };
            timeOutFrame = new Frame
            {
                Content           = timeOutLbl,
                BorderColor       = Color.Black,
                BackgroundColor   = Color.Black,
                HasShadow         = false,
                Padding           = 3,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand
            };
            timeOutTap         = new TapGestureRecognizer();
            timeOutTap.Tapped += (sender, e) =>
            {
                ToggleButtons();
                SetContent(this.account);
                ToggleButtons();
            };
            timeOutLbl.GestureRecognizers.Add(timeOutTap);
            activityIndicator = new ActivityIndicator
            {
                Style = (Style)Application.Current.Resources["common-activity-indicator"]
            };

            //events
            addPlaylistBtn.Clicked += async(object sender, EventArgs e) =>
            {
                ToggleButtons();
                await Navigation.PushModalAsync(new PlaylistCreatePage());

                ToggleButtons();
            };
            viewPlaylistBtn.Clicked += async(object sender, EventArgs e) =>
            {
                ToggleButtons();
                await Navigation.PushModalAsync(new PlaylistViewPage());

                ToggleButtons();
            };

            outerGrid.Children.Add(innerGrid, 0, 0);
            Content = outerGrid;
        }
Example #29
0
        //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
        public void BuildPageObjects()
        {
            var btnSize = Device.GetNamedSize(NamedSize.Large, typeof(Button));
            var lblSize = Device.GetNamedSize(NamedSize.Large, typeof(Label));

            //View Objects
            innerGrid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(7, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                }
            };
            outerGrid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                }
            };

            viewBlogLbl = new Label
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize * 1.5,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = lblSize,
                Margin     = -5,
#endif
                Text = "Mahecha BJJ Blog",
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center
            };
            blogListView = new ListView
            {
                HasUnevenRows       = true,
                SeparatorVisibility = SeparatorVisibility.None,
                BackgroundColor     = Color.FromHex("#F1ECCE")
            };
            backBtn = new Button
            {
                Image = "back.png",
                Style = (Style)Application.Current.Resources["common-red-btn"]
            };
            timeOutLbl = new Label
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
#endif
                Text                    = "Network Has Timed Out! \n Click To Try Again!",
                LineBreakMode           = LineBreakMode.WordWrap,
                FontSize                = lblSize,
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                HorizontalOptions       = LayoutOptions.CenterAndExpand,
                VerticalOptions         = LayoutOptions.CenterAndExpand,
                TextColor               = Color.White
            };
            timeOutFrame = new Frame
            {
                Content           = timeOutLbl,
                BorderColor       = Color.Black,
                BackgroundColor   = Color.Black,
                HasShadow         = false,
                Padding           = 3,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand
            };
            timeOutTap         = new TapGestureRecognizer();
            timeOutTap.Tapped += (sender, e) =>
            {
                SetContent();
            };
            timeOutLbl.GestureRecognizers.Add(timeOutTap);
            activityIndicator = new ActivityIndicator
            {
                Style = (Style)Application.Current.Resources["common-activity-indicator"]
            };

#if __ANDROID__
            androidViewBlogLbl          = new Android.Widget.TextView(MainApplication.ActivityContext);
            androidViewBlogLbl.Text     = "Mahecha BJJ Blog";
            androidViewBlogLbl.Typeface = Constants.COMMONFONT;
            androidViewBlogLbl.SetTextSize(Android.Util.ComplexUnitType.Fraction, 100);
            androidViewBlogLbl.SetTextColor(Android.Graphics.Color.Black);
            androidViewBlogLbl.Gravity = Android.Views.GravityFlags.Center;
            androidViewBlogLbl.SetTypeface(androidViewBlogLbl.Typeface, Android.Graphics.TypefaceStyle.Bold);
#endif

            //Events
            backBtn.Clicked += GoBack;
#if __ANDROID__
            blogListView.ItemSelected += async(object sender, SelectedItemChangedEventArgs e) =>
            {
                if (isPressed)
                {
                    return;
                }
                else
                {
                    isPressed = true;
                    blogListView.IsEnabled = false;
                    await LoadBlogpost(sender, e);
                }
                isPressed = false;
                blogListView.IsEnabled = true;
            };
#endif
#if __IOS__
            blogListView.ItemSelected += async(object sender, SelectedItemChangedEventArgs e) => {
                await LoadBlogpost(sender, e);
            };
#endif

            outerGrid.Children.Add(innerGrid, 0, 0);

            Content = outerGrid;
        }
Example #31
0
        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();
            scrollView  = new ScrollView();
            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(3, GridUnitType.Star)
                    }
                }
            };

            headerLbl = new Label
            {
                Text = "Change Password",
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize * 2,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = lblSize,
#endif
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalOptions         = LayoutOptions.StartAndExpand,
                HorizontalOptions       = LayoutOptions.CenterAndExpand
            };

            secretQuestionLbl = new Label
            {
                Text = _user.SecretQuestion,
#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,
                VerticalOptions         = LayoutOptions.FillAndExpand,
                HorizontalOptions       = LayoutOptions.FillAndExpand
            };

            secretQuestionEntry = new Entry
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = entrySize * 1.5,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = entrySize * .75,
#endif
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            newPasswordLbl = new Label
            {
                Text = "New Password",
#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,
                VerticalOptions         = LayoutOptions.CenterAndExpand,
                HorizontalOptions       = LayoutOptions.CenterAndExpand
            };

            newPasswordEntry = new Entry
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = entrySize * 1.5,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = entrySize * .75,
#endif
                IsPassword        = true,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            backBtn = new Button
            {
                Image = "back.png",
                Style = (Style)Application.Current.Resources["common-red-btn"]
            };

            submitBtn = new Button
            {
                Style = (Style)Application.Current.Resources["common-blue-btn"],

#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = btnSize * 1.5,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = btnSize * .75,
#endif
                Text = "Submit"
            };

#if __ANDROID__
            var pd = new PaintDrawable(Android.Graphics.Color.Rgb(58, 93, 174));
            pd.SetCornerRadius(100);

            innerGrid = new Grid();
            innerGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(2, GridUnitType.Star)
            });
            innerGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            innerGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            innerGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            innerGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            innerGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            innerGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            innerGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            innerGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            innerGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            innerGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(2, GridUnitType.Star)
            });

            outerGrid = new Grid();
            outerGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });

            androidSecretQuestionLbl          = new Android.Widget.TextView(MainApplication.ActivityContext);
            androidSecretQuestionLbl.Text     = _user.SecretQuestion;
            androidSecretQuestionLbl.Typeface = Constants.COMMONFONT;
            androidSecretQuestionLbl.SetAutoSizeTextTypeWithDefaults(Android.Widget.AutoSizeTextType.Uniform);
            androidSecretQuestionLbl.SetTextColor(Android.Graphics.Color.Black);
            androidSecretQuestionLbl.Gravity = Android.Views.GravityFlags.Center;

            androidSecretQuestionEntry          = new Android.Widget.EditText(MainApplication.ActivityContext);
            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;

            androidNewPasswordLbl          = new Android.Widget.TextView(MainApplication.ActivityContext);
            androidNewPasswordLbl.Text     = "New Password";
            androidNewPasswordLbl.Typeface = Constants.COMMONFONT;
            androidNewPasswordLbl.SetAutoSizeTextTypeWithDefaults(Android.Widget.AutoSizeTextType.Uniform);
            androidNewPasswordLbl.SetTextColor(Android.Graphics.Color.Black);
            androidNewPasswordLbl.Gravity = Android.Views.GravityFlags.Center;

            androidNewPasswordEntry          = new Android.Widget.EditText(MainApplication.ActivityContext);
            androidNewPasswordEntry.Typeface = Constants.COMMONFONT;
            androidNewPasswordEntry.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75);
            androidNewPasswordEntry.SetTextColor(Android.Graphics.Color.Black);
            androidNewPasswordEntry.Gravity              = Android.Views.GravityFlags.Start;
            androidNewPasswordEntry.InputType            = Android.Text.InputTypes.TextVariationPassword;
            androidNewPasswordEntry.TransformationMethod = new PasswordTransformationMethod();

            androidSubmitBtn          = new Android.Widget.Button(MainApplication.ActivityContext);
            androidSubmitBtn.Text     = "Change Password";
            androidSubmitBtn.Typeface = Constants.COMMONFONT;
            androidSubmitBtn.SetAutoSizeTextTypeWithDefaults(Android.Widget.AutoSizeTextType.Uniform);
            androidSubmitBtn.SetTextColor(Android.Graphics.Color.Rgb(242, 253, 255));
            androidSubmitBtn.SetBackground(pd);
            androidSubmitBtn.SetAllCaps(false);
            androidSubmitBtn.Click += async(object sender, EventArgs e) =>
            {
                ToggleButtons();
                await ChangePassword(sender, e);

                ToggleButtons();
            };

            contentViewAndroidSecretQuestionLbl         = new ContentView();
            contentViewAndroidSecretQuestionLbl.Content = androidSecretQuestionLbl.ToView();

            contentViewAndroidSecretQuestionEntry         = new ContentView();
            contentViewAndroidSecretQuestionEntry.Content = androidSecretQuestionEntry.ToView();

            contentViewAndroidNewPasswordLbl         = new ContentView();
            contentViewAndroidNewPasswordLbl.Content = androidNewPasswordLbl.ToView();

            contentViewAndroidNewPasswordEntry         = new ContentView();
            contentViewAndroidNewPasswordEntry.Content = androidNewPasswordEntry.ToView();

            contentViewAndroidSubmitBtn         = new ContentView();
            contentViewAndroidSubmitBtn.Content = androidSubmitBtn.ToView();
#endif

            //events
            backBtn.Clicked += (sender, e) =>
            {
                backBtn.IsEnabled = false;
                Navigation.PopModalAsync();
                backBtn.IsEnabled = true;
            };
            submitBtn.Clicked += async(object sender, EventArgs e) => {
                ToggleButtons();
                await ChangePassword(sender, e);

                ToggleButtons();
            };

            //layout
#if __ANDROID__
            innerGrid.Children.Add(contentViewAndroidSecretQuestionLbl, 0, 3);
            innerGrid.Children.Add(contentViewAndroidSecretQuestionEntry, 0, 4);
            innerGrid.Children.Add(contentViewAndroidNewPasswordLbl, 0, 6);
            innerGrid.Children.Add(contentViewAndroidNewPasswordEntry, 0, 7);
            innerGrid.Children.Add(contentViewAndroidSubmitBtn, 0, 10);

            outerGrid.Children.Add(innerGrid, 0, 0);

            Content = outerGrid;
#endif
#if __IOS__
            buttonGrid.Children.Add(backBtn, 0, 0);
            buttonGrid.Children.Add(submitBtn, 1, 0);

            stackLayout.Children.Add(headerLbl);
            stackLayout.Children.Add(secretQuestionLbl);
            stackLayout.Children.Add(secretQuestionEntry);
            stackLayout.Children.Add(newPasswordLbl);
            stackLayout.Children.Add(newPasswordEntry);
            stackLayout.Children.Add(buttonGrid);

            scrollView.Content = stackLayout;

            Content = scrollView;
#endif
        }