private void Init(Context context)
        {
            _activity = context as MainActivity;
            // set some styles
            SetHintTextColor(Color.LightGray);
            // The image we defined for the clear button
            imgClearButton = ResourcesCompat.GetDrawable(context.Resources, Resource.Drawable.clear, null);
            SetOnTouchListener(new CustomOnTouchListener());
            FocusChange += (s, e) =>
            {
                if (e.HasFocus)
                {
                    if (CrossCurrentActivity.Current.Activity is MainActivity)
                    {
                        (CrossCurrentActivity.Current.Activity as MainActivity).CloseDrawer();
                    }
                }
            };

            TextChanged += (s, e) =>
            {
                if (Text.Length > 0)
                {
                    ShowClearButton();
                }
                else
                {
                    HideClearButton();
                }
            };
        }
Example #2
0
 public PostingServiceConnection(MainActivity activity)
 {
     IsConnected  = false;
     Binder       = null;
     mainActivity = activity;
 }
 public GeocodeManager(MainActivity activity)
 {
     this.activity = activity;
 }
Example #4
0
 public override void OnDetach()
 {
     base.OnDetach();
     _mActivity = null;
 }
        public XamarinFormsMapsApplicationProject()
        {
            if (Builder.UseDotNet)
            {
                PackageReferences.Add(KnownPackages.XamarinFormsMaps_4_7_0_1142);
                PackageReferences.Add(KnownPackages.Xamarin_GooglePlayServices_Base);
                PackageReferences.Add(KnownPackages.Xamarin_GooglePlayServices_Basement);
                PackageReferences.Add(KnownPackages.Xamarin_GooglePlayServices_Maps);
                PackageReferences.Add(KnownPackages.Xamarin_GooglePlayServices_Tasks);

                //TODO: temporary fix for <Import/> ordering breakage and workloads
                SetProperty("AndroidApplication", "True");
            }
            else
            {
                PackageReferences.Add(KnownPackages.XamarinFormsMaps_4_0_0_425677);
            }
            MainActivity = MainActivity.Replace("//${AFTER_FORMS_INIT}", "Xamarin.FormsMaps.Init (this, savedInstanceState);");
            //NOTE: API_KEY metadata just has to *exist*
            AndroidManifest = AndroidManifest.Replace("</application>", "<meta-data android:name=\"com.google.android.maps.v2.API_KEY\" android:value=\"\" /></application>");
            // From https://github.com/xamarin/GooglePlayServicesComponents/blob/fc057c754e04d3e719d8c111d03d60eb2467b9ce/source/com.google.android.gms/play-services-basement/buildtasks.tests/google-services.json
            OtherBuildItems.Add(new BuildItem("GoogleServicesJson", "google-services.json")
            {
                Encoding    = new System.Text.UTF8Encoding(encoderShouldEmitUTF8Identifier: false),
                TextContent = () =>
                              @"{
  ""project_info"": {
    ""project_number"": ""1041063143217"",
    ""firebase_url"": ""https://white-cedar-97320.firebaseio.com"",
    ""project_id"": ""white-cedar-97320"",
    ""storage_bucket"": ""white-cedar-97320.appspot.com""
  },
  ""client"": [
    {
      ""client_info"": {
        ""mobilesdk_app_id"": ""1:1041063143217:android:ffbe6976403db935"",
        ""android_client_info"": {
          ""package_name"": ""com.xamarin.sample""
        }
      },
      ""oauth_client"": [
        {
          ""client_id"": ""1041063143217-rve97omgqivvs3qcne1ljso137k3t6po.apps.googleusercontent.com"",
          ""client_type"": 1,
          ""android_info"": {
            ""package_name"": ""com.xamarin.sample"",
            ""certificate_hash"": ""84949BBD3F34C8290A55AC9B66AD0A701EBA67AC""
          }
        },
        {
          ""client_id"": ""1041063143217-hu5u4dnv8dkj19i4tpi6piv97kd2k9i0.apps.googleusercontent.com"",
          ""client_type"": 3
        },
        {
          ""client_id"": ""1041063143217-n82odtjjgs9g2qnh1t470mdhj086id9f.apps.googleusercontent.com"",
          ""client_type"": 3
        }
      ],
      ""api_key"": [
        {
          ""current_key"": ""NOT_A_REAL_KEY""
        }
      ],
      ""services"": {
        ""analytics_service"": {
          ""status"": 2,
          ""analytics_property"": {
            ""tracking_id"": ""UA-6465612-26""
          }
        },
        ""appinvite_service"": {
          ""status"": 2,
          ""other_platform_oauth_client"": [
            {
              ""client_id"": ""1041063143217-hu5u4dnv8dkj19i4tpi6piv97kd2k9i0.apps.googleusercontent.com"",
              ""client_type"": 3
            },
            {
              ""client_id"": ""1041063143217-rdc97s7jssl1k29c83b6oci04sihqkdi.apps.googleusercontent.com"",
              ""client_type"": 2,
              ""ios_info"": {
                ""bundle_id"": ""com.xamarin.googleios.collectallthestars""
              }
            }
          ]
        },
        ""ads_service"": {
          ""status"": 2
        }
      }
    }
  ],
  ""configuration_version"": ""1""
}"
            });
        }
