{
static CollectionView mDeviceView = null;
static DeviceSource mDeviceSource = null;
- static TextLabel mBtOffMessage = null;
private static CollectionView CreateCollectionView(DeviceSource source, bool isPairedDeviceView = false)
{
{
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");
mDeviceView = null;
}
- ShowBtOffMessage();
+ BtMainView.ShowBtOffMessage();
}
internal static void RemoveAllSearchedDevices()
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using Tizen;
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)
{
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);
SettingBluetooth.mScanButton.IsEnabled = true;
break;
case BtOperationState.Activating:
- BtDeviceView.UpdateSearchedTitle(Resources.IDS_ST_BODY_TURNING_ON_BLUETOOTH);
+ ShowBtTurningOnMessage();
break;
case BtOperationState.Searching:
BtDeviceView.RemoveAllSearchedDevices();
onOffSwitch.SelectedChanged += AdapterController.OnOffSwitchSelectedChanged;
onOffItem.Extra = onOffSwitch;
mMainView.Add(onOffItem);
- BtDeviceView.CreateBtMessageView(mMainView);
+ CreateBtMessageView(mMainView);
BtModel.OperationStateChanged += BtModelOperationStateChanged;
BtModel.DeviceChanged += BtDeviceView.BtModelDeviceChanged;
}
else
{
- BtDeviceView.ShowBtOffMessage();
+ ShowBtOffMessage();
}
return mMainView;