org.solovyev.android.view
Class AbstractRangeSeekBar<T>

java.lang.Object
  extended by android.view.View
      extended by android.widget.ImageView
          extended by org.solovyev.android.view.AbstractRangeSeekBar<T>
Type Parameters:
T - The Number type of the range values. One of Long, Double, Integer, Float, Short, Byte or BigDecimal.
All Implemented Interfaces:
android.graphics.drawable.Drawable.Callback, android.view.accessibility.AccessibilityEventSource, android.view.KeyEvent.Callback
Direct Known Subclasses:
NumberRangeSeekBar

public abstract class AbstractRangeSeekBar<T>
extends android.widget.ImageView

Widget that lets users select a minimum and maximum value on a given numerical range. The range value types can be one of Long, Double, Integer, Float, Short, Byte or BigDecimal.

Author:
Stephan Tittel (stephan.tittel@kom.tu-darmstadt.de)

Nested Class Summary
static interface AbstractRangeSeekBar.OnRangeSeekBarChangeListener<T>
          Callback listener interface to notify about changed range values.
 
Nested classes/interfaces inherited from class android.widget.ImageView
android.widget.ImageView.ScaleType
 
Nested classes/interfaces inherited from class android.view.View
android.view.View.AccessibilityDelegate, android.view.View.BaseSavedState, android.view.View.DragShadowBuilder, android.view.View.MeasureSpec, android.view.View.OnAttachStateChangeListener, android.view.View.OnClickListener, android.view.View.OnCreateContextMenuListener, android.view.View.OnDragListener, android.view.View.OnFocusChangeListener, android.view.View.OnGenericMotionListener, android.view.View.OnHoverListener, android.view.View.OnKeyListener, android.view.View.OnLayoutChangeListener, android.view.View.OnLongClickListener, android.view.View.OnSystemUiVisibilityChangeListener, android.view.View.OnTouchListener
 
Field Summary
 
Fields inherited from class android.view.View
ALPHA, DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FIND_VIEWS_WITH_CONTENT_DESCRIPTION, FIND_VIEWS_WITH_TEXT, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, HAPTIC_FEEDBACK_ENABLED, IMPORTANT_FOR_ACCESSIBILITY_AUTO, IMPORTANT_FOR_ACCESSIBILITY_NO, IMPORTANT_FOR_ACCESSIBILITY_YES, INVISIBLE, KEEP_SCREEN_ON, LAYER_TYPE_HARDWARE, LAYER_TYPE_NONE, LAYER_TYPE_SOFTWARE, MEASURED_HEIGHT_STATE_SHIFT, MEASURED_SIZE_MASK, MEASURED_STATE_MASK, MEASURED_STATE_TOO_SMALL, NO_ID, OVER_SCROLL_ALWAYS, OVER_SCROLL_IF_CONTENT_SCROLLS, OVER_SCROLL_NEVER, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, ROTATION, ROTATION_X, ROTATION_Y, SCALE_X, SCALE_Y, SCREEN_STATE_OFF, SCREEN_STATE_ON, SCROLLBAR_POSITION_DEFAULT, SCROLLBAR_POSITION_LEFT, SCROLLBAR_POSITION_RIGHT, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, STATUS_BAR_HIDDEN, STATUS_BAR_VISIBLE, SYSTEM_UI_FLAG_FULLSCREEN, SYSTEM_UI_FLAG_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN, SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LAYOUT_STABLE, SYSTEM_UI_FLAG_LOW_PROFILE, SYSTEM_UI_FLAG_VISIBLE, SYSTEM_UI_LAYOUT_FLAGS, TEXT_ALIGNMENT_INHERIT, TEXT_ALIGNMENT_RESOLVED_DEFAULT, TRANSLATION_X, TRANSLATION_Y, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET, X, Y
 
Constructor Summary
AbstractRangeSeekBar(T minValue, T maxValue, Integer steps, android.content.Context context)
          Creates a new RangeSeekBar.
 
Method Summary
 T getMaxValue()
          Returns the absolute maximum value of the range that has been set at construction time.
 T getMinValue()
          Returns the absolute minimum value of the range that has been set at construction time.
 T getSelectedMaxValue()
          Returns the currently selected max value.
 T getSelectedMinValue()
          Returns the currently selected min value.
