void AddStatusBarUnderlay() { _statusBarUnderlay = new global::Android.Views.View(this); var layoutParameters = new ARelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, GetStatusBarHeight()) { AlignWithParent = true }; layoutParameters.AddRule(LayoutRules.AlignTop); _statusBarUnderlay.LayoutParameters = layoutParameters; _layout.AddView(_statusBarUnderlay); if (Forms.IsLollipopOrNewer) { Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); Window.SetStatusBarColor(AColor.Transparent); int primaryColorDark = GetColorPrimaryDark(); if (primaryColorDark != 0) { int r = AColor.GetRedComponent(primaryColorDark); int g = AColor.GetGreenComponent(primaryColorDark); int b = AColor.GetBlueComponent(primaryColorDark); int a = AColor.GetAlphaComponent(primaryColorDark); SetStatusBarColor(AColor.Argb(a, r, g, b)); } } }
protected override void OnElementChanged(ElementChangedEventArgs <Button> e) { base.OnElementChanged(e); if (e.OldElement == null) { var button = Control; // See ButtonRendererWithNavFix.cs CustomClickHandler(button); // Applies a "blue" gradient to our Android navigation buttons var gradientDrawable = new GradientDrawable(); gradientDrawable.SetOrientation(GradientDrawable.Orientation.TlBr); gradientDrawable.SetColors(new int[] { Color.Argb(255, 20, 143, 194), Color.Argb(255, 0, 44, 119) }); gradientDrawable.SetGradientType(GradientType.RadialGradient); gradientDrawable.SetGradientRadius(300); gradientDrawable.SetGradientCenter(0.5f, 0); button.SetBackgroundDrawable(gradientDrawable); // Sets a small drop shadow to the buttons' text button.SetShadowLayer(1, 1, 1, Color.Black); } }
public async Task SetStatusBarColorFromArgb(int alpha, int red, int green, int blue) { await BeginInvokeOnMainThreadAsync(() => { _window.SetStatusBarColor(Color.Argb(alpha, red, green, blue)); }); }
public AColor ToNativeColor() { return(AColor.Argb( innerRgbColor.A, innerRgbColor.R, innerRgbColor.G, innerRgbColor.B)); }
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 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()); }
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 }
private ColorStateList GetColorStateList() { int color; var defaultcolor = _effect.NativeAnimationColor; if (defaultcolor != Xamarin.Forms.Color.Default) { color = defaultcolor.ToAndroid(); } else { color = Color.Argb(31, 0, 0, 0); } return(new ColorStateList( new[] { new int[] { } }, new[] { color, })); }
public HybirdViewController(Activity context, WebView hview, string idpage = "") { try { ApplicationContext = context; HybirdView = hview; JavascriptCallback = new JavascriptValueCallbacker(HybirdView); JavascriptInterface = new JsBrigeInvoker(ApplicationContext, idpage); DefaultClient = new WoDefaultClient(this); ChromeClient = new WoChromeClient(); //HybirdView.Settings.UseWideViewPort = true; HybirdView.Settings.JavaScriptEnabled = true; HybirdView.Settings.DomStorageEnabled = true; HybirdView.Settings.AllowFileAccess = true; HybirdView.Settings.JavaScriptCanOpenWindowsAutomatically = true; HybirdView.Settings.SetLayoutAlgorithm(WebSettings.LayoutAlgorithm.NarrowColumns); HybirdView.AddJavascriptInterface(JavascriptInterface, "bridge"); HybirdView.SetWebViewClient(DefaultClient); HybirdView.SetWebChromeClient(ChromeClient); HybirdView.Settings.CacheMode = CacheModes.Default; HybirdView.Settings.SetEnableSmoothTransition(true); HybirdView.SetDownloadListener(new DownloadListener(ApplicationContext)); HybirdView.SetBackgroundColor(Color.Argb(1, 0, 0, 0)); if (Settings.EnableCachSystem) { HybirdView.Settings.SetAppCacheMaxSize(8 * 1024 * 1024); HybirdView.Settings.SetAppCachePath(ApplicationContext.CacheDir.AbsolutePath); HybirdView.Settings.SetAppCacheEnabled(true); } } catch (Exception e) { Crashes.TrackError(e); } }
protected override void OnElementChanged(ElementChangedEventArgs <Frame> e) { base.OnElementChanged(e); if (e.NewElement == null) { return; } try { // Setting shadow style SetOutlineSpotShadowColor(Color.Argb(100, 0, 0, 0)); SetOutlineAmbientShadowColor(Color.Argb(100, 0, 0, 0)); UpdateElevation(); } catch { UpdateElevation(); return; } }
protected override void OnElementChanged(ElementChangedEventArgs <Button> e) { base.OnElementChanged(e); if (e.OldElement == null) { var button = Control; // Applies a "gray" gradient to our Android popup buttons var gradientDrawable = new GradientDrawable(); gradientDrawable.SetOrientation(GradientDrawable.Orientation.TlBr); gradientDrawable.SetColors(new int[] { Color.Argb(255, 167, 169, 172), Color.Argb(255, 76, 76, 76) }); gradientDrawable.SetGradientType(GradientType.RadialGradient); gradientDrawable.SetGradientRadius(300); gradientDrawable.SetGradientCenter(0.5f, 0); button.SetBackgroundDrawable(gradientDrawable); // Sets a small drop shadow to the buttons' text button.SetShadowLayer(1, 1, 1, Color.Black); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); AToolbar bar; if (ToolbarResource != 0) { bar = LayoutInflater.Inflate(ToolbarResource, null).JavaCast <AToolbar>(); if (bar == null) { throw new InvalidOperationException("ToolbarResource must be set to a Android.Support.V7.Widget.Toolbar"); } } else { bar = new AToolbar(this); } SetSupportActionBar(bar); Window.SetSoftInputMode(SoftInput.AdjustPan); _layout = new ARelativeLayout(BaseContext); SetContentView(_layout); Xamarin.Forms.Application.ClearCurrent(); _previousState = _currentState; _currentState = AndroidApplicationLifecycleState.OnCreate; OnStateChanged(); _statusBarUnderlay = new global::Android.Views.View(this); var layoutParameters = new ARelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, GetStatusBarHeight()) { AlignWithParent = true }; layoutParameters.AddRule(LayoutRules.AlignTop); _statusBarUnderlay.LayoutParameters = layoutParameters; _layout.AddView(_statusBarUnderlay); if (Forms.IsLollipopOrNewer) { Window.DecorView.SystemUiVisibility = (StatusBarVisibility)(SystemUiFlags.LayoutFullscreen | SystemUiFlags.LayoutStable); Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); Window.SetStatusBarColor(AColor.Transparent); int primaryColorDark = GetColorPrimaryDark(); if (primaryColorDark != 0) { int r = AColor.GetRedComponent(primaryColorDark); int g = AColor.GetGreenComponent(primaryColorDark); int b = AColor.GetBlueComponent(primaryColorDark); int a = AColor.GetAlphaComponent(primaryColorDark); SetStatusBarColor(AColor.Argb(a, r, g, b)); } } }
protected void ChangeCheckColor(AColor accent) { ChangeCheckColor(accent, AColor.Argb(76, 117, 117, 117)); }