Exemple #1
0
        private void ApplyStyles()
        {
            Drawable mainBackground = Styles.GetMainBackgroundColor();

            if (mainBackground != null)
            {
                Background.Background = mainBackground;
                if (PrimaryView != null)
                {
                    PrimaryView.Background = mainBackground;
                }

                if (SecondaryView != null)
                {
                    SecondaryView.Background = mainBackground;
                }

                if (TertiaryView != null)
                {
                    TertiaryView.Background = mainBackground;
                }
            }

            Typeface primary = Styles.GetPrimaryTextTypeface();

            if (primary != null)
            {
                PrimaryView?.SetTypeface(primary, TypefaceStyle.Normal);
            }

            Typeface secondary = Styles.GetSecondaryTextTypeface();

            if (secondary != null)
            {
                SecondaryView?.SetTypeface(secondary, TypefaceStyle.Normal);
            }

            Typeface tertiary = Styles.GetTertiaryTextTypeface();

            if (tertiary != null)
            {
                TertiaryView?.SetTypeface(tertiary, TypefaceStyle.Normal);
            }

            //Typeface ctaTypeface = Styles.GetCallToActionTextTypeface();
            //if (ctaTypeface != null)
            //{
            //    CallToActionView?.SetTypeface(ctaTypeface, TypefaceStyle.Normal);
            //}

            Color primaryTypefaceColor = Styles.GetPrimaryTextTypefaceColor();

            if (primaryTypefaceColor > 0)
            {
                PrimaryView?.SetTextColor(primaryTypefaceColor);
            }

            Color secondaryTypefaceColor = Styles.GetSecondaryTextTypefaceColor();

            if (secondaryTypefaceColor > 0)
            {
                SecondaryView?.SetTextColor(secondaryTypefaceColor);
            }

            Color tertiaryTypefaceColor = Styles.GetTertiaryTextTypefaceColor();

            if (tertiaryTypefaceColor > 0)
            {
                TertiaryView?.SetTextColor(tertiaryTypefaceColor);
            }

            //var ctaTypefaceColor = Styles.GetCallToActionTypefaceColor();
            //if (ctaTypefaceColor > 0)
            //{
            //    CallToActionView?.SetTextColor(ctaTypefaceColor);
            //}

            //float ctaTextSize = Styles.GetCallToActionTextSize();
            //if (ctaTextSize > 0)
            //{
            //    CallToActionView?.SetTextSize(ComplexUnitType.Sp, ctaTextSize);
            //}

            float primaryTextSize = Styles.GetPrimaryTextSize();

            if (primaryTextSize > 0)
            {
                PrimaryView?.SetTextSize(ComplexUnitType.Sp, primaryTextSize);
            }

            float secondaryTextSize = Styles.GetSecondaryTextSize();

            if (secondaryTextSize > 0)
            {
                SecondaryView?.SetTextSize(ComplexUnitType.Sp, secondaryTextSize);
            }

            float tertiaryTextSize = Styles.GetTertiaryTextSize();

            if (tertiaryTextSize > 0)
            {
                TertiaryView?.SetTextSize(ComplexUnitType.Sp, tertiaryTextSize);
            }

            //Drawable ctaBackground = Styles.GetCallToActionBackgroundColor();
            //if (ctaBackground != null && CallToActionView != null)
            //{
            //    CallToActionView.Background = ctaBackground;
            //}

            Drawable primaryBackground = Styles.GetPrimaryTextBackgroundColor();

            if (primaryBackground != null && PrimaryView != null)
            {
                PrimaryView.Background = primaryBackground;
            }

            Drawable secondaryBackground = Styles.GetSecondaryTextBackgroundColor();

            if (secondaryBackground != null && SecondaryView != null)
            {
                SecondaryView.Background = secondaryBackground;
            }

            Drawable tertiaryBackground = Styles.GetTertiaryTextBackgroundColor();

            if (tertiaryBackground != null && TertiaryView != null)
            {
                TertiaryView.Background = tertiaryBackground;
            }

            Invalidate();
            RequestLayout();
        }