protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); if (!OpenCVLoader.InitDebug()) { Console.WriteLine("Init OpenCV failed!!"); } else { Console.WriteLine("Init OpenCV succefuly!!"); } // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // Get our button from the layout resource, // and attach an event to it Button button = FindViewById <Button> (Resource.Id.myButton); button.Click += delegate { //button.Text = string.Format ("{0} clicks!", count++); SetImage(); }; }
public AndroidImpl(ScriptRunnerService AccessibilityService) { _accessibilityService = AccessibilityService; RegisterStorageRootDir(); OpenCVLoader.InitDebug(); }
public AndroidImpl(ScriptRunnerService AccessibilityService) { _accessibilityService = AccessibilityService; _prefs = PreferenceManager.GetDefaultSharedPreferences(_accessibilityService); RegisterStorageRootDir(); OpenCVLoader.InitDebug(); }
/// <summary> /// Called when this activity is created. /// </summary> /// <param name="bundle"></param> protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Result); // Toolbar var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = "OthelloHelper"; // Inputs image_path = Intent.Extras.GetString("image_path"); Log.Info(TAG, $"Path : {image_path}"); isWhite = Intent.Extras.GetBoolean("is_white"); playerColor = isWhite ? "white" : "black"; float rotationAngle = Intent.Extras.GetFloat("rotation_angle"); // Views textResult = FindViewById <TextView>(Resource.Id.textResult); textResult.Text = "Player " + playerColor + " should play on cell ..."; imageView = FindViewById <ImageView>(Resource.Id.imageView); try { // Get bitmap bitmap = MediaStore.Images.Media.GetBitmap(ContentResolver, Android.Net.Uri.Parse(image_path)); bitmap = ResizeBitmap(bitmap); // Rotate if angle is different than 0 if (rotationAngle != 0f) { var matrix = new Matrix(); matrix.PostRotate(rotationAngle); bitmap = Bitmap.CreateBitmap(bitmap, 0, 0, bitmap.Width, bitmap.Height, matrix, true); } Log.Info(TAG, $"Bitmap : {bitmap}. ByteCount : {bitmap.ByteCount}"); imageView.SetImageBitmap(bitmap); } catch { Log.Warn(TAG, $"Can't create bitmap"); } // Init OpenCV if (!OpenCVLoader.InitDebug()) { Log.Debug(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization"); OpenCVLoader.InitAsync(OpenCVLoader.OpencvVersion300, this, this); } else { Log.Debug(TAG, "OpenCV library found inside package. Using it!"); OnManagerConnected(LoaderCallbackInterface.Success); } }
protected override void OnResume() { base.OnResume(); if (!OpenCVLoader.InitDebug()) { OpenCVLoader.InitAsync(OpenCVLoader.OpencvVersion300, this, this); } else { OnManagerConnected(LoaderCallbackInterface.Success); } }
protected override void OnResume() { base.OnResume(); if (!OpenCVLoader.InitDebug()) { Log.Debug(Tag, "Internal OpenCV library not found. Using OpenCV Manager for initialization"); OpenCVLoader.InitAsync(OpenCVLoader.OpencvVersion300, this, mLoaderCallback); } else { Log.Debug(Tag, "OpenCV library found inside package. Using it!"); mLoaderCallback.OnManagerConnected(LoaderCallbackInterface.Success); } }
protected override async void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); MobileBarcodeScanner.Initialize(this.Application); SmsAndroid.dev = this; await CrossMedia.Current.Initialize(); CrossFingerprint.SetCurrentActivityResolver(() => CrossCurrentActivity.Current.Activity); CrossCurrentActivity.Current.Init(this, savedInstanceState); LocalNotificationsImplementation.NotificationIconId = Resource.Drawable.icon; Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); Xamarin.FormsMaps.Init(this, savedInstanceState); CachedImageRenderer.Init(true); NfcManager NfcManager = (NfcManager)Android.App.Application.Context.GetSystemService(Context.NfcService); NFCdevice = NfcManager.DefaultAdapter; CrossNFC.Init(this); Xamarin.Forms.DependencyService.Register <INfcForms, NfcForms>(); x = Xamarin.Forms.DependencyService.Get <INfcForms>() as NfcForms; #if portifolio CrossBadge.Current.SetBadge(9); LoadApplication(new App(new SoapService(), new OpenCVActivity(), new SmsAndroid())); #else if (!OpenCVLoader.InitDebug()) { System.Console.WriteLine("Init OpenCV failed!!"); } else { System.Console.WriteLine("Init OpenCV succefuly!!"); } // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); mOpenCvCameraView = FindViewById <CameraBridgeViewBase>(Resource.Id.fd_activity_surface_view); mOpenCvCameraView.Visibility = ViewStates.Visible; mOpenCvCameraView.SetCvCameraViewListener2(this); mLoaderCallback = new Callback(this, this, mOpenCvCameraView); #endif }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); this.Window.AddFlags(Android.Views.WindowManagerFlags.Fullscreen | Android.Views.WindowManagerFlags.TurnScreenOn | Android.Views.WindowManagerFlags.KeepScreenOn); Xamarin.Essentials.Platform.Init(this, savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); //getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); javaCameraView = (JavaCameraView)FindViewById(Resource.Id.cameraView); javaCameraView.SetCvCameraViewListener2(this); javaCameraView.EnableView(); if (OpenCVLoader.InitDebug()) { System.Diagnostics.Debug.WriteLine("openCV Initialized"); } }
protected override async void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); MobileBarcodeScanner.Initialize(this.Application); await CrossMedia.Current.Initialize(); CrossFingerprint.SetCurrentActivityResolver(() => CrossCurrentActivity.Current.Activity); CrossCurrentActivity.Current.Init(this, savedInstanceState); LocalNotificationsImplementation.NotificationIconId = Resource.Drawable.icon; Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); Xamarin.FormsMaps.Init(this, savedInstanceState); CachedImageRenderer.Init(true); if (!OpenCVLoader.InitDebug()) { System.Console.WriteLine("Init OpenCV failed!!"); } else { System.Console.WriteLine("Init OpenCV succefuly!!"); } // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); mOpenCvCameraView = FindViewById <CameraBridgeViewBase>(Resource.Id.fd_activity_surface_view); mOpenCvCameraView.Visibility = ViewStates.Visible; mOpenCvCameraView.SetCvCameraViewListener2(this); mLoaderCallback = new Callback(this, this, mOpenCvCameraView); }