Beispiel #1
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;
            UINavigationBar.Appearance.TintColor = UIColor.White;
            UINavigationBar.Appearance.BarTintColor = UIColor.FromRGB(50, 50, 50);
            UINavigationBar.Appearance.BackgroundColor = UIColor.FromRGB(50, 50, 50);
            UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes { TextColor = UIColor.White, Font = UIFont.SystemFontOfSize(18f) });
            UINavigationBar.Appearance.SetBackgroundImage(img, UIBarPosition.Any, UIBarMetrics.Default);
            //CodeFramework.iOS.Utils.Hud.BackgroundTint = UIColor.FromRGBA(228, 228, 228, 128);
            UINavigationBar.Appearance.BackIndicatorImage = Images.BackButton;
            UINavigationBar.Appearance.BackIndicatorTransitionMaskImage = Images.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;
        }
Beispiel #2
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);
            UINavigationBar.Appearance.BackIndicatorImage = Images.Buttons.BackButton;
            UINavigationBar.Appearance.BackIndicatorTransitionMaskImage = Images.Buttons.BackButton;

            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;
        }
Beispiel #3
0
        private void InitializeApp(NSDictionary options)
        {
            // Stamp the date this was installed (first run)
            var installedDate = this.StampInstallDate("CodeHub", DateTime.Now.ToString());

            if (installedDate < new DateTime(2015, 12, 5))
            {
                IsPro = true;
            }

            // Register default settings from the settings.bundle
            RegisterDefaultSettings();

            Locator.CurrentMutable.InitializeFactories();
            Locator.CurrentMutable.InitializeServices();
            Bootstrap.Init();

            _settingsChangedObserver = NSNotificationCenter.DefaultCenter.AddObserver((NSString)"NSUserDefaultsDidChangeNotification", DefaultsChanged);

            System.Net.ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;

            OctokitClientFactory.CreateMessageHandler = () => new System.Net.Http.HttpClientHandler();
            GitHubSharp.Client.ClientConstructor      = () => new HttpClient(new HttpMessageHandler());

            var viewModelViews      = Locator.Current.GetService <IViewModelViewService>();
            var defaultValueService = Locator.Current.GetService <IDefaultValueService>();

            viewModelViews.RegisterViewModels(typeof(SettingsViewController).Assembly);

            Theme.Setup();
            Theme.SetPrimary(null);
//
//            Locator.Current.GetService<ISessionService>().AccountObservable.Subscribe(x => {
//            });

//            try
//            {
//                Data.LegacyMigration.Migrate(Locator.Current.GetService<IAccountsRepository>());
//            }
//            catch (Exception e)
//            {
//                this.Log().DebugException("Unable to migrate db!", e);
//            }

            bool hasSeenWelcome;

            if (!defaultValueService.TryGet("HAS_SEEN_WELCOME_INTRO", out hasSeenWelcome) || !hasSeenWelcome)
            {
                defaultValueService.Set("HAS_SEEN_WELCOME_INTRO", true);
                var welcomeViewController = new WelcomePageViewController();
                welcomeViewController.WantsToDimiss += GoToStartupView;
                TransitionToViewController(welcomeViewController);
            }
            else
            {
                GoToStartupView();
            }

            SetupPushNotifications();
            HandleNotificationOptions(options);
        }
Beispiel #4
0
        /// <summary>
        /// Finished the launching.
        /// </summary>
        /// <param name="app">The app.</param>
        /// <param name="options">The options.</param>
        /// <returns>True or false.</returns>
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Window    = new UIWindow(UIScreen.MainScreen.Bounds);
            Presenter = new IosViewPresenter(this.Window);
            var setup = new Setup(this, Presenter);

            setup.Initialize();

            // Initialize the error service!
            var errorService = Mvx.Resolve <IErrorService>();

            errorService.Init();

            var culture = new System.Globalization.CultureInfo("en");

            System.Threading.Thread.CurrentThread.CurrentUICulture         = culture;
            System.Globalization.CultureInfo.DefaultThreadCurrentUICulture = culture;

            // Setup theme
            UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.LightContent, true);
            Theme.Setup();

            var features            = Mvx.Resolve <IFeaturesService>();
            var defaultValueService = Mvx.Resolve <IDefaultValueService>();
            var purchaseService     = Mvx.Resolve <IInAppPurchaseService>();

            purchaseService.ThrownExceptions.Subscribe(ex => {
                AlertDialogService.ShowAlert("Error Purchasing", ex.Message);
                errorService.Log(ex);
            });

            #if DEBUG
            features.ActivateProDirect();
            #endif

//            options = new NSDictionary (UIApplication.LaunchOptionsRemoteNotificationKey,
//                new NSDictionary ("r", "octokit/octokit.net", "i", "739", "u", "thedillonb"));
//
            if (options != null)
            {
                if (options.ContainsKey(UIApplication.LaunchOptionsRemoteNotificationKey))
                {
                    var remoteNotification = options[UIApplication.LaunchOptionsRemoteNotificationKey] as NSDictionary;
                    if (remoteNotification != null)
                    {
                        HandleNotification(remoteNotification, true);
                    }
                }
            }

            // Set the client constructor
            GitHubSharp.Client.ClientConstructor = () => new HttpClient(new HttpMessageHandler());

            bool hasSeenWelcome;
            if (!defaultValueService.TryGet("HAS_SEEN_WELCOME_INTRO", out hasSeenWelcome) || !hasSeenWelcome)
            {
                defaultValueService.Set("HAS_SEEN_WELCOME_INTRO", true);
                var welcomeViewController = new CodeHub.iOS.ViewControllers.Walkthrough.WelcomePageViewController();
                welcomeViewController.WantsToDimiss += GoToStartupView;
                TransitionToViewController(welcomeViewController);
            }
            else
            {
                GoToStartupView();
            }

            Window.MakeKeyAndVisible();

            // Notifications don't work on teh simulator so don't bother
            if (Runtime.Arch != Arch.SIMULATOR && features.IsProEnabled)
            {
                RegisterUserForNotifications();
            }

            return(true);
        }
Beispiel #5
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;
            UINavigationBar.Appearance.TintColor           = UIColor.White;
            UINavigationBar.Appearance.BarTintColor        = UIColor.FromRGB(50, 50, 50);
            UINavigationBar.Appearance.BackgroundColor     = UIColor.FromRGB(50, 50, 50);
            UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes {
                TextColor = UIColor.White, Font = UIFont.SystemFontOfSize(18f)
            });
            UINavigationBar.Appearance.SetBackgroundImage(img, UIBarPosition.Any, UIBarMetrics.Default);
            //CodeFramework.iOS.Utils.Hud.BackgroundTint = UIColor.FromRGBA(228, 228, 228, 128);
            UINavigationBar.Appearance.BackIndicatorImage = Images.BackButton;
            UINavigationBar.Appearance.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;
        }