Exemplo n.º 1
0
 public async Task Bother()
 {
     vibrator.Vibrate(200, feedback);
     await Task.Delay(300);
     vibrator.Vibrate(200, feedback);
     await Task.Delay(200);
 }
Exemplo n.º 2
0
        private void Vibrate()
        {
            Vibrator vibrator = (Vibrator)GetSystemService(Context.VibratorService);

            vibrator.Vibrate(200);
            Thread.Sleep(300);
            vibrator.Vibrate(200);
            Thread.Sleep(300);
            vibrator.Vibrate(200);
        }
 private void VerificationVibrate()
 {
     if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
     {
         _vibrator.Vibrate(VibrationEffect.CreateOneShot(100, 100));
     }
     else
     {
         _vibrator.Vibrate(100);
     }
 }
Exemplo n.º 4
0
 private void BtnSpeed_Click(object sender, EventArgs e)
 {
     vibrator.Vibrate(30);
     try
     {
         lcmgr.RequestLocationUpdates(LocationManager.GpsProvider, 1, 1, this);
         location = lcmgr.GetLastKnownLocation(LocationManager.GpsProvider);
         RunOnUiThread(() => OnLocationChanged(location));
         tGps = TypeGps.speed;
     }
     catch { }
 }
Exemplo n.º 5
0
 internal void NotifyTransacting(Vibrator vibrator)
 {
     logger.Info("Init new Transaction");
     if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
     {
         vibrator.Vibrate(VibrationEffect.CreateOneShot(150, 100));
     }
     else
     {
         vibrator.Vibrate(150);
     }
     IsTransacting = true;
 }
Exemplo n.º 6
0
        private void Vibrate()
        {
            Vibrator vibrator = (Vibrator)GetSystemService(Context.VibratorService);

            if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.O)
            {
                vibrator.Vibrate(VibrationEffect.CreateOneShot(ONE_HUNDRED_MILLISECONDS, VibrationEffect.DefaultAmplitude));
            }
            else
            {
                vibrator.Vibrate(ONE_HUNDRED_MILLISECONDS);
            }
        }
Exemplo n.º 7
0
        //Starts the main layout, and makes the button functional
        private void StartMainLayout()
        {
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            ImageButton startGame = FindViewById <ImageButton>(Resource.Id.start_game);

            startGame.Click += delegate
            {
                myVib.Vibrate(30);
                StartFindIt();
            };
        }
Exemplo n.º 8
0
 partial void StartVibration(TimeSpan duration)
 {
     if (_vibrator != null)
     {
         _vibrator.Vibrate((long)duration.TotalMilliseconds);
     }
 }
Exemplo n.º 9
0
        private void StartListening()
        {
            PowerLock.RequestScreenLock(10);
            SetLabelText(string.Empty);
            Task.Run(() => Parallel.Invoke(
                         () =>
            {
                if (Pref.GetSoundFeedback())
                {
                    _player.Start();
                }
            },
                         () =>
            {
                if (Pref.GetVibrateFeedback())
                {
                    Vibrator vibrator = Vibrator.Vibrators[0];
                    vibrator.Vibrate(200, 100);
                }
            }
                         ));

            AudioRecorder.StartRecording(Pref.GetHtmlResponse());
            (ProgressPopup ?? (ProgressPopup = new ProgressPopup())).Show();

            SetActionButtonIsEnabled(false);
            SetButtonImage("listen_disabled_allgreyedout.png");
        }
