public AnalogClock(android.content.Context context, android.util.AttributeSet attrs , int defStyle) : base(context, attrs, defStyle) { mIntentReceiver = new _BroadcastReceiver_236(this); android.content.res.Resources r = mContext.getResources(); android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected] .styleable.AnalogClock, defStyle, 0); mDial = a.getDrawable([email protected]_dial); if (mDial == null) { mDial = r.getDrawable([email protected]_dial); } mHourHand = a.getDrawable([email protected]_hand_hour); if (mHourHand == null) { mHourHand = r.getDrawable([email protected]_hand_hour); } mMinuteHand = a.getDrawable([email protected]_hand_minute ); if (mMinuteHand == null) { mMinuteHand = r.getDrawable([email protected]_hand_minute); } mCalendar = new android.text.format.Time(); mDialWidth = mDial.getIntrinsicWidth(); mDialHeight = mDial.getIntrinsicHeight(); }
/// <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 TabWidget(android.content.Context context, android.util.AttributeSet attrs , int defStyle) : base(context, attrs, defStyle) { // This value will be set to 0 as soon as the first tab is added to TabHost. // When positive, the widths and heights of tabs will be imposed so that they fit in parent android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected] .styleable.TabWidget, defStyle, 0); setStripEnabled(a.getBoolean(android.R.styleable.TabWidget_tabStripEnabled, true) ); setLeftStripDrawable(a.getDrawable(android.R.styleable.TabWidget_tabStripLeft)); setRightStripDrawable(a.getDrawable(android.R.styleable.TabWidget_tabStripRight)); a.recycle(); initTabWidget(); }
public ActionBarContextView(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.ActionMode, defStyle, 0); setBackgroundDrawable(a.getDrawable([email protected]_background )); mTitleStyleRes = a.getResourceId([email protected]_titleTextStyle , 0); mSubtitleStyleRes = a.getResourceId([email protected]_subtitleTextStyle , 0); mContentHeight = a.getLayoutDimension([email protected]_height , 0); mSplitBackground = a.getDrawable([email protected]_backgroundSplit ); a.recycle(); }
public ActionBarContainer(android.content.Context context, android.util.AttributeSet attrs) : base(context, attrs) { setBackgroundDrawable(null); android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected] .styleable.ActionBar); mBackground = a.getDrawable([email protected]_background); mStackedBackground = a.getDrawable([email protected]_backgroundStacked ); if (getId() == [email protected]_action_bar) { mIsSplit = true; mSplitBackground = a.getDrawable([email protected]_backgroundSplit ); } a.recycle(); setWillNotDraw(mIsSplit ? mSplitBackground == null : mBackground == null && mStackedBackground == null); }
/// <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; } }
private void init(android.content.Context context) { // Get both the scrollbar states drawables android.content.res.TypedArray ta = context.getTheme().obtainStyledAttributes(ATTRS ); useThumbDrawable(context, ta.getDrawable(THUMB_DRAWABLE)); mTrackDrawable = ta.getDrawable(TRACK_DRAWABLE); mOverlayDrawableLeft = ta.getDrawable(PREVIEW_BACKGROUND_LEFT); mOverlayDrawableRight = ta.getDrawable(PREVIEW_BACKGROUND_RIGHT); mOverlayPosition = ta.getInt(OVERLAY_POSITION, OVERLAY_FLOATING); mScrollCompleted = true; getSectionsFromIndexer(); mOverlaySize = context.getResources().getDimensionPixelSize([email protected] .fastscroll_overlay_size); mOverlayPos = new android.graphics.RectF(); mScrollFade = new android.widget.FastScroller.ScrollFade(this); mPaint = new android.graphics.Paint(); mPaint.setAntiAlias(true); mPaint.setTextAlign(android.graphics.Paint.Align.CENTER); mPaint.setTextSize(mOverlaySize / 2); android.content.res.ColorStateList textColor = ta.getColorStateList(TEXT_COLOR); int textColorNormal = textColor.getDefaultColor(); mPaint.setColor(textColorNormal); mPaint.setStyle(android.graphics.Paint.Style.FILL_AND_STROKE); // to show mOverlayDrawable properly if (mList.getWidth() > 0 && mList.getHeight() > 0) { onSizeChanged(mList.getWidth(), mList.getHeight(), 0, 0); } mState = STATE_NONE; refreshDrawableState(); ta.recycle(); mScaledTouchSlop = android.view.ViewConfiguration.get(context).getScaledTouchSlop (); mMatchDragPosition = context.getApplicationInfo().targetSdkVersion >= android.os.Build .VERSION_CODES.HONEYCOMB; setScrollbarPosition(mList.getVerticalScrollbarPosition()); }
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(); }
/// <summary> /// Construct a new Switch with a default style determined by the given theme attribute, /// overriding specific style attributes as requested. /// </summary> /// <remarks> /// Construct a new Switch with a default style determined by the given theme attribute, /// overriding specific style attributes as requested. /// </remarks> /// <param name="context">The Context that will determine this widget's theming.</param> /// <param name="attrs">Specification of attributes that should deviate from the default styling. /// </param> /// <param name="defStyle"> /// An attribute ID within the active theme containing a reference to the /// default style for this widget. e.g. android.R.attr.switchStyle. /// </param> public Switch(android.content.Context context, android.util.AttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { // Enum for the "typeface" XML parameter. // Does not include padding mTextPaint = new android.text.TextPaint(android.graphics.Paint.ANTI_ALIAS_FLAG); android.content.res.Resources res = getResources(); mTextPaint.density = res.getDisplayMetrics().density; mTextPaint.setCompatibilityScaling(res.getCompatibilityInfo().applicationScale); android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected] .styleable.Switch, defStyle, 0); mThumbDrawable = a.getDrawable([email protected]_thumb); mTrackDrawable = a.getDrawable([email protected]_track); mTextOn = a.getText([email protected]_textOn); mTextOff = a.getText([email protected]_textOff); mThumbTextPadding = a.getDimensionPixelSize([email protected]_thumbTextPadding , 0); mSwitchMinWidth = a.getDimensionPixelSize([email protected]_switchMinWidth , 0); mSwitchPadding = a.getDimensionPixelSize([email protected]_switchPadding , 0); int appearance = a.getResourceId([email protected]_switchTextAppearance , 0); if (appearance != 0) { setSwitchTextAppearance(context, appearance); } a.recycle(); android.view.ViewConfiguration config = android.view.ViewConfiguration.get(context ); mTouchSlop = config.getScaledTouchSlop(); mMinFlingVelocity = config.getScaledMinimumFlingVelocity(); // Refresh display with current params refreshDrawableState(); setChecked(isChecked()); }
public CheckedTextView(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.CheckedTextView, defStyle, 0); android.graphics.drawable.Drawable d = a.getDrawable([email protected] .CheckedTextView_checkMark); if (d != null) { setCheckMarkDrawable(d); } bool @checked = a.getBoolean([email protected]_checked , false); setChecked(@checked); a.recycle(); }
public ImageView(android.content.Context context, android.util.AttributeSet attrs , int defStyle) : base(context, attrs, defStyle) { initImageView(); android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected] .styleable.ImageView, defStyle, 0); android.graphics.drawable.Drawable d = a.getDrawable([email protected] .ImageView_src); if (d != null) { setImageDrawable(d); } mBaselineAlignBottom = a.getBoolean([email protected]_baselineAlignBottom , false); mBaseline = a.getDimensionPixelSize([email protected]_baseline , -1); setAdjustViewBounds(a.getBoolean([email protected]_adjustViewBounds , false)); setMaxWidth(a.getDimensionPixelSize([email protected]_maxWidth , int.MaxValue)); setMaxHeight(a.getDimensionPixelSize([email protected]_maxHeight , int.MaxValue)); int index = a.getInt([email protected]_scaleType, -1); if (index >= 0) { setScaleType(sScaleTypeArray[index]); } int tint = a.getInt([email protected]_tint, 0); if (tint != 0) { setColorFilter(tint); } int alpha = a.getInt([email protected]_drawableAlpha, 255); if (alpha != 255) { setAlpha(alpha); } mCropToPadding = a.getBoolean([email protected]_cropToPadding , false); 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; android.content.res.TypedArray a = r.obtainAttributes(attrs, [email protected]. styleable.ScaleDrawable); float sw = getPercent(a, [email protected]_scaleWidth); float sh = getPercent(a, [email protected]_scaleHeight); int g = a.getInt([email protected]_scaleGravity, android.view.Gravity .LEFT); bool min = a.getBoolean([email protected]_useIntrinsicSizeAsMinimum , false); android.graphics.drawable.Drawable dr = a.getDrawable([email protected] .ScaleDrawable_drawable); a.recycle(); int outerDepth = parser.getDepth(); while ((type = parser.next()) != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT && (type != org.xmlpull.v1.XmlPullParserClass.END_TAG || parser.getDepth() > outerDepth )) { if (type != org.xmlpull.v1.XmlPullParserClass.START_TAG) { continue; } dr = android.graphics.drawable.Drawable.createFromXmlInner(r, parser, attrs); } if (dr == null) { throw new System.ArgumentException("No drawable specified for <scale>"); } mScaleState.mDrawable = dr; mScaleState.mScaleWidth = sw; mScaleState.mScaleHeight = sh; mScaleState.mGravity = g; mScaleState.mUseIntrinsicSizeAsMin = min; if (dr != null) { dr.setCallback(this); } }
public FrameLayout(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.FrameLayout, defStyle, 0); mForegroundGravity = a.getInt([email protected]_foregroundGravity , mForegroundGravity); android.graphics.drawable.Drawable d = a.getDrawable([email protected] .FrameLayout_foreground); if (d != null) { setForeground(d); } if (a.getBoolean([email protected]_measureAllChildren, false )) { setMeasureAllChildren(true); } mForegroundInPadding = a.getBoolean([email protected]_foregroundInsidePadding , true); a.recycle(); }
public AbsSeekBar(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.SeekBar, defStyle, 0); android.graphics.drawable.Drawable thumb = a.getDrawable([email protected] .SeekBar_thumb); setThumb(thumb); // will guess mThumbOffset if thumb != null... // ...but allow layout to override this int thumbOffset = a.getDimensionPixelOffset([email protected]_thumbOffset , getThumbOffset()); setThumbOffset(thumbOffset); a.recycle(); a = context.obtainStyledAttributes(attrs, [email protected], 0, 0); mDisabledAlpha = a.getFloat([email protected]_disabledAlpha, 0.5f ); a.recycle(); mScaledTouchSlop = android.view.ViewConfiguration.get(context).getScaledTouchSlop (); }
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; android.content.res.TypedArray a = r.obtainAttributes(attrs, [email protected]. styleable.ClipDrawable); int orientation = a.getInt([email protected]_clipOrientation , HORIZONTAL); int g = a.getInt([email protected]_gravity, android.view.Gravity .LEFT); android.graphics.drawable.Drawable dr = a.getDrawable([email protected] .ClipDrawable_drawable); a.recycle(); int outerDepth = parser.getDepth(); while ((type = parser.next()) != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT && (type != org.xmlpull.v1.XmlPullParserClass.END_TAG || parser.getDepth() > outerDepth )) { if (type != org.xmlpull.v1.XmlPullParserClass.START_TAG) { continue; } dr = android.graphics.drawable.Drawable.createFromXmlInner(r, parser, attrs); } if (dr == null) { throw new System.ArgumentException("No drawable specified for <clip>"); } mClipState.mDrawable = dr; mClipState.mOrientation = orientation; mClipState.mGravity = g; dr.setCallback(this); }
/// <summary>Create a new instance.</summary> /// <remarks>Create a new instance.</remarks> /// <param name="context">The application environment.</param> /// <param name="attrs">A collection of attributes.</param> /// <param name="defStyle">The default style to apply to this view.</param> public ActivityChooserView(android.content.Context context, android.util.AttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { mModelDataSetOberver = new _DataSetObserver_118(this); mOnGlobalLayoutListener = new _OnGlobalLayoutListener_132(this); android.content.res.TypedArray attributesArray = context.obtainStyledAttributes(attrs , [email protected], defStyle, 0); mInitialActivityCount = attributesArray.getInt([email protected]_initialActivityCount , android.widget.ActivityChooserView.ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_DEFAULT ); android.graphics.drawable.Drawable expandActivityOverflowButtonDrawable = attributesArray .getDrawable([email protected]_expandActivityOverflowButtonDrawable ); attributesArray.recycle(); android.view.LayoutInflater inflater = android.view.LayoutInflater.from(mContext); inflater.inflate([email protected]_chooser_view, this, true); mCallbacks = new android.widget.ActivityChooserView.Callbacks(this); mActivityChooserContent = (android.widget.LinearLayout)findViewById([email protected] .id.activity_chooser_view_content); mActivityChooserContentBackground = mActivityChooserContent.getBackground(); mDefaultActivityButton = (android.widget.FrameLayout)findViewById([email protected] .id.default_activity_button); mDefaultActivityButton.setOnClickListener(mCallbacks); mDefaultActivityButton.setOnLongClickListener(mCallbacks); mDefaultActivityButtonImage = (android.widget.ImageView)mDefaultActivityButton.findViewById ([email protected]); mExpandActivityOverflowButton = (android.widget.FrameLayout)findViewById([email protected] .id.expand_activities_button); mExpandActivityOverflowButton.setOnClickListener(mCallbacks); mExpandActivityOverflowButtonImage = (android.widget.ImageView)mExpandActivityOverflowButton .findViewById([email protected]); mExpandActivityOverflowButtonImage.setImageDrawable(expandActivityOverflowButtonDrawable ); mAdapter = new android.widget.ActivityChooserView.ActivityChooserViewAdapter(this ); mAdapter.registerDataSetObserver(new _DataSetObserver_239(this)); android.content.res.Resources resources = context.getResources(); mListPopupMaxWidth = System.Math.Max(resources.getDisplayMetrics().widthPixels / 2, resources.getDimensionPixelSize([email protected]_prefDialogWidth )); }