public NotificationManager(AndroidContext context, IServiceProvider services, ISerializer serializer, IJobManager jobs, IRepository repository, ISettings settings) { this.context = context; this.services = services; this.serializer = serializer; this.jobs = jobs; this.repository = repository; this.settings = settings; // auto process intent? //this.context // .WhenActivityStatusChanged() // .Where(x => x.Status == ActivityState.Created) // .Subscribe(x => TryProcessIntent(x.Activity.Intent)); if (this.context.IsMinApiLevel(26)) { this.newManager = Native.FromContext(context.AppContext); } else { this.compatManager = NotificationManagerCompat.From(context.AppContext); } }
public void OpenAppium() { //WebDriverWait driverWait = new WebDriverWait(androidDriver, TimeSpan.FromSeconds(10)); //driverWait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("icon ion-ios-chatboxes-outline"))); AndroidContext.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10)); AndroidContext.FindElementByXPath("//i[@class='icon ion-ios-chatboxes-outline']").Click(); }
public HttpTransferManager(AndroidContext context, IJobManager jobManager, IMessageBus messageBus, IRepository repository) : base(jobManager, messageBus, repository) { this.context = context; }
protected override void Remove(AndroidContext context, IShadow <RecyclerView> shadow, AndroidViewGroup <RecyclerView> current) { base.Remove(context, shadow, current); // clear down the recycler view adapter shadow.Item.SetAdapter(null); }
public PushManager(AndroidContext context, ISettings settings, IMessageBus bus) : base(settings) { this.context = context; this.bus = bus; }
public CentralContext(AndroidContext context, BleCentralConfiguration config = null) { this.Configuration = config ?? new BleCentralConfiguration(); this.Manager = (BluetoothManager)context.AppContext.GetSystemService(global::Android.App.Application.BluetoothService); this.Android = context; this.devices = new ConcurrentDictionary <string, IPeripheral>(); }
public CustomCellView(Context context, Cell cell) : base(context, cell) { RemoveHint(); RemoveCellValueStack(); _AccessoryStack = AccessoryStack(); Container = new FormsViewContainer(AndroidContext, _CustomCell); this.Add(Container, 2, 0, GridSpec.Fill, GridSpec.Fill, Extensions.Layout.Match ); if (!_CustomCell.ShowArrowIndicator) { // TODO: implement ShowArrowIndicator (_IndicatorView) _AccessoryStack } if (!_CustomCell.UseFullSize) { return; } _Icon.RemoveFromParent(); _Title.RemoveFromParent(); _Description.RemoveFromParent(); var rMargin = (int)(_CustomCell.ShowArrowIndicator ? AndroidContext.ToPixels(10) : 0); Container.SetPadding(0, 0, rMargin, 0); _CellLayout.SetPadding(0, 0, 0, 0); }
void UpdateStatusBarColor(ShellAppearance appearance) { var activity = AndroidContext.GetActivity(); var window = activity?.Window; var decorView = window?.DecorView; int statusBarHeight = AndroidContext.GetStatusBarHeight(); int navigationBarHeight = AndroidContext.GetNavigationBarHeight(); // we are using the split drawable here to avoid GPU overdraw. // All it really is is a drawable that only draws under the statusbar/bottom bar to make sure // we dont draw over areas we dont need to. This has very limited benefits considering its // only saving us a flat color fill BUT it helps people not freak out about overdraw. AColor color; if (appearance != null) { color = appearance.BackgroundColor.ToPlatform(Color.FromArgb("#03A9F4")); } else { color = Color.FromArgb("#03A9F4").ToPlatform(); } if (!(decorView.Background is SplitDrawable splitDrawable) || splitDrawable.Color != color || splitDrawable.TopSize != statusBarHeight || splitDrawable.BottomSize != navigationBarHeight) { var split = new SplitDrawable(color, statusBarHeight, navigationBarHeight); decorView.SetBackground(split); } }
protected virtual void OnElementSet(Shell shell) { Profile.FrameBegin(); Profile.FramePartition("Flyout"); _flyoutRenderer = CreateShellFlyoutRenderer(); Profile.FramePartition("Frame"); _frameLayout = new CustomFrameLayout(AndroidContext) { LayoutParameters = new LP(LP.MatchParent, LP.MatchParent), Id = Platform.GenerateViewId(), }; Profile.FramePartition("SetFitsSystemWindows"); _frameLayout.SetFitsSystemWindows(true); Profile.FramePartition("AttachFlyout"); _flyoutRenderer.AttachFlyout(this, _frameLayout); Profile.FramePartition("AddAppearanceObserver"); ((IShellController)shell).AddAppearanceObserver(this, shell); // Previewer Hack Profile.FramePartition("Previewer Hack"); if (AndroidContext.GetActivity() != null && shell.CurrentItem != null) { SwitchFragment(FragmentManager, _frameLayout, shell.CurrentItem, false); } Profile.FrameEnd(); }
internal static AccessState GetLocationManagerStatus(this AndroidContext context, bool gpsRequired) { //var hasGps = locationManager.IsProviderEnabled(LocationManager.GpsProvider); var lm = context.GetSystemService <LocationManager>(Context.LocationService); if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.P) { if (!lm.IsLocationEnabled) { return(AccessState.Disabled); } } else { if (!lm.IsProviderEnabled(LocationManager.NetworkProvider) && !lm.IsProviderEnabled(LocationManager.GpsProvider)) { return(AccessState.Disabled); } } if (gpsRequired && !lm.IsProviderEnabled(LocationManager.GpsProvider)) { return(AccessState.Disabled); } return(AccessState.Available); }
public void UpdateLayout() { var width = (int)AndroidContext.ToPixels(Element.Width); var height = (int)AndroidContext.ToPixels(Element.Height); _flyoutRenderer.AndroidView.Layout(0, 0, width, height); }
public JobManager(AndroidContext context, IServiceProvider container, IRepository repository, IPowerManager powerManager, IConnectivity connectivity) : base(container, repository, powerManager, connectivity) { this.context = context; }
public GpsManagerImpl(AndroidContext context) { this.context = context; this.client = LocationServices.GetFusedLocationProviderClient(this.context.AppContext); //if (this.IsListening) // this.StartListenerInternal(); // fire and forget }
public JobManager(AndroidContext context, IServiceProvider container, IRepository repository, ISettings settings) : base(container, repository) { this.context = context; this.settings = settings; }
protected internal void ShowKeyboard(AView inputView) { AObject temp = AndroidContext.GetSystemService(AContext.InputMethodService) ?? throw new NullReferenceException(nameof(Context.InputMethodService)); using InputMethodManager inputMethodManager = (InputMethodManager)temp; inputMethodManager.ShowSoftInput(inputView, ShowFlags.Forced); inputMethodManager.ToggleSoftInput(ShowFlags.Forced, HideSoftInputFlags.ImplicitOnly); }
public GeofenceManagerImpl(AndroidContext context, IRepository repository, IGeofenceDelegate geofenceDelegate) : base(repository) { this.context = context; this.client = LocationServices.GetGeofencingClient(this.context.AppContext); this.geofenceDelegate = geofenceDelegate; }
public static int GetResourceIdByName(this AndroidContext context, string iconName) => context .AppContext .Resources .GetIdentifier( iconName, "drawable", Application.Context.PackageName );
protected static AndroidContext CreateChildrenContext(AndroidContext context, IShadow <TView> shadow, AndroidViewGroup <TView> current, AndroidViewGroup <TView> next) { var layoutParamsFactory = (current ?? next).LayoutParamsFactory; var layoutContext = context.With((c) => c.LayoutParamsFactory = layoutParamsFactory); return(layoutContext); }
public MotionActivityManagerImpl(AndroidContext context, AndroidSqliteDatabase database, IMessageBus messageBus) { this.context = context; this.database = database; this.messageBus = messageBus; this.client = ActivityRecognition.GetClient(context.AppContext); }
void OnElementSizeChanged(object sender, EventArgs e) { int width = (int)AndroidContext.ToPixels(Element.Width); int height = (int)AndroidContext.ToPixels(Element.Height); _flyoutRenderer.AndroidView.Measure(MeasureSpecFactory.MakeMeasureSpec(width, MeasureSpecMode.Exactly), MeasureSpecFactory.MakeMeasureSpec(height, MeasureSpecMode.Exactly)); _flyoutRenderer.AndroidView.Layout(0, 0, width, height); }
public PushManager(AndroidContext context, INotificationManager notifications, ISettings settings, IMessageBus bus) : base(settings) { this.context = context; this.notifications = notifications; this.bus = bus; }
public CentralContext(IServiceProvider serviceProvider, AndroidContext context, BleCentralConfiguration config) { this.Android = context; this.Configuration = config; this.Manager = context.GetBluetooth(); this.sdelegate = new Lazy <IBleCentralDelegate>(() => serviceProvider.Resolve <IBleCentralDelegate>()); this.devices = new ConcurrentDictionary <string, IPeripheral>(); this.statusSubject = new Subject <AccessState>(); this.peripheralSubject = new Subject <NamedMessage <IPeripheral> >(); }
void UpdateStatusBarColor(ShellAppearance appearance) { Profile.FrameBegin("UpdtStatBarClr"); var activity = AndroidContext.GetActivity(); var window = activity?.Window; var decorView = window?.DecorView; var resources = AndroidContext.Resources; int statusBarHeight = 0; int resourceId = resources.GetIdentifier("status_bar_height", "dimen", "android"); if (resourceId > 0) { statusBarHeight = resources.GetDimensionPixelSize(resourceId); } int navigationBarHeight = 0; resourceId = resources.GetIdentifier("navigation_bar_height", "dimen", "android"); if (resourceId > 0) { navigationBarHeight = resources.GetDimensionPixelSize(resourceId); } // TODO Previewer Hack if (decorView != null) { // we are using the split drawable here to avoid GPU overdraw. // All it really is is a drawable that only draws under the statusbar/bottom bar to make sure // we dont draw over areas we dont need to. This has very limited benefits considering its // only saving us a flat color fill BUT it helps people not freak out about overdraw. AColor color; if (appearance != null) { color = appearance.BackgroundColor.ToAndroid(Color.FromHex("#03A9F4")); } else { color = Color.FromHex("#03A9F4").ToAndroid(); } if (!(decorView.Background is SplitDrawable splitDrawable) || splitDrawable.Color != color || splitDrawable.TopSize != statusBarHeight || splitDrawable.BottomSize != navigationBarHeight) { Profile.FramePartition("Create SplitDrawable"); var split = new SplitDrawable(color, statusBarHeight, navigationBarHeight); Profile.FramePartition("SetBackground"); decorView.SetBackground(split); } } Profile.FrameEnd("UpdtStatBarClr"); }
/// <summary> /// Update the UI /// </summary> /// <param name="context"></param> /// <param name="shadow"></param> /// <param name="current"></param> /// <param name="next"></param> /// <remarks></remarks> /// <remarks> /// We do the children first, then we do 'this' level /// </remarks> protected override void Update(AndroidContext context, IShadow <TView> shadow, AndroidViewGroup <TView> current, AndroidViewGroup <TView> next) { // create the context var childrenContext = CreateChildrenContext(context, shadow, current, next); // and update the children using the previously assigned adapter this.UpdateChildren(childrenContext, shadow, current, next); // and finally do this... base.Update(context, shadow, current, next); }
public FileSystemImpl(AndroidContext context) { this.AppData = new DirectoryInfo(context.AppContext.FilesDir.AbsolutePath); this.Cache = new DirectoryInfo(context.AppContext.CacheDir.AbsolutePath); var publicDir = context.AppContext.GetExternalFilesDir(null); if (publicDir != null) { this.Public = new DirectoryInfo(publicDir.AbsolutePath); } }
protected internal void HideKeyboard(AView inputView) { AObject temp = AndroidContext.GetSystemService(AContext.InputMethodService) ?? throw new NullReferenceException(nameof(Context.InputMethodService)); using InputMethodManager inputMethodManager = (InputMethodManager)temp; IBinder?windowToken = inputView.WindowToken; if (windowToken != null) { inputMethodManager.HideSoftInputFromWindow(windowToken, HideSoftInputFlags.None); } }
public GeofenceManagerImpl(AndroidContext context, IRepository repository) : base(repository) { this.context = context; this.client = LocationServices.GetGeofencingClient(this.context.AppContext); //mGoogleApiClient = new GoogleApiClient.Builder(this) // .addConnectionCallbacks(this) // .addOnConnectionFailedListener(this) // .addApi(LocationServices.API) // .build(); //this.client.Connect(); }
public NotificationManagerImpl(AndroidContext context, ISettings settings) { this.settings = settings; this.context = context; if ((int)Build.VERSION.SdkInt >= 26) { this.newManager = NotificationManager.FromContext(context.AppContext); } else { this.compatManager = NotificationManagerCompat.From(context.AppContext); } }
protected override TView CreateItem(AndroidContext context, AndroidView <TView> element) { var view = (TView)Activator.CreateInstance(typeof(TView), context.Context); if (context.LayoutParamsFactory != null) { // hang on, we need to get the dimensions from the attributes var dimensions = element.Attributes.GetAttributeOrDefault(View.DimensionsAttribute); view.LayoutParameters = context.LayoutParamsFactory(dimensions ?? Dimensions.WrapWrap); } return(view); }
protected override TView CreateItem(AndroidContext context, AndroidViewGroup <TView> element) { var instance = (TView)Activator.CreateInstance(typeof(TView), context.Context); var dimensions = element.Attributes.GetAttributeOrDefault(View.DimensionsAttribute); var lp = context.LayoutParamsFactory?.Invoke(dimensions ?? Dimensions.MatchMatch); if (lp != null) { instance.LayoutParameters = lp; } return(instance); }