danger.ui
Class AnimatedBitmapView

java.lang.Object
  extended by danger.app.Listener
      extended by danger.ui.View
          extended by danger.ui.AnimatedBitmapView


public class AnimatedBitmapView
extends View

Use an AnimatedBitmapView to display an AnimatedBitmap object. This class handles all of the timing and interaction with AnimatedBitmap. Generally, all you need to do is call setAnimation(danger.ui.AnimatedBitmap).


Field Summary
 
Fields inherited from class danger.ui.View
DEFAULT_SCROLL_FOCUS_MARGIN, FOCUS_DEFAULT, FOCUS_DOWNWARD, FOCUS_LEFTWARD, FOCUS_NONE, FOCUS_RIGHTWARD, FOCUS_UPWARD, mOriginX, mOriginY, mStyle, POSITION_ABOVE, POSITION_ALIGN_BASELINE, POSITION_ALIGN_BOTTOM, POSITION_ALIGN_HORIZONTALLY, POSITION_ALIGN_LEFT, POSITION_ALIGN_PARENT_BOTTOM, POSITION_ALIGN_PARENT_RIGHT, POSITION_ALIGN_RIGHT, POSITION_ALIGN_TOP, POSITION_ALIGN_VERTICALLY, POSITION_BELOW, POSITION_CENTER_HORIZONTALLY, POSITION_CENTER_VERTICALLY, POSITION_TO_LEFT, POSITION_TO_RIGHT, PREFER_DIRECTION_NONE, PREFER_HORIZONTAL_DIRECTION, PREFER_VERTICAL_DIRECTION, STATE_AT_AND_SPACE_PAGE, STATE_CAN_FOCUS, STATE_DEBUG_BOUNDS, STATE_ENABLED, STATE_FOCUSED, STATE_MAKE_DING, STATE_PARTIAL_FOCUS_OK, STATE_TRANSPARENT, STATE_VISIBLE, WIDTH_FILL_TO_RIGHT
 
Constructor Summary
AnimatedBitmapView()
          Create an instance.
 
Method Summary
protected  void onHide()
          This method is called when this view is hidden, via the method View.hide().
protected  void onShow()
          This method is called when this view is shown, via the method View.show().
 void paint(Pen pen)
          Draw the contents of this View.
 void play()
          Play the animation.
 boolean receiveEvent(Event e)
          Entry point for event processing.
 void setAnimation(AnimatedBitmap ab)
          Set the animation for the view.
 void setLoop(boolean loop)
          Specify whether the animation should loop.
 void stopPlaying()
          Stop playing the animation.
 
Methods inherited from class danger.ui.View
boundsIntersect, boundsIntersect, canLoseFocus, clear, clear, copyStyle, disable, enable, eventKeyDown, eventKeyHeld, eventKeyRepeat, eventKeyUp, eventPeriodicPulse, eventRawKeyDown, eventRawKeyHeld, eventRawKeyRepeat, eventRawKeyUp, eventShortcut, eventWidgetDown, eventWidgetHeld, eventWidgetUp, getAcceptFocus, getBackgroundColor, getBottom, getBounds, getBounds, getFocusTraversalDirection, getFocusTraversalFrom, getFocusTraversalPolicy, getFrame, getFrame, getGlobalBottom, getGlobalLeft, getGlobalRight, getGlobalTop, getHeight, getID, getInterestingRect, getInterestingRect, getLabelFont, getLabelFont, getLeft, getOrigin, getOrigin, getOriginX, getOriginY, getParent, getParentContainer, getPartialFocusOK, getRight, getScrollFocusMargin, getSibling, getState, getStyle, getStyleColor, getStyleFont, getTop, getWidth, getWindow, globalToLocal, globalToLocalH, globalToLocalV, hide, invalidate, invalidate, invalidate, invalidateIndependentOfOrigin, invalidateIndependentOfOrigin, isEnabled, isFocusable, isFocused, isOnScreen, isTransparent, isVisible, isVisibleInHierarchy, isVisibleOnScreen, justSetVisible, localToGlobal, localToGlobal, localToGlobalH, localToGlobalV, localToWindow, loseFocus, moveBy, notifyWhenParentSizeChanges, notifyWhenPositionChanges, notifyWhenSizeChanges, offsetOrigin, offsetOrigin, onAddedToParent, onDecoded, onEnabledStateChanged, onPeriodicPulse, onPositionChanged, onRemovedFromParent, onShortcut, onShortcut, onShortcutConsumed, onSizeChanged, onStyleChanged, onViewPositionChanged, onViewSizeChanged, onWindowPaint, pageToEnd, pageToHome, playLimitSound, receiveEventInternal, resetOrigin, sendEventToWindow, setAcceptFocus, setAtAndSpacePage, setBackground, setBackgroundColor, setBottom, setDebugBounds, setDynamicPosition, setDynamicWidth, setEnabled, setFocusTraversalDirection, setFocusTraversalFrom, setFocusTraversalPolicy, setFrame, setHeight, setKeyedValue, setLabelFont, setLeft, setMakeLimitNoise, setOrigin, setOrigin, setPartialFocusOK, setPosition, setPreferredDirection, setRight, setScrollFocusMargin, setSize, setStyle, setStyleColor, setStyleFont, setStyleFrameColor, setTop, setTransparent, setVisible, setWidth, setWindow, shouldDropEvent, show, showContextMenu, styleIsDefault, swapStyleColors, takeFocus, willFocusWithin, willFocusWithin, windowToLocal
 
