Exemplo n.º 1
0
        /// <summary>
        /// Helper for makeAndAddView to set the position of a view
        /// and fill out its layout paramters.
        /// </summary>
        /// <remarks>
        /// Helper for makeAndAddView to set the position of a view
        /// and fill out its layout paramters.
        /// </remarks>
        /// <param name="child">The view to position</param>
        private void setUpChild(android.view.View child)
        {
            // Respect layout params that are already in the view. Otherwise
            // make some up...
            android.view.ViewGroup.LayoutParams lp = child.getLayoutParams();
            if (lp == null)
            {
                lp = generateDefaultLayoutParams();
            }
            addViewInLayout(child, 0, lp);
            child.setSelected(hasFocus());
            // Get measure specs
            int childHeightSpec = android.view.ViewGroup.getChildMeasureSpec(mHeightMeasureSpec
                                                                             , mSpinnerPadding.top + mSpinnerPadding.bottom, lp.height);
            int childWidthSpec = android.view.ViewGroup.getChildMeasureSpec(mWidthMeasureSpec
                                                                            , mSpinnerPadding.left + mSpinnerPadding.right, lp.width);

            // Measure child
            child.measure(childWidthSpec, childHeightSpec);
            int childLeft;
            int childRight;
            // Position vertically based on gravity setting
            int childTop = mSpinnerPadding.top + ((getMeasuredHeight() - mSpinnerPadding.bottom
                                                   - mSpinnerPadding.top - child.getMeasuredHeight()) / 2);
            int childBottom = childTop + child.getMeasuredHeight();
            int width       = child.getMeasuredWidth();

            childLeft  = 0;
            childRight = childLeft + width;
            child.layout(childLeft, childTop, childRight, childBottom);
        }
Exemplo n.º 2
0
 public override void addView(android.view.View child, int index, android.view.ViewGroup
                              .LayoutParams @params)
 {
     if (!(child is android.widget.TextView))
     {
         throw new System.ArgumentException("TextSwitcher children must be instances of TextView"
                                            );
     }
     base.addView(child, index, @params);
 }
Exemplo n.º 3
0
 public override void addView(android.view.View child, int index, android.view.ViewGroup
                              .LayoutParams @params)
 {
     if (getChildCount() >= 2)
     {
         throw new System.InvalidOperationException("Can't add more than 2 views to a ViewSwitcher"
                                                    );
     }
     base.addView(child, index, @params);
 }
Exemplo n.º 4
0
 void android.view.ViewManager.updateViewLayout(android.view.View arg0, android.view.ViewGroup.LayoutParams arg1)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         @__env.CallVoidMethod(this.JvmHandle, global::android.view.ViewManager_._updateViewLayout9626, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
     }
     else
     {
         @__env.CallNonVirtualVoidMethod(this.JvmHandle, global::android.view.ViewManager_.staticClass, global::android.view.ViewManager_._updateViewLayout9626, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
     }
 }
Exemplo n.º 5
0
 protected override bool checkLayoutParams(android.view.ViewGroup.LayoutParams arg0)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         return(@__env.CallBooleanMethod(this.JvmHandle, global::android.widget.RelativeLayout._checkLayoutParams11767, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0)));
     }
     else
     {
         return(@__env.CallNonVirtualBooleanMethod(this.JvmHandle, global::android.widget.RelativeLayout.staticClass, global::android.widget.RelativeLayout._checkLayoutParams11767, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0)));
     }
 }
Exemplo n.º 6
0
 public override void addView(android.view.View arg0, int arg1, android.view.ViewGroup.LayoutParams arg2)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         @__env.CallVoidMethod(this.JvmHandle, global::android.widget.RadioGroup._addView11725, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2));
     }
     else
     {
         @__env.CallNonVirtualVoidMethod(this.JvmHandle, global::android.widget.RadioGroup.staticClass, global::android.widget.RadioGroup._addView11725, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2));
     }
 }
