org.solovyev.android
Class App

java.lang.Object
  extended by org.solovyev.android.App

public final class App
extends Object

This class aggregates several useful in any Android application interfaces and provides access to Application object from a static context. NOTE: use this class only if you don't use and dependency injection library (if you use any you can directly set interfaces through it).

Before first usage this class must be initialized by calling init(android.app.Application) method (for example, from Application.onCreate())


Method Summary
static
<A extends android.app.Application>
A
getApplication()
           
static org.solovyev.common.listeners.JEventListeners<org.solovyev.common.listeners.JEventListener<? extends org.solovyev.common.listeners.JEvent>,org.solovyev.common.listeners.JEvent> getEventBus()
           
static
<L extends ServiceLocator>
L
getLocator()
           
static org.solovyev.common.threads.DelayedExecutor getUiThreadExecutor()
          Method returns executor which runs on Main Application's thread.
static
<A extends android.app.Application & ServiceLocator>
void
init(A application)
           
static void init(android.app.Application application, ServiceLocator serviceLocator)
           
static void init(android.app.Application application, UiThreadExecutor uiThreadExecutor, org.solovyev.common.listeners.JEventListeners<org.solovyev.common.listeners.JEventListener<? extends org.solovyev.common.listeners.JEvent>,org.solovyev.common.listeners.JEvent> eventBus, ServiceLocator serviceLocator)
           
static boolean isInitialized()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

init

public static <A extends android.app.Application & ServiceLocator> void init(@Nonnull
                                                                            A application)

init

public static void init(@Nonnull
                        android.app.Application application,
                        @Nullable
                        ServiceLocator serviceLocator)

init

public static void init(@Nonnull
                        android.app.Application application,
                        @Nonnull
                        UiThreadExecutor uiThreadExecutor,
                        @Nonnull
                        org.solovyev.common.listeners.JEventListeners<org.solovyev.common.listeners.JEventListener<? extends org.solovyev.common.listeners.JEvent>,org.solovyev.common.listeners.JEvent> eventBus,
                        @Nullable
                        ServiceLocator serviceLocator)

isInitialized

public static boolean isInitialized()
Returns:
if App has already been initialized, false otherwise

getApplication

@Nonnull
public static <A extends android.app.Application> A getApplication()
Type Parameters:
A - real type of application
Returns:
application instance which was provided in init(android.app.Application) method

getLocator

@Nonnull
public static <L extends ServiceLocator> L getLocator()
Type Parameters:
L - real type of service locator
Returns:
instance of service locator user in application

getUiThreadExecutor

@Nonnull
public static org.solovyev.common.threads.DelayedExecutor getUiThreadExecutor()
Method returns executor which runs on Main Application's thread. It's safe to do all UI work on this executor

Returns:
UI thread executor

getEventBus

@Nonnull
public static org.solovyev.common.listeners.JEventListeners<org.solovyev.common.listeners.JEventListener<? extends org.solovyev.common.listeners.JEvent>,org.solovyev.common.listeners.JEvent> getEventBus()
Returns:
application's event bus


Copyright © 2013. All Rights Reserved.