java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.RelativeLayout
         ↳ com.android.contacts.ScrollingTabWidget

Summary

Nested Classes
interface ScrollingTabWidget.OnTabSelectionChangedListener  
[Expand]
Inherited Constants
From class android.widget.RelativeLayout
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
ScrollingTabWidget(Context context)
ScrollingTabWidget(Context context, AttributeSet attrs)
ScrollingTabWidget(Context context, AttributeSet attrs, int defStyle)
Public Methods
void addTab(View child)
Adds a tab to the list of tabs.
void addTab(int layoutResId)
Adds a tab to the list of tabs.
void dispatchDraw(Canvas canvas)
void focusCurrentTab(int index)
Sets the current tab and focuses the UI on it.
View getChildTabViewAt(int index)
Returns the tab indicator view at the given index.
int getCurrentTab()
Return index of the currently selected tab.
int getTabCount()
Returns the number of tab indicator views.
ViewGroup getTabParent()
Returns the ViewGroup that actually contains the tabs.
boolean isTab(View v)
void onClick(View v)
void onFocusChange(View v, boolean hasFocus)
void onGlobalFocusChanged(View oldFocus, View newFocus)
void removeAllTabs()
void setCurrentTab(int index)
Sets the current tab.
void setTabSelectionListener(ScrollingTabWidget.OnTabSelectionChangedListener listener)
Provides a way for ViewContactActivity and EditContactActivity to be notified that the user clicked on a tab indicator.
Protected Methods
void onAttachedToWindow()
void onDetachedFromWindow()
void onLoseFocus()
Called when the focus has left the ScrollingTabWidget or its descendants.
void onObtainFocus()
Called when the ScrollingTabWidget gets focus.
void tabScroll(boolean directionRight)
Scrolls the tabs by exactly one tab width.
void updateArrowVisibility()
void updateLeftMostVisible()
[Expand]
Inherited Methods
From class android.widget.RelativeLayout
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.KeyEvent.Callback
From interface android.view.View.OnClickListener
From interface android.view.View.OnFocusChangeListener
From interface android.view.ViewManager
From interface android.view.ViewParent
From interface android.view.ViewTreeObserver.OnGlobalFocusChangeListener
From interface android.view.accessibility.AccessibilityEventSource

Public Constructors

public ScrollingTabWidget (Context context)

public ScrollingTabWidget (Context context, AttributeSet attrs)

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

Public Methods

public void addTab (View child)

Adds a tab to the list of tabs. The tab's indicator view must be provided.

public void addTab (int layoutResId)

Adds a tab to the list of tabs. The tab's indicator view is specified by a layout id. InflateException will be thrown if there is a problem inflating.

Parameters
layoutResId The layout id to be inflated to make the tab indicator.

public void dispatchDraw (Canvas canvas)

public void focusCurrentTab (int index)

Sets the current tab and focuses the UI on it. This method makes sure that the focused tab matches the selected tab, normally at setCurrentTab(int). Normally this would not be an issue if we go through the UI, since the UI is responsible for calling TabWidget.onFocusChanged(), but in the case where we are selecting the tab programmatically, we'll need to make sure focus keeps up.

Parameters
index The tab that you want focused (highlighted in orange) and selected (tab brought to the front of the widget)

public View getChildTabViewAt (int index)

Returns the tab indicator view at the given index.

Parameters
index the zero-based index of the tab indicator view to return
Returns
  • the tab indicator view at the given index

public int getCurrentTab ()

Return index of the currently selected tab.

public int getTabCount ()

Returns the number of tab indicator views.

Returns
  • the number of tab indicator views.

public ViewGroup getTabParent ()

Returns the ViewGroup that actually contains the tabs. This is where the tab views should be attached to when being inflated.

public boolean isTab (View v)

public void onClick (View v)

public void onFocusChange (View v, boolean hasFocus)

public void onGlobalFocusChanged (View oldFocus, View newFocus)

public void removeAllTabs ()

public void setCurrentTab (int index)

Sets the current tab. This method is used to bring a tab to the front of the Widget, and is used to post to the rest of the UI that a different tab has been brought to the foreground. Note, this is separate from the traditional "focus" that is employed from the view logic. For instance, if we have a list in a tabbed view, a user may be navigating up and down the list, moving the UI focus (orange highlighting) through the list items. The cursor movement does not effect the "selected" tab though, because what is being scrolled through is all on the same tab. The selected tab only changes when we navigate between tabs (moving from the list view to the next tabbed view, in this example). To move both the focus AND the selected tab at once, please use focusCurrentTab(int). Normally, the view logic takes care of adjusting the focus, so unless you're circumventing the UI, you'll probably just focus your interest here.

Parameters
index The tab that you want to indicate as the selected tab (tab brought to the front of the widget)

public void setTabSelectionListener (ScrollingTabWidget.OnTabSelectionChangedListener listener)

Provides a way for ViewContactActivity and EditContactActivity to be notified that the user clicked on a tab indicator.

Protected Methods

protected void onAttachedToWindow ()

protected void onDetachedFromWindow ()

protected void onLoseFocus ()

Called when the focus has left the ScrollingTabWidget or its descendants. At this time we want the children of this view to be marked as un-focusable, so that next time focus is moved to the widget, the widget gets control, and can assign focus where it wants.

protected void onObtainFocus ()

Called when the ScrollingTabWidget gets focus. Here the widget decides which of it's tabs should have focus.

protected void tabScroll (boolean directionRight)

Scrolls the tabs by exactly one tab width.

Parameters
directionRight if true, scroll to the right, if false, scroll to the left.

protected void updateArrowVisibility ()

protected void updateLeftMostVisible ()