Example #1
0
 protected virtual void OnBootstrapperStarted([CanBeNull] AndroidBootstrapperBase bootstrapper, [CanBeNull] Exception exception)
 {
     if (exception != null)
     {
         throw exception;
     }
 }
        private static void StartBootstrapperCallback(object state)
        {
            var       activityBase = (SplashScreenActivityBase)state;
            Exception exception    = null;

            try
            {
                if (_bootstrapper == null)
                {
                    _bootstrapper = activityBase.CreateBootstrapper();
                    _bootstrapper.Initialize();
                    //NOTE: to improve startup performance
                    TypeCache <View> .Initialize(null);

#if !API8
                    TypeCache <Fragment> .Initialize(null);
#endif
                }
                _bootstrapper.Start(activityBase.GetContext());
            }
            catch (Exception e)
            {
                Tracer.Error(e.Flatten(true));
                exception = e;
            }
            finally
            {
                activityBase.OnBootstrapperStarted(_bootstrapper, exception);
                Current = null;
                _state  = DefaultState;
            }
        }
Example #3
0
        private static void StartBootstrapperCallback(object state)
        {
            var       activityBase = (SplashScreenActivityBase)state;
            Exception exception    = null;

            try
            {
                if (_bootstrapper == null)
                {
                    _bootstrapper = activityBase.CreateBootstrapper();
                }
                _bootstrapper.Start();
            }
            catch (Exception e)
            {
                Tracer.Error(e.Flatten(true));
                exception = e;
            }
            finally
            {
                activityBase.OnBootstrapperStarted(_bootstrapper, exception);
                Current = null;
                _state  = DefaultState;
            }
        }
Example #4
0
        public virtual void OnCreate(int?viewId, Bundle savedInstanceState, Action <Bundle> baseOnCreate)
        {
            AndroidBootstrapperBase.EnsureInitialized();
            if (Tracer.TraceInformation)
            {
                Tracer.Info("OnCreate activity({0})", Target);
            }
            _bundle = savedInstanceState;
            OnCreate(savedInstanceState);

            baseOnCreate(savedInstanceState);

            var service = Get <INavigationService>();

            service.OnCreateActivity(Target);

            var handler = Created;

            if (handler != null)
            {
                handler(Target, new ValueEventArgs <Bundle>(savedInstanceState));
            }

            if (viewId.HasValue)
            {
                Target.SetContentView(viewId.Value);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            Application.SynchronizationContext.Post(SetContentViewAsync, this);
            if (Interlocked.Exchange(ref _state, StartedState) == DefaultState)
            {
                Current = this;
                if (_bootstrapper == null)
                    _bootstrapper = BootstrapperBase.Current as AndroidBootstrapperBase;
                if (_bootstrapper == null)
                    ThreadPool.QueueUserWorkItem(StartBootstrapperCallback, this);
                else
                    StartBootstrapperCallback(this);
            }
        }
        /// <summary>
        ///     Called when the activity is starting.
        /// </summary>
        public void OnCreate(Bundle savedInstanceState, Action <Bundle> baseOnCreate)
        {
            AndroidBootstrapperBase.EnsureInitialized();
            Tracer.Info("OnCreate activity({0})", Target);
            _bundle = savedInstanceState;
            OnCreate(savedInstanceState);

            var service = Get <INavigationService>();

            service.OnCreateActivity(Activity);

            baseOnCreate(savedInstanceState);

            var handler = Created;

            if (handler != null)
            {
                handler(Activity, new ValueEventArgs <Bundle>(savedInstanceState));
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            View content = _viewId.HasValue
                ? LayoutInflater.Inflate(_viewId.Value, null)
                : CreateDefaultView();
            if (content != null)
                SetContentView(content);

            if (Interlocked.Exchange(ref _state, StartedState) == DefaultState)
            {
                Current = this;
                if (_bootstrapper == null)
                    _bootstrapper = BootstrapperBase.Current as AndroidBootstrapperBase;
                if (_bootstrapper == null)
                    ThreadPool.QueueUserWorkItem(StartBootstrapperCallback, this);
                else
                    StartBootstrapperCallback(this);
            }
        }
Example #8
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            Application.SynchronizationContext.Post(SetContentViewAsync, this);
            if (Interlocked.Exchange(ref _state, StartedState) == DefaultState)
            {
                Current = this;
                if (_bootstrapper == null)
                {
                    _bootstrapper = BootstrapperBase.Current as AndroidBootstrapperBase;
                }
                if (_bootstrapper == null)
                {
                    ThreadPool.QueueUserWorkItem(StartBootstrapperCallback, this);
                }
                else
                {
                    StartBootstrapperCallback(this);
                }
            }
        }
Example #9
0
        private static void StartBootstrapperCallback(object state)
        {
            var       activityBase = (SplashScreenActivityBase)state;
            Exception exception    = null;
            AndroidBootstrapperBase bootstrapper = null;

            try
            {
                bootstrapper = AndroidBootstrapperBase.GetOrCreateBootstrapper(activityBase.CreateBootstrapper);
                bootstrapper.Start();
            }
            catch (Exception e)
            {
                Tracer.Error(e.Flatten(true));
                exception = e;
            }
            finally
            {
                activityBase.OnBootstrapperStarted(bootstrapper, exception);
                AndroidToolkitExtensions.SetCurrentActivity(activityBase, true);
                _state = DefaultState;
            }
        }
        public virtual void OnCreate(int?viewId, Bundle savedInstanceState, Action <Bundle> baseOnCreate)
        {
            AndroidBootstrapperBase.EnsureInitialized(Target, savedInstanceState);
            if (Tracer.TraceInformation)
            {
                Tracer.Info("OnCreate activity({0})", Target);
            }
            _savedInstanceState = savedInstanceState;
            OnCreate(savedInstanceState);

            baseOnCreate(savedInstanceState);
            _isCreated = true;

            var service = Get <INavigationService>();

            service.OnCreateActivity(Target, NavigationContext);

            Created?.Invoke(Target, new ValueEventArgs <Bundle>(savedInstanceState));

            if (viewId.HasValue)
            {
                Target.SetContentView(viewId.Value);
            }
        }
 private static void StartBootstrapperCallback(object state)
 {
     var activityBase = (SplashScreenActivityBase)state;
     Exception exception = null;
     try
     {
         if (_bootstrapper == null)
             _bootstrapper = activityBase.CreateBootstrapper();
         _bootstrapper.Start();
     }
     catch (Exception e)
     {
         Tracer.Error(e.Flatten(true));
         exception = e;
     }
     finally
     {
         activityBase.OnBootstrapperStarted(_bootstrapper, exception);
         Current = null;
         _state = DefaultState;
     }
 }