Update Scan button place and style 77/299077/1
authorAkash Kumar <akash1.kumar@samsung.com>
Tue, 19 Sep 2023 07:05:27 +0000 (12:35 +0530)
committerAkash Kumar <akash1.kumar@samsung.com>
Tue, 19 Sep 2023 07:05:27 +0000 (12:35 +0530)
This patch:
- Resolves https://code.sec.samsung.net/jira/browse/TEIGHT-5169

Change-Id: I084d17c2eb897b92dcfb2dde637f8f6fbc78a2f2
Signed-off-by: Akash Kumar <akash1.kumar@samsung.com>
SettingBluetooth/SettingBluetooth/SettingBluetooth.cs
SettingBluetooth/SettingBluetooth/View/BtDeviceView.cs
SettingBluetooth/SettingBluetooth/View/BtMainView.cs
packaging/org.tizen.cssetting-bluetooth-1.0.0.rpk

index 54cca7f392f92e4970d53e7a4116889c6583a3e0..af9a729d10cc3993bf791954c924116619ae7f26 100644 (file)
@@ -1,9 +1,11 @@
 using SettingCore;
 using System;
+using System.Collections.Generic;
 using Tizen;
 using Tizen.Applications;
 using Tizen.NUI;
 using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
 
 namespace SettingBluetooth
 {
@@ -23,6 +25,7 @@ namespace SettingBluetooth
     public class SettingBluetooth : SettingCore.MainMenuGadget
     {
         public static readonly string LogTag = "SettingBluetooth";
+        public static Button mScanButton;
 
         public override Color ProvideIconColor() => new Color(ThemeManager.PlatformThemeId == "org.tizen.default-light-theme" ? "#FF6200" : "#FF8A00");
 
@@ -42,6 +45,33 @@ namespace SettingBluetooth
             return BtMainView.Create();
         }
 
+        private ViewStyle GetButtonViewStyle()
+        {
+            ViewStyle viewStyle = new ViewStyle();
+            viewStyle.Opacity = new Selector<float?>()
+            {
+                Normal = 1.0f,
+                Disabled = 0.0f
+            };
+
+            return viewStyle;
+        }
+
+        public override IEnumerable<View> ProvideMoreActions()
+        {
+            ViewStyle viewStyle = GetButtonViewStyle();
+
+            mScanButton = new Button()
+            {
+                Text = Resources.IDS_BT_SK_SCAN,
+                IsEnabled = BtModel.IsEnabled,
+            };
+            mScanButton.Clicked += AdapterController.ScanButtonClicked;
+            mScanButton.ApplyStyle(viewStyle);
+
+            return new View[] { mScanButton };
+        }
+
         protected override void OnAppControlReceived(AppControlReceivedEventArgs e)
         {
             Log.Info(LogTag, "OnAppControlReceived");
index 490f8d7effed570b62a7d6c7e83fc3f3109b4f1d..b6e218bd9fbaa1cb8132a52f2b184fd1361a2b80 100644 (file)
@@ -319,7 +319,6 @@ namespace SettingBluetooth
     internal static class BtDeviceView
     {
         static CollectionView mDeviceView = null;
-        static Button mScanButton = null;
         static DeviceSource mDeviceSource = null;
 
         private static CollectionView CreateCollectionView(DeviceSource source, bool isPairedDeviceView = false)
@@ -391,13 +390,6 @@ namespace SettingBluetooth
             mDeviceView = CreateCollectionView(mDeviceSource);
             view.Add(mDeviceView);
             BtModel.GetBondedDevices();
-
-            mScanButton = new Button
-            {
-                Text = Resources.IDS_BT_SK_SCAN,
-            };
-            mScanButton.Clicked += AdapterController.ScanButtonClicked;
-            view.Add(mScanButton);
         }
 
         internal static void RemoveDeviceView(View view)
@@ -409,12 +401,6 @@ namespace SettingBluetooth
                 view.Remove(mDeviceView);
                 mDeviceView = null;
             }
-
-            if (mScanButton)
-            {
-                view.Remove(mScanButton);
-                mScanButton = null;
-            }
         }
 
         internal static void RemoveAllSearchedDevices()
@@ -430,7 +416,7 @@ namespace SettingBluetooth
 
         internal static void UpdateScanButtonText(string text)
         {
-            mScanButton.Text = text;
+            SettingBluetooth.mScanButton.Text = text;
         }
 
         internal static Selector<Color> GetDefaultColorSelector()
index 37ba038f5310e388e70b353a6139dd285ac68bb4..930fe239feb37d6a6ce13f810f3631a66543672e 100644 (file)
@@ -20,12 +20,14 @@ namespace SettingBluetooth
             {
                 case BtOperationState.Deactivated:
                     BtDeviceView.RemoveDeviceView(mMainView);
+                    SettingBluetooth.mScanButton.IsEnabled = false;
                     break;
                 case BtOperationState.Deactivating:
                     break;
                 case BtOperationState.Activated:
                     BtDeviceView.AddDeviceView(mMainView);
                     AdapterController.AutoStart();
+                    SettingBluetooth.mScanButton.IsEnabled = true;
                     break;
                 case BtOperationState.Activating:
                     break;
index 1cba4bfd3eeeb8770fb664a72059bc9c26ae3419..ccef307be5354726ba2895fc4e9da9fc43c29a38 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