AI2 Component  (Version nb184)
com.google.appinventor.components.runtime.Slider Class Reference
Inheritance diagram for com.google.appinventor.components.runtime.Slider:
com.google.appinventor.components.runtime.AndroidViewComponent com.google.appinventor.components.runtime.VisibleComponent com.google.appinventor.components.runtime.Component

Public Member Functions

 Slider (ComponentContainer container)
 
void ThumbEnabled (boolean enabled)
 
boolean ThumbEnabled ()
 
void ThumbPosition (float position)
 
float ThumbPosition ()
 
void MinValue (float value)
 
float MinValue ()
 
void MaxValue (float value)
 
float MaxValue ()
 
int ColorLeft ()
 
void ColorLeft (int argb)
 
int ColorRight ()
 
void ColorRight (int argb)
 
View getView ()
 
void onProgressChanged (SeekBar seekBar, int progress, boolean fromUser)
 
void PositionChanged (float thumbPosition)
 
void onStartTrackingTouch (SeekBar seekBar)
 
void onStopTrackingTouch (SeekBar seekBar)
 
int Height ()
 
void Height (int height)
 
- Public Member Functions inherited from com.google.appinventor.components.runtime.AndroidViewComponent
boolean Visible ()
 
void Visible (boolean visibility)
 
int Width ()
 
void Width (int width)
 
void WidthPercent (int pCent)
 
void setLastWidth (int width)
 
int getSetWidth ()
 
void setLastHeight (int height)
 
int getSetHeight ()
 
void CopyWidth (AndroidViewComponent sourceComponent)
 
void HeightPercent (int pCent)
 
void CopyHeight (AndroidViewComponent sourceComponent)
 
int Column ()
 
void Column (int column)
 
int Row ()
 
void Row (int row)
 
HandlesEventDispatching getDispatchDelegate ()
 

Public Attributes

final boolean referenceGetThumb = (SdkLevel.getLevel() >= SdkLevel.LEVEL_JELLYBEAN)
 

Additional Inherited Members

- Static Public Attributes inherited from com.google.appinventor.components.runtime.Component
static final String ASSET_DIRECTORY = "component"
 
static final int ALIGNMENT_NORMAL = 0
 
static final int ALIGNMENT_CENTER = 1
 
static final int ALIGNMENT_OPPOSITE = 2
 
static final int ACCELEROMETER_SENSITIVITY_WEAK = 1
 
static final int ACCELEROMETER_SENSITIVITY_MODERATE = 2
 
static final int ACCELEROMETER_SENSITIVITY_STRONG = 3
 
static final int BUTTON_SHAPE_DEFAULT = 0
 
static final int BUTTON_SHAPE_ROUNDED = 1
 
static final int BUTTON_SHAPE_RECT = 2
 
static final int BUTTON_SHAPE_OVAL = 3
 
static final int COLOR_NONE = 0x00FFFFFF
 
static final int COLOR_BLACK = 0xFF000000
 
static final int COLOR_BLUE = 0xFF0000FF
 
static final int COLOR_CYAN = 0xFF00FFFF
 
static final int COLOR_DKGRAY = 0xFF444444
 
static final int COLOR_GRAY = 0xFF888888
 
static final int COLOR_GREEN = 0xFF00FF00
 
static final int COLOR_LTGRAY = 0xFFCCCCCC
 
static final int COLOR_MAGENTA = 0xFFFF00FF
 
static final int COLOR_ORANGE = 0xFFFFC800
 
static final int COLOR_PINK = 0xFFFFAFAF
 
static final int COLOR_RED = 0xFFFF0000
 
static final int COLOR_WHITE = 0xFFFFFFFF
 
static final int COLOR_YELLOW = 0xFFFFFF00
 
static final int COLOR_DEFAULT = 0x00000000
 
static final String DEFAULT_VALUE_COLOR_NONE = "&H00FFFFFF"
 
static final String DEFAULT_VALUE_COLOR_BLACK = "&HFF000000"
 
static final String DEFAULT_VALUE_COLOR_BLUE = "&HFF0000FF"
 
static final String DEFAULT_VALUE_COLOR_CYAN = "&HFF00FFFF"
 
static final String DEFAULT_VALUE_COLOR_DKGRAY = "&HFF444444"
 
static final String DEFAULT_VALUE_COLOR_GRAY = "&HFF888888"
 
static final String DEFAULT_VALUE_COLOR_GREEN = "&HFF00FF00"
 
static final String DEFAULT_VALUE_COLOR_LTGRAY = "&HFFCCCCCC"
 
static final String DEFAULT_VALUE_COLOR_MAGENTA = "&HFFFF00FF"
 
static final String DEFAULT_VALUE_COLOR_ORANGE = "&HFFFFC800"
 
static final String DEFAULT_VALUE_COLOR_PINK = "&HFFFFAFAF"
 
static final String DEFAULT_VALUE_COLOR_RED = "&HFFFF0000"
 
static final String DEFAULT_VALUE_COLOR_WHITE = "&HFFFFFFFF"
 
