Add audio disconnection alert popup 40/282640/1
authorWootak Jung <wootak.jung@samsung.com>
Fri, 7 Oct 2022 07:37:05 +0000 (16:37 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Fri, 7 Oct 2022 07:37:05 +0000 (16:37 +0900)
Change-Id: Ie370273612a4bfb335133a137578dfa2d01e948d
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
SettingBluetooth/SettingBluetooth/Controller/DeviceController.cs
SettingBluetooth/SettingBluetooth/Model/BtDevice.cs
SettingBluetooth/SettingBluetooth/View/BtDeviceView.cs
SettingBluetooth/SettingBluetooth/View/BtMainView.cs
packaging/org.tizen.cssetting-bluetooth-1.0.0.tpk

index 0b0633669e80f2325026e6c1a15d915a79f23029..76b995e064e58e1ed2f3c1a4bd4a9a16ca1bfce2 100644 (file)
@@ -23,13 +23,38 @@ namespace SettingBluetooth.Controller
             device.DisconnectAudio();
         }
 
+        private static void PopAlertDialog()
+        {
+            Navigator navigator = NUIApplication.GetDefaultWindow().GetDefaultNavigator();
+            navigator?.Pop();
+        }
+
         private static void DoPairUnpair(Device device)
         {
             if (device.BtItem.IsPaired)
             {
                 if (device.BtItem.IsA2dpConnected)
                 {
-                    device.BtItem.DisconnectAudio();
+                    var cancelButton = new Button()
+                    {
+                        Text = Resources.IDS_BR_SK_CANCEL,
+                    };
+                    cancelButton.Clicked += (obj, ev) =>
+                    {
+                        Log.Info(Program.LogTag, "Disconnect canceled");
+                        PopAlertDialog();
+                    };
+
+                    var disconnectButton = new Button()
+                    {
+                        Text = Resources.IDS_BT_SK_DISCONNECT,
+                    };
+                    disconnectButton.Clicked += (obj, ev) =>
+                    {
+                        device.BtItem.DisconnectAudio();
+                        PopAlertDialog();
+                    };
+                    DialogPage.ShowAlertDialog(Resources.IDS_BT_HEADER_DISCONNECT_DEVICE_ABB, String.Format(Resources.IDS_WMGR_POP_THIS_WILL_END_YOUR_CONNECTION_WITH_PS, device.Name), cancelButton, disconnectButton);
                 }
                 else
                 {
index 57295df0190b3004da236e780cafe2f40a93b847..b498ec18fa16eebbe901a3a24d8c432acf11637f 100644 (file)
@@ -214,7 +214,7 @@ namespace SettingBluetooth.Model
             }
             else
             {
-                Log.Error(Program.LogTag, mDeviceState == BtDeviceState.Connecting ? "Connect" : "Disconnect" + "failed. result: " + ev.Result);
+                Log.Error(Program.LogTag, (mDeviceState == BtDeviceState.Connecting ? "Connect" : "Disconnect") + "failed. result: " + ev.Result);
                 mDeviceState = BtDeviceState.Idle;
                 BtModel.NotifyDeviceChanged(this);
             }
index 62078afa72ccf9f6ee8c288c6174e21562789d79..099ab3be074d071d36cbf50963d01750fa5add33 100644 (file)
@@ -65,7 +65,6 @@ namespace SettingBluetooth
             }
             set
             {
-                Log.Info(Program.LogTag, "state changed: State: " + value);
                 mState = value;
                 OnPropertyChanged("State");
             }
index c42fc33a741baa4810abdac6f4dbcf5fe1a9f7a8..bb548da2832ea73dbc93674e4aef1956650d9085 100644 (file)
@@ -256,13 +256,15 @@ namespace SettingBluetooth
                     if (mPairedDevice.FindDevice(ev.BtDevice) == null)
                     {
                         mPairedDevice.AddDevice(ev.BtDevice);
+                        if (ev.BtDevice.IsA2dpSupported)
+                        {
+                            DeviceController.ConnectA2dp(ev.BtDevice);
+                        }
                     }
-
-                    if (ev.BtDevice.IsA2dpSupported)
+                    else // audio disconnected case
                     {
-                        DeviceController.ConnectA2dp(ev.BtDevice);
+                        mPairedDevice.UpdateState(ev.BtDevice, "");
                     }
-
                     break;
                 case BtDeviceState.Unpaired:
                     if (mSearchedDevice.FindDevice(ev.BtDevice) == null)
index df5050a26f83cd893de5ad6b5d283cad9460cea3..230ace3925b4566c68deef5666e45858df195ca6 100644 (file)
Binary files a/packaging/org.tizen.cssetting-bluetooth-1.0.0.tpk and b/packaging/org.tizen.cssetting-bluetooth-1.0.0.tpk differ