Build 1.0_r1(from source)

android.widget
Class Gallery

java.lang.Object
  extended by android.view.View
      extended by android.view.ViewGroup
          extended by android.widget.AdapterView<SpinnerAdapter>
              extended by android.widget.AbsSpinner
                  extended by android.widget.Gallery
All Implemented Interfaces:
Drawable.Callback, GestureDetector.OnGestureListener, KeyEvent.Callback, ViewManager, ViewParent

public class Gallery
extends AbsSpinner
implements GestureDetector.OnGestureListener

A view that shows items in a center-locked, horizontally scrolling list.

The default values for the Gallery assume you will be using R.styleable.Theme_galleryItemBackground as the background for each View given to the Gallery from the Adapter. If you are not doing this, you may need to adjust some Gallery properties, such as the spacing.


Nested Class Summary
static class Gallery.LayoutParams
          Gallery extends LayoutParams to provide a place to hold current Transformation information along with previous position/transformation info.
 
Nested classes/interfaces inherited from class android.widget.AbsSpinner
AbsSpinner.RecycleBin, AbsSpinner.SavedState
 
Nested classes/interfaces inherited from class android.widget.AdapterView
AdapterView.AdapterContextMenuInfo, AdapterView.AdapterDataSetObserver, AdapterView.OnItemClickListener, AdapterView.OnItemLongClickListener, AdapterView.OnItemSelectedListener
 
Nested classes/interfaces inherited from class android.view.ViewGroup
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.widget.AbsSpinner
mAdapter, mBlockLayoutRequests, mHeightMeasureSpec, mInterpolator, mRecycler, mSelectedView, mSelectionBottomPadding, mSelectionLeftPadding, mSelectionRightPadding, mSelectionTopPadding, mSpinnerPadding, mWidthMeasureSpec
 
Fields inherited from class android.widget.AdapterView
INVALID_POSITION, INVALID_ROW_ID, ITEM_VIEW_TYPE_HEADER_OR_FOOTER, ITEM_VIEW_TYPE_IGNORE, mDataChanged, mEmptyView, mFirstPosition, mInLayout, mItemCount, mNeedSync, mNextSelectedPosition, mNextSelectedRowId, mOldItemCount, mOldSelectedPosition, mOldSelectedRowId, mOnItemClickListener, mOnItemLongClickListener, mOnItemSelectedListener, mSelectedPosition, mSelectedRowId, mSpecificTop, mSyncHeight, mSyncMode, mSyncPosition, mSyncRowId, SYNC_FIRST_POSITION, SYNC_MAX_DURATION_MILLIS, SYNC_SELECTED_POSITION
 
Fields inherited from class android.view.ViewGroup
CLIP_TO_PADDING_MASK, FLAG_SUPPORT_STATIC_TRANSFORMATIONS, FLAG_USE_CHILD_DRAWING_ORDER, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, mDisappearingChildren, mGroupFlags, mOnHierarchyChangeListener, mPersistentDrawingCache, 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, FIRST_STATE_SET, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, INVISIBLE, KEEP_SCREEN_ON, LAST_STATE_SET, mBottom, mContext, mCurrentAnimation, MIDDLE_STATE_SET, mLayoutParams, mLeft, mLocation, mMeasuredHeight, mMeasuredWidth, mOnClickListener, mOnCreateContextMenuListener, mOnFocusChangeListener, mOnLongClickListener, mPaddingBottom, mPaddingLeft, mPaddingRight, mPaddingTop, mParent, mRight, mScrollX, mScrollY, mTag, mTop, 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_FIRST_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_LAST_STATE_SET, PRESSED_MIDDLE_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_SINGLE_STATE_SET, PRESSED_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, SINGLE_STATE_SET, SOUND_EFFECTS_ENABLED, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET
 
Constructor Summary
Gallery(Context context)
           
Gallery(Context context, AttributeSet attrs)
           
Gallery(Context context, AttributeSet attrs, int defStyle)
           
 
Method Summary
protected  boolean checkLayoutParams(ViewGroup.LayoutParams p)
          
