public class

GalleryFlowCarousel

extends Gallery
implements AbsListView.RecyclerListener GalleryFlowInterfaces.GalleryFlowViewInterface
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.AdapterView<T extends android.widget.Adapter>
         ↳ android.widget.AbsSpinner
           ↳ android.widget.Gallery
             ↳ com.droidux.pack.gallery.widget.GalleryFlowCarousel
Known Direct Subclasses

Class Overview

A GalleryFlow widget that flows in a circular/radial path (like a carousel).

You can set whether the flow view point should be inside (like looking at the carousel from the inside), or outside (like looking at the carousel from the outside), by setting the dux_viewPoint attribute (default is inside), or calling the setViewPoint(int) method.

Summary

XML Attributes
Attribute Name Related Method Description
dux_edgeAngle setEdgeAngle(int) Specifies the rotation angle (in degrees) of outermost/edge view in a GalleryFlow with a radial flow/path, such as the com.droidux.widget.gallery.GalleryFlowCarousel and com.droidux.widget.gallery.GalleryFlowWall. 
dux_effectStrength setEffectStrength(float) Specifies the strength of the effect to be apply to the view (see the dux_effectType attribute). 
dux_effectType setEffectType(int) Specifies the effect to be applied to the view. 
dux_floorGap setFloorGap(int) Specifies the distance from the bottom of the reflected view to the "floor". 
dux_reflected setReflected(boolean) Controls whether the view should be reflected. 
dux_reflectionHeight setReflectionHeightFactor(float) Specifies the factor to determine the reflection height. 
dux_reflectionStrength setReflectionStrength(float) Specifies the strength of the reflection. 
dux_viewPoint setViewPoint(int) Specifies the view point when looking at the GalleryFlow widget with a radial flow/path, such as the com.droidux.widget.gallery.GalleryFlowCarousel and com.droidux.widget.gallery.GalleryFlowWall. 
[Expand]
Inherited Constants
From class android.widget.AdapterView
From class android.view.ViewGroup
From class android.view.View
Fields
public static final int VIEW_POINT_INSIDE View the gallery from the inside.
public static final int VIEW_POINT_OUTSIDE View the gallery from the outside.
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
GalleryFlowCarousel(Context context)
GalleryFlowCarousel(Context context, AttributeSet attrs)
GalleryFlowCarousel(Context context, AttributeSet attrs, int defStyle)
Public Methods
SpinnerAdapter getAdapter()
Returns the adapter currently associated with this widget.
View getChildAt(int index)
Returns the view at the specified position in the group.
int getEdgeAngle()
Gets the rotation angle of the outermost/edge view.
float getEffectStrength()
Gets the strength of the effect to be applied to the view returned by the adapter.
int getEffectType()
Gets the type of the effect to be applied to the view returned by the adapter.
int getFloorGap()
Gets the distance between the bottom of the view to the 'floor' in a reflected view.
GalleryUrlImageCache getImageCache()
Gets the cache used to store the web images locally.
float getReflectionHeightFactor()
Gets the factor to calculate the reflection height.
float getReflectionStrength()
Gets the strength of the reflection in a reflected view.
View getSelectedWrappedView()
Gets the currently selected actual view given by the adapter's getView().
int getViewPoint()
Gets the view point when looking at the GalleryFlow widget with a radial flow/path.
boolean isReflected()
Returns whether the view is reflected.
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.
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 setAdapter(SpinnerAdapter adapter)
The Adapter is used to provide the data which backs this Spinner.
void setEdgeAngle(int edgeAngle)
Sets the rotation angle of the outermost/edge view.
void setEffectStrength(float effectStrength)
Sets the strength of the effect to be applied to the view returned by the adapter.
void setEffectType(int effectType)
Sets the type of the effect to be applied to the view returned by the adapter.
void setFloorGap(int floorGap)
Sets the distance between the bottom of the view to the 'floor' in a reflected view.
void setImageCache(GalleryUrlImageCache cache)
Sets the cache used to store the web images locally.
void setMaxFlingVelocity(float maxFlingVelocity)
Limits the fling velocity to the specified value.
void setOnItemClickListener(AdapterView.OnItemClickListener listener)
Register a callback to be invoked when an item in this AdapterView has been clicked.
void setOnItemLongClickListener(AdapterView.OnItemLongClickListener listener)
Register a callback to be invoked when an item in this AdapterView has been clicked and held
void setOnItemSelectedListener(AdapterView.OnItemSelectedListener listener)
Register a callback to be invoked when an item in this AdapterView has been selected.
void setReflected(boolean reflected)
Sets whether the view should be reflected.
void setReflectionHeightFactor(float factor)
Sets the factor to calculate the reflection height.
void setReflectionStrength(float strength)
Sets the strength of the reflection in a reflected view.
void setScrollingEnabled(boolean enabled)
Sets whether to enable/disable scrolling of the gallery.
void setViewPoint(int viewPoint)
Sets the view point when looking at the GalleryFlow widget with a radial flow/path.
Protected Methods
void detachViewFromParent(View child)
Detaches a view from its parent.
void detachViewsFromParent(int start, int count)
Detaches a range of views from their parents.
void dispatchDraw(Canvas canvas)
Called by draw to draw the child views.
int getChildDrawingOrder(int childCount, int i)
Returns the index of the child to draw for this iteration.
boolean getChildStaticTransformation(View child, Transformation t)
Sets t to be the static transformation of the child, if set, returning a boolean to indicate whether a static transform was set.
void initAttributes(Context context, AttributeSet attrs, int defStyle)
void onDetachedFromWindow()
This is called when the view is detached from a window.
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 onSizeChanged(int w, int h, int oldw, int oldh)
This is called during layout when the size of this view has changed.
void removeDetachedView(View child, boolean animate)
Finishes the removal of a detached view.
abstract void transformViewBitmap(ReflectionLayout child, Transformation t)
[Expand]
Inherited Methods
From class android.widget.Gallery
From class android.widget.AbsSpinner
From class android.widget.AdapterView
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.GestureDetector.OnGestureListener
From interface android.view.KeyEvent.Callback
From interface android.view.ViewManager
From interface android.view.ViewParent
From interface android.view.accessibility.AccessibilityEventSource
From interface android.widget.AbsListView.RecyclerListener
From interface com.droidux.pack.gallery.interfaces.GalleryFlowInterfaces.GalleryFlowViewInterface

