Exemplo n.º 1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            placeViews = new List <PlaceView> ();

            coffeeAnimation = CoffeeAnimationView.GetView(this);

            NavigationController.NavigationBar.TintColor = tintColor;

            var appearance = UIBarButtonItem.AppearanceWhenContainedIn(typeof(UINavigationBar));

            appearance.SetTitleTextAttributes(new UITextAttributes {
                TextColor = tintColor,
                Font      = UIFont.FromName("HelveticaNeue-Light", 20f)
            }, UIControlState.Normal);

            MapView.ShowsUserLocation = true;

            try {
                viewModel = ServiceContainer.Resolve <CoffeeFilterViewModel>();
            } catch {
                viewModel = new CoffeeFilterViewModel();
                ServiceContainer.Register <CoffeeFilterViewModel>(viewModel);
            }


            var searchButton     = NavigationItem.RightBarButtonItem;
            var navigationButton = new UIBarButtonItem(UIImage.FromBundle("near"), UIBarButtonItemStyle.Plain, OpenMaps);

            NavigationItem.SetRightBarButtonItems(new [] { searchButton, navigationButton }, false);

            RefreshData(true);
        }
Exemplo n.º 2
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            //Set the status bar
            if (Util.iOSVersion.Item1 < 6)
            {
                UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.BlackOpaque, false);
            }
            else
            {
                UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.BlackTranslucent, false);
            }

            if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
            {
                var textAttrs = new UITextAttributes()
                {
                    TextColor = UIColor.White, TextShadowColor = UIColor.DarkGray, TextShadowOffset = new UIOffset(0, -1)
                };
                UINavigationBar.Appearance.SetTitleTextAttributes(textAttrs);
                UISegmentedControl.Appearance.SetTitleTextAttributes(textAttrs, UIControlState.Normal);
            }

            //Set the theming
            UIBarButtonItem.Appearance.SetBackButtonBackgroundImage(Images.Controls.BackButton.CreateResizableImage(new UIEdgeInsets(0, 16, 0, 10)), UIControlState.Normal, UIBarMetrics.Default);
            UIBarButtonItem.AppearanceWhenContainedIn(typeof(UIPopoverController)).SetBackButtonBackgroundImage(null, UIControlState.Normal, UIBarMetrics.Default);

            UIBarButtonItem.Appearance.SetBackgroundImage(Images.Controls.Button, UIControlState.Normal, UIBarMetrics.Default);
            UIBarButtonItem.AppearanceWhenContainedIn(typeof(UIPopoverController)).SetBackgroundImage(null, UIControlState.Normal, UIBarMetrics.Default);

            UINavigationBar.Appearance.SetBackgroundImage(Images.Controls.Navbar.CreateResizableImage(new UIEdgeInsets(0, 0, 0, 0)), UIBarMetrics.Default);
            UINavigationBar.AppearanceWhenContainedIn(typeof(UIPopoverController)).SetBackgroundImage(null, UIBarMetrics.Default);

            UIToolbar.Appearance.SetBackgroundImage(Images.Controls.Navbar.CreateResizableImage(new UIEdgeInsets(0, 0, 0, 0)), UIToolbarPosition.Any, UIBarMetrics.Default);

            Window                    = new UIWindow(UIScreen.MainScreen.Bounds);
            SlideController           = new SlideoutNavigationController();
            Window.RootViewController = SlideController;
            SlideController.SelectView(new RecentPatternsViewController());
            Window.MakeKeyAndVisible();


            if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone)
            {
                UIImageView killSplash = null;
                if (IsTall)
                {
                    killSplash = new UIImageView(UIImageHelper.FromFileAuto("Default-568h"));
                }
                else
                {
                    killSplash = new UIImageView(UIImageHelper.FromFileAuto("Default"));
                }

                Window.AddSubview(killSplash);
                Window.BringSubviewToFront(killSplash);
                UIView.Animate(0.8, () => killSplash.Alpha = 0.0f, killSplash.RemoveFromSuperview);
            }

            return(true);
        }
