public EventButtonsAdapter(Context ctx, ObservableRangeCollection <ActionPlanListModel> buttons)
 {
     _context = ctx;
     _normalButtonBackgroundColor = new Color(ResourcesCompat.GetColor(_context.Resources, Resource.Color.icon_background_grey, null));
     _selectedIconColor           = new Color(ResourcesCompat.GetColor(_context.Resources, Resource.Color.white, null));
     EventButtons = buttons;
 }
Esempio n. 2
0
 private void ShowPassword()
 {
     mCbShowPwd.SetButtonDrawable(ResourcesCompat.GetDrawable(Resources,
                                                              Resource.Drawable.ic_eye_strike,
                                                              Activity.Theme));
     mEtPwd.TransformationMethod = HideReturnsTransformationMethod.Instance;
 }
Esempio n. 3
0
        /// <summary>
        /// Everything regarding location changes is handled here
        /// </summary>
        /// <param name="gpsLocation">Location from Gps</param>
        private void NewElementOnGpsLocationChanged(GeoLocation gpsLocation)
        {
            //Userposition is always updated and shown if position is available
            if (gpsLocation != null)
            {
                var userPosition = new GeoPoint(gpsLocation.Latitude, gpsLocation.Longitude);
                if (userMarkerPosition != null)
                {
                    mapView.OverlayManager.Remove(userMarkerPosition);
                }


                userMarkerPosition = new Marker(mapView);
                userMarkerPosition.SetIcon(ResourcesCompat.GetDrawable(Resources, Resource.Drawable.ic_my_location, null));
                userMarkerPosition.Position = userPosition;
                userMarkerPosition.SetInfoWindow(null);
                mapView.OverlayManager.Add(userMarkerPosition);
                mapView.Invalidate();
            }

            //if navigation is enabled the route will be drawn and updated
            if (osmMap.ShowNavigation)
            {
                CalculateRoute(gpsLocation);
            }
            else if (osmMap.ShowDetailsRoute)
            {
                DrawDetailsRoute(gpsLocation);
            }
        }
        public HorizontalDividerItemDecoration(Context context, int orientation, int resourceID) : base(context, orientation)
        {
            _dividerDrawable = ResourcesCompat.GetDrawable(context.Resources, resourceID, null);
            _drawableHeight  = _dividerDrawable.IntrinsicHeight;

            Drawable = _dividerDrawable;
        }
        protected override void OnElementChanged(ElementChangedEventArgs <Button> e)
        {
            base.OnElementChanged(e);

            if (Control == null)
            {
                return;
            }

            if (Element != null)
            {
                _dowButton = (DayOfWeekButton)Element;
            }

            if (Control.Width > Control.Height)
            {
                Control.SetHeight(Control.Width);
            }
            else
            {
                Control.SetWidth(Control.Height);
            }

            _dowButton.Clicked += Element_Clicked;

            Control.StateListAnimator = null;
            Control.SetPaddingRelative(0, 0, 0, 0);
            Control.TextSize   = 20;
            Control.Background = ResourcesCompat.GetDrawable(Resources, Resource.Drawable.circle_background, null);
            SetPadding(0, 0, 0, 0);
            ButtonDeselected();
            Control.Elevation = 0;
        }
 protected override void OnElementChanged(ElementChangedEventArgs <SearchBar> e)
 {
     base.OnElementChanged(e);
     if (Control != null)
     {
         Control.SetBackground(ResourcesCompat.GetDrawable(Resources, Resource.Drawable.SearchBarStyle, null));
     }
 }
Esempio n. 7
0
 protected override void OnElementChanged(ElementChangedEventArgs <Slider> e)
 {
     base.OnElementChanged(e);
     if (Control != null)
     {
         var thumb = ResourcesCompat.GetDrawable(Resources, Resource.Drawable.slider_thumb, null);
         Control.SetThumb(thumb);
     }
 }
        protected override void OnElementChanged(ElementChangedEventArgs <Entry> e)
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                Control.SetBackground(ResourcesCompat.GetDrawable(Resources, Resource.Drawable.border_text, null));
            }
        }
Esempio n. 9
0
        public void SetIconResource(int resId)
        {
            var drw = ResourcesCompat.GetDrawable(Resources, resId, null);

            if (drw != null)
            {
                IconDrawable = drw;
            }
        }
