Commit a235e5958585b2a6bce0a7f36bb785549bb0c05a

Authored by kristinlaahneolsen
2 parents 99269ba4 bae19628

Merge branch 'usability_improvements'

Risiko/app/src/main/AndroidManifest.xml
@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 android:label="@string/app_name" 10 android:label="@string/app_name"
11 android:roundIcon="@mipmap/ic_launcher_round" 11 android:roundIcon="@mipmap/ic_launcher_round"
12 android:supportsRtl="true" 12 android:supportsRtl="true"
13 - android:theme="@style/risikoTheme"> 13 + android:theme="@style/AppTheme">
14 <activity android:name="activity.MainPage"> 14 <activity android:name="activity.MainPage">
15 <intent-filter> 15 <intent-filter>
16 <action android:name="android.intent.action.MAIN" /> 16 <action android:name="android.intent.action.MAIN" />
Risiko/app/src/main/java/activity/Activities.java
@@ -3,8 +3,13 @@ package activity; @@ -3,8 +3,13 @@ package activity;
3 import android.content.Intent; 3 import android.content.Intent;
4 import android.support.v7.app.AppCompatActivity; 4 import android.support.v7.app.AppCompatActivity;
5 import android.os.Bundle; 5 import android.os.Bundle;
  6 +import android.support.v7.widget.Toolbar;
6 import android.util.Log; 7 import android.util.Log;
  8 +import android.view.Menu;
  9 +import android.view.MenuItem;
7 import android.widget.ListView; 10 import android.widget.ListView;
  11 +import android.widget.Toast;
  12 +
