示例#1
0
        public void TestComparison()
        {
            TypedArray a1 = new TypedArray(Variant.EnumType.Double, 2);
            a1[0] = 1.0;
            a1[1] = 2.0;

            Variant v1 = new Variant(a1);

            TypedArray a2 = new TypedArray(Variant.EnumType.Double, 2);
            a2[0] = 1.0;
            a2[1] = 2.0;

            Variant v2 = new Variant(a2);

            TypedArray a3 = new TypedArray(Variant.EnumType.Double, 2);
            a3[0] = 2.0;
            a3[1] = 1.0;

            Variant v3 = new Variant(a3);

            Assert.IsTrue(v1.Equals(v2));
            Assert.IsFalse(v1.Equals(v3));

            Assert.AreEqual(0, v1.CompareTo(v2));
            Assert.AreEqual(-1, v2.CompareTo(v3));
            Assert.AreEqual(1, v3.CompareTo(v2));
        }
 public void TestCtorSize() {
     Action f = () => {
         var a = new TypedArray(2);
         Done(a.ByteLength == TypedArray.BytesPerElement * 2 && a.Length == 2 && a[0] == 0 && a[1] == 0);
     };
     this.Start(f);
 }
 public void TestCtorArray() {
     Action f = () => {
         var a = new TypedArray(new ElementType[] { 1, 2 });
         Done(a.ByteLength == TypedArray.BytesPerElement * 2 && a.Length == 2 && a[0] == 1 && a[1] == 2);
     };
     this.Start(f);
 }
 public void TestCtorArrayBufferOffsetLength() {
     Action f = () => {
         var b = new TypedArray(new ElementType[] { 1, 2, 3 });
         var a = new TypedArray(b.Buffer, TypedArray.BytesPerElement, 1);
         Done(a.ByteLength == TypedArray.BytesPerElement * 1 && a.Length == 1 && a[0] == 2);
     };
     this.Start(f);
 }
 public void TestIndexer() {
     Action f = () => {
         var a = new TypedArray(1);
         a[0] = 99;
         Done(a[0] == 99);
     };
     this.Start(f);
 }
		protected internal virtual void initControlBar(Activity activity, TypedArray array)
		{
			DeviceActionsLayout.BUTTON_HEIGHT = array.getLayoutDimension(R.styleable.FloatingControler_bar_thickness, activity.Resources.getDimensionPixelSize(R.dimen.default_controlbar_thickness));
			DeviceActionsLayout.BUTTON_WIDTH = activity.Resources.getDimensionPixelSize(R.dimen.button_width);
			if (DeviceActionsLayout.BUTTON_WIDTH == 0)
			{
				DeviceActionsLayout.BUTTON_WIDTH = (int) Math.Ceiling(((double)DeviceActionsLayout.BUTTON_HEIGHT * 68) / 56);
			}
			//mBarThickness=array.getLayoutDimension(R.styleable.FloatingControler_bar_thickness, LayoutParams.WRAP_CONTENT);
		}
示例#7
0
        public void TestConstruction()
        {
            TypedArray a1 = new TypedArray(Variant.EnumType.Double, 2);
            a1[0] = 1.0;
            a1[1] = 2.0;

            Variant v1 = new Variant(a1);

            Assert.DoesNotThrow(delegate { v1.AsArray(); });
            Assert.Throws<VariantException>(delegate { v1.As<int>(); });
        }
示例#8
0
 public DrawerListAdapter(Context context,int drawerMenuList, int drawerMenuImages,DrawerListBadges badges)
 {
     _Context = context;
     _badges = badges;
     //_drawerMenuList = drawerMenuList;
     //_drawerMenuImages = drawerMenuImages;
     _inflater = ( LayoutInflater )context.
         GetSystemService(Context.LayoutInflaterService);
     _drawerMenuList = _Context.Resources.GetStringArray (drawerMenuList);
     _drawerMenuImages = _Context.Resources.ObtainTypedArray (drawerMenuImages);
 }
		private Drawable createPressedDrawable(TypedArray attr) {
			GradientDrawable drawablePressed =
				(GradientDrawable) getDrawable(Resource.Drawable.rect_pressed).Mutate();
			drawablePressed.SetCornerRadius(getCornerRadius());

			int blueDark = getColor(Resource.Color.blue_pressed);
			int colorPressed = attr.GetColor(Resource.Styleable.FlatButton_pb_colorPressed, blueDark);
			drawablePressed.SetColor(colorPressed);

			return drawablePressed;
		}
 private void ApplyBindingsFromAttribute(View view, TypedArray typedArray, int attributeId)
 {
     try
     {
         var bindingText = typedArray.GetString(attributeId);
         var newBindings = Binder.Bind(_source, view, bindingText);
         StoreBindings(view, newBindings);
     }
     catch (Exception exception)
     {
         MvxBindingTrace.Trace(MvxTraceLevel.Error, "Exception thrown during the view binding {0}",
                               exception.ToLongString());
     }
 }
        public FlipLoadingLayout(Context context, Mode mode, PTROrientation scrollDirection, TypedArray attrs)
            : base(context, mode, scrollDirection, attrs)
        {
            //super(context, mode, scrollDirection, attrs);

            int rotateAngle = mode == Mode.PULL_FROM_START ? -180 : 180;

            mRotateAnimation = new RotateAnimation(0, rotateAngle, Dimension.RelativeToSelf, 0.5f,
                    Dimension.RelativeToSelf, 0.5f);
            mRotateAnimation.Interpolator = ANIMATION_INTERPOLATOR;
            mRotateAnimation.Duration = FLIP_ANIMATION_DURATION;
            mRotateAnimation.FillAfter = true;

            mResetRotateAnimation = new RotateAnimation(rotateAngle, 0, Dimension.RelativeToSelf, 0.5f,
                    Dimension.RelativeToSelf, 0.5f);
            mResetRotateAnimation.Interpolator = ANIMATION_INTERPOLATOR;
            mResetRotateAnimation.Duration = FLIP_ANIMATION_DURATION;
            mResetRotateAnimation.FillAfter = true;
        }
        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;

        }
示例#13
0
        public void TestBinaryStreams()
        {
            TypedArray a1 = new TypedArray(Variant.EnumType.Double, 2);
            a1[0] = 1.0;
            a1[1] = 2.0;

            Variant v1 = new Variant(a1);

            byte[] bytes = BinaryWriter.ToBytes(v1);

            Variant v2 = BinaryReader.FromBytes(bytes);

            TypedArray a2 = v2.AsArray();

            Assert.AreEqual(a1.Count, a2.Count);
            Assert.AreEqual(a1.ElementType, a2.ElementType);

            Assert.AreEqual((double)a1[0], (double)a2[0]);
            Assert.AreEqual((double)a1[1], (double)a2[1]);
        }
		private LayerDrawable createNormalDrawable(TypedArray attr) {
			LayerDrawable drawableNormal =
				(LayerDrawable) getDrawable(Resource.Drawable.rect_normal).Mutate();
				
			GradientDrawable drawableTop = (GradientDrawable)drawableNormal.GetDrawable (0).Mutate ();
			drawableTop.SetCornerRadius(getCornerRadius());

			int blueDark = getColor(Resource.Color.blue_pressed);

			int colorPressed = attr.GetColor(Resource.Styleable.FlatButton_pb_colorPressed, blueDark);
			drawableTop.SetColor(colorPressed);

			GradientDrawable drawableBottom =
				(GradientDrawable) drawableNormal.GetDrawable(1).Mutate();
			drawableBottom.SetCornerRadius(getCornerRadius());

			int blueNormal = getColor(Resource.Color.blue_normal);
			int colorNormal = attr.GetColor(Resource.Styleable.FlatButton_pb_colorNormal, blueNormal);
			drawableBottom.SetColor(colorNormal);
			return drawableNormal;
		}
示例#15
0
        public void TestXMLStreams()
        {
            TypedArray a1 = new TypedArray(Variant.EnumType.Double, 2);
            a1[0] = 1.0;
            a1[1] = 2.0;

            Variant v1 = new Variant(a1);

            string xml = XmlWriter.ToString(v1);

            System.Console.WriteLine(xml);

            /*Variant v2 = BinaryReader.FromBytes(bytes);

            TypedArray a2 = v2.AsArray();

            Assert.AreEqual(a1.Count, a2.Count);
            Assert.AreEqual(a1.ElementType, a2.ElementType);

            Assert.AreEqual((double)a1[0], (double)a2[0]);
            Assert.AreEqual((double)a1[1], (double)a2[1]);*/
        }
示例#16
0
        private float ExtractNumericValueFromAttributes(TypedArray a, int attribute, int defaultValue)
        {
            var tv = a.PeekValue(attribute);

            return(tv == null ? defaultValue : a.GetFloat(attribute, defaultValue));
        }
示例#17
0
 public DisposableTypedArray(TypedArray array)
 {
     _array = array;
 }
