added in version 1.0.0
belongs to Maven artifact androidx.leanback:leanback:1.0.0-beta01

SearchOrbView

public class SearchOrbView
extends FrameLayout implements View.OnClickListener

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.FrameLayout
         ↳ androidx.leanback.widget.SearchOrbView


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 constants

Inherited fields

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)
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 was deprecated in API level 1.0.0. 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()
void onDetachedFromWindow()
void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect)

Inherited methods

Public constructors

SearchOrbView

added in version 1.0.0
public SearchOrbView (Context context)

Parameters
context Context

SearchOrbView

added in version 1.0.0
public SearchOrbView (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

SearchOrbView

added in version 1.0.0
public SearchOrbView (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

Public methods

enableOrbColorAnimation

added in version 1.0.0
public 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

added in version 1.0.0
public int getOrbColor ()

Returns the orb color

Returns
int the RGBA color

getOrbColors

added in version 1.0.0
public SearchOrbView.Colors getOrbColors ()

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

Returns
SearchOrbView.Colors

getOrbIcon

added in version 1.0.0
public Drawable getOrbIcon ()

Returns the orb icon

Returns
Drawable the drawable used as the icon

onClick

added in version 1.0.0
public void onClick (View view)

Parameters
view View

setOnOrbClickedListener

added in version 1.0.0
public void setOnOrbClickedListener (View.OnClickListener listener)

Sets the on click listener for the orb.

Parameters
listener View.OnClickListener: The listener.

setOrbColor

added in version 1.0.0
public 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

added in version 1.0.0
public void setOrbColor (int color, 
                int brightColor)

This method was deprecated in API level 1.0.0.
Use setOrbColors(Colors) instead.

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

Parameters
color int

brightColor int

setOrbColors

added in version 1.0.0
public void setOrbColors (SearchOrbView.Colors colors)

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

Parameters
colors SearchOrbView.Colors

setOrbIcon

added in version 1.0.0
public void setOrbIcon (Drawable icon)

Sets the orb icon.

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

Protected methods

onAttachedToWindow

protected void onAttachedToWindow ()

onDetachedFromWindow

protected void onDetachedFromWindow ()

onFocusChanged

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

Parameters
gainFocus boolean

direction int

previouslyFocusedRect Rect