Exemplo n.º 7
0
 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;
 }
        protected internal override long getDelayForView(android.view.View view)
        {
            android.view.ViewGroup.LayoutParams lp = view.getLayoutParams();
            android.view.animation.GridLayoutAnimationController.AnimationParameters @params =
                (android.view.animation.GridLayoutAnimationController.AnimationParameters)lp.layoutAnimationParameters;
            if (@params == null)
            {
                return(0);
            }
            int   column       = getTransformedColumnIndex(@params);
            int   row          = getTransformedRowIndex(@params);
            int   rowsCount    = @params.rowsCount;
            int   columnsCount = @params.columnsCount;
            long  duration     = mAnimation.getDuration();
            float columnDelay  = mColumnDelay * duration;
            float rowDelay     = mRowDelay * duration;
            float totalDelay;
            long  viewDelay;

            if (mInterpolator == null)
            {
                mInterpolator = new android.view.animation.LinearInterpolator();
            }
            switch (mDirectionPriority)
            {
            case PRIORITY_COLUMN:
            {
                viewDelay  = (long)(row * rowDelay + column * rowsCount * rowDelay);
                totalDelay = rowsCount * rowDelay + columnsCount * rowsCount * rowDelay;
                break;
            }

            case PRIORITY_ROW:
            {
                viewDelay  = (long)(column * columnDelay + row * columnsCount * columnDelay);
                totalDelay = columnsCount * columnDelay + rowsCount * columnsCount * columnDelay;
                break;
            }

            case PRIORITY_NONE:
            default:
            {
                viewDelay  = (long)(column * columnDelay + row * rowDelay);
                totalDelay = columnsCount * columnDelay + rowsCount * rowDelay;
                break;
            }
            }
            float normalizedDelay = viewDelay / totalDelay;

            normalizedDelay = mInterpolator.getInterpolation(normalizedDelay);
            return((long)(normalizedDelay * totalDelay));
        }
Exemplo n.º 9
0
 public override void addView(android.view.View child, int index, android.view.ViewGroup
                              .LayoutParams @params)
 {
     base.addView(child, index, @params);
     if (getChildCount() == 1)
     {
         child.setVisibility(android.view.View.VISIBLE);
     }
     else
     {
         child.setVisibility(android.view.View.GONE);
     }
 }
Exemplo n.º 10
0
 protected internal override android.view.ViewGroup.LayoutParams generateLayoutParams
     (android.view.ViewGroup.LayoutParams p)
 {
     if (p is [email protected])
     {
         [email protected] result = new [email protected]
                                                                          .LayoutParams(([email protected])p);
         if (result.gravity <= android.view.Gravity.NO_GRAVITY)
         {
             result.gravity = android.view.Gravity.CENTER_VERTICAL;
         }
         return(result);
     }
     return(([email protected])generateDefaultLayoutParams
                ());
 }
Exemplo n.º 11
0
 protected internal override void onMeasure(int widthMeasureSpec, int heightMeasureSpec
                                            )
 {
     if (mIconView != null && mPreserveIconSpacing)
     {
         // Enforce minimum icon spacing
         android.view.ViewGroup.LayoutParams      lp     = getLayoutParams();
         android.widget.LinearLayout.LayoutParams iconLp = (android.widget.LinearLayout.LayoutParams
                                                            )mIconView.getLayoutParams();
         if (lp.height > 0 && iconLp.width <= 0)
         {
             iconLp.width = lp.height;
         }
     }
     base.onMeasure(widthMeasureSpec, heightMeasureSpec);
 }
Exemplo n.º 12
0
 public virtual void setTabContainer([email protected]
                                     tabView)
 {
     if (mTabContainer != null)
     {
         removeView(mTabContainer);
     }
     mTabContainer = tabView;
     if (tabView != null)
     {
         addView(tabView);
         android.view.ViewGroup.LayoutParams lp = tabView.getLayoutParams();
         lp.width  = android.view.ViewGroup.LayoutParams.MATCH_PARENT;
         lp.height = android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
         tabView.setAllowCollapse(false);
     }
 }
Exemplo n.º 13
0
 public override void setSplitActionBar(bool split)
 {
     if (mSplitActionBar != split)
     {
         if (mActionMenuPresenter != null)
         {
             // Mode is already active; move everything over and adjust the menu itself.
             android.view.ViewGroup.LayoutParams layoutParams = new android.view.ViewGroup.LayoutParams
                                                                    (android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams
                                                                    .MATCH_PARENT);
             if (!split)
             {
                 mMenuView = ([email protected])mActionMenuPresenter.getMenuView
                                 (this);
                 mMenuView.setBackgroundDrawable(null);
                 android.view.ViewGroup oldParent = (android.view.ViewGroup)mMenuView.getParent();
                 if (oldParent != null)
                 {
                     oldParent.removeView(mMenuView);
                 }
                 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;
                 mMenuView           = ([email protected])mActionMenuPresenter.getMenuView
                                           (this);
                 mMenuView.setBackgroundDrawable(mSplitBackground);
                 android.view.ViewGroup oldParent = (android.view.ViewGroup)mMenuView.getParent();
                 if (oldParent != null)
                 {
                     oldParent.removeView(mMenuView);
                 }
                 mSplitView.addView(mMenuView, layoutParams);
             }
         }
         base.setSplitActionBar(split);
     }
 }
Exemplo n.º 14
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);
     }
 }
Exemplo n.º 15
0
 /// <summary>
 /// Inflates the layout resource identified by
 /// <see cref="getLayoutResource()">getLayoutResource()</see>
 /// and replaces this StubbedView in its parent by the inflated layout resource.
 /// </summary>
 /// <returns>The inflated layout resource.</returns>
 public android.view.View inflate()
 {
     android.view.ViewParent viewParent = getParent();
     if (viewParent != null && viewParent is android.view.ViewGroup)
     {
         if (mLayoutResource != 0)
         {
             android.view.ViewGroup      parent  = (android.view.ViewGroup)viewParent;
             android.view.LayoutInflater factory = android.view.LayoutInflater.from(mContext);
             android.view.View           view    = factory.inflate(mLayoutResource, parent, false);
             if (mInflatedId != NO_ID)
             {
                 view.setId(mInflatedId);
             }
             int index = parent.indexOfChild(this);
             parent.removeViewInLayout(this);
             android.view.ViewGroup.LayoutParams layoutParams = getLayoutParams();
             if (layoutParams != null)
             {
                 parent.addView(view, index, layoutParams);
             }
             else
             {
                 parent.addView(view, index);
             }
             mInflatedViewRef = new [email protected] <android.view.View>(view);
             if (mInflateListener != null)
             {
                 mInflateListener.onInflate(this, view);
             }
             return(view);
         }
         else
         {
             throw new System.ArgumentException("ViewStub must have a valid layoutResource");
         }
     }
     else
     {
         throw new System.InvalidOperationException("ViewStub must have a non-null ViewGroup viewParent"
                                                    );
     }
 }
Exemplo n.º 16
0
 public override void addView(android.view.View child, int index, android.view.ViewGroup
                              .LayoutParams @params)
 {
     if (child is android.widget.RadioButton)
     {
         android.widget.RadioButton button = (android.widget.RadioButton)child;
         if (button.isChecked())
         {
             mProtectFromCheckedChange = true;
             if (mCheckedId != -1)
             {
                 setCheckedStateForView(mCheckedId, false);
             }
             mProtectFromCheckedChange = false;
             setCheckedId(button.getId());
         }
     }
     base.addView(child, index, @params);
 }
        /// <summary>
        /// Returns the amount of milliseconds by which the specified view's
        /// animation must be delayed or offset.
        /// </summary>
        /// <remarks>
        /// Returns the amount of milliseconds by which the specified view's
        /// animation must be delayed or offset. Subclasses should override this
        /// method to return a suitable value.
        /// This implementation returns <code>child animation delay</code>
        /// milliseconds where:
        /// <pre>
        /// child animation delay = child index * delay
        /// </pre>
        /// The index is retrieved from the
        /// <see cref="AnimationParameters">AnimationParameters</see>
        /// found in the view's
        /// <see cref="android.view.ViewGroup.LayoutParams">android.view.ViewGroup.LayoutParams
        ///     </see>
        /// .
        /// </remarks>
        /// <param name="view">the view for which to obtain the animation's delay</param>
        /// <returns>a delay in milliseconds</returns>
        /// <seealso cref="getAnimationForView(android.view.View)">getAnimationForView(android.view.View)
        ///     </seealso>
        /// <seealso cref="getDelay()">getDelay()</seealso>
        /// <seealso cref="getTransformedIndex(AnimationParameters)">getTransformedIndex(AnimationParameters)
        ///     </seealso>
        /// <seealso cref="android.view.ViewGroup.LayoutParams">android.view.ViewGroup.LayoutParams
        ///     </seealso>
        protected internal virtual long getDelayForView(android.view.View view)
        {
            android.view.ViewGroup.LayoutParams lp = view.getLayoutParams();
            android.view.animation.LayoutAnimationController.AnimationParameters @params = lp
                                                                                           .layoutAnimationParameters;
            if (@params == null)
            {
                return(0);
            }
            float delay      = mDelay * mAnimation.getDuration();
            long  viewDelay  = (long)(getTransformedIndex(@params) * delay);
            float totalDelay = delay * @params.count;

            if (mInterpolator == null)
            {
                mInterpolator = new android.view.animation.LinearInterpolator();
            }
            float normalizedDelay = viewDelay / totalDelay;

            normalizedDelay = mInterpolator.getInterpolation(normalizedDelay);
            return((long)(normalizedDelay * totalDelay));
        }
Exemplo n.º 18
0
        public override void addView(android.view.View child, int index, android.view.ViewGroup
                                     .LayoutParams @params)
        {
            base.addView(child, index, @params);
            int childId = child.getId();

            if (childId == CHRONOMETER_ID && child is android.widget.Chronometer)
            {
                mChronometer = (android.widget.Chronometer)child;
                mChronometer.setOnChronometerTickListener(this);
                // Check if Chronometer should move with with ProgressBar
                mChronometerFollow = (@params.width == android.view.ViewGroup.LayoutParams.WRAP_CONTENT
                                      );
                mChronometerGravity = (mChronometer.getGravity() & android.view.Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK
                                       );
            }
            else
            {
                if (childId == PROGRESSBAR_ID && child is android.widget.ProgressBar)
                {
                    mProgressBar = (android.widget.ProgressBar)child;
                }
            }
        }
Exemplo n.º 19
0
 public override android.view.View getItemView([email protected]
                                               item, android.view.View convertView, android.view.ViewGroup parent)
 {
     android.view.View actionView = item.getActionView();
     if (actionView == null || item.hasCollapsibleActionView())
     {
         if (!(convertView is [email protected]))
         {
             convertView = null;
         }
         actionView = base.getItemView(item, convertView, parent);
     }
     actionView.setVisibility(item.isActionViewExpanded() ? android.view.View.GONE : android.view.View
                              .VISIBLE);
     [email protected] menuParent = ([email protected]
                                                              )parent;
     android.view.ViewGroup.LayoutParams lp = actionView.getLayoutParams();
     if (!menuParent.checkLayoutParams(lp))
     {
         actionView.setLayoutParams((([email protected]
                                      )menuParent.generateLayoutParams(lp)));
     }
     return(actionView);
 }
Exemplo n.º 20
0
		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;
		}
Exemplo n.º 21
0
 protected internal override bool checkLayoutParams(android.view.ViewGroup.LayoutParams
                                                    p)
 {
     return(p != null && p is [email protected]);
 }
Exemplo n.º 22
0
 public virtual void addContentView(android.view.View view, android.view.ViewGroup
                                    .LayoutParams @params)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 23
0
 public LayoutParams(android.view.ViewGroup.LayoutParams source) : base(source)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 24
0
 protected override global::android.view.ViewGroup.LayoutParams generateLayoutParams(android.view.ViewGroup.LayoutParams arg0)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         return(global::MonoJavaBridge.JavaBridge.WrapJavaObject(@__env.CallObjectMethod(this.JvmHandle, global::android.widget.RelativeLayout._generateLayoutParams11769, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0))) as android.view.ViewGroup.LayoutParams);
     }
     else
     {
         return(global::MonoJavaBridge.JavaBridge.WrapJavaObject(@__env.CallNonVirtualObjectMethod(this.JvmHandle, global::android.widget.RelativeLayout.staticClass, global::android.widget.RelativeLayout._generateLayoutParams11769, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0))) as android.view.ViewGroup.LayoutParams);
     }
 }
