danger.ui
Class AudioPreviewWindow

java.lang.Object
  extended by danger.app.Listener
      extended by danger.ui.View
          extended by danger.ui.Container
              extended by danger.ui.Window
                  extended by danger.ui.DialogWindow
                      extended by danger.ui.AudioPreviewWindow


public class AudioPreviewWindow
extends DialogWindow

Window used to preview an audio clip. You do not instantiate an AudioPreviewWindow directly. Instead, use play(java.lang.String, danger.audio.Tone).


Field Summary
 
Fields inherited from class danger.ui.DialogWindow
APP_ALERT_STYLE, APP_DIALOG_STYLE, BOTTOM_POSITION1, BOTTOM_POSITION2, BOTTOM_POSITION3, BUTTON_HEIGHT, m_autoCenter, m_bottomBorder, m_leftBorder, m_rightBorder, m_showTone, m_showToneID, m_toneAlarm, m_topBorder, mAutoSizeHeight, mAutoSizeWidth, MAX_BOTTOM_BUTTONS, MAX_BUTTONS, mBackEvent, mButtonIDs, mButtons, mCancelEvent, mCenterTitle, mDefaultButton, mDefaultButtonPosition, mHideOnButton, mLayoutButtonsVertically, mListener, mNeedToAddBottomFrameButtons, mNeedToAddTopFrameButtons, mRegisteredForKeyGuardEvent, mShortcutModifiers, mShortcuts, SHOW_STATE_HIDDEN, SHOW_STATE_SHOWING, SHOW_STATE_VISIBLE, SYSTEM_ALERT_TYPE_ALARM, SYSTEM_ALERT_TYPE_CONTROL, SYSTEM_ALERT_TYPE_GENERAL, SYSTEM_ALERT_TYPE_INCOMING_CALL, SYSTEM_ALERT_TYPE_MISSED_CALL, SYSTEM_ALERT_TYPE_PERSISTENT_CONTROL, SYSTEM_DIALOG_STYLE, SYSTEM_ERROR_STYLE, TOP_POSITION1, TOP_POSITION2
 
Fields inherited from class danger.ui.Window
mBusyPaintCount, mDefaultListener, STATE_AUTO_HIDE_IF_IDLE, STATE_DROP_ORPHANED_EVENTS, STATE_FULLSCREEN, STATE_UNUSED1
 
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
 
Method Summary
 boolean eventWidgetDown(int widget, Event event)
          Handle a button down event.
 void init(byte[] inAudioData, Tone inTone, int inPlayFilter)
           
 void init(File f, int inPlayFilter)
           
 void onDecoded()
          This method is called when this view has been completely decoded from a dialog or screen resource.
protected  void onHide()
          This method is called when this view is hidden, via the method View.hide().
static AudioPreviewWindow play(File f)
           
static AudioPreviewWindow play(String inTitle, byte[] inAudioData)
           
static AudioPreviewWindow play(String inTitle, byte[] inAudioData, int playFilter)
           
static AudioPreviewWindow play(String inTitle, File f)
           
static AudioPreviewWindow play(String inTitle, Tone tone)
           
static AudioPreviewWindow play(String inTitle, Tone tone, int playFilter)
           
 boolean receiveEvent(Event e)
          Entry point for event processing.
 void setDisplayedSize(int bytes)
           
 
