/// <summary>Instantiates the IconMenuView that is linked with the provided MenuBuilder. /// </summary> /// <remarks>Instantiates the IconMenuView that is linked with the provided MenuBuilder. /// </remarks> public IconMenuView(android.content.Context context, android.util.AttributeSet attrs ) : base(context, attrs) { android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected] .styleable.IconMenuView, 0, 0); mRowHeight = a.getDimensionPixelSize([email protected]_rowHeight , 64); mMaxRows = a.getInt([email protected]_maxRows, 2); mMaxItems = a.getInt([email protected]_maxItems, 6); mMaxItemsPerRow = a.getInt([email protected]_maxItemsPerRow , 3); mMoreIcon = a.getDrawable([email protected]_moreIcon); a.recycle(); a = context.obtainStyledAttributes(attrs, [email protected], 0, 0); mItemBackground = a.getDrawable([email protected]_itemBackground ); mHorizontalDivider = a.getDrawable([email protected]_horizontalDivider ); mHorizontalDividerRects = new java.util.ArrayList <android.graphics.Rect>(); mVerticalDivider = a.getDrawable([email protected]_verticalDivider ); mVerticalDividerRects = new java.util.ArrayList <android.graphics.Rect>(); mAnimations = a.getResourceId([email protected]_windowAnimationStyle , 0); a.recycle(); if (mHorizontalDivider != null) { mHorizontalDividerHeight = mHorizontalDivider.getIntrinsicHeight(); // Make sure to have some height for the divider if (mHorizontalDividerHeight == -1) { mHorizontalDividerHeight = 1; } } if (mVerticalDivider != null) { mVerticalDividerWidth = mVerticalDivider.getIntrinsicWidth(); // Make sure to have some width for the divider if (mVerticalDividerWidth == -1) { mVerticalDividerWidth = 1; } } mLayout = new int[mMaxRows]; // This view will be drawing the dividers setWillNotDraw(false); // This is so we'll receive the MENU key in touch mode setFocusableInTouchMode(true); // This is so our children can still be arrow-key focused setDescendantFocusability(FOCUS_AFTER_DESCENDANTS); }
public RatingBar(android.content.Context context, android.util.AttributeSet attrs , int defStyle) : base(context, attrs, defStyle) { android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected] .styleable.RatingBar, defStyle, 0); int numStars = a.getInt([email protected]_numStars, mNumStars ); setIsIndicator(a.getBoolean([email protected]_isIndicator, !mIsUserSeekable)); float rating = a.getFloat([email protected]_rating, -1); float stepSize = a.getFloat([email protected]_stepSize, -1); a.recycle(); if (numStars > 0 && numStars != mNumStars) { setNumStars(numStars); } if (stepSize >= 0) { setStepSize(stepSize); } else { setStepSize(0.5f); } if (rating >= 0) { setRating(rating); } // A touch inside a star fill up to that fractional area (slightly more // than 1 so boundaries round up). mTouchProgressOffset = 1.1f; }
/// <summary>Constructor used when an AnimationSet is loaded from a resource.</summary> /// <remarks>Constructor used when an AnimationSet is loaded from a resource.</remarks> /// <param name="context">Application context to use</param> /// <param name="attrs">Attribute set from which to read values</param> public AnimationSet(android.content.Context context, android.util.AttributeSet attrs ) : base(context, attrs) { android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected] .styleable.AnimationSet); setFlag(PROPERTY_SHARE_INTERPOLATOR_MASK, a.getBoolean([email protected] .AnimationSet_shareInterpolator, true)); init(); if (context.getApplicationInfo().targetSdkVersion >= android.os.Build.VERSION_CODES .ICE_CREAM_SANDWICH) { if (a.hasValue([email protected]_duration)) { mFlags |= PROPERTY_DURATION_MASK; } if (a.hasValue([email protected]_fillBefore)) { mFlags |= PROPERTY_FILL_BEFORE_MASK; } if (a.hasValue([email protected]_fillAfter)) { mFlags |= PROPERTY_FILL_AFTER_MASK; } if (a.hasValue([email protected]_repeatMode)) { mFlags |= PROPERTY_REPEAT_MODE_MASK; } if (a.hasValue([email protected]_startOffset)) { mFlags |= PROPERTY_START_OFFSET_MASK; } } a.recycle(); }
/// <summary>Creates a new layout animation controller from external resources.</summary> /// <remarks>Creates a new layout animation controller from external resources.</remarks> /// <param name="context"> /// the Context the view group is running in, through which /// it can access the resources /// </param> /// <param name="attrs"> /// the attributes of the XML tag that is inflating the /// layout animation controller /// </param> public LayoutAnimationController(android.content.Context context, android.util.AttributeSet attrs) { android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected] .styleable.LayoutAnimation); android.view.animation.Animation.Description d = android.view.animation.Animation .Description.parseValue(a.peekValue([email protected]_delay )); mDelay = d.value; mOrder = a.getInt([email protected]_animationOrder, ORDER_NORMAL ); int resource = a.getResourceId([email protected]_animation , 0); if (resource > 0) { setAnimation(context, resource); } resource = a.getResourceId([email protected]_interpolator , 0); if (resource > 0) { setInterpolator(context, resource); } a.recycle(); }
public ViewStub(android.content.Context context, android.util.AttributeSet attrs, int defStyle) { android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected] .styleable.ViewStub, defStyle, 0); mInflatedId = a.getResourceId([email protected]_inflatedId, NO_ID); mLayoutResource = a.getResourceId([email protected]_layout, 0); a.recycle(); a = context.obtainStyledAttributes(attrs, [email protected], defStyle , 0); mID = a.getResourceId([email protected]_id, NO_ID); a.recycle(); initialize(context); }
public ViewAnimator(android.content.Context context, android.util.AttributeSet attrs ) : base(context, attrs) { android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected] .styleable.ViewAnimator); int resource = a.getResourceId([email protected]_inAnimation , 0); if (resource > 0) { setInAnimation(context, resource); } resource = a.getResourceId([email protected]_outAnimation , 0); if (resource > 0) { setOutAnimation(context, resource); } bool flag = a.getBoolean([email protected]_animateFirstView , true); setAnimateFirstView(flag); a.recycle(); initViewAnimator(context, attrs); }
protected internal override bool inflateTag(string name, android.content.res.Resources r, org.xmlpull.v1.XmlPullParser parser, android.util.AttributeSet attrs) { if (name.Equals("corners")) { android.content.res.TypedArray a = r.obtainAttributes(attrs, [email protected]. styleable.DrawableCorners); int radius = a.getDimensionPixelSize([email protected]_radius , 0); setCornerRadius(radius); // now check of they have any per-corner radii int topLeftRadius = a.getDimensionPixelSize([email protected]_topLeftRadius , radius); int topRightRadius = a.getDimensionPixelSize([email protected]_topRightRadius , radius); int bottomLeftRadius = a.getDimensionPixelSize([email protected]_bottomLeftRadius , radius); int bottomRightRadius = a.getDimensionPixelSize([email protected]_bottomRightRadius , radius); if (topLeftRadius != radius || topRightRadius != radius || bottomLeftRadius != radius || bottomRightRadius != radius) { setCornerRadii(new float[] { topLeftRadius, topLeftRadius, topRightRadius, topRightRadius , bottomLeftRadius, bottomLeftRadius, bottomRightRadius, bottomRightRadius }); } a.recycle(); return(true); } return(base.inflateTag(name, r, parser, attrs)); }
protected internal override void onMeasure(int widthMeasureSpec, int heightMeasureSpec ) { base.onMeasure(widthMeasureSpec, heightMeasureSpec); android.text.Layout layout_1 = getLayout(); if (layout_1 != null) { int lineCount = layout_1.getLineCount(); if (lineCount > 0) { int ellipsisCount = layout_1.getEllipsisCount(lineCount - 1); if (ellipsisCount > 0) { setSingleLine(false); setMaxLines(2); android.content.res.TypedArray a = mContext.obtainStyledAttributes(null, android.R .styleable.TextAppearance, android.R.attr.textAppearanceMedium, android.R.style. TextAppearance_Medium); int textSize = a.getDimensionPixelSize(android.R.styleable.TextAppearance_textSize , 0); if (textSize != 0) { // textSize is already expressed in pixels setTextSize(android.util.TypedValue.COMPLEX_UNIT_PX, textSize); } a.recycle(); base.onMeasure(widthMeasureSpec, heightMeasureSpec); } } } }
public TwoLineListItem(android.content.Context context, android.util.AttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected] .styleable.TwoLineListItem, defStyle, 0); a.recycle(); }
public FcRecycleView(Context context, AttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { if (attrs != null) { TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.FcRecycleView, 0, 0); mMaxWidth = array.getLayoutDimension(R.styleable.FcRecycleView_max_width, LayoutParams.MATCH_PARENT); array.recycle(); } }
public KeyButton(Context context, AttributeSet attrs) : base(context, attrs) { TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.KeyButton); mNote = a.getInteger(R.styleable.KeyButton_note, 69); mVelocity = a.getInteger(R.styleable.KeyButton_velocity, 80); a.recycle(); }
public OvershootInterpolator(android.content.Context context, android.util.AttributeSet attrs) { android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected] .styleable.OvershootInterpolator); mTension = a.getFloat([email protected]_tension , 2.0f); a.recycle(); }
/// <summary><inheritDoc></inheritDoc></summary> public LayoutParams(android.content.Context c, android.util.AttributeSet attrs) : base(c, attrs) { android.content.res.TypedArray a = c.obtainStyledAttributes(attrs, [email protected] .styleable.FrameLayout_Layout); gravity = a.getInt([email protected]_Layout_layout_gravity , -1); a.recycle(); }
public CycleInterpolator(android.content.Context context, android.util.AttributeSet attrs) { android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected] .styleable.CycleInterpolator); mCycles = a.getFloat([email protected]_cycles, 1.0f ); a.recycle(); }
public DecelerateInterpolator(android.content.Context context, android.util.AttributeSet attrs) { android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected] .styleable.DecelerateInterpolator); mFactor = a.getFloat([email protected]_factor, 1.0f); a.recycle(); }
public override void inflate(android.content.res.Resources r, org.xmlpull.v1.XmlPullParser parser, android.util.AttributeSet attrs) { base.inflate(r, parser, attrs); int type; int low = 0; int innerDepth = parser.getDepth() + 1; int depth; while ((type = parser.next()) != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT && ((depth = parser.getDepth()) >= innerDepth || type != org.xmlpull.v1.XmlPullParserClass.END_TAG )) { if (type != org.xmlpull.v1.XmlPullParserClass.START_TAG) { continue; } if (depth > innerDepth || !parser.getName().Equals("item")) { continue; } android.content.res.TypedArray a = r.obtainAttributes(attrs, [email protected]. styleable.LevelListDrawableItem); low = a.getInt([email protected]_minLevel, 0); int high = a.getInt([email protected]_maxLevel, 0); int drawableRes = a.getResourceId([email protected]_drawable , 0); a.recycle(); if (high < 0) { throw new org.xmlpull.v1.XmlPullParserException(parser.getPositionDescription() + ": <item> tag requires a 'maxLevel' attribute"); } android.graphics.drawable.Drawable dr; if (drawableRes != 0) { dr = r.getDrawable(drawableRes); } else { while ((type = parser.next()) == org.xmlpull.v1.XmlPullParserClass.TEXT) { } if (type != org.xmlpull.v1.XmlPullParserClass.START_TAG) { throw new org.xmlpull.v1.XmlPullParserException(parser.getPositionDescription() + ": <item> tag requires a 'drawable' attribute or " + "child tag defining a drawable" ); } dr = android.graphics.drawable.Drawable.createFromXmlInner(r, parser, attrs); } mLevelListState.addLevel(low, high, dr); } onLevelChange(getLevel()); }
public override void inflate(android.content.res.Resources r, org.xmlpull.v1.XmlPullParser parser, android.util.AttributeSet attrs) { base.inflate(r, parser, attrs); android.content.res.TypedArray a = r.obtainAttributes(attrs, [email protected]. styleable.NinePatchDrawable); int id = a.getResourceId([email protected]_src, 0); if (id == 0) { throw new org.xmlpull.v1.XmlPullParserException(parser.getPositionDescription() + ": <nine-patch> requires a valid src attribute"); } bool dither = a.getBoolean([email protected]_dither , DEFAULT_DITHER); android.graphics.BitmapFactory.Options options = new android.graphics.BitmapFactory .Options(); if (dither) { options.inDither = false; } options.inScreenDensity = android.util.DisplayMetrics.DENSITY_DEVICE; android.graphics.Rect padding = new android.graphics.Rect(); android.graphics.Bitmap bitmap = null; try { android.util.TypedValue value = new android.util.TypedValue(); java.io.InputStream @is = r.openRawResource(id, value); bitmap = android.graphics.BitmapFactory.decodeResourceStream(r, value, @is, padding , options); @is.close(); } catch (System.IO.IOException) { } // Ignore if (bitmap == null) { throw new org.xmlpull.v1.XmlPullParserException(parser.getPositionDescription() + ": <nine-patch> requires a valid src attribute"); } else { if (bitmap.getNinePatchChunk() == null) { throw new org.xmlpull.v1.XmlPullParserException(parser.getPositionDescription() + ": <nine-patch> requires a valid 9-patch source image"); } } setNinePatchState(new android.graphics.drawable.NinePatchDrawable.NinePatchState( new android.graphics.NinePatch(bitmap, bitmap.getNinePatchChunk(), "XML 9-patch" ), padding, dither), r); mNinePatchState.mTargetDensity = mTargetDensity; a.recycle(); }
/// <summary>Instantiates the ExpandedMenuView that is linked with the provided MenuBuilder. /// </summary> /// <remarks>Instantiates the ExpandedMenuView that is linked with the provided MenuBuilder. /// </remarks> /// <param name="menu">The model for the menu which this MenuView will display</param> public ExpandedMenuView(android.content.Context context, android.util.AttributeSet attrs) : base(context, attrs) { android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected] .styleable.MenuView, 0, 0); mAnimations = a.getResourceId([email protected]_windowAnimationStyle , 0); a.recycle(); setOnItemClickListener(this); }
public AnticipateOvershootInterpolator(android.content.Context context, android.util.AttributeSet attrs) { android.content.res.TypedArray a_1 = context.obtainStyledAttributes(attrs, [email protected] .styleable.AnticipateOvershootInterpolator); mTension = a_1.getFloat([email protected]_tension , 2.0f) * a_1.getFloat([email protected]_extraTension , 1.5f); a_1.recycle(); }
/// <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(); }
/// <summary>Constructor used when an AlphaAnimation is loaded from a resource.</summary> /// <remarks>Constructor used when an AlphaAnimation is loaded from a resource.</remarks> /// <param name="context">Application context to use</param> /// <param name="attrs">Attribute set from which to read values</param> public AlphaAnimation(android.content.Context context, android.util.AttributeSet attrs) : base(context, attrs) { android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected] .styleable.AlphaAnimation); mFromAlpha = a.getFloat([email protected]_fromAlpha, 1.0f ); mToAlpha = a.getFloat([email protected]_toAlpha, 1.0f); a.recycle(); }
/// <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; } }
/// <summary>Creates a new set of layout parameters.</summary> /// <remarks> /// Creates a new set of layout parameters. The values are extracted from /// the supplied attributes set and context. The XML attributes mapped /// to this set of layout parameters are: /// <ul> /// <li><code>layout_x</code>: the X location of the child</li> /// <li><code>layout_y</code>: the Y location of the child</li> /// <li>All the XML attributes from /// <see cref="android.view.ViewGroup.LayoutParams">android.view.ViewGroup.LayoutParams /// </see> /// </li> /// </ul> /// </remarks> /// <param name="c">the application environment</param> /// <param name="attrs"> /// the set of attributes from which to extract the layout /// parameters values /// </param> public LayoutParams(android.content.Context c, android.util.AttributeSet attrs) : base(c, attrs) { android.content.res.TypedArray a = c.obtainStyledAttributes(attrs, [email protected] .styleable.AbsoluteLayout_Layout); x = a.getDimensionPixelOffset([email protected]_Layout_layout_x , 0); y = a.getDimensionPixelOffset([email protected]_Layout_layout_y , 0); a.recycle(); }
public ToggleButton(android.content.Context context, android.util.AttributeSet attrs , int defStyle) : base(context, attrs, defStyle) { android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected] .styleable.ToggleButton, defStyle, 0); mTextOn = a.getText([email protected]_textOn); mTextOff = a.getText([email protected]_textOff); mDisabledAlpha = a.getFloat([email protected]_disabledAlpha , 0.5f); syncTextState(); a.recycle(); }
protected internal override void onConfigurationChanged(android.content.res.Configuration newConfig) { base.onConfigurationChanged(newConfig); // Action bar can change size on configuration changes. // Reread the desired height from the theme-specified style. android.content.res.TypedArray a = getContext().obtainStyledAttributes(null, [email protected] .styleable.ActionBar, [email protected], 0); setContentHeight(a.getLayoutDimension([email protected]_height , 0)); a.recycle(); }
public override void inflate(android.content.res.Resources r, org.xmlpull.v1.XmlPullParser parser, android.util.AttributeSet attrs) { base.inflate(r, parser, attrs); android.content.res.TypedArray a = r.obtainAttributes(attrs, [email protected]. styleable.ColorDrawable); int color = mState.mBaseColor; color = a.getColor([email protected]_color, color); mState.mBaseColor = mState.mUseColor = color; a.recycle(); }
public ViewFlipper(android.content.Context context, android.util.AttributeSet attrs ) : base(context, attrs) { mReceiver = new _BroadcastReceiver_69(this); mHandler = new _Handler_201(this); android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected] .styleable.ViewFlipper); mFlipInterval = a.getInt([email protected]_flipInterval, DEFAULT_INTERVAL); mAutoStart = a.getBoolean([email protected]_autoStart, false ); a.recycle(); }
/// <summary><inheritDoc></inheritDoc></summary> public LayoutParams(android.content.Context c, android.util.AttributeSet attrs) : base(c, attrs) { android.content.res.TypedArray a = c.obtainStyledAttributes(attrs, [email protected] .styleable.TableRow_Cell); column = a.getInt([email protected]_Cell_layout_column, -1); span = a.getInt([email protected]_Cell_layout_span, 1); if (span <= 1) { span = 1; } a.recycle(); }
public ListMenuItemView(android.content.Context context, android.util.AttributeSet attrs, int defStyle) : base(context, attrs) { android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected] .styleable.MenuView, defStyle, 0); mBackground = a.getDrawable([email protected]_itemBackground ); mTextAppearance = a.getResourceId([email protected]_itemTextAppearance , -1); mPreserveIconSpacing = a.getBoolean([email protected]_preserveIconSpacing , false); mTextAppearanceContext = context; a.recycle(); }
public ScrollingTabContainerView(android.content.Context context) : base(context) { mVisAnimListener = new android.widget.@internal.ScrollingTabContainerView.VisibilityAnimListener (this); setHorizontalScrollBarEnabled(false); android.content.res.TypedArray a = getContext().obtainStyledAttributes(null, [email protected] .styleable.ActionBar, [email protected], 0); setContentHeight(a.getLayoutDimension([email protected]_height , 0)); a.recycle(); mTabLayout = createTabLayout(); addView(mTabLayout, new android.view.ViewGroup.LayoutParams(android.view.ViewGroup .LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT)); }