public class ShiftManager
extends java.lang.Object
createShiftView(), the registration of ShiftActions
registerAction(ShiftAction), and subscribing to changes in ShiftValues.
In order to use ShiftManager, you must first call
initialize(Context, ShiftVisibilityClient) or
initialize(Context, ShiftVisibilityClient, Class)
before calling getInstance()| Modifier and Type | Method and Description |
|---|---|
ShiftLauncherView |
createShiftView()
Returns a new ShiftLauncherView.
|
ShiftLauncherView |
createShiftViewAndShowFloatingIcon(FragmentActivity activity)
Returns a new ShiftLauncherView and automatically calls
ShiftLauncherView.showFloatingIcon(FragmentActivity) for you |
static ShiftManager |
getInstance()
Returns an instance of ShiftManager.
|
ShiftVisibilityClient |
getVisibilityClient()
Returns the ShiftVisibilityClient that was set in
initialize(Context, ShiftVisibilityClient)
or setVisibilityClient(ShiftVisibilityClient) |
static void |
initialize(android.content.Context context,
ShiftVisibilityClient shiftVisibilityClient)
Initializes ShiftManager.
|
static void |
initialize(android.content.Context context,
ShiftVisibilityClient shiftVisibilityClient,
java.lang.Class launcherClass)
Initializes ShiftManager
Use this if you want the ability to restart your application when ShiftValues are updated
Must call either this method or
initialize(Context, ShiftVisibilityClient, Class)
before calling getInstance() |
void |
registerAction(ShiftAction action)
Registers an action that can be run in Shift
|
void |
setLauncherClassForRestart(java.lang.Class launcherClass)
Provides the client applications Launcher class to Shift so that
ShiftValue
can be registered using subscribeShiftValueForRestart(ShiftValue). |
void |
setVisibilityClient(ShiftVisibilityClient visibilityClient)
Sets the visiblity client that determines whether or not a user can see Shift
|
void |
subscribeShiftValueForRestart(ShiftValue shiftValue)
Registers a
ShiftValue to trigger the app to restart. |
void |
subscribeToUpdatesForAllShiftValues(ShiftValueListener listener)
Registers your Activity to call shiftValuesUpdated when any
ShiftValue has been modified |
void |
subscribeToUpdatesForShiftValue(ShiftValueListener listener,
ShiftValue value)
Registers your ShiftValueListener to call shiftValuesUpdated
when the given
ShiftValue has been modified |
void |
subscribeToUpdatesForShiftValues(ShiftValueListener listener,
ShiftValue[] values)
Registers your Activity to call
ShiftValueListener.onShiftValuesUpdated(ShiftValue)
when the given ShiftValue have been modified |
void |
unsubscribeToUpdatesForAllShiftValues(ShiftValueListener listener)
Must be called on your Activity's onDestroy if you previously called
subscribeToUpdatesForAllShiftValues(ShiftValueListener) in your Activity's onCreate
Your Activity will no longer receive updates when a ShiftValue has been updated |
void |
unsubscribeToUpdatesForShiftValue(ShiftValueListener listener,
ShiftValue value)
Must be called on your Activity's onDestroy if you previously called
subscribeToUpdatesForShiftValue(ShiftValueListener, ShiftValue)
in your Activity's onCreate. |
void |
unsubscribeToUpdatesForShiftValues(ShiftValueListener listener,
ShiftValue[] values)
Must be called on your Activity's onDestroy if you previously called
subscribeToUpdatesForShiftValues(ShiftValueListener, ShiftValue[])
in your Activity's onCreate. |
public static ShiftManager getInstance()
initialize(Context, ShiftVisibilityClient) or
initialize(Context, ShiftVisibilityClient, Class)
before calling this methodpublic static void initialize(android.content.Context context,
ShiftVisibilityClient shiftVisibilityClient)
initialize(Context, ShiftVisibilityClient, Class)
before calling getInstance()context - shiftVisibilityClient - Determines whether or not a user can view the ShiftLauncherViewpublic static void initialize(android.content.Context context,
ShiftVisibilityClient shiftVisibilityClient,
java.lang.Class launcherClass)
initialize(Context, ShiftVisibilityClient, Class)
before calling getInstance()context - shiftVisibilityClient - Determines whether or not a user can view the ShiftLauncherViewlauncherClass - Your Applications LAUNCHER android.app.Activity class.public ShiftLauncherView createShiftView()
ShiftLauncherView.showFloatingIcon(FragmentActivity) to make the
floating icon appear, or they can hook up their own button to show the ShiftMenu
using ShiftLauncherView.showShiftMenu(FragmentActivity)public ShiftLauncherView createShiftViewAndShowFloatingIcon(FragmentActivity activity)
ShiftLauncherView.showFloatingIcon(FragmentActivity) for youactivity - public ShiftVisibilityClient getVisibilityClient()
initialize(Context, ShiftVisibilityClient)
or setVisibilityClient(ShiftVisibilityClient)public void setVisibilityClient(ShiftVisibilityClient visibilityClient)
public void setLauncherClassForRestart(java.lang.Class launcherClass)
ShiftValue
can be registered using subscribeShiftValueForRestart(ShiftValue).public void subscribeShiftValueForRestart(ShiftValue shiftValue)
ShiftValue to trigger the app to restart.
Must first set launcher class for restart using
setLauncherClassForRestart(Class) before calling this.public void subscribeToUpdatesForAllShiftValues(ShiftValueListener listener)
ShiftValue has been modifiedpublic void subscribeToUpdatesForShiftValue(ShiftValueListener listener, ShiftValue value)
ShiftValue has been modifiedpublic void subscribeToUpdatesForShiftValues(ShiftValueListener listener, ShiftValue[] values)
ShiftValueListener.onShiftValuesUpdated(ShiftValue)
when the given ShiftValue have been modifiedpublic void unsubscribeToUpdatesForAllShiftValues(ShiftValueListener listener)
subscribeToUpdatesForAllShiftValues(ShiftValueListener) in your Activity's onCreate
Your Activity will no longer receive updates when a ShiftValue has been updatedpublic void unsubscribeToUpdatesForShiftValue(ShiftValueListener listener, ShiftValue value)
subscribeToUpdatesForShiftValue(ShiftValueListener, ShiftValue)
in your Activity's onCreate. Your Activity will no longer receive
updates when the given ShiftValue has been updatedpublic void unsubscribeToUpdatesForShiftValues(ShiftValueListener listener, ShiftValue[] values)
subscribeToUpdatesForShiftValues(ShiftValueListener, ShiftValue[])
in your Activity's onCreate. Your Activity will no longer receive updates when the given
ShiftValue have been updatedpublic void registerAction(ShiftAction action)