protected  int computeHorizontalScrollExtent()
          Compute the horizontal extent of the horizontal scrollbar's thumb within the horizontal range.
protected  int computeHorizontalScrollOffset()
          Compute the horizontal offset of the horizontal scrollbar's thumb within the horizontal range.
protected  int computeHorizontalScrollRange()
          Compute the horizontal range that the horizontal scrollbar represents.
 boolean dispatchKeyEvent(KeyEvent event)
          Dispatch a key event to the next view on the focus path.
protected  void dispatchSetPressed(boolean pressed)
          Dispatch setPressed to all of this View's children.
 void dispatchSetSelected(boolean selected)
          Dispatch setSelected to all of this View's children.
protected  ViewGroup.LayoutParams generateDefaultLayoutParams()
          Returns a set of default layout parameters.
 ViewGroup.LayoutParams generateLayoutParams(AttributeSet attrs)
          Returns a new set of layout parameters based on the supplied attributes set.
protected  ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p)
          Returns a safe set of layout parameters based on the supplied layout params.
protected  int getChildDrawingOrder(int childCount, int i)
          Returns the index of the child to draw for this iteration.
(package private)  int getChildHeight(View child)
           
protected  boolean getChildStaticTransformation(View child, Transformation t)
          
protected  ContextMenu.ContextMenuInfo getContextMenuInfo()
          Views should implement this if they have extra information to associate with the context menu.
(package private)  int getLimitedMotionScrollAmount(boolean motionToLeft, int deltaX)
           
(package private)  void layout(int delta, boolean animate)
          Creates and positions all views for this Gallery.
(package private)  boolean moveNext()
           
(package private)  boolean movePrevious()
           
(package private)  void onCancel()
          Called when a touch event's action is MotionEvent.ACTION_CANCEL.
 boolean onDown(MotionEvent e)
          Notified when a tap occurs with the down MotionEvent that triggered it.
 boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
          Notified of a fling event when it occurs with the initial on down MotionEvent and the matching up MotionEvent.
protected  void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect)
          Called by the view system when the focus state of this view changes.
 boolean onKeyDown(int keyCode, KeyEvent event)
          Handles left, right, and clicking
 boolean onKeyUp(int keyCode, KeyEvent event)
          Default implementation of KeyEvent.Callback.onKeyMultiple(): perform clicking of the view when KeyEvent.KEYCODE_DPAD_CENTER or KeyEvent.KEYCODE_ENTER is released.
protected  void onLayout(boolean changed, int l, int t, int r, int b)
          Called from layout when this view should assign a size and position to each of its children.
 void onLongPress(MotionEvent e)
          Notified when a long press occurs with the initial on down MotionEvent that trigged it.
 boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY)
          Notified when a scroll occurs with the initial on down MotionEvent and the current move MotionEvent.
 void onShowPress(MotionEvent e)
          The user has performed a down MotionEvent and not performed a move or up yet.
 boolean onSingleTapUp(MotionEvent e)
          Notified when a tap occurs with the up MotionEvent that triggered it.
 boolean onTouchEvent(MotionEvent event)
          Implement this method to handle touch screen motion events.
(package private)  void onUp()
          Called when a touch event's action is MotionEvent.ACTION_UP.
(package private)  void selectionChanged()
           
 void setAnimationDuration(int animationDurationMillis)
          Sets how long the transition animation should run when a child view changes position.
 void setCallbackDuringFling(boolean shouldCallback)
          Whether or not to callback on any AdapterView.getOnItemSelectedListener() while the items are being flinged.
 void setCallbackOnUnselectedItemClick(boolean shouldCallback)
          Whether or not to callback when an item that is not selected is clicked.
 void setGravity(int gravity)
          Describes how the child views are aligned.