示例#18
0
        private Attributes ReadAttribute()
        {
            Attributes attrs = new Attributes(Activity);
            TypedArray a     = Activity.Theme.ObtainStyledAttributes(null,
                                                                     Resource.Styleable.ActionSheet, Resource.Attribute.actionSheetStyle, 0);
            Drawable background = a
                                  .GetDrawable(Resource.Styleable.ActionSheet_actionSheetBackground);

            if (background != null)
            {
                attrs.background = background;
            }
            Drawable cancelButtonBackground = a
                                              .GetDrawable(Resource.Styleable.ActionSheet_cancelButtonBackground);

            if (cancelButtonBackground != null)
            {
                attrs.cancelButtonBackground = cancelButtonBackground;
            }
            Drawable otherButtonTopBackground = a
                                                .GetDrawable(Resource.Styleable.ActionSheet_otherButtonTopBackground);

            if (otherButtonTopBackground != null)
            {
                attrs.otherButtonTopBackground = otherButtonTopBackground;
            }
            Drawable otherButtonMiddleBackground = a
                                                   .GetDrawable(Resource.Styleable.ActionSheet_otherButtonMiddleBackground);

            if (otherButtonMiddleBackground != null)
            {
                attrs.otherButtonMiddleBackground = otherButtonMiddleBackground;
            }
            Drawable otherButtonBottomBackground = a
                                                   .GetDrawable(Resource.Styleable.ActionSheet_otherButtonBottomBackground);

            if (otherButtonBottomBackground != null)
            {
                attrs.otherButtonBottomBackground = otherButtonBottomBackground;
            }
            Drawable otherButtonSingleBackground = a
                                                   .GetDrawable(Resource.Styleable.ActionSheet_otherButtonSingleBackground);

            if (otherButtonSingleBackground != null)
            {
                attrs.otherButtonSingleBackground = otherButtonSingleBackground;
            }
            attrs.cancelButtonTextColor = a.GetColor(
                Resource.Styleable.ActionSheet_cancelButtonTextColor,
                attrs.cancelButtonTextColor);
            attrs.otherButtonTextColor = a.GetColor(
                Resource.Styleable.ActionSheet_otherButtonTextColor,
                attrs.otherButtonTextColor);
            attrs.padding = (int)a.GetDimension(
                Resource.Styleable.ActionSheet_actionSheetPadding, attrs.padding);
            attrs.otherButtonSpacing = (int)a.GetDimension(
                Resource.Styleable.ActionSheet_otherButtonSpacing,
                attrs.otherButtonSpacing);
            attrs.cancelButtonMarginTop = (int)a.GetDimension(
                Resource.Styleable.ActionSheet_cancelButtonMarginTop,
                attrs.cancelButtonMarginTop);
            attrs.actionSheetTextSize = a.GetDimensionPixelSize(Resource.Styleable.ActionSheet_actionSheetTextSize, (int)attrs.actionSheetTextSize);

            a.Recycle();
            return(attrs);
        }
示例#19
0
        public static EcmaValue Buffer([This] EcmaValue thisValue)
        {
            TypedArray view = thisValue.GetUnderlyingObject <TypedArray>();

            return(view.Buffer);
        }
        private void Init(Context context, IAttributeSet attrs, int defStyleAttr, int defStyleRes)
        {
            try
            {
                View view = Inflate(context, Resource.Layout.RecordViewLayout, null);
                AddView(view);

                ViewGroup viewGroup = (ViewGroup)view.Parent;
                viewGroup.SetClipChildren(false);

                Arrow               = view.FindViewById <ImageView>(Resource.Id.arrow);
                SlideToCancel       = view.FindViewById <TextView>(Resource.Id.slide_to_cancel);
                SmallBlinkingMic    = view.FindViewById <ImageView>(Resource.Id.glowing_mic);
                CounterTime         = view.FindViewById <Chronometer>(Resource.Id.counter_tv);
                BasketImg           = view.FindViewById <ImageView>(Resource.Id.basket_img);
                SlideToCancelLayout = view.FindViewById <ShimmerLayout>(Resource.Id.shimmer_layout);

                HideViews(true);

                if (attrs != null)
                {
                    TypedArray typedArray = context.ObtainStyledAttributes(attrs, Resource.Styleable.RecordView, defStyleAttr, defStyleRes);

                    int    slideArrowResource = typedArray.GetResourceId(Resource.Styleable.RecordView_slide_to_cancel_arrow, -1);
                    string slideToCancelText  = typedArray.GetString(Resource.Styleable.RecordView_slide_to_cancel_text);
                    int    slideMarginRight   = (int)typedArray.GetDimension(Resource.Styleable.RecordView_slide_to_cancel_margin_right, 30);
                    Color  counterTimeColor   = typedArray.GetColor(Resource.Styleable.RecordView_counter_time_color, -1);
                    Color  arrowColor         = typedArray.GetColor(Resource.Styleable.RecordView_slide_to_cancel_arrow_color, -1);

                    int cancelBounds = typedArray.GetDimensionPixelSize(Resource.Styleable.RecordView_slide_to_cancel_bounds, -1);

                    if (cancelBounds != -1)
                    {
                        SetCancelBounds(cancelBounds, false);//don't convert it to pixels since it's already in pixels
                    }
                    if (slideArrowResource != -1)
                    {
                        Drawable slideArrow = AppCompatResources.GetDrawable(((View)this).Context, slideArrowResource);
                        Arrow.SetImageDrawable(slideArrow);
                    }

                    if (slideToCancelText != null)
                    {
                        SlideToCancel.Text = slideToCancelText;
                    }

                    if (counterTimeColor != -1)
                    {
                        SetCounterTimeColor(counterTimeColor);
                    }

                    if (arrowColor != -1)
                    {
                        SetSlideToCancelArrowColor(arrowColor);
                    }

                    SetMarginRight(slideMarginRight, true);

                    typedArray.Recycle();
                }

                AnimationHelper = new AnimationHelper(context, BasketImg, SmallBlinkingMic);
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
 protected override Java.Lang.Object OnGetDefaultValue(TypedArray a, int index)
 {
     //TODO: cross check with the native app
     return(base.OnGetDefaultValue(a, index));
 }
示例#22
0
		/// <summary>
		/// @brief This method was c </summary>
		/// <param name="root"> </param>
		/// <param name="array"> </param>
		public virtual void prepareView(View root, TypedArray array)
		{
			View dragReceiver = root.findViewById(R.id.for_content);
			OnDragListener dragListener = new OnDragListenerAnonymousInnerClassHelper(this);

			int barAlignment = array.getInt(R.styleable.FloatingControler_bar_alignment, ALIGN_PARENT_BOTTOM_RIGHT);
			mBarInitialAlignment = barAlignment;
			if (dragReceiver != null)
			{
				dragReceiver.OnDragListener = dragListener;
			}

			root.OnDragListener = dragListener;
			mMainView = (ViewGroup) root;
			mMainAppImage.Id = Context.GetHashCode();
			mDevicesActionLayoutWidth = mFcContext.getDimension(R.dimen.floating_controller_actions_length);

			putBarOnBoard(barAlignment);
		}
示例#23
0
 protected override Object OnGetDefaultValue(TypedArray a, int index)
 {
     return(a.GetInteger(index, Color.Black));
 }
 private void InitializeHideFirstItemOnCollapse(TypedArray attributes)
 {
     bool hideFirstItemOnCollapsed =
         attributes.GetBoolean(Resource.Styleable.expandable_selector_hide_first_item_on_collapse, false);
     this._expandableSelectorAnimator.HideFirstItemOnCollapse = hideFirstItemOnCollapsed;
 }
 private void InitializeAnimationDuration(TypedArray attributes)
 {
     int animationDuration =
         attributes.GetInteger(Resource.Styleable.expandable_selector_animation_duration,
             DEFAULT_ANIMATION_DURATION);
     int expandInterpolatorId =
         attributes.GetResourceId(Resource.Styleable.expandable_selector_expand_interpolator,
             global::Android.Resource.Animation.AccelerateInterpolator);
     int collapseInterpolatorId =
         attributes.GetResourceId(Resource.Styleable.expandable_selector_collapse_interpolator,
             global::Android.Resource.Animation.DecelerateInterpolator);
     int containerInterpolatorId =
         attributes.GetResourceId(Resource.Styleable.expandable_selector_container_interpolator,
             global::Android.Resource.Animation.DecelerateInterpolator);
     this._expandableSelectorAnimator = new ExpandableSelectorAnimator(this, animationDuration,
         expandInterpolatorId,
         collapseInterpolatorId, containerInterpolatorId);
 }
 private void InitializeHideBackgroundIfCollapsed(TypedArray attributes)
 {
     this._hideBackgroundIfCollapsed =
         attributes.GetBoolean(Resource.Styleable.expandable_selector_hide_background_if_collapsed, false);
     this._expandedBackground = this.Background;
     this.UpdateBackground();
 }
示例#27
0
        void Initialize(IAttributeSet attrs, int defStyle)
        {
            mTouchListener             = new OnTouchListener(this);
            mOnHieratchyChangeListener = new OnHierarchyChangeListener()
            {
                OnChildViewAddedAction = (View parent, View child) =>
                {
                    Log.Debug(TAG, "Child is added: " + child);
                    IViewParent scrollView = parent.Parent;
                    if (scrollView != null && scrollView is ScrollView)
                    {
                        ((ScrollView)scrollView).FullScroll(FocusSearchDirection.Down);
                    }
                    if (this.LayoutTransition != null)
                    {
                        View view = child.FindViewById(Resource.Id.card_actionarea);
                        if (view != null)
                        {
                            view.Alpha = 0;
                        }
                    }
                },
                OnChildViewRemovedAction = (View parent, View child) =>
                {
                    Log.Debug(TAG, "Child is removed: " + child);
                    mFixedViewList.Remove(child);
                }
            };

            mTransitionListener = new TransitionListener()
            {
                StartTransitionAction = (LayoutTransition transition, ViewGroup container, View view, LayoutTransitionType transitionType) =>
                {
                    Log.Debug(TAG, "Start LayoutTransition animation: " + transitionType);
                },
                EndTransitionAction = (LayoutTransition transition, ViewGroup container, View view, LayoutTransitionType transitionType) =>
                {
                    Log.Debug(TAG, "End LayoutTransition animation: " + transitionType);
                    if (transitionType == LayoutTransitionType.Appearing)
                    {
                        View area = view.FindViewById(Resource.Id.card_actionarea);
                        if (area != null)
                        {
                            RunShowActionAreaAnimation(container, area);
                        }
                    }
                }
            };

            float speedFactor = 1f;

            if (attrs != null)
            {
                var        v = Resource.Styleable.CardStream;
                TypedArray a = Context.ObtainStyledAttributes(attrs, Resource.Styleable.CardStream, defStyle, 0);

                if (a != null)
                {
                    int speedType = a.GetInt(Resource.Styleable.CardStream_animationDuration, 1001);
                    switch (speedType)
                    {
                    case ANIMATION_SPEED_FAST:
                        speedFactor = 0.5f;
                        break;

                    case ANIMATION_SPEED_NORMAL:
                        speedFactor = 1f;
                        break;

                    case ANIMATION_SPEED_SLOW:
                        speedFactor = 2f;
                        break;
                    }

                    string animatorName = a.GetString(Resource.Styleable.CardStream_animators);

                    try {
                        if (animatorName != null)
                        {
                            mAnimators = Class.ClassLoader.LoadClass(animatorName).NewInstance() as CardStreamAnimator;
                        }
                    }
                    catch (Exception e) {
                        Log.Error(TAG, "Failed to load animator: " + animatorName, e);
                    }
                    finally {
                        if (mAnimators == null)
                        {
                            mAnimators = new DefaultCardStreamAnimator();
                        }
                    }
                    a.Recycle();
                }
            }

            mAnimators.SpeedFactor = speedFactor;
            mSwipeSlop             = ViewConfiguration.Get(Context).ScaledTouchSlop;
            SetOnHierarchyChangeListener(mOnHieratchyChangeListener);
        }
        /// <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));
            _dividerPadding  = Convert.ToInt32(TypedValue.ApplyDimension(ComplexUnitType.Dip, _dividerPadding, 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);
            _dividerPadding  = a.GetDimensionPixelSize(Resource.Styleable.PagerSlidingTabStrip_pagerDividerPadding, _dividerPadding);
            _tabPadding      = a.GetDimensionPixelSize(Resource.Styleable.PagerSlidingTabStrip_tabPaddingLeftRight, _tabPadding);
            _shouldExpand    = a.GetBoolean(Resource.Styleable.PagerSlidingTabStrip_shouldExpand, _shouldExpand);
            _scrollOffset    = a.GetDimensionPixelSize(Resource.Styleable.PagerSlidingTabStrip_scrollOffset, _scrollOffset);
            _textAllCaps     = a.GetBoolean(Resource.Styleable.PagerSlidingTabStrip_pagerTextAllCaps, _textAllCaps);

            a.Recycle();

            using (var b =
                       Context.ObtainStyledAttributes(new [] { global::Android.Resource.Attribute.SelectableItemBackground }))
            {
                _selectableItem = b.GetDrawable(0);
                b.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);
        }
		protected override Java.Lang.Object OnGetDefaultValue (TypedArray a, int index)
		{
			//TODO: cross check with the native app
			return base.OnGetDefaultValue (a, index);
		}
示例#30
0
        public TimeDurationPicker(Context context, IAttributeSet attrs, int defStyleAttr)
            : base(context, attrs, defStyleAttr)
        {
            Inflate(context, Resource.Layout.time_duration_picker, this);

            // find views
            _displayRow = FindViewById(Resource.Id.displayRow);
            _durationView = FindViewById(Resource.Id.duration);
            _hoursView = FindViewById<TextView>(Resource.Id.hours);
            _minutesView = FindViewById<TextView>(Resource.Id.minutes);
            _secondsView = FindViewById<TextView>(Resource.Id.seconds);
            _displayViews = new TextView[] {_hoursView, _minutesView, _secondsView};

            _hoursLabel = FindViewById<TextView>(Resource.Id.hoursLabel);
            _minutesLabel = FindViewById<TextView>(Resource.Id.minutesLabel);
            _secondsLabel = FindViewById<TextView>(Resource.Id.secondsLabel);
            _unitLabelViews = new TextView[] {_hoursLabel, _minutesLabel, _secondsLabel};

            _backspaceButton = FindViewById<ImageButton>(Resource.Id.backspace);
            _clearButton = FindViewById<ImageButton>(Resource.Id.clear);

            _separatorView = FindViewById(Resource.Id.separator);

            _numPad = FindViewById(Resource.Id.numPad);
            _numPadMeasureButton = FindViewById<Button>(Resource.Id.numPadMeasure);
            _numPadButtons = new Button[]
            {
                FindViewById<Button>(Resource.Id.numPad1), FindViewById<Button>(Resource.Id.numPad2),
                FindViewById<Button>(Resource.Id.numPad3),
                FindViewById<Button>(Resource.Id.numPad4), FindViewById<Button>(Resource.Id.numPad5),
                FindViewById<Button>(Resource.Id.numPad6),
                FindViewById<Button>(Resource.Id.numPad7), FindViewById<Button>(Resource.Id.numPad8),
                FindViewById<Button>(Resource.Id.numPad9),
                FindViewById<Button>(Resource.Id.numPad0), FindViewById<Button>(Resource.Id.numPad00)
            };

            // apply style
            TypedArray attributes = context.Theme.ObtainStyledAttributes(attrs, Resource.Styleable.TimeDurationPicker,
                defStyleAttr, 0);
            try
            {
                ApplyPadding(attributes, Resource.Styleable.TimeDurationPicker_numPadButtonPadding, _numPadButtons);

                ApplyTextAppearance(context, attributes, Resource.Styleable.TimeDurationPicker_textAppearanceDisplay,
                    _displayViews);
                ApplyTextAppearance(context, attributes, Resource.Styleable.TimeDurationPicker_textAppearanceButton,
                    _numPadButtons);
                ApplyTextAppearance(context, attributes, Resource.Styleable.TimeDurationPicker_textAppearanceUnit,
                    _unitLabelViews);

                ApplyIcon(attributes, Resource.Styleable.TimeDurationPicker_backspaceIcon, _backspaceButton);
                ApplyIcon(attributes, Resource.Styleable.TimeDurationPicker_clearIcon, _clearButton);

                ApplyBackgroundColor(attributes, Resource.Styleable.TimeDurationPicker_separatorColor, _separatorView);
                ApplyBackgroundColor(attributes, Resource.Styleable.TimeDurationPicker_durationDisplayBackground,
                    _displayRow);

                ApplyUnits(attributes, Resource.Styleable.TimeDurationPicker_timeUnits);
            }
            finally
            {
                attributes.Recycle();
            }

            // init actions
            UpdateUnits();

            _backspaceButton.Click += (sender, args) => OnBackspace();
            _clearButton.Click += (IntentSender, args) => OnClear();

            foreach (var button in _numPadButtons)
            {
                button.Click += (sender, args) => OnNumberClick(button.Text);
            }

            // init default value
            UpdateHoursMinutesSeconds();
        }
 private void ApplyLanguageBindingsFromAttribute(View view, TypedArray typedArray, int attributeId)
 {
     try
     {
         var bindingText = typedArray.GetString(attributeId);
         var newBindings = Binder.LanguageBind(_source, view, bindingText);
         if (newBindings != null)
         {
             _viewBindings.AddRange(newBindings);
         }
     }
     catch (Exception exception)
     {
         MvxBindingTrace.Trace(MvxTraceLevel.Error, "Exception thrown during the view language binding {0}",
                               exception.ToLongString());
         throw;
     }
 }
示例#32
0
        public static EcmaValue ByteOffset([This] EcmaValue thisValue)
        {
            TypedArray view = thisValue.GetUnderlyingObject <TypedArray>();

            return(view.ByteOffset);
        }
示例#33
0
 public SideMenuAdapter(Activity context, string [] options, TypedArray icons) : base()
 {
     this.context = context;
     this.Options = options;
     this.Icons   = icons;
 }
        public static MessageInputStyle Parse(Context context, IAttributeSet attrs)
        {
            MessageInputStyle style      = new MessageInputStyle(context, attrs);
            TypedArray        typedArray = context.ObtainStyledAttributes(attrs, Resource.Styleable.MessageInput);

            style._showAttachmentButton = typedArray.GetBoolean(Resource.Styleable.MessageInput_showAttachmentButton, false);

            style.attachmentButtonBackground     = typedArray.GetResourceId(Resource.Styleable.MessageInput_attachmentButtonBackground, -1);
            style.attachmentButtonDefaultBgColor = typedArray.GetColor(Resource.Styleable.MessageInput_attachmentButtonDefaultBgColor,
                                                                       style.GetColor(Resource.Color.white_four));
            style.attachmentButtonDefaultBgPressedColor = typedArray.GetColor(Resource.Styleable.MessageInput_attachmentButtonDefaultBgPressedColor,
                                                                              style.GetColor(Resource.Color.white_five));
            style.attachmentButtonDefaultBgDisabledColor = typedArray.GetColor(Resource.Styleable.MessageInput_attachmentButtonDefaultBgDisabledColor,
                                                                               style.GetColor(Resource.Color.transparent));

            style.attachmentButtonIcon             = typedArray.GetResourceId(Resource.Styleable.MessageInput_attachmentButtonIcon, -1);
            style.attachmentButtonDefaultIconColor = typedArray.GetColor(Resource.Styleable.MessageInput_attachmentButtonDefaultIconColor,
                                                                         style.GetColor(Resource.Color.cornflower_blue_two));
            style.attachmentButtonDefaultIconPressedColor = typedArray.GetColor(Resource.Styleable.MessageInput_attachmentButtonDefaultIconPressedColor,
                                                                                style.GetColor(Resource.Color.cornflower_blue_two_dark));
            style.attachmentButtonDefaultIconDisabledColor = typedArray.GetColor(Resource.Styleable.MessageInput_attachmentButtonDefaultIconDisabledColor,
                                                                                 style.GetColor(Resource.Color.cornflower_blue_light_40));

            style.attachmentButtonWidth  = typedArray.GetDimensionPixelSize(Resource.Styleable.MessageInput_attachmentButtonWidth, style.GetDimension(Resource.Dimension.input_button_width));
            style.attachmentButtonHeight = typedArray.GetDimensionPixelSize(Resource.Styleable.MessageInput_attachmentButtonHeight, style.GetDimension(Resource.Dimension.input_button_height));
            style.attachmentButtonMargin = typedArray.GetDimensionPixelSize(Resource.Styleable.MessageInput_attachmentButtonMargin, style.GetDimension(Resource.Dimension.input_button_margin));

            style.inputButtonBackground     = typedArray.GetResourceId(Resource.Styleable.MessageInput_inputButtonBackground, -1);
            style.inputButtonDefaultBgColor = typedArray.GetColor(Resource.Styleable.MessageInput_inputButtonDefaultBgColor,
                                                                  style.GetColor(Resource.Color.cornflower_blue_two));
            style.inputButtonDefaultBgPressedColor = typedArray.GetColor(Resource.Styleable.MessageInput_inputButtonDefaultBgPressedColor,
                                                                         style.GetColor(Resource.Color.cornflower_blue_two_dark));
            style.inputButtonDefaultBgDisabledColor = typedArray.GetColor(Resource.Styleable.MessageInput_inputButtonDefaultBgDisabledColor,
                                                                          style.GetColor(Resource.Color.white_four));

            style.inputButtonIcon             = typedArray.GetResourceId(Resource.Styleable.MessageInput_inputButtonIcon, -1);
            style.inputButtonDefaultIconColor = typedArray.GetColor(Resource.Styleable.MessageInput_inputButtonDefaultIconColor,
                                                                    style.GetColor(Resource.Color.white));
            style.inputButtonDefaultIconPressedColor = typedArray.GetColor(Resource.Styleable.MessageInput_inputButtonDefaultIconPressedColor,
                                                                           style.GetColor(Resource.Color.white));
            style.inputButtonDefaultIconDisabledColor = typedArray.GetColor(Resource.Styleable.MessageInput_inputButtonDefaultIconDisabledColor,
                                                                            style.GetColor(Resource.Color.warm_grey));

            style.inputButtonWidth  = typedArray.GetDimensionPixelSize(Resource.Styleable.MessageInput_inputButtonWidth, style.GetDimension(Resource.Dimension.input_button_width));
            style.inputButtonHeight = typedArray.GetDimensionPixelSize(Resource.Styleable.MessageInput_inputButtonHeight, style.GetDimension(Resource.Dimension.input_button_height));
            style.inputButtonMargin = typedArray.GetDimensionPixelSize(Resource.Styleable.MessageInput_inputButtonMargin, style.GetDimension(Resource.Dimension.input_button_margin));

            style.inputMaxLines = typedArray.GetInt(Resource.Styleable.MessageInput_inputMaxLines, DEFAULT_MAX_LINES);
            style.inputHint     = typedArray.GetString(Resource.Styleable.MessageInput_inputHint);
            style.inputText     = typedArray.GetString(Resource.Styleable.MessageInput_inputText);

            style.inputTextSize  = typedArray.GetDimensionPixelSize(Resource.Styleable.MessageInput_inputTextSize, style.GetDimension(Resource.Dimension.input_text_size));
            style.inputTextColor = typedArray.GetColor(Resource.Styleable.MessageInput_inputTextColor, style.GetColor(Resource.Color.dark_grey_two));
            style.inputHintColor = typedArray.GetColor(Resource.Styleable.MessageInput_inputHintColor, style.GetColor(Resource.Color.warm_grey_three));

            style.inputBackground     = typedArray.GetDrawable(Resource.Styleable.MessageInput_inputBackground);
            style.inputCursorDrawable = typedArray.GetDrawable(Resource.Styleable.MessageInput_inputCursorDrawable);

            typedArray.Recycle();

            style.inputDefaultPaddingLeft   = style.GetDimension(Resource.Dimension.input_padding_left);
            style.inputDefaultPaddingRight  = style.GetDimension(Resource.Dimension.input_padding_right);
            style.inputDefaultPaddingTop    = style.GetDimension(Resource.Dimension.input_padding_top);
            style.inputDefaultPaddingBottom = style.GetDimension(Resource.Dimension.input_padding_bottom);

            return(style);
        }
        public RotateLoadingLayout(Context context, PullMode mode, ScrollOrientation scrollDirection, TypedArray attrs) : base(context, mode, scrollDirection, attrs)
        {
            mRotateDrawableWhilePulling = attrs.GetBoolean(Resource.Styleable.PullToRefresh_ptrRotateDrawableWhilePulling, true);

            mHeaderImage.SetScaleType(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;
        }
示例#36
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public LoadingLayout(android.content.Context context, final PullToRefresh.PullMode mode, final PullToRefresh.ScrollOrientation scrollDirection, android.content.res.TypedArray attrs)
        public LoadingLayout(Context context, PullMode mode, ScrollOrientation scrollDirection, TypedArray attrs) : base(context)
        {
            mMode            = mode;
            mScrollDirection = scrollDirection;

            switch (scrollDirection)
            {
            case ScrollOrientation.HORIZONTAL:
                LayoutInflater.From(context).Inflate(Resource.Layout.pull_to_refresh_header_horizontal, this);
                break;

            case ScrollOrientation.VERTICAL:
            default:
                LayoutInflater.From(context).Inflate(Resource.Layout.pull_to_refresh_header_vertical, this);
                break;
            }

            mInnerLayout    = (FrameLayout)FindViewById(Resource.Id.fl_inner);
            mHeaderText     = (TextView)mInnerLayout.FindViewById(Resource.Id.pull_to_refresh_text);
            mHeaderProgress = (ProgressBar)mInnerLayout.FindViewById(Resource.Id.pull_to_refresh_progress);
            mSubHeaderText  = (TextView)mInnerLayout.FindViewById(Resource.Id.pull_to_refresh_sub_text);
            mHeaderImage    = (ImageView)mInnerLayout.FindViewById(Resource.Id.pull_to_refresh_image);

            LayoutParams lp = (LayoutParams)mInnerLayout.LayoutParameters;

            switch (mode)
            {
            case PullMode.PULL_FROM_END:
                lp.Gravity = scrollDirection == ScrollOrientation.VERTICAL ? GravityFlags.Top : GravityFlags.Left;

                // Load in labels
                mPullLabel       = context.GetString(Resource.String.pull_to_refresh_pull_label);
                mRefreshingLabel = context.GetString(Resource.String.pull_to_refresh_refreshing_label);
                mReleaseLabel    = context.GetString(Resource.String.pull_to_refresh_release_label);
                break;

            case PullMode.PULL_FROM_START:
            default:
                lp.Gravity = scrollDirection == ScrollOrientation.VERTICAL ? GravityFlags.Bottom : GravityFlags.Right;

                // Load in labels
                mPullLabel       = context.GetString(Resource.String.pull_to_refresh_pull_label);
                mRefreshingLabel = context.GetString(Resource.String.pull_to_refresh_refreshing_label);
                mReleaseLabel    = context.GetString(Resource.String.pull_to_refresh_release_label);
                break;
            }

            if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrHeaderBackground))
            {
                Drawable background = attrs.GetDrawable(Resource.Styleable.PullToRefresh_ptrHeaderBackground);
                if (null != background)
                {
                    ViewCompat.setBackground(this, background);
                }
            }

            if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrHeaderTextAppearance))
            {
                TypedValue styleID = new TypedValue();
                attrs.GetValue(Resource.Styleable.PullToRefresh_ptrHeaderTextAppearance, styleID);
                TextAppearance = styleID.Data;
            }
            if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrSubHeaderTextAppearance))
            {
                TypedValue styleID = new TypedValue();
                attrs.GetValue(Resource.Styleable.PullToRefresh_ptrSubHeaderTextAppearance, styleID);
                SubTextAppearance = styleID.Data;
            }

            // Text Color attrs need to be set after TextAppearance attrs
            if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrHeaderTextColor))
            {
                ColorStateList colors = attrs.GetColorStateList(Resource.Styleable.PullToRefresh_ptrHeaderTextColor);
                if (null != colors)
                {
                    TextColor = colors;
                }
            }
            if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrHeaderSubTextColor))
            {
                ColorStateList colors = attrs.GetColorStateList(Resource.Styleable.PullToRefresh_ptrHeaderSubTextColor);
                if (null != colors)
                {
                    SubTextColor = colors;
                }
            }

            // Try and get defined drawable from Attrs
            Drawable imageDrawable = null;

            if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrDrawable))
            {
                imageDrawable = attrs.GetDrawable(Resource.Styleable.PullToRefresh_ptrDrawable);
            }

            // Check Specific Drawable from Attrs, these overrite the generic
            // drawable attr above
            switch (mode)
            {
            case PullMode.PULL_FROM_START:
            default:
                if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrDrawableStart))
                {
                    imageDrawable = attrs.GetDrawable(Resource.Styleable.PullToRefresh_ptrDrawableStart);
                }
                else if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrDrawableTop))
                {
                    Utils.warnDeprecation("ptrDrawableTop", "ptrDrawableStart");
                    imageDrawable = attrs.GetDrawable(Resource.Styleable.PullToRefresh_ptrDrawableTop);
                }
                break;

            case PullMode.PULL_FROM_END:
                if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrDrawableEnd))
                {
                    imageDrawable = attrs.GetDrawable(Resource.Styleable.PullToRefresh_ptrDrawableEnd);
                }
                else if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrDrawableBottom))
                {
                    Utils.warnDeprecation("ptrDrawableBottom", "ptrDrawableEnd");
                    imageDrawable = attrs.GetDrawable(Resource.Styleable.PullToRefresh_ptrDrawableBottom);
                }
                break;
            }

            // If we don't have a user defined drawable, load the default
            if (null == imageDrawable)
            {
                imageDrawable = context.Resources.GetDrawable(DefaultDrawableResId);
            }

            // Set Drawable, and save width/height
            LoadingDrawable = imageDrawable;

            reset();
        }
示例#37
0
        public static EcmaValue Length([This] EcmaValue thisValue)
        {
            TypedArray view = thisValue.GetUnderlyingObject <TypedArray>();

            return(view.Length);
        }
示例#38
0
        private void InitView(Context context, IAttributeSet attrs, int defStyleAttr, int defStyleRes)
        {
            if (IsInEditMode)
            {
                return;
            }
            else
            {
                View view = LayoutInflater.From(context).Inflate(Resource.Layout.view_carousel, this, true);
                this._containerViewPager = (CarouselViewPager)view.FindViewById(Resource.Id.containerViewPager);
                this._mIndicator         = (CirclePageIndicator)view.FindViewById(Resource.Id.indicator);
                this._containerViewPager.AddOnPageChangeListener(new CarouselViewOnPageChangeListener(this));
                // Retrieve styles attributes
                TypedArray a = context.ObtainStyledAttributes(attrs, Resource.Styleable.CarouselView, defStyleAttr, 0);
                try
                {
                    SetIndicatorMarginVertical(a.GetInt(Resource.Styleable.CarouselView_indicatorMarginVertical,
                                                        Resources.GetDimensionPixelSize(Resource.Dimension.default_indicator_margin_vertical)));
                    SetIndicatorMarginHorizontal(a.GetInt(Resource.Styleable.CarouselView_indicatorMarginHorizontal,
                                                          Resources.GetDimensionPixelSize(Resource.Dimension.default_indicator_margin_horizontal)));
                    this.SetPageTransformInterval(a.GetInt(Resource.Styleable.CarouselView_pageTransformInterval,
                                                           _defaultSlideVelocity));
                    this.SetSlideInterval(a.GetInt(Resource.Styleable.CarouselView_slideInterval, _defaultSlideInterval));
                    SetOrientation(a.GetInt(Resource.Styleable.CarouselView_indicatorOrientation,
                                            (int)Android.Widget.Orientation.Horizontal));
                    SetIndicatorGravity((GravityFlags)a.GetInt(Resource.Styleable.CarouselView_indicatorGravity, (int)(GravityFlags.Bottom | GravityFlags.CenterHorizontal)));
                    SetAutoPlay(a.GetBoolean(Resource.Styleable.CarouselView_autoPlay, true));
                    SetDisableAutoPlayOnUserInteraction(
                        a.GetBoolean(Resource.Styleable.CarouselView_disableAutoPlayOnUserInteraction, false));
                    SetAnimateOnBoundary(a.GetBoolean(Resource.Styleable.CarouselView_animateOnBoundary, true));
                    this.SetPageTransformer(new CarouselViewPagerTransformer((CarouselViewPagerTransformerType)a.GetInt(Resource.Styleable.CarouselView_pageTransformer, (int)CarouselViewPagerTransformerType.Default)));
                    Color fillColor = a.GetColor(Resource.Styleable.CarouselView_fillColor, 0);
                    if (fillColor != 0)
                    {
                        SetFillColor(fillColor);
                    }

                    Color pageColor = a.GetColor(Resource.Styleable.CarouselView_pageColor, 0);
                    if (pageColor != 0)
                    {
                        SetPageColor(pageColor);
                    }

                    float radius = a.GetDimensionPixelSize(Resource.Styleable.CarouselView_radius, 0);
                    if (radius != 0)
                    {
                        SetRadius(radius);
                    }

                    SetSnap(a.GetBoolean(Resource.Styleable.CarouselView_snap,
                                         Resources.GetBoolean(Resource.Boolean.default_circle_indicator_snap)));
                    Color strokeColor = a.GetColor(Resource.Styleable.CarouselView_strokeColor, 0);
                    if (strokeColor != 0)
                    {
                        SetStrokeColor(strokeColor);
                    }

                    float strokeWidth = a.GetDimensionPixelSize(Resource.Styleable.CarouselView_strokeWidth, 0);
                    if (strokeWidth != 0)
                    {
                        SetStrokeWidth(strokeWidth);
                    }
                }
                finally
                {
                    a.Recycle();
                }
            }
        }
示例#39
0
 protected override Java.Lang.Object OnGetDefaultValue(TypedArray a, int index)
 {
     return(a.GetString(index));
 }
示例#40
0
        protected void Init(Context context, IAttributeSet attrs)
        {
            if (IsInEditMode)
            {
                return;
            }

            if (null == attrs)
            {
                throw new IllegalArgumentException("Attributes should be provided to this view,");
            }

            TypedArray typedArray = context.ObtainStyledAttributes(attrs, Resource.Styleable.RippleBackground);

            rippleColor        = typedArray.GetColor(Resource.Styleable.RippleBackground_rb_rippleColour, -1);
            rippleStrokeWidth  = typedArray.GetDimension(Resource.Styleable.RippleBackground_rb_strokeWidth, Resource.Dimension.rippleStrokeWidth);
            rippleRadius       = typedArray.GetDimension(Resource.Styleable.RippleBackground_rb_radius, Resource.Dimension.rippleRadius);
            rippleDurationTime = typedArray.GetInt(Resource.Styleable.RippleBackground_rb_duration, DEFAULT_DURATION_TIME);
            rippleAmount       = typedArray.GetInt(Resource.Styleable.RippleBackground_rb_rippleAmount, DEFAULT_RIPPLE_COUNT);
            rippleScale        = typedArray.GetFloat(Resource.Styleable.RippleBackground_rb_scale, DEFAULT_SCALE);
            rippleType         = typedArray.GetInt(Resource.Styleable.RippleBackground_rb_type, DEFAULT_FILL_TYPE);
            RippleOnClick      = typedArray.GetBoolean(Resource.Styleable.RippleBackground_rb_rippleOnClick, true);
            typedArray.Recycle();

            rippleDelay = rippleDurationTime / rippleAmount;

            paint = new Paint
            {
                AntiAlias = true
            };

            if (rippleType == DEFAULT_FILL_TYPE)
            {
                rippleStrokeWidth = 0;
                paint.SetStyle(Paint.Style.Fill);
            }
            else
            {
                paint.SetStyle(Paint.Style.Stroke);
            }

            // set colour
            if (rippleColor == -1)
            {
                paint.Color = Color.DarkBlue;
            }
            else
            {
                paint.Color = new Color(rippleColor);
            }

            rippleParams = new LayoutParams((int)(2 * (rippleRadius + rippleStrokeWidth)), (int)(2 * (rippleRadius + rippleStrokeWidth)));
            rippleParams.AddRule(LayoutRules.CenterInParent, 1);

            animatorSet = new AnimatorSet();
            animatorSet.SetInterpolator(new AccelerateDecelerateInterpolator());
            animatorList = new JavaList <Animator>();

            for (int i = 0; i < rippleAmount; i++)
            {
                RippleView rippleView = new RippleView(Context, rippleStrokeWidth, paint);
                AddView(rippleView, rippleParams);
                rippleViewList.Add(rippleView);

                ObjectAnimator scaleXAnimator = ObjectAnimator.OfFloat(rippleView, "ScaleX", 1.0f, rippleScale);
                scaleXAnimator.RepeatCount = ValueAnimator.Infinite;
                scaleXAnimator.RepeatMode  = ValueAnimatorRepeatMode.Restart;
                scaleXAnimator.StartDelay  = (i * rippleDelay);
                scaleXAnimator.SetDuration(rippleDurationTime);
                animatorList.Add(scaleXAnimator);

                ObjectAnimator scaleYAnimator = ObjectAnimator.OfFloat(rippleView, "ScaleY", 1.0f, rippleScale);
                scaleYAnimator.RepeatCount = ValueAnimator.Infinite;
                scaleYAnimator.RepeatMode  = ValueAnimatorRepeatMode.Restart;
                scaleYAnimator.StartDelay  = (i * rippleDelay);
                scaleYAnimator.SetDuration(rippleDurationTime);
                animatorList.Add(scaleYAnimator);

                ObjectAnimator alphaAnimator = ObjectAnimator.OfFloat(rippleView, "Alpha", 1.0f, 0f);
                alphaAnimator.RepeatCount = ValueAnimator.Infinite;
                alphaAnimator.RepeatMode  = ValueAnimatorRepeatMode.Restart;
                alphaAnimator.StartDelay  = (i * rippleDelay);
                alphaAnimator.SetDuration(rippleDurationTime);
                animatorList.Add(alphaAnimator);
            }

            // set up click event
            Click += RippleBackground_Click;

            animatorSet.PlayTogether(animatorList);
        }
 public void TestSetTypedArray() {
     Action f = () => {
         var b = new TypedArray(new ElementType[] { 1, 2 });
         var a = new TypedArray(new ElementType[] { 6, 7, 8, 9 });
         a.Set(b);
         Done(a[0] == 1 && a[1] == 2 && a[2] == 8 && a[3] == 9);
     };
     this.Start(f);
 }
 protected override Java.Lang.Object OnGetDefaultValue(TypedArray a, int index) => a.GetInt(index, 1);
示例#43
0
 protected override Object OnGetDefaultValue(TypedArray a, int index)
 {
     return base.OnGetDefaultValue(a, index);
 }
示例#44
0
        public MyTitleBar(Context context, IAttributeSet attrs) : base(context, attrs)
        {
            //base(context, attrs);
            LayoutInflater.From(context).Inflate(Resource.Layout.TitleBar, this, true);
            title_bar_left_btn  = FindViewById <Button>(Resource.Id.titleBar_left_btn);
            title_bar_right_btn = FindViewById <Button>(Resource.Id.titleBar_right_btn);
            title_bar_title     = FindViewById <TextView>(Resource.Id.title_bar_title);

            try
            {
                TypedArray attributes = context.ObtainStyledAttributes(attrs, Resource.Styleable.CustomeTitleBar);
                if (attributes != null)
                {
                    //titlebar 背景颜色

                    int titleBarBackground = attributes.GetResourceId(Resource.Styleable.CustomeTitleBar_title_background_color, Resource.Color.color_primary);
                    SetBackgroundResource(titleBarBackground);

                    //左边按钮
                    //是否显示
                    bool leftButtonVisible = attributes.GetBoolean(Resource.Styleable.CustomeTitleBar_left_button_visible, true);
                    if (leftButtonVisible)
                    {
                        title_bar_left_btn.Visibility = ViewStates.Visible;
                    }
                    else
                    {
                        title_bar_left_btn.Visibility = ViewStates.Gone;
                    }

                    //设置左边按钮的文字和图标(二者只能选其一)
                    string leftButtonText = attributes.GetString(Resource.Styleable.CustomeTitleBar_left_button_text);
                    if (!string.IsNullOrEmpty(leftButtonText))
                    {
                        title_bar_left_btn.Text = leftButtonText;
                        //设置左边按钮的文字颜色
                        Color leftButtonTextColor = attributes.GetColor(Resource.Styleable.CustomeTitleBar_left_button_text_color, Color.White);
                        title_bar_left_btn.SetTextColor(leftButtonTextColor);
                    }
                    else //(不设置文本,就只能设置图标)
                    {
                        int leftButtonDrawable = attributes.GetResourceId(Resource.Styleable.CustomeTitleBar_left_button_drawable, Resource.Drawable.icon_white_arrow_left);
                        if (leftButtonDrawable != -1)
                        {
                            Drawable drawable = Resources.GetDrawable(leftButtonDrawable);
                            drawable.SetBounds(0, 0, drawable.MinimumWidth, drawable.MinimumHeight);//不设置这句图标显示不出来
                            title_bar_left_btn.SetCompoundDrawables(drawable, null, null, null);
                        }
                    }

                    //右边按钮
                    //是否显示
                    bool rightButtonVisible = attributes.GetBoolean(Resource.Styleable.CustomeTitleBar_right_button_visible, true);
                    if (rightButtonVisible)
                    {
                        title_bar_right_btn.Visibility = ViewStates.Visible;
                    }
                    else
                    {
                        title_bar_right_btn.Visibility = ViewStates.Gone;
                    }

                    //设置左边按钮的文字和图标(二者只能选其一)
                    string rightButtonText = attributes.GetString(Resource.Styleable.CustomeTitleBar_right_button_text);
                    if (!string.IsNullOrEmpty(rightButtonText))
                    {
                        title_bar_right_btn.Text = rightButtonText;
                        //设置左边按钮的文字颜色
                        Color leftButtonTextColor = attributes.GetColor(Resource.Styleable.CustomeTitleBar_right_button_text_color, Color.White);
                        title_bar_right_btn.SetTextColor(leftButtonTextColor);
                    }
                    else //(不设置文本,就只能设置图标)
                    {
                        int rightButtonDrawable = attributes.GetResourceId(Resource.Styleable.CustomeTitleBar_right_button_drawable, Resource.Drawable.icon_white_arrow_left);
                        if (rightButtonDrawable != -1)
                        {
                            Drawable drawable = Resources.GetDrawable(rightButtonDrawable);
                            drawable.SetBounds(0, 0, drawable.MinimumHeight, drawable.MinimumHeight);
                            title_bar_right_btn.SetCompoundDrawables(null, null, drawable, null);
                        }
                    }
                    //处理标题
                    string titleText = attributes.GetString(Resource.Styleable.CustomeTitleBar_title_text);
                    if (!string.IsNullOrEmpty(titleText))
                    {
                        title_bar_title.Text = titleText;
                    }
                    Color color = attributes.GetColor(Resource.Styleable.CustomeTitleBar_title_text_color, Color.White);
                    title_bar_title.SetTextColor(color);
                    attributes.Recycle();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Write(ex.ToString());
            }
        }
 void IPullToZoom <T> .HandleStyledAttributes(TypedArray a)
 {
 }
示例#46
0
        private static MvxRecyclerViewTemplateSelectorAttributes ReadRecyclerViewItemTemplateSelectorAttributes(Context context, IAttributeSet attrs)
        {
            TryInitializeBindingResourcePaths();

            TypedArray typedArray = null;

            string templateSelectorClassName     = string.Empty;
            string groupedDataConverterClassName = string.Empty;
            int    headerLayoutId       = 0;
            int    footerLayoutId       = 0;
            int    groupSectionLayoutId = 0;

            try
            {
                typedArray = context.ObtainStyledAttributes(attrs, MvxRecyclerViewGroupId);
                int numberOfStyles = typedArray.IndexCount;

                for (int i = 0; i < numberOfStyles; ++i)
                {
                    var attributeId = typedArray.GetIndex(i);

                    if (attributeId == MvxRecyclerViewItemTemplateSelector)
                    {
                        templateSelectorClassName = typedArray.GetString(attributeId);
                    }
                    if (attributeId == MvxRecyclerViewHeaderLayoutId)
                    {
                        headerLayoutId = typedArray.GetResourceId(attributeId, 0);
                    }
                    if (attributeId == MvxRecyclerViewFooterLayoutId)
                    {
                        footerLayoutId = typedArray.GetResourceId(attributeId, 0);
                    }
                    if (attributeId == MvxRecyclerViewGroupSectionLayoutId)
                    {
                        groupSectionLayoutId = typedArray.GetResourceId(attributeId, 0);
                    }
                    if (attributeId == MvxRecyclerViewGroupedDataConverter)
                    {
                        groupedDataConverterClassName = typedArray.GetString(attributeId);
                    }
                }
            }
            finally
            {
                typedArray?.Recycle();
            }

            if (string.IsNullOrEmpty(templateSelectorClassName))
            {
                templateSelectorClassName = typeof(MvxDefaultTemplateSelector).FullName;
            }

            return(new MvxRecyclerViewTemplateSelectorAttributes()
            {
                TemplateSelectorClassName = templateSelectorClassName,
                FooterLayoutId = footerLayoutId,
                HeaderLayoutId = headerLayoutId,
                GroupSectionLayoutId = groupSectionLayoutId,
                GroupedDataConverterClassName = groupedDataConverterClassName
            });
        }
 public virtual void HandleStyledAttributes(TypedArray a)
 {
 }
 public void TestSubArrayBeginEnd() {
     Action f = () => {
         var b = new TypedArray(new ElementType[] { 1, 2, 3, 4 });
         var a = b.Subarray(1, 3);
         Done(a.Length == 2 && a[0] == 2 && a[1] == 3);
     };
     this.Start(f);
 }
示例#49
0
 protected override Java.Lang.Object OnGetDefaultValue(TypedArray a, int index)
 {
     _initialValue = a.GetInt(index, 1);
     return(_initialValue);
 }
		/// <summary>
		/// This method sets layout of floating controller, creates control bar and puts it on its
		/// default position.
		/// </summary>
		/// <param name="barExpanded">
		///            Whether or not control bar shall be expanded. </param>
		/// <param name="devicesExpanded">
		///            Map describing which devices shall be expanded and which not. </param>
		private void initializeControl(TypedArray array)
		{

			int type = array.getInt(R.styleable.FloatingControler_type, 1);
			LayoutInflater inflater = (LayoutInflater) this.Context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			int resId;
			switch (type)
			{
				case 0:
					resId = R.layout.floating_controller_layout;
					break;

				case 1:
				default: // fall-through
					resId = R.layout.floating_controller_layout;
					break;
			}
			inflater.inflate(resId, this, true);
			mControlBar = (FcControlBar) findViewById(R.id.control_bar_layout);
			mControlBar.prepareView(this, array);
		}
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            mRootView = (RelativeLayout)inflater.Inflate(Resource.Layout.fragment_flower, container, false);

            mCircles = new View[6];
            mCircle  = mRootView.FindViewById(Resource.Id.circle);

            float diameter = TypedValue.ApplyDimension(ComplexUnitType.Dip, DIAMETER, Resources.DisplayMetrics);

            TypedArray circles = Resources.ObtainTypedArray(Resource.Array.circles);

            // layout params
            RelativeLayout.LayoutParams paramss = new RelativeLayout.LayoutParams((int)diameter,
                                                                                  (int)diameter);
            paramss.AddRule(LayoutRules.CenterInParent);

            // create the circle views
            int colorIndex = 0;

            for (int i = 0; i < mCircles.Length; i++)
            {
                mCircles[i] = new View(Activity);

                mCircles[i].LayoutParameters = paramss;

                mCircles[i].SetBackgroundDrawable(Resources.GetDrawable(circles.GetResourceId(colorIndex, -1)));

                colorIndex++;
                if (colorIndex >= circles.Length())
                {
                    colorIndex = 0;
                }

                mRootView.AddView(mCircles[i], 0);
            }

            circles.Recycle();

            /* Animations! */

            SpringSystem springSystem = SpringSystem.Create();

            // create spring
            Spring spring = springSystem.CreateSpring();

            // add listeners along arc
            double arc = 2 * Math.PI / mCircles.Length;

            for (int i = 0; i < mCircles.Length; i++)
            {
                View view = mCircles[i];

                // map spring to a line segment from the center to the edge of the ring
                spring.AddListener(new MapPerformer(view, ViewHelper.TranslationX, 0, 1, 0, (float)(RING_DIAMETER * Math.Cos(i * arc))));

                spring.AddListener(new MapPerformer(view, ViewHelper.TranslationY, 0, 1, 0, (float)(RING_DIAMETER * Math.Sin(i * arc))));

                spring.SetEndValue(CLOSED);
            }

            ToggleImitator imitator = new ToggleImitator(spring, CLOSED, OPEN);


            // move circle using finger, snap when near another circle, and bloom when touched
            new Actor.Builder(SpringSystem.Create(), mCircle)
            .AddMotion(new SnapImitator(MotionProperty.X), ViewHelper.TranslationX)
            .AddMotion(new SnapImitator(MotionProperty.Y), ViewHelper.TranslationY)
            .OnTouchListener(imitator)
            .Build();

            return(mRootView);
        }
