com.sileria.android.view
Class HorzListView

java.lang.Object
  extended by android.view.View
      extended by android.view.ViewGroup
          extended by android.widget.AdapterView<T>
              extended by com.sileria.android.view.FriendAdapterView<ListAdapter>
                  extended by 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 com.sileria.android.view.FriendAdapterView
FriendAdapterView.AdapterDataSetObserver, FriendAdapterView.RecycleBin, FriendAdapterView.SavedState
 
Nested classes/interfaces inherited from class android.widget.AdapterView
AdapterView.AdapterContextMenuInfo, 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.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
 
Field Summary
protected  Rect mListPadding
           
 
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.widget.AdapterView
INVALID_POSITION, INVALID_ROW_ID, ITEM_VIEW_TYPE_HEADER_OR_FOOTER, ITEM_VIEW_TYPE_IGNORE
 
Fields inherited from class android.view.ViewGroup
CLIP_TO_PADDING_MASK, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, LAYOUT_MODE_CLIP_BOUNDS, LAYOUT_MODE_OPTICAL_BOUNDS, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHE
 
Fields inherited from class android.view.View
ACCESSIBILITY_LIVE_REGION_ASSERTIVE, ACCESSIBILITY_LIVE_REGION_NONE, ACCESSIBILITY_LIVE_REGION_POLITE, 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_NO_HIDE_DESCENDANTS, IMPORTANT_FOR_ACCESSIBILITY_YES, INVISIBLE, KEEP_SCREEN_ON, LAYER_TYPE_HARDWARE, LAYER_TYPE_NONE, LAYER_TYPE_SOFTWARE, LAYOUT_DIRECTION_INHERIT, LAYOUT_DIRECTION_LOCALE, LAYOUT_DIRECTION_LTR, LAYOUT_DIRECTION_RTL, 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_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_IMMERSIVE, SYSTEM_UI_FLAG_IMMERSIVE_STICKY, 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_CENTER, TEXT_ALIGNMENT_GRAVITY, TEXT_ALIGNMENT_INHERIT, TEXT_ALIGNMENT_TEXT_END, TEXT_ALIGNMENT_TEXT_START, TEXT_ALIGNMENT_VIEW_END, TEXT_ALIGNMENT_VIEW_START, TEXT_DIRECTION_ANY_RTL, TEXT_DIRECTION_FIRST_STRONG, TEXT_DIRECTION_INHERIT, TEXT_DIRECTION_LOCALE, TEXT_DIRECTION_LTR, TEXT_DIRECTION_RTL, TRANSLATION_X, TRANSLATION_Y, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET, X, Y
 
Constructor Summary
HorzListView(Context context)
          Constructor, default.
HorzListView(Context context, AttributeSet attrs)
          Constructor with attribute set.
HorzListView(Context context, AttributeSet attrs, int defStyle)
          Constructor with attribute set and default style.
 
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, getItemsCanFocus, getLastVisiblePosition, getPositionForView, getSelectedItem, getSelectedItemId, getSelectedItemPosition, handleDataChanged, init, lookForSelectablePosition, onCreateDrawableState, onDetachedFromWindow, onFocusChanged, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyUp, onLayout, onRequestSendAccessibilityEvent, onRestoreInstanceState, onSaveInstanceState, recycleAllViews, rememberSyncState, requestLayout, resetList, setAdapter, setAnimationDuration, setDrawSelectorOnNoFocus, setDrawSelectorOnTop, setItemsCanFocus, 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
addChildrenForAccessibility, addFocusables, addStatesFromChildren, addTouchables, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, childDrawableStateChanged, childHasTransientStateChanged, 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, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, drawChild, endViewTransition, findFocus, findViewsWithText, fitSystemWindows, focusableViewAvailable, focusSearch, gatherTransparentRegion, getChildAt, getChildCount, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getClipChildren, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getLayoutMode, getLayoutTransition, getOverlay, getPersistentDrawingCache, hasFocus, hasFocusable, hasTransientState, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawingOrderEnabled, isChildrenDrawnWithCacheEnabled, isMotionEventSplittingEnabled, jumpDrawablesToCurrentState, layout, measureChild, measureChildren, measureChildWithMargins, notifySubtreeAccessibilityStateChanged, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAnimationEnd, onAnimationStart, onAttachedToWindow, onInterceptHoverEvent, onInterceptTouchEvent, onRequestFocusInDescendants, recomputeViewAttributes, removeAllViewsInLayout, removeDetachedView, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestSendAccessibilityEvent, requestTransparentRegion, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawingOrderEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutMode, setLayoutTransition, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPersistentDrawingCache, setStaticTransformationsEnabled, shouldDelayChildPressedState, startActionModeForChild, startLayoutAnimation, startViewTransition, updateViewLayout
 
