danger.ui
Class AudioRecordWindow

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.AudioRecordWindow


public class AudioRecordWindow
extends DialogWindow

Window used to record audio.

You do not instantiate an AudioRecordWindow directly. Instead, use create(danger.app.Event, danger.app.Event, boolean). Once the recording is finished, call getRingToneObject() to get the audio.


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, 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
static AudioRecordWindow create(Event doneEvent, Event cancelEvent, boolean immediate)
          Create an AudioRecordWindow.
 boolean eventWidgetUp(int w, Event e)
          Handle the release of a device widget
 RingToneObject getRingToneObject()
          Get the audio that was recorded.
 boolean isRecording()
          Returns true if the record process is currently active
 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().
protected  void onShow()
          This method is called when this view is shown, via the method View.show().
 boolean receiveEvent(Event e)
          Entry point for event processing.
 void setRecordFormat(int format)
          Set the audio format this AudioRecordWindow will use.
 void setRecordSampleRate(int sampleRate)
          Set the sample rate this AudioRecordWindow will use.
 boolean wasRecording()
          Returns true if the user at least tried to record
 
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, eventWidgetDown, 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, 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

create

public static AudioRecordWindow create(Event doneEvent,
                                       Event cancelEvent,
                                       boolean immediate)
Create an AudioRecordWindow.

Parameters:
doneEvent - event to send when the user is done recording audio
cancelEvent - event to send if the user cancels the operation
immediate - if true, recording starts immediately; if false, recording does not start until the user presses the record button. Default values for record format = WAV_IMA_ADPCM, sample rate = 8000. See setRecordFormat(int) and setRecordSampleRate(int) to set other values.

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

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

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 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)

eventWidgetUp

public boolean eventWidgetUp(int w,
                             Event e)
Description copied from class: Container
Handle the release of a device widget

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

setRecordFormat

public void setRecordFormat(int format)
Set the audio format this AudioRecordWindow will use.

Parameters:
audio - format to use for recording; currently supports two formats: Format.RecordType.WAV Format.RecordType.WAV_IMA_ADPCM
Since:
3.0

setRecordSampleRate

public void setRecordSampleRate(int sampleRate)
Set the sample rate this AudioRecordWindow will use.

Parameters:
sampleRate - sample rate to use for recording. Must be between 8000 and 44100; if not, the default sample rate is used (8000).
Since:
3.0

getRingToneObject

public RingToneObject getRingToneObject()
Get the audio that was recorded.


isRecording

public boolean isRecording()
Returns true if the record process is currently active

Since:
3.0

wasRecording

public boolean wasRecording()
Returns true if the user at least tried to record

Since:
3.0