From: Akash Kumar Date: Tue, 19 Sep 2023 07:05:27 +0000 (+0530) Subject: Update Scan button place and style X-Git-Tag: accepted/tizen/unified/20230925.091521~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F77%2F299077%2F1;p=profile%2Fiot%2Fapps%2Fdotnet%2Fsetting-bluetooth.git Update Scan button place and style This patch: - Resolves https://code.sec.samsung.net/jira/browse/TEIGHT-5169 Change-Id: I084d17c2eb897b92dcfb2dde637f8f6fbc78a2f2 Signed-off-by: Akash Kumar --- diff --git a/SettingBluetooth/SettingBluetooth/SettingBluetooth.cs b/SettingBluetooth/SettingBluetooth/SettingBluetooth.cs index 54cca7f..af9a729 100644 --- a/SettingBluetooth/SettingBluetooth/SettingBluetooth.cs +++ b/SettingBluetooth/SettingBluetooth/SettingBluetooth.cs @@ -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() + { + Normal = 1.0f, + Disabled = 0.0f + }; + + return viewStyle; + } + + public override IEnumerable 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"); diff --git a/SettingBluetooth/SettingBluetooth/View/BtDeviceView.cs b/SettingBluetooth/SettingBluetooth/View/BtDeviceView.cs index 490f8d7..b6e218b 100644 --- a/SettingBluetooth/SettingBluetooth/View/BtDeviceView.cs +++ b/SettingBluetooth/SettingBluetooth/View/BtDeviceView.cs @@ -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 GetDefaultColorSelector() diff --git a/SettingBluetooth/SettingBluetooth/View/BtMainView.cs b/SettingBluetooth/SettingBluetooth/View/BtMainView.cs index 37ba038..930fe23 100644 --- a/SettingBluetooth/SettingBluetooth/View/BtMainView.cs +++ b/SettingBluetooth/SettingBluetooth/View/BtMainView.cs @@ -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; diff --git a/packaging/org.tizen.cssetting-bluetooth-1.0.0.rpk b/packaging/org.tizen.cssetting-bluetooth-1.0.0.rpk index 1cba4bf..ccef307 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