WIMM Labs


com.wimm.framework.view
Class ViewTray

java.lang.Object
  extended by android.view.View
      extended by android.view.ViewGroup
          extended by com.wimm.framework.view.ViewTray
All Implemented Interfaces:
Drawable.Callback, AccessibilityEventSource, KeyEvent.Callback, ViewManager, ViewParent, MotionInterpreter.OnMotionHandler
Direct Known Subclasses:
AdapterViewTray

public class ViewTray
extends ViewGroup
implements MotionInterpreter.OnMotionHandler

The ViewTray class is the root view for application navigation. This class extends ViewGroup to manage the multi-paneled presentation of child views.

Since:
WIMM SDK 1.0.0

Nested Class Summary
static interface ViewTray.OnIndexChangeListener
          The listener interface for receiving ViewTray.OnIndexChangeListener.onIndexDidChange(int) events when the visible child view changes.
static interface ViewTray.Scrollable
          Deprecated. Use ScrollView from WIMM SDK 1.0.3 onwards.
 
Nested classes/interfaces inherited from class android.view.ViewGroup
ViewGroup.LayoutParams, ViewGroup.MarginLayoutParams, ViewGroup.OnHierarchyChangeListener
 
Nested classes/interfaces inherited from class android.view.View
View.BaseSavedState, View.MeasureSpec, View.OnClickListener, View.OnCreateContextMenuListener, View.OnFocusChangeListener, View.OnKeyListener, View.OnLongClickListener, View.OnTouchListener
 
Field Summary
 
Fields inherited from class android.view.ViewGroup
CLIP_TO_PADDING_MASK, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHE
 
Fields inherited from class android.view.View
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, 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, INVISIBLE, KEEP_SCREEN_ON, NO_ID, 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, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET
 
Constructor Summary
ViewTray(Context context)
          The ViewTray constructor.
ViewTray(Context context, AttributeSet attrs)
          Instantiates a new view tray.
ViewTray(Context context, AttributeSet attrs, int defStyle)
          Instantiates a new view tray.
 
Method Summary
 View getActiveView()
          Gets the active view.
 int getIndex()
          Gets the ViewTray index.
 int getInternalViewScrollOffset()
          Gets the internal view scroll offset.
 int getItemCount()
          Gets the item count.
 void onDrag(MotionEvent e, MotionInterpreter.ScrollAxis scrollAxis, int scrollDelta)
          On drag.
 void onDragEnd(MotionEvent e, MotionInterpreter.ScrollAxis scrollAxis, float velocity)
          Listens for an OnDragEnd event.
 void onInterruptingOneFingerTap(MotionEvent e)
          On animation-interrupting one finger tap.
protected  void onLayout(boolean changed, int l, int t, int r, int b)
           
 void onLongTap(MotionEvent e)
          On long tap.
 boolean onMotionBegin(MotionEvent e)
          Listens for a motion event and interprets the event behaviors.
 void onMotionCancel(MotionEvent e)
          Listens for the canceling of a motion event
 void onMotionEnd(MotionEvent e)
          Listens for the end of a motion event.
 void onOneFingerTap(MotionEvent e)
          On one finger tap.
 void onTwoFingerTap(MotionEvent e)
          On two finger tap.
 void setCanScrollInternalView(boolean canScrollInternalView)
          Deprecated. Not required from WIMM SDK 1.0.3 onwards.
 void setIndex(int index)
          Sets the index.
 void setIndex(int index, boolean animate)
          Sets the index.
 void setOnIndexChangeListener(ViewTray.OnIndexChangeListener indexChangeListener)
          Sets the index change listener.
 
Methods inherited from class android.view.ViewGroup
addFocusables, addFocusables, addStatesFromChildren, addTouchables, addView, addView, addView, addView, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, canAnimate, checkLayoutParams, childDrawableStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchDraw, dispatchFreezeSelfOnly, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetPressed, dispatchSetSelected, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchWindowFocusChanged, dispatchWindowVisibilityChanged, drawableStateChanged, drawChild, findFocus, fitSystemWindows, focusableViewAvailable, focusSearch, gatherTransparentRegion, generateDefaultLayoutParams, generateLayoutParams, generateLayoutParams, getChildAt, getChildCount, getChildDrawingOrder, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getPersistentDrawingCache, hasFocus, hasFocusable, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawingOrderEnabled, isChildrenDrawnWithCacheEnabled, measureChild, measureChildren, measureChildWithMargins, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAnimationEnd, onAnimationStart, onCreateDrawableState, onInterceptTouchEvent, onRequestFocusInDescendants, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeDetachedView, removeView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestTransparentRegion, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawingOrderEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setOnHierarchyChangeListener, setPadding, setPersistentDrawingCache, setStaticTransformationsEnabled, showContextMenuForChild, startLayoutAnimation, updateViewLayout
 
