示例#1
0
文件: Theme.cs 项目: Mikoj/CodeBucket
		public static void Setup()
		{
			var theme = new Theme();
			CurrentTheme = theme;
			Theme.CurrentTheme = theme;
			StyledStringElement.DefaultTitleFont = UIFont.SystemFontOfSize(15f);

            UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;

            var backgroundImg = CreateBackgroundImage(Theme.CurrentTheme.PrimaryColor);

            UINavigationBar.Appearance.TintColor = UIColor.White;
            UINavigationBar.Appearance.BarTintColor = Theme.CurrentTheme.PrimaryColor;
            UINavigationBar.Appearance.BackgroundColor = Theme.CurrentTheme.PrimaryColor;
            UINavigationBar.Appearance.SetBackgroundImage(backgroundImg, UIBarMetrics.Default);
            UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes { TextColor = UIColor.White, Font = UIFont.SystemFontOfSize(18f) });
            UINavigationBar.Appearance.BackIndicatorImage = Theme.CurrentTheme.BackButton;
            UINavigationBar.Appearance.BackIndicatorTransitionMaskImage = Theme.CurrentTheme.BackButton;

            UIBarButtonItem.Appearance.SetBackButtonTitlePositionAdjustment(new UIOffset(0, -64), UIBarMetrics.LandscapePhone);
            UIBarButtonItem.Appearance.SetBackButtonTitlePositionAdjustment(new UIOffset(0, -64), UIBarMetrics.Default);


            CodeBucket.Utils.Hud.BackgroundTint = UIColor.FromRGBA(228, 228, 228, 128);

            UISegmentedControl.Appearance.TintColor = Theme.CurrentTheme.PrimaryColor;
            UITableViewHeaderFooterView.Appearance.TintColor = UIColor.FromRGB(228, 228, 228);
            UILabel.AppearanceWhenContainedIn(typeof(UITableViewHeaderFooterView)).TextColor = UIColor.FromRGB(136, 136, 136);
            UILabel.AppearanceWhenContainedIn(typeof(UITableViewHeaderFooterView)).Font = UIFont.SystemFontOfSize(13f);

            UIToolbar.Appearance.BarTintColor = UIColor.FromRGB(245, 245, 245);

            UIBarButtonItem.AppearanceWhenContainedIn(typeof(UISearchBar)).SetTitleTextAttributes(new UITextAttributes()
            {
                TextColor = UIColor.White,
            }, UIControlState.Normal);

            CodeBucket.Views.StartupView.TextColor = UIColor.FromWhiteAlpha(0.9f, 1.0f);
            CodeBucket.Views.StartupView.SpinnerColor = UIColor.FromWhiteAlpha(0.85f, 1.0f);

            UIImageView.AppearanceWhenContainedIn(typeof(UITableViewCell), typeof(MonoTouch.SlideoutNavigation.MainNavigationController)).TintColor = Theme.CurrentTheme.IconColor;

		}
示例#2
0
文件: Theme.cs 项目: xNUTs/CodeBucket
		public static void Setup()
		{
			var theme = new Theme();
			CurrentTheme = theme;
			Theme.CurrentTheme = theme;

            var backgroundImg = CreateBackgroundImage(Theme.CurrentTheme.PrimaryColor);
            var barTypes = new [] { typeof(MainNavigationController), typeof(ThemedNavigationController) };
            foreach (var bar in barTypes.Select(x => UINavigationBar.AppearanceWhenContainedIn(x)))
                SetApperance(bar, backgroundImg, Theme.CurrentTheme.PrimaryColor);

            var menuColor = UIColor.FromRGB(50, 50, 50);
            var menuImg = CreateBackgroundImage(menuColor);
            var menuApp = UINavigationBar.AppearanceWhenContainedIn(typeof(MenuNavigationController));
            SetApperance(menuApp, menuImg, menuColor);

            foreach (var buttonItem in barTypes.Select(x => UIBarButtonItem.AppearanceWhenContainedIn(x)))
            {
                buttonItem.SetBackButtonTitlePositionAdjustment(new UIOffset(0, -64), UIBarMetrics.LandscapePhone);
                buttonItem.SetBackButtonTitlePositionAdjustment(new UIOffset(0, -64), UIBarMetrics.Default);
            }

            UISegmentedControl.AppearanceWhenContainedIn(typeof(UIToolbar)).TintColor = Theme.CurrentTheme.PrimaryColor;

            UITableViewHeaderFooterView.Appearance.TintColor = UIColor.FromRGB(228, 228, 228);
            UILabel.AppearanceWhenContainedIn(typeof(UITableViewHeaderFooterView)).TextColor = UIColor.FromRGB(136, 136, 136);
            UILabel.AppearanceWhenContainedIn(typeof(UITableViewHeaderFooterView)).Font = UIFont.SystemFontOfSize(13f);

            UIToolbar.Appearance.BarTintColor = UIColor.FromRGB(245, 245, 245);

            UIBarButtonItem.AppearanceWhenContainedIn(typeof(UISearchBar)).SetTitleTextAttributes(new UITextAttributes {TextColor  = UIColor.White }, UIControlState.Normal);

            UIImageView.AppearanceWhenContainedIn(typeof(UITableViewCell), typeof(MainNavigationController)).TintColor = Theme.CurrentTheme.IconColor;

            EmptyListView.DefaultColor = Theme.CurrentTheme.PrimaryColor;
		}