com.blackledge.david.tivo.multitasker
Class MultiTaskerApplication

java.lang.Object
  extended by com.tivo.hme.sdk.HmeObject
      extended by com.tivo.hme.sdk.Resource
          extended by com.tivo.hme.sdk.StreamResource
              extended by com.tivo.hme.sdk.Application
                  extended by com.tivo.hme.bananas.BApplication
                      extended by com.blackledge.david.tivo.multitasker.MultiTaskerApplication
All Implemented Interfaces:
LocalOptionProvider, com.tivo.hme.bananas.IBananas, com.tivo.hme.interfaces.IApplication, com.tivo.hme.sdk.IHmeEventHandler, com.tivo.hme.sdk.IHmeProtocol
Direct Known Subclasses:
PictureInPicture, SampleMultitaskerApp, TivoSolitaireMulti, WeatherMultitaskerApp

public class MultiTaskerApplication
extends com.tivo.hme.bananas.BApplication
implements LocalOptionProvider

Superclass of any applications that want to take advantage of the Multitasker architecture to automatically get configurable audio handling, ticker, background images, etc. [Also sets up a factory to serve local files and scaled local images.] Includes an options system and a preferences editor screen accessed via the "Slow" button. Also supports arg "-uriAndTitle" to set the uri and title separately from that built into app. Use: -uriAndTitle uripath:TitleToUse

Version:
$Revision: 1.6 $

Nested Class Summary
 class MultiTaskerApplication.CallbackChain
          Callback class to chain two callbacks together - when this callback is invoked, first it schedules the next callback, then it runs the primary callback.
static interface MultiTaskerApplication.ICallback
          Interface for MultiTasker callbacks - uses animation chaining but easier to understand
 
Nested classes/interfaces inherited from class com.tivo.hme.sdk.Resource
com.tivo.hme.sdk.Resource.FontResource
 
Field Summary
static int LIMIT_TEXT_RENDER_HEIGHT
          according to an error logged: "rendered text exceeded max allowed dimensions of 1920x1080"
static int LIMIT_TEXT_RENDER_WIDTH
          according to an error logged: "rendered text exceeded max allowed dimensions of 1920x1080"
static String OPTION_AUDIO_CLASS
          What is the class used to supply the audio streams?
static String OPTION_AUDIO_HANDLE_CONTROLS
          Should audio handler try to interpret some remote commands to control the audio stream?
static String OPTION_AUDIO_HANDLE_CONTROLS_NEXT
           
static String OPTION_AUDIO_HANDLE_CONTROLS_PAUSE
           
static String OPTION_AUDIO_ON
          Should audio be used at all?
static String OPTION_AUDIO_RANDOM
          Should audio be provided in random order (if supported)?
static String OPTION_AUDIO_STATUS_SHOW
          Should audio show the status of the audio stream?
static String OPTION_BACKGROUND_IMAGE_CLASS
          what is the class used to supply image information?
static String OPTION_BACKGROUND_IMAGE_DELAY
          How long should the background image wait to change the image? in milliseconds.
static String OPTION_BACKGROUND_IMAGE_HANDLE_CONTROLS
          Should Background Image handler try to interpret some remote commands to control the Background Images?
static String OPTION_BACKGROUND_IMAGE_HANDLE_CONTROLS_NEXT
           
static String OPTION_BACKGROUND_IMAGE_HANDLE_CONTROLS_PAUSE
           
static String OPTION_BACKGROUND_IMAGE_HANDLE_CONTROLS_PUPD
           
static String OPTION_BACKGROUND_IMAGE_HISTORY
          Size of the History available for Background Images.
static String OPTION_BACKGROUND_IMAGE_ON
          Should images be used at all?
static String OPTION_BACKGROUND_IMAGE_PLANE
          What Bananas plane should the images be in? (above, normal, or below?)
static String OPTION_BACKGROUND_IMAGE_RANDOM
          Should images be provided in random order (if supported)?
static String OPTION_BACKGROUND_IMAGE_SIZE
          What size should the background image be? max, normal, safe...
static String OPTION_BACKGROUND_IMAGE_TRANSITION
          What transition should the images use to change?
static String OPTION_BACKGROUND_IMAGE_TRANSITION_DELAY
          How much time should it take to transition to the next image? (how gradual should it be?) in milliseconds
static String OPTION_BRAND_CLASS
          what is the class used to supply the brand information?
static String OPTION_BRAND_HEIGHT
           
static String OPTION_BRAND_ON
          Should the brand be used at all?
static String OPTION_BRAND_TIME
          How long between brand updates? (milliseconds)
static String OPTION_BRAND_TRANSITION_TIME
          How fast does the transition animate between brands? (milliseconds)
static String OPTION_BRAND_TRANSPARENCY
          What level of transparency should the brand use? (1.0 = invisible)
static String OPTION_BRAND_WIDTH
           
static String OPTION_HANDLE_CONTROLS_CLEAR
          Should "clear" toggle various decorative options (ticker, audio display, brand)?
static String OPTION_IDLE
          "idle" - How should the application respond to the idle event?
static String OPTION_LOCAL_FILE_ROOT
          "localRoot" - Folder to start at - defaults to user.home, but that only works when it's not run by a service...
static String OPTION_MEDIA_KEY
          Global useful option - your media key - enables Tivo media options such as TivoTicker.
static String OPTION_TICKER_TAPE_BACKGROUND
          What background (color as a hex rgb value) should the ticker use?
static String OPTION_TICKER_TAPE_CLASS
          what is the class used to supply the ticker information?