Methods inherited from class android.view.View
awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, cancelLongPress, checkInputConnectionProxy, clearAnimation, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createContextMenu, destroyDrawingCache, draw, finalize, findViewById, findViewWithTag, focusSearch, forceLayout, getAnimation, getApplicationWindowToken, getBackground, getBaseline, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getContentDescription, getContext, getContextMenuInfo, getDefaultSize, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFocusables, getFocusedRect, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getKeepScreenOn, getKeyDispatcherState, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMeasuredHeight, getMeasuredWidth, getNextFocusDownId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getParent, getResources, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootView, getScrollBarStyle, getScrollX, getScrollY, getSolidColor, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getTag, getTag, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchables, getTouchDelegate, getVerticalFadingEdgeLength, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, hasWindowFocus, inflate, initializeFadingEdge, initializeScrollbars, invalidate, invalidate, invalidate, invalidateDrawable, isClickable, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isInEditMode, isInTouchMode, isLayoutRequested, isLongClickable, isOpaque, isPaddingOffsetRequired, isPressed, isSaveEnabled, isScrollbarFadingEnabled, isSelected, isShown, isSoundEffectsEnabled, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, layout, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAttachedToWindow, onCheckIsTextEditor, onCreateContextMenu, onCreateInputConnection, onDetachedFromWindow, onDraw, onDrawScrollBars, onFinishInflate, onFinishTemporaryDetach, onFocusChanged, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onMeasure, onRestoreInstanceState, onSaveInstanceState, onScrollChanged, onSetAlpha, onSizeChanged, onStartTemporaryDetach, onTouchEvent, onTrackballEvent, onWindowFocusChanged, onWindowVisibilityChanged, performClick, performHapticFeedback, performHapticFeedback, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, refreshDrawableState, removeCallbacks, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestRectangleOnScreen, requestRectangleOnScreen, resolveSize, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAnimation, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setClickable, setContentDescription, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setEnabled, setFadingEdgeLength, setFocusable, setFocusableInTouchMode, setHapticFeedbackEnabled, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setId, setKeepScreenOn, setLayoutParams, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnClickListener, setOnCreateContextMenuListener, setOnFocusChangeListener, setOnKeyListener, setOnLongClickListener, setOnTouchListener, setPressed, setSaveEnabled, setScrollbarFadingEnabled, setScrollBarStyle, setScrollContainer, setSelected, setSoundEffectsEnabled, setTag, setTag, setTouchDelegate, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVisibility, setWillNotCacheDrawing, setWillNotDraw, showContextMenu, startAnimation, unscheduleDrawable, unscheduleDrawable, verifyDrawable, willNotCacheDrawing, willNotDraw
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface android.view.ViewParent
createContextMenu, getParent, isLayoutRequested, requestLayout
 

Constructor Detail

ViewTray

public ViewTray(Context context)
The ViewTray constructor.

Parameters:
context - The Context.
Since:
WIMM SDK 1.0.0

ViewTray

public ViewTray(Context context,
                AttributeSet attrs)
Instantiates a new view tray.

Parameters:
context - The Context.
attrs - The AttributeSet.
Since:
WIMM SDK 1.0.0

ViewTray

public ViewTray(Context context,
                AttributeSet attrs,
                int defStyle)
Instantiates a new view tray.

Parameters:
context - The Context.
attrs - The AttributeSet.
defStyle - The Style Resource.
Since:
WIMM SDK 1.0.0
Method Detail

setOnIndexChangeListener

public void setOnIndexChangeListener(ViewTray.OnIndexChangeListener indexChangeListener)
Sets the index change listener.

Parameters:
indexChangeListener - The index change listener.
Since:
WIMM SDK 1.0.0