Exemplo n.º 3
0
        public static void Setup()
        {
            var theme = new Theme();

            CurrentTheme = theme;
            CodeFramework.iOS.Theme.CurrentTheme = theme;

            var defaultValues = Cirrious.CrossCore.Mvx.Resolve <CodeFramework.Core.Services.IDefaultValueService>();

            bool largeFonts;

            if (!defaultValues.TryGet <bool>("large_fonts", out largeFonts))
            {
                largeFonts = false;
            }
            Theme.CurrentTheme.FontSizeRatio = largeFonts ? 1.3f : 1.0f;

            RepositoryCellView.RoundImages = false;
            MonoTouch.Dialog.NameTimeStringElement.NameColor = Theme.CurrentTheme.MainTitleColor;
            MonoTouch.Dialog.Element.FontSizeRatio           = Theme.CurrentTheme.FontSizeRatio;

            UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;
            UINavigationBar.Appearance.TintColor           = UIColor.White;
            UINavigationBar.Appearance.BarTintColor        = UIColor.FromRGB(50, 50, 50);
            UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes {
                TextColor = UIColor.White, Font = UIFont.SystemFontOfSize(18f)
            });
            CodeFramework.iOS.Utils.Hud.BackgroundTint    = UIColor.FromRGBA(228, 228, 228, 128);
            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);

            UserVoice.UVStyleSheet.Instance.NavigationBarTintColor = UIColor.White;
            UserVoice.UVStyleSheet.Instance.NavigationBarTextColor = UIColor.White;

            UISegmentedControl.Appearance.TintColor = UIColor.FromRGB(110, 110, 117);
            UISegmentedControl.AppearanceWhenContainedIn(typeof(UINavigationBar)).TintColor = UIColor.White;

            // Composer Input Accessory Buttons
            UIButton.AppearanceWhenContainedIn(typeof(UIScrollView)).TintColor = UIColor.FromRGB(50, 50, 50);

            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 * Theme.CurrentTheme.FontSizeRatio);

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

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

//            CodeFramework.Elements.NewsFeedElement.LinkColor = theme.MainTitleColor;
//            CodeFramework.Elements.NewsFeedElement.TextColor = theme.MainTextColor;
//            CodeFramework.Elements.NewsFeedElement.NameColor = theme.MainTitleColor;
        }
Exemplo n.º 4
0
        public static void Setup()
        {
            var theme = new Theme();

            CurrentTheme = theme;

            var primaryColor  = Theme.CurrentTheme.PrimaryColor;
            var iconColor     = UIColor.FromRGB(0x5B, 0x61, 0x65);
            var backgroundImg = CreateBackgroundImage(primaryColor);

            UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;
            UINavigationBar.Appearance.TintColor           = UIColor.White;
            UINavigationBar.Appearance.SetBackgroundImage(backgroundImg, UIBarMetrics.Default);
            UINavigationBar.Appearance.BarTintColor = primaryColor;
            UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes {
                TextColor = UIColor.White, Font = UIFont.SystemFontOfSize(18f)
            });
            CodeHub.iOS.Utilities.Hud.BackgroundTint = UIColor.FromRGBA(228, 228, 228, 128);
            CodeHub.iOS.Services.AlertDialogService.BackgroundTint = UIColor.FromRGBA(228, 228, 228, 128);

            UINavigationBar.Appearance.BackIndicatorImage = Images.Buttons.BackButton;
            UINavigationBar.Appearance.BackIndicatorTransitionMaskImage = Images.Buttons.BackButton;

            var version = new Version(UIDevice.CurrentDevice.SystemVersion);

            if (version.Major < 11)
            {
                UIBarButtonItem.Appearance.SetBackButtonTitlePositionAdjustment(new UIOffset(0, -System.nfloat.MaxValue), UIBarMetrics.LandscapePhone);
                UIBarButtonItem.Appearance.SetBackButtonTitlePositionAdjustment(new UIOffset(0, -System.nfloat.MaxValue), UIBarMetrics.Default);
            }

            UISegmentedControl.Appearance.TintColor = UIColor.FromRGB(110, 110, 117);
            UISegmentedControl.AppearanceWhenContainedIn(typeof(UINavigationBar)).TintColor = UIColor.White;

            // Composer Input Accessory Buttons
            UIButton.AppearanceWhenContainedIn(typeof(UIScrollView)).TintColor = UIColor.FromRGB(50, 50, 50);

            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(MonoTouch.SlideoutNavigation.MainNavigationController)).TintColor = iconColor;

            EmptyListView.DefaultColor        = primaryColor;
            LoadingIndicatorView.DefaultColor = primaryColor;
        }
