From: Wootak Jung Date: Tue, 26 Sep 2023 06:41:52 +0000 (+0900) Subject: Enable BT turning on/off message X-Git-Tag: accepted/tizen/unified/20231004.100210^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F33%2F299333%2F1;p=profile%2Fiot%2Fapps%2Fdotnet%2Fsetting-bluetooth.git Enable BT turning on/off message - Move BtMessageView to MainView Change-Id: I8ba98a603cb760b8c8167b1f8f140b7d1d50799b Signed-off-by: Wootak Jung --- diff --git a/SettingBluetooth/SettingBluetooth/View/BtDeviceView.cs b/SettingBluetooth/SettingBluetooth/View/BtDeviceView.cs index 53aa6c3..ec26144 100644 --- a/SettingBluetooth/SettingBluetooth/View/BtDeviceView.cs +++ b/SettingBluetooth/SettingBluetooth/View/BtDeviceView.cs @@ -321,7 +321,6 @@ namespace SettingBluetooth { static CollectionView mDeviceView = null; static DeviceSource mDeviceSource = null; - static TextLabel mBtOffMessage = null; private static CollectionView CreateCollectionView(DeviceSource source, bool isPairedDeviceView = false) { @@ -388,49 +387,13 @@ namespace SettingBluetooth { Log.Info(SettingBluetooth.LogTag, "Add device view"); - ShowBtOnMessage(); + BtMainView.ShowBtOnMessage(); mDeviceSource = new DeviceSource(); mDeviceView = CreateCollectionView(mDeviceSource); view.Add(mDeviceView); BtModel.GetBondedDevices(); } - public static void CreateBtMessageView(View view) - { - View messageView = new View() - { - Layout = new LinearLayout() - { - HorizontalAlignment = HorizontalAlignment.Begin, - }, - WidthSpecification = LayoutParamPolicies.MatchParent, - HeightSpecification = LayoutParamPolicies.WrapContent, - }; - - mBtOffMessage = new TextLabel() - { - AccessibilityHidden = true, - ThemeChangeSensitive = true, - TextColor = Color.Grey, - PixelSize = 22.SpToPx(), - HorizontalAlignment = HorizontalAlignment.Begin, - Margin = new Extents(16, 0, 0, 0).SpToPx(), - }; - - messageView.Add(mBtOffMessage); - view.Add(messageView); - } - - internal static void ShowBtOffMessage() - { - mBtOffMessage.Text = Resources.IDS_BT_BODY_TURN_ON_BLUETOOTH_TO_SEE_A_LIST_OF_DEVICES_YOU_CAN_PAIR_WITH_OR_HAVE_ALREADY_PAIRED_WITH; - } - - internal static void ShowBtOnMessage() - { - mBtOffMessage.Text = string.Format(Resources.IDS_BT_BODY_YOUR_DEVICE_IS_CURRENTLY_VISIBLE_TO_NEARBY_DEVICES, BtModel.Name); - } - internal static void RemoveDeviceView(View view) { Log.Info(SettingBluetooth.LogTag, "Remove device view"); @@ -441,7 +404,7 @@ namespace SettingBluetooth mDeviceView = null; } - ShowBtOffMessage(); + BtMainView.ShowBtOffMessage(); } internal static void RemoveAllSearchedDevices() diff --git a/SettingBluetooth/SettingBluetooth/View/BtMainView.cs b/SettingBluetooth/SettingBluetooth/View/BtMainView.cs index 6f0ce55..8823b1e 100644 --- a/SettingBluetooth/SettingBluetooth/View/BtMainView.cs +++ b/SettingBluetooth/SettingBluetooth/View/BtMainView.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using Tizen; @@ -12,6 +12,53 @@ namespace SettingBluetooth class BtMainView { static View mMainView; + static TextLabel mBtMessage = null; + + public static void CreateBtMessageView(View view) + { + View messageView = new View() + { + Layout = new LinearLayout() + { + HorizontalAlignment = HorizontalAlignment.Begin, + }, + WidthSpecification = LayoutParamPolicies.MatchParent, + HeightSpecification = LayoutParamPolicies.WrapContent, + }; + + mBtMessage = new TextLabel() + { + AccessibilityHidden = true, + ThemeChangeSensitive = true, + TextColor = Color.Grey, + PixelSize = 22.SpToPx(), + HorizontalAlignment = HorizontalAlignment.Begin, + Margin = new Extents(16, 0, 0, 0).SpToPx(), + }; + + messageView.Add(mBtMessage); + view.Add(messageView); + } + + internal static void ShowBtOffMessage() + { + mBtMessage.Text = Resources.IDS_BT_BODY_TURN_ON_BLUETOOTH_TO_SEE_A_LIST_OF_DEVICES_YOU_CAN_PAIR_WITH_OR_HAVE_ALREADY_PAIRED_WITH; + } + + internal static void ShowBtOnMessage() + { + mBtMessage.Text = string.Format(Resources.IDS_BT_BODY_YOUR_DEVICE_IS_CURRENTLY_VISIBLE_TO_NEARBY_DEVICES, BtModel.Name); + } + + internal static void ShowBtTurningOnMessage() + { + mBtMessage.Text = Resources.IDS_ST_BODY_TURNING_ON_BLUETOOTH; + } + + internal static void ShowBtTurningOffMessage() + { + mBtMessage.Text = Resources.IDS_ST_BODY_TURNING_OFF_BLUETOOTH; + } private static void BtModelOperationStateChanged(object obj, BtOperationStateChangedEventArgs ev) { @@ -23,7 +70,7 @@ namespace SettingBluetooth SettingBluetooth.mScanButton.IsEnabled = false; break; case BtOperationState.Deactivating: - BtDeviceView.UpdateSearchedTitle(Resources.IDS_ST_BODY_TURNING_OFF_BLUETOOTH); + ShowBtTurningOffMessage(); break; case BtOperationState.Activated: BtDeviceView.AddDeviceView(mMainView); @@ -31,7 +78,7 @@ namespace SettingBluetooth SettingBluetooth.mScanButton.IsEnabled = true; break; case BtOperationState.Activating: - BtDeviceView.UpdateSearchedTitle(Resources.IDS_ST_BODY_TURNING_ON_BLUETOOTH); + ShowBtTurningOnMessage(); break; case BtOperationState.Searching: BtDeviceView.RemoveAllSearchedDevices(); @@ -81,7 +128,7 @@ namespace SettingBluetooth onOffSwitch.SelectedChanged += AdapterController.OnOffSwitchSelectedChanged; onOffItem.Extra = onOffSwitch; mMainView.Add(onOffItem); - BtDeviceView.CreateBtMessageView(mMainView); + CreateBtMessageView(mMainView); BtModel.OperationStateChanged += BtModelOperationStateChanged; BtModel.DeviceChanged += BtDeviceView.BtModelDeviceChanged; @@ -96,7 +143,7 @@ namespace SettingBluetooth } else { - BtDeviceView.ShowBtOffMessage(); + ShowBtOffMessage(); } return mMainView; diff --git a/packaging/org.tizen.cssetting-bluetooth-1.0.0.rpk b/packaging/org.tizen.cssetting-bluetooth-1.0.0.rpk index be7265f..f3a8a87 100644 Binary files a/packaging/org.tizen.cssetting-bluetooth-1.0.0.rpk and b/packaging/org.tizen.cssetting-bluetooth-1.0.0.rpk differ