// calling from the UI Button
        public void ToggleWidgetButton()
        {
            if (!AndroidPermissionsManager.CheckBluetoothPermissions())
            {
                AndroidPermissionsManager.RequestPermission();

                return;
            }

            if (!animator.GetCurrentAnimatorStateInfo(0).IsName("Idle") || alwaysActive)
            {
                return;
            }

            widgetActive = !widgetActive;

            if (widgetActive)
            {
                BhapticsAndroidManager.ForceUpdateDeviceList();
                foreach (var controlButton in controllButtons)
                {
                    controlButton.Refresh();
                }


                animator.Play("ShowWidget");

                ShowWidget();
            }
            else
            {
                animator.Play("HideWidget");
                HideWidget();
            }
        }
Beispiel #2
0
        public void ToggleWidgetButton()
        {
            if (!animator.GetCurrentAnimatorStateInfo(0).IsName("Idle"))
            {
                return;
            }

            if (!widgetActive)
            {
                if (AndroidPermissionsManager.CheckBluetoothPermissions())
                {
                    animator.Play("ShowWidget");
                }
                else
                {
                    AndroidPermissionsManager.RequestPermission();
                    return;
                }
                DeviceManager.Instance.ForceUpdateDeviceList();
                DeviceManager.Instance.Scan();
            }
            else
            {
                animator.Play("HideWidget");
                DeviceManager.Instance.ScanStop();
            }

            widgetActive = !widgetActive;
        }
        private void OnEnable()
        {
            if (alwaysActive)
            {
                if (!AndroidPermissionsManager.CheckBluetoothPermissions())
                {
                    AndroidPermissionsManager.RequestPermission();
                }

                scanCoroutine = StartCoroutine(LoopScan());
            }
            else
            {
                if (animator != null)
                {
                    animator.Play("HideWidget", -1, 1);
                }
            }

            if (BhapticsAndroidManager.Instance != null)
            {
                BhapticsAndroidManager.Instance.RefreshUIAddListener(Refresh);
            }
        }