am d5da500e: am fbb670d9: am 5a988492: am 00877d68: am f187823e: Merge "Fix exception when fragment container has no View." into lmp-dev
* commit 'd5da500e170fe3e2b430f27ac250b5b61dc90bcc': Fix exception when fragment container has no View.
This commit is contained in:
@@ -745,6 +745,11 @@ public class Activity extends ContextThemeWrapper
|
||||
public View findViewById(int id) {
|
||||
return Activity.this.findViewById(id);
|
||||
}
|
||||
@Override
|
||||
public boolean hasView() {
|
||||
Window window = Activity.this.getWindow();
|
||||
return (window != null && window.peekDecorView() != null);
|
||||
}
|
||||
};
|
||||
|
||||
// Most recent call to requestVisibleBehind().
|
||||
|
||||
@@ -868,6 +868,9 @@ final class BackStackRecord extends FragmentTransaction implements
|
||||
*/
|
||||
private void calculateFragments(SparseArray<Fragment> firstOutFragments,
|
||||
SparseArray<Fragment> lastInFragments) {
|
||||
if (!mManager.mContainer.hasView()) {
|
||||
return; // nothing to see, so no transitions
|
||||
}
|
||||
Op op = mHead;
|
||||
while (op != null) {
|
||||
switch (op.cmd) {
|
||||
@@ -923,6 +926,9 @@ final class BackStackRecord extends FragmentTransaction implements
|
||||
*/
|
||||
public void calculateBackFragments(SparseArray<Fragment> firstOutFragments,
|
||||
SparseArray<Fragment> lastInFragments) {
|
||||
if (!mManager.mContainer.hasView()) {
|
||||
return; // nothing to see, so no transitions
|
||||
}
|
||||
Op op = mHead;
|
||||
while (op != null) {
|
||||
switch (op.cmd) {
|
||||
|
||||
@@ -2014,6 +2014,11 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
|
||||
}
|
||||
return mView.findViewById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasView() {
|
||||
return (mView != null);
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -395,6 +395,7 @@ final class FragmentManagerState implements Parcelable {
|
||||
*/
|
||||
interface FragmentContainer {
|
||||
public View findViewById(int id);
|
||||
public boolean hasView();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user