Exemplo n.º 10
0
        void Game_Mechanics_Player_Colision()
        {
            /*
             *  This Section Manages The Player Colision With The Asteroids.
             */

            // Looping Thru The Asteroids List.
            for (int Asteroid_Index = 0; Asteroid_Index < Asteroids.Count(); Asteroid_Index++)
            {
                Asteroid Asteroid = Asteroids[Asteroid_Index]; // Creating A Reference To The Asteroid.

                if (Player.Collision_Detection(Asteroid.Get_Layout()))
                { // If The Asteroid Hit The Player.
                    // Vibrating The Phone When User Hit Asteroid.
                    Vibrator Vibrator = (Vibrator)Application.Context.GetSystemService(VibratorService);
                    Vibrator.Vibrate(100);

                    // Updating The Health Of The Player, And Checking If It's Health Is Depleted Below  0.
                    if (Player.Update_Health(Asteroid.GetHealth()) <= 0)
                    {
                        // Saving The Game And Exiting To Main Screen.
                        Save_And_Exit();
                    }

                    Health_TextView.Text = Player.GetPlayer_Health().ToString(); // Update The Health TextView.

                    Remove_Asteroid(Asteroid);
                }
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// User performed an action using single <paramref name="touch"/>
        /// </summary>
        /// <param name="touch"></param>
        private void SingleTouchLogic(Touch touch)
        {
            switch (touch.phase)
            {
            case TouchPhase.Stationary:
                stationaryTouchTime += Time.deltaTime;
                if (!GameManager.Instance.IsInputBlocked && stationaryTouchTime > TRANSLATE_TIMEOUT)
                {
                    GameManager.Instance.IsInputBlocked = true;
                    Vibrator.Vibrate(100);
                }
                break;

            case TouchPhase.Moved:
                if (stationaryTouchTime > TRANSLATE_TIMEOUT)
                {
                    var     ray      = Camera.main.ScreenPointToRay(touch.position);
                    Vector3 endPoint = ray.origin + (ray.direction * Vector3.Distance(Camera.main.transform.position, Board.transform.position));
                    ray = Camera.main.ScreenPointToRay(touch.position - touch.deltaPosition);
                    Vector3 start = ray.origin + (ray.direction * Vector3.Distance(Camera.main.transform.position, Board.transform.position));
                    TranslateBoard(endPoint - start);
                }
                break;

            case TouchPhase.Canceled:
            case TouchPhase.Ended:
                GameManager.Instance.IsInputBlocked = false;
                stationaryTouchTime = 0;
                break;
            }
        }
Exemplo n.º 12
0
        public void PlayVibrate()
        {
            var      obj      = Forms.Context.GetSystemService(Context.VibratorService);
            Vibrator vibrator = (Vibrator)obj;

            vibrator.Vibrate(500);
        }
Exemplo n.º 13
0
 private void Vibrate()
 {
     if (TimeUtil.CheckInterval("Vibrate", CT.table.vibrateInterval))
     {
         Vibrator.Vibrate(CT.table.vibrateDuration);
     }
 }
Exemplo n.º 14
0
            public void ReceiveDetections(Detector.Detections detections)
            {
                var qrcodes = detections.DetectedItems;

                if (qrcodes.Size() != 0)
                {
                    if (Configuration.IsScanning)
                    {
                        Configuration.IsScanning = false;
                        if (_vibrationOnDetected)
                        {
                            Vibrator vib = (Vibrator)_context.GetSystemService(Context.VibratorService);
                            vib.Vibrate(200);
                        }
                        List <BarcodeResult> barcodeResults = new List <BarcodeResult>();
                        for (int i = 0; i < qrcodes.Size(); i++)
                        {
                            Barcode barcode = qrcodes.ValueAt(i) as Barcode;
                            if (barcode == null)
                            {
                                continue;
                            }
                            var type  = Methods.ConvertBarcodeResultTypes(barcode.ValueFormat);
                            var value = barcode.DisplayValue;
                            barcodeResults.Add(new BarcodeResult
                            {
                                BarcodeType  = type,
                                DisplayValue = value
                            });
                        }
                        OnDetected?.Invoke(barcodeResults);
                    }
                }
            }
        private void Vibrate()
        {
            Vibrator vibrator = (Vibrator)GetSystemService(VibratorService);

            long[] pattern = { 0, 400, 600, 800 };
            vibrator.Vibrate(pattern, -1);
        }
Exemplo n.º 16
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build();
            StrictMode.SetThreadPolicy(policy);

            var wifi = (WifiManager)GetSystemService(WifiService);
            var ConnectivityManager = (ConnectivityManager)GetSystemService(ConnectivityService);

            wifilock = wifi.CreateWifiLock(WifiMode.FullHighPerf, "WifiLock");
            wifilock.Acquire();

            game = new Game1(
                CreateUdpService(wifi, ConnectivityManager)
                , RuningOnAndroid: true
                );

            if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
            {
                Vibrator vibrator = (Vibrator)GetSystemService(VibratorService);
                Game1.AndroidVibrate = f => vibrator.Vibrate(VibrationEffect.CreateOneShot(f, VibrationEffect.DefaultAmplitude));
            }
            else
            {
                //TODO:
            }

            SetViewFullScreen();

            //PowerManager pm = (PowerManager)GetSystemService(PowerService);
            //this.mWakeLock = pm.NewWakeLock(WakeLockFlags.ScreenDim, "My Tag");
            //this.mWakeLock.Acquire();
            game.Run();
        }
Exemplo n.º 17
0
        public void timeSucccess()
        {
            casovac.Stop();

            foreach (ButtonItem bt in ButtonItem.seznamVisibleButtons)
            {
                bt.killThis();
            }

            if (gameInterval >= 100 && gameInterval < 130)
            {
                RunOnUiThread(() => obrazekSmile.SetImageResource(Resource.Drawable.smile));
            }
            if (gameInterval < 100)
            {
                RunOnUiThread(() => obrazekSmile.SetImageResource(Resource.Drawable.lol));
            }
            if (OptionsHodnoty.Vibrace)
            {
                mvibrator = (Vibrator)this.GetSystemService(Context.VibratorService);
                mvibrator.Vibrate(10);
            }
            //System.Threading.Thread.Sleep (malaPausa);

            gameIntervalBase--;
            gameInterval = gameIntervalBase;

            casovac.Start();
        }
Exemplo n.º 18
0
 public void CheckAccion(string accion, TLClient client, Contact contact)
 {
     try
     {
         if (accion == "B")
         {
             contactService.BlockKnownContact(client, contacto, contactRepository);
             textToSpeak = "Contacto bloqueado. ";
         }
         else if (accion == "D")
         {
             contactService.UnblockKnownContact(client, contacto, contactRepository);
             textToSpeak = "Contacto desbloqueado. ";
         }
         Vibrator vibrator = (Vibrator)this.GetSystemService(Context.VibratorService);
         vibrator.Vibrate(1000);
         count        = 0;
         textToSpeak += "¿Quiere bloquear un contacto, desbloquear un contacto, no hacer nada o volver atrás?";
     }
     catch (Exception ex)
     {
         count       = 0;
         textToSpeak = "Ha ocurrido un problema bloquear o desbloquear el contacto. Por favor, inténtelo más tarde. " +
                       "¿Quiere bloquear un contacto, desbloquear un contacto, no hacer nada o volver atrás?";
         toSpeech = new TextToSpeech(this, this);
     }
     toSpeech = new TextToSpeech(this, this);
 }
Exemplo n.º 19
0
 public override void OnReceive(Context context, Intent intent)
 {
     if (Build.VERSION.SdkInt >= BuildVersionCodes.M)
     {
         PowerManager          pm       = (PowerManager)context.GetSystemService("power");
         PowerManager.WakeLock wakeLock = pm.NewWakeLock(WakeLockFlags.Partial, "LocationManagerService");
         if (pm.IsDeviceIdleMode)
         {
             // the device is now in doze mode
             Vibrator vibrator = (Vibrator)context.GetSystemService("vibrator");
             vibrator.Vibrate(100);
             if (wakeLock.IsHeld == false)
             {
                 wakeLock.Acquire();
             }
         }
         else
         {
             Vibrator vibrator = (Vibrator)context.GetSystemService("vibrator");
             vibrator.Vibrate(1000);
             if (wakeLock.IsHeld)
             {
                 wakeLock.Release();
             }
             // the device just woke up from doze mode
         }
     }
 }
Exemplo n.º 20
0
 public void MensajeEnviado(TLAbsUpdates updates, string fromPhone, string mensaje)
 {
     if (updates != null)
     {
         Chat m = new Chat
         {
             FromTo  = fromPhone,
             Mensaje = mensaje,
             Send    = true,
             Created = DateTime.Now,
             Seen    = true
         };
         messageRepository.InsertMessage(m);
         Vibrator vibrator = (Vibrator)this.GetSystemService(Context.VibratorService);
         vibrator.Vibrate(1000);
         _adapter    = new MyAdapterSingle(this, Resource.Layout.SingleChatItem, GetChats());
         _lv.Adapter = _adapter;
         count       = 0;
         textToSpeak = "Mensaje enviado. ¿Quiere leer desde una fecha, buscar por un mensaje, no hacer nada o volver atrás?";
         toSpeech    = new TextToSpeech(this, this);
     }
     else
     {
         count       = 0;
         textToSpeak = "No se ha podido enviar el mensaje. Inténtelo más tarde. ¿Quiere leer desde una fecha, buscar por un mensaje, no hacer nada o volver atrás?";
         toSpeech    = new TextToSpeech(this, this);
     }
 }
Exemplo n.º 21
0
        private SimpleMessageDialog LogErrorInternal(Exception ex, bool silent = false)
        {
            if (ex is LocalizedException)
            {
                WriteLine((ex as LocalizedException).InnerException, LogPriority.Error);
            }

            else
            {
                WriteLine(ex, LogPriority.Error);
            }

            if (silent)
            {
                return(null);
            }

            Vibrator vibrator = (Vibrator)_context.GetSystemService(Context.VibratorService);

            vibrator.Vibrate(VibrationEffect.CreateOneShot(100, VibrationEffect.DefaultAmplitude));

            var simpleMessageDialog = new SimpleMessageDialog(_context)
            {
                ButtonTextId  = Resource.String.mettarin_ok,
                MessageTextId = (ex is LocalizedException) ?
                                (ex as LocalizedException).ResourceId : Resource.String.mettarin_error_text,
                TitleTextId = Resource.String.mettarin_error
            };

            return(simpleMessageDialog);
        }
Exemplo n.º 22
0
        public static bool SetVibration(PlayerIndex playerIndex, float leftMotor, float rightMotor)
        {
            Vibrator vibrator = (Vibrator)Game.contextInstance.GetSystemService(Context.VibratorService);

            vibrator.Vibrate(500);
            return(true);
        }
        public void ActivateHaptic()
        {
            VibrationEffect effect   = VibrationEffect.CreateOneShot(100, VibrationEffect.DefaultAmplitude);
            Vibrator        vibrator = (Vibrator)global::Android.App.Application.Context.GetSystemService(Context.VibratorService);

            vibrator.Vibrate(effect);
        }
Exemplo n.º 24
0
        public void vibrar(int milisegundo)
        {
            Context  context  = Android.App.Application.Context;
            Vibrator vibrator = (Vibrator)context.GetSystemService(Context.VibratorService);

            vibrator.Vibrate(milisegundo);
        }
Exemplo n.º 25
0
        // Detecting The User Presses.

        private void Detect_LongPress(object sender, ElapsedEventArgs Event)
        {
            // Checking If The User 'Longged Pressed' A ImageView. ( To Change It To A Flag )

            ImageView[,] Grid_Views = Minesweeper.Get_Grid_Views();

            RelativeLayout Grid_Layout = FindViewById <RelativeLayout>(Resource.Id.Grid);

            // Checking If This View Still Being Pressed.
            if (Grid_Views[Pressed_Block_Location / Grid_Views.GetLength(1), Pressed_Block_Location % Grid_Views.GetLength(1)].GetY() + (int)(Block_Size / 2) < Press_Location.GetY() - Grid_Layout.GetY() && Grid_Views[Pressed_Block_Location / Grid_Views.GetLength(1), Pressed_Block_Location % Grid_Views.GetLength(1)].GetY() + (int)(Block_Size / 2) + Grid_Views[Pressed_Block_Location / Grid_Views.GetLength(1), Pressed_Block_Location % Grid_Views.GetLength(1)].Height > Press_Location.GetY() - Grid_Layout.GetY() && Grid_Views[Pressed_Block_Location / Grid_Views.GetLength(1), Pressed_Block_Location % Grid_Views.GetLength(1)].GetX() < (Press_Location.GetX() + (Grid_Layout.Width - Screen_Width)) + (Grid_Layout.Right - (Grid_Layout.GetX() + Grid_Layout.Width)) && Grid_Views[Pressed_Block_Location / Grid_Views.GetLength(1), Pressed_Block_Location % Grid_Views.GetLength(1)].GetX() + Grid_Views[Pressed_Block_Location / Grid_Views.GetLength(1), Pressed_Block_Location % Grid_Views.GetLength(1)].Width > (Press_Location.GetX() + (Grid_Layout.Width - Screen_Width)) + (Grid_Layout.Right - (Grid_Layout.GetX() + Grid_Layout.Width)))
            {
                Flag_Created = true;

                // Creating A Flag On That Location.
                if (Minesweeper.Change_Flag_State((Pressed_Block_Location / Grid_Views.GetLength(1)) + 1, (Pressed_Block_Location % Grid_Views.GetLength(1)) + 1))
                {
                    // Vibrating The Phone When Creating A Flag.
                    Vibrator Vibrator = (Vibrator)Application.Context.GetSystemService(VibratorService);
                    Vibrator.Vibrate(100);
                }
            }

            Timer_Detect_LongPress.Stop();

            throw new NotImplementedException();
        }
Exemplo n.º 26
0
        public void ReceiveDetections(Detections detections)
        {
            if (this.ViewModel.State == RegisterDeviceViewModel.RegistrationState.New)
            {
                SparseArray qrcodes = detections.DetectedItems;
                if (qrcodes.Size() != 0)
                {
                    try
                    {
                        Vibrator vibrator = (Vibrator)GetSystemService(Context.VibratorService);
                        vibrator.Vibrate(VibrationEffect.CreateOneShot(1000, 1));
                    }
                    catch { }
                    var value = ((Barcode)qrcodes.ValueAt(0)).RawValue;

                    string networkSSID = value;

                    if (!string.IsNullOrEmpty(networkSSID))
                    {
                        Task.Run(async() => await this.ViewModel.ProvisionDevice(new Common.WiFi.WifiNetwork()
                        {
                            SSID = networkSSID
                        }));
                    }
                }
            }
        }
Exemplo n.º 27
0
 public void OnPlayerChangedColor(PlayerChangedColorSignal signal)
 {
     if (signal.oldColor != GameColor.NONE)
     {
         Vibrator.Vibrate(50);
     }
 }
Exemplo n.º 28
0
 private void notificationSound(string AlertTone)
 {
     try
     {
         Vibrator vibrator = (Vibrator)Android.App.Application.Context.GetSystemService(Context.VibratorService);
         if (vibrator.HasVibrator)
         {
             vibrator.Vibrate(500);
         }
         if (AlertTone == Notification)
         {
             player = MediaPlayer.Create(Android.App.Application.Context,
                                         RingtoneManager.GetDefaultUri(RingtoneType.Notification));
         }
         else if (AlertTone == Alarm)
         {
             player = MediaPlayer.Create(Android.App.Application.Context,
                                         RingtoneManager.GetDefaultUri(RingtoneType.Alarm));
         }
         else
         {
             player = MediaPlayer.Create(Android.App.Application.Context,
                                         RingtoneManager.GetDefaultUri(RingtoneType.Ringtone));
         }
         player.Start();
     }
     catch (System.Exception e)
     {
         ExceptioHandler(e.Message, "notificationSound");
     }
 }
Exemplo n.º 29
0
 public void MensajeEnviado(TLAbsUpdates updates, string fromPhone, string mensaje)
 {
     record = false;
     if (updates != null)
     {
         try
         {
             Chat m = new Chat
             {
                 FromTo  = fromPhone,
                 Mensaje = mensaje,
                 Send    = true,
                 Created = DateTime.Now,
                 Seen    = true
             };
             messageRepository.InsertChat(m);
             Vibrator vibrator = (Vibrator)this.GetSystemService(Context.VibratorService);
             vibrator.Vibrate(1000);
             textToSpeak = "Mensaje enviado";
             toSpeech    = new TextToSpeech(this, this);
         }
         catch (Exception ex)
         {
             textToSpeak = "Ha ocurrido un error al acceder a la base de datos. Por favor, inténtelo más tarde.";
             toSpeech    = new TextToSpeech(this, this);
         }
     }
     else
     {
         textToSpeak = "No se ha podido enviar el mensaje. Inténtelo más tarde";
         toSpeech    = new TextToSpeech(this, this);
     }
 }
Exemplo n.º 30
0
        public override void OnCardboardTrigger()
        {
            Log.Info(Tag, "onCardboardTrigger");

            // Always give user feedback
            vibrator.Vibrate(50);
        }