Exemplo n.º 5
0
        public static void Setup()
        {
            UIGraphics.BeginImageContext(new CoreGraphics.CGSize(1, 64f));
            Theme.PrimaryNavigationBarColor.SetFill();
            UIGraphics.RectFill(new CoreGraphics.CGRect(0, 0, 1, 64));
            var img = UIGraphics.GetImageFromCurrentImageContext();

            UIGraphics.EndImageContext();

            UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;

            var navBarContainers = new [] { typeof(MenuNavigationController), typeof(ThemedNavigationController), typeof(MainNavigationController) };

            foreach (var navbarAppearance in navBarContainers.Select(x => UINavigationBar.AppearanceWhenContainedIn(x)))
            {
                navbarAppearance.TintColor       = Theme.PrimaryNavigationBarTextColor;
                navbarAppearance.BarTintColor    = Theme.PrimaryNavigationBarColor;
                navbarAppearance.BackgroundColor = Theme.PrimaryNavigationBarColor;
                navbarAppearance.SetTitleTextAttributes(new UITextAttributes {
                    TextColor = Theme.PrimaryNavigationBarTextColor, Font = UIFont.SystemFontOfSize(18f)
                });
                navbarAppearance.SetBackgroundImage(img, UIBarPosition.Any, UIBarMetrics.Default);
                navbarAppearance.BackIndicatorImage = Images.BackButton;
                navbarAppearance.BackIndicatorTransitionMaskImage = Images.BackButton;
            }

            UISegmentedControl.Appearance.TintColor = UIColor.FromRGB(110, 110, 117);
            UISegmentedControl.AppearanceWhenContainedIn(typeof(UINavigationBar)).TintColor = UIColor.White;

            UISwitch.Appearance.OnTintColor = UIColor.FromRGB(0x41, 0x83, 0xc4);

            // Composer Input Accessory Buttons
            UIButton.AppearanceWhenContainedIn(typeof(UIScrollView)).TintColor = Theme.PrimaryNavigationBarColor;

            //UITableViewHeaderFooterView.Appearance.TintColor = UIColor.FromRGB(228, 228, 228);
            var headerFooterContainers = new [] { typeof(UITableViewHeaderFooterView) };

            foreach (var navbarAppearance in headerFooterContainers)
            {
                UILabel.AppearanceWhenContainedIn(navbarAppearance).TextColor = UIColor.FromRGB(110, 110, 117);
                UILabel.AppearanceWhenContainedIn(navbarAppearance).Font      = UIFont.SystemFontOfSize(14f);
            }

            StringElement.DefaultTintColor = Theme.PrimaryNavigationBarColor;

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

            UIBarButtonItem.AppearanceWhenContainedIn(typeof(UISearchBar)).SetTitleTextAttributes(new UITextAttributes {
                TextColor = UIColor.White
            }, UIControlState.Normal);
        }
Exemplo n.º 6
0
        public void TextShadowOffset_7443()
        {
            if (!MFMailComposeViewController.CanSendMail)
            {
                Assert.Inconclusive("Not configured to send emails");
            }

            var cancelAttributes = new UITextAttributes();

            cancelAttributes.TextShadowOffset = new UIOffset(0, -1);
            UIBarButtonItem.AppearanceWhenContainedIn(typeof(UISearchBar)).SetTitleTextAttributes(cancelAttributes, UIControlState.Disabled);
            using (var mail = new MFMailComposeViewController()) {
                // we're happy the .ctor did not crash (only on iOS6) because the dictionary had a null key (typo)
                Assert.That(mail.Handle, Is.Not.EqualTo(IntPtr.Zero));
            }
        }
Exemplo n.º 7
0
        public static void Setup()
        {
            var theme = new Theme();

            CurrentTheme = theme;
            CodeFramework.iOS.Theme.CurrentTheme = theme;
            RepositoryCellView.RoundImages       = true;
            MonoTouch.Dialog.StyledStringElement.DefaultTitleFont = UIFont.SystemFontOfSize(15f);
            MonoTouch.Dialog.NameTimeStringElement.NameColor      = Theme.CurrentTheme.MainTitleColor;

            UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;

            UINavigationBar.Appearance.TintColor    = UIColor.White;
            UINavigationBar.Appearance.BarTintColor = UIColor.FromRGB(45, 80, 148);
            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);


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

            UserVoice.UVStyleSheet.Instance.NavigationBarTintColor = UIColor.White;
            UserVoice.UVStyleSheet.Instance.NavigationBarTextColor = UIColor.White;

            UISegmentedControl.Appearance.TintColor          = UIColor.FromRGB(45, 80, 148);
            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);

