public virtual void removeViewImmediate(android.view.View view) { lock (this) { int index = findViewLocked(view, true); android.view.ViewRootImpl root = mRoots[index]; android.view.View curView = root.getView(); root.mAddNesting = 0; root.die(true); finishRemoveViewLocked(curView, index); if (curView == view) { return; } throw new System.InvalidOperationException("Calling with view " + view + " but the ViewAncestor is attached to " + curView); } }
internal virtual android.view.View removeViewLocked(int index) { android.view.ViewRootImpl root = mRoots[index]; android.view.View view = root.getView(); // Don't really remove until we have matched all calls to add(). root.mAddNesting--; if (root.mAddNesting > 0) { return(view); } if (view != null) { android.view.inputmethod.InputMethodManager imm = android.view.inputmethod.InputMethodManager .getInstance(view.getContext()); if (imm != null) { imm.windowDismissed(mViews[index].getWindowToken()); } } root.die(false); finishRemoveViewLocked(view, index); return(view); }
// func doesn't allow null... does it matter if we clear them? //view.setLayoutParams(null); public virtual void closeAll(android.os.IBinder token, string who, string what) { lock (this) { if (mViews == null) { return; } int count = mViews.Length; { //Log.i("foo", "Closing all windows of " + token); for (int i = 0; i < count; i++) { //Log.i("foo", "@ " + i + " token " + mParams[i].token // + " view " + mRoots[i].getView()); if (token == null || mParams[i].token == token) { android.view.ViewRootImpl root = mRoots[i]; root.mAddNesting = 1; //Log.i("foo", "Force closing " + root); if (who != null) { android.view.WindowLeaked leak = new android.view.WindowLeaked(what + " " + who + " has leaked window " + root.getView() + " that was originally added here"); XobotOS.Runtime.Util.SetStackTrace(leak, root.getLocation().StackTrace); android.util.Log.e("WindowManager", leak.Message, leak); } removeViewLocked(i); i--; count--; } } } } }