Esempio n. 10
0
        private GradientDrawable CreateBG(Context context, int id)
        {
            var colorString     = Preferences.Get($"{SettingConstants.WIDGET_BACKGROUND}_{id}", "#FFFFFF");
            var roundedDrawable = ResourcesCompat.GetDrawable(context.Resources, Resource.Drawable.rounded_background, null) as GradientDrawable;

            roundedDrawable.SetColor(Color.ParseColor(colorString));

            return(roundedDrawable);
        }
 private void SetControlStyle()
 {
     if (Control != null)
     {
         Drawable imgDropDownArrow = ResourcesCompat.GetDrawable(Resources, Resource.Drawable.arrow1, null);
         //Resources.GetDrawable(Resource.Drawable.arrow);
         imgDropDownArrow.SetBounds(0, 0, 15, 0);
         Control.SetCompoundDrawablesRelativeWithIntrinsicBounds(null, null, imgDropDownArrow, null);
     }
 }
        /**
         * Demonstrates converting any Drawable to an Icon, for use as a marker icon.
         */
        public static Icon drawableToIcon(Context context, int id)
        {
            var vectorDrawable = ResourcesCompat.GetDrawable(context.Resources, id, context.Theme);
            var bitmap         = Bitmap.CreateBitmap(vectorDrawable.IntrinsicWidth, vectorDrawable.IntrinsicHeight, Bitmap.Config.Argb8888);
            var canvas         = new Canvas(bitmap);

            vectorDrawable.SetBounds(0, 0, canvas.Width, canvas.Height);
            vectorDrawable.Draw(canvas);
            return(IconFactory.GetInstance(context).FromBitmap(bitmap));
        }
 void SetCircleBackground()
 {
     //Set our control background to round drawable and overlay our background color as long as our background color isn't transparent
     if (Element.BackgroundColor != default(Xamarin.Forms.Color) && Element.BackgroundColor != Xamarin.Forms.Color.Transparent)
     {
         Control.Background = ResourcesCompat.GetDrawable(Resources, Resource.Drawable.circle_background, null);
         Control.Background.SetColorFilter(Element.BackgroundColor.ToAndroid(), PorterDuff.Mode.Src);
         Element.BackgroundColor = XFColor.Transparent;
     }
 }
Esempio n. 14
0
        protected override IShellToolbarTracker CreateTrackerForToolbar(Toolbar toolbar)
        {
            var d = ResourcesCompat.GetDrawable(context.Resources, Resource.Drawable.toolbar_bg, null);

            toolbar.SetBackground(d);

            var t = base.CreateTrackerForToolbar(toolbar);

            return(t);
        }
Esempio n. 15
0
        protected override void OnElementChanged(ElementChangedEventArgs <Entry> e)
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                Control.SetBackgroundColor(Android.Graphics.Color.White);
                Control.SetBackground(ResourcesCompat.GetDrawable(Resources, Resource.Drawable.edit_text_style, null));
            }
        }
        protected override Android.Views.View GetCellCore(Cell item, Android.Views.View convertView, ViewGroup parent, Context context)
        {
            var cell = base.GetCellCore(item, convertView, parent, context);

            var child1 = ((LinearLayout)cell).GetChildAt(1);

            var label = (TextView)((LinearLayout)child1).GetChildAt(0);
            label.SetTextColor(new Android.Graphics.Color(ResourcesCompat.GetColor(context.Resources, Resource.Color.black_color, null)));

            return cell;
        }
Esempio n. 17
0
 void OnIsValidChanged(object sender, System.EventArgs e)
 {
     if ((Element as CustomEntry).IsValid != true)
     {
         Control.Background = ResourcesCompat.GetDrawable(Resources, Resource.Drawable.control_background_invalid, null);
     }
     else
     {
         Control.Background = ResourcesCompat.GetDrawable(Resources, Resource.Drawable.control_selector, null);
     }
 }
        protected override Android.Widget.ProgressBar CreateNativeControl()
        {
            var progressbar = new Android.Widget.ProgressBar(Context, null, global::Android.Resource.Attribute.ProgressBarStyleHorizontal)
            {
                Indeterminate = false,
                Max           = 10000,
                //Background = ResourcesCompat.GetDrawable(Context.Resources, Resource.Drawable.progressGradient, null)
                ProgressDrawable = ResourcesCompat.GetDrawable(Context.Resources, Resource.Drawable.progressGradient, null)
            };

            return(progressbar);
        }
        private Drawable GetBackgroundDrawable()
        {
            GradientDrawable drawable = (GradientDrawable)ResourcesCompat.GetDrawable(
                res: Resources,
                id: Resource.Drawable.bkg_roundedview,
                theme: null);

            if (Element is PinItemView element)
            {
                drawable.SetStroke(1, element.BorderColor.ToAndroid());
            }
            return(drawable);
        }
