public virtual android.view.WindowManagerClass.LayoutParams getRootViewLayoutParameter (android.view.View view) { android.view.ViewParent vp = view.getParent(); while (vp != null && !(vp is android.view.ViewRootImpl)) { vp = vp.getParent(); } if (vp == null) { return(null); } android.view.ViewRootImpl vr = (android.view.ViewRootImpl)vp; int N = mRoots.Length; { for (int i = 0; i < N; ++i) { if (mRoots[i] == vr) { return(mParams[i]); } } } return(null); }
public virtual void handleShow() { if (mView != mNextView) { // remove the old view if necessary handleHide(); mView = mNextView; mWM = android.view.WindowManagerImpl.getDefault(); int gravity = mGravity; mParams.gravity = gravity; if ((gravity & android.view.Gravity.HORIZONTAL_GRAVITY_MASK) == android.view.Gravity .FILL_HORIZONTAL) { mParams.horizontalWeight = 1.0f; } if ((gravity & android.view.Gravity.VERTICAL_GRAVITY_MASK) == android.view.Gravity .FILL_VERTICAL) { mParams.verticalWeight = 1.0f; } mParams.x = mX; mParams.y = mY; mParams.verticalMargin = mVerticalMargin; mParams.horizontalMargin = mHorizontalMargin; if (mView.getParent() != null) { mWM.removeView(mView); } mWM.addView(mView, mParams); trySendAccessibilityEvent(); } }
/// <summary>Add an item view at the given index.</summary> /// <remarks>Add an item view at the given index.</remarks> /// <param name="itemView">View to add</param> /// <param name="childIndex">Index within the parent to insert at</param> protected internal virtual void addItemView(android.view.View itemView, int childIndex ) { android.view.ViewGroup currentParent = (android.view.ViewGroup)itemView.getParent (); if (currentParent != null) { currentParent.removeView(itemView); } ((android.view.ViewGroup)mMenuView).addView(itemView, childIndex); }
public virtual void initForMode(android.view.ActionMode mode) { if (mClose == null) { android.view.LayoutInflater inflater = android.view.LayoutInflater.from(mContext); mClose = inflater.inflate([email protected]_mode_close_item, this , false); addView(mClose); } else { if (mClose.getParent() == null) { addView(mClose); } } android.view.View closeButton = mClose.findViewById([email protected]_mode_close_button ); closeButton.setOnClickListener(new _OnClickListener_212(mode)); [email protected] menu = ([email protected] )mode.getMenu(); mActionMenuPresenter = new [email protected](mContext ); mActionMenuPresenter.setReserveOverflow(true); android.view.ViewGroup.LayoutParams layoutParams = new android.view.ViewGroup.LayoutParams (android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams .MATCH_PARENT); if (!mSplitActionBar) { menu.addMenuPresenter(mActionMenuPresenter); mMenuView = ([email protected])mActionMenuPresenter.getMenuView (this); mMenuView.setBackgroundDrawable(null); addView(mMenuView, layoutParams); } else { // Allow full screen width in split mode. mActionMenuPresenter.setWidthLimit(getContext().getResources().getDisplayMetrics( ).widthPixels, true); // No limit to the item count; use whatever will fit. mActionMenuPresenter.setItemLimit(int.MaxValue); // Span the whole width layoutParams.width = android.view.ViewGroup.LayoutParams.MATCH_PARENT; layoutParams.height = mContentHeight; menu.addMenuPresenter(mActionMenuPresenter); mMenuView = ([email protected])mActionMenuPresenter.getMenuView (this); mMenuView.setBackgroundDrawable(mSplitBackground); mSplitView.addView(mMenuView, layoutParams); } mAnimateInOnLayout = true; }
public virtual void handleHide() { if (mView != null) { // note: checking parent() just to make sure the view has // been added... i have seen cases where we get here when // the view isn't yet added, so let's try not to crash. if (mView.getParent() != null) { mWM.removeView(mView); } mView = null; } }
private android.view.ViewRootImpl getOwnerViewRootImpl() { android.view.View rootViewOfOwner = mOwnerView.getRootView(); if (rootViewOfOwner == null) { return(null); } android.view.ViewParent parentOfRootView = rootViewOfOwner.getParent(); if (parentOfRootView is android.view.ViewRootImpl) { return((android.view.ViewRootImpl)parentOfRootView); } else { return(null); } }
public virtual void setCurrentTab(int index) { if (index < 0 || index >= mTabSpecs.size()) { return; } if (index == mCurrentTab) { return; } // notify old tab content if (mCurrentTab != -1) { mTabSpecs.get(mCurrentTab).mContentStrategy.tabClosed(); } mCurrentTab = index; android.widget.TabHost.TabSpec spec = mTabSpecs.get(index); // Call the tab widget's focusCurrentTab(), instead of just // selecting the tab. mTabWidget.focusCurrentTab(mCurrentTab); // tab content mCurrentView = spec.mContentStrategy.getContentView(); if (mCurrentView.getParent() == null) { mTabContent.addView(mCurrentView, new android.view.ViewGroup.LayoutParams(android.view.ViewGroup .LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT)); } if (!mTabWidget.hasFocus()) { // if the tab widget didn't take focus (likely because we're in touch mode) // give the current tab content view a shot mCurrentView.requestFocus(); } //mTabContent.requestFocus(View.FOCUS_FORWARD); invokeOnTabChangeListener(); }
public virtual void handleShow() { if (mView != mNextView) { // remove the old view if necessary handleHide(); mView = mNextView; mWM = android.view.WindowManagerImpl.getDefault(); int gravity = mGravity; mParams.gravity = gravity; if ((gravity & android.view.Gravity.HORIZONTAL_GRAVITY_MASK) == android.view.Gravity .FILL_HORIZONTAL) { mParams.horizontalWeight = 1.0f; } if ((gravity & android.view.Gravity.VERTICAL_GRAVITY_MASK) == android.view.Gravity .FILL_VERTICAL) { mParams.verticalWeight = 1.0f; } mParams.x = mX; mParams.y = mY; mParams.verticalMargin = mVerticalMargin; mParams.horizontalMargin = mHorizontalMargin; if (mView.getParent() != null) { mWM.removeView(mView); } mWM.addView(mView, mParams); trySendAccessibilityEvent(); } }
public virtual void setCurrentTab(int index) { if (index < 0 || index >= mTabSpecs.size()) { return; } if (index == mCurrentTab) { return; } // notify old tab content if (mCurrentTab != -1) { mTabSpecs.get(mCurrentTab).mContentStrategy.tabClosed(); } mCurrentTab = index; android.widget.TabHost.TabSpec spec = mTabSpecs.get(index); // Call the tab widget's focusCurrentTab(), instead of just // selecting the tab. mTabWidget.focusCurrentTab(mCurrentTab); // tab content mCurrentView = spec.mContentStrategy.getContentView(); if (mCurrentView.getParent() == null) { mTabContent.addView(mCurrentView, new android.view.ViewGroup.LayoutParams(android.view.ViewGroup .LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT)); } if (!mTabWidget.hasFocus()) { // if the tab widget didn't take focus (likely because we're in touch mode) // give the current tab content view a shot mCurrentView.requestFocus(); } //mTabContent.requestFocus(View.FOCUS_FORWARD); invokeOnTabChangeListener(); }