XML Attributes

dux_edgeAngle

Since: API Level

Specifies the rotation angle (in degrees) of outermost/edge view in a GalleryFlow with a radial flow/path, such as the com.droidux.widget.gallery.GalleryFlowCarousel and com.droidux.widget.gallery.GalleryFlowWall. This angle will determine the curvature of the flow.

Range: 0-60

Related Methods

dux_effectStrength

Since: API Level

Specifies the strength of the effect to be apply to the view (see the dux_effectType attribute). Should be between 0.0 - 1.0 inclusive.

Related Methods

dux_effectType

Since: API Level

Specifies the effect to be applied to the view.

Must be one of the following constant values.

ConstantValueDescription
none0 Don't apply any effect.
dim1 Apply a dim effect. The dim effect will make the view appears darker.
fade2 Apply a fade effect. The fade effect will change the opacity/alpha of the view.

Related Methods

dux_floorGap

Since: API Level

Specifies the distance from the bottom of the reflected view to the "floor". Its value should be a dimension (such as "5dip").

Must be a dimension value, which is a floating point number appended with a unit such as "2.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters).

Related Methods

dux_reflected

Since: API Level

Controls whether the view should be reflected.

Must be a boolean value, either "true" or "false".

This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.

Related Methods

dux_reflectionHeight

Since: API Level

Specifies the factor to determine the reflection height. The reflection height will be the specified factor multiplied by the view's getHeight(). Should be between 0.0 - 1.0 inclusive.

dux_reflectionStrength

Since: API Level

Specifies the strength of the reflection. This value is a factor that determines the opacity/alpha of the reflection. Should be between 0.0 - 1.0 inclusive.

dux_viewPoint

Since: API Level

Specifies the view point when looking at the GalleryFlow widget with a radial flow/path, such as the com.droidux.widget.gallery.GalleryFlowCarousel and com.droidux.widget.gallery.GalleryFlowWall.

Must be one of the following constant values.

ConstantValueDescription
inside0 Looking at the GalleryFlow from inside.
outside1 Looking at the GalleryFlow from outside.

Related Methods

Fields

public static final int VIEW_POINT_INSIDE

Since: API Level 2.5

View the gallery from the inside.

public static final int VIEW_POINT_OUTSIDE

Since: API Level 2.5

View the gallery from the outside.

Public Constructors

public GalleryFlowCarousel (Context context)

Since: API Level 2.5

public GalleryFlowCarousel (Context context, AttributeSet attrs)

Since: API Level 2.5

public GalleryFlowCarousel (Context context, AttributeSet attrs, int defStyle)

Since: API Level 2.5

Public Methods