//            CodeFramework.Elements.NewsFeedElement.LinkColor = theme.MainTitleColor;
//            CodeFramework.Elements.NewsFeedElement.TextColor = theme.MainTextColor;
//            CodeFramework.Elements.NewsFeedElement.NameColor = theme.MainTitleColor;
        }
Exemplo n.º 8
0
        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;
        }
Exemplo n.º 9
0
        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;
        }
Exemplo n.º 10
0
        public static void Setup()
        {
            UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;

            var menuNavBarBackground = CreateBackgroundImage(Theme.PrimaryMenuNavigationBarColor);
            var menuNavBarContainer  = UINavigationBar.AppearanceWhenContainedIn(typeof(MenuNavigationController));

            menuNavBarContainer.TintColor       = Theme.PrimaryMenuNavigationBarTextColor;
            menuNavBarContainer.BarTintColor    = Theme.PrimaryMenuNavigationBarColor;
            menuNavBarContainer.BackgroundColor = Theme.PrimaryMenuNavigationBarColor;
            menuNavBarContainer.SetTitleTextAttributes(new UITextAttributes {
                TextColor = Theme.PrimaryMenuNavigationBarTextColor, Font = UIFont.SystemFontOfSize(18f)
            });
            menuNavBarContainer.SetBackgroundImage(menuNavBarBackground, UIBarPosition.Any, UIBarMetrics.Default);
            menuNavBarContainer.BackIndicatorImage = Images.BackButton;
            menuNavBarContainer.BackIndicatorTransitionMaskImage = Images.BackButton;

            UISegmentedControl.Appearance.TintColor = UIColor.FromRGB(110, 110, 117);
            UISegmentedControl.AppearanceWhenContainedIn(typeof(UINavigationBar)).TintColor = UIColor.White;

            // Composer Input Accessory Buttons
            UIButton.AppearanceWhenContainedIn(typeof(UIScrollView)).TintColor = Theme.PrimaryNavigationBarColor;

            //UITableViewHeaderFooterView.Appearance.TintColor = UIColor.FromRGB(228, 228, 228);
            var headerFooterContainers = new [] { typeof(UITableViewHeaderFooterView) };

            foreach (var navbarAppearance in headerFooterContainers)
            {
                UILabel.AppearanceWhenContainedIn(navbarAppearance).TextColor = UIColor.FromRGB(110, 110, 117);
                UILabel.AppearanceWhenContainedIn(navbarAppearance).Font      = UIFont.SystemFontOfSize(14f);
            }

            MenuSectionView.DefaultBackgroundColor = Theme.PrimaryMenuNavigationBarColor;
            MenuSectionView.DefaultTextColor       = Theme.MenuSectionTextColor;

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

            UIBarButtonItem.AppearanceWhenContainedIn(typeof(UISearchBar)).SetTitleTextAttributes(new UITextAttributes {
                TextColor = UIColor.White
            }, UIControlState.Normal);
        }
Exemplo n.º 11
0
        private void Theme()
        {
            //UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;

            UISwitch.Appearance.OnTintColor = UIColor.FromRGB(45, 80, 148);

            UINavigationBar.Appearance.TintColor    = UIColor.White;
            UINavigationBar.Appearance.BarTintColor = UIColor.FromRGB(45, 80, 148);
            UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes {
                TextColor = UIColor.White, Font = UIFont.SystemFontOfSize(18f)
            });
            UINavigationBar.Appearance.BackIndicatorImage = CodeFramework.iOS.Images.BackButton;
            UINavigationBar.Appearance.BackIndicatorTransitionMaskImage = CodeFramework.iOS.Images.BackButton;

            UIImageView.AppearanceWhenContainedIn(typeof(UITableViewCell)).TintColor = UIColor.FromRGB(45, 80, 148);

            MonoTouch.Dialog.SplitButtonElement.TextColor = UIColor.FromRGB(45, 80, 148);

            //CodeFramework.iOS.Utils.Hud.BackgroundTint = UIColor.FromRGBA(228, 228, 228, 128);

            //UISegmentedControl.Appearance.TintColor = UIColor.FromRGB(45,80,148);

            UISegmentedControl.AppearanceWhenContainedIn(typeof(UINavigationController)).TintColor = UIColor.White;

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