static String OPTION_TICKER_TAPE_FONT_FAMILY
          What font family should the ticker use? (default or system?)
static String OPTION_TICKER_TAPE_FOREGROUND
          What foreground (color as a hex rgb value) should the ticker use?
static String OPTION_TICKER_TAPE_HANDLE_CONTROLS
          Should tickertape handler try to interpret some remote commands to control the ticker?
static String OPTION_TICKER_TAPE_HANDLE_CONTROLS_NEXT
           
static String OPTION_TICKER_TAPE_HANDLE_CONTROLS_PAUSE
           
static String OPTION_TICKER_TAPE_HANDLE_CONTROLS_RWFF
           
static String OPTION_TICKER_TAPE_HEADING
          What part of the ticker is the height of the heading area?
static String OPTION_TICKER_TAPE_HEIGHT
          What is the total height of the screen real estate the ticker uses?
static String OPTION_TICKER_TAPE_ON
          Should the ticker be used at all?
static String OPTION_TICKER_TAPE_RANDOM
          Should ticker content be provided in random order (if supported)?
static String OPTION_TICKER_TAPE_TIME
          How much time should each letter of the ticker take to cross the screen? (in milliseconds)
static String OPTION_TICKER_TAPE_TRANSPARENCY
          What level of transparency should the ticker use? (1.0 = invisible)
static String OPTION_ZIP_CODE
          Global useful option...your zip code.
static int RSRC_STATUS_BUFFER_OVERFLOW
          Media status code, resource at end of available buffer.
static int RSRC_STATUS_END
          Media status code, resource at end of stream.
 
Fields inherited from class com.tivo.hme.bananas.BApplication
FADE_ANIM, SLIDE_ANIM
 
Fields inherited from class com.tivo.hme.sdk.Resource
EVT_RSRC_STATUS, status
 
Fields inherited from interface com.blackledge.david.tivo.multitasker.LocalOptionProvider
TYPE_BOOLEAN, TYPE_CLASS, TYPE_COLOR, TYPE_FILE, TYPE_FLOAT, TYPE_FOLDER, TYPE_IMAGE, TYPE_INTEGER, TYPE_STRING, TYPE_URL
 
Fields inherited from interface com.tivo.hme.bananas.IBananas
A_ANCHOR_MASK, A_BOTTOM, A_CENTER, A_DELTA_MASK, A_LEFT, A_NEGATIVE_MASK, A_RIGHT, A_TOP, ARROW_NAMES, BAR_DEFAULT, BAR_HANG, BEVT_ACTION, BEVT_FOCUS, BEVT_SCREEN_ENTER, BEVT_SCREEN_EXIT, H_BAR, H_DOWN, H_KEYBOARD, H_LEFT, H_PAGEDOWN, H_PAGEUP, H_RIGHT, H_UP, H_VIS_FALSE, H_VIS_FOCUS, H_VIS_TRUE, TRANSITION_FADE, TRANSITION_LEFT, TRANSITION_NONE
 