Methods inherited from class android.view.View
addFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, animate, announceForAccessibility, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, cancelLongPress, cancelPendingInputEvents, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, checkInputConnectionProxy, clearAnimation, combineMeasuredStates, computeScroll, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchGenericMotionEvent, draw, findViewById, findViewWithTag, focusSearch, forceLayout, generateViewId, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAlpha, getAnimation, getApplicationWindowToken, getBackground, getBaseline, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getCameraDistance, getClipBounds, getContentDescription, getContext, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusables, getFocusedRect, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getImportantForAccessibility, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, 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, getTextAlignment, getTextDirection, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchables, getTouchDelegate, getTranslationX, getTranslationY, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowId, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, hasOnClickListeners, hasOverlappingRendering, hasWindowFocus, inflate, initializeFadingEdge, initializeScrollbars, invalidate, invalidate, invalidate, invalidateDrawable, isActivated, isAttachedToWindow, isClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isInEditMode, isInLayout, isInTouchMode, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isOpaque, isPaddingOffsetRequired, isPaddingRelative, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShown, isSoundEffectsEnabled, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onCancelPendingInputEvents, onCheckIsTextEditor, onConfigurationChanged, onCreateContextMenu, onCreateInputConnection, onDisplayHint, onDragEvent, onDraw, onDrawScrollBars, onFilterTouchEventForSecurity, onFinishInflate, onFinishTemporaryDetach, onGenericMotionEvent, onHoverChanged, onHoverEvent, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onOverScrolled, onPopulateAccessibilityEvent, onRtlPropertiesChanged, 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, requestFocusFromTouch, requestRectangleOnScreen, requestRectangleOnScreen, resolveSize, resolveSizeAndState, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setAccessibilityLiveRegion, setActivated, setAlpha, setAnimation, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBottom, setCameraDistance, setClickable, setClipBounds, setContentDescription, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHovered, setId, setImportantForAccessibility, setKeepScreenOn, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPressed, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollContainer, setScrollX, setScrollY, setSelected, setSoundEffectsEnabled, setSystemUiVisibility, setTag, setTag, setTextAlignment, setTextDirection, setTop, setTouchDelegate, setTranslationX, setTranslationY, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, startActionMode, startAnimation, startDrag, toString, unscheduleDrawable, unscheduleDrawable, willNotCacheDrawing, willNotDraw
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface android.view.ViewParent
canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, createContextMenu, getLayoutDirection, getParent, getParentForAccessibility, getTextAlignment, getTextDirection, isLayoutDirectionResolved, isLayoutRequested, isTextAlignmentResolved, isTextDirectionResolved, requestFitSystemWindows
 

Field Detail

mListPadding

protected final Rect mListPadding
Constructor Detail

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.
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.

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 coordinate
y - 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.


getChildDrawingOrder

protected int getChildDrawingOrder(int childCount,
                                   int i)
Overrides:
getChildDrawingOrder in class ViewGroup


Copyright © 2001 - 2014 Sileria, Inc.
Licensed under the Apache License, Ver 2.0