public final class

StickyTabs

extends Object
java.lang.Object
   ↳ com.android.contacts.StickyTabs

Class Overview

Utility class to annotate Intents with extra data required for the Sticky-Tab behavior, which allows storing the app to go to the last tab that was used to make a call. Also handles saving and restoring the tab index

Summary

Constants
String PREFERENCES_NAME Name of the shared setting.
Public Constructors
StickyTabs()
Public Methods
static int getTab(Intent intent)
Returns the selected tab or -1 if no tab is stored
static int loadTab(Context context, int defaultValue)
Returns the previously persisted tab or defaultValue if nothing is saved
static void saveTab(Context context, Intent intent)
Persists the tab as it is stored in the Intent.
static void saveTab(Context context, int tabIndex)
Persists the given tabIndex.
static Intent setTab(Intent intent, int tabIndex)
Writes the selected tab to the passed intent
static Intent setTab(Intent intent, Intent originalIntent)
Writes the selected tab to the passed intent by retrieving it from the originalIntent that was passed in
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String PREFERENCES_NAME

Name of the shared setting. We are using the same name as in FroYo to prevent having an orphan here

Constant Value: "dialtacts"

Public Constructors

public StickyTabs ()

Public Methods

public static int getTab (Intent intent)

Returns the selected tab or -1 if no tab is stored

public static int loadTab (Context context, int defaultValue)

Returns the previously persisted tab or defaultValue if nothing is saved

public static void saveTab (Context context, Intent intent)

Persists the tab as it is stored in the Intent. If the intent does not have a tab index, the persisted value is not overriden

public static void saveTab (Context context, int tabIndex)

Persists the given tabIndex. If the value is -1, the previously persisted value is not overriden

public static Intent setTab (Intent intent, int tabIndex)

Writes the selected tab to the passed intent

Parameters
intent The intent to modify.
tabIndex The tab index to write to the intent
Returns
  • Returns the modified intent. Notice that this is not a new instance (the passed-in intent is modified)

public static Intent setTab (Intent intent, Intent originalIntent)

Writes the selected tab to the passed intent by retrieving it from the originalIntent that was passed in

Parameters
intent The intent to modify.
originalIntent The intent where the tab index should be read from
Returns
  • Returns the modified intent. Notice that this is not a new instance (the passed-in intent is modified)