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
{
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");
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");
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)
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)
view.Remove(mDeviceView);
mDeviceView = null;
}
-
- if (mScanButton)
- {
- view.Remove(mScanButton);
- mScanButton = null;
- }
}
internal static void RemoveAllSearchedDevices()
internal static void UpdateScanButtonText(string text)
{
- mScanButton.Text = text;
+ SettingBluetooth.mScanButton.Text = text;
}
internal static Selector<Color> GetDefaultColorSelector()
{
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;