protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.ColorPicker);

            // Create your application here
            var redSeekBar = FindViewById<SeekBar>(Resource.Id.redSeekBar);
            var greenSeekBar = FindViewById<SeekBar>(Resource.Id.greenSeekBar);
            var blueSeekBar = FindViewById<SeekBar>(Resource.Id.blueSeekBar);

            var redTextView = FindViewById<TextView>(Resource.Id.redValue);
            var greenTextView = FindViewById<TextView>(Resource.Id.greenValue);
            var blueTextView = FindViewById<TextView>(Resource.Id.blueValue);
            colorValue = FindViewById<TextView>(Resource.Id.colorValue);

            finalColor = new Android.Graphics.Color(0, 0, 0);
            
            textViews = new Dictionary<int, TextView>();
            textViews.Add(redSeekBar.Id, redTextView);
            textViews.Add(greenSeekBar.Id, greenTextView);
            textViews.Add(blueSeekBar.Id, blueTextView);

            redSeekBar.ProgressChanged += SeekBar_ProgressChanged;
            greenSeekBar.ProgressChanged += SeekBar_ProgressChanged;
            blueSeekBar.ProgressChanged += SeekBar_ProgressChanged;

            var returnColorButton = FindViewById<Button>(Resource.Id.returnButton);
            returnColorButton.Click += delegate
            {
                var intent = new Intent(this, typeof(MainActivity));
                intent.PutExtra("colorSelected", this.GetHexValue());
                SetResult(Result.Ok, intent);
                Finish();
            };
        }
 public TaskAdapter(Activity context, JavaList<TaskModel> tasks)
 {
     m_Context = context;
     m_Tasks = tasks;
     m_UncheckedColor = m_Context.Resources.GetColor(Settings.DarkTheme ? Resource.Color.white : Resource.Color.actionbar_maincolor_darkgray);
     m_CheckedColor = m_Context.Resources.GetColor(Settings.CheckedColor);
 }
        private void SeekBar_ProgressChanged(object sender, SeekBar.ProgressChangedEventArgs e)
        {
            var seekBar = (SeekBar)sender;
            var textViewChanged = textViews[seekBar.Id];
            textViewChanged.Text = seekBar.Progress.ToString();
            Android.Graphics.Color backgroundColor; // = new Android.Graphics.Color();
            switch (seekBar.Id)
            {
                case Resource.Id.redSeekBar:
                    backgroundColor = new Android.Graphics.Color(seekBar.Progress, 0, 0);
                    finalColor.R = (byte)seekBar.Progress;
                    break;
                case Resource.Id.greenSeekBar:
                    backgroundColor = new Android.Graphics.Color(0, seekBar.Progress, 0);
                    finalColor.G = (byte)seekBar.Progress;
                    break;
                case Resource.Id.blueSeekBar:
                    backgroundColor = new Android.Graphics.Color(0, 0, seekBar.Progress);
                    finalColor.B = (byte)seekBar.Progress;
                    break;
                default:
                    backgroundColor = new Android.Graphics.Color(255, 255, 255);
                    break;
            }

            textViewChanged.SetBackgroundColor(backgroundColor);
            colorValue.SetBackgroundColor(finalColor);
            colorValue.Text = GetHexValue();
        }
		protected override void OnAttached ()
		{
			try {
				backgroundColor = Android.Graphics.Color.LightGreen;
				Control.SetBackgroundColor (backgroundColor);

			} catch (Exception ex) {
				Console.WriteLine ("Cannot set property on attached control. Error: ", ex.Message);
			}
		}
示例#5
0
		public static void RenderBishop (RenderTarget c, Color main, Color alternate, Color white, Color black)
		{
			SetFillColor (main);
			SetStrokeColor (black);
			MoveTo (9f, 36f);
			AddCurveToPoint (12.39f, 35.03f, 19.11f, 36.43f, 22.5f, 34f);
			AddCurveToPoint (25.89f, 36.43f, 32.61f, 35.03f, 36f, 36f);
			AddCurveToPoint (36f, 36f, 37.65f, 36.54f, 39f, 38f);
			AddCurveToPoint (38.32f, 38.97f, 37.35f, 38.99f, 36f, 38.5f);
			AddCurveToPoint (32.61f, 37.53f, 25.89f, 38.96f, 22.5f, 37.5f);
			AddCurveToPoint (19.11f, 38.96f, 12.39f, 37.53f, 9f, 38.5f);
			AddCurveToPoint (7.646f, 38.99f, 6.677f, 38.97f, 6f, 38f);
			AddCurveToPoint (7.354f, 36.06f, 9f, 36f, 9f, 36f);
			ClosePath ();
			MoveTo (9f, 36f);
			FillAndStrokePath ();
			
			SetFillColor (main);
			SetStrokeColor (black);
			MoveTo (15f, 32f);
			AddCurveToPoint (17.5f, 34.5f, 27.5f, 34.5f, 30f, 32f);
			AddCurveToPoint (30.5f, 30.5f, 30f, 30f, 30f, 30f);
			AddCurveToPoint (30f, 27.5f, 27.5f, 26f, 27.5f, 26f);
			AddCurveToPoint (33f, 24.5f, 33.5f, 14.5f, 22.5f, 10.5f);
			AddCurveToPoint (11.5f, 14.5f, 12f, 24.5f, 17.5f, 26f);
			AddCurveToPoint (17.5f, 26f, 15f, 27.5f, 15f, 30f);
			AddCurveToPoint (15f, 30f, 14.5f, 30.5f, 15f, 32f);
			ClosePath ();
			MoveTo (15f, 32f);
			FillAndStrokePath ();
			
			SetFillColor (main);
			SetStrokeColor (black);
			MoveTo (25f, 8f);
			AddCurveToPoint (25f, 9.380712f, 23.88071f, 10.5f, 22.5f, 10.5f);
			AddCurveToPoint (21.11929f, 10.5f, 20f, 9.380712f, 20f, 8f);
			AddCurveToPoint (20f, 6.619288f, 21.11929f, 5.5f, 22.5f, 5.5f);
			AddCurveToPoint (23.88071f, 5.5f, 25f, 6.619288f, 25f, 8f);
			ClosePath ();
			MoveTo (25f, 8f);
			FillAndStrokePath ();
			
			SetStrokeColor (alternate);
			MoveTo (17.5f, 26f);
			AddLineToPoint (27.5f, 26f);
			MoveTo (15f, 30f);
			AddLineToPoint (30f, 30f);
			MoveTo (22.5f, 15.5f);
			AddLineToPoint (22.5f, 20.5f);
			MoveTo (20f, 18f);
			AddLineToPoint (25f, 18f);
			StrokePath ();
		}
