|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.ui.Field
net.rim.device.api.ui.extension.component.PictureScrollField
public class PictureScrollField
A slider component that draws a row of images that can be scrolled from side-to-side using the trackpad, trackball or touch gestures. The images slide horizontally with the focused image in the center. The images deccelerate as they approach their new position to give an animated effect.
All images occupy the same amount of space on the slider (as defined by
the constructor's imageWidth
and imageHeight
parameters). If the distance between the horizontal center of two adjacent
images is set to less than imageWidth
, the images
will overlap.
There are two ways to specify the image height:
Nested Class Summary | ||
---|---|---|
static class |
PictureScrollField.HighlightStyle
A list of highlight styles for the selected picture. |
|
static class |
PictureScrollField.ScrollEntry
An entry in the PictureScrollField . |
Field Summary | ||
---|---|---|
static int |
CONTEXT_CHANGE_SELECTION
Context hint for the event being triggered by a selection change. |
|
static int |
USE_ALL_HEIGHT
Constant for specifying that the Field layout height is to use all remaining visible screen height |
|
static int |
USE_PREFERRED_HEIGHT
Constant for specifying that the field layout height is to be calculated with selected options |
Constructor Summary | ||
---|---|---|
PictureScrollField()
Creates a new PictureScrollField which occupies all height of the visible
screen. |
||
PictureScrollField(int imageWidth,
int imageHeight)
Creates a new PictureScrollField that displays images with the specified
width and height. |
Method Summary | ||
---|---|---|
int |
getCurrentImageIndex()
Retrieves the index of the image that is selected. |
|
float |
getLensShrink()
Retrieves the lens shrink value. |
|
int |
getPaddingImageTop()
Retrieves the padding above the image. |
|
int |
getPreferredHeight()
Retrieves this field's preferred height. |
|
int |
getPreferredWidth()
Retrieves this field's preferred width. |
|
boolean |
hasCenteredLens()
Determines if the centered lens is enabled. |
|
boolean |
isLastTapOnFocusedImage()
Tracing the latest TAP touch event. |
|
boolean |
isLastTapOnNewImage()
Tracing the latest TAP touch event. |
|
void |
selectImageAtCoordinate(int xCoordinate)
Selects the image closest to the absolute x coordinate supplied. |
|
void |
setCenteredLens(boolean enabled)
Enables or disables the centered lens. |
|
void |
setData(PictureScrollField.ScrollEntry[] entries,
int focusIndex)
Sets the pictures to display in the field and (optionally) their labels and call-outs. |
|
void |
setForegroundAlpha(int foregroundAlpha,
int foregroundAlphaUnfocus)
Sets focus and unfocus foreground alpha. |
|
void |
setHighlightBorderColor(int color)
Sets the color of the border that appears when using Highlight Style SQUARE_BORDER and ILLUMINATE_WITH_SQUARE_BORDER . |
|
void |
setHighlightStyle(int style)
Sets the style used to highlight the selected image. |
|
void |
setImageDistance(int gap)
Sets the distance between the horizontal centers of two adjacent images. |
|
void |
setLabelSliderPadding(int padding)
Sets the padding between the label and the images. |
|
void |
setLabelsVisible(boolean visible)
Sets whether the PictureScrollField displays labels below the images. |
|
void |
setLensShrink(float lensShrink)
Sets the lens shrink. |
|
void |
setPaddingImageBottom(int padding)
Sets the padding below the images, in pixels. |
|
void |
setPaddingImageTop(int padding)
Sets the padding above the images, in pixels. |
|
void |
setScalingRegion(int distance)
Sets the distance between effects region edge and the center of the image. |
|
void |
setScrollbarVisible(boolean visible)
Sets whether or not the scroll bar visible. |
|
void |
setStyle(int style)
Sets the PictureScrollField instance's layout height style. |
|
void |
setTextColor(int color)
Sets the color of the label text. |
|
protected boolean |
touchEvent(TouchEvent message)
Indicates a touch event. |
|
void |
updateImage(Bitmap image,
int index)
Update the Bitmap image of the ScrollEntry at the specified index. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int CONTEXT_CHANGE_SELECTION
public static final int USE_PREFERRED_HEIGHT
public static final int USE_ALL_HEIGHT
Constructor Detail |
---|
public PictureScrollField()
PictureScrollField
which occupies all height of the visible
screen. The image height is automatically calculated in layout and
the image width is the same as image height.
public PictureScrollField(int imageWidth, int imageHeight)
PictureScrollField
that displays images with the specified
width and height.
imageWidth
- The width of the images displayed in the field.imageHeight
- The height of the images displayed in the field.
IllegalArgumentException
- if imageWidth
or imageHeight
are <= 0.Method Detail |
---|
public void setStyle(int style)
PictureScrollField
instance's layout height style.
style
- The PictureScrollField
layout height style.
USE_PREFERRED_HEIGHT
occupies the height which
is calculated based on the desired image height and highlight style.
USE_ALL_HEIGHT
allows this field to take up all the remaining
visible screen height.public int getCurrentImageIndex()
public float getLensShrink()
If the #SHRINK_LENS
highlighting style is specified, the images not selected will decrease in size by this factor in a linear function
away from the selected (center) image.
If the #MAGNIFY_LENS
highlighting style is specified, the select (center) image will increase in size by this factor and the not selected images
will not be resized.
public int getPaddingImageTop()
public final int getPreferredHeight()
getPreferredHeight
in class Field
public int getPreferredWidth()
getPreferredWidth
in class Field
public boolean hasCenteredLens()
true
if the centered lens is enabled;
false
otherwise.public boolean isLastTapOnNewImage()
true
if the latest TAP touch is vertically aligned with a new image in the field,
false
otherwise.public boolean isLastTapOnFocusedImage()
true
if the latest TAP touch is vertically aligned with the focused image in the field,
false
otherwise.public void selectImageAtCoordinate(int xCoordinate)
xCoordinate
- The coordinate where selection should occur.public void setCenteredLens(boolean enabled)
enabled
- if true
the lens is visible; if false
,
the lens is not visiblepublic void setData(PictureScrollField.ScrollEntry[] entries, int focusIndex)
entries
- The array of ScrollEntry
objects to display in the
PictureScrollField
.focusIndex
- The index to select.public void updateImage(Bitmap image, int index)
Bitmap
image of the ScrollEntry
at the specified index.
image
- the new Bitmap
image.index
- The index of the ScrollEntry
with updated image in arraypublic void setHighlightBorderColor(int color)
SQUARE_BORDER
and ILLUMINATE_WITH_SQUARE_BORDER
.
color
- The color to use for the border.public void setHighlightStyle(int style)
style
- The desired PictureScrollField.HighlightStyle
constant
(for example, PictureScrollField.HighlightStyle.NO_HIGHLIGHT
,
PictureScrollField.HighlightStyle.ILLUMINATE
, and so on).public void setLabelSliderPadding(int padding)
padding
- The desired padding in pixels.public void setLabelsVisible(boolean visible)
visible
- true
if labels should be displayed, otherwise false
.public void setLensShrink(float lensShrink)
lensShrink
- The desired lens shrink factor.public void setTextColor(int color)
color
- The desired Color
.public void setPaddingImageTop(int padding)
padding
- The desired padding in pixels.public void setPaddingImageBottom(int padding)
padding
- The desired padding in pixels.protected boolean touchEvent(TouchEvent message)
touchEvent
in class Field
message
- A TouchEvent
object containing various input
parameters including the event type and touch coordinates.
true
if this method consumed the event,
false
otherwise.public void setImageDistance(int gap)
gap
- The distance between two adjacent images horizontal center. By default,
the distance is the desired image width plus horizontal padding.public void setScrollbarVisible(boolean visible)
visible
- true
to make the scroll bar visible,
false
otherwise.public void setScalingRegion(int distance)
distance
- The desired distance between effects region edge and the center of the image.public void setForegroundAlpha(int foregroundAlpha, int foregroundAlphaUnfocus)
foregroundAlpha
- foregrounfAlphaUnfocus
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal