protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <MyMiniPlayer> e) { base.OnElementChanged(e); if (e.OldElement != null) { activity = this.Context as Activity; view.Dispose(); linearLayout.Dispose(); } if (e.NewElement != null) { if (Control == null) { activity = this.Context as Activity; view = activity.LayoutInflater.Inflate(Resource.Layout.miniplayerLayout, null); var test = view.FindViewById(Resource.Id.castMiniController); linearLayout = view.FindViewById <LinearLayout>(Resource.Layout.miniplayerLayout); SetNativeControl(view); } } }
protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <Button> e) { base.OnElementChanged(e); if (Control != null) { var newElement = e.NewElement as Panor.Views.BorderButton; if (newElement != null) { var width = newElement.BorderWidth; var color = newElement.BorderColor; var radius = newElement.BorderRadius; var bgColor = newElement.BackgroundColor; var sd = new Android.Graphics.Drawables.ShapeDrawable(); sd.Shape = new BtnShape( bgColor: Android.Graphics.Color.Rgb((int)(bgColor.R * 255), (int)(bgColor.G * 255), (int)(bgColor.B * 255)), borderColor: Android.Graphics.Color.Rgb((int)(color.R * 255), (int)(color.G * 255), (int)(color.B * 255)), borderWidth: Android.App.Application.Context.Resources.DisplayMetrics.Density * (float)width, borderRadius: Android.App.Application.Context.Resources.DisplayMetrics.Density * radius ); Control.Background = sd; } } }
protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <Map> e) { base.OnElementChanged(e); if (e.OldElement != null) { if (e.OldElement != null) { nativeMap.MarkerClick -= NativeMap_MarkerClick; MAP.PropertyChanged -= FormsMap_PropertyChanged; } } if (e.NewElement != null) { MAP = (CustomMap)e.NewElement; MAP.PropertyChanged += FormsMap_PropertyChanged; Control.GetMapAsync(this); MAP.MapRouteRender = null; MAP.MapRouteRender = new Func <Color, bool>(MapRouteRender); MAP.CleanRoute = null; MAP.CleanRoute = new Func <bool>(() => { if (line != null) { line.Remove(); } return(true); }); } }
protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <Frame> e) { base.OnElementChanged(e); if (e.NewElement == null) { this.GenericMotion -= HandleGenericMotion; this.LongClick -= HandleLongClick; this.Click -= CustomFrameRenderer_Click; } if (e.OldElement == null) { this.GenericMotion += HandleGenericMotion; this.LongClick += HandleLongClick; this.Click += CustomFrameRenderer_Click; } if (e.OldElement != null) { // Unsubscribe } if (e.NewElement != null) { if (e.NewElement != null && e.OldElement == null) { //this.SetBackgroundResource(Resource.Drawable.XMLFile1); //GradientDrawable drawable = (GradientDrawable)this.Background; //drawable.SetColor(Android.Graphics.Color.ParseColor("#FFFFFF")); //ViewGroup.SetBackgroundResource(Resource.Drawable.shadow); } } }
protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <Frame> e) { base.OnElementChanged(e); if (e.NewElement != null && Control != null) { UpdateCornerRadius(); } }
protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <IconView> e) { base.OnElementChanged(e); if (e.OldElement == null) { SetNativeControl(new ImageView(Context)); } UpdateBitmap(e.OldElement); }
protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <BarcodeScanner> e) { base.OnElementChanged(e); if (Element != null && Element.IsEnabled) { InitializeView(); } }
protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <Map> e) { base.OnElementChanged(e); if (e.NewElement != null) { Control.GetMapAsync(this); } }
//protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs<Map> e) //{ // base.OnElementChanged(e); // if (e.OldElement != null) // { // // Unsubscribe // } // if (e.NewElement != null) // { // var formsMap = (MyMap)e.NewElement; // routeCoordinates = formsMap.RouteCoordinates; // ((MapView)Control).GetMapAsync(this); // } //} protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <Map> e) { base.OnElementChanged(e); if (e.NewElement != null) { _xamarinMap = e.NewElement as MyMap; } ((MapView)Control).GetMapAsync(this); }
// Override the OnElementChanged method so we can tweak this renderer post-initial setup protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <Entry> e) { base.OnElementChanged(e); if (Control != null) { Typeface font = Typeface.CreateFromAsset(Forms.Context.Assets, "fonts/Lato-Regular.ttf"); Control.SetTypeface(font, TypefaceStyle.Normal); Control.SetTextColor(global::Android.Graphics.Color.White); Control.SetTextSize(Android.Util.ComplexUnitType.Sp, Config.VeryLargeFontSize); } }
protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <Map> e) { base.OnElementChanged(e); if (e.OldElement != null) { // Unsubscribe } if (e.NewElement != null) { ((MapView)Control).GetMapAsync(this); } }
protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <Map> e) { base.OnElementChanged(e); if (e.OldElement != null) { NativeMap.MarkerClick -= OnMarkerClick; } if (e.NewElement != null) { formsMap = (CoworkingsMap)e.NewElement; Control.GetMapAsync(this); } }
protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <Map> e) { base.OnElementChanged(e); if (e.OldElement != null) { } if (e.NewElement != null) { var androidMapa = (MapaCustomizado)e.NewElement; demarcarCirculo = androidMapa.AreaDemarcada; Control.GetMapAsync(this); } }
protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <Map> e) { base.OnElementChanged(e); if (e.OldElement != null) { NativeMap.InfoWindowClick -= OnInfoWindowClick; } if (e.NewElement != null) { var formsMap = (CustomMap)e.NewElement; customPins = formsMap.CustomPins; Control.GetMapAsync(this); } }
/// <summary> /// Called when [element changed]. /// </summary> /// <param name="e">The e.</param> protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <Button> e) { base.OnElementChanged(e); var view = (WButton)e.NewElement; if (view != null) { SetPadding(view); SetHorizontalTextAlignment(view); if (view.CornerRadius <= 0) { Control.SetBackgroundColor(Color.Transparent.ToAndroid()); } } }
protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <Map> e) { base.OnElementChanged(e); if (e.OldElement != null) { // Unsubscribe } if (e.NewElement != null) { formsMap = (RouteMap)e.NewElement; formsMap.MapControl = this; Control.GetMapAsync(this); } }
protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <Entry> e) { base.OnElementChanged(e); int colors = Color.FromHex("#FEEFDF").ToAndroid(); if (e.OldElement == null) { var gradientDrawable = new GradientDrawable(); gradientDrawable.SetColor(colors); gradientDrawable.SetStroke(0, Android.Graphics.Color.Transparent); Control.SetBackground(gradientDrawable); Control.SetPadding(50, Control.PaddingTop, Control.PaddingRight, ControlUsedForAutomation.PaddingBottom); } }
// Override the OnElementChanged method so we can tweak this renderer post-initial setup protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <Entry> e) { base.OnElementChanged(e); var view = (BybLargeEntry)Element; if (Control != null) { Typeface font = Typeface.CreateFromAsset(Forms.Context.Assets, "fonts/Lato-Regular.ttf"); Control.SetTypeface(font, TypefaceStyle.Normal); Control.SetTextColor(global::Android.Graphics.Color.White); Control.SetTextSize(Android.Util.ComplexUnitType.Sp, Config.VeryLargeFontSize); if (view.BackgroundColor != null) { Control.SetBackgroundColor(new Android.Graphics.Color((int)(255 * view.BackgroundColor.R), (int)(255 * view.BackgroundColor.G), (int)(255 * view.BackgroundColor.B), (int)(255 * view.BackgroundColor.A))); } Control.SetPadding(0, 0, 0, 0); } }
protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <NavigationPage> e) { base.OnElementChanged(e); if (e.OldElement != null) { _toolbarTracker.CollectionChanged -= toolbarCollectionChanged; Element.Pushed -= pagePusshed; Element.Popped -= pagePopped; } if (e.NewElement != null) { var fieldInfo = typeof(NavigationPageRenderer).GetField("_toolbarTracker", BindingFlags.Instance | BindingFlags.NonPublic); _toolbarTracker = (ToolbarTracker)fieldInfo.GetValue(this); fieldInfo = typeof(NavigationPageRenderer).GetField("_toolbar", BindingFlags.Instance | BindingFlags.NonPublic); _toolbar = (Toolbar)fieldInfo.GetValue(this); _toolbarTracker.CollectionChanged += toolbarCollectionChanged; _toolbar.SetTitleTextColor(ForeColor); _toolbar.SetSubtitleTextColor(ForeColor); Element.Pushed += pagePusshed; Element.Popped += pagePopped; _navigationBackListener = new NavigationIconBack(Element); UpdateMenu(); if (Element.Parent is Xamarin.Forms.Application) { var statusBarColor = (Element as NavigationPageEx).StatusBarBackColor; if (statusBarColor != Xamarin.Forms.Color.Default) { (Context as FormsAppCompatActivity).Window.SetStatusBarColor(statusBarColor.ToAndroid()); } } } }
protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <Map> e) { try { base.OnElementChanged(e); if (e.OldElement != null) { map.InfoWindowClick -= OnInfoWindowClick; } if (e.NewElement != null) { formsMap = (CustomMap)e.NewElement; ((MapView)Control).GetMapAsync(this); } } catch (System.Exception) { } }
protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <TabbedPage> e) { base.OnElementChanged(e); var tabLayout = FindChildOfType <TabLayout>(ViewGroup); if (tabLayout == null) { return; } var tabStrip = FindChildOfType <TabLayout.SlidingTabStrip>(tabLayout); BadgeViews = new BadgeView[tabLayout.TabCount]; for (var i = 0; i < tabLayout.TabCount; i++) { var tab = tabLayout.GetTabAt(i); var view = tab.CustomView ?? tabStrip?.GetChildAt(i); var imageView = FindChildOfType <ImageView>(view as ViewGroup); var badgeTarget = imageView?.Drawable != null ? (Android.Views.View)imageView : FindChildOfType <TextView>(view as ViewGroup); //create bage for tab BadgeViews[i] = new BadgeView(Context, badgeTarget); //get text var badgeText = TabBadge.GetBadgeText(Element.Children[i]); BadgeViews[i].Text = badgeText; // set color if not default var tabColor = TabBadge.GetBadgeColor(Element.Children[i]); if (tabColor != Color.Default) { BadgeViews[i].BadgeColor = tabColor.ToAndroid(); } Element.Children[i].PropertyChanged += OnTabPagePropertyChanged; } }
OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <Entry> e) { base.OnElementChanged(e); }
protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <Entry> e) { base.OnElementChanged(e); this.Control.Background = Forms.Context.GetDrawable(Resource.Drawable.EntryBackground); Control?.SetPadding(20, 0, 20, 2); }