public void RegisterDependencies(IMutableDependencyResolver resolver)
 {
     resolver.RegisterConstant(mainActivity.Application, typeof(Application));
     resolver.RegisterConstant(mainActivity, typeof(Context));
     resolver.RegisterLazySingleton(() => new AndroidActivityPresenter(), typeof(IPagePresenter));
     resolver.RegisterLazySingleton(() => Locator.Current.GetService <IPagePresenter>(), typeof(IPresenter));
     resolver.RegisterLazySingleton(() =>
     {
         var callbacks = new AndroidActivityCallbacks();
         mainActivity.Application.RegisterActivityLifecycleCallbacks(callbacks);
         return(callbacks);
     }, typeof(AndroidActivityCallbacks));
     resolver.Register(() => Locator.Current.GetService <AndroidSuspensionNotifierHelper>().LatestBundle, typeof(Bundle));
     resolver.RegisterLazySingleton(
         () => new AndroidSuspensionNotifierHelper(savedInstanceState),
         typeof(AndroidSuspensionNotifierHelper));
     resolver.RegisterLazySingleton(
         () => new AndroidBundleObjectStateStore(),
         typeof(IObjectStateStore));
     resolver.RegisterLazySingleton(() =>
                                    new BooleanToViewStateTypeConverter(),
                                    typeof(IBindingTypeConverter));
     resolver.RegisterConstant(new JsonSerializerSettings()
     {
         TypeNameHandling = TypeNameHandling.Auto
     }, typeof(JsonSerializerSettings));
 }
Example #2
0
 public AndroidActivityPresenter(Application application = null, Context context = null, IViewTypeLocator viewLocator = null)
     : base(application, context, viewLocator)
 {
     ActivityCallbacks = new AndroidActivityCallbacks();
     Application.RegisterActivityLifecycleCallbacks(ActivityCallbacks);
 }