private void InitialiseStack() { iEventCreated.WaitOne(); iEventLock = new object(); iUserLogListener = new AndroidUserLogListener(); UserLog.AddListener(iUserLogListener); iTraceListener = new AndroidTraceListener(); Trace.AddListener(iTraceListener); iInvoker = new Invoker(this.ApplicationContext); iResourceManager = new AndroidResourceManager(this.Resources); iIconResolver = new IconResolver(iResourceManager); iLayoutInflater = (LayoutInflater)GetSystemService(Context.LayoutInflaterService); iHelperKinsky = new HelperKinsky(new string[2] { "-t", kTraceLevel }, Invoker); Android.Runtime.AndroidEnvironment.UnhandledExceptionRaiser += UnhandledExceptionRaiser; // name the crash dumper section general and add other UI options OptionPageCrashDumper generalOptions = new OptionPageCrashDumper("General"); iOptionExtendedTrackInfo = new OptionBool("trackinfo", "Extended track info", "Show extended track information for the current track", true); generalOptions.Add(iOptionExtendedTrackInfo); iOptionEnableRocker = new OptionBool("rocker", "Button controls", "Enable button controls for controlling volume and seeking", false); generalOptions.Add(iOptionEnableRocker); iOptionGroupTracks = new OptionBool("groupplaylist", "Group playlist tracks", "Grouping tracks by album within the playlist window", true); generalOptions.Add(iOptionGroupTracks); iOptionAutoLock = new OptionEnum("autolock", "Prevent auto-lock", "When to prevent auto-lock"); iOptionAutoLock.AddDefault(kAutoLockNever); iOptionAutoLock.Add(kAutoLockCharging); iOptionAutoLock.Add(kAutoLockAlways); generalOptions.Add(iOptionAutoLock); iOptionAutoLock.EventValueChanged += OptionAutoLock_EventValueChangedHandler; iHelperKinsky.AddOptionPage(generalOptions); iHelperKinsky.SetStackExtender(this); iCrashLogDumper = new CrashDumper(this.ApplicationContext, Resource.Drawable.Icon, iHelperKinsky, generalOptions); iHelperKinsky.AddCrashLogDumper(iCrashLogDumper); iOptionInsertMode = new OptionInsertMode(); iHelperKinsky.AddOption(iOptionInsertMode); iViewMaster = new ViewMaster(); iHttpServer = new HttpServer(HttpServer.kPortKinskyDroid); iHttpClient = new HttpClient(); iLibrary = new MediaProviderLibrary(iHelperKinsky); iSharedPlaylists = new SharedPlaylists(iHelperKinsky); iLocalPlaylists = new LocalPlaylists(iHelperKinsky, false); PluginManager pluginManager = new PluginManager(iHelperKinsky, iHttpClient, new MediaProviderSupport(iHttpServer)); iLocator = new ContentDirectoryLocator(pluginManager, new AppRestartHandler()); OptionBool optionSharedPlaylists = iLocator.Add(SharedPlaylists.kRootId, iSharedPlaylists); OptionBool optionLocalPlaylists = iLocator.Add(LocalPlaylists.kRootId, iLocalPlaylists); iLocator.Add(MediaProviderLibrary.kLibraryId, iLibrary); iHelperKinsky.AddOptionPage(iLocator.OptionPage); iSaveSupport = new SaveSupport(iHelperKinsky, iSharedPlaylists, optionSharedPlaylists, iLocalPlaylists, optionLocalPlaylists); iPlaySupport = new PlaySupport(); iHelperKinsky.ProcessOptionsFileAndCommandLine(); Linn.Kinsky.Model model = new Linn.Kinsky.Model(iViewMaster, iPlaySupport); iMediator = new Mediator(iHelperKinsky, model); iAndroidViewMaster = new AndroidViewMaster(this, iViewMaster, iInvoker, iResourceManager, iSaveSupport, iIconResolver, iOptionGroupTracks, iOptionExtendedTrackInfo, IsTabletView ? kMaxImageCacheSizeTablet : kMaxImageCacheSizePhone); iStackWatchdog = new System.Threading.Timer(StackWatchdogExpired); iPowerListener = new PowerStateListener(this.ApplicationContext); iPowerListener.EventPowerStateChanged += EventPowerStateChangedHandler; iIsCharging = PowerStateListener.IsConnected(this.ApplicationContext); iRescanTimer = new System.Threading.Timer((e) => { Rescan(); }); iRescanTimer.Change(Timeout.Infinite, Timeout.Infinite); SetAutoLock(); EventLowMemory += EventLowMemoryHandler; iInitialised = true; StartStack(); }
public IconResolver(AndroidResourceManager aResourceManager) { iResourceManager = aResourceManager; }