public SpinnerAdapter getAdapter ()

Since: API Level

Returns the adapter currently associated with this widget.

Returns
  • The adapter used to provide this view's content.

public View getChildAt (int index)

Since: API Level

Returns the view at the specified position in the group.

Parameters
index the position at which to get the view from
Returns
  • the view at the specified position or null if the position does not exist within the group

public int getEdgeAngle ()

Since: API Level 2.5

Gets the rotation angle of the outermost/edge view. This angle determine the curvature of the flow.

Related XML Attributes
Returns
  • The angle of the outermost/edge view.

public float getEffectStrength ()

Since: API Level

Gets the strength of the effect to be applied to the view returned by the adapter.

Related XML Attributes
Returns
  • The effect strength

public int getEffectType ()

Since: API Level

Gets the type of the effect to be applied to the view returned by the adapter.

Related XML Attributes
Returns
  • effectType The type of the effect.

public int getFloorGap ()

Since: API Level

Gets the distance between the bottom of the view to the 'floor' in a reflected view.

Related XML Attributes
Returns
  • The floor gap.

public GalleryUrlImageCache getImageCache ()

Since: API Level

Gets the cache used to store the web images locally.

Returns
  • The cache.

public float getReflectionHeightFactor ()

Since: API Level

Gets the factor to calculate the reflection height. The reflection height is the factor multiply by the view's height.

Related XML Attributes
Returns
  • The reflection height factor.

public float getReflectionStrength ()

Since: API Level

Gets the strength of the reflection in a reflected view.

Related XML Attributes
Returns
  • The reflection strength

public View getSelectedWrappedView ()

Since: API Level

Gets the currently selected actual view given by the adapter's getView(). Note: The GalleryFlow widgets uses internal GalleryFlowInterfaces.WrapperViewInterface view to wrap the actual view given by the client's adapter to add certain attributes and effects. The getSelectedView() will return the GalleryFlowInterfaces.WrapperViewInterface. If you need the to get the actual view, instead of the wrapper, use this function instead of the getSelectedView()

Returns
  • The currently selected actual view given by the client's adapter.

public int getViewPoint ()

Since: API Level 2.5

Gets the view point when looking at the GalleryFlow widget with a radial flow/path.

Related XML Attributes
Returns

public boolean isReflected ()

Since: API Level

Returns whether the view is reflected.

Related XML Attributes
Returns
  • whether the view is reflected.

public boolean onDown (MotionEvent e)

Since: API Level

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.

Parameters
e The down motion event.

public boolean onFling (MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)

Since: API Level

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.

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

public boolean onScroll (MotionEvent e1, MotionEvent e2, float distanceX, float distanceY)

Since: API Level

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.

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

public void setAdapter (SpinnerAdapter adapter)

Since: API Level

The Adapter is used to provide the data which backs this Spinner. It also provides methods to transform spinner items based on their position relative to the selected item.

Parameters
adapter The SpinnerAdapter to use for this Spinner

public void setEdgeAngle (int edgeAngle)

Since: API Level 2.5

Sets the rotation angle of the outermost/edge view. This angle determine the curvature of the flow.

Related XML Attributes
Parameters
edgeAngle The angle of the outermost/edge view.

public void setEffectStrength (float effectStrength)

Since: API Level

Sets the strength of the effect to be applied to the view returned by the adapter.

Related XML Attributes
Parameters
effectStrength The effect strength; 0f-1f inclusive.

public void setEffectType (int effectType)

Since: API Level

Sets the type of the effect to be applied to the view returned by the adapter.

Related XML Attributes
Parameters
effectType The type of the effect.

public void setFloorGap (int floorGap)

Since: API Level

Sets the distance between the bottom of the view to the 'floor' in a reflected view.

Related XML Attributes
Parameters
floorGap The distance.

public void setImageCache (GalleryUrlImageCache cache)

Since: API Level

Sets the cache used to store the web images locally.

Returns
  • The cache.

public void setMaxFlingVelocity (float maxFlingVelocity)

Since: API Level

Limits the fling velocity to the specified value.

Parameters
maxFlingVelocity If greater than 0.0, the fling velocity will be limited.

public void setOnItemClickListener (AdapterView.OnItemClickListener listener)

Since: API Level

Register a callback to be invoked when an item in this AdapterView has been clicked.

Parameters
listener The callback that will be invoked.

public void setOnItemLongClickListener (AdapterView.OnItemLongClickListener listener)

Since: API Level

Register a callback to be invoked when an item in this AdapterView has been clicked and held

Parameters
listener The callback that will run

