Merge "Add Fragment#onAttachFragment for parent fragments" into nyc-dev

This commit is contained in:
TreeHugger Robot
2016-05-13 21:53:41 +00:00
committed by Android (Google) Code Review
5 changed files with 17 additions and 0 deletions

View File

@@ -4430,6 +4430,7 @@ package android.app {
method public void onActivityResult(int, int, android.content.Intent);
method public void onAttach(android.content.Context);
method public deprecated void onAttach(android.app.Activity);
method public void onAttachFragment(android.app.Fragment);
method public void onConfigurationChanged(android.content.res.Configuration);
method public boolean onContextItemSelected(android.view.MenuItem);
method public void onCreate(android.os.Bundle);

View File

@@ -4575,6 +4575,7 @@ package android.app {
method public void onActivityResult(int, int, android.content.Intent);
method public void onAttach(android.content.Context);
method public deprecated void onAttach(android.app.Activity);
method public void onAttachFragment(android.app.Fragment);
method public void onConfigurationChanged(android.content.res.Configuration);
method public boolean onContextItemSelected(android.view.MenuItem);
method public void onCreate(android.os.Bundle);

View File

@@ -4431,6 +4431,7 @@ package android.app {
method public void onActivityResult(int, int, android.content.Intent);
method public void onAttach(android.content.Context);
method public deprecated void onAttach(android.app.Activity);
method public void onAttachFragment(android.app.Fragment);
method public void onConfigurationChanged(android.content.res.Configuration);
method public boolean onContextItemSelected(android.view.MenuItem);
method public void onCreate(android.os.Bundle);

View File

@@ -1429,6 +1429,18 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
mCalled = true;
}
/**
* Called when a fragment is attached as a child of this fragment.
*
* <p>This is called after the attached fragment's <code>onAttach</code> and before
* the attached fragment's <code>onCreate</code> if the fragment has not yet had a previous
* call to <code>onCreate</code>.</p>
*
* @param childFragment child fragment being attached
*/
public void onAttachFragment(Fragment childFragment) {
}
/**
* Called when a fragment is first attached to its context.
* {@link #onCreate(Bundle)} will be called after this.

View File

@@ -941,6 +941,8 @@ final class FragmentManagerImpl extends FragmentManager implements LayoutInflate
}
if (f.mParentFragment == null) {
mHost.onAttachFragment(f);
} else {
f.mParentFragment.onAttachFragment(f);
}
if (!f.mRetaining) {