Example #1
0
        /// <summary>
        /// <p>Creates a new TableLayout for the given context and with the
        /// specified set attributes.</p>
        /// </summary>
        /// <param name="context">the application environment</param>
        /// <param name="attrs">a collection of attributes</param>
        public TableLayout(android.content.Context context, android.util.AttributeSet attrs
                           ) : base(context, attrs)
        {
            android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected]
                                                                              .styleable.TableLayout);
            string stretchedColumns = a.getString([email protected]_stretchColumns
                                                  );

            if (stretchedColumns != null)
            {
                if (stretchedColumns[0] == '*')
                {
                    mStretchAllColumns = true;
                }
                else
                {
                    mStretchableColumns = parseColumns(stretchedColumns);
                }
            }
            string shrinkedColumns = a.getString([email protected]_shrinkColumns
                                                 );

            if (shrinkedColumns != null)
            {
                if (shrinkedColumns[0] == '*')
                {
                    mShrinkAllColumns = true;
                }
                else
                {
                    mShrinkableColumns = parseColumns(shrinkedColumns);
                }
            }
            string collapsedColumns = a.getString([email protected]_collapseColumns
                                                  );

            if (collapsedColumns != null)
            {
                mCollapsedColumns = parseColumns(collapsedColumns);
            }
            a.recycle();
            initTableLayout();
        }
Example #2
0
 /// <summary>Initialize with standard view layout information and style.</summary>
 /// <remarks>
 /// Initialize with standard view layout information and style.
 /// Sets the base to the current time.
 /// </remarks>
 public Chronometer(android.content.Context context, android.util.AttributeSet attrs
                    , int defStyle) : base(context, attrs, defStyle)
 {
     mHandler = new _Handler_264(this);
     android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected]
                                                                       .styleable.Chronometer, defStyle, 0);
     setFormat(a.getString([email protected]_format));
     a.recycle();
     init();
 }
Example #3
0
        /// <summary>
        /// Construct a new spinner with the given context's theme, the supplied attribute set,
        /// and default style.
        /// </summary>
        /// <remarks>
        /// Construct a new spinner with the given context's theme, the supplied attribute set,
        /// and default style. <code>mode</code> may be one of
        /// <see cref="MODE_DIALOG">MODE_DIALOG</see>
        /// or
        /// <see cref="MODE_DROPDOWN">MODE_DROPDOWN</see>
        /// and determines how the user will select choices from the spinner.
        /// </remarks>
        /// <param name="context">
        /// The Context the view is running in, through which it can
        /// access the current theme, resources, etc.
        /// </param>
        /// <param name="attrs">The attributes of the XML tag that is inflating the view.</param>
        /// <param name="defStyle">
        /// The default style to apply to this view. If 0, no style
        /// will be applied (beyond what is included in the theme). This may
        /// either be an attribute resource, whose value will be retrieved
        /// from the current theme, or an explicit style resource.
        /// </param>
        /// <param name="mode">Constant describing how the user will select choices from the spinner.
        ///     </param>
        /// <seealso cref="MODE_DIALOG">MODE_DIALOG</seealso>
        /// <seealso cref="MODE_DROPDOWN">MODE_DROPDOWN</seealso>
        public Spinner(android.content.Context context, android.util.AttributeSet attrs,
                       int defStyle, int mode) : base(context, attrs, defStyle)
        {
            // Only measure this many items to get a decent max width.
            android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected]
                                                                              .styleable.Spinner, defStyle, 0);
            if (mode == MODE_THEME)
            {
                mode = a.getInt([email protected]_spinnerMode, MODE_DIALOG);
            }
            switch (mode)
            {
            case MODE_DIALOG:
            {
                mPopup = new android.widget.Spinner.DialogPopup(this);
                break;
            }

            case MODE_DROPDOWN:
            {
                android.widget.Spinner.DropdownPopup popup = new android.widget.Spinner.DropdownPopup
                                                                 (this, context, attrs, defStyle);
                mDropDownWidth = a.getLayoutDimension([email protected]_dropDownWidth
                                                      , android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
                popup.setBackgroundDrawable(a.getDrawable([email protected]_popupBackground
                                                          ));
                int verticalOffset = a.getDimensionPixelOffset([email protected]_dropDownVerticalOffset
                                                               , 0);
                if (verticalOffset != 0)
                {
                    popup.setVerticalOffset(verticalOffset);
                }
                int horizontalOffset = a.getDimensionPixelOffset([email protected]_dropDownHorizontalOffset
                                                                 , 0);
                if (horizontalOffset != 0)
                {
                    popup.setHorizontalOffset(horizontalOffset);
                }
                mPopup = popup;
                break;
            }
            }
            mGravity = a.getInt([email protected]_gravity, android.view.Gravity
                                .CENTER);
            mPopup.setPromptText(java.lang.CharSequenceProxy.Wrap(a.getString([email protected]
                                                                              .styleable.Spinner_prompt)));
            a.recycle();
            // Base constructor can call setAdapter before we initialize mPopup.
            // Finish setting things up if this happened.
            if (mTempAdapter != null)
            {
                mPopup.setAdapter(mTempAdapter);
                mTempAdapter = null;
            }
        }
Example #4
0
        /// <exception cref="android.content.res.Resources.NotFoundException"></exception>
        private static android.animation.ObjectAnimator loadObjectAnimator(android.content.Context
                                                                           context, android.util.AttributeSet attrs)
        {
            android.animation.ObjectAnimator anim = new android.animation.ObjectAnimator();
            loadAnimator(context, attrs, anim);
            android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected]
                                                                              .styleable.PropertyAnimator);
            string propertyName = a.getString([email protected]_propertyName
                                              );

            anim.setPropertyName(propertyName);
            a.recycle();
            return(anim);
        }
Example #5
0
        private static float getPercent(android.content.res.TypedArray a, int name)
        {
            string s = a.getString(name);

            if (s != null)
            {
                if (s.EndsWith("%"))
                {
                    string f = Sharpen.StringHelper.Substring(s, 0, s.Length - 1);
                    return(float.Parse(f) / 100.0f);
                }
            }
            return(-1);
        }