Package org.robolectric.shadows
Class ShadowLegacyMessage
java.lang.Object
org.robolectric.shadows.ShadowMessage
org.robolectric.shadows.ShadowLegacyMessage
@Implements(value=android.os.Message.class, isInAndroidSdk=false) public class ShadowLegacyMessage extends ShadowMessage
-
Nested Class Summary
Nested classes/interfaces inherited from class org.robolectric.shadows.ShadowMessage
ShadowMessage.Picker -
Constructor Summary
Constructors Constructor Description ShadowLegacyMessage() -
Method Summary
Modifier and Type Method Description MessagegetNext()Convenience method to provide getter access to the private fieldMessage.next.protected booleanisInUse()Convenience method to provide access to the privateMessage.isInUse()method.protected voidrecycle()Hook to unscheduled the callback when the message is recycled.voidrecycleUnchecked()Hook to unscheduled the callback when the message is recycled.voidsetNext(Message next)Convenience method to provide setter access to the private fieldMessage.next.voidsetScheduledRunnable(Runnable r)Stores theRunnableinstance that has been scheduled to invoke this message.
-
Constructor Details
-
ShadowLegacyMessage
public ShadowLegacyMessage()
-
-
Method Details
-
recycleUnchecked
Hook to unscheduled the callback when the message is recycled. Invokesunschedule()and then calls through to the package private methodMessage.recycleUnchecked()on the real object.- Specified by:
recycleUncheckedin classShadowMessage
-
recycle
Hook to unscheduled the callback when the message is recycled. Invokesunschedule()and then calls through toMessage.recycle()on the real object. -
setScheduledRunnable
Description copied from class:ShadowMessageStores theRunnableinstance that has been scheduled to invoke this message. This is called when the message is enqueued byShadowLegacyMessageQueue.enqueueMessage(android.os.Message, long)and is used when the message is recycled to ensure that the correctRunnableinstance is removed from the associated scheduler.- Specified by:
setScheduledRunnablein classShadowMessage- Parameters:
r- theRunnableinstance that is scheduled to trigger this message.#if ($api >= 21) * @see #recycleUnchecked() #else * @see #recycle() #end
Only supported in
LooperMode.Mode.LEGACY.
-
isInUse
Convenience method to provide access to the privateMessage.isInUse()method. Note that the definition of "in use" changed with API 21:In API 19, a message was only considered "in use" during its dispatch. In API 21, the message is considered "in use" from the time it is enqueued until the time that it is freshly obtained via a call to
Message.obtain(). This means that in API 21 messages that are in the recycled pool will still be marked as "in use".- Returns:
trueif the message is currently "in use",falseotherwise.
-
getNext
Description copied from class:ShadowMessageConvenience method to provide getter access to the private fieldMessage.next.Only supported in
LooperMode.Mode.LEGACY- Specified by:
getNextin classShadowMessage- Returns:
- The next message in the current message chain.
- See Also:
ShadowMessage.setNext(Message)
-
setNext
Description copied from class:ShadowMessageConvenience method to provide setter access to the private fieldMessage.next.Only supported in
LooperMode.Mode.LEGACY- Specified by:
setNextin classShadowMessage- Parameters:
next- the new next message for the current message.- See Also:
ShadowMessage.getNext()
-