示例#52
0
 protected override Java.Lang.Object OnGetDefaultValue(TypedArray array, Int32 index)
 {
     return(array.GetInt(index, 0));
 }
        private View buildView(Context context)
        {
            var inflater = LayoutInflater.From(context);
            var view     = inflater.Inflate(Resource.Layout.track_selection_dialog, null);
            var root     = (ViewGroup)view.FindViewById(Resource.Id.root);

            TypedArray attributeArray = context.Theme.ObtainStyledAttributes(
                new int[] { global::Android.Resource.Attribute.SelectableItemBackground });
            var selectableItemBackgroundResourceId = attributeArray.GetResourceId(0, 0);

            attributeArray.Recycle();

            // View for disabling the renderer.
            disableView = (CheckedTextView)inflater.Inflate(
                global::Android.Resource.Layout.SimpleListItemSingleChoice, root, false);
            disableView.SetBackgroundResource(selectableItemBackgroundResourceId);
            disableView.SetText(Resource.String.selection_disabled);
            disableView.Focusable = true;
            disableView.SetOnClickListener(this);
            root.AddView(disableView);

            // View for clearing the override to allow the selector to use its default selection logic.
            defaultView = (CheckedTextView)inflater.Inflate(
                global::Android.Resource.Layout.SimpleListItemSingleChoice, root, false);
            defaultView.SetBackgroundResource(selectableItemBackgroundResourceId);
            defaultView.SetText(Resource.String.selection_default);
            defaultView.Focusable = true;
            defaultView.SetOnClickListener(this);
            root.AddView(inflater.Inflate(Resource.Layout.list_divider, root, false));
            root.AddView(defaultView);

            // Per-track views.
            var haveAdaptiveTracks = false;

            trackViews = new CheckedTextView[trackGroups.Length][];
            for (var groupIndex = 0; groupIndex < trackGroups.Length; groupIndex++)
            {
                var group           = trackGroups.Get(groupIndex);
                var groupIsAdaptive = trackGroupsAdaptive[groupIndex];
                haveAdaptiveTracks    |= groupIsAdaptive;
                trackViews[groupIndex] = new CheckedTextView[group.Length];
                for (var trackIndex = 0; trackIndex < group.Length; trackIndex++)
                {
                    if (trackIndex == 0)
                    {
                        root.AddView(inflater.Inflate(Resource.Layout.list_divider, root, false));
                    }
                    int trackViewLayoutId = groupIsAdaptive ? global::Android.Resource.Layout.SimpleListItemMultipleChoice
                                                : global::Android.Resource.Layout.SimpleListItemSingleChoice;
                    var trackView = (CheckedTextView)inflater.Inflate(
                        trackViewLayoutId, root, false);
                    trackView.SetBackgroundResource(selectableItemBackgroundResourceId);
                    trackView.Text = DemoUtil.BuildTrackName(group.GetFormat(trackIndex));
                    if (trackInfo.GetTrackFormatSupport(rendererIndex, groupIndex, trackIndex)
                        == RendererCapabilities.FormatHandled)
                    {
                        trackView.Focusable = true;
                        trackView.Tag       = Pair.Create(groupIndex, trackIndex);
                        trackView.SetOnClickListener(this);
                    }
                    else
                    {
                        trackView.Focusable = false;
                        trackView.Enabled   = false;
                    }
                    trackViews[groupIndex][trackIndex] = trackView;
                    root.AddView(trackView);
                }
            }

            if (haveAdaptiveTracks)
            {
                // View for using random adaptation.
                enableRandomAdaptationView = (CheckedTextView)inflater.Inflate(
                    global::Android.Resource.Layout.SimpleListItemMultipleChoice, root, false);
                enableRandomAdaptationView.SetBackgroundResource(selectableItemBackgroundResourceId);
                enableRandomAdaptationView.SetText(Resource.String.enable_random_adaptation);
                enableRandomAdaptationView.SetOnClickListener(this);
                root.AddView(inflater.Inflate(Resource.Layout.list_divider, root, false));
                root.AddView(enableRandomAdaptationView);
            }

            UpdateViews();
            return(view);
        }
        public LoadingLayout(Context context, Mode mode, PtrOrientation scrollDirection, TypedArray attrs)
            : base(context)
        {
            //base(context);
            mMode = mode;
            mScrollDirection = scrollDirection;

            switch (scrollDirection)
            {
                case PtrOrientation.HORIZONTAL:
                    LayoutInflater.From(context).Inflate(Resource.Layout.pull_to_refresh_header_horizontal, this);
                    break;
                case PtrOrientation.VERTICAL:
                default:
                    LayoutInflater.From(context).Inflate(Resource.Layout.pull_to_refresh_header_vertical, this);
                    break;
            }

            mInnerLayout = (FrameLayout)FindViewById(Resource.Id.fl_inner);
            mHeaderText = (TextView)mInnerLayout.FindViewById(Resource.Id.pull_to_refresh_text);
            mHeaderProgress = (ProgressBar)mInnerLayout.FindViewById(Resource.Id.pull_to_refresh_progress);
            mSubHeaderText = (TextView)mInnerLayout.FindViewById(Resource.Id.pull_to_refresh_sub_text);
            mHeaderImage = (ImageView)mInnerLayout.FindViewById(Resource.Id.pull_to_refresh_image);

            FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams)mInnerLayout.LayoutParameters;

            switch (mode)
            {
                case Mode.PULL_FROM_END:
                    lp.Gravity = scrollDirection == PtrOrientation.VERTICAL ? GravityFlags.Top : GravityFlags.Left;

                    // Load in labels
                    mPullLabel = context.GetString(Resource.String.pull_to_refresh_from_bottom_pull_label);
                    mRefreshingLabel = context.GetString(Resource.String.pull_to_refresh_from_bottom_refreshing_label);
                    mReleaseLabel = context.GetString(Resource.String.pull_to_refresh_from_bottom_release_label);
                    break;

                case Mode.PULL_FROM_START:
                default:
                    lp.Gravity = scrollDirection == PtrOrientation.VERTICAL ? GravityFlags.Bottom : GravityFlags.Right;

                    // Load in labels
                    mPullLabel = context.GetString(Resource.String.pull_to_refresh_pull_label);
                    mRefreshingLabel = context.GetString(Resource.String.pull_to_refresh_refreshing_label);
                    mReleaseLabel = context.GetString(Resource.String.pull_to_refresh_release_label);
                    break;
            }



            if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrHeaderBackground))
            {
                Drawable background = attrs.GetDrawable(Resource.Styleable.PullToRefresh_ptrHeaderBackground);
                if (null != background)
                {
                    ViewCompat.setBackground(this, background);
                }
            }

            if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrHeaderTextAppearance))
            {
                TypedValue styleID = new TypedValue();
                attrs.GetValue(Resource.Styleable.PullToRefresh_ptrHeaderTextAppearance, styleID);
                setTextAppearance(styleID.Data);
            }
            if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrSubHeaderTextAppearance))
            {
                TypedValue styleID = new TypedValue();
                attrs.GetValue(Resource.Styleable.PullToRefresh_ptrSubHeaderTextAppearance, styleID);
                setSubTextAppearance(styleID.Data);
            }

            // Text Color attrs need to be set after TextAppearance attrs
            if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrHeaderTextColor))
            {
                ColorStateList colors = attrs.GetColorStateList(Resource.Styleable.PullToRefresh_ptrHeaderTextColor);
                if (null != colors)
                {
                    setTextColor(colors);
                }
            }
            if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrHeaderSubTextColor))
            {
                ColorStateList colors = attrs.GetColorStateList(Resource.Styleable.PullToRefresh_ptrHeaderSubTextColor);
                if (null != colors)
                {
                    setSubTextColor(colors);
                }
            }

            // Try and get defined drawable from Attrs
            Drawable imageDrawable = null;
            if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrDrawable))
            {
                imageDrawable = attrs.GetDrawable(Resource.Styleable.PullToRefresh_ptrDrawable);
            }

            // Check Specific Drawable from Attrs, these overrite the generic
            // drawable attr above
            switch (mode)
            {
                case Mode.PULL_FROM_START:
                default:

                    if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrDrawableStart))
                    {
                        imageDrawable = attrs.GetDrawable(Resource.Styleable.PullToRefresh_ptrDrawableStart);
                    }
                    else if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrDrawableTop))
                    {
                        Utils.warnDeprecation("ptrDrawableTop", "ptrDrawableStart");
                        imageDrawable = attrs.GetDrawable(Resource.Styleable.PullToRefresh_ptrDrawableTop);
                    }
                    break;

                case Mode.PULL_FROM_END:
                    if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrDrawableEnd))
                    {
                        imageDrawable = attrs.GetDrawable(Resource.Styleable.PullToRefresh_ptrDrawableEnd);
                    }
                    else if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrDrawableBottom))
                    {
                        Utils.warnDeprecation("ptrDrawableBottom", "ptrDrawableEnd");
                        imageDrawable = attrs.GetDrawable(Resource.Styleable.PullToRefresh_ptrDrawableBottom);
                    }
                    break;
            }

            // If we don't have a user defined drawable, load the default
            if (null == imageDrawable)
            {

                imageDrawable = context.Resources.GetDrawable(getDefaultDrawableResId());
            }

            // Set Drawable, and save width/height
            setLoadingDrawable(imageDrawable);

            reset();
        }
        private void InitView(Context context, IAttributeSet attrs)
        {
            LayoutInflater inflater = LayoutInflater.From(context);
            View           layout   = inflater.Inflate(Resource.Layout.view_spinner, this, false);

            AddView(layout);

            if (attrs != null)
            {
                TypedArray a = context.ObtainStyledAttributes(attrs, Resource.Styleable.KakaoDialogSpinner);
                title            = a.GetString(Resource.Styleable.KakaoDialogSpinner_kakao_prompt);
                iconResId        = a.GetResourceId(Resource.Styleable.KakaoDialogSpinner_kakao_icon, 0);
                titleBgResId     = a.GetResourceId(Resource.Styleable.KakaoDialogSpinner_kakao_dialogTitle, 0);
                titleTextColor   = a.GetResourceId(Resource.Styleable.KakaoDialogSpinner_kakao_titleTextColor, 0);
                showTitleDivider = a.GetBoolean(Resource.Styleable.KakaoDialogSpinner_kakao_showTitleDivider, false);

                int entriesResId = a.GetResourceId(Resource.Styleable.KakaoDialogSpinner_kakao_entries, 0);
                if (entriesResId > 0)
                {
                    entryList = new List <string>(Resources.GetStringArray(entriesResId));
                }

                a.Recycle();
            }

            ImageView icon = layout.FindViewById <ImageView>(Resource.Id.menu_icon);

            if (iconResId > 0)
            {
                icon.Visibility = ViewStates.Visible;
                icon.SetBackgroundResource(iconResId);
            }
            else
            {
                icon.Visibility = ViewStates.Gone;
            }

            spinner = layout.FindViewById <TextView>(Resource.Id.menu_title);
            if (entryList != null && entryList.Count > 0)
            {
                spinner.Text = entryList[0];
            }

            DialogBuilder builder = new DialogBuilder(context);

            if (title != null)
            {
                builder = builder.SetTitle(title);
            }

            builder.SetTitleBgResId(titleBgResId);
            builder.SetTitleTextColor(titleTextColor);
            builder.SetShowTitleDivider(showTitleDivider);

            if (entryList != null)
            {
                listView = (ListView)inflater.Inflate(Resource.Layout.view_custom_list, null, false);
                builder.SetView(listView);
                dialog = builder.Create();

                adapter = new KakaoSpinnerAdapter(new KakaoSpinnerItems(iconResId, entryList), new MySpinnerListener((adapter, position) =>
                {
                    spinner.Text = entryList[position];
                    if (dialog != null)
                    {
                        dialog.Dismiss();
                    }

                    if (listener != null)
                    {
                        listener.OnItemSelected(adapter, position);
                    }
                }));
                listView.SetAdapter(adapter);
            }

            this.Click += (s, e) =>
            {
                ShowDialog();
            };
        }
        static MvxAdvancedRecyclerViewAttributes ReadRecyclerViewItemTemplateSelectorAttributes(Context context, IAttributeSet attrs)
        {
            TryInitializeBindingResourcePaths();

            TypedArray typedArray = null;

            string templateSelectorClassName       = string.Empty;
            string groupedDataConverterClassName   = string.Empty;
            string groupExpandControllerClassName  = string.Empty;
            string swipeableTemplateClassName      = string.Empty;
            string uniqueItemIdProviderClassName   = string.Empty;
            string groupSwipeableTemplateClassName = string.Empty;
            string childSwipeableTemplateClassName = string.Empty;

            int headerLayoutId = 0;
            int footerLayoutId = 0;

            try
            {
                typedArray = context.ObtainStyledAttributes(attrs, MvxRecyclerViewGroupId);
                int numberOfStyles = typedArray.IndexCount;

                for (int i = 0; i < numberOfStyles; ++i)
                {
                    var attributeId = typedArray.GetIndex(i);

                    if (attributeId == MvxRecyclerViewGroupExpandController)
                    {
                        groupExpandControllerClassName = typedArray.GetString(attributeId);
                    }
                    if (attributeId == MvxRecyclerViewItemTemplateSelector)
                    {
                        templateSelectorClassName = typedArray.GetString(attributeId);
                    }
                    if (attributeId == MvxRecyclerViewHeaderLayoutId)
                    {
                        headerLayoutId = typedArray.GetResourceId(attributeId, 0);
                    }
                    if (attributeId == MvxRecyclerViewFooterLayoutId)
                    {
                        footerLayoutId = typedArray.GetResourceId(attributeId, 0);
                    }
                    if (attributeId == MvxRecyclerViewGroupedDataConverter)
                    {
                        groupedDataConverterClassName = typedArray.GetString(attributeId);
                    }
                    if (attributeId == MvxRecyclerViewSwipeableTemplate)
                    {
                        swipeableTemplateClassName = typedArray.GetString(attributeId);
                    }
                    if (attributeId == MvxRecyclerViewUniqueItemIdProvider)
                    {
                        uniqueItemIdProviderClassName = typedArray.GetString(attributeId);
                    }
                    if (attributeId == MvxRecyclerViewGroupSwipeableTemplate)
                    {
                        groupSwipeableTemplateClassName = typedArray.GetString(attributeId);
                    }
                    if (attributeId == MvxRecyclerViewChildSwipeableTemplate)
                    {
                        childSwipeableTemplateClassName = typedArray.GetString(attributeId);
                    }
                }
            }
            finally
            {
                typedArray?.Recycle();
            }

            if (string.IsNullOrEmpty(templateSelectorClassName))
            {
                templateSelectorClassName = typeof(MvxDefaultTemplateSelector).FullName;
            }
            if (string.IsNullOrEmpty(groupExpandControllerClassName))
            {
                groupExpandControllerClassName = typeof(DefaultMvxGroupExpandController).FullName;
            }

            return(new MvxAdvancedRecyclerViewAttributes()
            {
                TemplateSelectorClassName = templateSelectorClassName,
                ItemTemplateLayoutId = MvxAttributeHelpers.ReadListItemTemplateId(context, attrs),
                FooterLayoutId = footerLayoutId,
                HeaderLayoutId = headerLayoutId,
                GroupedDataConverterClassName = groupedDataConverterClassName,
                GroupExpandControllerClassName = groupExpandControllerClassName,
                SwipeableTemplateClassName = swipeableTemplateClassName,
                UniqueItemIdProviderClassName = uniqueItemIdProviderClassName,
                GroupSwipeableTemplateClassName = groupSwipeableTemplateClassName,
                ChildSwipeableTemplateClassName = childSwipeableTemplateClassName
            });
        }
示例#57
0
 public void GridViewParams(TypedArray paramTypedArray)
 {
     this.HorizontalSpacing = paramTypedArray.GetDimensionPixelSize(0, 4);
     this.VerticalSpacing = paramTypedArray.GetDimensionPixelSize(1, 4);
     this.NumColumns = paramTypedArray.GetInt(3, 10);
     this.ColumnWidth = paramTypedArray.GetDimensionPixelSize(2, 48);
 }