Methods inherited from class danger.app.Listener
cancelEvents, childEventPump, childEventPumpDone, eventProblem, isDispatchingThread, sendEvent, sendEvent, sendEvent, sendEvent, sendEvent, sendLowPriorityEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnimatedBitmapView

public AnimatedBitmapView()
Create an instance.

Method Detail

onShow

protected void onShow()
Description copied from class: View
This method is called when this view is shown, via the method View.show(). It is called as the very last thing done by that method, and it is only ever called if the view was not already visible. Overriding this method is the recommended way to get special behavior when a view gets shown. The implementation in this class does nothin.

Overrides:
onShow in class View

onHide

protected void onHide()
Description copied from class: View
This method is called when this view is hidden, via the method View.hide(). It is called as the very last thing done by that method, and it is only ever called if the view was not already hidden. Overriding this method is the recommended way to get special behavior when a view gets hidden . The implementation in this class does nothin.

Overrides:
onHide in class View

setAnimation

public void setAnimation(AnimatedBitmap ab)
Set the animation for the view.


setLoop

public void setLoop(boolean loop)
Specify whether the animation should loop. By default, it does not.


receiveEvent

public boolean receiveEvent(Event e)
Description copied from class: Listener
Entry point for event processing. This method is called from a Dispatcher when it reads an Event in its queue that is targetted at this instance. The default behavior is to do nothing and return false. Subclasses are expected to override this method to do something more useful.

Overrides:
receiveEvent in class Listener
Parameters:
e - non-null; the event to process
Returns:
whether (true) or not (false) this method actually handled the event to completion

stopPlaying

public void stopPlaying()
Stop playing the animation. This is called automatically whenever the view is hidden. Stopping the animation causes all decoded frames to be released for garbage collection, unless the AnimatedBitmap was created using the AnimatedBitmap.CREATE_FLAG_PRE_DECODE or AnimatedBitmap.CREATE_FLAG_CONSERVE_MEM flags.


play

public void play()
Play the animation. This is generally called automatically when the view is visible on the screen, but you may want to call it explicitly if you call stopPlaying().


paint

public void paint(Pen pen)
Description copied from class: View
Draw the contents of this View. This method is called by the graphics system when the View needs to be repainted. A Pen will be provided which is appropriately clipped and translated for drawing on this View.

The implementation of this method in this class will merely call clear() pen, if this View is opaque (not transparent), and will do nothing otherwise. If you don't need this behavior, then there is no point in calling super.paint() in an overriding method.

Overrides:
paint in class View
Parameters:
pen - non-null; the pen to use for drawing operations