(package private)  void setSelectedPositionInt(int position)
          Utility to keep mSelectedPosition and mSelectedRowId in sync
 void setSpacing(int spacing)
          Sets the spacing between items in a Gallery
 void setUnselectedAlpha(float unselectedAlpha)
          Sets the alpha of items that are not selected in the Gallery.
 boolean showContextMenu()
          Bring up the context menu for this view.
 boolean showContextMenuForChild(View originalView)
          Bring up a context menu for the specified view or its ancestors.
(package private)  void trackMotionScroll(int deltaX)
          Tracks a motion scroll.
 
Methods inherited from class android.widget.AbsSpinner
getAdapter, getChildWidth, getCount, getSelectedView, handleDataChanged, onMeasure, onRestoreInstanceState, onSaveInstanceState, pointToPosition, recycleAllViews, requestLayout, resetList, setAdapter, setSelection, setSelection, setSelectionInt
 
Methods inherited from class android.widget.AdapterView
addView, addView, addView, addView, canAnimate, checkFocus, checkSelectionChanged, dispatchRestoreInstanceState, dispatchSaveInstanceState, findSyncPosition, getEmptyView, getFirstVisiblePosition, getItemAtPosition, getItemIdAtPosition, getLastVisiblePosition, getOnItemClickListener, getOnItemLongClickListener, getOnItemSelectedListener, getPositionForView, getSelectedItem, getSelectedItemId, getSelectedItemPosition, isInFilterMode, lookForSelectablePosition, performItemClick, rememberSyncState, removeAllViews, removeView, removeViewAt, setEmptyView, setFocusable, setFocusableInTouchMode, setNextSelectedPositionInt, setOnClickListener, setOnItemClickListener, setOnItemLongClickListener, setOnItemSelectedListener
 
Methods inherited from class android.view.ViewGroup
addFocusables, addStatesFromChildren, addTouchables, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, childDrawableStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchDraw, dispatchFreezeSelfOnly, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchWindowFocusChanged, dispatchWindowVisibilityChanged, drawableStateChanged, drawChild, findFocus, findViewTraversal, findViewWithTagTraversal, fitSystemWindows, focusableViewAvailable, focusSearch, gatherTransparentRegion, getChildAt, getChildCount, getChildMeasureSpec, getChildVisibleRect, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getPersistentDrawingCache, hasFocus, hasFocusable, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawnWithCacheEnabled, measureChild, measureChildren, measureChildWithMargins, offsetChildrenTopAndBottom, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAnimationEnd, onAnimationStart, onCreateDrawableState, onInterceptTouchEvent, onRequestFocusInDescendants, recomputeViewAttributes, removeAllViewsInLayout, removeDetachedView, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestTransparentRegion, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setOnHierarchyChangeListener, setPadding, setPersistentDrawingCache, startLayoutAnimation, updateViewLayout
 
Methods inherited from class android.view.View
applyDrawableToTransparentRegion, bringToFront, buildDrawingCache, cancelLongPress, clearAnimation, computeScroll, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createContextMenu, debug, debugIndent, destroyDrawingCache, dispatchKeyShortcutEvent, draw, finalize, findViewById, findViewWithTag, focusSearch, forceLayout, getAnimation, getApplicationWindowToken, getBackground, getBaseline, getBottom, getBottomFadingEdgeStrength, getContext, getDefaultSize, getDrawableState, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFocusables, getFocusedRect, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getKeepScreenOn, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMeasuredHeight, getMeasuredWidth, getNextFocusDownId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getParent, getResources, getRight, getRightFadingEdgeStrength, getRootView, getScrollBarStyle, getScrollX, getScrollY, getSolidColor, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getTag, getTop, getTopFadingEdgeStrength, getTouchables, getTouchDelegate, getVerticalFadingEdgeLength, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowToken, getWindowVisibility, hasWindowFocus, inflate, initializeFadingEdge, initializeScrollbars, invalidate, invalidate, invalidate, invalidateDrawable, isClickable, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isInTouchMode, isLayoutRequested, isLongClickable, isPressed, isRootNamespace, isSaveEnabled, isSelected, isShown, isSoundEffectsEnabled, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, layout, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAttachedToWindow, onCreateContextMenu, onDetachedFromWindow, onDraw, onFinishInflate, onKeyMultiple, onKeyShortcut, onScrollChanged, onSetAlpha, onSizeChanged, onTrackballEvent, onWindowFocusChanged, onWindowVisibilityChanged, performClick, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, refreshDrawableState, removeCallbacks, requestFocus, requestFocus, requestFocusFromTouch, requestRectangleOnScreen, requestRectangleOnScreen, resolveSize, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, setAnimation, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setClickable, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setEnabled, setFadingEdgeLength, setFrame, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setId, setIsRootNamespace, setKeepScreenOn, setLayoutParams, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnCreateContextMenuListener, setOnFocusChangeListener, setOnKeyListener, setOnLongClickListener, setOnTouchListener, setPressed, setSaveEnabled, setScrollBarStyle, setSelected, setSoundEffectsEnabled, setTag, setTouchDelegate, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVisibility, setWillNotCacheDrawing, setWillNotDraw, 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
 