Fields inherited from interface com.tivo.hme.sdk.IHmeProtocol
APP_ERROR_BAD_ARGUMENT, APP_ERROR_BAD_COMMAND, APP_ERROR_OTHER, APP_ERROR_OUT_OF_MEMORY, APP_ERROR_RSRC_NOT_FOUND, APP_ERROR_UNKNOWN, APP_ERROR_VIEW_NOT_FOUND, CMD_RECEIVER_ACKNOWLEDGE_IDLE, CMD_RECEIVER_TRANSITION, CMD_RESERVED, CMD_RSRC_ADD_ANIM, CMD_RSRC_ADD_COLOR, CMD_RSRC_ADD_FONT, CMD_RSRC_ADD_IMAGE, CMD_RSRC_ADD_SOUND, CMD_RSRC_ADD_STREAM, CMD_RSRC_ADD_TEXT, CMD_RSRC_ADD_TTF, CMD_RSRC_CLOSE, CMD_RSRC_REMOVE, CMD_RSRC_SEND_EVENT, CMD_RSRC_SET_ACTIVE, CMD_RSRC_SET_POSITION, CMD_RSRC_SET_SPEED, CMD_VIEW_ADD, CMD_VIEW_REMOVE, CMD_VIEW_SET_BOUNDS, CMD_VIEW_SET_PAINTING, CMD_VIEW_SET_RESOURCE, CMD_VIEW_SET_SCALE, CMD_VIEW_SET_TRANSLATION, CMD_VIEW_SET_TRANSPARENCY, CMD_VIEW_SET_VISIBLE, EVT_APP_INFO, EVT_DEVICE_INFO, EVT_FONT_INFO, EVT_IDLE, EVT_INIT_INFO, EVT_KEY, EVT_RESERVED, EVT_RSRC_INFO, FONT_BOLD, FONT_BOLDITALIC, FONT_ITALIC, FONT_METRICS_BASIC, FONT_METRICS_GLYPH, FONT_PLAIN, ID_ALERT_SOUND, ID_BONK_SOUND, ID_CLIENT, ID_CLIENT_PRE_0_38, ID_DEFAULT_TTF, ID_DESELECT_SOUND, ID_ERROR_SOUND, ID_LEFT_SOUND, ID_NULL, ID_PAGEDOWN_SOUND, ID_PAGEUP_SOUND, ID_RESERVED, ID_RIGHT_SOUND, ID_ROOT_STREAM, ID_ROOT_VIEW, ID_SELECT_SOUND, ID_SLOWDOWN1_SOUND, ID_SPEEDUP1_SOUND, ID_SPEEDUP2_SOUND, ID_SPEEDUP3_SOUND, ID_SYSTEM_TTF, ID_THUMBSDOWN_SOUND, ID_THUMBSUP_SOUND, ID_TIVO_SOUND, ID_UPDOWN_SOUND, KEY_ADVANCE, KEY_CHANNELDOWN, KEY_CHANNELUP, KEY_CLEAR, KEY_DISPLAY, KEY_DOWN, KEY_ENTER, KEY_FORWARD, KEY_INFO, KEY_LEFT, KEY_LIVETV, KEY_MUTE, KEY_NUM0, KEY_NUM1, KEY_NUM2, KEY_NUM3, KEY_NUM4, KEY_NUM5, KEY_NUM6, KEY_NUM7, KEY_NUM8, KEY_NUM9, KEY_OPT_ANGLE, KEY_OPT_ASPECT, KEY_OPT_DVD, KEY_OPT_EXIT, KEY_OPT_GUIDE, KEY_OPT_LIST, KEY_OPT_MENU, KEY_OPT_PIP, KEY_OPT_STOP, KEY_OPT_TOP_MENU, KEY_OPT_WINDOW, KEY_PAUSE, KEY_PLAY, KEY_PRESS, KEY_RECORD, KEY_RELEASE, KEY_REPEAT, KEY_REPLAY, KEY_REVERSE, KEY_RIGHT, KEY_SELECT, KEY_SLOW, KEY_THUMBSDOWN, KEY_THUMBSUP, KEY_TIVO, KEY_UNKNOWN, KEY_UP, KEY_VOLUMEDOWN, KEY_VOLUMEUP, LIMIT_CMD_NBYTES, LIMIT_EVENT_NBYTES, LIMIT_FONT_POINT_SIZE, LIMIT_IMAGE_HEIGHT, LIMIT_IMAGE_NBYTES, LIMIT_IMAGE_WIDTH, LIMIT_SOUND_NBYTES, LIMIT_TEXT_NBYTES, LIMIT_URL_NBYTES, LIMIT_VIEW_DEPTH, MAGIC, RSRC_ERROR_BAD_ARGUMENT, RSRC_ERROR_BAD_DATA, RSRC_ERROR_BAD_MAGIC, RSRC_ERROR_BAD_STATE, RSRC_ERROR_BAD_VERSION, RSRC_ERROR_CONNECT_FAILED, RSRC_ERROR_CONNECTION_LOST, RSRC_ERROR_CONNECTION_TIMEOUT, RSRC_ERROR_HOST_NOT_FOUND, RSRC_ERROR_INCOMPATIBLE, RSRC_ERROR_NOT_SUPPORTED, RSRC_ERROR_OTHER, RSRC_ERROR_UNKNOWN, RSRC_HALIGN_CENTER, RSRC_HALIGN_LEFT, RSRC_HALIGN_MASK, RSRC_HALIGN_RIGHT, RSRC_IMAGE_BESTFIT, RSRC_IMAGE_HFIT, RSRC_IMAGE_MASK, RSRC_IMAGE_VFIT, RSRC_STATUS_CLOSED, RSRC_STATUS_COMPLETE, RSRC_STATUS_CONNECTED, RSRC_STATUS_CONNECTING, RSRC_STATUS_ERROR, RSRC_STATUS_LOADING, RSRC_STATUS_PAUSED, RSRC_STATUS_PLAYING, RSRC_STATUS_READY, RSRC_STATUS_SEEKING, RSRC_STATUS_UNKNOWN, RSRC_TEXT_MASK, RSRC_TEXT_WRAP, RSRC_VALIGN_BOTTOM, RSRC_VALIGN_CENTER, RSRC_VALIGN_MASK, RSRC_VALIGN_TOP, SAFE_ACTION_H, SAFE_ACTION_V, SAFE_TITLE_H, SAFE_TITLE_V, TRANSITION_BACK, TRANSITION_FORWARD, TRANSITION_TELEPORT, VERSION, VERSION_0_38, VERSION_0_40, VERSION_MAJOR, VERSION_MINOR, VERSION_STRING
 
Constructor Summary
MultiTaskerApplication()
           
 
Method Summary
 void addCallback(MultiTaskerApplication.ICallback callback, com.tivo.hme.sdk.Resource animation)
           
 boolean cancelCallback(MultiTaskerApplication.ICallback callback)
           
 com.tivo.hme.sdk.StreamResource createImageStream(String nextImageStream)
          USE THIS METHOD TO PREVENT CRASHES.
 com.tivo.hme.sdk.StreamResource createStream(String uri, String contentType, boolean play)
          Checks against IHmeProtocol.LIMIT_URL_NBYTES and uses MultiTaskerApplicationFactory.getShortMappedUri(String) to have the factory act as proxy so it still will work, also logs a warning.
 void destroy()
           
static String fixPoorUrl(String newUrl)
          Intended to fix e.g.
