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.GalleryFlowZoom
Known Direct Subclasses

Class Overview

A GalleryFlow widget with a linear flow where you can have a zoom effect. To have the zoom effect you have to set the dux_cameraZ to a value greater than 0.

Summary

XML Attributes
Attribute Name Related Method Description
dux_cameraZ Specifies the maximum distance in the z-axis of the Camera, from the screen to the 'farthest' view, in a GalleryFlow widget. 
dux_effectDistanceFactor setEffectDistanceFactor(float) Specifies the factor to calculate the various effects of the view depending on the distance of the view to the center of the gallery. 
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_maxRotationAngle setMaxRotationAngle(int) Specifies the maximum rotation angle of a view in a GalleryFlow widget. 
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_rotationAxisMode setRotationAxisMode(int) Specifies the axis used to calculate the Y-rotation of a view in a GalleryFlow widget. 
[Expand]
Inherited Constants
From class android.widget.AdapterView
From class android.view.ViewGroup
From class android.view.View
Fields
public static final int ROTATION_AXIS_MODE_CENTER
public static final int ROTATION_AXIS_MODE_EDGE
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
GalleryFlowZoom(Context context)
GalleryFlowZoom(Context context, AttributeSet attrs)
GalleryFlowZoom(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.
float getEffectDistanceFactor()
Gets the factor to calculate the various effects of the view depending on the distance of the view to the center of the gallery.
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.
int getMaxRotationAngle()
Gets the maximum rotation angle.
float getReflectionHeightFactor()
Gets the factor to calculate the reflection height.
float getReflectionStrength()
Gets the strength of the reflection in a reflected view.
int getRotationAxisMode()
Gets the axis to calculate the Y rotation of the view.
View getSelectedWrappedView()
Gets the currently selected actual view given by the adapter's getView().
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 setEffectDistanceFactor(float factor)
Sets the factor to calculate the various effects of the view depending on the distance of the view to the center of the gallery.
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 setMaxRotationAngle(int maxRotationAngle)
Sets the maximum rotation angle.
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 setRotationAxisMode(int rotationAxisMode)
Sets the axis to calculate the Y rotation of the view.
void setScrollingEnabled(boolean enabled)
Sets whether to enable/disable scrolling of the gallery.
Protected Methods
int calcFactorSign(float factorMultiplier)
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 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_cameraZ

Since: API Level

Specifies the maximum distance in the z-axis of the Camera, from the screen to the 'farthest' view, in a GalleryFlow widget.

The selected (center-locked) view is the frontmost view, with z coordinate of 0f. The further the view from the center, the greater the z coordinate. The maximum z distance will be reached when the absolute x-axis distance of the view from the center of the gallery reached a certain distance as specified by the dux_effectDistanceFactor attribute.

Related Methods

dux_effectDistanceFactor

Since: API Level

Specifies the factor to calculate the various effects of the view depending on the distance of the view to the center of the gallery. This factor will be use to determine the distance of a view from the center of the gallery, where all effects should reach the maximum values. The value of this attribute signifies a ratio between the distance of the view to the center of the gallery, and the distance of the center of the gallery to the outermost x coordinate.

The selected (center-locked) view is the frontmost view, where all distance-related effects will have the minimum value/strength. The further the view from the center, the greater the strength of the effect will be, like the rotation angle, opacity/alpha, scale, zoom, etc. The maximum effect will be reached when the absolute x-axis distance of the view from the center of the gallery reached a certain distance as calculated using the value of this attribute.

Example: In a gallery with a horizontal (x-axis) width of 320 px, and the dux_effectDistanceFactor set to 0.5, a view will have a maximum effect at a distance of 0.5 x (320/2), which is 80px from the center of the gallery. So, a view which have an x-coordinate less than (160-80) and more than (160+80) will have a maximum effect.

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_maxRotationAngle

Since: API Level

Specifies the maximum rotation angle of a view in a GalleryFlow widget. This angle will be reached when the distance of the view to the center of the gallery reached a certain value as calculated using the value of dux_effectDistanceFactor attribute.

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_rotationAxisMode

Since: API Level

Specifies the axis used to calculate the Y-rotation of a view in a GalleryFlow widget.

Must be one of the following constant values.

ConstantValueDescription
center0 The axis of rotation will be the center of the view.
edge1 The axis of rotation will be the edge of the view, farthest from the center of the gallery.

Related Methods

Fields

public static final int ROTATION_AXIS_MODE_CENTER

Since: API Level

public static final int ROTATION_AXIS_MODE_EDGE

Since: API Level

Public Constructors

public GalleryFlowZoom (Context context)

Since: API Level 2.5

public GalleryFlowZoom (Context context, AttributeSet attrs)

Since: API Level 2.5

public GalleryFlowZoom (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 float getEffectDistanceFactor ()

Since: API Level

Gets the factor to calculate the various effects of the view depending on the distance of the view to the center of the gallery. See the dux_effectDistanceFactor attribute for more information.

Related XML Attributes
Returns
  • The ratio between the distance of the view to the center of the gallery, and the distance of the center of the gallery to the outermost x coordinate.

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 int getMaxRotationAngle ()

Since: API Level

Gets the maximum rotation angle.

Related XML Attributes
Returns
  • The maximum rotation angle

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 int getRotationAxisMode ()

Since: API Level

Gets the axis to calculate the Y rotation of the view.

Related XML Attributes
Returns

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 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 setEffectDistanceFactor (float factor)

Since: API Level

Sets the factor to calculate the various effects of the view depending on the distance of the view to the center of the gallery. See the dux_effectDistanceFactor attribute for more information.

Related XML Attributes
Parameters
factor The ratio between the distance of the view to the center of the gallery, and the distance of the center of the gallery to the outermost x coordinate.

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 setMaxRotationAngle (int maxRotationAngle)

Since: API Level

Sets the maximum rotation angle.

Related XML Attributes
Parameters
maxRotationAngle The maximum rotation angle

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 setRotationAxisMode (int rotationAxisMode)

Since: API Level

Sets the axis to calculate the Y rotation of the view.

Related XML Attributes
Parameters
rotationAxisMode ROTATION_AXIS_MODE_CENTER to rotate the view with the axis at the center, ROTATION_AXIS_MODE_EDGE to rotate the view with the axis at the edge of the view.

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.

Protected Methods

protected int calcFactorSign (float factorMultiplier)

Since: API Level

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