static final String DEFAULT_VALUE_COLOR_YELLOW = "&HFFFFFF00"
 
static final String DEFAULT_VALUE_COLOR_DEFAULT = "&H00000000"
 
static final float FONT_DEFAULT_SIZE = 14
 
static final int LAYOUT_ORIENTATION_HORIZONTAL = ComponentConstants.LAYOUT_ORIENTATION_HORIZONTAL
 
static final int LAYOUT_ORIENTATION_VERTICAL = ComponentConstants.LAYOUT_ORIENTATION_VERTICAL
 
static final int SCALING_SCALE_PROPORTIONALLY = 0
 
static final int SCALING_SCALE_TO_FIT = 1
 
static final int TYPEFACE_DEFAULT = 0
 
static final int TYPEFACE_SANSSERIF = 1
 
static final int TYPEFACE_SERIF = 2
 
static final int TYPEFACE_MONOSPACE = 3
 
static final int LENGTH_PREFERRED = -1
 
static final int LENGTH_FILL_PARENT = -2
 
static final int LENGTH_UNKNOWN = -3
 
static final int LENGTH_PERCENT_TAG = -1000
 
static final int TOAST_LENGTH_SHORT = 0
 
static final int TOAST_LENGTH_LONG = 1
 
static final int DIRECTION_NORTH = 1
 
static final int DIRECTION_NORTHEAST = 2
 
static final int DIRECTION_EAST = 3
 
static final int DIRECTION_SOUTHEAST = 4
 
static final int DIRECTION_SOUTH = -1
 
static final int DIRECTION_SOUTHWEST = -2
 
static final int DIRECTION_WEST = -3
 
static final int DIRECTION_NORTHWEST = -4
 
static final int DIRECTION_NONE = 0
 
static final int DIRECTION_MIN = -4
 
static final int DIRECTION_MAX = 4
 
static float SLIDER_MIN_VALUE = 10
 
static float SLIDER_MAX_VALUE = 50
 
static float SLIDER_THUMB_VALUE = (SLIDER_MIN_VALUE + SLIDER_MAX_VALUE) / 2.0f
 
static final String DEFAULT_VALUE_TEXT_TO_SPEECH_COUNTRY = ""
 
static final String DEFAULT_VALUE_TEXT_TO_SPEECH_LANGUAGE = ""
 
- Protected Member Functions inherited from com.google.appinventor.components.runtime.AndroidViewComponent
 AndroidViewComponent (ComponentContainer container)
 
- Protected Member Functions inherited from com.google.appinventor.components.runtime.VisibleComponent
 VisibleComponent ()
 
- Protected Attributes inherited from com.google.appinventor.components.runtime.AndroidViewComponent
final ComponentContainer container
 

Detailed Description

This class is used to display a Slider.

Example Slider icon

A Slider is a progress bar that adds a draggable thumb. You can touch the thumb and drag left or right to set the slider thumb position. As the Slider thumb is dragged, it will trigger the PositionChanged(float) event, reporting the position of the Slider thumb. The reported position of the thumb can be used to dynamically update another component attribute, such as the TextBox#FontSize(float) of a TextBox or the Radius of a Ball.

The Slider uses the following default values. However these values can be changed through the Designer or Blocks editor:

Author
kashi.nosp@m.01@g.nosp@m.mail..nosp@m.com (M. Hossein Amerkashi)
hal@m.nosp@m.it.e.nosp@m.du (Hal Abelson)

Definition at line 60 of file Slider.java.

Constructor & Destructor Documentation

◆ Slider()

com.google.appinventor.components.runtime.Slider.Slider ( ComponentContainer  container)

Creates a new Slider component.

Parameters
containercontainer that the component will be placed in

Definition at line 104 of file Slider.java.

Member Function Documentation

◆ ColorLeft() [1/2]

int com.google.appinventor.components.runtime.Slider.ColorLeft ( )

Returns the color of the slider bar to the left of the thumb, as an alpha-red-green-blue integer, i.e.,

0xAARRGGBB

. An alpha of

00

indicates fully transparent and

FF

means opaque.

Returns
left color in the format 0xAARRGGBB, which includes alpha, red, green, and blue components

Definition at line 355 of file Slider.java.

◆ ColorLeft() [2/2]

void com.google.appinventor.components.runtime.Slider.ColorLeft ( int  argb)

Specifies the color of the slider bar to the left of the thumb as an alpha-red-green-blue integer, i.e.,

0xAARRGGBB

. An alpha of

00

indicates fully transparent and

FF

means opaque.

Parameters
argbbackground color in the format 0xAARRGGBB, which includes alpha, red, green, and blue components

Definition at line 370 of file Slider.java.

◆ ColorRight() [1/2]

int com.google.appinventor.components.runtime.Slider.ColorRight ( )

Returns the color of the slider bar to the right of the thumb, as an alpha-red-green-blue integer, i.e.,

0xAARRGGBB

. An alpha of

00

indicates fully transparent and

FF

means opaque.

Returns
right color in the format 0xAARRGGBB, which includes alpha, red, green, and blue components

