public CircleImageView(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { // init paint paint = new Paint(); paint.AntiAlias = true; paintBorder = new Paint(); paintBorder.AntiAlias = true; // load the styled attributes and set their properties TypedArray attributes = context.ObtainStyledAttributes(attrs, Resource.Styleable.CircularImageView, defStyle, 0); if (attributes.GetBoolean(Resource.Styleable.CircularImageView_border, true)) { int defaultBorderSize = (int)(4 * context.Resources.DisplayMetrics.Density+ 0.5f); BorderWidth = attributes.GetDimensionPixelOffset(Resource.Styleable.CircularImageView_border_width, defaultBorderSize); BorderColor = attributes.GetColor(Resource.Styleable.CircularImageView_border_color, Color.White); } if (attributes.GetBoolean(Resource.Styleable.CircularImageView_shadow, false)) { addShadow(); } }
public CirclePageIndicator(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { //Load defaults from resources var res = Resources; int defaultPageColor = res.GetColor(Resource.Color.default_circle_indicator_page_color); int defaultFillColor = res.GetColor(Resource.Color.default_circle_indicator_fill_color); int defaultOrientation = res.GetInteger(Resource.Integer.default_circle_indicator_orientation); int defaultStrokeColor = res.GetColor(Resource.Color.default_circle_indicator_stroke_color); float defaultStrokeWidth = res.GetDimension(Resource.Dimension.default_circle_indicator_stroke_width); float defaultRadius = res.GetDimension(Resource.Dimension.default_circle_indicator_radius); bool defaultCentered = res.GetBoolean(Resource.Boolean.default_circle_indicator_centered); bool defaultSnap = res.GetBoolean(Resource.Boolean.default_circle_indicator_snap); //Retrieve styles attributes var a = context.ObtainStyledAttributes(attrs, Resource.Styleable.CirclePageIndicator, defStyle, Resource.Style.Widget_CirclePageIndicator); mCentered = a.GetBoolean(Resource.Styleable.CirclePageIndicator_vpiCentered, defaultCentered); mOrientation = a.GetInt(Resource.Styleable.CirclePageIndicator_vpiOrientation, defaultOrientation); mPaintPageFill = new Paint(PaintFlags.AntiAlias); mPaintPageFill.SetStyle(Paint.Style.Fill); mPaintPageFill.Color = a.GetColor(Resource.Styleable.CirclePageIndicator_vpiPageColor, defaultPageColor); mPaintStroke = new Paint(PaintFlags.AntiAlias); mPaintStroke.SetStyle(Paint.Style.Stroke); mPaintFill = new Paint(PaintFlags.AntiAlias); mPaintFill.SetStyle(Paint.Style.Fill); mSnap = a.GetBoolean(Resource.Styleable.CirclePageIndicator_vpiSnap, defaultSnap); mRadius = a.GetDimension(Resource.Styleable.CirclePageIndicator_vpiRadius, defaultRadius); mPaintFill.Color = a.GetColor(Resource.Styleable.CirclePageIndicator_vpiFillColor, defaultFillColor); mPaintStroke.Color = a.GetColor(Resource.Styleable.CirclePageIndicator_vpiStrokeColor, defaultStrokeColor); mPaintStroke.StrokeWidth = a.GetDimension(Resource.Styleable.CirclePageIndicator_vpiStrokeWidth, defaultStrokeWidth); a.Recycle(); }
void init(IAttributeSet attrs) { if (attrs != null) { var a = Context.ObtainStyledAttributes (attrs, Resource.Styleable.FlatUI); var themeName = a.GetString (Resource.Styleable.FlatUI_theme) ?? string.Empty; theme = FlatUI.GetTheme (themeName); style = a.GetInt (Resource.Styleable.FlatUI_fieldStyle, 0); radius = a.GetDimensionPixelSize (Resource.Styleable.FlatUI_cornerRadius, radius); padding = a.GetDimensionPixelSize (Resource.Styleable.FlatUI_textPadding, padding); Enum.TryParse<FlatUI.FlatTextAppearance> ( a.GetInt (Resource.Styleable.FlatUI_textAppearance, (int)textAppearance).ToString (), out textAppearance); Enum.TryParse<FlatUI.FlatFontFamily> ( a.GetInt (Resource.Styleable.FlatUI_fontFamily, (int)fontFamily).ToString (), out fontFamily); Enum.TryParse<FlatUI.FlatFontWeight> ( a.GetInt (Resource.Styleable.FlatUI_fontWeight, (int)fontWeight).ToString (), out fontWeight); a.Recycle (); } SetTheme (this, theme, fontFamily, fontWeight, textAppearance, style, radius, padding, border); }
public virtual View CreateView(View parent, string name, Context context, IAttributeSet attrs) { // resolve the tag name to a type var viewType = ViewTypeResolver.Resolve(name); if (viewType == null) { //MvxBindingTrace.Trace(MvxTraceLevel.Error, "View type not found - {0}", name); return null; } try { var view = Activator.CreateInstance(viewType, context, attrs) as View; if (view == null) { MvxBindingTrace.Trace(MvxTraceLevel.Error, "Unable to load view {0} from type {1}", name, viewType.FullName); } return view; } catch (ThreadAbortException) { throw; } catch (Exception exception) { MvxBindingTrace.Trace(MvxTraceLevel.Error, "Exception during creation of {0} from type {1} - exception {2}", name, viewType.FullName, exception.ToLongString()); return null; } }
public ForwardNavigationMenu(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { _mainContainer = new LinearLayout (context); _mainContainer.Orientation = Android.Widget.Orientation.Vertical; _mainContainer.LayoutParameters = new LayoutParams (LayoutParams.MatchParent, LayoutParams.MatchParent); _context = context; var dm = Resources.DisplayMetrics; textSize = (int)TypedValue.ApplyDimension (ComplexUnitType.Sp, textSize, dm); var a = context.ObtainStyledAttributes (attrs, Attrs); a = context.ObtainStyledAttributes (attrs, Resource.Styleable.ForwardNavigationMenu); contentPadding = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmContentPadding, contentPadding); padding = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmPadding, padding); paddingLeft = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmPaddingLeft, paddingLeft); paddingBottom = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmPaddingBottom, paddingBottom); paddingRight = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmPaddingRight, paddingRight); paddingTop = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmPaddingTop, paddingTop); margin = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmMargin, margin); marginRight = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmMarginRight, marginRight); marginLeft = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmMarginLeft, marginLeft); marginBottom = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmMarginBottom, marginBottom); marginTop = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmMarginTop, marginTop); typefaceStyle = (TypefaceStyle)a.GetInt (Resource.Styleable.ForwardNavigationMenu_fnmTextStyle, (int)TypefaceStyle.Normal); textAlpha = a.GetInt (Resource.Styleable.ForwardNavigationMenu_fnmTextAlpha, textAlpha); a.Recycle (); _mainContainer.SetPadding (contentPadding, contentPadding, contentPadding, contentPadding); AddView (_mainContainer); }
public ProgressButton(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { ResourceIdManager.UpdateIdValues(); Initialize(context, attrs, defStyle); }
public SlidingTabStrip(Context context, IAttributeSet Attrs):base(context, Attrs) { SetWillNotDraw(false); float density = Resources.DisplayMetrics.Density; TypedValue outValue = new TypedValue(); context.Theme.ResolveAttribute(Android.Resource.Attribute.ColorForeground, outValue, true); int themeForegroundColor = outValue.Data; _defaultBottomBorderColor = SetColorAlpha(themeForegroundColor,0x26); _defaultTabColorizer = new SimpleTabColorizer(); _defaultTabColorizer.SetIndicatorColors(0xFF33B5); _defaultTabColorizer.SetDividerColors(SetColorAlpha(themeForegroundColor,0x20)); _bottomBorderThickness = (int) (2 * density); _bottomBorderPaint = new Paint(); _bottomBorderPaint.Color = Color.White; _selectedIndicatorThickness = (int) (6 * density); _selectedIndicatorPaint = new Paint(); _dividerHeight = 0.5f; _dividerPaint = new Paint(); _dividerPaint.StrokeWidth=((int) (1 * density)); }
public CircularImageView(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { this._attrs = attrs; this._defStyle = defStyle; Init(); }
public SlidingTabStrip1(Context context, IAttributeSet attrs) : base(context, attrs) { SetWillNotDraw(false); float density = Resources.DisplayMetrics.Density; TypedValue outValue = new TypedValue(); context.Theme.ResolveAttribute(Android.Resource.Attribute.ColorForeground, outValue, true); int themeForeGround = outValue.Data; mDefaultBottomBorderColor = SetColorAlpha(themeForeGround, DEFAULT_BOTTOM_BORDER_COLOR_ALPHA); mDefaultTabColorizer = new SimpleTabColorizer1(); mDefaultTabColorizer.IndicatorColors = INDICATOR_COLORS; mDefaultTabColorizer.DividerColors = DIVIDER_COLORS; mBottomBorderThickness = (int)(DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS * density); mBottomBorderPaint = new Paint(); mBottomBorderPaint.Color = GetColorFromInteger(0xC5C5C5); //Gray mSelectedIndicatorThickness = (int)(SELECTED_INDICATOR_THICKNESS_DIPS * density); mSelectedIndicatorPaint = new Paint(); mDividerHeight = DEFAULT_DIVIDER_HEIGHT; mDividerPaint = new Paint(); mDividerPaint.StrokeWidth = (int)(DEFAULT_DIVIDER_THICKNESS_DIPS * density); }
void Initialize(IAttributeSet attrs) { TypedArray a = Context.ObtainStyledAttributes( attrs, Resource.Styleable.Kp2aShortHelpView); HelpText = a.GetString(Resource.Styleable.Kp2aShortHelpView_help_text); }
public CalendarPickerView(Context context, IAttributeSet attrs) : base(context, attrs) { ResourceIdManager.UpdateIdValues(); _context = context; MyAdapter = new MonthAdapter(context, this); base.Adapter = MyAdapter; base.Divider = null; base.DividerHeight = 0; var bgColor = base.Resources.GetColor(Resource.Color.calendar_bg); base.SetBackgroundColor(bgColor); base.CacheColorHint = bgColor; MonthNameFormat = base.Resources.GetString(Resource.String.month_name_format); WeekdayNameFormat = base.Resources.GetString(Resource.String.day_name_format); FullDateFormat = CultureInfo.CurrentCulture.DateTimeFormat.LongDatePattern; ClickHandler += OnCellClicked; OnInvalidDateSelected += OnInvalidateDateClicked; if (base.IsInEditMode) { Init(DateTime.Now, DateTime.Now.AddYears(1)).WithSelectedDate(DateTime.Now); } }
public CustomViewBehind(Context context, IAttributeSet attrs) : base(context, attrs) { TouchMode = TouchMode.Margin; MarginThreshold = (int) TypedValue.ApplyDimension(ComplexUnitType.Dip, MARGIN_THRESHOLD, Resources.DisplayMetrics); }
public MultiSelectionSpinner(Context c, IAttributeSet attr, int defStyle) : base(c, attr, defStyle) { context = c; simpleAdapter = new ArrayAdapter<string>(context, Android.Resource.Layout.SimpleSpinnerItem); Adapter = simpleAdapter; }
private void init(IAttributeSet attrs) { TypedArray a = Context.ObtainStyledAttributes (attrs, Resource.Styleable.ColorPickerPreference); showDialogTitle = a.GetBoolean(Resource.Styleable.ColorPickerPreference_showDialogTitle, false); showPreviewSelectedColorInList = a.GetBoolean(Resource.Styleable.ColorPickerPreference_showSelectedColorInList, true); a.Recycle(); a = Context.ObtainStyledAttributes(attrs, Resource.Styleable.ColorPickerView); alphaChannelVisible = a.GetBoolean(Resource.Styleable.ColorPickerView_alphaChannelVisible, false); alphaChannelText = a.GetString(Resource.Styleable.ColorPickerView_alphaChannelText); colorPickerSliderColor = a.GetColor(Resource.Styleable.ColorPickerView_colorPickerSliderColor, -1); colorPickerBorderColor = a.GetColor(Resource.Styleable.ColorPickerView_colorPickerBorderColor, -1); a.Recycle(); if(showPreviewSelectedColorInList) { WidgetLayoutResource = Resource.Layout.preference_preview_layout; } if(!showDialogTitle) { DialogTitle = null; } DialogLayoutResource = Resource.Layout.dialog_color_picker; SetPositiveButtonText(Resource.String.dialog_ok); SetNegativeButtonText(Resource.String.dialog_cancle); Persistent = true; }
public MvxHorizontalGridView(Context context, IAttributeSet attrs, int defStyle, IMvxRecyclerAdapter adapter) : base(context, attrs, defStyle) { // Note: Any calling derived class passing a null adapter is responsible for setting // it's own itemTemplateId if (adapter == null) return; var itemTemplateId = MvxAttributeHelpers.ReadListItemTemplateId(context, attrs); adapter.ItemTemplateId = itemTemplateId; Adapter = adapter; var typedArray = context.ObtainStyledAttributes(attrs, Resource.Styleable.MvxHorizontalGridView); try { FocusFirstChildOnLaidOut = typedArray.GetBoolean(Resource.Styleable.MvxHorizontalGridView_FocusFirstChildOnLaidOut, false); if (FocusFirstChildOnLaidOut) { SetOnChildLaidOutListener(new MvxFocusFirstChildOnChildLaidOutListener()); } } finally { typedArray.Recycle(); } // We need this listener to get information about the currently _selected_ item // Overriding setter of base.SelectedPosition is not enough! OnChildViewHolderSelectedListener = new MvxOnChildViewHolderSelectedListener(); SetOnChildViewHolderSelectedListener(OnChildViewHolderSelectedListener); }
public LinePageIndicator(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { if(IsInEditMode) return; var res = Resources; //Load defaults from resources var defaultSelectedColor = res.GetColor(Resource.Color.default_line_indicator_selected_color); var defaultUnselectedColor = res.GetColor(Resource.Color.default_line_indicator_unselected_color); var defaultLineWidth = res.GetDimension(Resource.Dimension.default_line_indicator_line_width); var defaultGapWidth = res.GetDimension(Resource.Dimension.default_line_indicator_gap_width); var defaultStrokeWidth = res.GetDimension(Resource.Dimension.default_line_indicator_stroke_width); var defaultCentered = res.GetBoolean(Resource.Boolean.default_line_indicator_centered); //Retrive styles attributes var a = context.ObtainStyledAttributes(attrs, Resource.Styleable.LinePageIndicator, defStyle, 0); _centered = a.GetBoolean(Resource.Styleable.LinePageIndicator_centered, defaultCentered); _lineWidth = a.GetDimension(Resource.Styleable.LinePageIndicator_lineWidth, defaultLineWidth); _gapWidth = a.GetDimension(Resource.Styleable.LinePageIndicator_gapWidth, defaultGapWidth); StrokeWidth = a.GetDimension(Resource.Styleable.LinePageIndicator_strokeWidth, defaultStrokeWidth); _paintUnSelected.Color = a.GetColor(Resource.Styleable.LinePageIndicator_unselectedColor, defaultUnselectedColor); _paintSelected.Color = a.GetColor(Resource.Styleable.LinePageIndicator_selectedColor, defaultSelectedColor); var background = a.GetDrawable(Resource.Styleable.LinePageIndicator_android_background); if (null != background) Background = background; a.Recycle(); var configuration = ViewConfiguration.Get(context); _touchSlop = ViewConfigurationCompat.GetScaledPagingTouchSlop(configuration); }
public static IItemTemplateSelector BuildItemTemplateSelector(Context context, IAttributeSet attrs) { var templateSelectorClassName = ReadRecyclerViewItemTemplateSelectorClassName(context, attrs); var type = Type.GetType(templateSelectorClassName); if (type == null) { var message = $"Sorry but type with class name: {templateSelectorClassName} does not exist." + $"Make sure you have provided full Type name: namespace + class name, AssemblyName." + $"Example (check Example.Droid sample!): Example.Droid.Common.TemplateSelectors.MultiItemTemplateModelTemplateSelector, Example.Droid"; Mvx.Error(message); throw new InvalidOperationException(message); } if (!typeof (IItemTemplateSelector).IsAssignableFrom(type)) { string message = $"Sorry but type: {type} does not implement {nameof(IItemTemplateSelector)} interface."; Mvx.Error(message); throw new InvalidOperationException(message); } if (type.IsAbstract) { string message = $"Sorry can not instatiate {nameof(IItemTemplateSelector)} as provided type: {type} is abstract/interface."; Mvx.Error(message); throw new InvalidOperationException(message); } return Activator.CreateInstance(type) as IItemTemplateSelector; }
private static string ReadRecyclerViewItemTemplateSelectorClassName(Context context, IAttributeSet attrs) { TryInitializeBindingResourcePaths(); TypedArray typedArray = null; string className = string.Empty; try { typedArray = context.ObtainStyledAttributes(attrs, MvxRecyclerViewItemTemplateSelectorGroupId); int numberOfStyles = typedArray.IndexCount; for (int i = 0; i < numberOfStyles; ++i) { var attributeId = typedArray.GetIndex(i); if (attributeId == MvxRecyclerViewItemTemplateSelector) className = typedArray.GetString(attributeId); } } finally { typedArray?.Recycle(); } if (string.IsNullOrEmpty(className)) return typeof (SingleItemDefaultTemplateSelector).FullName; return className; }
private void Init(Android.Content.Context context, IAttributeSet attrs, int p) { TypedArray a = context.ObtainStyledAttributes(attrs, Resource.Styleable.CircleProgressBar, p, 0); float density = context.Resources.DisplayMetrics.Density; mBackGroundColor = a.GetColor(Resource.Styleable.CircleProgressBar_mlpb_background_color, DEFAULT_CIRCLE_BG_LIGHT); mProgressColor = a.GetColor(Resource.Styleable.CircleProgressBar_mlpb_progress_color, DEFAULT_CIRCLE_BG_LIGHT); mInnerRadius = a.GetDimensionPixelOffset(Resource.Styleable.CircleProgressBar_mlpb_inner_radius, -1); mProgressStokeWidth = a.GetDimensionPixelOffset(Resource.Styleable.CircleProgressBar_mlpb_progress_stoke_width, (int)(STROKE_WIDTH_LARGE * density)); mArrowWidth = a.GetDimensionPixelOffset(Resource.Styleable.CircleProgressBar_mlpb_arrow_width, -1); mArrowHeight = a.GetDimensionPixelOffset(Resource.Styleable.CircleProgressBar_mlpb_arrow_height, -1); mTextSize = a.GetDimensionPixelOffset(Resource.Styleable.CircleProgressBar_mlpb_progress_text_size, (int)(DEFAULT_TEXT_SIZE * density)); mTextColor = a.GetColor(Resource.Styleable.CircleProgressBar_mlpb_progress_text_color, Color.Black); mShowArrow = a.GetBoolean(Resource.Styleable.CircleProgressBar_mlpb_show_arrow, false); mCircleBackgroundEnabled = a.GetBoolean(Resource.Styleable.CircleProgressBar_mlpb_enable_circle_background, true); mProgress = a.GetInt(Resource.Styleable.CircleProgressBar_mlpb_progress, 0); mMax = a.GetInt(Resource.Styleable.CircleProgressBar_mlpb_max, 100); int textVisible = a.GetInt(Resource.Styleable.CircleProgressBar_mlpb_progress_text_visibility, 1); if (textVisible != 1) { mIfDrawText = true; } mTextPaint = new Paint(); mTextPaint.SetStyle(Paint.Style.Fill); mTextPaint.Color = mTextColor; mTextPaint.TextSize = mTextSize; mTextPaint.AntiAlias = true; a.Recycle(); mProgressDrawable = new MaterialProgressDrawale(Context, this); base.SetImageDrawable(mProgressDrawable); }
public MvxImageView(Context context, IAttributeSet attrs) : base(context, attrs) { if (!Mvx.TryResolve(out _imageHelper)) { MvxTrace.Error( "No IMvxImageHelper registered - you must provide an image helper before you can use a MvxImageView"); } else { _imageHelper.ImageChanged += ImageHelperOnImageChanged; } var typedArray = context.ObtainStyledAttributes(attrs, MvxAndroidBindingResource.Instance .ImageViewStylableGroupId); int numStyles = typedArray.IndexCount; for (var i = 0; i < numStyles; ++i) { int attributeId = typedArray.GetIndex(i); if (attributeId == MvxAndroidBindingResource.Instance.SourceBindId) { ImageUrl = typedArray.GetString(attributeId); } } typedArray.Recycle(); }
public SearchToolbar(Context context, IAttributeSet attrs, int defStyleAttr) : base(context, attrs, defStyleAttr) { binding = SearchToolbarBinding.Inflate(LayoutInflater.From(context), Resource.Layout.toolbar_search, this, true); if (!IsInEditMode) { var a = context.ObtainStyledAttributes(attrs, Resource.Styleable.SearchToolbar); try { var focus = a.GetBoolean(Resource.Styleable.SearchToolbar_searchFocus, false); var hintResId = a.GetResourceId(Resource.Styleable.SearchToolbar_searchHint, Resource.String.search_hint); SetHint(hintResId); if (focus) { binding.editSearch.RequestFocus(); } else { ClearFocus(); } ToggleCloseButtonVisible(false); InitView(); } finally { a.Recycle(); } } }
/// <summary> /// Initializes a new instance of the <see cref="OsmSharp.Android.UI.CanvasRenderer2DView"/> class. /// </summary> /// <param name="context">Context.</param> /// <param name="attrs">Attrs.</param> public CanvasRenderer2DView(Context context, IAttributeSet attrs, Scene2D scene) : base(context, attrs) { Initialize (); this.Scene = scene; }
public BindableViewPager(Context context, IAttributeSet attrs, MvxBindablePagerAdapter adapter) : base(context, attrs) { var itemTemplateId = MvxAttributeHelpers.ReadListItemTemplateId(context, attrs); adapter.ItemTemplateId = itemTemplateId; Adapter = adapter; }
public BandThemeView(Context context, IAttributeSet attrs) : base(context, attrs) { var inflater = LayoutInflater.From(context); inflater.Inflate(Resource.Layout.view_bandtheme, this); LoadViews(); }
public MvxAutoCompleteTextView(Context context, IAttributeSet attrs) : this(context, attrs, new MvxFilteringAdapter(context)) { // note - we shouldn't realy need both of these... but we do this.ItemClick += OnItemClick; this.ItemSelected += OnItemSelected; }
public NormalGameView(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { GraphicMode = false; InitGameView (); screenEvents = new ScreenEvents (this); }
public GridView(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { var a = context.ObtainStyledAttributes(attrs, Resource.Styleable.GridView, defStyle, 0); int markupId = a.GetResourceId(Resource.Styleable.GridView_grid_markup, DefaultGridMarkupValue); if(markupId != DefaultGridMarkupValue) { ParseMarkupXml(markupId); } else { _rowDefinitions.Add(new GridDefinition()); _columnDefinitions.Add(new GridDefinition()); } foreach(var row in _rowDefinitions) { var rowInfo = new GridDefinitionMeasureInfo(row); _rowsInfo.Add(row, rowInfo); if(row.Length.IsStar) { _heightStarSum += row.Length.Value; } } foreach(var column in _columnDefinitions) { var columnInfo = new GridDefinitionMeasureInfo(column); _columnsInfo.Add(column, columnInfo); if(column.Length.IsStar) { _widthStarSum += column.Length.Value; } } }
//applies font from XML public static void ApplyCustomFont(TextView view, Context context, IAttributeSet attrs) { TypedArray attributeArray = context.ObtainStyledAttributes (attrs, Resource.Styleable.CustomFont); string fontName = attributeArray.GetString (Resource.Styleable.CustomFont_font); int textStyle = attrs.GetAttributeIntValue (ANDROID_SCHEMA, "textStyle", 0); Typeface customFont = SelectTypeface (context, fontName); switch (textStyle) { case 1: view.SetTypeface (customFont, TypefaceStyle.Bold); break; case 2: view.SetTypeface (customFont, TypefaceStyle.Italic); break; case 3: view.SetTypeface (customFont, TypefaceStyle.BoldItalic); break; default: view.SetTypeface (customFont, TypefaceStyle.Normal); break; } attributeArray.Recycle (); }
/// <summary> /// Parses the binding attributes into MvxViewBindingTag. /// </summary> /// <returns>The tag with parsed values, null if no binding attributes found.</returns> protected MvxViewBindingTag ParseAttributes (Context context, IAttributeSet attrs) { var res = MvxAndroidBindingResource.Instance; IEnumerable<MvxBindingDescription> descriptions = null; using (var typedArray = context.ObtainStyledAttributes( attrs, res.BindingStylableGroupId)) { int numStyles = typedArray.IndexCount; for (var i = 0; i < numStyles; ++i) { var attributeId = typedArray.GetIndex (i); if (attributeId == res.BindingBindId) { try { var bindingText = typedArray.GetString (attributeId); descriptions = this.GetService<IMvxBindingDescriptionParser> ().Parse (bindingText); } catch (Exception exception) { MvxBindingTrace.Trace ( MvxTraceLevel.Error, "Exception thrown during the parsing the bindings {0}", exception.ToLongString ()); throw; } } } typedArray.Recycle (); } if (descriptions != null) { return new MvxViewBindingTag (descriptions); } return null; }
public RoundedImageView(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { TypedArray a = context.ObtainStyledAttributes(attrs, Resource.Styleable.RoundedImageView, defStyle, 0); int index = a.GetInt(Resource.Styleable.RoundedImageView_android_scaleType, -1); SetScaleType(index >= 0 ? ScaleTypes[index] : ScaleType.FitCenter); _cornerRadius = a.GetDimensionPixelSize(Resource.Styleable.RoundedImageView_corner_radius, -1); _borderWidth = a.GetDimensionPixelSize(Resource.Styleable.RoundedImageView_border_width, -1); // don't allow negative values for radius and border if (_cornerRadius < 0) { _cornerRadius = DefaultRadius; } if (_borderWidth < 0) { _borderWidth = DefaultBorderWidth; } _borderColor = a.GetColorStateList(Resource.Styleable.RoundedImageView_border_color) ?? ColorStateList.ValueOf(Color.Black); _mutateBackground = a.GetBoolean(Resource.Styleable.RoundedImageView_mutate_background, false); _isOval = a.GetBoolean(Resource.Styleable.RoundedImageView_oval, false); UpdateDrawableAttrs(); UpdateBackgroundDrawableAttrs(true); a.Recycle(); }
public RoundButton(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { }
public virtual ViewResult Initialize(View view, IAttributeSet attrs) { Should.NotBeNull(view, nameof(view)); Should.NotBeNull(attrs, nameof(attrs)); return(GetViewResult(view, view.Context, attrs)); }
public SamplesListView(Context context, IAttributeSet attrs) : base(context, attrs) { listViewContext = context; }
/// <summary> /// Initializes a new instance of the <see cref="OsmSharp.Android.UI.MapView"/> class. /// </summary> /// <param name="context">Context.</param> /// <param name="attrs">Attrs.</param> public MapViewSurface(Context context, IAttributeSet attrs) : base(context, attrs) { // do not do too much here could cause https://github.com/OsmSharp/OsmSharp/issues/129 // just wait for a C# reference with patience and initialize stuff in IMapViewSurface.Initialize() }
public ExpandableListView(Context context, IAttributeSet attrs) : base(context, attrs) { }
public CustomViewPager(Context context, IAttributeSet attrs) : base(context, attrs) { }
public AnimatedImageView(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { }
public AnimatedImageView(Context context, IAttributeSet attrs) : base(context, attrs) { }
public HeaderContainer(Context context, IAttributeSet attribs) : base(context, attribs) { }
public HeaderContainer(Context context, IAttributeSet attribs, int defStyleAttr) : base(context, attribs, defStyleAttr) { }
public Shape(float density, Context context, IAttributeSet attributes) : base(context, attributes) { this.density = density; }
public Shape(float density, Context context, IAttributeSet attributes, int defStyle) : base(context, attributes, defStyle) { this.density = density; }
public NotScrollableGridView(Context context, IAttributeSet attrs) : base(context, attrs) { }
public NotScrollableGridView(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { }
public FixedMusicBar(Context context, IAttributeSet attrs) : base(context, attrs) { }
public FixedMusicBar(Context context, IAttributeSet attrs, int defStyleAttr, int defStyleRes) : base(context, attrs, defStyleAttr, defStyleRes) { }
public AutoFitTextureView(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { }
public MobButton(Context context, IAttributeSet attrs) : base(context, attrs) { this.Click += MobButton_Click; }
public SamplesListView(Context context, IAttributeSet attrs, int defStyleAttr, int defStyleRes) : base(context, attrs, defStyleAttr, defStyleRes) { listViewContext = context; }
public AutoFitTextureView(Context context, IAttributeSet attrs) : this(context, attrs, 0) { }
public WalkerLayout(Context context, IAttributeSet attrs) : base(context, attrs) { }
public BadgeView(Context context, IAttributeSet attrs, int defStyle, View target) : base(context, attrs, defStyle) { Init(context, target); }
public CircleMenuLayout(Context context, IAttributeSet attrs) : base(context, attrs) { SetPadding(0, 0, 0, 0); }
public RoundButton(Context context, IAttributeSet attrs) : base(context, attrs) { }
public DayPagerControl(Context context, IAttributeSet attrs) : base(context, attrs) { Initialize(); }
public CheckInCheckOutItem(Context aContext, Context bContext, IAttributeSet attrs) : base(aContext, attrs) { Initialize(aContext, bContext); }
public CustomVirtualView(Context context, IAttributeSet attrs, int defStyleAttr) : this(context, attrs, defStyleAttr, 0) { }
public CustomButton(Context context, IAttributeSet attributeSet) : base(context, attributeSet) { }
public CustomVirtualView(Context context, IAttributeSet attrs) : this(context, attrs, 0) { }
public WalkerLayout(Context context, IAttributeSet attrs, int defStyleAttr) : base(context, attrs, defStyleAttr) { }