示例#6
0
        private ShowCaseImageView Focus(Xamarin.Forms.View onView)
        {
            Android.Graphics.Color color = Android.Graphics.Color.Black;
            color.A = 90;
            var mView                   = GetOrCreateRenderer(onView).View;
            var mCalculator             = new Calculator(mView, 10);
            ShowCaseImageView imageView = new ShowCaseImageView(MainApplication.ActivityContext);

            imageView.SetParameters(color, mCalculator);
            imageView.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            //imageView.SetBorderParameters(Android.Graphics.Color.White, 2);
            imageView.Click += ImageViewClick;;
            return(imageView);
        }
示例#7
0
 protected void UpdateSelectedColor()
 {
     if (CellParent != null &&
         CellParent.SelectedColor != Color.Default)
     {
         SelectedColor.Color = CellParent.SelectedColor.MultiplyAlpha(0.5).ToAndroid();
         Ripple.SetColor(DrawableUtility.GetPressedColorSelector(CellParent.SelectedColor.ToAndroid()));
     }
     else
     {
         SelectedColor.Color = AColor.Argb(125, 180, 180, 180);
         Ripple.SetColor(DrawableUtility.GetPressedColorSelector(AColor.Rgb(180, 180, 180)));
     }
 }
        protected override void OnAttached()
        {
            var tv = Control as TextView;

            oldColor  = tv.ShadowColor;
            oldRadius = tv.ShadowRadius;
            oldDx     = tv.ShadowDx;
            oldDy     = tv.ShadowDy;

            var routingEffect = (ShadowEffect)Element.Effects.First((arg) => arg is ShadowEffect);
            var shadowColor   = routingEffect.ShadowColor;

            tv.SetShadowLayer(2f, 2f, 2f, shadowColor.ToAndroid());
        }
示例#9
0
        private void ChangeBackgroundColor(Android.Graphics.Color color)
        {
            TextView tvStatus = FindViewById <TextView>(Resource.Id.tvStatus);

            try
            {
                _layout = FindViewById <LinearLayout>(Resource.Id.LayoutMain);
                _layout.SetBackgroundColor(color);
            }
            catch (Exception ex)
            {
                tvStatus.Text = string.Format("{0}", ex.ToString());
            }
        }
示例#10
0
        void ChangeTextViewBack(Android.Graphics.Color accent)
        {
            var colorlist = new ColorStateList(new int[][]
            {
                new int[] { global::Android.Resource.Attribute.StateFocused },
                new int[] { -global::Android.Resource.Attribute.StateFocused },
            },
                                               new int[] {
                Android.Graphics.Color.Argb(255, accent.R, accent.G, accent.B),
                Android.Graphics.Color.Argb(255, 200, 200, 200)
            });

            _EditText.Background.SetTintList(colorlist);
        }
示例#11
0
        protected override void OnElementChanged(ElementChangedEventArgs <Entry> e)
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                Android.Graphics.Color backgroundColor = Android.Graphics.Color.White;
                if (Element is Entry entry)
                {
                    backgroundColor = entry.BackgroundColor.ToAndroid();
                }
                Control.SetBackgroundColor(backgroundColor);
            }
        }
        public static Stream CreateBitmapStream(int width, int height, AColor color)
        {
            using var bitmap = CreateBitmap(width, height, color);

            var stream = new MemoryStream();

            var success = bitmap.Compress(ABitmap.CompressFormat.Png, 100, stream);

            Assert.True(success);

            stream.Position = 0;

            return(stream);
        }
示例#13
0
        void AddRipple()
        {
            var color = TouchEffect.GetColor(Element);

            if (color == Xamarin.Forms.Color.Default)
            {
                return;
            }

            _color   = color.ToAndroid();
            _color.A = 80;

            _viewOverlay.Background = CreateRipple(color.ToAndroid());
        }
        private Android.Graphics.Color GetTranstypeIconColorFilter(string _transactionType, bool _isPaid)
        {
            Android.Graphics.Color retVal = ColorHelper.ResourceIdToColor(Resource.Color.colorPrimaryDark, mContext);
            if (_transactionType == PAYLATER && !_isPaid)
            {
                retVal = ColorHelper.ResourceIdToColor(Resource.Color.colorRed, mContext);
            }
            else
            {
                retVal = ColorHelper.ResourceIdToColor(Resource.Color.colorPrimaryDark, mContext);
            }

            return(retVal);
        }
示例#15
0
        // <summary>
        // Called automatically whenever an activity finishes
        // </summary>
        // <param name = "requestCode" ></ param >
        // < param name="resultCode"></param>
        /// <param name="data"></param>
        protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            //Make image available in the gallery

            /*
             * Intent mediaScanIntent = new Intent(Intent.ActionMediaScannerScanFile);
             * var contentUri = Android.Net.Uri.FromFile(_file);
             * mediaScanIntent.SetData(contentUri);
             * SendBroadcast(mediaScanIntent);
             */

            // Display in ImageView. We will resize the bitmap to fit the display.
            // Loading the full sized image will consume too much memory
            // and cause the application to crash.
            ImageView imageView = FindViewById <ImageView>(Resource.Id.takenPictureImageView);
            int       height    = Resources.DisplayMetrics.HeightPixels;
            int       width     = imageView.Height;

            //AC: workaround for not passing actual files
            Android.Graphics.Bitmap bitmap = (Android.Graphics.Bitmap)data.Extras.Get("data");
            //Android.Graphics.Bitmap bitmap = _file.Path.LoadAndResizeBitmap(width, height);
            Android.Graphics.Bitmap copyBitmap = bitmap.Copy(Android.Graphics.Bitmap.Config.Alpha8, true);
            for (int i = 0; i < copyBitmap.Width; i++)
            {
                for (int j = 0; j < copyBitmap.Height; j++)
                {
                    int p = copyBitmap.GetPixel(i, j);
                    //00000000 00000000 00000000 00000000
                    //long mask = (long)0xFF00FFFF;
                    //p = p & (int)mask;
                    Android.Graphics.Color c = new Android.Graphics.Color(p);

                    //TODO: fix
                    //c.R = 0;
                    copyBitmap.SetPixel(i, j, c);
                }
            }
            if (bitmap != null)
            {
                imageView.SetImageBitmap(bitmap);
                imageView.Visibility = Android.Views.ViewStates.Visible;
                bitmap = null;
            }

            // Dispose of the Java side bitmap.
            System.GC.Collect();
        }
示例#16
0
        public static FillLayer ToForms(this Sdk.Style.Layers.FillLayer fill)
        {
            if (fill == null)
            {
                return(null);
            }
            FillLayer forms = new FillLayer(fill.Id, fill.SourceLayer);

            if (!fill.FillColor.IsNull && fill.FillColor.ColorInt != null)
            {
                Android.Graphics.Color fillColor = new Android.Graphics.Color((int)fill.FillColor.ColorInt);
                forms.FillColor = Xamarin.Forms.Color.FromRgb(fillColor.R, fillColor.G, fillColor.B);
            }
            return(forms);
        }
示例#17
0
        void ResetIndicators()
        {
            if (!IsVisible)
            {
                return;
            }

            _pageIndicatorTintColor        = IndicatorsView.IndicatorColor.ToAndroid();
            _currentPageIndicatorTintColor = IndicatorsView.SelectedIndicatorColor.ToAndroid();
            _shapeType        = IndicatorsView.IndicatorsShape == IndicatorShape.Circle ? AShapeType.Oval : AShapeType.Rectangle;
            _pageShape        = null;
            _currentPageShape = null;
            UpdateShapes();
            UpdateIndicators();
        }
示例#18
0
        void ConvertButton_Click(object sender, System.EventArgs e)
        {
            //Android.Graphics.Color my_colour = new Android.Graphics.Color(255,0,0);
            //Drawable drawableCircle = Resources.GetDrawable(Resources.GetIdentifier("rgb_color", "drawable", PackageName));
            GradientDrawable gradientDrawable = (GradientDrawable)backgroundImageView.Background.Current;

            RGB colour = RGB.fromHex(hexColorEditText.Text);

            Android.Graphics.Color my_colour = new Android.Graphics.Color(colour.r, colour.g, colour.b);
            gradientDrawable.SetColor(my_colour);

            redtextView.Text   = colour.r.ToString();
            greenTextView.Text = colour.g.ToString();
            bluetextView.Text  = colour.b.ToString();
        }
示例#19
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            EsperarMensagem();

            base.OnCreate(savedInstanceState);

            Window.SetNavigationBarColor(Color.Argb(255, 207, 116, 121));

            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            LoadApplication(new App());
        }
示例#20
0
		public static Android.Graphics.Drawables.StateListDrawable ToButtonPressEffect(
			this Android.Graphics.Color color, byte alpha=200
		){

			var pressed = new Android.Graphics.Color (
				color.R, color.G, color.B, alpha);

			var effect = new  Android.Graphics.Drawables.StateListDrawable ();
			effect.AddState (
				new int[]{ Android.Resource.Attribute.StatePressed }, pressed.ToDrawable ());

			effect.AddState (
				Android.Util.StateSet.WildCard.ToArray (), color.ToDrawable ());
			return effect;
		}
示例#21
0
 void UpdateShadow()
 {
     if (((Label)Element).OnThisPlatform().IsShadowed())
     {
         float radius    = 5;
         float distanceX = 5;
         float distanceY = 5;
         Android.Graphics.Color color = Android.Graphics.Color.Black;
         (Control as Android.Widget.TextView).SetShadowLayer(radius, distanceX, distanceY, color);
     }
     else if (!((Label)Element).OnThisPlatform().IsShadowed())
     {
         (Control as Android.Widget.TextView).SetShadowLayer(0, 0, 0, Color.Default.ToAndroid());
     }
 }
示例#22
0
 private void NegateBlue() //
 {
     Toast.MakeText(this.ApplicationContext, "Method NegateBlue() has been called.", ToastLength.Short).Show();
     //this code negates all blue from a picture
     for (int i = 0; i < bitmap.Width; i++)
     {
         for (int j = 0; j < bitmap.Height; j++)
         {
             int p = bitmap.GetPixel(i, j);
             Android.Graphics.Color c = new Android.Graphics.Color(p);
             c.B = Convert.ToByte(255 - Convert.ToInt32(c.B.GetHashCode().ToString()));
             copyBitmap.SetPixel(i, j, c);
         }
     }
 }
示例#23
0
        public static BackgroundLayer ToForms(this Sdk.Style.Layers.BackgroundLayer background)
        {
            if (background == null)
            {
                return(null);
            }
            BackgroundLayer forms = new BackgroundLayer(background.Id, "");

            if (background.BackgroundColor.IsNull && background.BackgroundColor.ColorInt != null)
            {
                Android.Graphics.Color backgroundColor = new Android.Graphics.Color((int)background.BackgroundColor.ColorInt);
                forms.BackgroundColor = Xamarin.Forms.Color.FromRgb(backgroundColor.R, backgroundColor.G, backgroundColor.B);
            }
            return(forms);
        }
        private void setThemeColor(int colorPrimary, int colorPrimaryDark)
        {
            mToolbar.SetBackgroundResource(colorPrimary);
            mAppBarLayout.SetBackgroundResource(colorPrimary);
            mToolbarLayout.SetContentScrimResource(colorPrimary);
            mRefreshLayout.SetPrimaryColorsId(colorPrimary, Android.Resource.Color.White);
            var color = new Android.Graphics.Color(ContextCompat.GetColor(this, colorPrimaryDark));

            mActionButton.SetBackgroundColor(color);
            mActionButton.BackgroundTintList = ColorStateList.ValueOf(color);
            if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) //21
            {
                Window.SetStatusBarColor(new Android.Graphics.Color(ContextCompat.GetColor(this, colorPrimaryDark)));
            }
        }
示例#25
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            var item = _items[position];

            View view = convertView ?? _context.LayoutInflater.Inflate(Resource.Layout.string_list, null);

            Android.Graphics.Color backgroundColor = item.BackgroundColor.HasValue ? item.BackgroundColor.Value : _backgroundColor;
            view.SetBackgroundColor(backgroundColor);

            TextView textView = view.FindViewById <TextView>(Resource.Id.textStringEntry);

            textView.Text = item.Text;

            return(view);
        }
示例#26
0
 /// <param name="context"> to fetch color </param>
 /// <returns> border color </returns>
 public virtual int GetBorderColor(Context context)
 {
     if (this.mBorderColorResource != 0)
     {
         return(ContextCompat.GetColor(context, mBorderColorResource));
     }
     else if (!string.IsNullOrWhiteSpace(mBorderColorCode))
     {
         return(Color.ParseColor(mBorderColorCode));
     }
     else
     {
         return(mBorderColor);
     }
 }
        protected override void OnAttached()
        {
            

            try
            {
                backgroundColor = Android.Graphics.Color.LightGreen;
                Control.SetBackgroundColor(backgroundColor);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Cannot set property on attached control. Error: ", ex.Message);
            }

        }
示例#28
0
        private void SetTextColor()
        {
            Android.Graphics.Color andrColor = Android.Graphics.Color.Gray;

            if (Element.TextColor != Xamarin.Forms.Color.Default)
            {
                Xamarin.Forms.Color color = Element.TextColor;
                andrColor = Android.Graphics.Color.Argb(
                    (byte)(color.A * 255),
                    (byte)(color.R * 255),
                    (byte)(color.G * 255),
                    (byte)(color.B * 255));
            }
            Control.SetTextColor(andrColor);
        }
示例#29
0
 private void RemoveBlue() //
 {
     Toast.MakeText(this.ApplicationContext, "Method RemoveBlue() has been called.", ToastLength.Short).Show();
     //this code removes all blue from a picture
     for (int i = 0; i < bitmap.Width; i++)
     {
         for (int j = 0; j < bitmap.Height; j++)
         {
             int p = bitmap.GetPixel(i, j);
             Android.Graphics.Color c = new Android.Graphics.Color(p);
             c.B = 0;
             copyBitmap.SetPixel(i, j, c);
         }
     }
 }
示例#30
0
        public static LineLayer ToForms(this Sdk.Style.Layers.LineLayer line)
        {
            if (line == null)
            {
                return(null);
            }
            var forms = new LineLayer(line.Id, line.SourceLayer);

            if (line.LineColor.IsNull && line.LineColor.ColorInt != null)
            {
                var lineColor = new Android.Graphics.Color((int)line.LineColor.ColorInt);
                forms.LineColor = Xamarin.Forms.Color.FromRgb(lineColor.R, lineColor.G, lineColor.B);
            }
            return(forms);
        }
示例#31
0
        Color GetNativePlaceholderColor(SearchBarHandler searchBarHandler)

        {
            var searchView = GetNativeSearchBar(searchBarHandler);
            var editText   = searchView.GetChildrenOfType <EditText>().FirstOrDefault();

            if (editText != null)
            {
                int    currentHintTextColor     = editText.CurrentHintTextColor;
                AColor currentPlaceholderColorr = new AColor(currentHintTextColor);
                return(currentPlaceholderColorr.ToColor());
            }

            return(Colors.Transparent);
        }
示例#32
0
        private BottomBar CreateBottomBar(IEnumerable <Page> pageIntents)
        {
            var bar = new BottomBar(Context);

            // TODO: Configure the bottom bar here according to your needs
            // When you create a bottom menu, you can write the content you need here

            bar.SetOnTabClickListener(this);
            bar.UseFixedMode();

            PopulateBottomBarItems(bar, pageIntents);
            bar.SetDefaultTabPosition(1);
            bar.ItemContainer.SetBackgroundColor(Color.Rgb(129, 196, 202));
            return(bar);
        }
示例#33
0
        internal static NativeColor ToNativeColor(this Color color)
        {
            var a = (byte)(255 * color.A);
            var r = (byte)(255 * color.R);
            var g = (byte)(255 * color.G);
            var b = (byte)(255 * color.B);

#if NETFX_CORE
            return(NativeColor.FromArgb(a, r, g, b));
#elif __ANDROID__
            return(NativeColor.Argb(a, r, g, b));
#elif __IOS__
            return(NativeColor.FromRGBA(r, g, b, a));
#endif
        }
示例#34
0
        public override System.Drawing.Image CreateDrawingImage(Android.Graphics.Color foreground, Android.Graphics.Color background)
        {
            String bCode;

            if (codeType == CODE128_RAW)
            {
                int idx = code.IndexOf('\uffff');
                if (idx >= 0)
                {
                    bCode = code.Substring(0, idx);
                }
                else
                {
                    bCode = code;
                }
            }
            else
            {
                bCode = GetRawText(code, codeType == CODE128_UCC);
            }
            int len       = bCode.Length;
            int fullWidth = (len + 2) * 11 + 2;

            byte[] bars   = GetBarsCode128Raw(bCode);
            int    height = (int)barHeight;

            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(fullWidth, height);
            for (int h = 0; h < height; ++h)
            {
                bool print = true;
                int  ptr   = 0;
                for (int k = 0; k < bars.Length; ++k)
                {
                    int w = bars[k];
                    Android.Graphics.Color c = background;
                    if (print)
                    {
                        c = foreground;
                    }
                    print = !print;
                    for (int j = 0; j < w; ++j)
                    {
                        bmp.SetPixel(ptr++, h, c);
                    }
                }
            }
            return(bmp);
        }
示例#35
0
        public override void Render()
        {
            SetContentView(Resource.Layout.WelcomeView);

            Button b = (Button)FindViewById(Resource.Id.myButton);

            if (b != null)
            {
                Android.Graphics.Color           color = Android.Graphics.Color.Rgb(0x62, 0x63, 0x70);
                Android.Graphics.PorterDuff.Mode mode  = Android.Graphics.PorterDuff.Mode.Multiply;

                var colorFilder = new Android.Graphics.PorterDuffColorFilter(color, mode);
                b.Background.SetColorFilter(colorFilder);
                b.Click += (sender, e) => { MXDroidContainer.Navigate("Dashboard"); };
            }
        }
示例#36
0
 public void ClearCanvas(Android.Graphics.Color color)
 {
     using var canvas = LockCanvas(null);
     lock (locker)
     {
         try
         {
             canvas.DrawColor(color);
         }
         finally
         {
             UnlockCanvasAndPost(canvas);
         }
         Invalidate();
     }
 }
示例#37
0
		public static void SetWindowBackground(this AView view)
		{
			Context context = view.Context;
			using (var background = new TypedValue())
			{
				if (context.Theme.ResolveAttribute(global::Android.Resource.Attribute.WindowBackground, background, true))
				{
					string type = context.Resources.GetResourceTypeName(background.ResourceId).ToLower();
					switch (type)
					{
						case "color":
							var color = new AColor(ContextCompat.GetColor(context, background.ResourceId));
							view.SetBackgroundColor(color);
							break;
						case "drawable":
							using (Drawable drawable = ContextCompat.GetDrawable(context, background.ResourceId))
								view.SetBackground(drawable);
							break;
					}
				}
			}
		}
示例#38
0
 private void UpdateDisplayAdd(string message, Color color)
 {
     RunOnUiThread(() =>
     {
         _text.Text = _text.Text + "\n" + message;
         //_view.SetBackgroundColor(color);
     });
 }
示例#39
0
		private void UpdateDisplay(string message, Color color)
		{
            //Get the buildup message
            string tempMessage = "";
            int l = 0;
            for (l = 0; l < beaconTime.Count; l++)
            {
                if (beaconActive[l] == "0")
                {
                    //Do nothing
                }
                else if (beaconActive[l] == "3")
                {
                    tempMessage = tempMessage + "\n You are at " + temp[l] + "   Distance:" + String.Format("  {0:F2}", beaconDist[l], beaconDist[l]) + "m";
                }
                else if (beaconActive[l] == "2")
                {
                    tempMessage = tempMessage + "\n You are near " + temp[l] + "   Distance:" + String.Format("  {0:F2}", beaconDist[l], beaconDist[l]) + "m";
                }
                else if (beaconActive[l] == "1")
                {
                    tempMessage = tempMessage + "\n You are far from " + temp[l] + "   Distance:" + String.Format("  {0:F2}", beaconDist[l], beaconDist[l]) + "m";
                }
            }
			RunOnUiThread(() =>
			{
				_text.Text = tempMessage;
				//_view.SetBackgroundColor(color);
			});
		}
示例#40
0
		public static void RenderWhiteRook (RenderTarget c, Color white, Color black)
		{
			SetFillColor (white);
			SetStrokeColor (black);

			MoveTo (9f, 39f);
			AddLineToPoint (36f, 39f);
			AddLineToPoint (36f, 36f);
			AddLineToPoint (9f, 36f);
			AddLineToPoint (9f, 39f);
			ClosePath ();
			MoveTo (9f, 39f);
			FillAndStrokePath ();

			MoveTo (12f, 36f);
			AddLineToPoint (12f, 32f);
			AddLineToPoint (33f, 32f);
			AddLineToPoint (33f, 36f);
			AddLineToPoint (12f, 36f);
			ClosePath ();
			MoveTo (12f, 36f);
			FillAndStrokePath ();

			MoveTo (11f, 14f);
			AddLineToPoint (11f, 9f);
			AddLineToPoint (15f, 9f);
			AddLineToPoint (15f, 11f);
			AddLineToPoint (20f, 11f);
			AddLineToPoint (20f, 9f);
			AddLineToPoint (25f, 9f);
			AddLineToPoint (25f, 11f);
			AddLineToPoint (30f, 11f);
			AddLineToPoint (30f, 9f);
			AddLineToPoint (34f, 9f);
			AddLineToPoint (34f, 14f);
			FillAndStrokePath ();

			MoveTo (34f, 14f);
			AddLineToPoint (31f, 17f);
			AddLineToPoint (14f, 17f);
			AddLineToPoint (11f, 14f);
			FillAndStrokePath ();

			MoveTo (31f, 17f);
			AddLineToPoint (31f, 29.5f);
			AddLineToPoint (14f, 29.5f);
			AddLineToPoint (14f, 17f);
			FillAndStrokePath ();

			MoveTo (31f, 29.5f);
			AddLineToPoint (32.5f, 32f);
			AddLineToPoint (12.5f, 32f);
			AddLineToPoint (14f, 29.5f);
			FillAndStrokePath ();

			MoveTo (11f, 14f);
			AddLineToPoint (34f, 14f);
			StrokePath ();
		}
