package android.app;
import android.animation.Animator;
+import android.annotation.CallSuper;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.StringRes;
* @deprecated Use {@link #onInflate(Context, AttributeSet, Bundle)} instead.
*/
@Deprecated
+ @CallSuper
public void onInflate(AttributeSet attrs, Bundle savedInstanceState) {
mCalled = true;
}
* @param savedInstanceState If the fragment is being re-created from
* a previous saved state, this is the state.
*/
+ @CallSuper
public void onInflate(Context context, AttributeSet attrs, Bundle savedInstanceState) {
onInflate(attrs, savedInstanceState);
mCalled = true;
* @deprecated Use {@link #onInflate(Context, AttributeSet, Bundle)} instead.
*/
@Deprecated
+ @CallSuper
public void onInflate(Activity activity, AttributeSet attrs, Bundle savedInstanceState) {
mCalled = true;
}
* Called when a fragment is first attached to its context.
* {@link #onCreate(Bundle)} will be called after this.
*/
+ @CallSuper
public void onAttach(Context context) {
mCalled = true;
final Activity hostActivity = mHost == null ? null : mHost.getActivity();
* @deprecated Use {@link #onAttach(Context)} instead.
*/
@Deprecated
+ @CallSuper
public void onAttach(Activity activity) {
mCalled = true;
}
* @param savedInstanceState If the fragment is being re-created from
* a previous saved state, this is the state.
*/
+ @CallSuper
public void onCreate(@Nullable Bundle savedInstanceState) {
mCalled = true;
final Context context = getContext();
* @param savedInstanceState If the fragment is being re-created from
* a previous saved state, this is the state.
*/
+ @CallSuper
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
mCalled = true;
}
* @param savedInstanceState If the fragment is being re-created from
* a previous saved state, this is the state.
*/
+ @CallSuper
public void onViewStateRestored(Bundle savedInstanceState) {
mCalled = true;
}
* tied to {@link Activity#onStart() Activity.onStart} of the containing
* Activity's lifecycle.
*/
+ @CallSuper
public void onStart() {
mCalled = true;
* tied to {@link Activity#onResume() Activity.onResume} of the containing
* Activity's lifecycle.
*/
+ @CallSuper
public void onResume() {
mCalled = true;
}
public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode) {
}
+ @CallSuper
public void onConfigurationChanged(Configuration newConfig) {
mCalled = true;
}
* tied to {@link Activity#onPause() Activity.onPause} of the containing
* Activity's lifecycle.
*/
+ @CallSuper
public void onPause() {
mCalled = true;
}
* tied to {@link Activity#onStop() Activity.onStop} of the containing
* Activity's lifecycle.
*/
+ @CallSuper
public void onStop() {
mCalled = true;
}
+ @CallSuper
public void onLowMemory() {
mCalled = true;
}
+ @CallSuper
public void onTrimMemory(int level) {
mCalled = true;
}
* non-null view. Internally it is called after the view's state has
* been saved but before it has been removed from its parent.
*/
+ @CallSuper
public void onDestroyView() {
mCalled = true;
}
* Called when the fragment is no longer in use. This is called
* after {@link #onStop()} and before {@link #onDetach()}.
*/
+ @CallSuper
public void onDestroy() {
mCalled = true;
//Log.v("foo", "onDestroy: mCheckedForLoaderManager=" + mCheckedForLoaderManager
* Activity re-creation (see {@link #setRetainInstance(boolean)}), in which case it is called
* after {@link #onStop()}.
*/
+ @CallSuper
public void onDetach() {
mCalled = true;
-
- // Destroy the child FragmentManager if we still have it here.
- // We won't unless we're retaining our instance and if we do,
- // our child FragmentManager instance state will have already been saved.
- if (mChildFragmentManager != null) {
- if (!mRetaining) {
- throw new IllegalStateException("Child FragmentManager of " + this + " was not "
- + " destroyed and this fragment is not retaining instance");
- }
- mChildFragmentManager.dispatchDestroy();
- mChildFragmentManager = null;
- }
}
/**
mChildFragmentManager = null;
}
+ void performDetach() {
+ mCalled = false;
+ onDetach();
+ if (!mCalled) {
+ throw new SuperNotCalledException("Fragment " + this
+ + " did not call through to super.onDetach()");
+ }
+
+ // Destroy the child FragmentManager if we still have it here.
+ // We won't unless we're retaining our instance and if we do,
+ // our child FragmentManager instance state will have already been saved.
+ if (mChildFragmentManager != null) {
+ if (!mRetaining) {
+ throw new IllegalStateException("Child FragmentManager of " + this + " was not "
+ + " destroyed and this fragment is not retaining instance");
+ }
+ mChildFragmentManager.dispatchDestroy();
+ mChildFragmentManager = null;
+ }
+ }
+
private static Transition loadTransition(Context context, TypedArray typedArray,
Transition currentValue, Transition defaultValue, int id) {
if (currentValue != defaultValue) {