Example #6
0
 private void MainActivityCreated(MainActivity activity)
 {
     MainActivity.OnActivityCreated -= MainActivityCreated;
     _activity = activity;
     ConnectToOSService();
 }
			public OnClickListener (MainActivity t)
			{
				that = t;
			}
 public AlarmServiceConnection(MainActivity activity)
 {
     this.activity = activity;
 }
Example #9
0
 public LastLocationSuccess(MainActivity mainActivity)
 {
     this.mainActivity = mainActivity;
 }
Example #10
0
        protected async override void OnResume()
        {
            Log.Info(TAG, "OnResume");

            base.OnResume();

            var portInfo   = Intent.GetParcelableExtra(EXTRA_TAG) as UsbSerialPortInfo;
            int vendorId   = portInfo.VendorId;
            int deviceId   = portInfo.DeviceId;
            int portNumber = portInfo.PortNumber;

            Log.Info(TAG, string.Format("VendorId: {0} DeviceId: {1} PortNumber: {2}", vendorId, deviceId, portNumber));

            var drivers = await MainActivity.FindAllDriversAsync(usbManager);

            var driver = drivers.Where((d) => d.Device.VendorId == vendorId && d.Device.DeviceId == deviceId).FirstOrDefault();

            if (driver == null)
            {
                throw new Exception("Driver specified in extra tag not found.");
            }

            port = driver.Ports[portNumber];
            if (port == null)
            {
                titleTextView.Text = "No serial device.";
                return;
            }
            Log.Info(TAG, "port=" + port);

            titleTextView.Text = "Serial device: " + port.GetType().Name;

            serialIoManager = new SerialInputOutputManager(port)
            {
                BaudRate = 4800,
                DataBits = 8,
                StopBits = StopBits.One,
                Parity   = Parity.None,
            };
            serialIoManager.DataReceived += (sender, e) => {
                RunOnUiThread(() => {
                    UpdateReceivedData(e.Data);
                });
            };
            serialIoManager.ErrorReceived += (sender, e) => {
                RunOnUiThread(() => {
                    var intent = new Intent(this, typeof(MainActivity));
                    StartActivity(intent);
                });
            };

            Log.Info(TAG, "Starting IO manager ..");
            try
            {
                serialIoManager.Open(usbManager);
            }
            catch (Java.IO.IOException e)
            {
                titleTextView.Text = "Error opening device: " + e.Message;
                return;
            }
        }
Example #11
0
 public ProjectAdapter(Projects project, MainActivity main)
 {
     this.main = main;
     mProjects = project;
 }
Example #12
0
 public override void OnStart()
 {
     MainActivity.SetActionBarForBackOperation(AppResources.App_About);
     base.OnStart();
 }
Example #13
0
 public BtClient(MainActivity mainActivity)
 {
     this._mainActivity = mainActivity;
 }