public void setOnItemSelectedListener (AdapterView.OnItemSelectedListener listener)

Since: API Level

Register a callback to be invoked when an item in this AdapterView has been selected.

Parameters
listener The callback that will run

public void setReflected (boolean reflected)

Since: API Level

Sets whether the view should be reflected.

Related XML Attributes

public void setReflectionHeightFactor (float factor)

Since: API Level

Sets the factor to calculate the reflection height. The reflection height is the factor multiply by the view's height.

Related XML Attributes
Parameters
factor The reflection height factor.

public void setReflectionStrength (float strength)

Since: API Level

Sets the strength of the reflection in a reflected view.

Related XML Attributes
Parameters
strength The reflection strength

public void setScrollingEnabled (boolean enabled)

Since: API Level

Sets whether to enable/disable scrolling of the gallery.

Parameters
enabled If true, the gallery can be scrolled as normal. Otherwise, it can't be scrolled.

public void setViewPoint (int viewPoint)

Since: API Level 2.5

Sets the view point when looking at the GalleryFlow widget with a radial flow/path.

Related XML Attributes
Parameters
viewPoint VIEW_POINT_INSIDE to look from the inside of the carousel, or VIEW_POINT_OUTSIDE to look from the outside.

Protected Methods

protected void detachViewFromParent (View child)

Since: API Level

Detaches a view from its parent. Detaching a view should be followed either by a call to attachViewToParent(View, int, android.view.ViewGroup.LayoutParams) or a call to removeDetachedView(View, boolean). Detachment should only be temporary; reattachment or removal should happen within the same drawing cycle as detachment. When a view is detached, its parent is null and cannot be retrieved by a call to getChildAt(int).

Parameters
child the child to detach

protected void detachViewsFromParent (int start, int count)

Since: API Level

Detaches a range of views from their parents. Detaching a view should be followed either by a call to attachViewToParent(View, int, android.view.ViewGroup.LayoutParams) or a call to removeDetachedView(View, boolean). Detachment should only be temporary; reattachment or removal should happen within the same drawing cycle as detachment. When a view is detached, its parent is null and cannot be retrieved by a call to getChildAt(int).

Parameters
start the first index of the childrend range to detach
count the number of children to detach

protected void dispatchDraw (Canvas canvas)

Since: API Level

Called by draw to draw the child views. This may be overridden by derived classes to gain control just before its children are drawn (but after its own view has been drawn).

Parameters
canvas the canvas on which to draw the view

protected int getChildDrawingOrder (int childCount, int i)

Since: API Level

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, you must enable child ordering first by calling setChildrenDrawingOrderEnabled(boolean).

Parameters
i The current iteration.
Returns
  • The index of the child to draw this iteration.

protected boolean getChildStaticTransformation (View child, Transformation t)

Since: API Level

Sets t to be the static transformation of the child, if set, returning a boolean to indicate whether a static transform was set. The default implementation simply returns false; subclasses may override this method for different behavior. setStaticTransformationsEnabled(boolean) must be set to true for this method to be called.

Parameters
child The child view whose static transform is being requested
t The Transformation which will hold the result
Returns
  • true if the transformation was set, false otherwise

protected void initAttributes (Context context, AttributeSet attrs, int defStyle)

Since: API Level

protected void onDetachedFromWindow ()

Since: API Level

This is called when the view is detached from a window. At this point it no longer has a surface for drawing.

protected void onLayout (boolean changed, int l, int t, int r, int b)

Since: API Level

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

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

protected void onSizeChanged (int w, int h, int oldw, int oldh)

Since: API Level

This is called during layout when the size of this view has changed. If you were just added to the view hierarchy, you're called with the old values of 0.

Parameters
w Current width of this view.
h Current height of this view.
oldw Old width of this view.
oldh Old height of this view.

protected void removeDetachedView (View child, boolean animate)

Since: API Level

Finishes the removal of a detached view. This method will dispatch the detached from window event and notify the hierarchy change listener.

This method is intended to be lightweight and makes no assumptions about whether the parent or child should be redrawn. Proper use of this method will include also making any appropriate requestLayout() or invalidate() calls. For example, callers can post a Runnable which performs a requestLayout() on the next frame, after all detach/remove calls are finished, causing layout to be run prior to redrawing the view hierarchy.

Parameters
child the child to be definitely removed from the view hierarchy
animate if true and the view has an animation, the view is placed in the disappearing views list, otherwise, it is detached from the window

protected abstract void transformViewBitmap (ReflectionLayout child, Transformation t)

Since: API Level