Most visited

Recently visited

SearchOrbView

public class SearchOrbView
extends FrameLayout implements View.OnClickListener

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.FrameLayout
         ↳ android.support.v17.leanback.widget.SearchOrbView
Known Direct Subclasses


A widget that draws a search affordance, represented by a round background and an icon.

The background color and icon can be customized.

Summary

Nested classes

class SearchOrbView.Colors

A set of colors used to display the search orb. 

Inherited XML attributes

From class android.widget.FrameLayout
From class android.view.ViewGroup
From class android.view.View

Inherited constants

From class android.view.ViewGroup
From class android.view.View

Inherited fields

From class android.view.View

Public constructors

SearchOrbView(Context context)
SearchOrbView(Context context, AttributeSet attrs)
SearchOrbView(Context context, AttributeSet attrs, int defStyleAttr)

Public methods

void enableOrbColorAnimation(boolean enable)

Enables or disables the orb color animation.

int getOrbColor()

Returns the orb color

SearchOrbView.Colors getOrbColors()

Returns the SearchOrbView.Colors used to display the search orb.

Drawable getOrbIcon()

Returns the orb icon

void onClick(View view)

Called when a view has been clicked.

void setOnOrbClickedListener(View.OnClickListener listener)

Sets the on click listener for the orb.

void setOrbColor(int color)

Sets the background color of the search orb.

void setOrbColor(int color, int brightColor)

This method is deprecated. Use setOrbColors(Colors) instead.

void setOrbColors(SearchOrbView.Colors colors)

Sets the SearchOrbView.Colors used to display the search orb.

void setOrbIcon(Drawable icon)

Sets the orb icon.

Protected methods

void onAttachedToWindow()

This is called when the view is attached to a window.

void onDetachedFromWindow()

This is called when the view is detached from a window.

void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect)

Called by the view system when the focus state of this view changes.

Inherited methods

From class android.widget.FrameLayout
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.view.ViewParent
From interface android.view.ViewManager
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.accessibility.AccessibilityEventSource
From interface android.view.View.OnClickListener

Public constructors

SearchOrbView

SearchOrbView (Context context)

Parameters
context Context

SearchOrbView

SearchOrbView (Context context, 
                AttributeSet attrs)

Parameters
context Context
attrs AttributeSet

SearchOrbView

SearchOrbView (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)

Parameters
context Context
attrs AttributeSet
defStyleAttr int

Public methods

enableOrbColorAnimation

void enableOrbColorAnimation (boolean enable)

Enables or disables the orb color animation.

Orb color animation is handled automatically when the orb is focused/unfocused, however, an app may choose to override the current animation state, for example when an activity is paused.

Parameters
enable boolean

getOrbColor

int getOrbColor ()

Returns the orb color

Returns
int the RGBA color

getOrbColors

SearchOrbView.Colors getOrbColors ()

Returns the SearchOrbView.Colors used to display the search orb.

Returns
SearchOrbView.Colors

getOrbIcon

Drawable getOrbIcon ()

Returns the orb icon

Returns
Drawable the drawable used as the icon

onClick

void onClick (View view)

Called when a view has been clicked.

Parameters
view View: The view that was clicked.

setOnOrbClickedListener

void setOnOrbClickedListener (View.OnClickListener listener)

Sets the on click listener for the orb.

Parameters
listener View.OnClickListener: The listener.

setOrbColor

void setOrbColor (int color)

Sets the background color of the search orb. Other colors will be provided by the framework.

Parameters
color int: the RGBA color

setOrbColor

void setOrbColor (int color, 
                int brightColor)

This method is deprecated.
Use setOrbColors(Colors) instead.

Sets the search orb colors. Other colors are provided by the framework.

Parameters
color int
brightColor int

setOrbColors

void setOrbColors (SearchOrbView.Colors colors)

Sets the SearchOrbView.Colors used to display the search orb.

Parameters
colors SearchOrbView.Colors

setOrbIcon

void setOrbIcon (Drawable icon)

Sets the orb icon.

Parameters
icon Drawable: the drawable to be used as the icon

Protected methods

onAttachedToWindow

void onAttachedToWindow ()

This is called when the view is attached to a window. At this point it has a Surface and will start drawing. Note that this function is guaranteed to be called before onDraw(android.graphics.Canvas), however it may be called any time before the first onDraw -- including before or after onMeasure(int, int).

onDetachedFromWindow

void onDetachedFromWindow ()

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

onFocusChanged

void onFocusChanged (boolean gainFocus, 
                int direction, 
                Rect previouslyFocusedRect)

Called by the view system when the focus state of this view changes. When the focus change event is caused by directional navigation, direction and previouslyFocusedRect provide insight into where the focus is coming from. When overriding, be sure to call up through to the super class so that the standard focus handling will occur.

Parameters
gainFocus boolean: True if the View has focus; false otherwise.
direction int: The direction focus has moved when requestFocus() is called to give this view focus. Values are FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_FORWARD, or FOCUS_BACKWARD. It may not always apply, in which case use the default.
previouslyFocusedRect Rect: The rectangle, in this view's coordinate system, of the previously focused view. If applicable, this will be passed in as finer grained information about where the focus is coming from (in addition to direction). Will be null otherwise.

Hooray!