Constructor Detail

Gallery

public Gallery(Context context)

Gallery

public Gallery(Context context,
               AttributeSet attrs)

Gallery

public Gallery(Context context,
               AttributeSet attrs,
               int defStyle)
Method Detail

setCallbackDuringFling

public void setCallbackDuringFling(boolean shouldCallback)
Whether or not to callback on any AdapterView.getOnItemSelectedListener() while the items are being flinged. If false, only the final selected item will cause the callback. If true, all items between the first and the final will cause callbacks.

Parameters:
shouldCallback - Whether or not to callback on the listener while the items are being flinged.

setCallbackOnUnselectedItemClick

public void setCallbackOnUnselectedItemClick(boolean shouldCallback)
Whether or not to callback when an item that is not selected is clicked. If false, the item will become selected (and re-centered). If true, the AdapterView.getOnItemClickListener() will get the callback.

Parameters:
shouldCallback - Whether or not to callback on the listener when a item that is not selected is clicked.

setAnimationDuration

public void setAnimationDuration(int animationDurationMillis)
Sets how long the transition animation should run when a child view changes position. Only relevant if animation is turned on.

Parameters:
animationDurationMillis - The duration of the transition, in milliseconds.

setSpacing

public void setSpacing(int spacing)
Sets the spacing between items in a Gallery

Parameters:
spacing - The spacing in pixels between items in the Gallery

setUnselectedAlpha

public void setUnselectedAlpha(float unselectedAlpha)
Sets the alpha of items that are not selected in the Gallery.

Parameters:
unselectedAlpha - the alpha for the items that are not selected.

getChildStaticTransformation

protected boolean getChildStaticTransformation(View child,
                                               Transformation t)
Description copied from class: ViewGroup

Overrides:
getChildStaticTransformation in class ViewGroup

computeHorizontalScrollExtent

protected int computeHorizontalScrollExtent()
Description copied from class: View

Compute the horizontal extent of the horizontal scrollbar's thumb within the horizontal range. This value is used to compute the length of the thumb within the scrollbar's track.

The range is expressed in arbitrary units that must be the same as the units used by View.computeHorizontalScrollRange() and View.computeHorizontalScrollOffset().

The default extent is the drawing width of this view.

Overrides:
computeHorizontalScrollExtent in class View
Returns:
the horizontal extent of the scrollbar's thumb
See Also:
View.computeHorizontalScrollRange(), View.computeHorizontalScrollOffset(), ScrollBarDrawable

computeHorizontalScrollOffset

protected int computeHorizontalScrollOffset()
Description copied from class: View

Compute the horizontal offset of the horizontal scrollbar's thumb within the horizontal range. This value is used to compute the position of the thumb within the scrollbar's track.

The range is expressed in arbitrary units that must be the same as the units used by View.computeHorizontalScrollRange() and View.computeHorizontalScrollExtent().

The default offset is the scroll offset of this view.

Overrides:
computeHorizontalScrollOffset in class View
Returns:
the horizontal offset of the scrollbar's thumb
See Also:
View.computeHorizontalScrollRange(), View.computeHorizontalScrollExtent(), ScrollBarDrawable