Definition at line 387 of file Slider.java.

◆ ColorRight() [2/2]

void com.google.appinventor.components.runtime.Slider.ColorRight ( int  argb)

Specifies the color of the slider bar to the right of the thumb as an alpha-red-green-blue integer, i.e.,

0xAARRGGBB

. An alpha of

00

indicates fully transparent and

FF

means opaque.

Parameters
argbbackground color in the format 0xAARRGGBB, which includes alpha, red, green, and blue components

Definition at line 402 of file Slider.java.

◆ getView()

View com.google.appinventor.components.runtime.Slider.getView ( )

Returns the View that is displayed in the UI.

Reimplemented from com.google.appinventor.components.runtime.AndroidViewComponent.

Definition at line 408 of file Slider.java.

◆ Height() [1/2]

int com.google.appinventor.components.runtime.Slider.Height ( )

Returns the component's vertical height, measured in pixels.

Returns
height in pixels

Reimplemented from com.google.appinventor.components.runtime.AndroidViewComponent.

Definition at line 454 of file Slider.java.

◆ Height() [2/2]

void com.google.appinventor.components.runtime.Slider.Height ( int  height)

Specifies the component's vertical height, measured in pixels.

Parameters
heightin pixels

Reimplemented from com.google.appinventor.components.runtime.AndroidViewComponent.

Definition at line 466 of file Slider.java.

◆ MaxValue() [1/2]

float com.google.appinventor.components.runtime.Slider.MaxValue ( )

Returns the slider max value

@suppressdoc

Returns
the slider max value

Definition at line 338 of file Slider.java.

◆ MaxValue() [2/2]

void com.google.appinventor.components.runtime.Slider.MaxValue ( float  value)

Sets the maximum value of slider. If the new maximum is less than the current minimum, then minimum and maximum will both be set to this value. Setting MaxValue resets the thumb position to halfway between MinValue() and MaxValue and signals the PositionChanged(float)` event.

Definition at line 320 of file Slider.java.

◆ MinValue() [1/2]

float com.google.appinventor.components.runtime.Slider.MinValue ( )

Returns the value of slider min value.

@suppressdoc

Returns
the value of slider min value.

Definition at line 302 of file Slider.java.

◆ MinValue() [2/2]

void com.google.appinventor.components.runtime.Slider.MinValue ( float  value)

Sets the minimum value of slider. If the new minimum is greater than the current maximum, then minimum and maximum will both be set to this value. Setting MinValue resets the thumb position to halfway between MinValue and MaxValue() and signals the PositionChanged(float)` event.

Definition at line 282 of file Slider.java.

◆ onProgressChanged()

void com.google.appinventor.components.runtime.Slider.onProgressChanged ( SeekBar  seekBar,
int  progress,
boolean  fromUser 
)

Definition at line 413 of file Slider.java.

◆ onStartTrackingTouch()

void com.google.appinventor.components.runtime.Slider.onStartTrackingTouch ( SeekBar  seekBar)

Definition at line 439 of file Slider.java.

◆ onStopTrackingTouch()

void com.google.appinventor.components.runtime.Slider.onStopTrackingTouch ( SeekBar  seekBar)

Definition at line 444 of file Slider.java.

◆ PositionChanged()

void com.google.appinventor.components.runtime.Slider.PositionChanged ( float  thumbPosition)

Indicates that position of the slider thumb has changed.

Definition at line 434 of file Slider.java.

◆ ThumbEnabled() [1/2]

boolean com.google.appinventor.components.runtime.Slider.ThumbEnabled ( )

Whether or not the slider thumb is being be shown.

Returns
Whether or not the slider thumb is being be shown

Definition at line 226 of file Slider.java.

◆ ThumbEnabled() [2/2]

void com.google.appinventor.components.runtime.Slider.ThumbEnabled ( boolean  enabled)

Sets whether or not the slider thumb should be shown

Parameters
enabledWhether or not the slider thumb should be shown

Definition at line 202 of file Slider.java.

◆ ThumbPosition() [1/2]

float com.google.appinventor.components.runtime.Slider.ThumbPosition ( )

Returns the position of slider thumb

@suppressdoc

Returns
the slider thumb position

Definition at line 262 of file Slider.java.

◆ ThumbPosition() [2/2]

void com.google.appinventor.components.runtime.Slider.ThumbPosition ( float  position)

Sets the position of the slider thumb. If this value is greater than MaxValue(), then it will be set to same value as MaxValue(). If this value is less than MinValue(), then it will be set to same value as MinValue().

Parameters
positionthe position of the slider thumb. This value should be between sliderMinValue and sliderMaxValue. If this value is not within the min and max, then it will be calculated.

Definition at line 245 of file Slider.java.

Member Data Documentation

◆ referenceGetThumb

final boolean com.google.appinventor.components.runtime.Slider.referenceGetThumb = (SdkLevel.getLevel() >= SdkLevel.LEVEL_JELLYBEAN)

Definition at line 97 of file Slider.java.


The documentation for this class was generated from the following file: