Ejemplo n.º 1
0
        public async Task SetVibrancyType(VibrancyType type)
        {
            string vType = string.Empty;

            switch (type)
            {
            case VibrancyType.AppearanceBased:
                vType = "appearance-based";
                break;

            case VibrancyType.MediumLight:
                vType = "medium-light";
                break;

            case VibrancyType.UltraDark:
                vType = "ultra-dark";
                break;

            default:
                vType = type.ToString().ToLower();
                break;
            }
            await Invoke <object>("setVibrancy", vType);
        }
Ejemplo n.º 2
0
        public KeyboardKey(VibrancyType optionalVibrancy) :
            base(CGRect.Empty)
        {
            this.vibrancy = optionalVibrancy;

            this.displayView = new ShapeView();
            this.underView   = new ShapeView();
            this.borderView  = new ShapeView();

            this.shadowLayer = new CAShapeLayer();
            this.shadowView  = new UIView();

            this.label = new UILabel();
            this.text  = "";

            this.color       = UIColor.White;
            this.underColor  = UIColor.Gray;
            this.borderColor = UIColor.Black;
            this.popupColor  = UIColor.White;
            this.drawUnder   = true;
            this.drawOver    = true;
            this.drawBorder  = false;
            this.underOffset = 1;

            this.background     = new KeyboardKeyBackground(cornerRadius: 4, underOffset: this.underOffset);
            this.textColor      = UIColor.Black;
            this.popupDirection = null;


            this.AddSubview(this.shadowView);
            this.shadowView.Layer.AddSublayer(this.shadowLayer);
            this.AddSubview(this.displayView);

            var underView = this.underView;

            if (underView != null)
            {
                this.AddSubview(underView);
            }

            var borderView = this.borderView;

            if (borderView != null)
            {
                this.AddSubview(borderView);
            }

            this.AddSubview(this.background);

            this.background.AddSubview(this.label);


            //var setupViews: Void = {
            this.displayView.Opaque = false;
            this.underView.Opaque   = false;
            this.borderView.Opaque  = false;


            this.shadowLayer.ShadowOpacity = 0.2f;
            this.shadowLayer.ShadowRadius  = 4;
            this.shadowLayer.ShadowOffset  = new CGSize(0, 3);


            this.borderView.lineWidth = (CGFloat)(0.5);
            this.borderView.fillColor = UIColor.Clear;


            this.label.TextAlignment      = UITextAlignment.Center;
            this.label.BaselineAdjustment = UIBaselineAdjustment.AlignCenters;
            this.label.Font = this.label.Font.WithSize(22);
            this.label.AdjustsFontSizeToFitWidth = true;
            this.label.MinimumScaleFactor        = (CGFloat)(0.1);
            this.label.UserInteractionEnabled    = false;
            this.label.Lines = 1;
        }