-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMainActivity.cs
More file actions
90 lines (81 loc) · 2.88 KB
/
MainActivity.cs
File metadata and controls
90 lines (81 loc) · 2.88 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
using Android.App;
using Android.OS;
using Android.Support.V7.App;
using ChoreChomper.Controller;
using ChoreChomper.Data;
namespace ChoreChomper
{
[Activity(Label = "@string/app_name", Theme = "@style/AppTheme", MainLauncher = true)]
public class MainActivity : AppCompatActivity
{
Controller.Controller controller;
SessionData currentSession = new SessionData();
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
// For future reference, remeber to set the content view before assigning the controller
SetContentView(Resource.Layout.loginLayout);
controller = new LoginController(this);
}
public SessionData GetSessionData() { return currentSession; }
public bool ChangeTo(int layout)
{
bool valid = true;
if (layout == Resource.Layout.newUserLayout)
{
SetContentView(layout);
controller = new NewUserController(this);
}
else if (layout == Resource.Layout.loginLayout)
{
SetContentView(layout);
controller = new LoginController(this);
}
else if (layout == Resource.Layout.mainMenuLayout)
{
SetContentView(layout);
controller = new MenuController(this);
}
else if (layout == Resource.Layout.choreListLayout)
{
SetContentView(layout);
controller = new ChoreListController(this);
}
else if (layout == Resource.Layout.choreListSettingsLayout)
{
SetContentView(layout);
controller = new ChoreListSettingsController(this);
}
else if (layout == Resource.Layout.choreCreateLayout)
{
SetContentView(layout);
controller = new ChoreCreationController(this);
}
else if (layout == Resource.Layout.choreEditLayout)
{
SetContentView(layout);
controller = new ChoreEditController(this);
}
else if (layout == Resource.Layout.groupListLayout)
{
SetContentView(layout);
controller = new GroupListController(this);
}
else if (layout == Resource.Layout.groupCreateLayout)
{
SetContentView(layout);
controller = new GroupCreateController(this);
}
else if (layout == Resource.Layout.joinGroupLayout)
{
SetContentView(layout);
controller = new JoinGroupController(this);
}
else
{
valid = false;
}
return valid;
}
}
}