Example #14
0
        public void StopBeacon()
        {
            MainActivity activity = (MainActivity)(Android.App.Application.Context);

            activity.StopBeacon();
        }
Example #15
0
 public GridViewSuggestAdapter(List <string> suggestSource, Context context, MainActivity mainActivity)
 {
     this.mainActivity     = mainActivity;
     this.context          = context;
     this.m_LSuggestSource = suggestSource;
 }
		public override void OnAttach (Activity activity)
		{
			base.OnAttach (activity);
			mActivity = (MainActivity) activity;
		}
Example #17
0
 public LastLocationFail(MainActivity mainActivity)
 {
     this.mainActivity = mainActivity;
 }
			public JavaIdiomClickListener(MainActivity outer)
			{
				this.outer = outer;
				
			}
Example #19
0
 public static void UpdateLocation()
 {
     LocationReqvest();
     FusedLocationProviderClient = LocationServices.GetFusedLocationProviderClient(MainActivity.GetInstance());
     if (ActivityCompat.CheckSelfPermission(MainActivity.GetInstance(), Manifest.Permission.AccessFineLocation) != Android.Content.PM.Permission.Granted)
     {
         return;
     }
     gefenceModel.PendingIntent = GetPendingIntent();
     FusedLocationProviderClient.RequestLocationUpdates(locationRequest, gefenceModel.PendingIntent);
 }
        public void StartTutorial(MainActivity activity)
        {
            _mainActivity = activity;

            // hide Tools for tuto
            _mainActivity.HideTools();
            _mainActivity.HideScroll();

            //TODO : put Bed Cachou
            _mainActivity.SetCachouImg(Resource.Drawable.Cachou);

            // start audio 1
            PlayAudio(_mainActivity, Resource.Raw.audio1);

            // Add event on nurse click
            _mainActivity.FindViewById<ImageView>(Resource.Id.bear1).Click += OnCompletion;
            _mainActivity.FindViewById<ImageView>(Resource.Id.bear2).Click += OnCompletion;
            _mainActivity.FindViewById<ImageView>(Resource.Id.bear3).Click += OnCompletion;

            _mainActivity.FindViewById<ImageView>(Resource.Id.fox1).Click += OnCompletion;
            _mainActivity.FindViewById<ImageView>(Resource.Id.fox2).Click += OnCompletion;

            _mainActivity.FindViewById<ImageView>(Resource.Id.girafe1).Click += OnCompletion;
            _mainActivity.FindViewById<ImageView>(Resource.Id.girafe2).Click += OnCompletion;

            _mainActivity.FindViewById<ImageView>(Resource.Id.panda1).Click += OnCompletion;
            _mainActivity.FindViewById<ImageView>(Resource.Id.panda2).Click += OnCompletion;
        }
 public FragmentDetailProducts(MainActivity _parent) : base()
 {
     parent = _parent;
 }
 public RegularPersonaBroadcastReceiver(MainActivity mainActivity, IUpdateMacroInfo updater)
 {
     _mainActivity = mainActivity;
     _updater      = updater;
 }
Example #23
0
 public override void OnReceive(Context context, Intent intent)
 {
     MainActivity.SetAlarmForBackgroundServices(context);
 }
Example #24
0
 public override void OnAttach(Context activity)
 {
     base.OnAttach(activity);
     _mActivity = (MainActivity)activity;
 }
Example #25
0
 internal void setParentActivity(MainActivity mainActivity)
 {
     this.main = mainActivity;
 }
 public Adaptador_Caballos(List <Caballos> caballos, MainActivity mainActivity)
 {
     this.caballos     = caballos;
     this.mainActivity = mainActivity;
 }
 public GeofenceManager(MainActivity activity)
 {
     this.activity = activity;
 }
 public QuerySuggestionResultListener(MainActivity context)
 {
     this.context = context;
 }
 public Fragment_Caballos(MainActivity mainActivity)
 {
     this.mainActivity = mainActivity;
 }
 public FileChooserWebChromeClient(MainActivity activity)
 {
     this.activity = activity;
 }