protected abstract  org.solovyev.common.Converter<T,Double> getToDoubleConverter()
           
protected abstract  org.solovyev.common.Converter<Double,T> getToTConverter()
           
 boolean isNotifyWhileDragging()
           
protected  void onDraw(android.graphics.Canvas canvas)
          Draws the widget on the given canvas.
protected  void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
          Ensures correct size of the widget.
 boolean onTouchEvent(android.view.MotionEvent event)
          Handles thumb selection and movement.
 void setNotifyWhileDragging(boolean flag)
          Should the widget notify the listener callback while the user is still dragging a thumb? Default is false.
 void setOnRangeSeekBarChangeListener(AbstractRangeSeekBar.OnRangeSeekBarChangeListener<T> listener)
          Registers given listener callback to notify about changed selected values.
 void setSelectedMaxValue(T value)
          Sets the currently selected maximum value.
 void setSelectedMinValue(T value)
          Sets the currently selected minimum value.
 
Methods inherited from class android.widget.ImageView
clearColorFilter, drawableStateChanged, getAdjustViewBounds, getBaseline, getBaselineAlignBottom, getColorFilter, getCropToPadding, getDrawable, getImageAlpha, getImageMatrix, getMaxHeight, getMaxWidth, getScaleType, hasOverlappingRendering, invalidateDrawable, jumpDrawablesToCurrentState, onAttachedToWindow, onCreateDrawableState, onDetachedFromWindow, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onPopulateAccessibilityEvent, setAdjustViewBounds, setAlpha, setBaseline, setBaselineAlignBottom, setColorFilter, setColorFilter, setColorFilter, setCropToPadding, setFrame, setImageAlpha, setImageBitmap, setImageDrawable, setImageLevel, setImageMatrix, setImageResource, setImageState, setImageURI, setMaxHeight, setMaxWidth, setScaleType, setSelected, setVisibility, verifyDrawable
 
Methods inherited from class android.view.View
addChildrenForAccessibility, addFocusables, addFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, addTouchables, animate, announceForAccessibility, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, cancelLongPress, canScrollHorizontally, canScrollVertically, checkInputConnectionProxy, clearAnimation, clearFocus, combineMeasuredStates, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDragEvent, dispatchDraw, dispatchGenericFocusedEvent, dispatchGenericMotionEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchSystemUiVisibilityChanged, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, draw, findFocus, findViewById, findViewsWithText, findViewWithTag, fitSystemWindows, focusSearch, forceLayout, getAccessibilityNodeProvider, getAlpha, getAnimation, getApplicationWindowToken, getBackground, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getCameraDistance, getContentDescription, getContext, getContextMenuInfo, getDefaultSize, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusables, getFocusedRect, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getImportantForAccessibility, getKeepScreenOn, getKeyDispatcherState, getLayerType, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOverScrollMode, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getResources, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootView, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollX, getScrollY, getSolidColor, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSystemUiVisibility, getTag, getTag, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchables, getTouchDelegate, getTranslationX, getTranslationY, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, hasFocus, hasFocusable, hasOnClickListeners, hasTransientState, hasWindowFocus, inflate, initializeFadingEdge, initializeScrollbars, invalidate, invalidate, invalidate, isActivated, isClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isInEditMode, isInTouchMode, isLayoutRequested, isLongClickable, isOpaque, isPaddingOffsetRequired, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShown, isSoundEffectsEnabled, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, layout, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAnimationEnd, onAnimationStart, onCheckIsTextEditor, onConfigurationChanged, onCreateContextMenu, onCreateInputConnection, onDisplayHint, onDragEvent, onDrawScrollBars, onFilterTouchEventForSecurity, onFinishInflate, onFinishTemporaryDetach, onFocusChanged, onGenericMotionEvent, onHoverChanged, onHoverEvent, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onLayout, onOverScrolled, onRestoreInstanceState, onSaveInstanceState, onScreenStateChanged, onScrollChanged, onSetAlpha, onSizeChanged, onStartTemporaryDetach, onTrackballEvent, onVisibilityChanged, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, onWindowVisibilityChanged, overScrollBy, performAccessibilityAction, performClick, performHapticFeedback, performHapticFeedback, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, requestFitSystemWindows, requestFocus, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestRectangleOnScreen, requestRectangleOnScreen, resolveSize, resolveSizeAndState, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setActivated, setAlpha, setAnimation, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBottom, setCameraDistance, setClickable, setContentDescription, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusableInTouchMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHovered, setId, setImportantForAccessibility, setKeepScreenOn, setLayerType, setLayoutParams, setLeft, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOverScrollMode, setPadding, setPivotX, setPivotY, setPressed, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollContainer, setScrollX, setScrollY, setSoundEffectsEnabled, setSystemUiVisibility, setTag, setTag, setTop, setTouchDelegate, setTranslationX, setTranslationY, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setWillNotCacheDrawing, setWillNotDraw, setX, setY, showContextMenu, startActionMode, startAnimation, startDrag, unscheduleDrawable, unscheduleDrawable, willNotCacheDrawing, willNotDraw
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractRangeSeekBar

public AbstractRangeSeekBar(@Nonnull
                            T minValue,
                            @Nonnull
                            T maxValue,
                            @Nullable
                            Integer steps,
                            android.content.Context context)
                     throws IllegalArgumentException
Creates a new RangeSeekBar.

Parameters:
minValue - The minimum value of the selectable range.
maxValue - The maximum value of the selectable range.
steps - number of steps to be used in range seek bar
context - parent context
Throws:
IllegalArgumentException - Will be thrown if min/max value types are not one of Long, Double, Integer, Float, Short, Byte or BigDecimal.
Method Detail

getToTConverter

@Nonnull
protected abstract org.solovyev.common.Converter<Double,T> getToTConverter()

getToDoubleConverter

@Nonnull
protected abstract org.solovyev.common.Converter<T,Double> getToDoubleConverter()

isNotifyWhileDragging

public boolean isNotifyWhileDragging()

setNotifyWhileDragging

public void setNotifyWhileDragging(boolean flag)
Should the widget notify the listener callback while the user is still dragging a thumb? Default is false.

Parameters:
flag -

getMinValue

@Nonnull
public T getMinValue()
Returns the absolute minimum value of the range that has been set at construction time.

Returns:
The absolute minimum value of the range.

getMaxValue

@Nonnull
public T getMaxValue()
Returns the absolute maximum value of the range that has been set at construction time.

Returns:
The absolute maximum value of the range.

getSelectedMinValue

public T getSelectedMinValue()
Returns the currently selected min value.

Returns:
The currently selected min value.

setSelectedMinValue

public void setSelectedMinValue(@Nonnull
                                T value)
Sets the currently selected minimum value. The widget will be invalidated and redrawn.

Parameters:
value - The Number value to set the minimum value to. Will be clamped to given absolute minimum/maximum range.

getSelectedMaxValue

public T getSelectedMaxValue()
Returns the currently selected max value.

Returns:
The currently selected max value.

setSelectedMaxValue

public void setSelectedMaxValue(@Nonnull
                                T value)
Sets the currently selected maximum value. The widget will be invalidated and redrawn.

Parameters:
value - The Number value to set the maximum value to. Will be clamped to given absolute minimum/maximum range.

setOnRangeSeekBarChangeListener

public void setOnRangeSeekBarChangeListener(AbstractRangeSeekBar.OnRangeSeekBarChangeListener<T> listener)
Registers given listener callback to notify about changed selected values.

Parameters:
listener - The listener to notify about changed selected values.

onTouchEvent

public boolean onTouchEvent(android.view.MotionEvent event)
Handles thumb selection and movement. Notifies listener callback on certain events.

Overrides:
onTouchEvent in class android.view.View

onMeasure

protected void onMeasure(int widthMeasureSpec,
                         int heightMeasureSpec)
Ensures correct size of the widget.

Overrides:
onMeasure in class android.widget.ImageView

onDraw

protected void onDraw(android.graphics.Canvas canvas)
Draws the widget on the given canvas.

Overrides:
onDraw in class android.widget.ImageView


Copyright © 2014 se.solovyev. All Rights Reserved.