Exemplo n.º 25
0
		public override void setSplitActionBar(bool split)
		{
			if (mSplitActionBar != split)
			{
				if (mActionMenuPresenter != null)
				{
					// Mode is already active; move everything over and adjust the menu itself.
					android.view.ViewGroup.LayoutParams layoutParams = new android.view.ViewGroup.LayoutParams
						(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams
						.MATCH_PARENT);
					if (!split)
					{
						mMenuView = ([email protected])mActionMenuPresenter.getMenuView
							(this);
						mMenuView.setBackgroundDrawable(null);
						android.view.ViewGroup oldParent = (android.view.ViewGroup)mMenuView.getParent();
						if (oldParent != null)
						{
							oldParent.removeView(mMenuView);
						}
						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;
						mMenuView = ([email protected])mActionMenuPresenter.getMenuView
							(this);
						mMenuView.setBackgroundDrawable(mSplitBackground);
						android.view.ViewGroup oldParent = (android.view.ViewGroup)mMenuView.getParent();
						if (oldParent != null)
						{
							oldParent.removeView(mMenuView);
						}
						mSplitView.addView(mMenuView, layoutParams);
					}
				}
				base.setSplitActionBar(split);
			}
		}
Exemplo n.º 26
0
 public LayoutParams(android.view.ViewGroup.LayoutParams arg0)  : base(global::MonoJavaBridge.JNIEnv.ThreadEnv)
 {
     global::MonoJavaBridge.JNIEnv         @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     global::MonoJavaBridge.JniLocalHandle handle = @__env.NewObject(android.widget.RelativeLayout.LayoutParams.staticClass, global::android.widget.RelativeLayout.LayoutParams._LayoutParams11758, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
     Init(@__env, handle);
 }
Exemplo n.º 27
0
 /// <summary><p>Finds the largest cell in each column.</summary>
 /// <remarks>
 /// <p>Finds the largest cell in each column. For each column, the width of
 /// the largest cell is applied to all the other cells.</p>
 /// </remarks>
 /// <param name="widthMeasureSpec">the measure constraint imposed by our parent</param>
 private void findLargestCells(int widthMeasureSpec)
 {
     bool firstRow = true;
     // find the maximum width for each column
     // the total number of columns is dynamically changed if we find
     // wider rows as we go through the children
     // the array is reused for each layout operation; the array can grow
     // but never shrinks. Unused extra cells in the array are just ignored
     // this behavior avoids to unnecessary grow the array after the first
     // layout operation
     int count = getChildCount();
     {
         for (int i = 0; i < count; i++)
         {
             android.view.View child = getChildAt(i);
             if (child.getVisibility() == GONE)
             {
                 continue;
             }
             if (child is android.widget.TableRow)
             {
                 android.widget.TableRow row = (android.widget.TableRow)child;
                 // forces the row's height
                 android.view.ViewGroup.LayoutParams layoutParams = row.getLayoutParams();
                 layoutParams.height = android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
                 int[] widths    = row.getColumnsWidths(widthMeasureSpec);
                 int   newLength = widths.Length;
                 // this is the first row, we just need to copy the values
                 if (firstRow)
                 {
                     if (mMaxWidths == null || mMaxWidths.Length != newLength)
                     {
                         mMaxWidths = new int[newLength];
                     }
                     System.Array.Copy(widths, 0, mMaxWidths, 0, newLength);
                     firstRow = false;
                 }
                 else
                 {
                     int length     = mMaxWidths.Length;
                     int difference = newLength - length;
                     // the current row is wider than the previous rows, so
                     // we just grow the array and copy the values
                     if (difference > 0)
                     {
                         int[] oldMaxWidths = mMaxWidths;
                         mMaxWidths = new int[newLength];
                         System.Array.Copy(oldMaxWidths, 0, mMaxWidths, 0, oldMaxWidths.Length);
                         System.Array.Copy(widths, oldMaxWidths.Length, mMaxWidths, oldMaxWidths.Length, difference
                                           );
                     }
                     // the row is narrower or of the same width as the previous
                     // rows, so we find the maximum width for each column
                     // if the row is narrower than the previous ones,
                     // difference will be negative
                     int[] maxWidths = mMaxWidths;
                     length = System.Math.Min(length, newLength);
                     {
                         for (int j = 0; j < length; j++)
                         {
                             maxWidths[j] = System.Math.Max(maxWidths[j], widths[j]);
                         }
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 28
0
 /// <summary><inheritDoc></inheritDoc></summary>
 public LayoutParams(android.view.ViewGroup.LayoutParams source) : base(source)
 {
 }
Exemplo n.º 29
0
 protected internal override android.view.ViewGroup.LayoutParams generateLayoutParams
     (android.view.ViewGroup.LayoutParams p)
 {
     return(new android.widget.AbsoluteLayout.LayoutParams(p));
 }
Exemplo n.º 30
0
 protected internal override bool checkLayoutParams(android.view.ViewGroup.LayoutParams
                                                    p)
 {
     return(p is android.widget.AbsoluteLayout.LayoutParams);
 }
Exemplo n.º 31
0
 /// <summary><inheritDoc></inheritDoc></summary>
 public LayoutParams(android.view.ViewGroup.LayoutParams p) : base(p)
 {
 }
Exemplo n.º 32
0
        protected internal override void onMeasure(int widthMeasureSpec, int heightMeasureSpec
                                                   )
        {
            int widthMode = android.view.View.MeasureSpec.getMode(widthMeasureSpec);

            if (widthMode != android.view.View.MeasureSpec.EXACTLY)
            {
                throw new System.InvalidOperationException(GetType().Name + " can only be used "
                                                           + "with android:layout_width=\"match_parent\" (or fill_parent)");
            }
            int heightMode = android.view.View.MeasureSpec.getMode(heightMeasureSpec);

            if (heightMode == android.view.View.MeasureSpec.UNSPECIFIED)
            {
                throw new System.InvalidOperationException(GetType().Name + " can only be used "
                                                           + "with android:layout_height=\"wrap_content\"");
            }
            int contentWidth = android.view.View.MeasureSpec.getSize(widthMeasureSpec);
            int maxHeight    = mContentHeight > 0 ? mContentHeight : android.view.View.MeasureSpec
                               .getSize(heightMeasureSpec);
            int verticalPadding = getPaddingTop() + getPaddingBottom();
            int availableWidth  = contentWidth - getPaddingLeft() - getPaddingRight();
            int height          = maxHeight - verticalPadding;
            int childSpecHeight = android.view.View.MeasureSpec.makeMeasureSpec(height, android.view.View
                                                                                .MeasureSpec.AT_MOST);

            if (mClose != null)
            {
                availableWidth = measureChildView(mClose, availableWidth, childSpecHeight, 0);
                android.view.ViewGroup.MarginLayoutParams lp = (android.view.ViewGroup.MarginLayoutParams
                                                                )mClose.getLayoutParams();
                availableWidth -= lp.leftMargin + lp.rightMargin;
            }
            if (mMenuView != null && mMenuView.getParent() == this)
            {
                availableWidth = measureChildView(mMenuView, availableWidth, childSpecHeight, 0);
            }
            if (mTitleLayout != null && mCustomView == null)
            {
                availableWidth = measureChildView(mTitleLayout, availableWidth, childSpecHeight,
                                                  0);
            }
            if (mCustomView != null)
            {
                android.view.ViewGroup.LayoutParams lp = mCustomView.getLayoutParams();
                int customWidthMode = lp.width != android.view.ViewGroup.LayoutParams.WRAP_CONTENT
                                         ? android.view.View.MeasureSpec.EXACTLY : android.view.View.MeasureSpec.AT_MOST;
                int customWidth      = lp.width >= 0 ? System.Math.Min(lp.width, availableWidth) : availableWidth;
                int customHeightMode = lp.height != android.view.ViewGroup.LayoutParams.WRAP_CONTENT
                                         ? android.view.View.MeasureSpec.EXACTLY : android.view.View.MeasureSpec.AT_MOST;
                int customHeight = lp.height >= 0 ? System.Math.Min(lp.height, height) : height;
                mCustomView.measure(android.view.View.MeasureSpec.makeMeasureSpec(customWidth, customWidthMode
                                                                                  ), android.view.View.MeasureSpec.makeMeasureSpec(customHeight, customHeightMode)
                                    );
            }
            if (mContentHeight <= 0)
            {
                int measuredHeight = 0;
                int count          = getChildCount();
                {
                    for (int i = 0; i < count; i++)
                    {
                        android.view.View v  = getChildAt(i);
                        int paddedViewHeight = v.getMeasuredHeight() + verticalPadding;
                        if (paddedViewHeight > measuredHeight)
                        {
                            measuredHeight = paddedViewHeight;
                        }
                    }
                }
                setMeasuredDimension(contentWidth, measuredHeight);
            }
            else
            {
                setMeasuredDimension(contentWidth, maxHeight);
            }
        }