public final class AutoDisposeAndroidPlugins
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isLockdown()
Returns true if the plugins were locked down.
|
static void |
lockdown()
Prevents changing the plugins from then on.
|
static boolean |
onCheckMainThread(BooleanSupplier defaultChecker)
Returns
true if called on the main thread, false if not. |
static void |
reset()
Removes all handlers and resets to default behavior.
|
static void |
setOnCheckMainThread(BooleanSupplier mainThreadChecker)
Sets the preferred main thread checker.
|
public static void lockdown()
This allows container-like environments to prevent client messing with plugins.
public static boolean isLockdown()
public static void setOnCheckMainThread(BooleanSupplier mainThreadChecker)
null, the mainThreadChecker will
be preferred in all main thread checks in onCheckMainThread(BooleanSupplier) calls.
This can be useful for JVM testing environments, where standard Android Looper APIs cannot be
stubbed and thus should be overridden with a custom check.
This is a reset-able API, which means you can pass null as the parameter value to reset
it. Alternatively, you can call reset().
mainThreadChecker - a BooleanSupplier to call to check if current execution is
on the main thread. Should return true if it is on the main
thread or false if not.public static boolean onCheckMainThread(BooleanSupplier defaultChecker)
true if called on the main thread, false if not. This will prefer a set
checker via setOnCheckMainThread(BooleanSupplier) if one is present, otherwise it will
use defaultChecker.defaultChecker - the default checker to fall back to if there is no main thread checker
set.true if called on the main thread, false if not.public static void reset()