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; }
/// <summary> /// Initializes XML attributes. /// </summary> /// <param name="context"></param> /// <param name="attrs"></param> private void Init(Context context, IAttributeSet attrs) { TypedArray array = null; try { if (attrs != null) { array = context.Theme.ObtainStyledAttributes(attrs, Resource.Styleable.DragToClose, 0, 0); DraggableViewId = array.GetResourceId(Resource.Styleable.DragToClose_draggableView, -1); DraggableContainerId = array.GetResourceId(Resource.Styleable.DragToClose_draggableContainer, -1); FinishActivity = array.GetBoolean(Resource.Styleable.DragToClose_finishActivity, true); CloseOnClick = array.GetBoolean(Resource.Styleable.DragToClose_closeOnClick, false); if (DraggableViewId == -1 || DraggableContainerId == -1) { throw new IllegalArgumentException("draggableView and draggableContainer attributes are required."); } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } finally { array?.Recycle(); } }
/** * Instantiates a new holo circular progress bar. * * @param context the context * @param attrs the attrs * @param defStyle the def style */ public HoloCircularProgressBar(Context context, IAttributeSet Attrs, int DefStyle) : base(context, Attrs, DefStyle) { // load the styled attributes and set their properties TypedArray attributes = context.ObtainStyledAttributes(Attrs, Resource.Styleable.HoloCircularProgressBar, DefStyle, 0); if (attributes != null) { try { SetProgressColor(attributes.GetColor(Resource.Styleable.HoloCircularProgressBar_progress_color, Color.Cyan)); SetProgressBackgroundColor(attributes.GetColor(Resource.Styleable.HoloCircularProgressBar_progress_background_color, Color.Green)); SetProgress(attributes.GetFloat(Resource.Styleable.HoloCircularProgressBar_progress, 0.0f)); SetMarkerProgress(attributes.GetFloat(Resource.Styleable.HoloCircularProgressBar_marker_progress, 0.0f)); SetWheelSize((int)attributes.GetDimension(Resource.Styleable.HoloCircularProgressBar_stroke_width, 10)); SetThumbEnabled(attributes.GetBoolean(Resource.Styleable.HoloCircularProgressBar_thumb_visible, true)); SetMarkerEnabled(attributes.GetBoolean(Resource.Styleable.HoloCircularProgressBar_marker_visible, true)); _gravity = (GravityFlags)attributes.GetInt(Resource.Styleable.HoloCircularProgressBar_android_gravity, (int)GravityFlags.Center); } finally { // make sure recycle is always called. attributes.Recycle(); } } _thumbRadius = _circleStrokeWidth * 2; UpdateBackgroundColor(); UpdateMarkerColor(); UpdateProgressColor(); // the view has now all properties and can be drawn _isInitializing = false; }
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); }
/** * Parse the attributes passed to the view from the XML * * @param a the attributes to parse */ private void ParseAttributes(TypedArray a) { DisplayMetrics metrics = Context.Resources.DisplayMetrics;// GetContext().getResources().getDisplayMetrics(); barWidth = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, barWidth, metrics); rimWidth = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, rimWidth, metrics); circleRadius = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, circleRadius, metrics); circleRadius = (int)a.GetDimension(Resource.Styleable.CircleProgressView_matProg_circleRadius, circleRadius); fillRadius = a.GetBoolean(Resource.Styleable.CircleProgressView_matProg_fillRadius, false); barWidth = (int)a.GetDimension(Resource.Styleable.CircleProgressView_matProg_barWidth, barWidth); rimWidth = (int)a.GetDimension(Resource.Styleable.CircleProgressView_matProg_rimWidth, rimWidth); float baseSpinSpeed = a.GetFloat(Resource.Styleable.CircleProgressView_matProg_spinSpeed, spinSpeed / 360.0f); spinSpeed = baseSpinSpeed * 360; barSpinCycleTime = a.GetInt(Resource.Styleable.CircleProgressView_matProg_barSpinCycleTime, (int)barSpinCycleTime); barColor = a.GetColor(Resource.Styleable.CircleProgressView_matProg_barColor, barColor); rimColor = a.GetColor(Resource.Styleable.CircleProgressView_matProg_rimColor, rimColor); linearProgress = a.GetBoolean(Resource.Styleable.CircleProgressView_matProg_linearProgress, false); if (a.GetBoolean(Resource.Styleable.CircleProgressView_matProg_progressIndeterminate, false)) { Spin(); } a.Recycle(); }
private void initButton(Context context, IAttributeSet attrs) { if (context is Activity) { init((Activity)context); } TypedArray a = context.ObtainStyledAttributes(attrs, Resource.Styleable.ShineButton); btnColor = a.GetColor(Resource.Styleable.ShineButton_btn_color, Color.Gray); btnFillColor = a.GetColor(Resource.Styleable.ShineButton_btn_fill_color, Color.Black); shineParams.allowRandomColor = a.GetBoolean(Resource.Styleable.ShineButton_allow_random_color, false); shineParams.animDuration = a.GetInteger(Resource.Styleable.ShineButton_shine_animation_duration, (int)shineParams.animDuration); shineParams.bigShineColor = a.GetColor(Resource.Styleable.ShineButton_big_shine_color, shineParams.bigShineColor); shineParams.clickAnimDuration = a.GetInteger(Resource.Styleable.ShineButton_click_animation_duration, (int)shineParams.clickAnimDuration); shineParams.enableFlashing = a.GetBoolean(Resource.Styleable.ShineButton_enable_flashing, false); shineParams.shineCount = a.GetInteger(Resource.Styleable.ShineButton_shine_count, shineParams.shineCount); shineParams.shineDistanceMultiple = a.GetFloat(Resource.Styleable.ShineButton_shine_distance_multiple, shineParams.shineDistanceMultiple); shineParams.shineTurnAngle = a.GetFloat(Resource.Styleable.ShineButton_shine_turn_angle, shineParams.shineTurnAngle); shineParams.smallShineColor = a.GetColor(Resource.Styleable.ShineButton_small_shine_color, shineParams.smallShineColor); shineParams.smallShineOffsetAngle = a.GetFloat(Resource.Styleable.ShineButton_small_shine_offset_angle, shineParams.smallShineOffsetAngle); shineParams.shineSize = a.GetDimensionPixelSize(Resource.Styleable.ShineButton_shine_size, shineParams.shineSize); a.Recycle(); setSrcColor(btnColor); }
public void InitButton(Context context, IAttributeSet attrs) { Activity activityCaller = context as Activity; if (activityCaller != null) { Init((Activity)context); } TypedArray a = context.ObtainStyledAttributes(attrs, Resource.Styleable.ShineButton); btnColor = a.GetColor(Resource.Styleable.ShineButton_btn_color, Color.Gray); ButtonFillColour = a.GetColor(Resource.Styleable.ShineButton_btn_fill_color, Color.Black); shineParams.UseRandomColor = a.GetBoolean(Resource.Styleable.ShineButton_allow_random_color, false); shineParams.AnimDuration = a.GetInteger(Resource.Styleable.ShineButton_shine_animation_duration, (int)shineParams.AnimDuration); shineParams.BigShineColor = a.GetColor(Resource.Styleable.ShineButton_big_shine_color, shineParams.BigShineColor); shineParams.ClickAnimDuration = a.GetInteger(Resource.Styleable.ShineButton_click_animation_duration, (int)shineParams.ClickAnimDuration); shineParams.EnableFlashing = a.GetBoolean(Resource.Styleable.ShineButton_enable_flashing, false); shineParams.ShineCount = a.GetInteger(Resource.Styleable.ShineButton_shine_count, shineParams.ShineCount); shineParams.ShineDistanceMultiple = a.GetFloat(Resource.Styleable.ShineButton_shine_distance_multiple, shineParams.ShineDistanceMultiple); shineParams.ShineTurnAngle = a.GetFloat(Resource.Styleable.ShineButton_shine_turn_angle, shineParams.ShineTurnAngle); shineParams.SmallShineColor = a.GetColor(Resource.Styleable.ShineButton_small_shine_color, shineParams.SmallShineColor); shineParams.SmallShineOffsetAngle = a.GetFloat(Resource.Styleable.ShineButton_small_shine_offset_angle, shineParams.SmallShineOffsetAngle); shineParams.ShineSize = a.GetDimensionPixelSize(Resource.Styleable.ShineButton_shine_size, shineParams.ShineSize); a.Recycle(); SourceColour = btnColor; }
public ChipView(Context context, IAttributeSet attrs, int defStyleAttr) : base(context, attrs, defStyleAttr) { TypedArray a = context.Theme.ObtainStyledAttributes(attrs, Resource.Styleable.ChipView, defStyleAttr, 0); if (a.HasValue(Resource.Styleable.ChipView_chip_text)) { _chipText = a.GetString(Resource.Styleable.ChipView_chip_text); } _hasIcon = a.GetBoolean(Resource.Styleable.ChipView_enable_icon, false); if (a.HasValue(Resource.Styleable.ChipView_chip_icon)) { _chipIcon = a.GetDrawable(Resource.Styleable.ChipView_chip_icon); } _closable = a.GetBoolean(Resource.Styleable.ChipView_closeable, false); _selectable = a.GetBoolean(Resource.Styleable.ChipView_chip_selectable, false); _backgroundColor = a.GetColor(Resource.Styleable.ChipView_chip_backgroundColor, ContextCompat.GetColor(context, Resource.Color.default_chip_background_color)); _selectedBackgroundColor = a.GetColor(Resource.Styleable.ChipView_chip_selectedBackgroundColor, ContextCompat.GetColor(context, Resource.Color.default_chip_background_clicked_color)); _textColor = a.GetColor(Resource.Styleable.ChipView_chip_text_color, ContextCompat.GetColor(context, Resource.Color.default_chip_text_color)); _selectedTextColor = a.GetColor(Resource.Styleable.ChipView_chip_selected_text_color, ContextCompat.GetColor(context, Resource.Color.default_chip_text_clicked_color)); _closeColor = a.GetColor(Resource.Styleable.ChipView_chip_close_color, ContextCompat.GetColor(context, Resource.Color.default_chip_close_inactive_color)); _selectedCloseColor = a.GetColor(Resource.Styleable.ChipView_chip_selected_close_color, ContextCompat.GetColor(context, Resource.Color.default_chip_close_clicked_color)); _cornerRadius = (int)a.GetDimension(Resource.Styleable.ChipView_chip_cornerRadius, Resources.GetDimension(Resource.Dimension.chip_height) / 2); _strokeSize = (int)a.GetDimension(Resource.Styleable.ChipView_chip_strokeSize, 0); _strokeColor = a.GetColor(Resource.Styleable.ChipView_chip_strokeColor, ContextCompat.GetColor(context, Resource.Color.default_chip_close_clicked_color)); if (a.HasValue(Resource.Styleable.ChipView_chip_iconText)) { _iconText = a.GetString(Resource.Styleable.ChipView_chip_iconText); } _iconTextColor = a.GetColor(Resource.Styleable.ChipView_chip_iconTextColor, ContextCompat.GetColor(context, Resource.Color.default_chip_background_clicked_color)); _iconTextBackgroundColor = a.GetColor(Resource.Styleable.ChipView_chip_iconTextBackgroundColor, ContextCompat.GetColor(context, Resource.Color.default_chip_close_clicked_color)); a.Recycle(); InitalizeViews(context); }
/// <summary> /// Initializes a new instance of the <see cref="PagerSlidingTabStrip"/> class. /// </summary> /// <param name="context">The context.</param> /// <param name="attrs">The attributes from xml.</param> /// <param name="defStyle">The default style.</param> public PagerSlidingTabStrip(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { HorizontalScrollBarEnabled = false; FillViewport = true; SetWillNotDraw(false); _tabsContainer = new LinearLayout(context); _tabsContainer.Orientation = Android.Widget.Orientation.Horizontal; _tabsContainer.LayoutParameters = new ViewGroup.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent); AddView(_tabsContainer); DisplayMetrics dm = Resources.DisplayMetrics; _scrollOffset = Convert.ToInt32(TypedValue.ApplyDimension(ComplexUnitType.Dip, _scrollOffset, dm)); _indicatorHeight = Convert.ToInt32(TypedValue.ApplyDimension(ComplexUnitType.Dip, _indicatorHeight, dm)); _underlineHeight = Convert.ToInt32(TypedValue.ApplyDimension(ComplexUnitType.Dip, _underlineHeight, dm)); _tabDividerPadding = Convert.ToInt32(TypedValue.ApplyDimension(ComplexUnitType.Dip, _tabDividerPadding, dm)); _tabPadding = Convert.ToInt32(TypedValue.ApplyDimension(ComplexUnitType.Dip, _tabPadding, dm)); _dividerWidth = Convert.ToInt32(TypedValue.ApplyDimension(ComplexUnitType.Dip, _dividerWidth, dm)); _tabTextSize = Convert.ToInt32(TypedValue.ApplyDimension(ComplexUnitType.Dip, _tabTextSize, dm)); // get system attrs (android:textSize and android:textColor) TypedArray a = context.ObtainStyledAttributes(attrs, ATTRS); _tabTextSize = a.GetDimensionPixelSize(0, _tabTextSize); _tabTextColor = a.GetColor(1, _tabTextColor); a.Recycle(); // get custom attrs a = context.ObtainStyledAttributes(attrs, Resource.Styleable.PagerSlidingTabStrip); _indicatorColor = a.GetColor(Resource.Styleable.PagerSlidingTabStrip_indicatorColor, _indicatorColor); _underlineColor = a.GetColor(Resource.Styleable.PagerSlidingTabStrip_underlineColor, _underlineColor); _dividerColor = a.GetColor(Resource.Styleable.PagerSlidingTabStrip_dividerColor, _dividerColor); _indicatorHeight = a.GetDimensionPixelSize(Resource.Styleable.PagerSlidingTabStrip_indicatorHeight, _indicatorHeight); _underlineHeight = a.GetDimensionPixelSize(Resource.Styleable.PagerSlidingTabStrip_underlineHeight, _underlineHeight); _tabDividerPadding = a.GetDimensionPixelSize(Resource.Styleable.PagerSlidingTabStrip_tabDividerPadding, _tabDividerPadding); _tabPadding = a.GetDimensionPixelSize(Resource.Styleable.PagerSlidingTabStrip_tabPaddingLeftRight, _tabPadding); _tabBackgroundResId = a.GetResourceId(Resource.Styleable.PagerSlidingTabStrip_tabBackground, _tabBackgroundResId); _shouldExpand = a.GetBoolean(Resource.Styleable.PagerSlidingTabStrip_shouldExpand, _shouldExpand); _scrollOffset = a.GetDimensionPixelSize(Resource.Styleable.PagerSlidingTabStrip_scrollOffset, _scrollOffset); _tabTextAllCaps = a.GetBoolean(Resource.Styleable.PagerSlidingTabStrip_tabTextAllCaps, _tabTextAllCaps); a.Recycle(); _rectPaint = new Paint(); _rectPaint.AntiAlias = true; _rectPaint.SetStyle(Android.Graphics.Paint.Style.Fill); _dividerPaint = new Paint(); _dividerPaint.AntiAlias = true; _dividerPaint.StrokeWidth = _dividerWidth; _defaultTabLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WrapContent, LayoutParams.MatchParent); _expandedTabLayoutParams = new LinearLayout.LayoutParams(0, LayoutParams.MatchParent, 1.0f); }
public void inititialize(Context context, IAttributeSet attrs, int defStyle) { mHandler = new SlidingHandler(this); TypedArray a = context.ObtainStyledAttributes(attrs, Resource.Styleable.MultiDirectionSlidingDrawer, defStyle, 0); int orientation = a.GetInt(Resource.Styleable.MultiDirectionSlidingDrawer_direction, ORIENTATION_BTT); mVertical = (orientation == ORIENTATION_BTT || orientation == ORIENTATION_TTB); mBottomOffset = (int)a.GetDimension(Resource.Styleable.MultiDirectionSlidingDrawer_bottomOffset, 0.0f); mTopOffset = (int)a.GetDimension(Resource.Styleable.MultiDirectionSlidingDrawer_topOffset, 0.0f); mAllowSingleTap = a.GetBoolean(Resource.Styleable.MultiDirectionSlidingDrawer_allowSingleTap, true); mAnimateOnClick = a.GetBoolean(Resource.Styleable.MultiDirectionSlidingDrawer_animateOnClick, true); mInvert = (orientation == ORIENTATION_TTB || orientation == ORIENTATION_LTR); int handleId = a.GetResourceId(Resource.Styleable.MultiDirectionSlidingDrawer_handle, 0); if (handleId == 0) { throw new Java.Lang.IllegalArgumentException("The handle attribute is required and must refer " + "to a valid child."); } int contentId = a.GetResourceId(Resource.Styleable.MultiDirectionSlidingDrawer_content, 0); if (contentId == 0) { throw new Java.Lang.IllegalArgumentException("The content attribute is required and must refer " + "to a valid child."); } if (handleId == contentId) { throw new Java.Lang.IllegalArgumentException("The content and handle attributes must refer " + "to different children."); } mHandleId = handleId; mContentId = contentId; float density = Resources.DisplayMetrics.Density; mTapThreshold = (int)(TAP_THRESHOLD * density + 0.5f); mMaximumTapVelocity = (int)(MAXIMUM_TAP_VELOCITY * density + 0.5f); mMaximumMinorVelocity = (int)(MAXIMUM_MINOR_VELOCITY * density + 0.5f); mMaximumMajorVelocity = (int)(MAXIMUM_MAJOR_VELOCITY * density + 0.5f); mMaximumAcceleration = (int)(MAXIMUM_ACCELERATION * density + 0.5f); mVelocityUnits = (int)(VELOCITY_UNITS * density + 0.5f); if (mInvert) { mMaximumAcceleration = -mMaximumAcceleration; mMaximumMajorVelocity = -mMaximumMajorVelocity; mMaximumMinorVelocity = -mMaximumMinorVelocity; } a.Recycle(); AlwaysDrawnWithCacheEnabled = false; }
/** * Initializes paint objects and sets desired attributes. * @param Context Context * @param _attrs Attributes * @param _defStyle Default Style */ private void Init() { // Initialize paint objects _paint = new Paint { AntiAlias = true }; _paintBorder = new Paint { AntiAlias = true }; _paintSelectorBorder = new Paint { AntiAlias = true }; // Disable this view's hardware acceleration on Honeycomb and up (Needed for shadow effect) if (Build.VERSION.SdkInt >= BuildVersionCodes.Honeycomb) { SetLayerType(LayerType.Software, _paintBorder); SetLayerType(LayerType.Software, _paintSelectorBorder); } // load the styled attributes and set their properties TypedArray attributes = Context.ObtainStyledAttributes(_attrs, Resource.Styleable.CircularImageView, _defStyle, 0); // Check if border and/or border is enabled _hasBorder = attributes.GetBoolean(Resource.Styleable.CircularImageView_border, false); _hasSelector = attributes.GetBoolean(Resource.Styleable.CircularImageView_selector, false); // Set border properties if enabled if (_hasBorder) { int defaultBorderSize = (int)(2 * Context.Resources.DisplayMetrics.Density + 0.5f); SetBorderWidth(attributes.GetDimensionPixelOffset(Resource.Styleable.CircularImageView_border_width, defaultBorderSize)); SetBorderColor(attributes.GetColor(Resource.Styleable.CircularImageView_border_color, Color.White)); } // Set selector properties if enabled if (_hasSelector) { int defaultSelectorSize = (int)(2 * Context.Resources.DisplayMetrics.Density + 0.5f); SetSelectorColor(attributes.GetColor( Resource.Styleable.CircularImageView_selector_color, Color.Transparent)); SetSelectorStrokeWidth(attributes.GetDimensionPixelOffset(Resource.Styleable.CircularImageView_selector_stroke_width, defaultSelectorSize)); SetSelectorStrokeColor(attributes.GetColor(Resource.Styleable.CircularImageView_selector_stroke_color, Color.Blue)); } // Add shadow if enabled if (attributes.GetBoolean(Resource.Styleable.CircularImageView_shadow, false)) { SetShadow(attributes); } // We no longer need our attributes TypedArray, give it back to cache attributes.Recycle(); }
private void initAttrs(Context context, IAttributeSet attrs, int defStyle) { TypedArray a = context.ObtainStyledAttributes(attrs, Resource.Styleable.RecyclerViewPager, defStyle, 0); mFlingFactor = a.GetFloat(Resource.Styleable.RecyclerViewPager_rvp_flingFactor, 0.15f); mTriggerOffset = a.GetFloat(Resource.Styleable.RecyclerViewPager_rvp_triggerOffset, 0.25f); mSinglePageFling = a.GetBoolean(Resource.Styleable.RecyclerViewPager_rvp_singlePageFling, mSinglePageFling); isInertia = a.GetBoolean(Resource.Styleable.RecyclerViewPager_rvp_inertia, false); mMillisecondsPerInch = a.GetFloat(Resource.Styleable.RecyclerViewPager_rvp_millisecondsPerInch, 25f); a.Recycle(); }
public SystemBarTintManager(Activity activity) { Window win = activity.Window; ViewGroup decorViewGroup = (ViewGroup)win.DecorView; if (Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat) { // check theme attrs int[] attrs = { Android.Resource.Attribute.WindowTranslucentStatus, Android.Resource.Attribute.WindowTranslucentNavigation }; TypedArray a = activity.ObtainStyledAttributes(attrs); try { mStatusBarAvailable = a.GetBoolean(0, false); mNavBarAvailable = a.GetBoolean(1, false); } finally { a.Recycle(); } // check window flags //IWindowManager.LayoutParams WindowManagerLayoutParams winParams = win.Attributes; WindowManagerFlags bits = WindowManagerFlags.TranslucentStatus; if ((winParams.Flags & bits) != 0) { mStatusBarAvailable = true; } bits = WindowManagerFlags.TranslucentNavigation; if ((winParams.Flags & bits) != 0) { mNavBarAvailable = true; } } mConfig = new SystemBarConfig(activity, mStatusBarAvailable, mNavBarAvailable); // device might not have virtual navigation keys if (!mConfig.hasNavigtionBar()) { mNavBarAvailable = false; } if (mStatusBarAvailable) { setupStatusBarView(activity, decorViewGroup); } if (mNavBarAvailable) { setupNavBarView(activity, decorViewGroup); } }
public XLHRatingBar(Context context, IAttributeSet attrs) : base(context, attrs) { TypedArray typedArray = context.ObtainStyledAttributes(attrs, Resource.Styleable.XlHRatingBar); countNum = typedArray.GetInt(Resource.Styleable.XlHRatingBar_starCount, 5); countSelected = typedArray.GetInt(Resource.Styleable.XlHRatingBar_countSelected, 0); canEdit = typedArray.GetBoolean(Resource.Styleable.XlHRatingBar_canEdit, false); differentSize = typedArray.GetBoolean(Resource.Styleable.XlHRatingBar_differentSize, false); widthAndHeight = typedArray.GetDimension(Resource.Styleable.XlHRatingBar_widthAndHeight, ScreenUtils.dpToPxInt(0)); dividerWidth = typedArray.GetDimension(Resource.Styleable.XlHRatingBar_dividerWidth, ScreenUtils.dpToPxInt(0)); stateResId = typedArray.GetResourceId(Resource.Styleable.XlHRatingBar_stateResId, -1); initView(); }
/// <summary> /// Constructs a new MapView object from a context object and attributes. /// </summary> /// <param name="context">The context object.</param> /// <param name="attrs">The attributes.</param> public MapView(Context context, IAttributeSet attrs) : base(context, attrs) { // Connect context info and assets manager to native part AndroidUtils.SetContext(context); if (_assetManager == null) { Carto.Utils.Log.Warn("MapView: MapView created before MapView.RegisterLicense is called"); _assetManager = context.ApplicationContext.Assets; AssetUtils.SetAssetManagerPointer(_assetManager); } // Unless explictly not clickable, make clickable by default bool clickable = true; bool longClickable = true; try { TypedArray ta = context.ObtainStyledAttributes(attrs, new int[] { Android.Resource.Attribute.Clickable, Android.Resource.Attribute.LongClickable }); clickable = ta.GetBoolean(0, true); longClickable = ta.GetBoolean(1, true); ta.Recycle(); } catch (System.Exception e) { Carto.Utils.Log.Warn("MapView: Failed to read attributes"); } Clickable = clickable; LongClickable = longClickable; // Create base map view, attach redraw listener _baseMapView = new BaseMapView(); _baseMapView.GetOptions().DPI = (int)Resources.DisplayMetrics.DensityDpi; _redrawRequestListener = new MapRedrawRequestListener(this); _baseMapView.SetRedrawRequestListener(_redrawRequestListener); // Create base map renderer and EGL configuration chooser _baseMapViewRenderer = new BaseMapViewRenderer(_baseMapView); try { System.Reflection.PropertyInfo prop = typeof(GLSurfaceView).GetProperty("PreserveEGLContextOnPause"); prop.SetValue(this, true); } catch (System.Exception) { Carto.Utils.Log.Info("MapView: Preserving EGL context on pause is not possible"); } SetEGLContextClientVersion(2); SetEGLConfigChooser(new ConfigChooser()); SetRenderer(_baseMapViewRenderer); RenderMode = Rendermode.WhenDirty; }
private void ReadAttrs(Context context, IAttributeSet attrs, int defStyle) { TypedArray typedArray = context.ObtainStyledAttributes(attrs, Resource.Styleable.GaugeView, defStyle, 0); mShowOuterShadow = typedArray.GetBoolean(Resource.Styleable.GaugeView_showOuterShadow, SHOW_OUTER_SHADOW); mShowOuterBorder = typedArray.GetBoolean(Resource.Styleable.GaugeView_showOuterBorder, SHOW_OUTER_BORDER); mShowOuterRim = typedArray.GetBoolean(Resource.Styleable.GaugeView_showOuterRim, SHOW_OUTER_RIM); mShowInnerRim = typedArray.GetBoolean(Resource.Styleable.GaugeView_showInnerRim, SHOW_INNER_RIM); mShowNeedle = typedArray.GetBoolean(Resource.Styleable.GaugeView_showNeedle, SHOW_NEEDLE); mShowScale = typedArray.GetBoolean(Resource.Styleable.GaugeView_showScale, SHOW_SCALE); mShowRanges = typedArray.GetBoolean(Resource.Styleable.GaugeView_showRanges, SHOW_RANGES); mShowText = typedArray.GetBoolean(Resource.Styleable.GaugeView_showText, SHOW_TEXT); mOuterShadowWidth = mShowOuterShadow ? typedArray.GetFloat(Resource.Styleable.GaugeView_outerShadowWidth, OUTER_SHADOW_WIDTH) : 0.0f; mOuterBorderWidth = mShowOuterBorder ? typedArray.GetFloat(Resource.Styleable.GaugeView_outerBorderWidth, OUTER_BORDER_WIDTH) : 0.0f; mOuterRimWidth = mShowOuterRim ? typedArray.GetFloat(Resource.Styleable.GaugeView_outerRimWidth, OUTER_RIM_WIDTH) : 0.0f; mInnerRimWidth = mShowInnerRim ? typedArray.GetFloat(Resource.Styleable.GaugeView_innerRimWidth, INNER_RIM_WIDTH) : 0.0f; mInnerRimBorderWidth = mShowInnerRim ? typedArray.GetFloat(Resource.Styleable.GaugeView_innerRimBorderWidth, INNER_RIM_BORDER_WIDTH) : 0.0f; mNeedleWidth = typedArray.GetFloat(Resource.Styleable.GaugeView_needleWidth, NEEDLE_WIDTH); mNeedleHeight = typedArray.GetFloat(Resource.Styleable.GaugeView_needleHeight, NEEDLE_HEIGHT); mScalePosition = (mShowScale || mShowRanges) ? typedArray.GetFloat(Resource.Styleable.GaugeView_scalePosition, SCALE_POSITION) : 0.0f; mScaleStartValue = typedArray.GetFloat(Resource.Styleable.GaugeView_scaleStartValue, SCALE_START_VALUE); mScaleEndValue = typedArray.GetFloat(Resource.Styleable.GaugeView_scaleEndValue, SCALE_END_VALUE); mScaleStartAngle = typedArray.GetFloat(Resource.Styleable.GaugeView_scaleStartAngle, SCALE_START_ANGLE); mScaleEndAngle = typedArray.GetFloat(Resource.Styleable.GaugeView_scaleEndAngle, 360.0f - mScaleStartAngle); mDivisions = typedArray.GetInteger(Resource.Styleable.GaugeView_divisions, SCALE_DIVISIONS); mSubdivisions = typedArray.GetInteger(Resource.Styleable.GaugeView_subdivisions, SCALE_SUBDIVISIONS); if (mShowRanges) { mTextShadowColor = typedArray.GetColor(Resource.Styleable.GaugeView_textShadowColor, TEXT_SHADOW_COLOR); string[] rangeValues = typedArray.GetTextArray(Resource.Styleable.GaugeView_rangeValues); string[] rangeColors = typedArray.GetTextArray(Resource.Styleable.GaugeView_rangeColors); ReadRanges(rangeValues, rangeColors); } if (mShowText) { int textValueId = typedArray.GetResourceId(Resource.Styleable.GaugeView_textValue, 0); string textValue = typedArray.GetString(Resource.Styleable.GaugeView_textValue); mTextValue = (0 < textValueId) ? context.GetString(textValueId) : (null != textValue) ? textValue : ""; int textUnitId = typedArray.GetResourceId(Resource.Styleable.GaugeView_textUnit, 0); string textUnit = typedArray.GetString(Resource.Styleable.GaugeView_textUnit); mTextUnit = (0 < textUnitId) ? context.GetString(textUnitId) : (null != textUnit) ? textUnit : ""; mTextValueColor = typedArray.GetColor(Resource.Styleable.GaugeView_textValueColor, TEXT_VALUE_COLOR); mTextUnitColor = typedArray.GetColor(Resource.Styleable.GaugeView_textUnitColor, TEXT_UNIT_COLOR); mTextShadowColor = typedArray.GetColor(Resource.Styleable.GaugeView_textShadowColor, TEXT_SHADOW_COLOR); mTextValueSize = typedArray.GetFloat(Resource.Styleable.GaugeView_textValueSize, TEXT_VALUE_SIZE); mTextUnitSize = typedArray.GetFloat(Resource.Styleable.GaugeView_textUnitSize, TEXT_UNIT_SIZE); } typedArray.Recycle(); }
private void init(IAttributeSet attrs, int defStyle) { TypedArray a = Context.ObtainStyledAttributes(attrs, Resource.Styleable.ColorBars, defStyle, 0); Resources b = Context.Resources; mBarThickness = a.GetDimensionPixelSize( Resource.Styleable.ColorBars_bar_thickness, b.GetDimensionPixelSize(Resource.Dimension.bar_thickness)); mBarLength = a.GetDimensionPixelSize(Resource.Styleable.ColorBars_bar_length, b.GetDimensionPixelSize(Resource.Dimension.bar_length)); mPreferredBarLength = mBarLength; mBarPointerRadius = a.GetDimensionPixelSize( Resource.Styleable.ColorBars_bar_pointer_radius, b.GetDimensionPixelSize(Resource.Dimension.bar_pointer_radius)); mBarPointerHaloRadius = a.GetDimensionPixelSize( Resource.Styleable.ColorBars_bar_pointer_halo_radius, b.GetDimensionPixelSize(Resource.Dimension.bar_pointer_halo_radius)); mOrientation = a.GetBoolean( Resource.Styleable.ColorBars_bar_orientation_horizontal, ORIENTATION_DEFAULT); int n = a.IndexCount; for (int i = 0; i < n; i++) { int attributeIndex = a.GetIndex(i); switch (attributeIndex) { case Resource.Attribute.bar_corner_radius: case Resource.Styleable.ColorBars_bar_corner_radius: try { mCornerRadius = a.GetFloat(attributeIndex, CORNER_RADIUS_DEFAULT); } catch (Exception e) { System.Console.Error.WriteLine(e + ": " + e.Message); } break; default: break; } } a.Recycle(); mBarPaint = new Paint(PaintFlags.AntiAlias); mBarPaint.SetShader(shader); mBarPointerPosition = (mBarLength / 2) + mBarPointerHaloRadius; mBarPointerHaloPaint = new Paint(PaintFlags.AntiAlias); mBarPointerHaloPaint.Color = (Color.Black); mBarPointerHaloPaint.Alpha = (0x50); mBarPointerPaint = new Paint(PaintFlags.AntiAlias); mBarPointerPaint.Color = new Color(unchecked ((int)(0xff81ff00))); mPosToSVFactor = 1 / ((float)mBarLength / 2); mSVToPosFactor = ((float)mBarLength / 2) / 1; }
private void Init(Context context, IAttributeSet attrs) { ConstructModel(); counterTextViewModel.stop = fixedStop; elapsedSecond = fixedStop; TypedArray ta = context.ObtainStyledAttributes(attrs, Resource.Styleable.CounterTextView, 0, 0); try { counterTextViewModel.progression = ta.GetInt(Resource.Styleable.CounterTextView_progression, 1); counterTextViewModel.stop = ta.GetInt(Resource.Styleable.CounterTextView_stop, -11111111); counterTextViewModel.StopText = ta.GetString(Resource.Styleable.CounterTextView_stopText); counterTextViewModel.start = ta.GetInt(Resource.Styleable.CounterTextView_start, 0); counterTextViewModel.StartText = ta.GetString(Resource.Styleable.CounterTextView_startText); counterTextViewModel.interval = ta.GetInt(Resource.Styleable.CounterTextView_interval, 1000); counterTextViewModel.future = ta.GetInt(Resource.Styleable.CounterTextView_future, 0); counterTextViewModel.repeat = ta.GetBoolean(Resource.Styleable.CounterTextView_repeat, false); if (counterTextViewModel.future > 0) { futureDone = true; } } finally { ta.Recycle(); } lastnumber = counterTextViewModel.start;; SetText(); }
private void init(IAttributeSet attrs) { TypedArray typedArray = Context.ObtainStyledAttributes(attrs, Resource.Styleable.timeline_style); mMarker = typedArray.GetDrawable(Resource.Styleable.timeline_style_marker); mStartLine = typedArray.GetDrawable(Resource.Styleable.timeline_style_line); mEndLine = typedArray.GetDrawable(Resource.Styleable.timeline_style_line); mMarkerSize = typedArray.GetDimensionPixelSize(Resource.Styleable.timeline_style_markerSize, Utils.dpToPx(20, mContext)); mLineSize = typedArray.GetDimensionPixelSize(Resource.Styleable.timeline_style_lineSize, Utils.dpToPx(2, mContext)); mLineOrientation = typedArray.GetInt(Resource.Styleable.timeline_style_lineOrientation, 1); mLinePadding = typedArray.GetDimensionPixelSize(Resource.Styleable.timeline_style_linePadding, 0); mMarkerInCenter = typedArray.GetBoolean(Resource.Styleable.timeline_style_markerInCenter, true); typedArray.Recycle(); if (mMarker == null) { mMarker = mContext.Resources.GetDrawable(Resource.Drawable.marker); } if (mStartLine == null && mEndLine == null) { mStartLine = new ColorDrawable(mContext.Resources.GetColor(Android.Resource.Color.DarkerGray)); mEndLine = new ColorDrawable(mContext.Resources.GetColor(Android.Resource.Color.DarkerGray)); } }
public BottomSheet4StateBehaviour(Context context, IAttributeSet attrs) : base(context, attrs) { using (TypedArray a = context.ObtainStyledAttributes(attrs, Resource.Styleable.BottomSheetBehavior_Layout)) { PeekHeight = a.GetDimensionPixelSize(Resource.Styleable.BottomSheetBehavior_Layout_behavior_peekHeight, 0); Hideable = a.GetBoolean(Resource.Styleable.BottomSheetBehavior_Layout_behavior_hideable, false); } /** * Getting the anchorPoint... */ AnchorPoint = DefaultAnchorPoint > PeekHeight ? DefaultAnchorPoint : 0; Collapsible = true; using (TypedArray a1 = context.ObtainStyledAttributes(attrs, Resource.Styleable.CustomBottomSheetBehavior)) { AnchorPoint = (int)a1.GetDimension(Resource.Styleable.CustomBottomSheetBehavior_anchorPoint, DefaultAnchorPoint); // _state = a1.GetInt(Resource.Styleable.CustomBottomSheetBehavior_defaultState, StateCollapsed); _state = a1.GetInt(Resource.Styleable.CustomBottomSheetBehavior_defaultState, StateAnchorPoint); } ViewConfiguration configuration = ViewConfiguration.Get(context); _minimumVelocity = configuration.ScaledMinimumFlingVelocity; _dragCallback = new ViewDragHelperCallback(this); }
private void init(Context context, Android.Util.IAttributeSet attrs, int defStyle) { LayoutInflater.From(context).Inflate(Resource.Layout.sat_main, this, true); imgMain = FindViewById <ImageView>(Resource.Id.sat_main); if (attrs != null) { TypedArray typedArray = context.ObtainStyledAttributes(attrs, Resource.Styleable.SatelliteMenu, defStyle, 0); satelliteDistance = typedArray.GetDimensionPixelSize(Resource.Styleable.SatelliteMenu_satelliteDistance, DEFAULT_SATELLITE_DISTANCE); totalSpacingDegree = typedArray.GetFloat(Resource.Styleable.SatelliteMenu_totalSpacingDegree, DEFAULT_TOTAL_SPACING_DEGREES); closeItemsOnClick = typedArray.GetBoolean(Resource.Styleable.SatelliteMenu_closeOnClick, DEFAULT_CLOSE_ON_CLICK); expandDuration = typedArray.GetInt(Resource.Styleable.SatelliteMenu_expandDuration, DEFAULT_EXPAND_DURATION); //float satelliteDistance = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 170, getResources().getDisplayMetrics()); typedArray.Recycle(); } mainRotateLeft = SatelliteAnimationCreator.createMainButtonAnimation(context); mainRotateRight = SatelliteAnimationCreator.createMainButtonInverseAnimation(context); mainRotateLeft.SetAnimationListener(this); mainRotateRight.SetAnimationListener(this); imgMain.Click += (s, e) => { onClick(); }; internalItemClickListener = new InternalSatelliteOnClickListener(this); }
public AmbilWarnaPreference(Context context, IAttributeSet attrs) : base(context, attrs) { TypedArray ta = context.ObtainStyledAttributes(attrs, R.Styleable.AmbilWarnaPreference); _supportsAlpha = ta.GetBoolean(R.Styleable.AmbilWarnaPreference_supportsAlpha, false); }
public PanoramaImageView(Context context, IAttributeSet attr, int defStyleAttr) : base(context, attr, defStyleAttr) { this.SetScaleType(ScaleType.CenterCrop); TypedArray typedArray = context.ObtainStyledAttributes(attr, Resource.Styleable.PanoramaImageView); mEnablePanoramaMode = typedArray.GetBoolean(Resource.Styleable.PanoramaImageView_piv_enablePanoramaMode, true); mInvertScrollDirection = typedArray.GetBoolean(Resource.Styleable.PanoramaImageView_piv_invertScrollDirection, false); mEnableScrollbar = typedArray.GetBoolean(Resource.Styleable.PanoramaImageView_piv_show_scrollbar, true); typedArray.Recycle(); if (mEnableScrollbar) { InitScrollbarPaint(); } }
private void LoadAttribute(Context context, IAttributeSet attrs) { TypedArray typedArray = context.Theme.ObtainStyledAttributes(attrs, Resource.Styleable.MusicBar, 0, 0); try { MLoadedBarSecondaryPaint.Color = typedArray.GetColor( Resource.Styleable.MusicBar_LoadedBarSecondaryColor, ContextCompat.GetColor(context, Resource.Color.LoadedBarSecondaryColor)); MBackgroundBarSecondaryPaint.Color = typedArray.GetColor( Resource.Styleable.MusicBar_backgroundBarSecondaryColor, ContextCompat.GetColor(context, Resource.Color.BackgroundBarSecondaryColor)); IsDivided = typedArray.GetBoolean(Resource.Styleable.MusicBar_divided, false); MDividerSize = typedArray.GetFloat(Resource.Styleable.MusicBar_dividerSize, 2); MBarWidth = typedArray.GetFloat(Resource.Styleable.MusicBar_barWidth, 3); MLoadedBarPrimeColor.StrokeWidth = MBarWidth; MBackgroundBarPrimeColor.StrokeWidth = MBarWidth; MLoadedBarSecondaryPaint.StrokeWidth = MBarWidth; MBackgroundBarSecondaryPaint.StrokeWidth = MBarWidth; MDividerSize = MBarWidth + MDividerSize; } catch (Exception e) { Console.WriteLine(e); } finally { typedArray.Recycle(); } }
/** * Constructor that is called when inflating SwipeRefreshLayout from XML. * * @param context * @param attrs */ public SwipeRefreshLayout(Context context, IAttributeSet attrs) : base(context, attrs) { mRefreshListener = new CustomRefreshListener(this); mAnimateToCorrectPosition = new CustommAnimateToCorrectPosition(this); mAnimateToStartPosition = new CustommAnimateToStartPosition(this); mTouchSlop = ViewConfiguration.Get(context).ScaledTouchSlop; mMediumAnimationDuration = Resources.GetInteger( AndroidResource.Integer.ConfigMediumAnimTime); SetWillNotDraw(false); mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR); TypedArray a = context.ObtainStyledAttributes(attrs, LAYOUT_ATTRS); Enabled = (a.GetBoolean(0, true)); a.Recycle(); DisplayMetrics metrics = Resources.DisplayMetrics; mCircleWidth = (int)(CIRCLE_DIAMETER * metrics.Density); mCircleHeight = (int)(CIRCLE_DIAMETER * metrics.Density); createProgressView(); ViewCompat.SetChildrenDrawingOrderEnabled(this, true); // the absolute offset has to take into account that the circle starts at an offset mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.Density; mTotalDragDistance = mSpinnerFinalOffset; RequestDisallowInterceptTouchEvent(true); }
public static bool IsHidesFooterIfEmptyEnabled(Context context, IAttributeSet attrs) { TryInitializeBindingResourcePaths(); TypedArray typedArray = null; bool hidesFooterIfEmpty = true; try { typedArray = context.ObtainStyledAttributes(attrs, MvxRecyclerViewGroupId); int numberOfStyles = typedArray.IndexCount; for (int i = 0; i < numberOfStyles; ++i) { var attributeId = typedArray.GetIndex(i); if (attributeId == MvxRecyclerViewHidesFooterIfEmpty) { hidesFooterIfEmpty = typedArray.GetBoolean(attributeId, true); break; } } return(hidesFooterIfEmpty); } finally { typedArray.Recycle(); } }
private void Initialize(IAttributeSet attrs) { //Load those if set in xml resource file. TypedArray a = Context.ObtainStyledAttributes(attrs, Resource.Styleable.ColorPickerView); mShowAlphaPanel = a.GetBoolean(Resource.Styleable.ColorPickerView_alphaChannelVisible, false); mAlphaSliderText = a.GetString(Resource.Styleable.ColorPickerView_alphaChannelText); //TODO : cross check calculation mSliderTrackerColor = a.GetColor(Resource.Styleable.ColorPickerView_colorPickerSliderColor, Int32.Parse("FFBDBDBD", System.Globalization.NumberStyles.HexNumber)); mBorderColor = a.GetColor(Resource.Styleable.ColorPickerView_colorPickerBorderColor, Int32.Parse("FF6E6E6E", System.Globalization.NumberStyles.HexNumber)); a.Recycle(); mDensity = Context.Resources.DisplayMetrics.Density; PALETTE_CIRCLE_TRACKER_RADIUS *= mDensity; RECTANGLE_TRACKER_OFFSET *= mDensity; HUE_PANEL_WIDTH *= mDensity; ALPHA_PANEL_HEIGHT *= mDensity; PANEL_SPACING = PANEL_SPACING * mDensity; mDrawingOffset = calculateRequiredOffset(); initPaintTools(); //Needed for receiving trackball motion events. Focusable = true; FocusableInTouchMode = true; }
public PresetButton(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { TypedArray a = context.ObtainStyledAttributes(attrs, Resource.Styleable.PresetButton, defStyle, 0); _Selected = a.GetBoolean(Resource.Styleable.PresetButton_Selected, false); a.Recycle(); }
/// <summary> /// 获取自定义属性 /// </summary> /// <param name="context"></param> /// <param name="attrs"></param> private void GetAttributes(Context context, IAttributeSet attrs) { TypedArray a = context.ObtainStyledAttributes(attrs, Resource.Styleable.CircleImageView); mBorderWidth = a.GetDimensionPixelSize(Resource.Styleable.CircleImageView_border_width, DEFAULT_BORDER_WIDTH); mBorderColor = a.GetColor(Resource.Styleable.CircleImageView_border_color, DEFAULT_BORDER_COLOR); mBorderOverlay = a.GetBoolean(Resource.Styleable.CircleImageView_border_overlay, DEFAULT_BORDER_OVERLAY); a.Recycle(); }
private void InitialDefaultValues(IAttributeSet attrs) { // Dimensions mRowHeaderWidth = (int)Resources.GetDimension(Resource.Dimension.default_row_header_width); mColumnHeaderHeight = (int)Resources.GetDimension(Resource.Dimension.default_column_header_height); // Colors mSelectedColor = ContextCompat.GetColor(Context, Resource.Color.table_view_default_selected_background_color); mUnSelectedColor = ContextCompat.GetColor(Context, Resource.Color.table_view_default_unselected_background_color); mShadowColor = ContextCompat.GetColor(Context, Resource.Color.table_view_default_shadow_background_color); if (attrs == null) { // That means TableView is created programmatically. return; } // Get values from xml attributes TypedArray a = Context.Theme.ObtainStyledAttributes(attrs, Resource.Styleable.TableView, 0, 0); try { // Dimensions mRowHeaderWidth = (int)a.GetDimension(Resource.Styleable.TableView_row_header_width, mRowHeaderWidth); mColumnHeaderHeight = (int)a.GetDimension(Resource.Styleable.TableView_column_header_height, mColumnHeaderHeight); // Colors mSelectedColor = a.GetColor(Resource.Styleable.TableView_selected_color, mSelectedColor); mUnSelectedColor = a.GetColor(Resource.Styleable.TableView_unselected_color, mUnSelectedColor); mShadowColor = a.GetColor(Resource.Styleable.TableView_shadow_color, mShadowColor); mSeparatorColor = a.GetColor(Resource.Styleable.TableView_separator_color, ContextCompat.GetColor(Context, Resource.Color.table_view_default_separator_color)); // Booleans mShowVerticalSeparators = a.GetBoolean(Resource.Styleable.TableView_show_vertical_separator, mShowVerticalSeparators); mShowHorizontalSeparators = a.GetBoolean(Resource.Styleable.TableView_show_horizontal_separator, mShowHorizontalSeparators); } finally { a.Recycle(); } }
public RotateLoadingLayout(Context context, Mode mode, PtrOrientation scrollDirection, TypedArray attrs) : base(context, mode, scrollDirection, attrs) { //super(context, mode, scrollDirection, attrs); mRotateDrawableWhilePulling = attrs.GetBoolean(Resource.Styleable.PullToRefresh_ptrRotateDrawableWhilePulling, true); mHeaderImage.SetScaleType(ImageView.ScaleType.Matrix); mHeaderImageMatrix = new Matrix(); mHeaderImage.ImageMatrix = mHeaderImageMatrix; mRotateAnimation = new RotateAnimation(0, 720, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f); mRotateAnimation.Interpolator = ANIMATION_INTERPOLATOR; mRotateAnimation.Duration = ROTATION_ANIMATION_DURATION; mRotateAnimation.RepeatCount = Animation.Infinite; mRotateAnimation.RepeatMode = RepeatMode.Restart; }
private void InitializeHideBackgroundIfCollapsed(TypedArray attributes) { this._hideBackgroundIfCollapsed = attributes.GetBoolean(Resource.Styleable.expandable_selector_hide_background_if_collapsed, false); this._expandedBackground = this.Background; this.UpdateBackground(); }
private void InitializeHideFirstItemOnCollapse(TypedArray attributes) { bool hideFirstItemOnCollapsed = attributes.GetBoolean(Resource.Styleable.expandable_selector_hide_first_item_on_collapse, false); this._expandableSelectorAnimator.HideFirstItemOnCollapse = hideFirstItemOnCollapsed; }