com.sileria.android.view
Class HorzListView
java.lang.Object
android.view.View
android.view.ViewGroup
android.widget.AdapterView<T>
com.sileria.android.view.FriendAdapterView<ListAdapter>
com.sileria.android.view.HorzListView
- All Implemented Interfaces:
- Drawable.Callback, AccessibilityEventSource, GestureDetector.OnGestureListener, KeyEvent.Callback, ViewManager, ViewParent
public class HorzListView
- extends FriendAdapterView<ListAdapter>
- implements GestureDetector.OnGestureListener
Finally a mixture of Gallery and a ListView that actually works like a
horizontal list view, and thank God without being "center-locked".
As usual it was too hard for google engineers to make a small flag that
will let the list be center_locked or !center-locked.
This list is very similar to Gallery but uses a ListAdapter and not
the SpinnerAdapater.
- Since:
- API 8
- Author:
- Ahmed Shakil
- Create Date:
- 19-May-2012
- Note:
- Incomplete selection and selector work. (Might have some other minor bugs)
|
Nested Class Summary |
static class |
HorzListView.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.view.View |
View.AccessibilityDelegate, View.BaseSavedState, View.DragShadowBuilder, View.MeasureSpec, View.OnAttachStateChangeListener, View.OnClickListener, View.OnCreateContextMenuListener, View.OnDragListener, View.OnFocusChangeListener, View.OnGenericMotionListener, View.OnHoverListener, View.OnKeyListener, View.OnLayoutChangeListener, View.OnLongClickListener, View.OnSystemUiVisibilityChangeListener, View.OnTouchListener |
| Fields inherited from class com.sileria.android.view.FriendAdapterView |
mAdapter, mAnimationDuration, mBlockLayoutRequests, mDataChanged, mFirstPosition, mInLayout, mItemCount, mNeedSync, mNextSelectedPosition, mNextSelectedRowId, mOldItemCount, mOldSelectedPosition, mOldSelectedRowId, mRecycler, mSelectedChild, mSelectedPosition, mSelectedRowId, mSelectionBottomPadding, mSelectionLeftPadding, mSelectionRightPadding, mSelectionTopPadding, mSpecificTop, mSyncHeight, mSyncMode, mSyncPosition, mSyncRowId, SYNC_FIRST_POSITION, SYNC_MAX_DURATION_MILLIS, SYNC_SELECTED_POSITION |
| 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, 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, 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_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LOW_PROFILE, SYSTEM_UI_FLAG_VISIBLE, TRANSLATION_X, TRANSLATION_Y, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET, X, Y |
|
Method Summary |
protected boolean |
checkLayoutParams(ViewGroup.LayoutParams p)
|
protected int |
computeHorizontalScrollExtent()
|
protected int |
computeHorizontalScrollOffset()
|
protected int |
computeHorizontalScrollRange()
|
boolean |
dispatchKeyEvent(KeyEvent event)
Steal all key events. |
protected ViewGroup.LayoutParams |
generateDefaultLayoutParams()
|
ViewGroup.LayoutParams |
generateLayoutParams(AttributeSet attrs)
|
protected ViewGroup.LayoutParams |
generateLayoutParams(ViewGroup.LayoutParams p)
|
protected int |
getChildDrawingOrder(int childCount,
int i)
|
protected int |
getChildHeight(View child)
|
protected int |
getChildWidth(View child)
|
protected ContextMenu.ContextMenuInfo |
getContextMenuInfo()
|
protected int |
getLimitedMotionScrollAmount(boolean motionToLeft,
int deltaX)
|
View |
getSelectedView()
|
boolean |
isSmoothScrollbarEnabled()
Returns the current state of the fast scroll feature. |
protected void |
layoutChildren(int delta,
boolean animate,
boolean changed)
Creates and positions all views for this Gallery. |
protected boolean |
moveNext()
|
protected boolean |
movePrevious()
|
protected void |
onCancel()
Called when a touch event's action is MotionEvent.ACTION_CANCEL. |
boolean |
onDown(MotionEvent e)
|
boolean |
onFling(MotionEvent e1,
MotionEvent e2,
float velocityX,
float velocityY)
|
boolean |
onKeyDown(int keyCode,
KeyEvent event)
Handles left, right, and clicking |
void |
onLongPress(MotionEvent e)
|
protected void |
onMeasure(int widthMeasureSpec,
int heightMeasureSpec)
|
boolean |
onScroll(MotionEvent e1,
MotionEvent e2,
float distanceX,
float distanceY)
|
void |
onShowPress(MotionEvent e)
|
boolean |
onSingleTapUp(MotionEvent e)
|
boolean |
onTouchEvent(MotionEvent event)
|
protected void |
onUp()
Called when a touch event's action is MotionEvent.ACTION_UP. |
int |
pointToPosition(int x,
int y)
Maps a point to a position in the list. |
protected void |
selectionChanged()
|
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. |
void |
setSelection(int position)
|
void |
setSelection(int position,
boolean animate)
Jump directly to a specific item in the adapter data. |
void |
setSmoothScrollbarEnabled(boolean enabled)
When smooth scrollbar is enabled, the position and size of the scrollbar thumb
is computed based on the number of visible pixels in the visible items. |
void |
setSpacing(int spacing)
Sets the spacing between items in a Gallery |
boolean |
showContextMenu()
|
boolean |
showContextMenuForChild(View originalView)
|
protected void |
trackMotionScroll(int deltaX)
Tracks a motion scroll. |
| Methods inherited from class com.sileria.android.view.FriendAdapterView |
canAnimate, checkFocus, checkSelectionChanged, createDataSetObserver, dispatchDraw, dispatchPopulateAccessibilityEvent, dispatchPress, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetPressed, dispatchSetSelected, dispatchUnpress, drawableStateChanged, drawSelector, getAdapter, getCount, getFirstVisiblePosition, getItemAtPosition, getItemIdAtPosition, getLastVisiblePosition, getPositionForView, getSelectedItem, getSelectedItemId, getSelectedItemPosition, handleDataChanged, init, lookForSelectablePosition, onCreateDrawableState, onDetachedFromWindow, onFocusChanged, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyUp, onLayout, onRequestSendAccessibilityEvent, onRestoreInstanceState, onSaveInstanceState, recycleAllViews, rememberSyncState, requestLayout, resetList, setAdapter, setAnimationDuration, setDrawSelectorOnTop, setNextSelectedPositionInt, setOnClickListener, setSelectedPositionInt, setSelectionInt, setSelector, setSelector, shouldShowSelector, updateSelectedItemMetadata, updateSelector, verifyDrawable |
| Methods inherited from class android.widget.AdapterView |
addView, addView, addView, addView, getEmptyView, getOnItemClickListener, getOnItemLongClickListener, getOnItemSelectedListener, performItemClick, removeAllViews, removeView, removeViewAt, setEmptyView, setFocusable, setFocusableInTouchMode, setOnItemClickListener, setOnItemLongClickListener, setOnItemSelectedListener |
| Methods inherited from class android.view.ViewGroup |
addFocusables, addFocusables, addStatesFromChildren, addTouchables, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, childDrawableStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDragEvent, dispatchFreezeSelfOnly, dispatchGenericFocusedEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchSetActivated, dispatchSystemUiVisibilityChanged, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowVisibilityChanged, drawChild, endViewTransition, findFocus, findViewsWithText, fitSystemWindows, focusableViewAvailable, focusSearch, gatherTransparentRegion, getChildAt, getChildCount, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getLayoutTransition, getPersistentDrawingCache, hasFocus, hasFocusable, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawingOrderEnabled, isChildrenDrawnWithCacheEnabled, isMotionEventSplittingEnabled, jumpDrawablesToCurrentState, layout, measureChild, measureChildren, measureChildWithMargins, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAnimationEnd, onAnimationStart, onInterceptHoverEvent, onInterceptTouchEvent, onRequestFocusInDescendants, recomputeViewAttributes, removeAllViewsInLayout, removeDetachedView, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestSendAccessibilityEvent, requestTransparentRegion, resetResolvedLayoutDirection, resetResolvedTextDirection, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawingOrderEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutTransition, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPadding, setPersistentDrawingCache, setStaticTransformationsEnabled, shouldDelayChildPressedState, startActionModeForChild, startLayoutAnimation, startViewTransition, updateViewLayout |
| Methods inherited from class android.view.View |
addOnAttachStateChangeListener, addOnLayoutChangeListener, animate, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, cancelLongPress, canScrollHorizontally, canScrollVertically, checkInputConnectionProxy, clearAnimation, combineMeasuredStates, computeScroll, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchGenericMotionEvent, draw, findViewById, findViewWithTag, fitsSystemWindows, focusSearch, forceLayout, getAlpha, getAnimation, getApplicationWindowToken, getBackground, getBaseline, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getContentDescription, getContext, getDefaultSize, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFilterTouchesWhenObscured, getFocusables, getFocusedRect, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getKeepScreenOn, getKeyDispatcherState, getLayerType, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOverScrollMode, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getParent, getPivotX, getPivotY, getResources, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootView, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarStyle, getScrollX, getScrollY, getSolidColor, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSystemUiVisibility, getTag, getTag, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchables, getTouchDelegate, getTranslationX, getTranslationY, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, hasOnClickListeners, hasWindowFocus, inflate, initializeFadingEdge, initializeScrollbars, invalidate, invalidate, invalidate, invalidateDrawable, isActivated, isClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isInEditMode, isInTouchMode, isLayoutRequested, isLongClickable, isOpaque, isPaddingOffsetRequired, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScrollbarFadingEnabled, isSelected, isShown, isSoundEffectsEnabled, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAttachedToWindow, onCheckIsTextEditor, onConfigurationChanged, onCreateContextMenu, onCreateInputConnection, onDisplayHint, onDragEvent, onDraw, onDrawScrollBars, onFilterTouchEventForSecurity, onFinishInflate, onFinishTemporaryDetach, onGenericMotionEvent, onHoverChanged, onHoverEvent, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onOverScrolled, onPopulateAccessibilityEvent, onScrollChanged, onSetAlpha, onSizeChanged, onStartTemporaryDetach, onTrackballEvent, onVisibilityChanged, onWindowFocusChanged, onWindowVisibilityChanged, overScrollBy, performClick, performHapticFeedback, performHapticFeedback, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, refreshDrawableState, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, requestFocus, requestFocus, requestFocusFromTouch, requestRectangleOnScreen, requestRectangleOnScreen, resolveSize, resolveSizeAndState, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setActivated, setAlpha, setAnimation, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBottom, setCameraDistance, setClickable, setContentDescription, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setHapticFeedbackEnabled, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHovered, setId, setKeepScreenOn, setLayerType, setLayoutParams, setLeft, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOverScrollMode, setPivotX, setPivotY, setPressed, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScrollbarFadingEnabled, setScrollBarStyle, setScrollContainer, setScrollX, setScrollY, setSelected, setSoundEffectsEnabled, setSystemUiVisibility, setTag, setTag, setTop, setTouchDelegate, setTranslationX, setTranslationY, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, 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 |
mListPadding
protected final Rect mListPadding
HorzListView
public HorzListView(Context context)
- Constructor, default.
- Parameters:
context - Activity context.
HorzListView
public HorzListView(Context context,
AttributeSet attrs)
- Constructor with attribute set.
- Parameters:
context - Activity context.
HorzListView
public HorzListView(Context context,
AttributeSet attrs,
int defStyle)
- Constructor with attribute set and default style.
- Parameters:
context - Activity context.
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.
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- XML Attributes:
- ref android.R.styleable#Gallery_spacing
setSmoothScrollbarEnabled
public void setSmoothScrollbarEnabled(boolean enabled)
- When smooth scrollbar is enabled, the position and size of the scrollbar thumb
is computed based on the number of visible pixels in the visible items. This
however assumes that all list items have the same height. If you use a list in
which items have different heights, the scrollbar will change appearance as the
user scrolls through the list. To avoid this issue, you need to disable this
property.
When smooth scrollbar is disabled, the position and size of the scrollbar thumb
is based solely on the number of items in the adapter and the position of the
visible items inside the adapter. This provides a stable scrollbar as the user
navigates through a list of items with varying heights.
- Parameters:
enabled - Whether or not to enable smooth scrollbar.- See Also:
setSmoothScrollbarEnabled(boolean)- XML Attributes:
- ref android.R.styleable#AbsListView_smoothScrollbar
isSmoothScrollbarEnabled
public boolean isSmoothScrollbarEnabled()
- Returns the current state of the fast scroll feature.
- Returns:
- True if smooth scrollbar is enabled is enabled, false otherwise.
- See Also:
setSmoothScrollbarEnabled(boolean)
computeHorizontalScrollExtent
protected int computeHorizontalScrollExtent()
- Overrides:
computeHorizontalScrollExtent in class View
computeHorizontalScrollOffset
protected int computeHorizontalScrollOffset()
- Overrides:
computeHorizontalScrollOffset in class View
computeHorizontalScrollRange
protected int computeHorizontalScrollRange()
- Overrides:
computeHorizontalScrollRange in class View
checkLayoutParams
protected boolean checkLayoutParams(ViewGroup.LayoutParams p)
- Overrides:
checkLayoutParams in class ViewGroup
generateLayoutParams
protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p)
- Overrides:
generateLayoutParams in class ViewGroup
generateLayoutParams
public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attrs)
- Overrides:
generateLayoutParams in class ViewGroup
generateDefaultLayoutParams
protected ViewGroup.LayoutParams generateDefaultLayoutParams()
- Overrides:
generateDefaultLayoutParams in class ViewGroup
getChildHeight
protected int getChildHeight(View child)
getChildWidth
protected int getChildWidth(View child)
trackMotionScroll
protected 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
protected int getLimitedMotionScrollAmount(boolean motionToLeft,
int deltaX)
setSelection
public void setSelection(int position,
boolean animate)
- Jump directly to a specific item in the adapter data.
setSelection
public void setSelection(int position)
- Specified by:
setSelection in class AdapterView<ListAdapter>
getSelectedView
public View getSelectedView()
- Specified by:
getSelectedView in class FriendAdapterView<ListAdapter>
- Returns:
- The view corresponding to the currently selected item, or null
if nothing is selected
selectionChanged
protected void selectionChanged()
- Overrides:
selectionChanged in class FriendAdapterView<ListAdapter>
onMeasure
protected void onMeasure(int widthMeasureSpec,
int heightMeasureSpec)
- Overrides:
onMeasure in class View
- See Also:
Figure out the dimensions of this Spinner. The width comes from
the widthMeasureSpec as Spinnners can't have their width set to
UNSPECIFIED. The height is based on the height of the selected item
plus padding.
layoutChildren
protected void layoutChildren(int delta,
boolean animate,
boolean changed)
- 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:
layoutChildren in class FriendAdapterView<ListAdapter>
- 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.
dispatchKeyEvent
public boolean dispatchKeyEvent(KeyEvent event)
- Steal all key events.
- Overrides:
dispatchKeyEvent in class ViewGroup
onKeyDown
public boolean onKeyDown(int keyCode,
KeyEvent event)
- Description copied from class:
FriendAdapterView
- Handles left, right, and clicking
- Specified by:
onKeyDown in interface KeyEvent.Callback- Overrides:
onKeyDown in class FriendAdapterView<ListAdapter>
- See Also:
View.onKeyDown(int, android.view.KeyEvent)
onTouchEvent
public boolean onTouchEvent(MotionEvent event)
- Overrides:
onTouchEvent in class View
onSingleTapUp
public boolean onSingleTapUp(MotionEvent e)
- Specified by:
onSingleTapUp in interface GestureDetector.OnGestureListener
onFling
public boolean onFling(MotionEvent e1,
MotionEvent e2,
float velocityX,
float velocityY)
- Specified by:
onFling in interface GestureDetector.OnGestureListener
onScroll
public boolean onScroll(MotionEvent e1,
MotionEvent e2,
float distanceX,
float distanceY)
- Specified by:
onScroll in interface GestureDetector.OnGestureListener
onDown
public boolean onDown(MotionEvent e)
- Specified by:
onDown in interface GestureDetector.OnGestureListener
onUp
protected void onUp()
- Called when a touch event's action is MotionEvent.ACTION_UP.
onCancel
protected void onCancel()
- Called when a touch event's action is MotionEvent.ACTION_CANCEL.
onLongPress
public void onLongPress(MotionEvent e)
- Specified by:
onLongPress in interface GestureDetector.OnGestureListener
onShowPress
public void onShowPress(MotionEvent e)
- Specified by:
onShowPress in interface GestureDetector.OnGestureListener
pointToPosition
public int pointToPosition(int x,
int y)
- Maps a point to a position in the list.
- Parameters:
x - X in local coordinatey - Y in local coordinate
- Returns:
- The position of the item which contains the specified point, or
AdapterView.INVALID_POSITION if the point does not intersect an item.
getContextMenuInfo
protected ContextMenu.ContextMenuInfo getContextMenuInfo()
- Overrides:
getContextMenuInfo in class View
showContextMenuForChild
public boolean showContextMenuForChild(View originalView)
- Specified by:
showContextMenuForChild in interface ViewParent- Overrides:
showContextMenuForChild in class ViewGroup
showContextMenu
public boolean showContextMenu()
- Overrides:
showContextMenu in class View
movePrevious
protected boolean movePrevious()
moveNext
protected boolean moveNext()
setGravity
public void setGravity(int gravity)
- Describes how the child views are aligned.
- XML Attributes:
- ref android.R.styleable#Gallery_gravity
getChildDrawingOrder
protected int getChildDrawingOrder(int childCount,
int i)
- Overrides:
getChildDrawingOrder in class ViewGroup
Copyright © 2001 - 2012 Sileria, Inc.