示例#41
0
		public static void RenderKnight (RenderTarget c, Player.PlayerColourNames player, Color main, Color alternate, Color white, Color black)
		{	
			SetFillColor (main);
			SetStrokeColor (black);
			MoveTo (22f, 10f);
			AddCurveToPoint (32.5f, 11f, 38.5f, 18f, 38f, 39f);
			AddLineToPoint (15f, 39f);
			AddCurveToPoint (15f, 30f, 25f, 32.5f, 23f, 18f);
			FillAndStrokePath ();

			SetFillColor (main);
			SetStrokeColor (black);
			MoveTo (24f, 18f);
			AddCurveToPoint (24.38f, 20.91f, 18.45f, 25.37f, 16f, 27f);
			AddCurveToPoint (13f, 29f, 13.18f, 31.34f, 11f, 31f);
			AddCurveToPoint (9.958f, 30.06f, 12.41f, 27.96f, 11f, 28f);
			AddCurveToPoint (10f, 28f, 11.19f, 29.23f, 10f, 30f);
			AddCurveToPoint (9f, 30f, 5.997f, 31f, 6f, 26f);
			AddCurveToPoint (6f, 24f, 12f, 14f, 12f, 14f);
			AddCurveToPoint (12f, 14f, 13.89f, 12.1f, 14f, 10.5f);
			AddCurveToPoint (13.27f, 9.506f, 13.5f, 8.5f, 13.5f, 7.5f);
			AddCurveToPoint (14.5f, 6.5f, 16.5f, 10f, 16.5f, 10f);
			AddLineToPoint (18.5f, 10f);
			AddCurveToPoint (18.5f, 10f, 19.28f, 8.008f, 21f, 7f);
			AddCurveToPoint (22f, 7f, 22f, 10f, 22f, 10f);
			FillAndStrokePath ();

			SetFillColor (main);
			SetStrokeColor (alternate);
			MoveTo (9.5f, 25.5f);
			AddCurveToPoint (9.5f, 25.77614f, 9.276142f, 26f, 9f, 26f);
			AddCurveToPoint (8.723858f, 26f, 8.5f, 25.77614f, 8.5f, 25.5f);
			AddCurveToPoint (8.5f, 25.22386f, 8.723858f, 25f, 9f, 25f);
			AddCurveToPoint (9.276142f, 25f, 9.5f, 25.22386f, 9.5f, 25.5f);
			ClosePath ();
			MoveTo (9.5f, 25.5f);
			FillAndStrokePath ();

			SetMatrix (0.866f, 0.5f, -0.5f, 0.866f, 9.693f, -5.173f);
			SetFillColor (black);
			SetStrokeColor (alternate);
			MoveTo (15f, 15.5f);
			AddCurveToPoint (15f, 16.32843f, 14.77614f, 17f, 14.5f, 17f);
			AddCurveToPoint (14.22386f, 17f, 14f, 16.32843f, 14f, 15.5f);
			AddCurveToPoint (14f, 14.67157f, 14.22386f, 14f, 14.5f, 14f);
			AddCurveToPoint (14.77614f, 14f, 15f, 14.67157f, 15f, 15.5f);
			ClosePath ();
			MoveTo (15f, 15.5f);
			FillAndStrokePath ();

			if (player == Player.PlayerColourNames.Black) {
				SetFillColor (white);
				MoveTo (24.55f, 10.4f);
				AddLineToPoint (24.1f, 11.85f);
				AddLineToPoint (24.6f, 12f);
				AddCurveToPoint (27.75f, 13f, 30.25f, 14.49f, 32.5f, 18.75f);
				AddCurveToPoint (34.75f, 23.01f, 35.75f, 29.06f, 35.25f, 39f);
				AddLineToPoint (35.2f, 39.5f);
				AddLineToPoint (37.45f, 39.5f);
				AddLineToPoint (37.5f, 39f);
				AddCurveToPoint (38f, 28.94f, 36.62f, 22.15f, 34.25f, 17.66f);
				AddCurveToPoint (31.88f, 13.17f, 28.46f, 11.02f, 25.06f, 10.5f);
				AddLineToPoint (24.55f, 10.4f);
				ClosePath ();
				MoveTo (24.55f, 10.4f);
				FillPath ();
			}
		}
        private void UpdateDisplay(string message, Color color)
        {
            RunOnUiThread(() =>
            {
                string formatedMessage = String.Format("{0}: {1}",DateTime.Now.ToString("T"),message) + System.Environment.NewLine + System.Environment.NewLine;

                if(_text.Text.Equals(INITIAL_MESSAGE))
                {
                    _text.Text = string.Empty;
                }

                _text.Text += formatedMessage;

                _view.SetBackgroundColor(color);
            });
        }
示例#43
0
		public static void RenderPawn (RenderTarget c, Color main, Color alternate, Color white, Color black)
		{
			SetFillColor (main);
			SetStrokeColor (black);

			MoveTo (22f, 9f);
			AddCurveToPoint (19.79f, 9f, 18f, 10.79f, 18f, 13f);
			AddCurveToPoint (18f, 13.89f, 18.29f, 14.71f, 18.78f, 15.38f);
			AddCurveToPoint (16.83f, 16.5f, 15.5f, 18.59f, 15.5f, 21f);
			AddCurveToPoint (15.5f, 23.03f, 16.44f, 24.84f, 17.91f, 26.03f);
			AddCurveToPoint (14.91f, 27.09f, 10.5f, 31.58f, 10.5f, 39.5f);
			AddLineToPoint (33.5f, 39.5f);
			AddCurveToPoint (33.5f, 31.58f, 29.09f, 27.09f, 26.09f, 26.03f);
			AddCurveToPoint (27.56f, 24.84f, 28.5f, 23.03f, 28.5f, 21f);
			AddCurveToPoint (28.5f, 18.59f, 27.17f, 16.5f, 25.22f, 15.38f);
			AddCurveToPoint (25.71f, 14.71f, 26f, 13.89f, 26f, 13f);
			AddCurveToPoint (26f, 10.79f, 24.21f, 9f, 22f, 9f);

			ClosePath ();
			MoveTo (22f, 9f);
			FillAndStrokePath ();
		}
