Loading api/current.xml +111 −83 Original line number Diff line number Diff line Loading @@ -21707,6 +21707,21 @@ <parameter name="tab" type="android.app.ActionBar.Tab"> </parameter> </method> <method name="addTab" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="tab" type="android.app.ActionBar.Tab"> </parameter> <parameter name="position" type="int"> </parameter> </method> <method name="getCustomNavigationView" return="android.view.View" abstract="true" Loading Loading @@ -21762,8 +21777,8 @@ visibility="public" > </method> <method name="getSubtitle" return="java.lang.CharSequence" <method name="getSelectedTab" return="android.app.ActionBar.Tab" abstract="true" native="false" synchronized="false" Loading @@ -21773,7 +21788,7 @@ visibility="public" > </method> <method name="getTitle" <method name="getSubtitle" return="java.lang.CharSequence" abstract="true" native="false" Loading @@ -21784,8 +21799,8 @@ visibility="public" > </method> <method name="hide" return="void" <method name="getTitle" return="java.lang.CharSequence" abstract="true" native="false" synchronized="false" Loading @@ -21795,7 +21810,7 @@ visibility="public" > </method> <method name="insertTab" <method name="hide" return="void" abstract="true" native="false" Loading @@ -21805,10 +21820,6 @@ deprecated="not deprecated" visibility="public" > <parameter name="tab" type="android.app.ActionBar.Tab"> </parameter> <parameter name="position" type="int"> </parameter> </method> <method name="isShowing" return="boolean" Loading Loading @@ -21980,62 +21991,6 @@ deprecated="not deprecated" visibility="public" > <parameter name="title" type="java.lang.CharSequence"> </parameter> <parameter name="subtitle" type="java.lang.CharSequence"> </parameter> </method> <method name="setStandardNavigationMode" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="titleResId" type="int"> </parameter> <parameter name="subtitleResId" type="int"> </parameter> </method> <method name="setStandardNavigationMode" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="title" type="java.lang.CharSequence"> </parameter> </method> <method name="setStandardNavigationMode" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="titleResId" type="int"> </parameter> </method> <method name="setStandardNavigationMode" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="setSubtitle" return="void" Loading Loading @@ -22074,19 +22029,6 @@ visibility="public" > </method> <method name="setTabNavigationMode" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="containerViewId" type="int"> </parameter> </method> <method name="setTitle" return="void" abstract="true" Loading Loading @@ -22230,8 +22172,8 @@ visibility="public" > </constructor> <method name="getFragment" return="android.app.Fragment" <method name="getCustomView" return="android.view.View" abstract="true" native="false" synchronized="false" Loading Loading @@ -22263,6 +22205,17 @@ visibility="public" > </method> <method name="getTag" return="java.lang.Object" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getText" return="java.lang.CharSequence" abstract="true" Loading @@ -22285,7 +22238,7 @@ visibility="public" > </method> <method name="setFragment" <method name="setCustomView" return="void" abstract="true" native="false" Loading @@ -22295,7 +22248,7 @@ deprecated="not deprecated" visibility="public" > <parameter name="fragment" type="android.app.Fragment"> <parameter name="view" type="android.view.View"> </parameter> </method> <method name="setIcon" Loading @@ -22311,6 +22264,32 @@ <parameter name="icon" type="android.graphics.drawable.Drawable"> </parameter> </method> <method name="setTabListener" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="listener" type="android.app.ActionBar.TabListener"> </parameter> </method> <method name="setTag" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="obj" type="java.lang.Object"> </parameter> </method> <method name="setText" return="void" abstract="true" Loading @@ -22336,6 +22315,44 @@ > </field> </class> <interface name="ActionBar.TabListener" abstract="true" static="true" final="false" deprecated="not deprecated" visibility="public" > <method name="onTabSelected" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="tab" type="android.app.ActionBar.Tab"> </parameter> <parameter name="ft" type="android.app.FragmentTransaction"> </parameter> </method> <method name="onTabUnselected" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="tab" type="android.app.ActionBar.Tab"> </parameter> <parameter name="ft" type="android.app.FragmentTransaction"> </parameter> </method> </interface> <class name="Activity" extends="android.view.ContextThemeWrapper" abstract="false" Loading Loading @@ -29326,6 +29343,17 @@ <parameter name="fragment" type="android.app.Fragment"> </parameter> </method> <method name="isEmpty" return="boolean" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="remove" return="android.app.FragmentTransaction" abstract="true" core/java/android/app/ActionBar.java +62 −86 Original line number Diff line number Diff line Loading @@ -122,72 +122,6 @@ public abstract class ActionBar { */ public abstract int getSelectedNavigationItem(); /** * Set the action bar into standard navigation mode, supplying a title and subtitle. * * Standard navigation mode is default. The title is automatically set to the * name of your Activity. Subtitles are displayed underneath the title, usually * in a smaller font or otherwise less prominently than the title. Subtitles are * good for extended descriptions of activity state. * * @param title The action bar's title. null is treated as an empty string. * @param subtitle The action bar's subtitle. null will remove the subtitle entirely. * * @see #setStandardNavigationMode() * @see #setStandardNavigationMode(CharSequence) * @see #setStandardNavigationMode(int) * @see #setStandardNavigationMode(int, int) */ public abstract void setStandardNavigationMode(CharSequence title, CharSequence subtitle); /** * Set the action bar into standard navigation mode, supplying a title and subtitle. * * Standard navigation mode is default. The title is automatically set to the * name of your Activity. Subtitles are displayed underneath the title, usually * in a smaller font or otherwise less prominently than the title. Subtitles are * good for extended descriptions of activity state. * * @param titleResId Resource ID of a title string * @param subtitleResId Resource ID of a subtitle string * * @see #setStandardNavigationMode() * @see #setStandardNavigationMode(CharSequence) * @see #setStandardNavigationMode(CharSequence, CharSequence) * @see #setStandardNavigationMode(int) */ public abstract void setStandardNavigationMode(int titleResId, int subtitleResId); /** * Set the action bar into standard navigation mode, supplying a title and subtitle. * * Standard navigation mode is default. The title is automatically set to the * name of your Activity on startup if an action bar is present. * * @param title The action bar's title. null is treated as an empty string. * * @see #setStandardNavigationMode() * @see #setStandardNavigationMode(CharSequence, CharSequence) * @see #setStandardNavigationMode(int) * @see #setStandardNavigationMode(int, int) */ public abstract void setStandardNavigationMode(CharSequence title); /** * Set the action bar into standard navigation mode, supplying a title and subtitle. * * Standard navigation mode is default. The title is automatically set to the * name of your Activity on startup if an action bar is present. * * @param titleResId Resource ID of a title string * * @see #setStandardNavigationMode() * @see #setStandardNavigationMode(CharSequence) * @see #setStandardNavigationMode(CharSequence, CharSequence) * @see #setStandardNavigationMode(int, int) */ public abstract void setStandardNavigationMode(int titleResId); /** * Set the action bar into standard navigation mode, using the currently set title * and/or subtitle. Loading Loading @@ -323,18 +257,6 @@ public abstract class ActionBar { */ public abstract void setTabNavigationMode(); /** * Set the action bar into tabbed navigation mode. * * @param containerViewId Id of the container view where tab content fragments should appear. * * @see #addTab(Tab) * @see #insertTab(Tab, int) * @see #removeTab(Tab) * @see #removeTabAt(int) */ public abstract void setTabNavigationMode(int containerViewId); /** * Create and return a new {@link Tab}. * This tab will not be included in the action bar until it is added. Loading @@ -354,13 +276,13 @@ public abstract class ActionBar { public abstract void addTab(Tab tab); /** * Insert a tab for use in tabbed navigation mode. The tab will be inserted at * Add a tab for use in tabbed navigation mode. The tab will be inserted at * <code>position</code>. * * @param tab The tab to add * @param position The new position of the tab */ public abstract void insertTab(Tab tab, int position); public abstract void addTab(Tab tab, int position); /** * Remove a tab from the action bar. Loading @@ -383,6 +305,14 @@ public abstract class ActionBar { */ public abstract void selectTab(Tab tab); /** * Returns the currently selected tab if in tabbed navigation mode and there is at least * one tab present. * * @return The currently selected tab or null */ public abstract Tab getSelectedTab(); /** * Retrieve the current height of the ActionBar. * Loading Loading @@ -477,22 +407,68 @@ public abstract class ActionBar { public abstract void setText(CharSequence text); /** * Returns the fragment that will be shown when this tab is selected. * Set a custom view to be used for this tab. This overrides values set by * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}. * * @return Fragment associated with this tab * @param view Custom view to be used as a tab. */ public abstract Fragment getFragment(); public abstract void setCustomView(View view); /** * Set the fragment that will be shown when this tab is selected. * Retrieve a previously set custom view for this tab. * * @param fragment Fragment to associate with this tab * @return The custom view set by {@link #setCustomView(View)}. */ public abstract void setFragment(Fragment fragment); public abstract View getCustomView(); /** * Give this Tab an arbitrary object to hold for later use. * * @param obj Object to store */ public abstract void setTag(Object obj); /** * @return This Tab's tag object. */ public abstract Object getTag(); /** * Set the {@link TabListener} that will handle switching to and from this tab. * All tabs must have a TabListener set before being added to the ActionBar. * * @param listener Listener to handle tab selection events */ public abstract void setTabListener(TabListener listener); /** * Select this tab. Only valid if the tab has been added to the action bar. */ public abstract void select(); } /** * Callback interface invoked when a tab is focused, unfocused, added, or removed. */ public interface TabListener { /** * Called when a tab enters the selected state. * * @param tab The tab that was selected * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute * during a tab switch. The previous tab's unselect and this tab's select will be * executed in a single transaction. */ public void onTabSelected(Tab tab, FragmentTransaction ft); /** * Called when a tab exits the selected state. * * @param tab The tab that was unselected * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute * during a tab switch. This tab's unselect and the newly selected tab's select * will be executed in a single transaction. */ public void onTabUnselected(Tab tab, FragmentTransaction ft); } } core/java/android/app/BackStackEntry.java +4 −0 Original line number Diff line number Diff line Loading @@ -490,4 +490,8 @@ final class BackStackEntry implements FragmentTransaction, Runnable { public int getTransitionStyle() { return mTransitionStyle; } public boolean isEmpty() { return mNumOp == 0; } } core/java/android/app/FragmentTransaction.java +6 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,12 @@ public interface FragmentTransaction { */ public FragmentTransaction show(Fragment fragment); /** * @return <code>true</code> if this transaction contains no operations, * <code>false</code> otherwise. */ public boolean isEmpty(); /** * Bit mask that is set for all enter transitions. */ Loading core/java/com/android/internal/app/ActionBarImpl.java +55 −82 Original line number Diff line number Diff line Loading @@ -121,17 +121,6 @@ public class ActionBarImpl extends ActionBar { CONTEXT_DISPLAY_NORMAL : CONTEXT_DISPLAY_SPLIT; } @Override public void setStandardNavigationMode(int titleResId, int subtitleResId) { setStandardNavigationMode(mContext.getString(titleResId), mContext.getString(subtitleResId)); } @Override public void setStandardNavigationMode(int titleResId) { setStandardNavigationMode(mContext.getString(titleResId)); } @Override public void setTitle(int resId) { setTitle(mContext.getString(resId)); Loading Loading @@ -169,19 +158,6 @@ public class ActionBarImpl extends ActionBar { mActionView.setCallback(null); } public void setStandardNavigationMode(CharSequence title) { cleanupTabs(); setStandardNavigationMode(title, null); } public void setStandardNavigationMode(CharSequence title, CharSequence subtitle) { cleanupTabs(); mActionView.setNavigationMode(NAVIGATION_MODE_STANDARD); mActionView.setTitle(title); mActionView.setSubtitle(subtitle); mActionView.setCallback(null); } public void setSelectedNavigationItem(int position) { switch (mActionView.getNavigationMode()) { case NAVIGATION_MODE_TABS: Loading Loading @@ -211,18 +187,8 @@ public class ActionBarImpl extends ActionBar { if (mSelectedTab != null) { selectTab(null); } if (!mTabs.isEmpty()) { if (mTabSwitchMode == TAB_SWITCH_SHOW_HIDE) { final FragmentTransaction trans = mActivity.openFragmentTransaction(); final int tabCount = mTabs.size(); for (int i = 0; i < tabCount; i++) { trans.remove(mTabs.get(i).getFragment()); } trans.commit(); } mTabs.clear(); } } public void setTitle(CharSequence title) { mActionView.setTitle(title); Loading Loading @@ -295,31 +261,23 @@ public class ActionBarImpl extends ActionBar { private void configureTab(Tab tab, int position) { final TabImpl tabi = (TabImpl) tab; final boolean isFirstTab = mTabs.isEmpty(); final FragmentTransaction trans = mActivity.openFragmentTransaction(); final Fragment frag = tabi.getFragment(); final ActionBar.TabListener callback = tabi.getCallback(); if (callback == null) { throw new IllegalStateException("Action Bar Tab must have a Callback"); } tabi.setPosition(position); mTabs.add(position, tabi); if (mTabSwitchMode == TAB_SWITCH_SHOW_HIDE) { if (!frag.isAdded()) { trans.add(mTabContainerViewId, frag); } } if (isFirstTab) { if (mTabSwitchMode == TAB_SWITCH_SHOW_HIDE) { trans.show(frag); } else if (mTabSwitchMode == TAB_SWITCH_ADD_REMOVE) { trans.add(mTabContainerViewId, frag); } final FragmentTransaction trans = mActivity.getFragmentManager().openTransaction(); mSelectedTab = tabi; } else { if (mTabSwitchMode == TAB_SWITCH_SHOW_HIDE) { trans.hide(frag); callback.onTabSelected(tab, trans); if (!trans.isEmpty()) { trans.commit(); } } trans.commit(); } @Override Loading @@ -329,8 +287,8 @@ public class ActionBarImpl extends ActionBar { } @Override public void insertTab(Tab tab, int position) { mActionView.insertTab(tab, position); public void addTab(Tab tab, int position) { mActionView.addTab(tab, position); configureTab(tab, position); } Loading Loading @@ -366,12 +324,6 @@ public class ActionBarImpl extends ActionBar { mActionView.setNavigationMode(NAVIGATION_MODE_TABS); } @Override public void setTabNavigationMode(int containerViewId) { mTabContainerViewId = containerViewId; setTabNavigationMode(); } @Override public void selectTab(Tab tab) { if (mSelectedTab == tab) { Loading @@ -379,23 +331,23 @@ public class ActionBarImpl extends ActionBar { } mActionView.setTabSelected(tab != null ? tab.getPosition() : Tab.INVALID_POSITION); final FragmentTransaction trans = mActivity.openFragmentTransaction(); final FragmentTransaction trans = mActivity.getFragmentManager().openTransaction(); if (mSelectedTab != null) { if (mTabSwitchMode == TAB_SWITCH_SHOW_HIDE) { trans.hide(mSelectedTab.getFragment()); } else if (mTabSwitchMode == TAB_SWITCH_ADD_REMOVE) { trans.remove(mSelectedTab.getFragment()); mSelectedTab.getCallback().onTabUnselected(mSelectedTab, trans); } mSelectedTab = (TabImpl) tab; if (mSelectedTab != null) { mSelectedTab.getCallback().onTabSelected(mSelectedTab, trans); } if (tab != null) { if (mTabSwitchMode == TAB_SWITCH_SHOW_HIDE) { trans.show(tab.getFragment()); } else if (mTabSwitchMode == TAB_SWITCH_ADD_REMOVE) { trans.add(mTabContainerViewId, tab.getFragment()); if (!trans.isEmpty()) { trans.commit(); } } mSelectedTab = (TabImpl) tab; trans.commit(); @Override public Tab getSelectedTab() { return mSelectedTab; } @Override Loading Loading @@ -542,14 +494,40 @@ public class ActionBarImpl extends ActionBar { * @hide */ public class TabImpl extends ActionBar.Tab { private Fragment mFragment; private ActionBar.TabListener mCallback; private Object mTag; private Drawable mIcon; private CharSequence mText; private int mPosition; private View mCustomView; @Override public Fragment getFragment() { return mFragment; public Object getTag() { return mTag; } @Override public void setTag(Object tag) { mTag = tag; } public ActionBar.TabListener getCallback() { return mCallback; } @Override public void setTabListener(ActionBar.TabListener callback) { mCallback = callback; } @Override public View getCustomView() { return mCustomView; } @Override public void setCustomView(View view) { mCustomView = view; } @Override Loading @@ -571,11 +549,6 @@ public class ActionBarImpl extends ActionBar { return mText; } @Override public void setFragment(Fragment fragment) { mFragment = fragment; } @Override public void setIcon(Drawable icon) { mIcon = icon; Loading Loading
api/current.xml +111 −83 Original line number Diff line number Diff line Loading @@ -21707,6 +21707,21 @@ <parameter name="tab" type="android.app.ActionBar.Tab"> </parameter> </method> <method name="addTab" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="tab" type="android.app.ActionBar.Tab"> </parameter> <parameter name="position" type="int"> </parameter> </method> <method name="getCustomNavigationView" return="android.view.View" abstract="true" Loading Loading @@ -21762,8 +21777,8 @@ visibility="public" > </method> <method name="getSubtitle" return="java.lang.CharSequence" <method name="getSelectedTab" return="android.app.ActionBar.Tab" abstract="true" native="false" synchronized="false" Loading @@ -21773,7 +21788,7 @@ visibility="public" > </method> <method name="getTitle" <method name="getSubtitle" return="java.lang.CharSequence" abstract="true" native="false" Loading @@ -21784,8 +21799,8 @@ visibility="public" > </method> <method name="hide" return="void" <method name="getTitle" return="java.lang.CharSequence" abstract="true" native="false" synchronized="false" Loading @@ -21795,7 +21810,7 @@ visibility="public" > </method> <method name="insertTab" <method name="hide" return="void" abstract="true" native="false" Loading @@ -21805,10 +21820,6 @@ deprecated="not deprecated" visibility="public" > <parameter name="tab" type="android.app.ActionBar.Tab"> </parameter> <parameter name="position" type="int"> </parameter> </method> <method name="isShowing" return="boolean" Loading Loading @@ -21980,62 +21991,6 @@ deprecated="not deprecated" visibility="public" > <parameter name="title" type="java.lang.CharSequence"> </parameter> <parameter name="subtitle" type="java.lang.CharSequence"> </parameter> </method> <method name="setStandardNavigationMode" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="titleResId" type="int"> </parameter> <parameter name="subtitleResId" type="int"> </parameter> </method> <method name="setStandardNavigationMode" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="title" type="java.lang.CharSequence"> </parameter> </method> <method name="setStandardNavigationMode" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="titleResId" type="int"> </parameter> </method> <method name="setStandardNavigationMode" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="setSubtitle" return="void" Loading Loading @@ -22074,19 +22029,6 @@ visibility="public" > </method> <method name="setTabNavigationMode" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="containerViewId" type="int"> </parameter> </method> <method name="setTitle" return="void" abstract="true" Loading Loading @@ -22230,8 +22172,8 @@ visibility="public" > </constructor> <method name="getFragment" return="android.app.Fragment" <method name="getCustomView" return="android.view.View" abstract="true" native="false" synchronized="false" Loading Loading @@ -22263,6 +22205,17 @@ visibility="public" > </method> <method name="getTag" return="java.lang.Object" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getText" return="java.lang.CharSequence" abstract="true" Loading @@ -22285,7 +22238,7 @@ visibility="public" > </method> <method name="setFragment" <method name="setCustomView" return="void" abstract="true" native="false" Loading @@ -22295,7 +22248,7 @@ deprecated="not deprecated" visibility="public" > <parameter name="fragment" type="android.app.Fragment"> <parameter name="view" type="android.view.View"> </parameter> </method> <method name="setIcon" Loading @@ -22311,6 +22264,32 @@ <parameter name="icon" type="android.graphics.drawable.Drawable"> </parameter> </method> <method name="setTabListener" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="listener" type="android.app.ActionBar.TabListener"> </parameter> </method> <method name="setTag" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="obj" type="java.lang.Object"> </parameter> </method> <method name="setText" return="void" abstract="true" Loading @@ -22336,6 +22315,44 @@ > </field> </class> <interface name="ActionBar.TabListener" abstract="true" static="true" final="false" deprecated="not deprecated" visibility="public" > <method name="onTabSelected" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="tab" type="android.app.ActionBar.Tab"> </parameter> <parameter name="ft" type="android.app.FragmentTransaction"> </parameter> </method> <method name="onTabUnselected" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="tab" type="android.app.ActionBar.Tab"> </parameter> <parameter name="ft" type="android.app.FragmentTransaction"> </parameter> </method> </interface> <class name="Activity" extends="android.view.ContextThemeWrapper" abstract="false" Loading Loading @@ -29326,6 +29343,17 @@ <parameter name="fragment" type="android.app.Fragment"> </parameter> </method> <method name="isEmpty" return="boolean" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="remove" return="android.app.FragmentTransaction" abstract="true"
core/java/android/app/ActionBar.java +62 −86 Original line number Diff line number Diff line Loading @@ -122,72 +122,6 @@ public abstract class ActionBar { */ public abstract int getSelectedNavigationItem(); /** * Set the action bar into standard navigation mode, supplying a title and subtitle. * * Standard navigation mode is default. The title is automatically set to the * name of your Activity. Subtitles are displayed underneath the title, usually * in a smaller font or otherwise less prominently than the title. Subtitles are * good for extended descriptions of activity state. * * @param title The action bar's title. null is treated as an empty string. * @param subtitle The action bar's subtitle. null will remove the subtitle entirely. * * @see #setStandardNavigationMode() * @see #setStandardNavigationMode(CharSequence) * @see #setStandardNavigationMode(int) * @see #setStandardNavigationMode(int, int) */ public abstract void setStandardNavigationMode(CharSequence title, CharSequence subtitle); /** * Set the action bar into standard navigation mode, supplying a title and subtitle. * * Standard navigation mode is default. The title is automatically set to the * name of your Activity. Subtitles are displayed underneath the title, usually * in a smaller font or otherwise less prominently than the title. Subtitles are * good for extended descriptions of activity state. * * @param titleResId Resource ID of a title string * @param subtitleResId Resource ID of a subtitle string * * @see #setStandardNavigationMode() * @see #setStandardNavigationMode(CharSequence) * @see #setStandardNavigationMode(CharSequence, CharSequence) * @see #setStandardNavigationMode(int) */ public abstract void setStandardNavigationMode(int titleResId, int subtitleResId); /** * Set the action bar into standard navigation mode, supplying a title and subtitle. * * Standard navigation mode is default. The title is automatically set to the * name of your Activity on startup if an action bar is present. * * @param title The action bar's title. null is treated as an empty string. * * @see #setStandardNavigationMode() * @see #setStandardNavigationMode(CharSequence, CharSequence) * @see #setStandardNavigationMode(int) * @see #setStandardNavigationMode(int, int) */ public abstract void setStandardNavigationMode(CharSequence title); /** * Set the action bar into standard navigation mode, supplying a title and subtitle. * * Standard navigation mode is default. The title is automatically set to the * name of your Activity on startup if an action bar is present. * * @param titleResId Resource ID of a title string * * @see #setStandardNavigationMode() * @see #setStandardNavigationMode(CharSequence) * @see #setStandardNavigationMode(CharSequence, CharSequence) * @see #setStandardNavigationMode(int, int) */ public abstract void setStandardNavigationMode(int titleResId); /** * Set the action bar into standard navigation mode, using the currently set title * and/or subtitle. Loading Loading @@ -323,18 +257,6 @@ public abstract class ActionBar { */ public abstract void setTabNavigationMode(); /** * Set the action bar into tabbed navigation mode. * * @param containerViewId Id of the container view where tab content fragments should appear. * * @see #addTab(Tab) * @see #insertTab(Tab, int) * @see #removeTab(Tab) * @see #removeTabAt(int) */ public abstract void setTabNavigationMode(int containerViewId); /** * Create and return a new {@link Tab}. * This tab will not be included in the action bar until it is added. Loading @@ -354,13 +276,13 @@ public abstract class ActionBar { public abstract void addTab(Tab tab); /** * Insert a tab for use in tabbed navigation mode. The tab will be inserted at * Add a tab for use in tabbed navigation mode. The tab will be inserted at * <code>position</code>. * * @param tab The tab to add * @param position The new position of the tab */ public abstract void insertTab(Tab tab, int position); public abstract void addTab(Tab tab, int position); /** * Remove a tab from the action bar. Loading @@ -383,6 +305,14 @@ public abstract class ActionBar { */ public abstract void selectTab(Tab tab); /** * Returns the currently selected tab if in tabbed navigation mode and there is at least * one tab present. * * @return The currently selected tab or null */ public abstract Tab getSelectedTab(); /** * Retrieve the current height of the ActionBar. * Loading Loading @@ -477,22 +407,68 @@ public abstract class ActionBar { public abstract void setText(CharSequence text); /** * Returns the fragment that will be shown when this tab is selected. * Set a custom view to be used for this tab. This overrides values set by * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}. * * @return Fragment associated with this tab * @param view Custom view to be used as a tab. */ public abstract Fragment getFragment(); public abstract void setCustomView(View view); /** * Set the fragment that will be shown when this tab is selected. * Retrieve a previously set custom view for this tab. * * @param fragment Fragment to associate with this tab * @return The custom view set by {@link #setCustomView(View)}. */ public abstract void setFragment(Fragment fragment); public abstract View getCustomView(); /** * Give this Tab an arbitrary object to hold for later use. * * @param obj Object to store */ public abstract void setTag(Object obj); /** * @return This Tab's tag object. */ public abstract Object getTag(); /** * Set the {@link TabListener} that will handle switching to and from this tab. * All tabs must have a TabListener set before being added to the ActionBar. * * @param listener Listener to handle tab selection events */ public abstract void setTabListener(TabListener listener); /** * Select this tab. Only valid if the tab has been added to the action bar. */ public abstract void select(); } /** * Callback interface invoked when a tab is focused, unfocused, added, or removed. */ public interface TabListener { /** * Called when a tab enters the selected state. * * @param tab The tab that was selected * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute * during a tab switch. The previous tab's unselect and this tab's select will be * executed in a single transaction. */ public void onTabSelected(Tab tab, FragmentTransaction ft); /** * Called when a tab exits the selected state. * * @param tab The tab that was unselected * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute * during a tab switch. This tab's unselect and the newly selected tab's select * will be executed in a single transaction. */ public void onTabUnselected(Tab tab, FragmentTransaction ft); } }
core/java/android/app/BackStackEntry.java +4 −0 Original line number Diff line number Diff line Loading @@ -490,4 +490,8 @@ final class BackStackEntry implements FragmentTransaction, Runnable { public int getTransitionStyle() { return mTransitionStyle; } public boolean isEmpty() { return mNumOp == 0; } }
core/java/android/app/FragmentTransaction.java +6 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,12 @@ public interface FragmentTransaction { */ public FragmentTransaction show(Fragment fragment); /** * @return <code>true</code> if this transaction contains no operations, * <code>false</code> otherwise. */ public boolean isEmpty(); /** * Bit mask that is set for all enter transitions. */ Loading
core/java/com/android/internal/app/ActionBarImpl.java +55 −82 Original line number Diff line number Diff line Loading @@ -121,17 +121,6 @@ public class ActionBarImpl extends ActionBar { CONTEXT_DISPLAY_NORMAL : CONTEXT_DISPLAY_SPLIT; } @Override public void setStandardNavigationMode(int titleResId, int subtitleResId) { setStandardNavigationMode(mContext.getString(titleResId), mContext.getString(subtitleResId)); } @Override public void setStandardNavigationMode(int titleResId) { setStandardNavigationMode(mContext.getString(titleResId)); } @Override public void setTitle(int resId) { setTitle(mContext.getString(resId)); Loading Loading @@ -169,19 +158,6 @@ public class ActionBarImpl extends ActionBar { mActionView.setCallback(null); } public void setStandardNavigationMode(CharSequence title) { cleanupTabs(); setStandardNavigationMode(title, null); } public void setStandardNavigationMode(CharSequence title, CharSequence subtitle) { cleanupTabs(); mActionView.setNavigationMode(NAVIGATION_MODE_STANDARD); mActionView.setTitle(title); mActionView.setSubtitle(subtitle); mActionView.setCallback(null); } public void setSelectedNavigationItem(int position) { switch (mActionView.getNavigationMode()) { case NAVIGATION_MODE_TABS: Loading Loading @@ -211,18 +187,8 @@ public class ActionBarImpl extends ActionBar { if (mSelectedTab != null) { selectTab(null); } if (!mTabs.isEmpty()) { if (mTabSwitchMode == TAB_SWITCH_SHOW_HIDE) { final FragmentTransaction trans = mActivity.openFragmentTransaction(); final int tabCount = mTabs.size(); for (int i = 0; i < tabCount; i++) { trans.remove(mTabs.get(i).getFragment()); } trans.commit(); } mTabs.clear(); } } public void setTitle(CharSequence title) { mActionView.setTitle(title); Loading Loading @@ -295,31 +261,23 @@ public class ActionBarImpl extends ActionBar { private void configureTab(Tab tab, int position) { final TabImpl tabi = (TabImpl) tab; final boolean isFirstTab = mTabs.isEmpty(); final FragmentTransaction trans = mActivity.openFragmentTransaction(); final Fragment frag = tabi.getFragment(); final ActionBar.TabListener callback = tabi.getCallback(); if (callback == null) { throw new IllegalStateException("Action Bar Tab must have a Callback"); } tabi.setPosition(position); mTabs.add(position, tabi); if (mTabSwitchMode == TAB_SWITCH_SHOW_HIDE) { if (!frag.isAdded()) { trans.add(mTabContainerViewId, frag); } } if (isFirstTab) { if (mTabSwitchMode == TAB_SWITCH_SHOW_HIDE) { trans.show(frag); } else if (mTabSwitchMode == TAB_SWITCH_ADD_REMOVE) { trans.add(mTabContainerViewId, frag); } final FragmentTransaction trans = mActivity.getFragmentManager().openTransaction(); mSelectedTab = tabi; } else { if (mTabSwitchMode == TAB_SWITCH_SHOW_HIDE) { trans.hide(frag); callback.onTabSelected(tab, trans); if (!trans.isEmpty()) { trans.commit(); } } trans.commit(); } @Override Loading @@ -329,8 +287,8 @@ public class ActionBarImpl extends ActionBar { } @Override public void insertTab(Tab tab, int position) { mActionView.insertTab(tab, position); public void addTab(Tab tab, int position) { mActionView.addTab(tab, position); configureTab(tab, position); } Loading Loading @@ -366,12 +324,6 @@ public class ActionBarImpl extends ActionBar { mActionView.setNavigationMode(NAVIGATION_MODE_TABS); } @Override public void setTabNavigationMode(int containerViewId) { mTabContainerViewId = containerViewId; setTabNavigationMode(); } @Override public void selectTab(Tab tab) { if (mSelectedTab == tab) { Loading @@ -379,23 +331,23 @@ public class ActionBarImpl extends ActionBar { } mActionView.setTabSelected(tab != null ? tab.getPosition() : Tab.INVALID_POSITION); final FragmentTransaction trans = mActivity.openFragmentTransaction(); final FragmentTransaction trans = mActivity.getFragmentManager().openTransaction(); if (mSelectedTab != null) { if (mTabSwitchMode == TAB_SWITCH_SHOW_HIDE) { trans.hide(mSelectedTab.getFragment()); } else if (mTabSwitchMode == TAB_SWITCH_ADD_REMOVE) { trans.remove(mSelectedTab.getFragment()); mSelectedTab.getCallback().onTabUnselected(mSelectedTab, trans); } mSelectedTab = (TabImpl) tab; if (mSelectedTab != null) { mSelectedTab.getCallback().onTabSelected(mSelectedTab, trans); } if (tab != null) { if (mTabSwitchMode == TAB_SWITCH_SHOW_HIDE) { trans.show(tab.getFragment()); } else if (mTabSwitchMode == TAB_SWITCH_ADD_REMOVE) { trans.add(mTabContainerViewId, tab.getFragment()); if (!trans.isEmpty()) { trans.commit(); } } mSelectedTab = (TabImpl) tab; trans.commit(); @Override public Tab getSelectedTab() { return mSelectedTab; } @Override Loading Loading @@ -542,14 +494,40 @@ public class ActionBarImpl extends ActionBar { * @hide */ public class TabImpl extends ActionBar.Tab { private Fragment mFragment; private ActionBar.TabListener mCallback; private Object mTag; private Drawable mIcon; private CharSequence mText; private int mPosition; private View mCustomView; @Override public Fragment getFragment() { return mFragment; public Object getTag() { return mTag; } @Override public void setTag(Object tag) { mTag = tag; } public ActionBar.TabListener getCallback() { return mCallback; } @Override public void setTabListener(ActionBar.TabListener callback) { mCallback = callback; } @Override public View getCustomView() { return mCustomView; } @Override public void setCustomView(View view) { mCustomView = view; } @Override Loading @@ -571,11 +549,6 @@ public class ActionBarImpl extends ActionBar { return mText; } @Override public void setFragment(Fragment fragment) { mFragment = fragment; } @Override public void setIcon(Drawable icon) { mIcon = icon; Loading