Esempio n. 20
0
        protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.Button> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null)
            {
            }

            if (e.NewElement != null)
            {
                Control.SetBackground(ResourcesCompat.GetDrawable(Resources, Resource.Drawable.button_style, null));
            }
        }
Esempio n. 21
0
        public void Update(GeoLocation loc)
        {
            GeoPoint p = new GeoPoint(loc.Latitude, loc.Longitude);

            mapController.SetCenter(p);

            userPosition.SetIcon(ResourcesCompat.GetDrawable(Resources, Resource.Drawable.ic_my_location, null));
            userPosition.Position = new GeoPoint(p.Latitude, p.Longitude);
            userPosition.SetInfoWindow(null);
            mapView.OverlayManager.Add(userPosition);
            mapView.Invalidate();
            GeoLocation = loc;
        }
Esempio n. 22
0
        public static LayerDrawable CircularIcon(Context ctx, int iconResId, ColorStateList iconColorList, ColorStateList backgroundColorList, int iconPadding = 10, int intrinsicSize = 100)
        {
            var icon = ResourcesCompat.GetDrawable(ctx.Resources, iconResId, null);

            icon?.SetTintList(iconColorList);
            var backgroundDrawable = Circle();

            backgroundDrawable?.SetTintList(backgroundColorList);
            var drw = new LayerDrawable(new Drawable[] { backgroundDrawable, icon });

            drw.SetLayerSize(0, intrinsicSize, intrinsicSize);
            drw.SetLayerInset(1, iconPadding, iconPadding, iconPadding, iconPadding);
            return(drw);
        }
        private Drawable GetDrawable1(string imageEntryImage)
        {
            Drawable imgDropDownArrow = ResourcesCompat.GetDrawable(Resources, Resource.Drawable.dropdown, null);

            //Resources.GetDrawable(Resource.Drawable.arrow);
            imgDropDownArrow.SetBounds(0, 0, 15, 0);
            // Control.SetCompoundDrawablesRelativeWithIntrinsicBounds(null, null, imgDropDownArrow, null);

            //int resID = Resources.GetIdentifier(imageEntryImage, "drawable", this.Context.PackageName);
            //var drawable = ContextCompat.GetDrawable(this.Context, resID);
            //var bitmap = ((BitmapDrawable)drawable).Bitmap;
            return(imgDropDownArrow);
            //return new BitmapDrawable(Resources, Bitmap.CreateScaledBitmap(bitmap, element.ImageWidth1 , element.ImageHeight1 , true));
        }
Esempio n. 24
0
 protected override void OnElementChanged(ElementChangedEventArgs <Slider> e)
 {
     base.OnElementChanged(e);
     if (Control != null && Element is ExtendedSlider view)
     {
         var t = ResourcesCompat.GetDrawable(Resources, Resource.Drawable.slider_thumb, null);
         if (t is GradientDrawable thumb)
         {
             thumb.SetColor(view.ThumbColor.ToAndroid());
             thumb.SetStroke(3, view.ThumbBorderColor.ToAndroid());
             Control.SetThumb(thumb);
         }
     }
 }
Esempio n. 25
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.WidgetSetting);
            SetSupportActionBar(FindViewById <AndroidX.AppCompat.Widget.Toolbar>(Resource.Id.toolbar));
            Title = AppResources.WidgetConfigure_Title;

            var mExtras = Intent.Extras;

            if (mExtras != null)
            {
                widgetId    = mExtras.GetInt(AppWidgetManager.ExtraAppwidgetId, AppWidgetManager.InvalidAppwidgetId);
                bgSelectKey = $"{SettingConstants.WIDGET_BACKGROUND}_{widgetId}";
            }
            else
            {
                return;
            }

            if (!Preferences.ContainsKey(bgSelectKey))
            {
                Preferences.Set(bgSelectKey, selectedColor);
            }

            widgetManager  = AppWidgetManager.GetInstance(this);
            widgetLayoutId = widgetManager.GetAppWidgetInfo(widgetId).InitialLayout;

            remoteView      = new RemoteViews(PackageName, widgetLayoutId);
            previewView     = LayoutInflater.Inflate(widgetLayoutId, null);
            roundedDrawable = ResourcesCompat.GetDrawable(Resources, Resource.Drawable.rounded_background, null) as GradientDrawable;

            //opacitySeekBar = FindViewById<AndroidX.AppCompat.Widget.AppCompatSeekBar>(Resource.Id.WidgetConfigureOpacitySeekBar);
            //opacitySeekBar.ProgressChanged += (sender, e) =>
            //{
            //    opacity = e.Progress;

            //    UpdatePreviewStyle();
            //};

            FindViewById <RadioButton>(Resource.Id.WidgetConfigureBackgroundColorWhite).CheckedChange += WidgetConfigBackgroundSelector_CheckedChange;
            FindViewById <RadioButton>(Resource.Id.WidgetConfigureBackgroundColorBlack).CheckedChange += WidgetConfigBackgroundSelector_CheckedChange;

            FindViewById <FrameLayout>(Resource.Id.WidgetSettingPreviewLayout).AddView(previewView);

            SetPreviewValue();
            UpdatePreviewStyle();
        }
Esempio n. 26
0
        ///<inehritdoc/>
        protected override RecyclerView HandleRecyclerView(Android.Views.View fragmentView)
        {
            RecyclerView recView = fragmentView.FindViewById <RecyclerView>(Resource.Id.questRecyclerViewRefId);

            recView.SetLayoutManager(new LinearLayoutManager(this.Context));
            recView.SetAdapter(QuestsAdapter = new AvailableQuestsAdapter(this.Activity, ViewModel, this));

            DividerItemDecoration decor = new DividerItemDecoration(this.Context, DividerItemDecoration.Vertical);
            Drawable dr = ResourcesCompat.GetDrawable(this.Resources,
                                                      Resource.Drawable.questItemDivider, null);

            decor.SetDrawable(dr);
            recView.AddItemDecoration(decor);
            return(recView);
        }
Esempio n. 27
0
        public static Drawable GetCompanionTypeDrawable(Resources res, ECompanionType type)
        {
            int id;

            switch (type)
            {
            case ECompanionType.Offensive: id = Resource.Drawable.ic_sword; break;

            case ECompanionType.Defensive: id = Resource.Drawable.ic_shield; break;

            default: id = Resource.Drawable.ic_missed; break;
            }

            return(ResourcesCompat.GetDrawable(res, id, null));
        }
Esempio n. 28
0
        protected override void OnElementChanged(ElementChangedEventArgs <Entry> e)
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                var drawableRight = ResourcesCompat.GetDrawable(Resources, Resource.Drawable.ic_mic_black_24dp, null);

                var color = new Base.Graphics.Color(255, 255, 255);
                Control.SetBackgroundColor(color);
                Control.SetCompoundDrawablesWithIntrinsicBounds(null, null, ResourcesCompat.GetDrawable(Resources, Resource.Drawable.ic_mic_black_24dp, null), null);
                Control.Gravity = GravityFlags.CenterVertical;
                Control.SetPadding(30, 20, 30, 20);
                Control.Touch += Control_Touch;
            }
        }
Esempio n. 29
0
        protected override void OnElementChanged(ElementChangedEventArgs <Entry> e)
        {
            base.OnElementChanged(e);

            if (Control == null)
            {
                return;
            }
            if (Element is CustomEntry)
            {
                (Element as CustomEntry).IsValidChanged += OnIsValidChanged;
            }
            Control.Gravity = Android.Views.GravityFlags.CenterVertical | Android.Views.GravityFlags.Left;
            Control.SetPaddingRelative(5, 5, 5, 5);
            Control.SetHintTextColor(Color.FromHex("#565C78").ToAndroid());
            Control.Background = ResourcesCompat.GetDrawable(Resources, Resource.Drawable.control_selector, null);
        }
Esempio n. 30
0
        private Drawable CreateUserIconDrawable()
        {
            int           dp16       = PixelSizeConverter.DpToPx(16);
            int           dp12       = PixelSizeConverter.DpToPx(12);
            int           dp4        = PixelSizeConverter.DpToPx(4);
            var           fillColor  = new Color(ResourcesCompat.GetColor(_layout.Resources, Resource.Color.user_location, null));
            var           ringColor  = new Color(ResourcesCompat.GetColor(_layout.Resources, Resource.Color.user_location_stroke, null));
            var           pointColor = new Color(ResourcesCompat.GetColor(_layout.Resources, Resource.Color.user_location_center, null));
            LayerDrawable drw        = new LayerDrawable(new Drawable[] { CircleDrawable(ringColor, dp16), CircleDrawable(fillColor, dp12), CircleDrawable(pointColor, dp4) });

            drw.SetLayerSize(0, dp16, dp16);
            drw.SetLayerSize(1, dp12, dp12);
            drw.SetLayerSize(2, dp4, dp4);
            drw.SetLayerGravity(0, GravityFlags.Center);
            drw.SetLayerGravity(1, GravityFlags.Center);
            drw.SetLayerGravity(2, GravityFlags.Center);
            return(drw);
        }