Commit d87500ec81a11ab9e26749e25016efbcdfe5224f

Authored by Ali B
2 parents e8fb7145 615050cc

Merge branch 'ali_v2' into master_application

Risiko/.idea/caches/build_file_checksums.ser
No preview for this file type
Risiko/app/src/main/java/activity/Activities.java
... ... @@ -15,7 +15,6 @@ import dataclasses.Activity;
15 15  
16 16 public class Activities extends AppCompatActivity {
17 17 ListView lv;
18   - String chosenActivity;
19 18  
20 19 @Override
21 20 protected void onCreate(Bundle savedInstanceState) {
... ... @@ -36,19 +35,19 @@ public class Activities extends AppCompatActivity {
36 35 private void insertActivities(List<Activity> activities) {
37 36 lv = (ListView) findViewById(R.id.lv_activities);
38 37 lv.setAdapter(new ListAdapterActivities(this, activities));
39   - lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
40   - @Override
41   - public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
42   - chosenActivity = ((Activity) lv.getItemAtPosition(position)).getNameOfActivity();
43   - goToChosenActivity();
44   - }
  38 + lv.setOnItemClickListener((parent, view, position, id) -> {
  39 + String nameOfChosenActivity = ((Activity) lv.getItemAtPosition(position)).getNameOfActivity();
  40 + int activityId = ((Activity) lv.getItemAtPosition(position)).getId();
  41 + System.out.println(activityId);
  42 + goToChosenActivity(nameOfChosenActivity, activityId);
45 43 });
46 44 }
47 45  
48 46  
49   - private void goToChosenActivity() {
  47 + private void goToChosenActivity(String nameOfChosenActivity, int activityId) {
50 48 Intent intent = new Intent(this, Evaluations.class);
51   - intent.putExtra("NAME_OF_CHOSEN_ACTIVITY", chosenActivity);
  49 + intent.putExtra("NAME_OF_CHOSEN_ACTIVITY", nameOfChosenActivity);
  50 + intent.putExtra("ID_OF_CHOSEN_ACTIVITY", activityId);
52 51 startActivity(intent);
53 52 }
54 53 }
... ...
Risiko/app/src/main/java/activity/Evaluations.java
... ... @@ -19,26 +19,36 @@ import java.util.List;
19 19  
20 20 import adapters.ListAdapterEvaluations;
21 21  
  22 +import database.DatabaseSource;
22 23 import dataclasses.Evaluation;
23 24  
24 25 public class Evaluations extends AppCompatActivity {
25 26 ListView lv;
26 27 String chosenEvaluation;
27   - TextView consequence;
  28 + TextView tvNameOfActivity;
28 29 Button addNewEvaluation;
  30 + DatabaseSource dbs;
29 31  
30 32 @Override
31 33 protected void onCreate(Bundle savedInstanceState) {
32 34 super.onCreate(savedInstanceState);
33 35 setContentView(R.layout.activity_evaluations);
34 36  
  37 +
  38 + dbs = new DatabaseSource(this);
  39 + Intent intent = getIntent();
  40 + String activityName = intent.getStringExtra("NAME_OF_CHOSEN_ACTIVITY");
  41 + int activityId = intent.getIntExtra("ID_OF_CHOSEN_ACTIVITY", -1);
  42 +
  43 + tvNameOfActivity = findViewById(R.id.tv_nameOfActivity);
  44 + tvNameOfActivity.setText(activityName);
  45 +
35 46 addNewEvaluation = findViewById(R.id.btn_add_new_evaluation);
36   - addNewEvaluation.setOnClickListener(view -> startActivity(new Intent(this, NewEvaluation.class)));
  47 + intent.setClass(this, NewEvaluation.class);
  48 + addNewEvaluation.setOnClickListener(view -> startActivity(intent));
37 49  
38   - //TODO Bytte ut Mockdata på sikt
39   - ArrayList<Evaluation> evaluationList= new ArrayList<>();
40   - evaluationList.add(new Evaluation("Tråkke over", "Skade foten", "Velge riktig skotøy", 1, 3));
41   - evaluationList.add(new Evaluation("Falle i elva", "Blir våt", "Ikke gjør det", 1, 1));
  50 + ArrayList<Evaluation> evaluationList = new ArrayList<>();
  51 + dbs.getAllEvaluationsForActivity(activityId, evaluationList);
42 52 insertEvaluations(evaluationList);
43 53 }
44 54  
... ... @@ -46,16 +56,13 @@ public class Evaluations extends AppCompatActivity {
46 56 private void insertEvaluations(List<Evaluation> evaluations) {
47 57 lv = (ListView) findViewById(R.id.lv_evaluations);
48 58 lv.setAdapter(new ListAdapterEvaluations(this, evaluations));
49   - lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
50   - @Override
51   - public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
52   - chosenEvaluation = ((Evaluation) lv.getItemAtPosition(position)).getTitle();
53   - showEvaluationPopup();
54   - }
  59 + lv.setOnItemClickListener((parent, view, position, id) -> {
  60 + chosenEvaluation = ((Evaluation) lv.getItemAtPosition(position)).getTitle();
  61 + showEvaluationPopup((Evaluation) lv.getItemAtPosition(position));
55 62 });
56 63 }
57 64  
58   - private void showEvaluationPopup() {
  65 + private void showEvaluationPopup(Evaluation evaluation) {
59 66  
60 67 LayoutInflater layoutInflater = LayoutInflater.from(this);
61 68 View promptView = layoutInflater.inflate(R.layout.popup_evaluation, null);
... ... @@ -63,8 +70,7 @@ public class Evaluations extends AppCompatActivity {
63 70 alertDialogBuilder.setView(promptView);
64 71  
65 72 //TODO FINNE EN MÅTE Å KNYTTE SAMMEN POPUP MED DET ELEMENTET SOM
66   - Evaluation evaluati = new Evaluation("Tråkke over", "Skade foten", "Velge riktig skotøy", 1, 2);
67   -
  73 +// Evaluation evaluati = new Evaluation("Tråkke over", "Skade foten", "Velge riktig skotøy", 1, 2);
68 74  
69 75  
70 76 TextView headline = promptView.findViewById(R.id.pop_headline);
... ... @@ -78,10 +84,10 @@ public class Evaluations extends AppCompatActivity {
78 84 TextView probabilityHigh = promptView.findViewById(R.id.pop_probability_high);
79 85  
80 86  
81   - if (evaluati.getProbability() == 3) {
  87 + if (evaluation.getProbability() == 3) {
82 88 probabilityHigh.setTextColor(getResources().getColor(R.color.colorDarkGreen));
83 89 probabilityHigh.setTypeface(Typeface.DEFAULT_BOLD);
84   - } else if(evaluati.getProbability() == 2) {
  90 + } else if(evaluation.getProbability() == 2) {
85 91 probabilityMedium.setTextColor(getResources().getColor(R.color.colorDarkGreen));
86 92 probabilityMedium.setTypeface(Typeface.DEFAULT_BOLD);
87 93 } else {
... ... @@ -90,10 +96,10 @@ public class Evaluations extends AppCompatActivity {
90 96 }
91 97  
92 98  
93   - if (evaluati.getConsequence() == 1) {
  99 + if (evaluation.getConsequence() == 1) {
94 100 consequenceHarmless.setTextColor(getResources().getColor(R.color.colorDarkGreen));
95 101 consequenceHarmless.setTypeface(Typeface.DEFAULT_BOLD);
96   - } else if(evaluati.getConsequence() == 2) {
  102 + } else if(evaluation.getConsequence() == 2) {
97 103 consequenceModerate.setTextColor(getResources().getColor(R.color.colorDarkGreen));
98 104 consequenceModerate.setTypeface(Typeface.DEFAULT_BOLD);
99 105 } else {
... ... @@ -102,10 +108,9 @@ public class Evaluations extends AppCompatActivity {
102 108 }
103 109  
104 110  
105   - headline.setText(evaluati.getTitle());
106   - outcome.setText("- " + evaluati.getOutcome());
107   - measures.setText("- " + evaluati.getMeasures());
108   -
  111 + headline.setText(evaluation.getTitle());
  112 + outcome.setText("- " + evaluation.getOutcome());
  113 + measures.setText("- " + evaluation.getMeasures());
109 114  
110 115 alertDialogBuilder.setCancelable(false)
111 116 .setNegativeButton(getString(R.string.cancel),
... ... @@ -113,8 +118,6 @@ public class Evaluations extends AppCompatActivity {
113 118 AlertDialog alert = alertDialogBuilder.create();
114 119  
115 120 alert.show();
116   -
117   -
118 121 }
119 122  
120 123 }
... ...
Risiko/app/src/main/java/activity/Incident.java
... ... @@ -14,10 +14,12 @@ import java.util.ArrayList;
14 14 import java.util.List;
15 15  
16 16 import adapters.ListAdapterIncidents;
  17 +import database.DatabaseSource;
17 18  
18 19 public class Incident extends AppCompatActivity {
19 20 ListView lv;
20 21 int chosenEventId;
  22 + DatabaseSource dbs;
21 23  
22 24 @Override
23 25 protected void onCreate(Bundle savedInstanceState) {
... ... @@ -25,14 +27,17 @@ public class Incident extends AppCompatActivity {
25 27 setContentView(R.layout.activity_incidents);
26 28  
27 29  
  30 +
28 31 //TODO Bytte ut Mockdata på sikt
29 32 ArrayList<dataclasses.Incident> incidentList = new ArrayList<>();
30   - incidentList.add(new dataclasses.Incident("Datt i elva"));
31   - incidentList.add(new dataclasses.Incident("Brant meg under matlaging"));
32   - incidentList.add(new dataclasses.Incident("Vrikket foten"));
33   - incidentList.add(new dataclasses.Incident("Falt ned fra et bord"));
34   - incidentList.add(new dataclasses.Incident("Kræsjet i et tre"));
35   - incidentList.add(new dataclasses.Incident("Fikk alkoholforgiftning"));
  33 + dbs.getAllIncidents(incidentList);
  34 +
  35 +// incidentList.add(new dataclasses.Incident("Datt i elva"));
  36 +// incidentList.add(new dataclasses.Incident("Brant meg under matlaging"));
  37 +// incidentList.add(new dataclasses.Incident("Vrikket foten"));
  38 +// incidentList.add(new dataclasses.Incident("Falt ned fra et bord"));
  39 +// incidentList.add(new dataclasses.Incident("Kræsjet i et tre"));
  40 +// incidentList.add(new dataclasses.Incident("Fikk alkoholforgiftning"));
36 41 insertEvents(incidentList);
37 42 }
38 43  
... ... @@ -40,13 +45,10 @@ public class Incident extends AppCompatActivity {
40 45 private void insertEvents(List<dataclasses.Incident> incident) {
41 46 lv = (ListView) findViewById(R.id.lv_events);
42 47 lv.setAdapter(new ListAdapterIncidents(this, incident));
43   - lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
44   - @Override
45   - public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
46   - chosenEventId = ((dataclasses.Incident) lv.getItemAtPosition(position)).getId();
47   - showEventPopup();
  48 + lv.setOnItemClickListener((parent, view, position, id) -> {
  49 + chosenEventId = ((dataclasses.Incident) lv.getItemAtPosition(position)).getId();
  50 + showEventPopup();
48 51  
49   - }
50 52 });
51 53 }
52 54  
... ...
Risiko/app/src/main/java/activity/NewEvaluation.java
1 1 package activity;
2 2  
  3 +import android.content.Intent;
3 4 import android.support.v7.app.AppCompatActivity;
4 5 import android.os.Bundle;
5 6 import android.widget.ArrayAdapter;
  7 +import android.widget.Button;
  8 +import android.widget.EditText;
6 9 import android.widget.Spinner;
7 10  
8 11 import com.risiko.risiko.R;
9 12  
  13 +import database.DatabaseSource;
  14 +import dataclasses.Evaluation;
  15 +
10 16 public class NewEvaluation extends AppCompatActivity {
11 17  
  18 + private EditText etNewEvalTitle, etNewEvalOutcome, etNewEvalAction;
  19 + private Button btnNewEval;
  20 + DatabaseSource dbs;
  21 +
12 22 @Override
13 23 protected void onCreate(Bundle savedInstanceState) {
14 24 super.onCreate(savedInstanceState);
15 25 setContentView(R.layout.activity_new_evaluation);
  26 + Intent intent = getIntent();
  27 + int activityId = intent.getIntExtra("ID_OF_CHOSEN_ACTIVITY", -1);
  28 +
  29 +
  30 + dbs = new DatabaseSource(this);
  31 + etNewEvalTitle = findViewById(R.id.et_newEval_title);
  32 + etNewEvalOutcome = findViewById(R.id.et_newEval_outcome);
  33 + etNewEvalAction = findViewById(R.id.et_newEval_action);
16 34  
17 35 Spinner consequenceSpinner = (Spinner) findViewById(R.id.spinner_consequence);
18 36 ArrayAdapter<CharSequence> consequenceAdapter = ArrayAdapter.createFromResource(this, R.array.consequence_array, android.R.layout.simple_spinner_item);
19 37 consequenceAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
20 38 consequenceSpinner.setAdapter(consequenceAdapter);
21 39  
22   - Spinner associatedRiskSpinner = (Spinner) findViewById(R.id.spinner_associated_risk);
23   - ArrayAdapter<CharSequence> associatedRiskAdapter = ArrayAdapter.createFromResource(this, R.array.associated_risk_array, android.R.layout.simple_spinner_item);
  40 + Spinner probabilitySpinner = (Spinner) findViewById(R.id.spinner_probability);
  41 + ArrayAdapter<CharSequence> probabilityAdapter = ArrayAdapter.createFromResource(this, R.array.probability_array, android.R.layout.simple_spinner_item);
24 42 consequenceAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
25   - associatedRiskSpinner.setAdapter(associatedRiskAdapter);
  43 + probabilitySpinner.setAdapter(probabilityAdapter);
  44 +
  45 + btnNewEval = findViewById(R.id.btn_new_eval);
  46 +
  47 + btnNewEval.setOnClickListener(view -> {
  48 + if (inputAccepted()) {
  49 + String title = etNewEvalTitle.getText().toString();
  50 + String outcome = etNewEvalOutcome.getText().toString();
  51 + String action = etNewEvalAction.getText().toString();
  52 + String consequence = consequenceSpinner.getSelectedItem().toString();
  53 + String probability = probabilitySpinner.getSelectedItem().toString();
  54 +
  55 + int consequenceValue = getConsequenceValue(consequence);
  56 + int probabilityValue = getProbabilityValue(probability);
  57 +
  58 + Evaluation newEval = new Evaluation(activityId, title, outcome, action, consequenceValue, probabilityValue);
  59 + dbs.insertEvaluation(newEval);
  60 +
  61 + intent.setClass(this, Evaluations.class);
  62 + startActivity(intent);
  63 + }
  64 + });
  65 +
  66 + }
  67 +
  68 + private int getConsequenceValue(String consequence) {
  69 + switch (consequence) {
  70 + case "Ufarlig": return 1;
  71 + case "Moderate": return 2;
  72 + case "Alvorlig": return 3;
  73 + default: return -1;
  74 + }
  75 + }
  76 +
  77 + private int getProbabilityValue(String probability) {
  78 + switch (probability) {
  79 + case "Lav": return 1;
  80 + case "Middels": return 2;
  81 + case "Stor": return 3;
  82 + default: return -1;
  83 + }
  84 + }
  85 +
  86 + private boolean inputAccepted() {
  87 + if (etNewEvalTitle.getText().toString().isEmpty()) return false;
  88 + if (etNewEvalAction.getText().toString().isEmpty()) return false;
  89 + if (etNewEvalOutcome.getText().toString().isEmpty()) return false;
  90 + return true;
26 91 }
27 92 }
... ...
Risiko/app/src/main/java/activity/NewIncident.java
... ... @@ -2,14 +2,36 @@ package activity;
2 2  
3 3 import android.support.v7.app.AppCompatActivity;
4 4 import android.os.Bundle;
  5 +import android.widget.ArrayAdapter;
  6 +import android.widget.EditText;
  7 +import android.widget.Spinner;
5 8  
6 9 import com.risiko.risiko.R;
7 10  
  11 +import java.util.ArrayList;
  12 +import java.util.List;
  13 +
  14 +import database.DatabaseSource;
  15 +import dataclasses.Incident;
  16 +
8 17 public class NewIncident extends AppCompatActivity {
9 18  
  19 + private EditText etDate, etLocation, etTitle, etDescripton;
  20 + private Spinner spinnerAssociatedRisk;
  21 + private DatabaseSource dbs;
  22 +
10 23 @Override
11 24 protected void onCreate(Bundle savedInstanceState) {
12 25 super.onCreate(savedInstanceState);
13 26 setContentView(R.layout.activity_new_incident);
  27 + dbs = new DatabaseSource(this);
  28 +
  29 + ArrayList<Incident> incidents = new ArrayList<>();
  30 + dbs.getAllIncidents(incidents);
  31 +
  32 + Spinner spinnerAssociatedRisk = (Spinner) findViewById(R.id.spinner_associated_risk);
  33 + ArrayAdapter<Incident> adapter = new ArrayAdapter<Incident>(this, android.R.layout.simple_spinner_item, incidents);
  34 + adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  35 + spinnerAssociatedRisk.setAdapter(adapter);
14 36 }
15 37 }
... ...
Risiko/app/src/main/java/adapters/ListAdapterEvaluations.java
... ... @@ -29,10 +29,10 @@ public class ListAdapterEvaluations extends ArrayAdapter&lt;Evaluation&gt; {
29 29 evaluationHeadline.setText(evaluation.getTitle());
30 30  
31 31 TextView probability = convertView.findViewById(R.id.tv_probability);
32   - probability.setText(evaluation.getProbability());
  32 + probability.setText(evaluation.getProbabilityString());
33 33  
34 34 TextView consequence = convertView.findViewById(R.id.tv_consequence);
35   - consequence.setText(evaluation.getConsequence());
  35 + consequence.setText(evaluation.getConsequenceString());
36 36  
37 37 return convertView;
38 38 }
... ...
Risiko/app/src/main/java/database/DatabaseSource.java
... ... @@ -49,26 +49,49 @@ public class DatabaseSource {
49 49 return insertId > -1;
50 50 }
51 51  
52   - public void getAllEvaluation(ArrayList<Evaluation> evaluations) {
  52 + public void getAllEvaluation(ArrayList<Evaluation> listToUpdate) {
53 53 SQLiteDatabase database = helper.getWritableDatabase();
54 54 Cursor cursor = database.rawQuery("select * from " + EvaluationTable.EVALUATION_TABLE, null);
55 55 cursor.moveToFirst();
56   - evaluations.clear();
  56 + listToUpdate.clear();
57 57 while (!cursor.isAfterLast()) {
58   - evaluations.add(cursorToEvaluation(cursor));
  58 + listToUpdate.add(cursorToEvaluation(cursor));
59 59 cursor.moveToNext();
60 60 }
61 61 cursor.close();
62 62 database.close();
63 63 }
64 64  
65   - public void getAllIncidents(ArrayList<Incident> incidents) {
  65 + public Evaluation getEvaluationById(int id) {
  66 + SQLiteDatabase database = helper.getWritableDatabase();
  67 + Cursor cursor = database.rawQuery("select * from " + EvaluationTable.EVALUATION_TABLE + " where " + EvaluationTable.EVALUATION_COL_ID + " = " + " ?", new String[]{String.valueOf(id)});
  68 + cursor.moveToFirst();
  69 + if (!cursor.isAfterLast())
  70 + return cursorToEvaluation(cursor);
  71 +
  72 + return new Evaluation();
  73 + }
  74 +
  75 + public void getAllEvaluationsForActivity(int activityId, ArrayList<Evaluation> listToUpdate) {
  76 + SQLiteDatabase database = helper.getWritableDatabase();
  77 + Cursor cursor = database.rawQuery("select * from " + EvaluationTable.EVALUATION_TABLE + " where " + EvaluationTable.EVALUATION_COL_ASSOCIATED_ACTIVITY + " = " + " ?", new String[]{String.valueOf(activityId)});
  78 + cursor.moveToFirst();
  79 + listToUpdate.clear();
  80 + while (!cursor.isAfterLast()) {
  81 + listToUpdate.add(cursorToEvaluation(cursor));
  82 + cursor.moveToNext();
  83 + }
  84 + cursor.close();
  85 + database.close();
  86 + }
  87 +
  88 + public void getAllIncidents(ArrayList<Incident> listToUpdate) {
66 89 SQLiteDatabase database = helper.getWritableDatabase();
67 90 Cursor cursor = database.rawQuery("select * from " + IncidentTable.INCIDENT_TABLE, null);
68 91 cursor.moveToFirst();
69   - incidents.clear();
  92 + listToUpdate.clear();
70 93 while (!cursor.isAfterLast()) {
71   - incidents.add(cursorToIncident(cursor));
  94 + listToUpdate.add(cursorToIncident(cursor));
72 95 cursor.moveToNext();
73 96 }
74 97 cursor.close();
... ...
Risiko/app/src/main/java/database/IncidentTable.java
... ... @@ -15,6 +15,7 @@ public class IncidentTable {
15 15 private static final String INCIDENT_TABLE_CREATE =
16 16 "CREATE TABLE IF NOT EXISTS " + INCIDENT_TABLE + " ("
17 17 + INCIDENT_COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
  18 + + INCIDENT_COL_ASSOCIATED_EVALUATION + " INTEGER, "
18 19 + INCIDENT_COL_TITLE + " TEXT, "
19 20 + INCIDENT_COL_DATE + " TEXT, "
20 21 + INCIDENT_COL_LOCATION + " TEXT, "
... ...
Risiko/app/src/main/java/dataclasses/Evaluation.java
... ... @@ -6,6 +6,9 @@ package dataclasses;
6 6  
7 7 public class Evaluation {
8 8  
  9 + public static final int CONSEQUENCE_HARMLESS = 1, CONSEQUENCE_MODERATE = 2, CONSEQUENCE_SEVERE = 3;
  10 + public static final int PROBABILITY_LOW = 1, PROBABILITY_MEDIUM = 2, PROBABILITY_HIGH = 3;
  11 +
9 12 int id;
10 13 int associatedActivity;
11 14 String title;
... ... @@ -17,8 +20,9 @@ public class Evaluation {
17 20 public Evaluation() {
18 21 }
19 22  
20   - public Evaluation(String title, String outcome, String measures, int consequence, int probability) {
  23 + public Evaluation(int associatedActivity, String title, String outcome, String measures, int consequence, int probability) {
21 24 this.title = title;
  25 + this.associatedActivity = associatedActivity;
22 26 this.outcome = outcome;
23 27 this.measures = measures;
24 28 this.consequence = consequence;
... ... @@ -61,6 +65,15 @@ public class Evaluation {
61 65 return consequence;
62 66 }
63 67  
  68 + public String getConsequenceString() {
  69 + switch (consequence) {
  70 + case CONSEQUENCE_HARMLESS: return "Ufarlig";
  71 + case CONSEQUENCE_MODERATE: return "Moderate";
  72 + case CONSEQUENCE_SEVERE: return "Alvorlig";
  73 + default: return "Ukjent";
  74 + }
  75 + }
  76 +
64 77 public void setConsequence(int consequence) {
65 78 this.consequence = consequence;
66 79 }
... ... @@ -69,6 +82,15 @@ public class Evaluation {
69 82 return probability;
70 83 }
71 84  
  85 + public String getProbabilityString() {
  86 + switch (probability) {
  87 + case PROBABILITY_LOW: return "Lav";
  88 + case PROBABILITY_MEDIUM: return "Middels";
  89 + case PROBABILITY_HIGH: return "Stor";
  90 + default: return "Ukjent";
  91 + }
  92 + }
  93 +
72 94 public void setProbability(int probability) {
73 95 this.probability = probability;
74 96 }
... ...
Risiko/app/src/main/res/layout/activity_new_evaluation.xml
... ... @@ -23,25 +23,28 @@
23 23  
24 24  
25 25 <EditText
26   - android:layout_marginVertical="10dp"
  26 + android:id="@+id/et_newEval_title"
27 27 android:layout_width="match_parent"
28 28 android:layout_height="wrap_content"
  29 + android:layout_marginVertical="10dp"
29 30 android:hint="Tittel:"
30   - android:inputType="text"/>
  31 + android:inputType="text" />
31 32  
32 33 <EditText
33   - android:layout_marginVertical="10dp"
  34 + android:id="@+id/et_newEval_outcome"
34 35 android:layout_width="match_parent"
35 36 android:layout_height="wrap_content"
  37 + android:layout_marginVertical="10dp"
36 38 android:hint="Mulig utfall:"
37   - android:inputType="text"/>
  39 + android:inputType="text" />
38 40  
39 41 <EditText
40   - android:layout_marginVertical="10dp"
  42 + android:id="@+id/et_newEval_action"
41 43 android:layout_width="match_parent"
42 44 android:layout_height="wrap_content"
  45 + android:layout_marginVertical="10dp"
43 46 android:hint="Tiltak:"
44   - android:inputType="text"/>
  47 + android:inputType="text" />
45 48  
46 49 <LinearLayout
47 50 android:padding="10dp"
... ... @@ -75,27 +78,28 @@
75 78 android:orientation="horizontal">
76 79  
77 80 <TextView
78   - android:layout_marginEnd="20dp"
79   - android:id="@+id/tv_associated_risk"
  81 + android:id="@+id/tv_probability"
80 82 android:layout_width="wrap_content"
81 83 android:layout_height="wrap_content"
  84 + android:layout_marginEnd="20dp"
  85 + android:text="@string/probability"
82 86 android:textSize="17sp"
83   - android:textStyle="bold"
84   - android:text="@string/probability" />
  87 + android:textStyle="bold" />
85 88  
86 89 <Spinner
87   - android:id="@+id/spinner_associated_risk"
  90 + android:id="@+id/spinner_probability"
88 91 android:layout_width="fill_parent"
89 92 android:layout_height="wrap_content" />
90 93  
91 94 </LinearLayout>
92 95  
93 96 <Button
94   - android:layout_marginTop="30dp"
95   - android:layout_gravity="center"
  97 + android:id="@+id/btn_new_eval"
96 98 android:layout_width="150dp"
97 99 android:layout_height="wrap_content"
98   - android:text="Legg til "/>
  100 + android:layout_gravity="center"
  101 + android:layout_marginTop="30dp"
  102 + android:text="Legg til " />
99 103  
100 104 </LinearLayout>
101 105  
... ...
Risiko/app/src/main/res/layout/activity_new_incident.xml
... ... @@ -22,30 +22,34 @@
22 22 app:layout_constraintTop_toTopOf="parent"/>
23 23  
24 24 <EditText
  25 + android:id="@+id/et_newIncident_date"
25 26 android:layout_width="match_parent"
26 27 android:layout_height="wrap_content"
27 28 android:hint="Dato:"
28   - android:inputType="date"/>
  29 + android:inputType="date" />
29 30  
30 31 <EditText
  32 + android:id="@+id/et_newIncident_location"
31 33 android:layout_width="match_parent"
32 34 android:layout_height="wrap_content"
33 35 android:hint="Sted:"
34   - android:inputType="text"/>
  36 + android:inputType="text" />
35 37  
36 38 <EditText
  39 + android:id="@+id/et_newIncident_title"
37 40 android:layout_width="match_parent"
38 41 android:layout_height="wrap_content"
39 42 android:hint="Tittel:"
40   - android:inputType="text"/>
  43 + android:inputType="text" />
41 44  
42 45 <EditText
  46 + android:id="@+id/et_newIncident_description"
43 47 android:layout_width="match_parent"
44 48 android:layout_height="wrap_content"
45 49 android:hint="Beskrivelse:"
46   - android:minLines="2"
  50 + android:inputType="textMultiLine"
47 51 android:maxLines="5"
48   - android:inputType="textMultiLine"/>
  52 + android:minLines="2" />
49 53  
50 54 <LinearLayout
51 55 android:padding="10dp"
... ... @@ -69,11 +73,12 @@
69 73  
70 74 </LinearLayout>
71 75  
72   - <Button
73   - android:layout_gravity="center"
74   - android:layout_width="wrap_content"
75   - android:layout_height="wrap_content"
76   - android:text="Lagre hendelse"/>
  76 + <Button
  77 + android:id="@+id/btn_newIncident"
  78 + android:layout_width="wrap_content"
  79 + android:layout_height="wrap_content"
  80 + android:layout_gravity="center"
  81 + android:text="Lagre hendelse" />
77 82  
78 83 </LinearLayout>
79 84  
... ...
Risiko/app/src/main/res/values/array.xml
... ... @@ -7,7 +7,7 @@
7 7 <item>Alvorlig</item>
8 8 </string-array>
9 9  
10   - <string-array name="associated_risk_array">
  10 + <string-array name="probability_array">
11 11 <item>Lav</item>
12 12 <item>Middels</item>
13 13 <item>Stor</item>
... ...