Since: API Level 2.5
public static interface

ActionDrawer.OnDrawingListener

com.droidux.pack.action.widget.ActionDrawer.OnDrawingListener

Class Overview

A listener to be notified when the drawer, content and arrow are being drawn. By implementing this listener you can modify the canvas and add various effects to the drawer. The callback methods are called in the dispatchDraw(android.graphics.Canvas) of the containers, between a call to save() and restore(). If you return true from the callback, the container will be drawn before the canvas is restored. Otherwise, if you return false, the canvas will be restored first (thus cancelling any transform to the canvas during the callback) before the container is drawn.

Summary

Public Methods
abstract boolean onArrowDrawing(Canvas canvas, float openRatio, Rect arrowRect, Paint paint)
This callback is called before the arrow (if shown) is drawn.
abstract boolean onContentDrawing(Canvas canvas, float openRatio)
This callback is called when the content container is being drawn.
abstract boolean onDrawerDrawing(Canvas canvas, float openRatio)
This callback is called when the drawer container is being drawn.

Public Methods

public abstract boolean onArrowDrawing (Canvas canvas, float openRatio, Rect arrowRect, Paint paint)

Since: API Level 2.5

This callback is called before the arrow (if shown) is drawn. Here you can implement some effect, for example to hide the arrow when it passed certain area.

Parameters
canvas The canvas used to draw the arrow.
openRatio How far the drawer has been opened. Value will be between 0f - 1f.
arrowRect The rect of the arrow bitmap. You can use this information to know the location of the arrow.
paint The paint used to draw the arrow.
Returns
  • If true, any transformation to the canvas and/or paint will be applied to the drawing of the arrow. Otherwise, it will be ignored (the canvas will be restored before the drawing, and the paint will not be used for drawing).

public abstract boolean onContentDrawing (Canvas canvas, float openRatio)

Since: API Level 2.5

This callback is called when the content container is being drawn. Here you can transform your canvas to add some effect/animation to the content view during the opening/closing of the drawer.

Parameters
canvas The canvas used to draw the content container.
openRatio How far the drawer has been opened. Value will be between 0f - 1f.
Returns
  • If true, the content will be drawn before the canvas is restored, which means that any transformation applied to the canvas will have effects to the drawing of the content. Otherwise, The canvas is restored before the drawer is drawn, effectively cancelling any transform during the callback.

public abstract boolean onDrawerDrawing (Canvas canvas, float openRatio)

Since: API Level 2.5

This callback is called when the drawer container is being drawn. Here you can transform your canvas to add some effect/animation during the opening/closing of the drawer.

Parameters
canvas The canvas used to draw the drawer.
openRatio How far the drawer has been opened. Value will be between 0f - 1f.
Returns
  • If true, the drawer will be drawn before the canvas is restored, which means that any transformation applied to the canvas will have effects to the drawing of the drawer. Otherwise, The canvas is restored before the drawer is drawn, effectively cancelling any transform during the callback.