computeHorizontalScrollRange

protected int computeHorizontalScrollRange()
Description copied from class: View

Compute the horizontal range that the horizontal scrollbar represents.

The range is expressed in arbitrary units that must be the same as the units used by View.computeHorizontalScrollExtent() and View.computeHorizontalScrollOffset().

The default range is the drawing width of this view.

Overrides:
computeHorizontalScrollRange in class View
Returns:
the total horizontal range represented by the horizontal scrollbar
See Also:
View.computeHorizontalScrollExtent(), View.computeHorizontalScrollOffset(), ScrollBarDrawable

checkLayoutParams

protected boolean checkLayoutParams(ViewGroup.LayoutParams p)
Description copied from class: ViewGroup

Overrides:
checkLayoutParams in class ViewGroup

generateLayoutParams

protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p)
Description copied from class: ViewGroup
Returns a safe set of layout parameters based on the supplied layout params. When a ViewGroup is passed a View whose layout params do not pass the test of ViewGroup.checkLayoutParams(android.view.ViewGroup.LayoutParams), this method is invoked. This method should return a new set of layout params suitable for this ViewGroup, possibly by copying the appropriate attributes from the specified set of layout params.

Overrides:
generateLayoutParams in class ViewGroup
Parameters:
p - The layout parameters to convert into a suitable set of layout parameters for this ViewGroup.
Returns:
an instance of ViewGroup.LayoutParams or one of its descendants

generateLayoutParams

public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attrs)
Description copied from class: ViewGroup
Returns a new set of layout parameters based on the supplied attributes set.

Overrides:
generateLayoutParams in class ViewGroup
Parameters:
attrs - the attributes to build the layout parameters from
Returns:
an instance of ViewGroup.LayoutParams or one of its descendants

generateDefaultLayoutParams

protected ViewGroup.LayoutParams generateDefaultLayoutParams()
Description copied from class: ViewGroup
Returns a set of default layout parameters. These parameters are requested when the View passed to ViewGroup.addView(View) has no layout parameters already set. If null is returned, an exception is thrown from addView.

Overrides:
generateDefaultLayoutParams in class AbsSpinner
Returns:
a set of default layout parameters or null

onLayout

protected void onLayout(boolean changed,
                        int l,
                        int t,
                        int r,
                        int b)
Description copied from class: ViewGroup
Called from layout when this view should assign a size and position to each of its children. Derived classes with children should override this method and call layout on each of their their children.

Overrides:
onLayout in class AdapterView<SpinnerAdapter>
Parameters:
changed - This is a new size or position for this view
l - Left position, relative to parent
t - Top position, relative to parent
r - Right position, relative to parent
b - Bottom position, relative to parent

getChildHeight

int getChildHeight(View child)
Overrides:
getChildHeight in class AbsSpinner

trackMotionScroll

void trackMotionScroll(int deltaX)
Tracks a motion scroll. In reality, this is used to do just about any movement to items (touch scroll, arrow-key scroll, set an item as selected).

Parameters:
deltaX - Change in X from the previous event.

getLimitedMotionScrollAmount

int getLimitedMotionScrollAmount(boolean motionToLeft,
                                 int deltaX)

selectionChanged

void selectionChanged()
Overrides:
selectionChanged in class AdapterView<SpinnerAdapter>

layout

void layout(int delta,
            boolean animate)
Creates and positions all views for this Gallery.

We layout rarely, most of the time trackMotionScroll(int) takes care of repositioning, adding, and removing children.

Specified by:
layout in class AbsSpinner
Parameters:
delta - Change in the selected position. +1 means the selection is moving to the right, so views are scrolling to the left. -1 means the selection is moving to the left.

onTouchEvent

public boolean onTouchEvent(MotionEvent event)
Description copied from class: View
Implement this method to handle touch screen motion events.

Overrides:
onTouchEvent in class View
Parameters:
event - The motion event.
Returns:
True if the event was handled, false otherwise.

onSingleTapUp

