-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommandActivity.cs
59 lines (49 loc) · 1.6 KB
/
CommandActivity.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using Android;
using Android.Content;
using Android.Content.PM;
using AndroidX.Core.App;
using AndroidX.Core.Content;
using AndroidX.Wear.Widget;
using Nauti_Control_Wear.Adapters;
using Nauti_Control_Wear.ViewModels;
namespace Nauti_Control_Wear
{
[Activity(Label = "@string/command_activity")]
public class CommandActivity : Activity
{
/// <summary>
/// VM
/// </summary>
CommandActivityVM? _vm;
/// <summary>
/// Main Menu Adapter
/// </summary>
CommandAdapter? _mainMenuAdapter;
/// <summary>
/// On Create
/// </summary>
/// <param name="savedInstanceState">Saved Instance</param>
protected override void OnCreate(Bundle? savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.command_menu);
SetupVM();
}
/// <summary>
/// Setup ViewModel
/// </summary>
private void SetupVM()
{
_vm = new CommandActivityVM();
WearableRecyclerView? recyclerView = FindViewById<WearableRecyclerView>(Resource.Id.command_menu);
if (recyclerView != null)
{
recyclerView.EdgeItemsCenteringEnabled = true;
_mainMenuAdapter = new CommandAdapter(_vm.CommandMenuVM);
_mainMenuAdapter.ItemClick += _vm.CommandMenuVM.OnItemClick;
recyclerView.SetAdapter(_mainMenuAdapter);
recyclerView.SetLayoutManager(new WearableLinearLayoutManager(this));
}
}
}
}