Window Covers

The cover namespace provides the ability to modify the application's window cover which is displayed when the application is in thumbnail mode.

The following image shows window covers on a device:

Device showing window covers.

Installation:

To use this API in your project, add the cover plugin:

webworks plugin add com.blackberry.ui.cover

Learning Resources:

Sample - Using Window Covers Sample that demonstrates how to use the BlackBerry Window Covers API [BlackBerry on GitHub].

Functions:
void resetCover()
void setContent()
void setTransition()
void updateCover()
Events:
void entercover
void exitcover
Properties:
Object coverSize
Cover Label labels
Boolean showBadges
Constants:
String TRANSITION_DEFAULT
String TRANSITION_FADE
String TRANSITION_NONE
String TRANSITION_SLIDE
String TYPE_IMAGE
String TYPE_SNAPSHOT

resetCover()

Resets the window cover to default behaviour: scaled snaphot on entering window cover.

Synopsis:

void blackberry.ui.cover.resetCover()

Example:

<script type="text/javascript">

    blackberry.ui.cover.resetCover();

</script>
            

setContent()

Sets content for the application's window cover. See constants.

Synopsis:

void blackberry.ui.cover.setContent(type, options)

Parameters:

type {String}

The type of content to be displated.

options {Object}

Contains relevant information based on type

path {String}

The path to the image to display for the window cover, necessary for image mode.

x {Number}

Starting x for cover snapshot, necessary for snapshot mode.

y {Number}

Starting y for cover snapshot, necessary for snapshot mode.

width {Number}

Snapshot width, necessary for snapshot mode.

height {Number}

Snapshot height, necessary for snapshot mode.

setTransition()

Sets the application's window cover transition. The default transition is TRANSITION_SLIDE

Synopsis:

void blackberry.ui.cover.setTransition(transition)

Parameters:

transition {String}

See constants.

Example:

<script type="text/javascript">

    blackberry.ui.cover.setTransition(blackberry.ui.cover.TRANSITION_FADE);

</script>
            

updateCover()

Updates the application's window cover.

Synopsis:

void blackberry.ui.cover.updateCover()

Example:

<script type="text/javascript">

    blackberry.ui.cover.updateCover();

</script>
            

entercover

The entercover event is triggered whenever the the application displays the window cover in thumbnail mode.

Synopsis:

Event

Example:

<script type="text/javascript">

    function onEnterCover() {
        blackberry.ui.cover.updateCover();
    }

    document.addEventListener('enterCover', onEnterCover);

</script>
            

exitcover

The exitcover event is triggered whenever the the application removes the window cover exiting thumbnail mode.

Synopsis:

Event

Example:

<script type="text/javascript">

    function onExitCover() {
        console.log("app is exiting cover mode");
    }

    document.addEventListener('exitCover', onExitCover);

</script>
            

coverSize

The application's cover dimensions, contains a width and height (in pixels).

Synopsis:

Object blackberry.ui.cover.coverSize

labels

The list of labels to be displayed on the window cover

Synopsis:

{Cover Label[]} blackberry.ui.cover.labels

showBadges

Should the window cover show notification badges. The default value is true.

Synopsis:

Boolean blackberry.ui.cover.showBadges

TRANSITION_DEFAULT

Specifies default window cover transition.

Synopsis:

constant
String blackberry.ui.cover.TRANSITION_DEFAULT = 'default'

TRANSITION_FADE

Specifies fade window cover transition.

Synopsis:

constant
String blackberry.ui.cover.TRANSITION_FADE = 'fade'

TRANSITION_NONE

Specifies no window cover transition.

Synopsis:

constant
String blackberry.ui.cover.TRANSITION_NONE = 'none'

TRANSITION_SLIDE

Specifies slide window cover transition.

Synopsis:

constant
String blackberry.ui.cover.TRANSITION_SLIDE = 'slide'

TYPE_IMAGE

Specifies image mode.

Synopsis:

constant
String blackberry.ui.cover.TYPE_IMAGE = 'file'

TYPE_SNAPSHOT

Specifies snapshot mode.

Synopsis:

constant
String blackberry.ui.cover.TYPE_SNAPSHOT = 'snapshot'

Last modified: 2014-04-10