//            CodeFramework.iOS.Views.StartupView.TextColor = UIColor.FromWhiteAlpha(0.9f, 1.0f);
//            CodeFramework.iOS.Views.StartupView.SpinnerColor = UIColor.FromWhiteAlpha(0.85f, 1.0f);
//            CodeFramework.iOS.Views.StartupView.StatusBarStyle = UIStatusBarStyle.LightContent;
        }
Exemplo n.º 12
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Forms.Init();

            if (!Resolver.IsSet)
            {
                SetIoc();
            }

            _lockService       = Resolver.Resolve <ILockService>();
            _deviceInfoService = Resolver.Resolve <IDeviceInfoService>();
            _pushHandler       = new iOSPushNotificationHandler(Resolver.Resolve <IPushNotificationListener>());
            _nfcDelegate       = new NFCReaderDelegate((success, message) => ProcessYubikey(success, message));
            var appIdService = Resolver.Resolve <IAppIdService>();

            var crashManagerDelegate = new HockeyAppCrashManagerDelegate(
                appIdService, Resolver.Resolve <IAuthService>());
            var manager = BITHockeyManager.SharedHockeyManager;

            manager.Configure("51f96ae568ba45f699a18ad9f63046c3", crashManagerDelegate);
            manager.CrashManager.CrashManagerStatus = BITCrashManagerStatus.AutoSend;
            manager.UserId = appIdService.AppId;
            manager.StartManager();
            manager.Authenticator.AuthenticateInstallation();
            manager.DisableMetricsManager = manager.DisableFeedbackManager = manager.DisableUpdateManager = true;

            LoadApplication(new App.App(
                                null,
                                Resolver.Resolve <IAuthService>(),
                                Resolver.Resolve <IConnectivity>(),
                                Resolver.Resolve <IDatabaseService>(),
                                Resolver.Resolve <ISyncService>(),
                                Resolver.Resolve <ISettings>(),
                                _lockService,
                                Resolver.Resolve <ILocalizeService>(),
                                Resolver.Resolve <IAppInfoService>(),
                                Resolver.Resolve <IAppSettingsService>(),
                                Resolver.Resolve <IDeviceActionService>()));

            // Appearance stuff

            var primaryColor = new UIColor(red: 0.24f, green: 0.55f, blue: 0.74f, alpha: 1.0f);
            var grayLight    = new UIColor(red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f);

            UINavigationBar.Appearance.ShadowImage = new UIImage();
            UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default);
            UIBarButtonItem.AppearanceWhenContainedIn(new Type[] { typeof(UISearchBar) }).TintColor = primaryColor;
            UIButton.AppearanceWhenContainedIn(new Type[] { typeof(UISearchBar) }).SetTitleColor(primaryColor,
                                                                                                 UIControlState.Normal);
            UIButton.AppearanceWhenContainedIn(new Type[] { typeof(UISearchBar) }).TintColor = primaryColor;
            UIStepper.Appearance.TintColor = grayLight;
            UISlider.Appearance.TintColor  = primaryColor;

            MessagingCenter.Subscribe <Xamarin.Forms.Application, ToolsExtensionPage>(
                Xamarin.Forms.Application.Current, "ShowAppExtension", (sender, page) =>
            {
                var itemProvider           = new NSItemProvider(new NSDictionary(), Core.Constants.UTTypeAppExtensionSetup);
                var extensionItem          = new NSExtensionItem();
                extensionItem.Attachments  = new NSItemProvider[] { itemProvider };
                var activityViewController = new UIActivityViewController(new NSExtensionItem[] { extensionItem }, null);
                activityViewController.CompletionHandler = (activityType, completed) =>
                {
                    page.EnabledExtension(completed && activityType == "com.8bit.bitwarden.find-login-action-extension");
                };

                var modal = UIApplication.SharedApplication.KeyWindow.RootViewController.ModalViewController;
                if (activityViewController.PopoverPresentationController != null)
                {
                    activityViewController.PopoverPresentationController.SourceView = modal.View;
                    var frame     = UIScreen.MainScreen.Bounds;
                    frame.Height /= 2;
                    activityViewController.PopoverPresentationController.SourceRect = frame;
                }

                modal.PresentViewController(activityViewController, true, null);
            });

            MessagingCenter.Subscribe <Xamarin.Forms.Application, bool>(Xamarin.Forms.Application.Current,
                                                                        "ListenYubiKeyOTP", (sender, listen) =>
            {
                if (_deviceInfoService.NfcEnabled)
                {
                    _nfcSession?.InvalidateSession();
                    _nfcSession?.Dispose();
                    _nfcSession = null;
                    if (listen)
                    {
                        _nfcSession = new NFCNdefReaderSession(_nfcDelegate, null, true);
                        _nfcSession.AlertMessage = AppResources.HoldYubikeyNearTop;
                        _nfcSession.BeginSession();
                    }
                }
            });

            UIApplication.SharedApplication.StatusBarHidden = false;
            UIApplication.SharedApplication.StatusBarStyle  = UIStatusBarStyle.LightContent;

            MessagingCenter.Subscribe <Xamarin.Forms.Application, bool>(Xamarin.Forms.Application.Current,
                                                                        "ShowStatusBar", (sender, show) =>
            {
                UIApplication.SharedApplication.SetStatusBarHidden(!show, false);
            });

            ZXing.Net.Mobile.Forms.iOS.Platform.Init();
            return(base.FinishedLaunching(app, options));
        }