public boolean onSingleTapUp(MotionEvent e)
Notified when a tap occurs with the up MotionEvent that triggered it.

Specified by:
onSingleTapUp in interface GestureDetector.OnGestureListener
Parameters:
e - The up motion event that completed the first tap
Returns:
true if the event is consumed, else false

onFling

public boolean onFling(MotionEvent e1,
                       MotionEvent e2,
                       float velocityX,
                       float velocityY)
Notified of a fling event when it occurs with the initial on down MotionEvent and the matching up MotionEvent. The calculated velocity is supplied along the x and y axis in pixels per second.

Specified by:
onFling in interface GestureDetector.OnGestureListener
Parameters:
e1 - The first down motion event that started the fling.
e2 - The move motion event that triggered the current onFling.
velocityX - The velocity of this fling measured in pixels per second along the x axis.
velocityY - The velocity of this fling measured in pixels per second along the y axis.
Returns:
true if the event is consumed, else false

onScroll

public boolean onScroll(MotionEvent e1,
                        MotionEvent e2,
                        float distanceX,
                        float distanceY)
Notified when a scroll occurs with the initial on down MotionEvent and the current move MotionEvent. The distance in x and y is also supplied for convenience.

Specified by:
onScroll in interface GestureDetector.OnGestureListener
Parameters:
e1 - The first down motion event that started the scrolling.
e2 - The move motion event that triggered the current onScroll.
distanceX - The distance along the X axis that has been scrolled since the last call to onScroll. This is NOT the distance between e1 and e2.
distanceY - The distance along the Y axis that has been scrolled since the last call to onScroll. This is NOT the distance between e1 and e2.
Returns:
true if the event is consumed, else false

onDown

public boolean onDown(MotionEvent e)
Notified when a tap occurs with the down MotionEvent that triggered it. This will be triggered immediately for every down event. All other events should be preceded by this.

Specified by:
onDown in interface GestureDetector.OnGestureListener
Parameters:
e - The down motion event.

onUp

void onUp()
Called when a touch event's action is MotionEvent.ACTION_UP.


onCancel

void onCancel()
Called when a touch event's action is MotionEvent.ACTION_CANCEL.


onLongPress

public void onLongPress(MotionEvent e)
Notified when a long press occurs with the initial on down MotionEvent that trigged it.

Specified by:
onLongPress in interface GestureDetector.OnGestureListener
Parameters:
e - The initial on down motion event that started the longpress.

onShowPress

public void onShowPress(MotionEvent e)
The user has performed a down MotionEvent and not performed a move or up yet. This event is commonly used to provide visual feedback to the user to let them know that their action has been recognized i.e. highlight an element.

Specified by:
onShowPress in interface GestureDetector.OnGestureListener
Parameters:
e - The down motion event

dispatchSetSelected

public void dispatchSetSelected(boolean selected)
Description copied from class: ViewGroup
Dispatch setSelected to all of this View's children.

Overrides:
dispatchSetSelected in class ViewGroup
Parameters:
selected - The new selected state
See Also:
View.setSelected(boolean)

dispatchSetPressed

protected void dispatchSetPressed(boolean pressed)
Description copied from class: View
Dispatch setPressed to all of this View's children.

Overrides:
dispatchSetPressed in class ViewGroup
Parameters:
pressed - The new pressed state
See Also:
View.setPressed(boolean)

getContextMenuInfo

protected ContextMenu.ContextMenuInfo getContextMenuInfo()
Description copied from class: View
Views should implement this if they have extra information to associate with the context menu. The return result is supplied as a parameter to the OnCreateContextMenuListener#onCreateContextMenu(ContextMenu, View, ContextMenuInfo) callback.

Overrides:
getContextMenuInfo in class View
Returns:
Extra information about the item for which the context menu should be shown. This information will vary across different subclasses of View.

showContextMenuForChild

public boolean showContextMenuForChild(View originalView)
Description copied from class: ViewGroup
Bring up a context menu for the specified view or its ancestors.

