Enable BT turning on/off message 39/299639/1
authorWootak Jung <wootak.jung@samsung.com>
Tue, 26 Sep 2023 06:41:52 +0000 (15:41 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Fri, 6 Oct 2023 01:18:24 +0000 (10:18 +0900)
- Move BtMessageView to MainView

Change-Id: I8ba98a603cb760b8c8167b1f8f140b7d1d50799b
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
SettingBluetooth/SettingBluetooth/View/BtDeviceView.cs
SettingBluetooth/SettingBluetooth/View/BtMainView.cs
packaging/org.tizen.cssetting-bluetooth-1.0.0.rpk

index 53aa6c3aad5a5a066e6ea2436fd29ae26fa976cb..ec26144b2b94266e898698c2e2c2c7790eaf9554 100644 (file)
@@ -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()
index 6f0ce556e5a481c0d1eb8ff3dc45f421596dcdc2..8823b1e5cae1a96881b5e219a6b190e15f0f613b 100644 (file)
@@ -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;
index be7265fde8c3c2fc127cf0b1201c13f5e3b73392..f3a8a87fe82a39e7aef757fd97111b2787f15785 100644 (file)
Binary files a/packaging/org.tizen.cssetting-bluetooth-1.0.0.rpk and b/packaging/org.tizen.cssetting-bluetooth-1.0.0.rpk differ