Exemplo n.º 1
0
        public static void Init(Application androidApp,
                                IStartup startup = null,
                                Action <IServiceCollection> platformBuild = null)
        {
            var callbacks = new ActivityLifecycleCallbacks();

            androidApp.RegisterActivityLifecycleCallbacks(callbacks);
            var context = new AndroidContext(androidApp, callbacks);

            InitPlatform(
                startup,
                services =>
            {
                services.AddSingleton(context);

                services.AddSingleton <IEnvironment, EnvironmentImpl>();
                services.AddSingleton <IConnectivity, ConnectivityImpl>();
                services.AddSingleton <IPowerManager, PowerManagerImpl>();
                services.AddSingleton <IJobManager, JobManager>();
                services.AddSingleton <IRepository, FileSystemRepositoryImpl>();
                services.AddSingleton <IFileSystem, FileSystemImpl>();
                services.AddSingleton <ISerializer, JsonNetSerializer>();
                services.AddSingleton <ISettings, SettingsImpl>();
                platformBuild?.Invoke(services);
            }
                );
        }
Exemplo n.º 2
0
 internal static int GetResourceIdByName(this AndroidContext context, string iconName) => context
 .AppContext
 .Resources
 .GetIdentifier(
     iconName,
     "drawable",
     context.AppContext.PackageName
     );
 internal static int GetColorByName(this AndroidContext context, string colorName) => context
 .AppContext
 .Resources
 .GetIdentifier(
     colorName,
     "color",
     context.AppContext.PackageName
     );
 public static bool IsAtLeastAndroid10(this AndroidContext context)
 => context.IsMinApiLevel(29);
Exemplo n.º 5
0
 public EnvironmentImpl(AndroidContext context) => this.context = context;
Exemplo n.º 6
0
 public AndroidSqliteDatabase(AndroidContext context) : base(context.AppContext, "shinystore.db", null, 1)
 {
 }