8 import com.risiko.risiko.R; 13 import com.risiko.risiko.R;
9 14
10 import java.util.ArrayList; 15 import java.util.ArrayList;
@@ -23,6 +28,8 @@ public class Activities extends AppCompatActivity { @@ -23,6 +28,8 @@ public class Activities extends AppCompatActivity {
23 protected void onCreate(Bundle savedInstanceState) { 28 protected void onCreate(Bundle savedInstanceState) {
24 super.onCreate(savedInstanceState); 29 super.onCreate(savedInstanceState);
25 setContentView(R.layout.activity_activities); 30 setContentView(R.layout.activity_activities);
  31 + Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
  32 + setSupportActionBar(myToolbar);
26 33
27 34
28 /* //TODO Bytte ut Mockdata på sikt 35 /* //TODO Bytte ut Mockdata på sikt
@@ -72,4 +79,31 @@ public class Activities extends AppCompatActivity { @@ -72,4 +79,31 @@ public class Activities extends AppCompatActivity {
72 intent.putExtra("ID_OF_CHOSEN_ACTIVITY", activityId); 79 intent.putExtra("ID_OF_CHOSEN_ACTIVITY", activityId);
73 startActivity(intent); 80 startActivity(intent);
74 } 81 }
  82 +
  83 + @Override
  84 + public boolean onCreateOptionsMenu (Menu menu) {
  85 + getMenuInflater().inflate(R.menu.main, menu);
  86 + return true;
  87 + }
  88 +
  89 + @Override
  90 + public boolean onOptionsItemSelected(MenuItem item) {
  91 + switch (item.getItemId()) {
  92 + case R.id.action_logout:
  93 + //TODO: LEGG TIL LOGG-UT-FUNKSJON
  94 + Toast.makeText(Activities.this, "Logger ut",
  95 + Toast.LENGTH_LONG).show();
  96 + return true;
  97 +
  98 + case R.id.action_home:
  99 + Intent intent = new Intent(this, MainMenu.class);
  100 + startActivity(intent);
  101 + return true;
  102 +
  103 + default:
  104 + return super.onOptionsItemSelected(item);
  105 +
  106 + }
  107 + }
  108 +
75 } 109 }
Risiko/app/src/main/java/activity/EditIncident.java
@@ -3,7 +3,10 @@ package activity; @@ -3,7 +3,10 @@ package activity;
3 import android.content.Intent; 3 import android.content.Intent;
4 import android.os.Bundle; 4 import android.os.Bundle;
5 import android.support.v7.app.AppCompatActivity; 5 import android.support.v7.app.AppCompatActivity;
  6 +import android.support.v7.widget.Toolbar;
6 import android.util.Log; 7 import android.util.Log;
  8 +import android.view.Menu;
  9 +import android.view.MenuItem;
7 import android.widget.ArrayAdapter; 10 import android.widget.ArrayAdapter;
8 import android.widget.Button; 11 import android.widget.Button;
9 import android.widget.EditText; 12 import android.widget.EditText;
@@ -34,6 +37,9 @@ public class EditIncident extends AppCompatActivity { @@ -34,6 +37,9 @@ public class EditIncident extends AppCompatActivity {
34 protected void onCreate(Bundle savedInstanceState) { 37 protected void onCreate(Bundle savedInstanceState) {
35 super.onCreate(savedInstanceState); 38 super.onCreate(savedInstanceState);
36 setContentView(R.layout.activity_edit_incident); 39 setContentView(R.layout.activity_edit_incident);
  40 + Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
  41 + setSupportActionBar(myToolbar);
  42 +
37 Intent intent = getIntent(); 43 Intent intent = getIntent();
38 Bundle b = intent.getExtras(); 44 Bundle b = intent.getExtras();
39 String id = b.getString("chosenEventId"); 45 String id = b.getString("chosenEventId");
@@ -140,6 +146,33 @@ public class EditIncident extends AppCompatActivity { @@ -140,6 +146,33 @@ public class EditIncident extends AppCompatActivity {
140 return evalMap; 146 return evalMap;
141 } 147 }
142 148
  149 + @Override
  150 + public boolean onCreateOptionsMenu (Menu menu) {
  151 + getMenuInflater().inflate(R.menu.main, menu);
  152 + return true;
  153 + }
  154 +
  155 + @Override
  156 + public boolean onOptionsItemSelected(MenuItem item) {
  157 + switch (item.getItemId()) {
  158 + case R.id.action_logout:
  159 + //TODO: LEGG TIL LOGG-UT-FUNKSJON
  160 + Toast.makeText(EditIncident.this, "Logger ut",
  161 + Toast.LENGTH_LONG).show();
  162 + return true;
  163 +
  164 + case R.id.action_home:
  165 + Intent intent = new Intent(this, MainMenu.class);
  166 + startActivity(intent);
  167 + return true;
  168 +
  169 + default:
  170 + return super.onOptionsItemSelected(item);
  171 +
  172 + }
  173 + }
  174 +
  175 +
143 } 176 }
144 177
145 178
Risiko/app/src/main/java/activity/Evaluations.java
@@ -6,12 +6,16 @@ import android.graphics.Typeface; @@ -6,12 +6,16 @@ import android.graphics.Typeface;
6 import android.support.v7.app.AlertDialog; 6 import android.support.v7.app.AlertDialog;
7 import android.support.v7.app.AppCompatActivity; 7 import android.support.v7.app.AppCompatActivity;
8 import android.os.Bundle; 8 import android.os.Bundle;
  9 +import android.support.v7.widget.Toolbar;
9 import android.util.Log; 10 import android.util.Log;
10 import android.view.LayoutInflater; 11 import android.view.LayoutInflater;
  12 +import android.view.Menu;
  13 +import android.view.MenuItem;
11 import android.view.View; 14 import android.view.View;
12 import android.widget.Button; 15 import android.widget.Button;
13 import android.widget.ListView; 16 import android.widget.ListView;
14 import android.widget.TextView; 17 import android.widget.TextView;
  18 +import android.widget.Toast;
15 19
16 import com.risiko.risiko.R; 20 import com.risiko.risiko.R;
17 21
@@ -38,6 +42,9 @@ public class Evaluations extends AppCompatActivity { @@ -38,6 +42,9 @@ public class Evaluations extends AppCompatActivity {
38 protected void onCreate(Bundle savedInstanceState) { 42 protected void onCreate(Bundle savedInstanceState) {
39 super.onCreate(savedInstanceState); 43 super.onCreate(savedInstanceState);
40 setContentView(R.layout.activity_evaluations); 44 setContentView(R.layout.activity_evaluations);
  45 + Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
  46 + setSupportActionBar(myToolbar);
  47 +
41 48
42 dbs = new DatabaseSource(this); 49 dbs = new DatabaseSource(this);
43 50
@@ -196,4 +203,31 @@ public class Evaluations extends AppCompatActivity { @@ -196,4 +203,31 @@ public class Evaluations extends AppCompatActivity {
196 .show(); 203 .show();
197 } 204 }
198 205
  206 + @Override
  207 + public boolean onCreateOptionsMenu (Menu menu) {
  208 + getMenuInflater().inflate(R.menu.main, menu);
  209 + return true;
  210 + }
  211 +
  212 + @Override
  213 + public boolean onOptionsItemSelected(MenuItem item) {
  214 + switch (item.getItemId()) {
  215 + case R.id.action_logout:
  216 + //TODO: LEGG TIL LOGG-UT-FUNKSJON
  217 + Toast.makeText(Evaluations.this, "Logger ut",
  218 + Toast.LENGTH_LONG).show();
  219 + return true;
  220 +
  221 + case R.id.action_home:
  222 + Intent intent = new Intent(this, MainMenu.class);
  223 + startActivity(intent);
  224 + return true;
  225 +
  226 + default:
  227 + return super.onOptionsItemSelected(item);
  228 +
  229 + }
  230 + }
  231 +
  232 +
199 } 233 }
Risiko/app/src/main/java/activity/Incident.java
@@ -5,13 +5,17 @@ import android.content.Intent; @@ -5,13 +5,17 @@ import android.content.Intent;
5 import android.support.v7.app.AlertDialog; 5 import android.support.v7.app.AlertDialog;
6 import android.support.v7.app.AppCompatActivity; 6 import android.support.v7.app.AppCompatActivity;
7 import android.os.Bundle; 7 import android.os.Bundle;
  8 +import android.support.v7.widget.Toolbar;
8 import android.util.Log; 9 import android.util.Log;
9 import android.view.LayoutInflater; 10 import android.view.LayoutInflater;
  11 +import android.view.Menu;
  12 +import android.view.MenuItem;
10 import android.view.View; 13 import android.view.View;
11 import android.widget.Button; 14 import android.widget.Button;
12 import android.widget.EditText; 15 import android.widget.EditText;
13 import android.widget.ListView; 16 import android.widget.ListView;
14 import android.widget.TextView; 17 import android.widget.TextView;
  18 +import android.widget.Toast;
15 19
16 import com.risiko.risiko.R; 20 import com.risiko.risiko.R;
17 21
@@ -39,6 +43,10 @@ public class Incident extends AppCompatActivity { @@ -39,6 +43,10 @@ public class Incident extends AppCompatActivity {
39 super.onCreate(savedInstanceState); 43 super.onCreate(savedInstanceState);
40 setContentView(R.layout.activity_incidents); 44 setContentView(R.layout.activity_incidents);
41 45
  46 + Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
  47 + setSupportActionBar(myToolbar);
  48 +
  49 +
42 dbs = new DatabaseSource(this); 50 dbs = new DatabaseSource(this);
43 51
44 // ArrayList<dataclasses.Incident> incidentList = new ArrayList<>(); 52 // ArrayList<dataclasses.Incident> incidentList = new ArrayList<>();
@@ -189,8 +197,36 @@ public class Incident extends AppCompatActivity { @@ -189,8 +197,36 @@ public class Incident extends AppCompatActivity {
189 .show(); 197 .show();
190 } 198 }
191 199
  200 +<<<<<<< HEAD
  201 +
192 202
193 203
  204 +=======
  205 + @Override
  206 + public boolean onCreateOptionsMenu (Menu menu) {
  207 + getMenuInflater().inflate(R.menu.main, menu);
  208 + return true;
  209 + }
194 210
  211 + @Override
  212 + public boolean onOptionsItemSelected(MenuItem item) {
  213 + switch (item.getItemId()) {
  214 + case R.id.action_logout:
  215 + //TODO: LEGG TIL LOGG-UT-FUNKSJON
  216 + Toast.makeText(Incident.this, "Logger ut",
  217 + Toast.LENGTH_LONG).show();
  218 + return true;
  219 +
  220 + case R.id.action_home:
  221 + Intent intent = new Intent(this, MainMenu.class);
  222 + startActivity(intent);
  223 + return true;
  224 +
  225 + default:
  226 + return super.onOptionsItemSelected(item);
  227 +
  228 + }
  229 + }
  230 +>>>>>>> usability_improvements
195 231
196 } 232 }
Risiko/app/src/main/java/activity/MainMenu.java
@@ -4,8 +4,10 @@ import android.content.Intent; @@ -4,8 +4,10 @@ import android.content.Intent;
4 import android.support.v7.app.AppCompatActivity; 4 import android.support.v7.app.AppCompatActivity;
5 import android.os.Bundle; 5 import android.os.Bundle;
6 import android.support.v7.widget.Toolbar; 6 import android.support.v7.widget.Toolbar;
  7 +import android.view.Menu;
  8 +import android.view.MenuItem;
7 import android.widget.Button; 9 import android.widget.Button;
8 -import android.widget.TextView; 10 +import android.widget.Toast;
9 11
10 import com.risiko.risiko.R; 12 import com.risiko.risiko.R;
11 13
@@ -15,23 +17,53 @@ public class MainMenu extends AppCompatActivity { @@ -15,23 +17,53 @@ public class MainMenu extends AppCompatActivity {
15 Button toSequences; 17 Button toSequences;
16 Button toNewEvent; 18 Button toNewEvent;
17 19
  20 +
18 @Override 21 @Override
19 protected void onCreate(Bundle savedInstanceState) { 22 protected void onCreate(Bundle savedInstanceState) {
20 super.onCreate(savedInstanceState); 23 super.onCreate(savedInstanceState);
21 setContentView(R.layout.activity_main_menu); 24 setContentView(R.layout.activity_main_menu);
22 25
  26 + Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
  27 + setSupportActionBar(myToolbar);
  28 +
  29 +
23 toActivityList = findViewById(R.id.btn_to_activitylist); 30 toActivityList = findViewById(R.id.btn_to_activitylist);
24 - toActivityList.setOnClickListener(view -> startActivity(new Intent(this, Activities.class))); 31 + toActivityList.setOnClickListener(newview -> startActivity(new Intent(this, Activities.class)));
25 32
26 toSequences= findViewById(R.id.btn_to_sequense_of_activities); 33 toSequences= findViewById(R.id.btn_to_sequense_of_activities);
27 - toSequences.setOnClickListener(view -> startActivity(new Intent(this, SequenceOfActivities.class))); 34 + toSequences.setOnClickListener(newview -> startActivity(new Intent(this, SequenceOfActivities.class)));
28 35
29 toEventList = findViewById(R.id.btn_to_events); 36 toEventList = findViewById(R.id.btn_to_events);
30 - toEventList.setOnClickListener(view -> startActivity(new Intent(this, Incident.class))); 37 + toEventList.setOnClickListener(newview -> startActivity(new Intent(this, Incident.class)));
31 38
32 toNewEvent = findViewById(R.id.btn_to_new_event); 39 toNewEvent = findViewById(R.id.btn_to_new_event);
33 - toNewEvent.setOnClickListener(view -> startActivity(new Intent(this, NewIncident.class))); 40 + toNewEvent.setOnClickListener(newview -> startActivity(new Intent(this, NewIncident.class)));
  41 +
  42 + }
  43 +
  44 + @Override
  45 + public boolean onCreateOptionsMenu (Menu menu) {
  46 + getMenuInflater().inflate(R.menu.main, menu);
  47 + return true;
  48 + }
  49 +
  50 + @Override
  51 + public boolean onOptionsItemSelected(MenuItem item) {
  52 + switch (item.getItemId()) {
  53 + case R.id.action_logout:
  54 + //TODO: LEGG TIL LOGG-UT-FUNKSJON
  55 + return true;
  56 +
  57 + case R.id.action_home:
  58 + Toast.makeText(MainMenu.this, "Du er på appens hovedside",
  59 + Toast.LENGTH_LONG).show();
  60 + return true;
  61 +
  62 + default:
  63 +
  64 + return super.onOptionsItemSelected(item);
34 65
  66 + }
35 } 67 }
36 68
37 } 69 }
Risiko/app/src/main/java/activity/NewEvaluation.java
@@ -3,10 +3,14 @@ package activity; @@ -3,10 +3,14 @@ package activity;
3 import android.content.Intent; 3 import android.content.Intent;
4 import android.support.v7.app.AppCompatActivity; 4 import android.support.v7.app.AppCompatActivity;
5 import android.os.Bundle; 5 import android.os.Bundle;
  6 +import android.support.v7.widget.Toolbar;
  7 +import android.view.Menu;
  8 +import android.view.MenuItem;
6 import android.widget.ArrayAdapter; 9 import android.widget.ArrayAdapter;
7 import android.widget.Button; 10 import android.widget.Button;
8 import android.widget.EditText; 11 import android.widget.EditText;
9 import android.widget.Spinner; 12 import android.widget.Spinner;
  13 +import android.widget.Toast;
10 14
11 import com.risiko.risiko.R; 15 import com.risiko.risiko.R;
12 16
@@ -31,6 +35,9 @@ public class NewEvaluation extends AppCompatActivity { @@ -31,6 +35,9 @@ public class NewEvaluation extends AppCompatActivity {
31 protected void onCreate(Bundle savedInstanceState) { 35 protected void onCreate(Bundle savedInstanceState) {
32 super.onCreate(savedInstanceState); 36 super.onCreate(savedInstanceState);
33 setContentView(R.layout.activity_new_evaluation); 37 setContentView(R.layout.activity_new_evaluation);
  38 + Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
  39 + setSupportActionBar(myToolbar);
  40 +
34 41
35 Intent intent = getIntent(); 42 Intent intent = getIntent();
36 String activityId = intent.getStringExtra("ID_OF_CHOSEN_ACTIVITY"); 43 String activityId = intent.getStringExtra("ID_OF_CHOSEN_ACTIVITY");
@@ -110,4 +117,31 @@ public class NewEvaluation extends AppCompatActivity { @@ -110,4 +117,31 @@ public class NewEvaluation extends AppCompatActivity {
110 if (etNewEvalOutcome.getText().toString().isEmpty()) return false; 117 if (etNewEvalOutcome.getText().toString().isEmpty()) return false;
111 return true; 118 return true;
112 } 119 }
  120 +
  121 + @Override
  122 + public boolean onCreateOptionsMenu (Menu menu) {
  123 + getMenuInflater().inflate(R.menu.main, menu);
  124 + return true;
  125 + }
  126 +
  127 + @Override
  128 + public boolean onOptionsItemSelected(MenuItem item) {
  129 + switch (item.getItemId()) {
  130 + case R.id.action_logout:
  131 + //TODO: LEGG TIL LOGG-UT-FUNKSJON
  132 + Toast.makeText(NewEvaluation.this, "Logger ut",
  133 + Toast.LENGTH_LONG).show();
  134 + return true;
  135 +
  136 + case R.id.action_home:
  137 + Intent intent = new Intent(this, MainMenu.class);
  138 + startActivity(intent);
  139 + return true;
  140 +
  141 + default:
  142 + return super.onOptionsItemSelected(item);
  143 +
  144 + }
  145 + }
  146 +
113 } 147 }
Risiko/app/src/main/java/activity/NewIncident.java
1 package activity; 1 package activity;
2 2
  3 +import android.content.Intent;
3 import android.support.v7.app.AppCompatActivity; 4 import android.support.v7.app.AppCompatActivity;
4 import android.os.Bundle; 5 import android.os.Bundle;
  6 +import android.support.v7.widget.Toolbar;
5 import android.util.Log; 7 import android.util.Log;
  8 +import android.view.Menu;
  9 +import android.view.MenuItem;
6 import android.widget.ArrayAdapter; 10 import android.widget.ArrayAdapter;
7 import android.widget.Button; 11 import android.widget.Button;
8 import android.widget.EditText; 12 import android.widget.EditText;
@@ -30,11 +34,15 @@ public class NewIncident extends AppCompatActivity { @@ -30,11 +34,15 @@ public class NewIncident extends AppCompatActivity {
30 private Spinner spinnerAssociatedRisk; 34 private Spinner spinnerAssociatedRisk;
31 private Button btnNewIncident; 35 private Button btnNewIncident;
32 private DatabaseSource dbs; 36 private DatabaseSource dbs;
  37 + private Spinner spinnerReadAccess;
33 38
34 @Override 39 @Override
35 protected void onCreate(Bundle savedInstanceState) { 40 protected void onCreate(Bundle savedInstanceState) {
36 super.onCreate(savedInstanceState); 41 super.onCreate(savedInstanceState);
37 setContentView(R.layout.activity_new_incident); 42 setContentView(R.layout.activity_new_incident);
  43 + Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
  44 + setSupportActionBar(myToolbar);
  45 +
38 46
39 etDate = findViewById(R.id.et_newIncident_date); 47 etDate = findViewById(R.id.et_newIncident_date);
40 etLocation = findViewById(R.id.et_newIncident_location); 48 etLocation = findViewById(R.id.et_newIncident_location);
@@ -44,6 +52,19 @@ public class NewIncident extends AppCompatActivity { @@ -44,6 +52,19 @@ public class NewIncident extends AppCompatActivity {
44 dbs = new DatabaseSource(this); 52 dbs = new DatabaseSource(this);
45 53
46 spinnerAssociatedRisk = findViewById(R.id.spinner_associated_risk); 54 spinnerAssociatedRisk = findViewById(R.id.spinner_associated_risk);
  55 + spinnerReadAccess = findViewById(R.id.spinner_read_access);
  56 +
  57 + //TODO FJERN DENNE MIDLERTIDIGE DELEN FOR LESEAKSESS
  58 +
  59 + List<String> list = new ArrayList<>();
  60 + list.add("Sykepleiere");
  61 + list.add("Ambulansepersonell");
  62 + list.add("Leger");
  63 + ArrayAdapter<String> adapter2 = new ArrayAdapter<String>(NewIncident.this, android.R.layout.simple_spinner_item, list);
  64 + adapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  65 + spinnerReadAccess.setAdapter(adapter2);
  66 +
  67 +
47 // dbs.getAllEvaluation(evaluations); 68 // dbs.getAllEvaluation(evaluations);
48 69
49 Api.get().getAllEvaluations() 70 Api.get().getAllEvaluations()
@@ -127,4 +148,31 @@ public class NewIncident extends AppCompatActivity { @@ -127,4 +148,31 @@ public class NewIncident extends AppCompatActivity {
127 } 148 }
128 return evalMap; 149 return evalMap;
129 } 150 }
  151 +
  152 + @Override
  153 + public boolean onCreateOptionsMenu (Menu menu) {
  154 + getMenuInflater().inflate(R.menu.main, menu);
  155 + return true;
  156 + }
  157 +
  158 + @Override
  159 + public boolean onOptionsItemSelected(MenuItem item) {
  160 + switch (item.getItemId()) {
  161 + case R.id.action_logout:
  162 + //TODO: LEGG TIL LOGG-UT-FUNKSJON
  163 + Toast.makeText(NewIncident.this, "Logger ut",
  164 + Toast.LENGTH_LONG).show();
  165 + return true;
  166 +
  167 + case R.id.action_home:
  168 + Intent intent = new Intent(this, MainMenu.class);
  169 + startActivity(intent);
  170 + return true;
  171 +
  172 + default:
  173 + return super.onOptionsItemSelected(item);
  174 +
  175 + }
  176 + }
  177 +
130 } 178 }
Risiko/app/src/main/java/activity/SequenceOfActivities.java
@@ -4,11 +4,15 @@ import android.content.Intent; @@ -4,11 +4,15 @@ import android.content.Intent;
4 import android.support.v7.app.AlertDialog; 4 import android.support.v7.app.AlertDialog;
5 import android.support.v7.app.AppCompatActivity; 5 import android.support.v7.app.AppCompatActivity;
6 import android.os.Bundle; 6 import android.os.Bundle;
  7 +import android.support.v7.widget.Toolbar;
7 import android.view.LayoutInflater; 8 import android.view.LayoutInflater;
  9 +import android.view.Menu;
  10 +import android.view.MenuItem;
8 import android.view.View; 11 import android.view.View;
9 import android.widget.ArrayAdapter; 12 import android.widget.ArrayAdapter;
10 import android.widget.Button; 13 import android.widget.Button;
11 import android.widget.Spinner; 14 import android.widget.Spinner;
  15 +import android.widget.Toast;
12 16
13 import com.risiko.risiko.R; 17 import com.risiko.risiko.R;
14 18
@@ -20,6 +24,10 @@ public class SequenceOfActivities extends AppCompatActivity { @@ -20,6 +24,10 @@ public class SequenceOfActivities extends AppCompatActivity {
20 super.onCreate(savedInstanceState); 24 super.onCreate(savedInstanceState);
21 setContentView(R.layout.activity_sequence_of_activities); 25 setContentView(R.layout.activity_sequence_of_activities);
22 26
  27 + Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
  28 + setSupportActionBar(myToolbar);
  29 +
  30 +
23 generateReport = findViewById(R.id.btn_generate_report); 31 generateReport = findViewById(R.id.btn_generate_report);
24 generateReport.setOnClickListener(view -> reportDialog()); 32 generateReport.setOnClickListener(view -> reportDialog());
25 33
@@ -55,4 +63,31 @@ public class SequenceOfActivities extends AppCompatActivity { @@ -55,4 +63,31 @@ public class SequenceOfActivities extends AppCompatActivity {
55 63
56 alert.show(); 64 alert.show();
57 } 65 }
  66 +
  67 + @Override
  68 + public boolean onCreateOptionsMenu (Menu menu) {
  69 + getMenuInflater().inflate(R.menu.main, menu);
  70 + return true;
  71 + }
  72 +
  73 + @Override
  74 + public boolean onOptionsItemSelected(MenuItem item) {
  75 + switch (item.getItemId()) {
  76 + case R.id.action_logout:
  77 + //TODO: LEGG TIL LOGG-UT-FUNKSJON
  78 + Toast.makeText(SequenceOfActivities.this, "Logger ut",
  79 + Toast.LENGTH_LONG).show();
  80 + return true;
  81 +
  82 + case R.id.action_home:
  83 + Intent intent = new Intent(this, MainMenu.class);
  84 + startActivity(intent);
  85 + return true;
  86 +
  87 + default:
  88 + return super.onOptionsItemSelected(item);
  89 +
  90 + }
  91 + }
  92 +
58 } 93 }
Risiko/app/src/main/res/drawable/ic_home_24dp.xml 0 → 100644
  1 +<vector xmlns:android="http://schemas.android.com/apk/res/android"
  2 + android:width="24dp"
  3 + android:height="24dp"
  4 + android:viewportWidth="24.0"
  5 + android:viewportHeight="24.0">
  6 + <path
  7 + android:fillColor="#ffffff"
  8 + android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z"/>
  9 +</vector>
Risiko/app/src/main/res/drawable/ic_logout_24dp.xml 0 → 100644
  1 +<vector xmlns:android="http://schemas.android.com/apk/res/android"
  2 + android:width="24dp"
  3 + android:height="24dp"
  4 + android:viewportWidth="24.0"
  5 + android:viewportHeight="24.0">
  6 + <path
  7 + android:fillColor="#ffffff"
  8 + android:pathData="M13.5,5.5c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM9.8,8.9L7,23h2.1l1.8,-8 2.1,2v6h2v-7.5l-2.1,-2 0.6,-3C14.8,12 16.8,13 19,13v-2c-1.9,0 -3.5,-1 -4.3,-2.4l-1,-1.6c-0.4,-0.6 -1,-1 -1.7,-1 -0.3,0 -0.5,0.1 -0.8,0.1L6,8.3V13h2V9.6l1.8,-0.7"/>
  9 +</vector>
Risiko/app/src/main/res/layout/activity_activities.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
  2 +
2 <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:app="http://schemas.android.com/apk/res-auto" 4 xmlns:app="http://schemas.android.com/apk/res-auto"
4 xmlns:tools="http://schemas.android.com/tools" 5 xmlns:tools="http://schemas.android.com/tools"
5 android:layout_width="match_parent" 6 android:layout_width="match_parent"
6 android:layout_height="match_parent"> 7 android:layout_height="match_parent">
7 8
  9 + <include layout="@layout/toolbar"/>
  10 +
8 <TextView 11 <TextView
  12 + android:id="@+id/headline"
9 android:layout_width="wrap_content" 13 android:layout_width="wrap_content"
10 android:layout_height="wrap_content" 14 android:layout_height="wrap_content"
11 android:text="Liste over aktivititeter" 15 android:text="Liste over aktivititeter"
@@ -15,24 +19,28 @@ @@ -15,24 +19,28 @@
15 app:layout_constraintLeft_toLeftOf="parent" 19 app:layout_constraintLeft_toLeftOf="parent"
16 app:layout_constraintRight_toRightOf="parent" 20 app:layout_constraintRight_toRightOf="parent"
17 app:layout_constraintTop_toTopOf="parent" 21 app:layout_constraintTop_toTopOf="parent"
18 - android:layout_marginTop="25dp"/> 22 + android:layout_marginTop="70dp"
  23 + android:layout_marginBottom="100dp" />
19 24
20 25
21 <android.support.constraint.ConstraintLayout 26 <android.support.constraint.ConstraintLayout
  27 + app:layout_constraintTop_toBottomOf="@+id/headline"
22 android:layout_width="match_parent" 28 android:layout_width="match_parent"
23 android:layout_height="match_parent" 29 android:layout_height="match_parent"
24 android:layout_marginVertical="70dp" 30 android:layout_marginVertical="70dp"
25 - android:layout_marginHorizontal="20dp"> 31 + android:layout_marginBottom="20dp">
26 32
27 33
28 <android.support.v4.widget.SwipeRefreshLayout 34 <android.support.v4.widget.SwipeRefreshLayout
29 xmlns:android="http://schemas.android.com/apk/res/android" 35 xmlns:android="http://schemas.android.com/apk/res/android"
30 android:id="@+id/swiperefresh" 36 android:id="@+id/swiperefresh"
  37 + android:layout_marginTop="50dp"
31 android:layout_width="match_parent" 38 android:layout_width="match_parent"
32 android:layout_height="match_parent"> 39 android:layout_height="match_parent">
33 40
34 41
35 <LinearLayout 42 <LinearLayout
  43 + android:layout_marginTop="200dp"
36 android:background="@color/colorWhite" 44 android:background="@color/colorWhite"
37 android:layout_width="match_parent" 45 android:layout_width="match_parent"
38 android:layout_height="match_parent" 46 android:layout_height="match_parent"
Risiko/app/src/main/res/layout/activity_edit_incident.xml
@@ -6,19 +6,24 @@ @@ -6,19 +6,24 @@
6 android:layout_height="match_parent" 6 android:layout_height="match_parent"
7 tools:context="com.risiko.risiko.activity.EditIncident"> 7 tools:context="com.risiko.risiko.activity.EditIncident">
8 8
  9 + <include layout="@layout/toolbar"/>
  10 +
9 <LinearLayout 11 <LinearLayout
10 android:layout_width="match_parent" 12 android:layout_width="match_parent"
11 android:layout_height="match_parent" 13 android:layout_height="match_parent"
12 android:orientation="vertical" 14 android:orientation="vertical"
13 android:background="@color/colorWhite" 15 android:background="@color/colorWhite"
14 android:padding="10dp" 16 android:padding="10dp"
15 - android:layout_margin="15dp"> 17 + android:layout_marginTop="70dp"
  18 + android:layout_marginHorizontal="15dp"
  19 + android:layout_marginBottom="15dp">
16 20
17 21
18 <TextView 22 <TextView
19 android:layout_width="match_parent" 23 android:layout_width="match_parent"
20 android:layout_height="wrap_content" 24 android:layout_height="wrap_content"
21 android:text="Endre hendelse" 25 android:text="Endre hendelse"
  26 + android:textColor="@color/colorPrimaryDark"
22 android:textSize="25dp" 27 android:textSize="25dp"
23 android:textStyle="bold" 28 android:textStyle="bold"
24 app:layout_constraintTop_toTopOf="parent"/> 29 app:layout_constraintTop_toTopOf="parent"/>
Risiko/app/src/main/res/layout/activity_evaluations.xml
@@ -6,6 +6,8 @@ @@ -6,6 +6,8 @@
6 android:layout_width="match_parent" 6 android:layout_width="match_parent"
7 android:layout_height="match_parent"> 7 android:layout_height="match_parent">
8 8
  9 + <include layout="@layout/toolbar"/>
  10 +
9 <TextView 11 <TextView
10 android:id="@+id/tv_nameOfActivity" 12 android:id="@+id/tv_nameOfActivity"
11 android:layout_width="wrap_content" 13 android:layout_width="wrap_content"
Risiko/app/src/main/res/layout/activity_incidents.xml
@@ -5,6 +5,8 @@ @@ -5,6 +5,8 @@
5 android:layout_width="match_parent" 5 android:layout_width="match_parent"
6 android:layout_height="match_parent"> 6 android:layout_height="match_parent">
7 7
  8 + <include layout="@layout/toolbar"/>
  9 +
8 <TextView 10 <TextView
9 android:layout_width="wrap_content" 11 android:layout_width="wrap_content"
10 android:layout_height="wrap_content" 12 android:layout_height="wrap_content"
@@ -15,20 +17,22 @@ @@ -15,20 +17,22 @@
15 app:layout_constraintLeft_toLeftOf="parent" 17 app:layout_constraintLeft_toLeftOf="parent"
16 app:layout_constraintRight_toRightOf="parent" 18 app:layout_constraintRight_toRightOf="parent"
17 app:layout_constraintTop_toTopOf="parent" 19 app:layout_constraintTop_toTopOf="parent"
18 - android:layout_marginTop="25dp" 20 + android:layout_marginTop="70dp"
19 android:layout_marginBottom="10dp"/> 21 android:layout_marginBottom="10dp"/>
20 22
21 23
22 <android.support.constraint.ConstraintLayout 24 <android.support.constraint.ConstraintLayout
23 android:layout_width="match_parent" 25 android:layout_width="match_parent"
24 android:layout_height="match_parent" 26 android:layout_height="match_parent"
25 - android:layout_marginVertical="70dp" 27 + android:layout_marginTop="120dp"
  28 + android:layout_marginBottom="20dp"
26 android:layout_marginHorizontal="20dp"> 29 android:layout_marginHorizontal="20dp">
27 30
28 31
29 <android.support.v4.widget.SwipeRefreshLayout 32 <android.support.v4.widget.SwipeRefreshLayout
30 xmlns:android="http://schemas.android.com/apk/res/android" 33 xmlns:android="http://schemas.android.com/apk/res/android"
31 android:id="@+id/swiperefresh" 34 android:id="@+id/swiperefresh"
  35 + android:layout_marginTop="40dp"
32 android:layout_width="match_parent" 36 android:layout_width="match_parent"
33 android:layout_height="wrap_content"> 37 android:layout_height="wrap_content">
34 38
Risiko/app/src/main/res/layout/activity_main_menu.xml
@@ -6,7 +6,11 @@ @@ -6,7 +6,11 @@
6 android:layout_height="match_parent" 6 android:layout_height="match_parent"
7 tools:context="com.risiko.risiko.activity.MainMenu"> 7 tools:context="com.risiko.risiko.activity.MainMenu">
8 8
  9 + <include layout="@layout/toolbar"/>
  10 +
  11 +
9 <LinearLayout 12 <LinearLayout
  13 + android:layout_marginTop="?attr/actionBarSize"
10 android:layout_width="match_parent" 14 android:layout_width="match_parent"
11 android:layout_height="match_parent" 15 android:layout_height="match_parent"
12 android:orientation="vertical" 16 android:orientation="vertical"
Risiko/app/src/main/res/layout/activity_main_page.xml
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 8
9 <TextView 9 <TextView
10 android:id="@+id/app_name" 10 android:id="@+id/app_name"
11 - android:layout_marginTop="40dp" 11 + android:layout_marginTop="50dp"
12 android:layout_width="wrap_content" 12 android:layout_width="wrap_content"
13 android:layout_height="wrap_content" 13 android:layout_height="wrap_content"
14 android:text="@string/app_name" 14 android:text="@string/app_name"
Risiko/app/src/main/res/layout/activity_new_evaluation.xml
@@ -6,19 +6,24 @@ @@ -6,19 +6,24 @@
6 android:layout_height="match_parent" 6 android:layout_height="match_parent"
7 tools:context="com.risiko.risiko.activity.NewEvaluation"> 7 tools:context="com.risiko.risiko.activity.NewEvaluation">
8 8
  9 + <include layout="@layout/toolbar"/>
  10 +
9 <LinearLayout 11 <LinearLayout
10 android:layout_width="match_parent" 12 android:layout_width="match_parent"
11 android:layout_height="match_parent" 13 android:layout_height="match_parent"
12 android:orientation="vertical" 14 android:orientation="vertical"
13 android:background="@color/colorWhite" 15 android:background="@color/colorWhite"
14 android:padding="10dp" 16 android:padding="10dp"
15 - android:layout_margin="15dp"> 17 + android:layout_marginTop="70dp"
  18 + android:layout_marginBottom="15dp"
  19 + android:layout_marginHorizontal="15dp">
16 20
17 21
18 <TextView 22 <TextView
19 android:layout_width="match_parent" 23 android:layout_width="match_parent"
20 android:layout_height="wrap_content" 24 android:layout_height="wrap_content"
21 android:text="Ny vurdering" 25 android:text="Ny vurdering"
  26 + android:textColor="@color/colorPrimaryDark"
22 android:textSize="25dp" 27 android:textSize="25dp"
23 android:textStyle="bold"/> 28 android:textStyle="bold"/>
24 29
Risiko/app/src/main/res/layout/activity_new_incident.xml
@@ -6,13 +6,17 @@ @@ -6,13 +6,17 @@
6 android:layout_height="match_parent" 6 android:layout_height="match_parent"
7 tools:context="com.risiko.risiko.activity.NewEvent"> 7 tools:context="com.risiko.risiko.activity.NewEvent">
8 8
  9 + <include layout="@layout/toolbar"/>
  10 +
9 <LinearLayout 11 <LinearLayout
10 android:layout_width="match_parent" 12 android:layout_width="match_parent"
11 android:layout_height="match_parent" 13 android:layout_height="match_parent"
12 android:orientation="vertical" 14 android:orientation="vertical"
13 android:background="@color/colorWhite" 15 android:background="@color/colorWhite"
14 android:padding="10dp" 16 android:padding="10dp"
15 - android:layout_margin="15dp"> 17 + android:layout_marginBottom="15dp"
  18 + android:layout_marginHorizontal="15dp"
  19 + android:layout_marginTop="70dp">
16 20
17 21
18 <TextView 22 <TextView
@@ -21,6 +25,7 @@ @@ -21,6 +25,7 @@
21 android:text="Ny hendelse" 25 android:text="Ny hendelse"
22 android:textSize="25dp" 26 android:textSize="25dp"
23 android:textStyle="bold" 27 android:textStyle="bold"
  28 + android:textColor="@color/colorPrimaryDark"
24 app:layout_constraintTop_toTopOf="parent"/> 29 app:layout_constraintTop_toTopOf="parent"/>
25 30
26 <EditText 31 <EditText
Risiko/app/src/main/res/layout/activity_sequence_of_activities.xml
@@ -6,13 +6,17 @@ @@ -6,13 +6,17 @@
6 android:layout_height="match_parent" 6 android:layout_height="match_parent"
7 tools:context="com.risiko.risiko.activity.SequenceOfActivities"> 7 tools:context="com.risiko.risiko.activity.SequenceOfActivities">
8 8
  9 + <include layout="@layout/toolbar"/>
  10 +
9 <LinearLayout 11 <LinearLayout
10 android:layout_width="match_parent" 12 android:layout_width="match_parent"
11 android:layout_height="match_parent" 13 android:layout_height="match_parent"
12 android:orientation="vertical" 14 android:orientation="vertical"
13 android:background="@color/colorWhite" 15 android:background="@color/colorWhite"
14 android:padding="10dp" 16 android:padding="10dp"
15 - android:layout_margin="15dp"> 17 + android:layout_marginBottom="15dp"
  18 + android:layout_marginHorizontal="15dp"
  19 + android:layout_marginTop="70dp">
16 20
17 21
18 <TextView 22 <TextView
@@ -23,6 +27,7 @@ @@ -23,6 +27,7 @@
23 android:text="@string/sequence_of_activities" 27 android:text="@string/sequence_of_activities"
24 android:textStyle="bold" 28 android:textStyle="bold"
25 android:textSize="25dp" 29 android:textSize="25dp"
  30 + android:textColor="@color/colorPrimaryDark"
26 app:layout_constraintLeft_toLeftOf="parent" 31 app:layout_constraintLeft_toLeftOf="parent"
27 app:layout_constraintRight_toRightOf="parent" 32 app:layout_constraintRight_toRightOf="parent"
28 app:layout_constraintTop_toTopOf="parent" 33 app:layout_constraintTop_toTopOf="parent"
Risiko/app/src/main/res/layout/toolbar.xml 0 → 100644
  1 +<android.support.v7.widget.ActionBarContainer
  2 + xmlns:android="http://schemas.android.com/apk/res/android"
  3 + xmlns:app="http://schemas.android.com/apk/res-auto"
  4 + xmlns:tools="http://schemas.android.com/tools"
  5 + android:layout_width="match_parent"
  6 + android:layout_height="wrap_content"
  7 + android:fitsSystemWindows="true"
  8 + tools:context="kna.quizter.Activities.MainActivity"
  9 + android:layout_marginBottom="20dp">
  10 +
  11 + <android.support.v7.widget.Toolbar
  12 + android:id="@+id/my_toolbar"
  13 + android:layout_height="?attr/actionBarSize"
  14 + android:layout_width="match_parent"
  15 + android:background="@color/colorPrimaryDark"
  16 + android:elevation="4dp"
  17 + app:titleTextColor="@color/colorWhite"
  18 + android:textAlignment="center"
  19 + android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
  20 + app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
  21 + />
  22 +
  23 +</android.support.v7.widget.ActionBarContainer>
0 \ No newline at end of file 24 \ No newline at end of file
Risiko/app/src/main/res/menu/main.xml 0 → 100644
  1 +<menu xmlns:android="http://schemas.android.com/apk/res/android"
  2 + xmlns:app="http://schemas.android.com/apk/res-auto">
  3 +
  4 + <item
  5 + android:id="@+id/action_home"
  6 + android:icon="@drawable/ic_home_24dp"
  7 + android:title="Hovedmeny"
  8 + app:showAsAction="ifRoom"/>
  9 +
  10 + <item android:id="@+id/action_logout"
  11 + android:icon="@drawable/ic_logout_24dp"
  12 + android:title="Logg ut"
  13 + app:showAsAction="ifRoom"/>
  14 +
  15 +</menu>
0 \ No newline at end of file 16 \ No newline at end of file
Risiko/app/src/main/res/values/styles.xml
1 <resources> 1 <resources>
2 2
3 <!-- Base application theme. --> 3 <!-- Base application theme. -->
4 - <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">  
5 - <!-- Customize your theme here. -->  
6 - <item name="colorPrimary">@color/colorPrimaryDark</item>  
7 - <item name="colorPrimaryDark">@color/colorPrimary</item>  
8 - <item name="colorAccent">@color/colorAccent</item>  
9 - <item name="android:colorBackground">@color/background_material_light</item>  
10 - </style>  
11 4
12 - <style name="risikoTheme" parent="AppTheme" >  
13 - <item name="colorPrimary">@color/colorPrimaryDark</item>  
14 - </style> 5 + <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
  6 + <!-- Customize your theme here. -->
  7 + <item name="colorPrimary">@color/colorPrimaryDark</item>
  8 + <item name="colorPrimaryDark">@color/colorPrimary</item>
  9 + <item name="colorAccent">@color/colorAccent</item>
  10 + <item name="android:colorBackground">@color/background_material_light</item>
  11 + </style>
  12 +
  13 + <style name="CustomTheme" parent="Theme.AppCompat.Light">
  14 +
  15 + <item name="contentInsetStart">0dp</item>
  16 + <item name="contentInsetEnd">0dp</item>
  17 + </style>
  18 +
15 19
16 </resources> 20 </resources>