Methods inherited from class danger.ui.DialogWindow
activateFrameButton, addBottomFrameButton, addBottomFrameButton, addBottomFrameButtons, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addTopFrameButton, addTopFrameButton, addTopFrameButtons, blocksChooser, calcBottom, convertShortcutKeyToButtonIndex, convertShortcutKeyToButtonIndex, disableBottomRightButtonOnEmptyField, disableButtonOnEmptyField, drawDialogStyleFrame, eventKeyUp, eventShortcut, eventWidgetUp, getCancelButton, getChildWithID, getContentRect, getDefaultFrameButton, getDescendantWithID, getFrameButtonWithID, getNumTopFrameButtons, getShowState, getSleepScreenImage, getSleepScreenMessage, getSleepScreenMessageCharSequence, getTitle, getTitleBarHeight, getTitleFont, getTitleSequence, getWidthToFitTitle, getWindowStyle, handleButtonShortcut, handleFrameButtonShortcut, handleShortcutKey, hasVisibleFrameButtons, hide, layoutTopFrameButtons, paint, positionDialog, reflowFrameButtons, removeAllChildren, removeFrameButtonWithID, setAutoCenter, setAutoSize, setAutoSizeHeight, setAutoSizeWidth, setBackEvent, setBorders, setCancelButtonEvent, setCenterTitle, setContentSize, setDefaultFrameButton, setDefaultFrameButton, setDrawBottomFrame, setEventForControlWithID, setEventForFrameButtonWithID, setFocusedChild, setFocusedDescendant, setForceDrawBottomFrame, setFrameButtonShortcut, setFrameButtonShortcut, setHideOnButtonEvent, setHideOnButtonWithID, setHideOnButtonWithPosition, setLayoutBottomFrameButtonsVertically, setListener, setNoDefaultFrameButton, setShowCancel, setShowTone, setShowTone, setSize, setSleepScreenMessage, setSleepScreenMessage, setTitle, setTitle, setWidthToFitTitle, setWindowStyle, show, show, show, showInternal, snapToChildren, startShowTone, stopShowTone, updateBottomButtonWidths, updateFrameButtonColors, wantsEndButton, wantsSendButton
 
Methods inherited from class danger.ui.Window
adjustActionMenuState, advanceFocus, autoHide, autoHideIfIdle, autoHideIfIdle, blocksBackButton, blocksFloatingControls, blocksKeyGuard, blocksVolumeButtons, centerHorizontal, centerOnScreen, centerUnderTitleBar, centerVertical, disableControlWithID, dropOrphanedEvents, enableControlWithID, forwardQueuedEvents, getApplication, getDefaultFocus, getIDOfChild, getListener, getWindowBelow, hideActiveMenu, hideControlWithID, incrementMaxChildID, isActionMenuVisible, isFullScreen, isUnresponsive, onActivate, onDeactivate, onPeriodicPulse, onWindowPaint, receiveMessage, reverseFocus, setDefaultFocus, setDefaultListener, setEventArgForControlWithID, setFullScreen, setMaxChildID, setMaxControlID, setPosition, setTitled, setTitleFormatDate, setTitleFormatText, setTitleFormatText, setTitleFormatText, setTitleFormatText, setTitleFormatText, shouldDropEvent, showControlWithID, startQueueingEvents, willPassEventToWindow
 
Methods inherited from class danger.ui.Container
addChild, addChild, addChildAt, addChildAt, addFromContainerResource, addFromContainerResource, addFromContainerResource, addFromDialogResource, addFromDialogResource, advanceFocusInWindow, childCount, childIsOnScreen, disable, enable, eventKeyDown, eventKeyHeld, eventKeyRepeat, eventPeriodicPulse, eventRawKeyDown, eventRawKeyHeld, eventRawKeyRepeat, eventRawKeyUp, eventWidgetHeld, focusedDescendantIsValid, getBottomChild, getBottomChild, getChildAt, getChildIndex, getControlWithID, getFirstChild, getFirstFocusableChild, getFocusableChildInWindow, getFocusedChild, getFocusedLeaf, getInterestingRect, getLastChild, getLastFocusableChild, getLeftMostChild, getNextFocusableChild, getNextFocusableChild, getPageHeight, getPrevFocusableChild, getPrevFocusableChild, getRightMostChild, getRightMostChild, hideAllChildren, isDescendant, keepRectInView, loseFocus, moveChildToIndex, onChildPositionChanged, onChildSizeChanged, onChildVisibilityChanged, pageToEnd, pageToHome, paintChildren, reflowChildren, removeChild, setFocusedChild, setFocusedChild, setFocusedDescendant, setFocusedDescendant, setFocusToFirstDescendant, setFormatDateForControlWithID, setFormatDateForTextControlWithID, setFormatTextForControlWithID, setFormatTextForControlWithID, setFormatTextForControlWithID, setFormatTextForControlWithID, setFormatTextForControlWithID, setFormatTextForTextControlWithID, setFormatTextForTextControlWithID, setFormatTextForTextControlWithID, setFormatTextForTextControlWithID, setFormatTextForTextControlWithID, setListenerForAllControls, setReflowAdjustHeight, setWindow, showAllChildren, snapHeightToChildren, snapHeightToChildren, snapWidthToChildren, snapWidthToChildren, takeFocus, willFocusWithin, willFocusWithin
 