In most cases, a subclass does not need to override this. However, if the subclass is added directly to the window manager (for example, ViewManager.addView(View, android.view.ViewGroup.LayoutParams)) then it should override this and show the context menu.

Specified by:
showContextMenuForChild in interface ViewParent
Overrides:
showContextMenuForChild in class ViewGroup
Parameters:
originalView - The source view where the context menu was first invoked
Returns:
true if a context menu was displayed

showContextMenu

public boolean showContextMenu()
Description copied from class: View
Bring up the context menu for this view.

Overrides:
showContextMenu in class View
Returns:
Whether a context menu was displayed.

dispatchKeyEvent

public boolean dispatchKeyEvent(KeyEvent event)
Description copied from class: ViewGroup
Dispatch a key event to the next view on the focus path. This path runs from the top of the view tree down to the currently focused view. If this view has focus, it will dispatch to itself. Otherwise it will dispatch the next node down the focus path. This method also fires any key listeners.

Overrides:
dispatchKeyEvent in class ViewGroup
Parameters:
event - The key event to be dispatched.
Returns:
True if the event was handled, false otherwise.

onKeyDown

public boolean onKeyDown(int keyCode,
                         KeyEvent event)
Handles left, right, and clicking

Specified by:
onKeyDown in interface KeyEvent.Callback
Overrides:
onKeyDown in class View
Parameters:
keyCode - A key code that represents the button pressed, from KeyEvent.
event - The KeyEvent object that defines the button action.
Returns:
If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.
See Also:
View.onKeyDown(int, android.view.KeyEvent)

onKeyUp

public boolean onKeyUp(int keyCode,
                       KeyEvent event)
Description copied from class: View
Default implementation of KeyEvent.Callback.onKeyMultiple(): perform clicking of the view when KeyEvent.KEYCODE_DPAD_CENTER or KeyEvent.KEYCODE_ENTER is released.

Specified by:
onKeyUp in interface KeyEvent.Callback
Overrides:
onKeyUp in class View
Parameters:
keyCode - A key code that represents the button pressed, from KeyEvent.
event - The KeyEvent object that defines the button action.
Returns:
If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

movePrevious

boolean movePrevious()

moveNext

boolean moveNext()

setSelectedPositionInt

void setSelectedPositionInt(int position)
Description copied from class: AdapterView
Utility to keep mSelectedPosition and mSelectedRowId in sync

Overrides:
setSelectedPositionInt in class AdapterView<SpinnerAdapter>
Parameters:
position - Our current position

setGravity

public void setGravity(int gravity)
Describes how the child views are aligned.

Parameters:
gravity -

getChildDrawingOrder

protected int getChildDrawingOrder(int childCount,
                                   int i)
Description copied from class: ViewGroup
Returns the index of the child to draw for this iteration. Override this if you want to change the drawing order of children. By default, it returns i.

NOTE: In order for this method to be called, the ViewGroup.FLAG_USE_CHILD_DRAWING_ORDER must be set.

Overrides:
getChildDrawingOrder in class ViewGroup
i - The current iteration.
Returns:
The index of the child to draw this iteration.

onFocusChanged

protected void onFocusChanged(boolean gainFocus,
                              int direction,
                              Rect previouslyFocusedRect)
Description copied from class: View
Called by the view system when the focus state of this view changes. When the focus change event is caused by directional navigation, direction and previouslyFocusedRect provide insight into where the focus is coming from.

Overrides:
onFocusChanged in class View
Parameters:
gainFocus - True if the View has focus; false otherwise.
direction - The direction focus has moved when requestFocus() is called to give this view focus. Values are View.FOCUS_UP, View.FOCUS_DOWN, View.FOCUS_LEFT or View.FOCUS_RIGHT. It may not always apply, in which case use the default.
previouslyFocusedRect - The rectangle, in this view's coordinate system, of the previously focused view. If applicable, this will be passed in as finer grained information about where the focus is coming from (in addition to direction). Will be null otherwise.

Build 1.0_r1(from source)

Please submit a feedback, bug or feature