From: Wootak Jung Date: Fri, 7 Oct 2022 07:37:05 +0000 (+0900) Subject: Add audio disconnection alert popup X-Git-Tag: accepted/tizen/unified/20221111.105330~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ffe2654b7cb7af242d9791e4aa0d83ff9b901c72;p=profile%2Fiot%2Fapps%2Fdotnet%2Fsetting-bluetooth.git Add audio disconnection alert popup Change-Id: Ie370273612a4bfb335133a137578dfa2d01e948d Signed-off-by: Wootak Jung --- diff --git a/SettingBluetooth/SettingBluetooth/Controller/DeviceController.cs b/SettingBluetooth/SettingBluetooth/Controller/DeviceController.cs index 0b06336..76b995e 100644 --- a/SettingBluetooth/SettingBluetooth/Controller/DeviceController.cs +++ b/SettingBluetooth/SettingBluetooth/Controller/DeviceController.cs @@ -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 { diff --git a/SettingBluetooth/SettingBluetooth/Model/BtDevice.cs b/SettingBluetooth/SettingBluetooth/Model/BtDevice.cs index 57295df..b498ec1 100644 --- a/SettingBluetooth/SettingBluetooth/Model/BtDevice.cs +++ b/SettingBluetooth/SettingBluetooth/Model/BtDevice.cs @@ -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); } diff --git a/SettingBluetooth/SettingBluetooth/View/BtDeviceView.cs b/SettingBluetooth/SettingBluetooth/View/BtDeviceView.cs index 62078af..099ab3b 100644 --- a/SettingBluetooth/SettingBluetooth/View/BtDeviceView.cs +++ b/SettingBluetooth/SettingBluetooth/View/BtDeviceView.cs @@ -65,7 +65,6 @@ namespace SettingBluetooth } set { - Log.Info(Program.LogTag, "state changed: State: " + value); mState = value; OnPropertyChanged("State"); } diff --git a/SettingBluetooth/SettingBluetooth/View/BtMainView.cs b/SettingBluetooth/SettingBluetooth/View/BtMainView.cs index c42fc33..bb548da 100644 --- a/SettingBluetooth/SettingBluetooth/View/BtMainView.cs +++ b/SettingBluetooth/SettingBluetooth/View/BtMainView.cs @@ -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) diff --git a/packaging/org.tizen.cssetting-bluetooth-1.0.0.tpk b/packaging/org.tizen.cssetting-bluetooth-1.0.0.tpk index df5050a..230ace3 100644 Binary files a/packaging/org.tizen.cssetting-bluetooth-1.0.0.tpk and b/packaging/org.tizen.cssetting-bluetooth-1.0.0.tpk differ