getItemCount

public int getItemCount()
Gets the item count.

Returns:
The number of items in the ViewTray.
Since:
WIMM SDK 1.0.0

getIndex

public int getIndex()
Gets the ViewTray index.

Returns:
The current index.
Since:
WIMM SDK 1.0.0

getActiveView

public View getActiveView()
Gets the active view.

Returns:
The active View.
Since:
WIMM SDK 1.0.0

setIndex

public void setIndex(int index)
Sets the index.

Parameters:
index - The index.
Since:
WIMM SDK 1.0.0

setIndex

public void setIndex(int index,
                     boolean animate)
Sets the index.

Parameters:
index - The index.
animate - True if the view tray should animate to the new index.
Since:
WIMM SDK 1.0.0

setCanScrollInternalView

public void setCanScrollInternalView(boolean canScrollInternalView)
Deprecated. Not required from WIMM SDK 1.0.3 onwards.

Allows or prevents scrolling of a child view. When set to false touch events are propagated.

Parameters:
canScrollInternalView - Set to true if the view tray should animate to the new index.
Since:
WIMM SDK 1.0.0

onMotionBegin

public boolean onMotionBegin(MotionEvent e)
Listens for a motion event and interprets the event behaviors.

Specified by:
onMotionBegin in interface MotionInterpreter.OnMotionHandler
Parameters:
e - The MotionEvent.
Returns:
true, if successful.
Since:
WIMM SDK 1.0.0

onMotionEnd

public void onMotionEnd(MotionEvent e)
Listens for the end of a motion event.

Specified by:
onMotionEnd in interface MotionInterpreter.OnMotionHandler
Parameters:
e - The MotionEvent.
Since:
WIMM SDK 1.0.0

onMotionCancel

public void onMotionCancel(MotionEvent e)
Listens for the canceling of a motion event

Specified by:
onMotionCancel in interface MotionInterpreter.OnMotionHandler
Parameters:
e - The MotionEvent.

onOneFingerTap

public void onOneFingerTap(MotionEvent e)
On one finger tap.

Specified by:
onOneFingerTap in interface MotionInterpreter.OnMotionHandler
Parameters:
e - The MotionEvent.
Since:
WIMM SDK 1.0.0

onTwoFingerTap

public void onTwoFingerTap(MotionEvent e)
On two finger tap.

Specified by:
onTwoFingerTap in interface MotionInterpreter.OnMotionHandler
Parameters:
e - The MotionEvent.
Since:
WIMM SDK 1.0.0

onLongTap

public void onLongTap(MotionEvent e)
On long tap.

Specified by:
onLongTap in interface MotionInterpreter.OnMotionHandler
Parameters:
e - The MotionEvent.
Since:
WIMM SDK 1.0.0

onInterruptingOneFingerTap

public void onInterruptingOneFingerTap(MotionEvent e)
On animation-interrupting one finger tap.

Specified by:
onInterruptingOneFingerTap in interface MotionInterpreter.OnMotionHandler
Parameters:
e - The MotionEvent.

onDrag

public void onDrag(MotionEvent e,
                   MotionInterpreter.ScrollAxis scrollAxis,
                   int scrollDelta)
On drag.

Specified by:
onDrag in interface MotionInterpreter.OnMotionHandler
Parameters:
e - The MotionEvent.
scrollAxis - The scroll axis.
scrollDelta - The scroll delta.
Since:
WIMM SDK 1.0.0

onDragEnd

public void onDragEnd(MotionEvent e,
                      MotionInterpreter.ScrollAxis scrollAxis,
                      float velocity)
Listens for an OnDragEnd event.

Specified by:
onDragEnd in interface MotionInterpreter.OnMotionHandler
Parameters:
e - The MotionEvent.
scrollAxis - The scroll axis.
velocity - The scroll velocity.
Since:
WIMM SDK 1.0.0

getInternalViewScrollOffset

public int getInternalViewScrollOffset()
Gets the internal view scroll offset.

Returns:
The internal view scroll offset.
Since:
WIMM SDK 1.0.0

onLayout

protected void onLayout(boolean changed,
                        int l,
                        int t,
                        int r,
                        int b)
Specified by:
onLayout in class ViewGroup

WIMM Labs