示例#44
0
		public static void RenderWhiteQueen (RenderTarget c, Color white, Color black)
		{
			SetFillColor (white);
			SetStrokeColor (black);

			MoveTo (9f, 26f);
			AddCurveToPoint (17.5f, 24.5f, 30f, 24.5f, 36f, 26f);
			AddLineToPoint (38f, 14f);
			AddLineToPoint (31f, 25f);
			AddLineToPoint (31f, 11f);
			AddLineToPoint (25.5f, 24.5f);
			AddLineToPoint (22.5f, 9.5f);
			AddLineToPoint (19.5f, 24.5f);
			AddLineToPoint (14f, 10.5f);
			AddLineToPoint (14f, 25f);
			AddLineToPoint (7f, 14f);
			AddLineToPoint (9f, 26f);
			ClosePath ();
			MoveTo (9f, 26f);
			FillAndStrokePath ();

			MoveTo (9f, 26f);
			AddCurveToPoint (9f, 28f, 10.5f, 28f, 11.5f, 30f);
			AddCurveToPoint (12.5f, 31.5f, 12.5f, 31f, 12f, 33.5f);
			AddCurveToPoint (10.5f, 34.5f, 10.5f, 36f, 10.5f, 36f);
			AddCurveToPoint (9f, 37.5f, 11f, 38.5f, 11f, 38.5f);
			AddCurveToPoint (17.5f, 39.5f, 27.5f, 39.5f, 34f, 38.5f);
			AddCurveToPoint (34f, 38.5f, 35.5f, 37.5f, 34f, 36f);
			AddCurveToPoint (34f, 36f, 34.5f, 34.5f, 33f, 33.5f);
			AddCurveToPoint (32.5f, 31f, 32.5f, 31.5f, 33.5f, 30f);
			AddCurveToPoint (34.5f, 28f, 36f, 28f, 36f, 26f);
			AddCurveToPoint (27.5f, 24.5f, 17.5f, 24.5f, 9f, 26f);
			ClosePath ();
			MoveTo (9f, 26f);
			FillAndStrokePath ();

			MoveTo (11.5f, 30f);
			AddCurveToPoint (15f, 29f, 30f, 29f, 33.5f, 30f);
			StrokePath ();

			MoveTo (12f, 33.5f);
			AddCurveToPoint (18f, 32.5f, 27f, 32.5f, 33f, 33.5f);
			StrokePath ();


			SetFillColor (White);
			SetStrokeColor (Black);

			AddCircle (6f, 12f, 2.0f);
			FillAndStrokePath ();

			AddCircle (14f, 9, 2.0f);
			FillAndStrokePath ();

			AddCircle (22.5f, 8, 2.0f);
			FillAndStrokePath ();

			AddCircle (31, 9, 2.0f);
			FillAndStrokePath ();

			AddCircle (39, 12, 2.0f);
			FillAndStrokePath ();
		}
示例#45
0
		public static void RenderBlackKing (RenderTarget c, Color main, Color alternate, Color white, Color black)
		{
			SetStrokeColor (black);
			MoveTo (22.5f, 11.63f);
			AddLineToPoint (22.5f, 6f);
			StrokePath ();
			
			SetFillColor (main);
			SetStrokeColor (alternate);
			MoveTo (22.5f, 25f);
			AddCurveToPoint (22.5f, 25f, 27f, 17.5f, 25.5f, 14.5f);
			AddCurveToPoint (25.5f, 14.5f, 24.5f, 12f, 22.5f, 12f);
			AddCurveToPoint (20.5f, 12f, 19.5f, 14.5f, 19.5f, 14.5f);
			AddCurveToPoint (18f, 17.5f, 22.5f, 25f, 22.5f, 25f);
			FillPath ();

			MoveTo (11.5f, 37f);
			AddCurveToPoint (17f, 40.5f, 27f, 40.5f, 32.5f, 37f);
			AddLineToPoint (32.5f, 30f);
			AddCurveToPoint (32.5f, 30f, 41.5f, 25.5f, 38.5f, 19.5f);
			AddCurveToPoint (34.5f, 13f, 25f, 16f, 22.5f, 23.5f);
			AddLineToPoint (22.5f, 27f);
			AddLineToPoint (22.5f, 23.5f);
			AddCurveToPoint (19f, 16f, 9.5f, 13f, 6.5f, 19.5f);
			AddCurveToPoint (3.5f, 25.5f, 11.5f, 29.5f, 11.5f, 29.5f);
			AddLineToPoint (11.5f, 37f);
			ClosePath ();
			MoveTo (11.5f, 37f);
			FillPath ();

			SetStrokeColor (black);
			MoveTo (20f, 8f);
			AddLineToPoint (25f, 8f);
			StrokePath ();

			SetStrokeColor (alternate);
			MoveTo (32f, 29.5f);
			AddCurveToPoint (32f, 29.5f, 40.5f, 25.5f, 38.03f, 19.85f);
			AddCurveToPoint (34.15f, 14f, 25f, 18f, 22.5f, 24.5f);
			AddLineToPoint (22.51f, 26.6f);
			AddLineToPoint (22.5f, 24.5f);
			AddCurveToPoint (20f, 18f, 9.906f, 14f, 6.997f, 19.85f);
			AddCurveToPoint (4.5f, 25.5f, 11.85f, 28.85f, 11.85f, 28.85f);
			StrokePath ();

			MoveTo (11.5f, 30f);
			AddCurveToPoint (17f, 27f, 27f, 27f, 32.5f, 30f);
			MoveTo (11.5f, 33.5f);
			AddCurveToPoint (17f, 30.5f, 27f, 30.5f, 32.5f, 33.5f);
			MoveTo (11.5f, 37f);
			AddCurveToPoint (17f, 34f, 27f, 34f, 32.5f, 37f);
			StrokePath ();
		}
		void UpdateColor ()
		{
			color = ShadowEffect.GetColor (Element).ToAndroid ();
		}