static com.tivo.hme.interfaces.IFactory getAppFactory(String appClassName, ClassLoader loader, com.tivo.hme.interfaces.IArgumentList args)
          overrides so MultiTasker's application factory is now the default.
 AudioView getAudioView()
           
 BackgroundView getBackgroundView()
           
 Boolean getBooleanOption(String key)
           
 Boolean getBooleanOption(String key, Boolean def)
           
 BrandView getBrandView()
           
 Color getColorOption(String key)
          key must be a hex value for the rgb representation of the color (may begin with 0x or not)
 Color getColorOption(String key, Color def)
           
 String getCurrentAudioStream()
          What stream is currently getting played by the audio task?
 com.tivo.hme.sdk.Resource getCurrentImage()
          What resource is currently getting displayed by the background image task?
 Float getFloatOption(String key)
           
 Float getFloatOption(String key, Float def)
           
 String getHostAddress()
          Get the IP address of the Tivo that is connected.
 Integer getIntegerOption(String key)
           
 Integer getIntegerOption(String key, Integer def)
           
 String getLocalOptionDefault(String key)
          By default, just returns whatever getOptionDefault(String) returns.
 Collection getLocalOptionNames()
          LocalOptionProvider default implementation.
 Map getLocalOptionPreferences()
          LocalOptionProvider default implementation - returns null(?an empty map).
 File getLocalRoot()
           
 String getOption(String key)
          If an option has an override, the override is returned no matter what.
 String getOption(String key, String def)
          equivalent to getOption(String), but returns def if the option is null.
 String getOptionDefault(String key)
          Override this method to provide your own default values for some options (return super implementation for things you're not providing a default for) (public just so preferences screen can use it).
 String getOptionOverride(String key)
          Override this method to override options with no ability for the user to change them for your app.
 String getOptionSetting(String key)
          Just the value set in the user settings for this option, ignoring overrides and defaults.
static Image getScaledImageByHeight(InputStream file, int height)
           
static Image getScaledImageByWidth(InputStream file, int width)
           
 TickerView getTickerView()
           
static String getUrlContent(URL _url, String contentTypeSubstring)
          Deprecated. Use Utility.getUrlContent(URL,String) instead
 boolean handleApplicationError(int errorCode, String errorText, Integer resourceId)
          Improved version of Application#handleApplicationError(int, String) that includes the resourceId related to the error - critical for knowing when you have a problem with a resource you created.
 boolean handleEvent(com.tivo.hme.sdk.HmeEvent event)
          In addition to various MultiTaskerApplication things (like callback/animation chaining, menu, etc), this also generates a ResourceInfo event with an error status when there is an application error that has a resource id.
 boolean handleIdle(boolean isIdle)
          Handles the idle/unidle events based on the OPTION_IDLE setting.
static List handleMultiStreamSource(String originalUrl)
          Deprecated. Use Utility.handleMultiStreamSource(String) instead
static String handleRedirect(String url)
          deal with redirect requests and use that Url instead.
 void hideAudio()
          Hide's the audio visual element (e.g.
 void hideBackgroundImage()
           
 void hideBrand()
           
 void hideTickerTape()
           
 void init(com.tivo.hme.interfaces.IContext context)
          Make sure you call super.init(context) if you override this method.
protected  boolean openMultiTaskerMenu()
          Opens the menu of multitasker options, including access to the settings.
 Map parseQuery(String query)
          SDK Bug Fix - OMG! sick bug in HMEObject that has never been noticed or exercised since nobody has apparently attempted to do App-in-app with HmeObject.createStream(String, Map).
 void postEvent(com.tivo.hme.sdk.HmeEvent event)
           
 void showAudio()
           
 void showBackgroundImage()
           
 void showBrand()
           
 void showTickerTape()
           
 void silenceAudio()
          Clears the current audio resource from the audio plugin's view.
 void toggleAudio()
           
 void toggleBackgroundImage()
           
 void toggleBrand()
           
 void toggleTickerTape()
           
static boolean validUrl(String url)
          Test that the string is a good url before sending it to the Tivo
 
Methods inherited from class com.tivo.hme.bananas.BApplication
dispatchEvent, dispatchKeyEvent, getAbove, getBelow, getCurrentScreen, getNormal, getSkin, getStackDepth, handleAction, play, playSoundForKey, pop, pop, push, push, setSkin
 
Methods inherited from class com.tivo.hme.sdk.Application
acknowledgeIdle, close, flush, getContext, getFactory, getFocus, getHeight, getResource, getResources, getRoot, getStream, getWidth, handleActive, handleApplicationError, handleChunk, handlePing, isAChunk, isApplicationClosing, log, open, setContext, setFactory, setFocus, transitionBack, transitionForward
 
Methods inherited from class com.tivo.hme.sdk.StreamResource
getContentType, getSpeed, getStatus, getURI, isPaused, pause, play, setPosition, setSpeed, toString
 
Methods inherited from class com.tivo.hme.sdk.Resource
addHandler, dump, finalize, remove, removeHandler, sendEvent, sendEvent, setActive
 
Methods inherited from class com.tivo.hme.sdk.HmeObject
createAnimation, createAnimation, createColor, createFont, createFont, createImage, createImage, createImage, createImage, createSound, createSound, createSound, createStream, createStream, createText, createTrueType, getApp, getID, handleKeyPress, handleKeyRelease, handleKeyRepeat, rsrcFlagsToString, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LIMIT_TEXT_RENDER_WIDTH

public static final int LIMIT_TEXT_RENDER_WIDTH
according to an error logged: "rendered text exceeded max allowed dimensions of 1920x1080"

See Also:
Constant Field Values

LIMIT_TEXT_RENDER_HEIGHT

public static final int LIMIT_TEXT_RENDER_HEIGHT
according to an error logged: "rendered text exceeded max allowed dimensions of 1920x1080"

See Also:
Constant Field Values

RSRC_STATUS_END

public static final int RSRC_STATUS_END
Media status code, resource at end of stream.

See Also:
Constant Field Values

RSRC_STATUS_BUFFER_OVERFLOW

public static final int RSRC_STATUS_BUFFER_OVERFLOW
Media status code, resource at end of available buffer.

See Also:
Constant Field Values

OPTION_AUDIO_HANDLE_CONTROLS

public static final String OPTION_AUDIO_HANDLE_CONTROLS
Should audio handler try to interpret some remote commands to control the audio stream?

See Also:
Constant Field Values

OPTION_AUDIO_HANDLE_CONTROLS_NEXT

public static final String OPTION_AUDIO_HANDLE_CONTROLS_NEXT
See Also:
Constant Field Values

OPTION_AUDIO_HANDLE_CONTROLS_PAUSE

public static final String OPTION_AUDIO_HANDLE_CONTROLS_PAUSE
See Also:
Constant Field Values

OPTION_AUDIO_STATUS_SHOW

public static final String OPTION_AUDIO_STATUS_SHOW
Should audio show the status of the audio stream?

See Also:
Constant Field Values

OPTION_AUDIO_CLASS

public static final String OPTION_AUDIO_CLASS
What is the class used to supply the audio streams?

See Also:
Constant Field Values

OPTION_AUDIO_ON

public static final String OPTION_AUDIO_ON
Should audio be used at all?

See Also:
Constant Field Values

OPTION_AUDIO_RANDOM

public static final String OPTION_AUDIO_RANDOM
Should audio be provided in random order (if supported)?

See Also:
Constant Field Values

OPTION_TICKER_TAPE_HANDLE_CONTROLS

public static final String OPTION_TICKER_TAPE_HANDLE_CONTROLS
Should tickertape handler try to interpret some remote commands to control the ticker?

See Also:
Constant Field Values

OPTION_TICKER_TAPE_HANDLE_CONTROLS_NEXT

public static final String OPTION_TICKER_TAPE_HANDLE_CONTROLS_NEXT
See Also:
Constant Field Values

OPTION_TICKER_TAPE_HANDLE_CONTROLS_RWFF

public static final String OPTION_TICKER_TAPE_HANDLE_CONTROLS_RWFF
See Also:
Constant Field Values

OPTION_TICKER_TAPE_HANDLE_CONTROLS_PAUSE

public static final String OPTION_TICKER_TAPE_HANDLE_CONTROLS_PAUSE
See Also:
Constant Field Values

OPTION_TICKER_TAPE_HEADING

public static final String OPTION_TICKER_TAPE_HEADING
What part of the ticker is the height of the heading area?

See Also:
Constant Field Values

OPTION_TICKER_TAPE_HEIGHT

public static final String OPTION_TICKER_TAPE_HEIGHT
What is the total height of the screen real estate the ticker uses?

See Also:
Constant Field Values

OPTION_TICKER_TAPE_FONT_FAMILY

public static final String OPTION_TICKER_TAPE_FONT_FAMILY
What font family should the ticker use? (default or system?)

See Also:
Constant Field Values

OPTION_TICKER_TAPE_TRANSPARENCY

public static final String OPTION_TICKER_TAPE_TRANSPARENCY
What level of transparency should the ticker use? (1.0 = invisible)

See Also:
Constant Field Values

OPTION_TICKER_TAPE_BACKGROUND

public static final String OPTION_TICKER_TAPE_BACKGROUND
What background (color as a hex rgb value) should the ticker use?

See Also:
Constant Field Values

OPTION_TICKER_TAPE_FOREGROUND

public static final String OPTION_TICKER_TAPE_FOREGROUND
What foreground (color as a hex rgb value) should the ticker use?

See Also:
Constant Field Values

OPTION_TICKER_TAPE_TIME

public static final String OPTION_TICKER_TAPE_TIME
How much time should each letter of the ticker take to cross the screen? (in milliseconds)

See Also:
Constant Field Values

OPTION_TICKER_TAPE_CLASS

public static final String OPTION_TICKER_TAPE_CLASS
what is the class used to supply the ticker information?

See Also:
Constant Field Values

OPTION_TICKER_TAPE_ON

public static final String OPTION_TICKER_TAPE_ON
Should the ticker be used at all?

See Also:
Constant Field Values

OPTION_TICKER_TAPE_RANDOM

public static final String OPTION_TICKER_TAPE_RANDOM
Should ticker content be provided in random order (if supported)?

See Also:
Constant Field Values

OPTION_BRAND_CLASS

public static final String OPTION_BRAND_CLASS
what is the class used to supply the brand information?

See Also:
Constant Field Values

OPTION_BRAND_ON

public static final String OPTION_BRAND_ON
Should the brand be used at all?

See Also:
Constant Field Values

OPTION_BRAND_TRANSPARENCY

public static final String OPTION_BRAND_TRANSPARENCY
What level of transparency should the brand use? (1.0 = invisible)

See Also:
Constant Field Values

OPTION_BRAND_TIME

public static final String OPTION_BRAND_TIME
How long between brand updates? (milliseconds)

See Also:
Constant Field Values

OPTION_BRAND_TRANSITION_TIME

public static final String OPTION_BRAND_TRANSITION_TIME
How fast does the transition animate between brands? (milliseconds)

See Also:
Constant Field Values

OPTION_BRAND_WIDTH

public static final String OPTION_BRAND_WIDTH
See Also:
Constant Field Values

OPTION_BRAND_HEIGHT

public static final String OPTION_BRAND_HEIGHT
See Also:
Constant Field Values

OPTION_BACKGROUND_IMAGE_DELAY

public static final String OPTION_BACKGROUND_IMAGE_DELAY
How long should the background image wait to change the image? in milliseconds. 0 or negative means don't automatically change.

See Also:
Constant Field Values

OPTION_BACKGROUND_IMAGE_TRANSITION_DELAY

public static final String OPTION_BACKGROUND_IMAGE_TRANSITION_DELAY
How much time should it take to transition to the next image? (how gradual should it be?) in milliseconds

See Also:
Constant Field Values

OPTION_BACKGROUND_IMAGE_TRANSITION

public static final String OPTION_BACKGROUND_IMAGE_TRANSITION
What transition should the images use to change?

See Also:
Constant Field Values

OPTION_BACKGROUND_IMAGE_PLANE

public static final String OPTION_BACKGROUND_IMAGE_PLANE
What Bananas plane should the images be in? (above, normal, or below?)

See Also:
Constant Field Values

OPTION_BACKGROUND_IMAGE_SIZE

public static final String OPTION_BACKGROUND_IMAGE_SIZE
What size should the background image be? max, normal, safe...

See Also:
Constant Field Values

OPTION_BACKGROUND_IMAGE_CLASS

public static final String OPTION_BACKGROUND_IMAGE_CLASS
what is the class used to supply image information?

See Also:
Constant Field Values

OPTION_BACKGROUND_IMAGE_HISTORY

public static final String OPTION_BACKGROUND_IMAGE_HISTORY
Size of the History available for Background Images.

See Also:
Constant Field Values

OPTION_BACKGROUND_IMAGE_ON

public static final String OPTION_BACKGROUND_IMAGE_ON
Should images be used at all?

See Also:
Constant Field Values

OPTION_BACKGROUND_IMAGE_HANDLE_CONTROLS

public static final String OPTION_BACKGROUND_IMAGE_HANDLE_CONTROLS
Should Background Image handler try to interpret some remote commands to control the Background Images?

See Also:
Constant Field Values

OPTION_BACKGROUND_IMAGE_HANDLE_CONTROLS_NEXT

public static final String OPTION_BACKGROUND_IMAGE_HANDLE_CONTROLS_NEXT
See Also:
Constant Field Values

OPTION_BACKGROUND_IMAGE_HANDLE_CONTROLS_PUPD

public static final String OPTION_BACKGROUND_IMAGE_HANDLE_CONTROLS_PUPD
See Also:
Constant Field Values

OPTION_BACKGROUND_IMAGE_HANDLE_CONTROLS_PAUSE

public static final String OPTION_BACKGROUND_IMAGE_HANDLE_CONTROLS_PAUSE
See Also:
Constant Field Values

OPTION_BACKGROUND_IMAGE_RANDOM

public static final String OPTION_BACKGROUND_IMAGE_RANDOM
Should images be provided in random order (if supported)?

See Also:
Constant Field Values

OPTION_ZIP_CODE

public static final String OPTION_ZIP_CODE
Global useful option...your zip code.

See Also:
Constant Field Values

OPTION_MEDIA_KEY

public static final String OPTION_MEDIA_KEY
Global useful option - your media key - enables Tivo media options such as TivoTicker.

See Also:
Constant Field Values

OPTION_IDLE

public static final String OPTION_IDLE
"idle" - How should the application respond to the idle event?

See Also:
Constant Field Values

OPTION_HANDLE_CONTROLS_CLEAR

public static final String OPTION_HANDLE_CONTROLS_CLEAR
Should "clear" toggle various decorative options (ticker, audio display, brand)?

See Also:
Constant Field Values

OPTION_LOCAL_FILE_ROOT

public static final String OPTION_LOCAL_FILE_ROOT
"localRoot" - Folder to start at - defaults to user.home, but that only works when it's not run by a service... defaults to C:/Documents and Settings/Owner otherwise.

See Also:
Constant Field Values
Constructor Detail

MultiTaskerApplication

public MultiTaskerApplication()
Method Detail

getAppFactory

public static com.tivo.hme.interfaces.IFactory getAppFactory(String appClassName,
                                                             ClassLoader loader,
                                                             com.tivo.hme.interfaces.IArgumentList args)
overrides so MultiTasker's application factory is now the default. If you set up a factory class yourself, it will use that instead - please subclass MultiTaskerApplicationFactory, though. Not a true override since it's static, but it works.

Parameters:
appClassName -
loader -
args -
Returns:
the factory that will handle http requests and static data for the multitasker elements

addCallback

public void addCallback(MultiTaskerApplication.ICallback callback,
                        com.tivo.hme.sdk.Resource animation)

cancelCallback

public boolean cancelCallback(MultiTaskerApplication.ICallback callback)
Parameters:
callback -
Returns:
true if the callback was cancelled, false if it wasn't found.

toggleBrand

public void toggleBrand()

hideBrand

public void hideBrand()

showBrand

public void showBrand()

toggleTickerTape

public void toggleTickerTape()

hideTickerTape

public void hideTickerTape()

showTickerTape

public void showTickerTape()

toggleBackgroundImage

public void toggleBackgroundImage()

hideBackgroundImage

public void hideBackgroundImage()

showBackgroundImage

public void showBackgroundImage()

toggleAudio

public void toggleAudio()

silenceAudio

public void silenceAudio()
Clears the current audio resource from the audio plugin's view.


hideAudio

public void hideAudio()
Hide's the audio visual element (e.g. percent complete)


showAudio

public void showAudio()

getCurrentAudioStream

public String getCurrentAudioStream()
What stream is currently getting played by the audio task?

Returns:
the stream's URI, or null.

getCurrentImage

public com.tivo.hme.sdk.Resource getCurrentImage()
What resource is currently getting displayed by the background image task?

Returns:
the Resource currently displayed (may get removed later)

getScaledImageByHeight

public static Image getScaledImageByHeight(InputStream file,
                                           int height)

getScaledImageByWidth

public static Image getScaledImageByWidth(InputStream file,
                                          int width)

handleEvent

public boolean handleEvent(com.tivo.hme.sdk.HmeEvent event)
In addition to various MultiTaskerApplication things (like callback/animation chaining, menu, etc), this also generates a ResourceInfo event with an error status when there is an application error that has a resource id. Note: it's sort of a side-effect (read: not totally reliable), but generally you will get an initial "key_release" event for the button pressed to start the application so you can start differently depending on whether it was a "right" "select" or "play"

Overrides:
handleEvent in class com.tivo.hme.bananas.BApplication
See Also:
BApplication.handleEvent(com.tivo.hme.sdk.HmeEvent)

handleIdle

public boolean handleIdle(boolean isIdle)
Handles the idle/unidle events based on the OPTION_IDLE setting.

Overrides:
handleIdle in class com.tivo.hme.sdk.Application
See Also:
Application.handleIdle(boolean)

getTickerView

public TickerView getTickerView()
Returns:
the specialized view for the TickerTape plugins.

getBrandView

public BrandView getBrandView()
Returns:
the specialized view for the Brand plugins.

getBackgroundView

public BackgroundView getBackgroundView()
Returns:
the specialized view for the BackgroundImage plugins.

getAudioView

public AudioView getAudioView()
Returns:
the specialized view for the Audio plugins.

getOption

public final String getOption(String key)
If an option has an override, the override is returned no matter what. If an option setting starts with a +, then it is appended (separated by a comma) to the default value.

Parameters:
key -
Returns:
the Option value in string form, or null if there is no setting or default.

getOptionSetting

public String getOptionSetting(String key)
Just the value set in the user settings for this option, ignoring overrides and defaults. First tries application settings, then global settings.

Parameters:
key -
Returns:

getOptionDefault

public String getOptionDefault(String key)
Override this method to provide your own default values for some options (return super implementation for things you're not providing a default for) (public just so preferences screen can use it). By default, just returns what getLocalOptionDefault(String) returns.

Parameters:
key -
Returns:

getOptionOverride

public String getOptionOverride(String key)
Override this method to override options with no ability for the user to change them for your app. (public just so preferences screen can use it)

Parameters:
key -
Returns:
the override value for this key. null if there is no override for this key.

getOption

public final String getOption(String key,
                              String def)
equivalent to getOption(String), but returns def if the option is null.

Parameters:
key -
def - the value to return if the option is null.
Returns:
the option value, or def.

getIntegerOption

public final Integer getIntegerOption(String key)
Parameters:
key -
Returns:
the option, converted to an Integer object.
See Also:
getOption(String)

getIntegerOption

public final Integer getIntegerOption(String key,
                                      Integer def)

getFloatOption

public final Float getFloatOption(String key)
Parameters:
key -
Returns:
the option converted to a Float object.
See Also:
getOption(String)

getFloatOption

public final Float getFloatOption(String key,
                                  Float def)

getBooleanOption

public final Boolean getBooleanOption(String key)
Parameters:
key -
Returns:
the option converted to a Boolean object.
See Also:
getOption(String)

getBooleanOption

public final Boolean getBooleanOption(String key,
                                      Boolean def)

getColorOption

public final Color getColorOption(String key)
key must be a hex value for the rgb representation of the color (may begin with 0x or not)

Parameters:
key -
Returns:
the option converted to a Color object
See Also:
getOption(String)

getColorOption

public final Color getColorOption(String key,
                                  Color def)

openMultiTaskerMenu

protected boolean openMultiTaskerMenu()
Opens the menu of multitasker options, including access to the settings.

Returns:
true always, currently

destroy

public void destroy()
Overrides:
destroy in class com.tivo.hme.sdk.Application

init

public void init(com.tivo.hme.interfaces.IContext context)
          throws Exception
Make sure you call super.init(context) if you override this method.

Overrides:
init in class com.tivo.hme.bananas.BApplication
Throws:
Exception
See Also:
BApplication.init(com.tivo.hme.interfaces.IContext)

postEvent

public void postEvent(com.tivo.hme.sdk.HmeEvent event)
Specified by:
postEvent in interface com.tivo.hme.sdk.IHmeEventHandler
Overrides:
postEvent in class com.tivo.hme.sdk.Resource

getLocalRoot

public File getLocalRoot()

handleApplicationError

public boolean handleApplicationError(int errorCode,
                                      String errorText,
                                      Integer resourceId)
Improved version of Application#handleApplicationError(int, String) that includes the resourceId related to the error - critical for knowing when you have a problem with a resource you created. Default implementation simply calls Application.handleApplicationError(int, String). ApplicationError codes 1 (e.g. "can't create rsrc. unsupported stream type /avatar/cf1e61a4330e75d5d1d7a744c5ef38c4") and 3 (e.g. "resource 2091 not found (type type[-1])") about a resource never provide a resourceinfo event!

Parameters:
errorCode - the error code of the error (one of the IHmeProtocol APP_ERROR_ constants)
errorText - details of the error
resourceId - the id associated with the error - could be null. Suitable for use with Application.getResource(Object) (or ((WeakReference)Application.getResources().get(Object)).get() to avoid automatic SDK warning message when it's not found)
Returns:
true if the event was handled.

createStream

public com.tivo.hme.sdk.StreamResource createStream(String uri,
                                                    String contentType,
                                                    boolean play)
Checks against IHmeProtocol.LIMIT_URL_NBYTES and uses MultiTaskerApplicationFactory.getShortMappedUri(String) to have the factory act as proxy so it still will work, also logs a warning.

Overrides:
createStream in class com.tivo.hme.sdk.HmeObject
See Also:
HmeObject.createStream(java.lang.String, java.lang.String, boolean)

parseQuery

public Map parseQuery(String query)
SDK Bug Fix - OMG! sick bug in HMEObject that has never been noticed or exercised since nobody has apparently attempted to do App-in-app with HmeObject.createStream(String, Map). They forgot a "new" keyword and auto-"fixed" the problem creating a method named LinkedHashMap that has default method content returning null! Also, calling code won't handle the nulls that are returned in certain circumstances, so now returning an empty map here. Lucky for us it is public and non-final.

Overrides:
parseQuery in class com.tivo.hme.sdk.HmeObject
See Also:
HmeObject.parseQuery(java.lang.String)

handleRedirect

public static String handleRedirect(String url)
deal with redirect requests and use that Url instead.

Parameters:
url - original URL
Returns:
new URL that won't request further redirection.

fixPoorUrl

public static String fixPoorUrl(String newUrl)
Intended to fix e.g. a url of the form "http://site.com/url with spaces and (bad chars).mp3" Currently: Uses URLEncoder on the content after the last slash and before any ?, but uses %20 instead of +.

Parameters:
newUrl -
Returns:

handleMultiStreamSource

public static List handleMultiStreamSource(String originalUrl)
Deprecated. Use Utility.handleMultiStreamSource(String) instead

Handle things like shoutcast files and xml content (assume it's an rss file with content as an enclosure entry for each item or (possibly multiple) media:content).

Parameters:
originalUrl -
Returns:
List of Urls gathered from the originalUrl, or a List containing only the originalUrl if it wasn't a MultiStream source.

getUrlContent

public static String getUrlContent(URL _url,
                                   String contentTypeSubstring)
                            throws IOException
Deprecated. Use Utility.getUrlContent(URL,String) instead

TODO move to utility. Get the content of a URL's page as a string.

Parameters:
_url -
contentTypeSubstring - if not null, this method will return null if the contentType of the url's connection is null or doesn't contain this substring.
Returns:
the content, or null if there was a problem
Throws:
IOException - if one happens while reading the stream (if one happens while connecting, null is returned)

validUrl

public static boolean validUrl(String url)
Test that the string is a good url before sending it to the Tivo

Parameters:
url -
Returns:
true if it is not a MalformedURL [NOT: or it starts with a / (not sure if that's reasonable, though... at least it takes care of the problem cases I've hit occasionally in RSS feeds, etc)]

getHostAddress

public String getHostAddress()
Get the IP address of the Tivo that is connected. This does not come from the context "Host" attribute, since that is the host serving this app, not the Tivo. This is gathered from the Context's socket. Retrieved via the public getSocket method which exists in the HME sample host's HostContext class. If your host is using a different class that doesn't have that method, then this will return null.


createImageStream

public com.tivo.hme.sdk.StreamResource createImageStream(String nextImageStream)
USE THIS METHOD TO PREVENT CRASHES. If your image stream isn't obviously a supported image type, it can result in TiVo saying things like "can't create rsrc. unsupported stream type /avatar/cf1e61a4330e75d5d1d7a744c5ef38c4", and after a few of those and associated "resource 2091 not found (type type[-1])" errors, it crashes. This method checks the URL, and if it doesn't have a good suffix, it connects to it to check the content type...if that's good, it passes that info along to the TiVo so it doesn't fail to guess correctly. If it can't make a good determination, it returns null! Specifically, it restricts to suffixes .jpg, .jpeg, .gif, and .png (ignoring any appended url query starting with "?"), otherwise content types image/jpg, image/jpeg, image/gif, or image/png.

Returns:
null if a safe image stream can't be found! Otherwise, an image stream created with either HmeObject.createStream(String) or createStream(String, String, boolean).

getLocalOptionNames

public Collection getLocalOptionNames()
LocalOptionProvider default implementation. Override to provide Option Names for your Application's local options. Default keySet of getLocalOptionPreferences(), or null if that is null.

Specified by:
getLocalOptionNames in interface LocalOptionProvider
Returns:
keySet Collection.

getLocalOptionPreferences

public Map getLocalOptionPreferences()
LocalOptionProvider default implementation - returns null(?an empty map). Override to provide Option Preferences settings for your Application's local options.

Specified by:
getLocalOptionPreferences in interface LocalOptionProvider
Returns:
null(?empty map).

getLocalOptionDefault

public String getLocalOptionDefault(String key)
By default, just returns whatever getOptionDefault(String) returns. If the local option default starst with a +, it is appended (delimeted by a comma) to the getOptionDefault value, if any. Only the first local provider that has a default for the key is used. defaults for each of the local option keys. Could just return null if there is no provided default. If the local option default starts with a +, it is appended (delimeted by a comma) to the getOptionDefault value, if any.

Specified by:
getLocalOptionDefault in interface LocalOptionProvider
Returns:
Option value to use if none is set or overridden.
See Also:
LocalOptionProvider.getLocalOptionDefault(java.lang.String)