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, m_showToneID, mListener, 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
NO_FULL_SCREEN_MARQUEE, SHOW_FULL_SCREEN_MARQUEE, 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_FROM_NOWHERE, FOCUS_LEFTWARD, FOCUS_NONE, FOCUS_RIGHTWARD, FOCUS_UPWARD, HEIGHT_AUTO, HEIGHT_FILL_TO_BOTTOM, HEIGHT_FILL_TO_TOP, HEIGHT_MATCH_CONTROL, HEIGHT_PERCENTAGE, POSITION_ABOVE, POSITION_ALIGN_BASELINE, POSITION_ALIGN_BOTTOM, POSITION_ALIGN_HORIZONTALLY, POSITION_ALIGN_LEFT, POSITION_ALIGN_PARENT_BOTTOM, POSITION_ALIGN_PARENT_RIGHT, POSITION_ALIGN_PARENT_TOP, POSITION_ALIGN_RIGHT, POSITION_ALIGN_TOP, POSITION_ALIGN_VERTICALLY, POSITION_BELOW, POSITION_BELOW_GROUP_BOX_HEADING, 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_AUTO, WIDTH_FILL_TO_LEFT, WIDTH_FILL_TO_RIGHT, WIDTH_MATCH_CONTROL, WIDTH_PERCENTAGE
 
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
 int getMaxDuration()
          Get the max record duration for this AudioRecordWindow.
 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().
 void onSystemFontChanged(int oldSize)
          Respond to the system font being changed.
 boolean receiveEvent(Event e)
          Entry point for event processing.
 void setMaxDuration(int milliseconds)
          Set the max record duration for this AudioRecordWindow.
 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, getFrameButtonListener, getFrameButtonWithID, getMaxWidth, getNumTopFrameButtons, getShowState, getShowToneID, getSleepScreenImage, 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, setOverrideMaxWidth, setShowCancel, setShowTone, setShowTone, setSize, setSleepScreenImage, setSleepScreenMessage, setSleepScreenMessage, setTitle, setTitle, setWidthToFitTitle, setWindowStyle, show, show, show, showInternal, snapToChildren, snapToChildren, startShowTone, startShowTone, startShowTone, startShowTone, stopShowTone, updateBottomButtonWidths, updateFrameButtonColors, wantsEndButton, wantsSendButton
 
Methods inherited from class danger.ui.Window
addTranslucentRegion, addTranslucentRegion, adjustActionMenuState, advanceFocus, autoHide, autoHideIfIdle, autoHideIfIdle, blocksAutomaticKeyGuard, blocksBackButton, blocksFloatingControls, blocksKeyGuard, blocksVolumeButtons, centerHorizontal, centerOnScreen, centerUnderTitleBar, centerVertical, disableControlWithID, dropOrphanedEvents, enableControlWithID, forwardQueuedEvents, getApplication, getDefaultFocus, getDefaultListener, getEffectiveWindow, getIDOfChild, getListener, getWindowBelow, hideActiveMenu, hideControlWithID, incrementMaxChildID, invalidate, isActionMenuVisible, isFullScreen, isUnresponsive, onActivate, onDeactivate, onPeriodicPulse, onWindowPaint, receiveMessage, removeTranslucentRegions, reverseFocus, setDefaultFocus, setDefaultListener, setEventArgForControlWithID, setFullScreen, setMaxChildID, setMaxControlID, setPosition, setShowFullScreenMarquee, setTitled, setTitleFormatDate, setTitleFormatText, setTitleFormatText, setTitleFormatText, setTitleFormatText, setTitleFormatText, setTransparent, shouldDropEvent, showControlWithID, startQueueingEvents, wantsMenuTrackball, 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, getData, 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, invalidateIndependentOfOrigin, invalidateIndependentOfOrigin, isEnabled, isFocusable, isFocused, isObscured, isOnScreen, isTransparent, isVisible, isVisibleInHierarchy, isVisibleOnScreen, justSetVisible, localToGlobal, localToGlobal, localToGlobalH, localToGlobalV, localToWindow, moveBy, notifyWhenFocusChanges, notifyWhenObscurityChanges, notifyWhenParentSizeChanges, notifyWhenPositionChanges, notifyWhenSizeChanges, notifyWhenVisibilityChanges, offsetOrigin, offsetOrigin, onAddedToParent, onEnabledStateChanged, onPositionChanged, onRemovedFromParent, onShortcut, onShortcut, onShortcutConsumed, onSizeChanged, onStyleChanged, onViewFocusChanged, onViewObscurityChanged, onViewPositionChanged, onViewSizeChanged, onViewVisibilityChanged, playLimitSound, receiveEventInternal, resetOrigin, sendEventToWindow, setAcceptFocus, setAtAndSpacePage, setBackground, setBackgroundColor, setBottom, setData, setDebugBounds, setDynamicHeight, setDynamicPosition, setDynamicWidth, setEnabled, setFocusTraversalDirection, setFocusTraversalFrom, setFocusTraversalPolicy, setFrame, setHeight, setKeyedValue, setLabelFont, setLeft, setMakeLimitNoise, setOrigin, setOrigin, setPartialFocusOK, setPreferredDirection, setRight, setScrollFocusMargin, setStyle, setStyleColor, setStyleFont, setStyleFrameColor, setTop, 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

onSystemFontChanged

public void onSystemFontChanged(int oldSize)
Description copied from class: View
Respond to the system font being changed. This method is called whenever the system font changes. It is only called if this View is part of a Window. This base class implementation, as well as all implementations in the library are empty, so you are not required to call the superclass method.

Overrides:
onSystemFontChanged 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 nothing.

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

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. This base class implementation handles event methods as specified by the eventMethod keyword in .rsrc files. If you override this method, be sure to call super.receiveEvent.

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

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

setRecordFormat

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

Parameters:
format - 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

getMaxDuration

public int getMaxDuration()
Get the max record duration for this AudioRecordWindow. This will return the duration set by setMaxDuration(int), or if that has not been called, the carrier default, which is usually 20 seconds.

Returns:
milliseconds to use for recording.
Since:
4.0

setMaxDuration

public void setMaxDuration(int milliseconds)
Set the max record duration for this AudioRecordWindow. This may be retrieved by getMaxDuration().

Parameters:
milliseconds - duration to use for recording.
Since:
4.0