Fixes attach state management when a controller is pushed while the Activity is paused. (Fixes #303)
This commit is contained in:
@@ -8,7 +8,6 @@ import android.content.IntentSender;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.IdRes;
|
||||
import android.support.annotation.NonNull;
|
||||
@@ -732,8 +731,8 @@ public abstract class Controller {
|
||||
return false;
|
||||
}
|
||||
|
||||
final void setNeedsAttach() {
|
||||
needsAttach = true;
|
||||
final void setNeedsAttach(boolean needsAttach) {
|
||||
this.needsAttach = needsAttach;
|
||||
}
|
||||
|
||||
final void prepareForHostDetach() {
|
||||
|
||||
@@ -218,6 +218,10 @@ public abstract class ControllerChangeHandler {
|
||||
((ViewGroup)fromParent).removeView(fromView);
|
||||
}
|
||||
}
|
||||
|
||||
if (handler.removesFromViewOnPush() && from != null) {
|
||||
from.setNeedsAttach(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -577,7 +577,7 @@ public abstract class Router {
|
||||
void prepareForHostDetach() {
|
||||
for (RouterTransaction transaction : backstack) {
|
||||
if (ControllerChangeHandler.completeHandlerImmediately(transaction.controller.getInstanceId())) {
|
||||
transaction.controller.setNeedsAttach();
|
||||
transaction.controller.setNeedsAttach(true);
|
||||
}
|
||||
transaction.controller.prepareForHostDetach();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user