Example #31
0
        private unsafe void DecodeFrame(IntPtr address, int w, int h)
        {
            if (input == null)
            {
                width    = w;
                height   = h;
                cDegrees = cameraController.mSensorOrientation;

                imageData     = new int[width * height];
                imageGCHandle = GCHandle.Alloc(imageData, GCHandleType.Pinned);
                imageIntPtr   = imageGCHandle.AddrOfPinnedObject();

                input = new SKBitmap(new SKImageInfo(width, height, SKColorType.Rgba8888, SKAlphaType.Premul));
            }

            input.InstallPixels(input.Info, address);

            if (inputCropped == null)
            {
                inputCropped = new SKBitmap(new SKImageInfo(width, width, SKColorType.Rgba8888, SKAlphaType.Premul));
            }

            CropInputBitmap(input);

            if (canAnalyze)
            {
                Task.Factory.StartNew(() =>
                {
                    canAnalyze = false;

                    stopwatch.Restart();

                    inputCropped.ScalePixels(inputScaled_PlateAndMoto, SKFilterQuality.None);
                    inputCropped.ScalePixels(inputScaled_MotoModel, SKFilterQuality.None);

                    stopwatch.Stop();

                    MainActivity.PlateAndMotoStats.ResizeAndRotateElapsedMs = stopwatch.ElapsedMilliseconds;

                    stopwatch.Restart();

                    colors_PlateAndMoto = inputScaled_PlateAndMoto.GetPixels();
                    colors_MotoModel    = inputScaled_MotoModel.GetPixels();

                    tfService_Plate?.Recognize(colors_PlateAndMoto, colorCount_PlateAndMoto);
                    //tfService_Moto?.Recognize(colors_PlateAndMoto, colorCount_PlateAndMoto);

                    stopwatch.Stop();

                    MainActivity.PlateAndMotoStats.InterpreterElapsedMs = stopwatch.ElapsedMilliseconds;

                    stopwatch.Restart();

                    tfService_MotoModel?.Recognize(colors_MotoModel, colorCount_MotoModel);

                    stopwatch.Stop();

                    MainActivity.MotoModelStats.InterpreterElapsedMs = stopwatch.ElapsedMilliseconds;

                    //canAnalyze = true;

                    //MainActivity.context.RunOnUiThread(() =>
                    //{
                    //    MainActivity.ReloadCanvas();
                    //});
                }).ContinueWith((t) =>
                {
                    if (t.Exception != null)
                    {
                        Crashes.TrackError(t.Exception);
                    }

                    canAnalyze = true;

                    MainActivity.context.RunOnUiThread(() =>
                    {
                        MainActivity.ReloadCanvas();
                    });
                });
            }
        }
Example #32
0
 public PurgeServiceConnection(MainActivity activity)
 {
     IsConnected  = false;
     mainActivity = activity;
 }
Example #33
0
 public ActivityResultListener(MainActivity activity)
 {
     // subscribe to activity results
     ActivityEvent.OnActivityResult += OnActivityResult;
 }
Example #34
0
 public MainActivity()
 {
     _instance = this;
 }
Example #35
0
 public AndroidBilling(MainActivity a)
 {
     SAMLog.Debug("AndroidBilling.ctr");
     _activity = a;
 }
 public AndroidPhoneFeatureService(MainActivity owner)
 {
     this.owner = owner;
 }
Example #37
0
 public CustomAdapter(MainActivity mainActivity, List <string> taskList, DbHelper dbHelper)
 {
     this.mainActivity = mainActivity;
     this.taskList     = taskList;
     this.dbHelper     = dbHelper;
 }
			public AdListener (MainActivity t)
			{
				that = t;
			}
Example #39
0
 public FusedLocationProviderCallback(MainActivity activity = null)
 {
     this.activity = activity;
 }
 public TouchableWrapper(Context context) : base(context)
 {
     _mainActivity = context as MainActivity;
 }
 public void PlayAudio(MainActivity act,int ress)
 {
     _player = MediaPlayer.Create(act, ress);
     _player.Completion += OnCompletion;
     _player.Start();
 }