Ejemplo n.º 1
0
		private void addViewInner(android.view.View child, int index, android.view.ViewGroup
			.LayoutParams @params, bool preventRequestLayout)
		{
			if (mTransition != null)
			{
				// Don't prevent other add transitions from completing, but cancel remove
				// transitions to let them complete the process before we add to the container
				mTransition.cancel(android.animation.LayoutTransition.DISAPPEARING);
			}
			if (child.getParent() != null)
			{
				throw new System.InvalidOperationException("The specified child already has a parent. "
					 + "You must call removeView() on the child's parent first.");
			}
			if (mTransition != null)
			{
				mTransition.addChild(this, child);
			}
			if (!checkLayoutParams(@params))
			{
				@params = generateLayoutParams(@params);
			}
			if (preventRequestLayout)
			{
				child.mLayoutParams = @params;
			}
			else
			{
				child.setLayoutParams(@params);
			}
			if (index < 0)
			{
				index = mChildrenCount;
			}
			addInArray(child, index);
			// tell our children
			if (preventRequestLayout)
			{
				child.assignParent(this);
			}
			else
			{
				child.mParent = this;
			}
			if (child.hasFocus())
			{
				requestChildFocus(child, child.findFocus());
			}
			android.view.View.AttachInfo ai = mAttachInfo;
			if (ai != null && (mGroupFlags & FLAG_PREVENT_DISPATCH_ATTACHED_TO_WINDOW) == 0)
			{
				bool lastKeepOn = ai.mKeepScreenOn;
				ai.mKeepScreenOn = false;
				child.dispatchAttachedToWindow(mAttachInfo, (mViewFlags & VISIBILITY_MASK));
				if (ai.mKeepScreenOn)
				{
					needGlobalAttributesUpdate(true);
				}
				ai.mKeepScreenOn = lastKeepOn;
			}
			onViewAdded(child);
			if ((child.mViewFlags & DUPLICATE_PARENT_STATE) == DUPLICATE_PARENT_STATE)
			{
				mGroupFlags |= FLAG_NOTIFY_CHILDREN_ON_DRAWABLE_STATE_CHANGE;
			}
		}
Ejemplo n.º 2
0
		public virtual void updateViewLayout(android.view.View view, android.view.ViewGroup
			.LayoutParams @params)
		{
			if (!checkLayoutParams(@params))
			{
				throw new System.ArgumentException("Invalid LayoutParams supplied to " + this);
			}
			if (view.mParent != this)
			{
				throw new System.ArgumentException("Given view not a child of " + this);
			}
			view.setLayoutParams(@params);
		}
Ejemplo n.º 3
0
		public override void addView(android.view.View child)
		{
			if (child.getLayoutParams() == null)
			{
				android.widget.LinearLayout.LayoutParams lp = new android.widget.LinearLayout.LayoutParams
					(0, android.view.ViewGroup.LayoutParams.MATCH_PARENT, 1.0f);
				lp.setMargins(0, 0, 0, 0);
				child.setLayoutParams(lp);
			}
			// Ensure you can navigate to the tab with the keyboard, and you can touch it
			child.setFocusable(true);
			child.setClickable(true);
			base.addView(child);
			// TODO: detect this via geometry with a tabwidget listener rather
			// than potentially interfere with the view's listener
			child.setOnClickListener(new android.widget.TabWidget.TabClickListener(this, getTabCount
				() - 1));
			child.setOnFocusChangeListener(this);
		}
Ejemplo n.º 4
0
		public virtual void updateViewLayout(android.view.View view, android.view.ViewGroup
			.LayoutParams @params)
		{
			if (!(@params is android.view.WindowManagerClass.LayoutParams))
			{
				throw new System.ArgumentException("Params must be WindowManager.LayoutParams");
			}
			android.view.WindowManagerClass.LayoutParams wparams = (android.view.WindowManagerClass
				.LayoutParams)@params;
			view.setLayoutParams(wparams);
			lock (this)
			{
				int index = findViewLocked(view, true);
				android.view.ViewRootImpl root = mRoots[index];
				mParams[index] = wparams;
				root.setLayoutParams(wparams, false);
			}
		}
Ejemplo n.º 5
0
		private void addView(android.view.View view, android.view.ViewGroup.LayoutParams 
			@params, android.view.CompatibilityInfoHolder cih, bool nest)
		{
			if (false)
			{
				android.util.Log.v("WindowManager", "addView view=" + view);
			}
			if (!(@params is android.view.WindowManagerClass.LayoutParams))
			{
				throw new System.ArgumentException("Params must be WindowManager.LayoutParams");
			}
			android.view.WindowManagerClass.LayoutParams wparams = (android.view.WindowManagerClass
				.LayoutParams)@params;
			android.view.ViewRootImpl root;
			android.view.View panelParentView = null;
			lock (this)
			{
				// Here's an odd/questionable case: if someone tries to add a
				// view multiple times, then we simply bump up a nesting count
				// and they need to remove the view the corresponding number of
				// times to have it actually removed from the window manager.
				// This is useful specifically for the notification manager,
				// which can continually add/remove the same view as a
				// notification gets updated.
				int index = findViewLocked(view, false);
				if (index >= 0)
				{
					if (!nest)
					{
						throw new System.InvalidOperationException("View " + view + " has already been added to the window manager."
							);
					}
					root = mRoots[index];
					root.mAddNesting++;
					// Update layout parameters.
					view.setLayoutParams(wparams);
					root.setLayoutParams(wparams, true);
					return;
				}
				// If this is a panel window, then find the window it is being
				// attached to for future reference.
				if (wparams.type >= android.view.WindowManagerClass.LayoutParams.FIRST_SUB_WINDOW
					 && wparams.type <= android.view.WindowManagerClass.LayoutParams.LAST_SUB_WINDOW)
				{
					int count = mViews != null ? mViews.Length : 0;
					{
						for (int i = 0; i < count; i++)
						{
							if (mRoots[i].mWindow.asBinder() == wparams.token)
							{
								panelParentView = mViews[i];
							}
						}
					}
				}
				root = new android.view.ViewRootImpl(view.getContext());
				root.mAddNesting = 1;
				if (cih == null)
				{
					root.mCompatibilityInfo = new android.view.CompatibilityInfoHolder();
				}
				else
				{
					root.mCompatibilityInfo = cih;
				}
				view.setLayoutParams(wparams);
				if (mViews == null)
				{
					index = 1;
					mViews = new android.view.View[1];
					mRoots = new android.view.ViewRootImpl[1];
					mParams = new android.view.WindowManagerClass.LayoutParams[1];
				}
				else
				{
					index = mViews.Length + 1;
					object[] old = mViews;
					mViews = new android.view.View[index];
					System.Array.Copy(old, 0, mViews, 0, index - 1);
					old = mRoots;
					mRoots = new android.view.ViewRootImpl[index];
					System.Array.Copy(old, 0, mRoots, 0, index - 1);
					old = mParams;
					mParams = new android.view.WindowManagerClass.LayoutParams[index];
					System.Array.Copy(old, 0, mParams, 0, index - 1);
				}
				index--;
				mViews[index] = view;
				mRoots[index] = root;
				mParams[index] = wparams;
			}
			// do this last because it fires off messages to start doing things
			root.setView(view, wparams, panelParentView);
		}
Ejemplo n.º 6
0
		public override void setCustomView(android.view.View view, android.app.ActionBar.
			LayoutParams layoutParams)
		{
			view.setLayoutParams(layoutParams);
			mActionView.setCustomNavigationView(view);
		}