Methods Summary |
---|
public void | destroyItem(android.view.ViewGroup container, int position, java.lang.Object object)
if (mCurTransaction == null) {
mCurTransaction = mFragmentManager.beginTransaction();
}
if (DEBUG) Log.v(TAG, "Detaching item #" + getItemId(position) + ": f=" + object
+ " v=" + ((Fragment)object).getView());
mCurTransaction.detach((Fragment)object);
|
public void | finishUpdate(android.view.ViewGroup container)
if (mCurTransaction != null) {
mCurTransaction.commitAllowingStateLoss();
mCurTransaction = null;
mFragmentManager.executePendingTransactions();
}
|
public abstract android.app.Fragment | getItem(int position)Return the Fragment associated with a specified position.
|
public long | getItemId(int position)Return a unique identifier for the item at the given position.
The default implementation returns the given position.
Subclasses should override this method if the positions of items can change.
return position;
|
public java.lang.Object | instantiateItem(android.view.ViewGroup container, int position)
if (mCurTransaction == null) {
mCurTransaction = mFragmentManager.beginTransaction();
}
final long itemId = getItemId(position);
// Do we already have this fragment?
String name = makeFragmentName(container.getId(), itemId);
Fragment fragment = mFragmentManager.findFragmentByTag(name);
if (fragment != null) {
if (DEBUG) Log.v(TAG, "Attaching item #" + itemId + ": f=" + fragment);
mCurTransaction.attach(fragment);
} else {
fragment = getItem(position);
if (DEBUG) Log.v(TAG, "Adding item #" + itemId + ": f=" + fragment);
mCurTransaction.add(container.getId(), fragment,
makeFragmentName(container.getId(), itemId));
}
if (fragment != mCurrentPrimaryItem) {
FragmentCompat.setMenuVisibility(fragment, false);
FragmentCompat.setUserVisibleHint(fragment, false);
}
return fragment;
|
public boolean | isViewFromObject(android.view.View view, java.lang.Object object)
return ((Fragment)object).getView() == view;
|
private static java.lang.String | makeFragmentName(int viewId, long id)
return "android:switcher:" + viewId + ":" + id;
|
public void | restoreState(android.os.Parcelable state, java.lang.ClassLoader loader)
|
public android.os.Parcelable | saveState()
return null;
|
public void | setPrimaryItem(android.view.ViewGroup container, int position, java.lang.Object object)
Fragment fragment = (Fragment)object;
if (fragment != mCurrentPrimaryItem) {
if (mCurrentPrimaryItem != null) {
FragmentCompat.setMenuVisibility(mCurrentPrimaryItem, false);
FragmentCompat.setUserVisibleHint(mCurrentPrimaryItem, false);
}
if (fragment != null) {
FragmentCompat.setMenuVisibility(fragment, true);
FragmentCompat.setUserVisibleHint(fragment, true);
}
mCurrentPrimaryItem = fragment;
}
|
public void | startUpdate(android.view.ViewGroup container)
|