Exemplo n.º 13
0
        public static void Setup()
        {
            var theme = new Theme();

            CurrentTheme = theme;

            var defaultValues = IoC.Resolve <IDefaultValueService>();

            bool largeFonts;

            if (!defaultValues.TryGet("large_fonts", out largeFonts))
            {
                largeFonts = false;
            }
            Theme.CurrentTheme.FontSizeRatio = largeFonts ? 1.3f : 1.0f;

            UIGraphics.BeginImageContext(new System.Drawing.SizeF(1, 64f));
            UIColor.FromRGB(50, 50, 50).SetFill();
            UIGraphics.RectFill(new System.Drawing.RectangleF(0, 0, 1, 64));
            var img = UIGraphics.GetImageFromCurrentImageContext();

            UIGraphics.EndImageContext();

            NameTimeStringElement.NameColor = Theme.CurrentTheme.MainTitleColor;
            //Element.FontSizeRatio = Theme.CurrentTheme.FontSizeRatio;

            UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;

            var navBarContainers = new [] { typeof(MenuNavigationController), typeof(ThemedNavigationController), typeof(MainNavigationController) };

            foreach (var navbarAppearance in navBarContainers.Select(x => UINavigationBar.AppearanceWhenContainedIn(x)))
            {
                navbarAppearance.TintColor       = UIColor.White;
                navbarAppearance.BarTintColor    = UIColor.FromRGB(50, 50, 50);
                navbarAppearance.BackgroundColor = UIColor.FromRGB(50, 50, 50);
                navbarAppearance.SetTitleTextAttributes(new UITextAttributes {
                    TextColor = UIColor.White, Font = UIFont.SystemFontOfSize(18f)
                });
                navbarAppearance.SetBackgroundImage(img, UIBarPosition.Any, UIBarMetrics.Default);
                //CodeFramework.iOS.Utils.Hud.BackgroundTint = UIColor.FromRGBA(228, 228, 228, 128);
                navbarAppearance.BackIndicatorImage = Images.BackButton;
                navbarAppearance.BackIndicatorTransitionMaskImage = Images.BackButton;
            }


//            UIBarButtonItem.Appearance.SetBackButtonTitlePositionAdjustment(new UIOffset(-1000, -64), UIBarMetrics.LandscapePhone);
//            UIBarButtonItem.Appearance.SetBackButtonTitlePositionAdjustment(new UIOffset(-1000, -64), UIBarMetrics.Default);
//
//            UserVoice.UVStyleSheet.Instance.NavigationBarTintColor = UIColor.White;
//            UserVoice.UVStyleSheet.Instance.NavigationBarTextColor = UIColor.White;

            UISegmentedControl.Appearance.TintColor = UIColor.FromRGB(110, 110, 117);
            UISegmentedControl.AppearanceWhenContainedIn(typeof(UINavigationBar)).TintColor = UIColor.White;

            // Composer Input Accessory Buttons
            UIButton.AppearanceWhenContainedIn(typeof(UIScrollView)).TintColor = UIColor.FromRGB(50, 50, 50);

            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 * Theme.CurrentTheme.FontSizeRatio);

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

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

//            CodeFramework.Elements.NewsFeedElement.LinkColor = theme.MainTitleColor;
//            CodeFramework.Elements.NewsFeedElement.TextColor = theme.MainTextColor;
//            CodeFramework.Elements.NewsFeedElement.NameColor = theme.MainTitleColor;
        }