Methods inherited from class danger.ui.View
boundsIntersect, boundsIntersect, canLoseFocus, clear, clear, copyStyle, getAcceptFocus, getBackgroundColor, getBottom, getBounds, getBounds, getFocusTraversalDirection, getFocusTraversalFrom, getFocusTraversalPolicy, getFrame, getFrame, getGlobalBottom, getGlobalLeft, getGlobalRight, getGlobalTop, getHeight, getID, getInterestingRect, getLabelFont, getLabelFont, getLeft, getOrigin, getOrigin, getOriginX, getOriginY, getParent, getParentContainer, getPartialFocusOK, getRight, getScrollFocusMargin, getSibling, getState, getStyle, getStyleColor, getStyleFont, getTop, getWidth, getWindow, globalToLocal, globalToLocalH, globalToLocalV, invalidate, invalidate, invalidate, invalidateIndependentOfOrigin, invalidateIndependentOfOrigin, isEnabled, isFocusable, isFocused, isOnScreen, isTransparent, isVisible, isVisibleInHierarchy, isVisibleOnScreen, justSetVisible, localToGlobal, localToGlobal, localToGlobalH, localToGlobalV, localToWindow, moveBy, notifyWhenParentSizeChanges, notifyWhenPositionChanges, notifyWhenSizeChanges, offsetOrigin, offsetOrigin, onAddedToParent, onEnabledStateChanged, onPositionChanged, onRemovedFromParent, onShortcut, onShortcut, onShortcutConsumed, onShow, onSizeChanged, onStyleChanged, onViewPositionChanged, onViewSizeChanged, 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, setPreferredDirection, setRight, setScrollFocusMargin, setStyle, setStyleColor, setStyleFont, setStyleFrameColor, setTop, setTransparent, setVisible, setWidth, showContextMenu, styleIsDefault, swapStyleColors, 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
 

Method Detail

onDecoded

public void onDecoded()
Description copied from class: View
This method is called when this view has been completely decoded from a dialog or screen resource. Base implementation does nothing. You will generally override this method and do any initialization before showing the window. Note that it is not safe to access a dialog or screen resource's children in the constructor, since the children have not yet been added. Override this method instead.

Overrides:
onDecoded in class View

init

public void init(byte[] inAudioData,
                 Tone inTone,
                 int inPlayFilter)

init

public void init(File f,
                 int inPlayFilter)

play

public static AudioPreviewWindow play(String inTitle,
                                      Tone tone)

play

public static AudioPreviewWindow play(String inTitle,
                                      Tone tone,
                                      int playFilter)

play

public static AudioPreviewWindow play(String inTitle,
                                      byte[] inAudioData)

play

public static AudioPreviewWindow play(String inTitle,
                                      byte[] inAudioData,
                                      int playFilter)

play

public static AudioPreviewWindow play(String inTitle,
                                      File f)

play

public static AudioPreviewWindow play(File f)

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

receiveEvent

public final 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 DialogWindow
Parameters:
e - non-null; the event to process
Returns:
whether (true) or not (false) this method actually handled the event to completion
See Also:
Listener.receiveEvent(danger.app.Event)

eventWidgetDown

public boolean eventWidgetDown(int widget,
                               Event event)
Description copied from class: Window
Handle a button down event.

Overrides:
eventWidgetDown in class DialogWindow
Parameters:
widget - the widget that went up
Returns:
whether or not the event was consumed
See Also:
View.eventWidgetDown(int, danger.app.Event)

setDisplayedSize

public void setDisplayedSize(int bytes)