Commit 85beaaa902866783ffd17d98ba99565c537bf8bf

Authored by kristinlaahneolsen
1 parent 70b54cf8

Har ryddet i koden. Fjernet ting som ikke er i bruk, sjekket at alle TODO's er g…

…jort og formattert kode. Nå skal det være klart til å leveres
Showing 38 changed files with 652 additions and 739 deletions   Show diff stats
Risiko/app/src/main/java/activity/Accesslog.java
1 package activity; 1 package activity;
2 2
3 import android.content.Intent; 3 import android.content.Intent;
4 -import android.support.v7.app.AppCompatActivity;  
5 import android.os.Bundle; 4 import android.os.Bundle;
  5 +import android.support.v7.app.AppCompatActivity;
6 import android.support.v7.widget.Toolbar; 6 import android.support.v7.widget.Toolbar;
  7 +import android.util.Log;
7 import android.view.Menu; 8 import android.view.Menu;
8 import android.view.MenuItem; 9 import android.view.MenuItem;
9 import android.widget.ListView; 10 import android.widget.ListView;
10 -import android.widget.Toast;  
11 11
12 import com.risiko.risiko.R; 12 import com.risiko.risiko.R;
13 13
@@ -15,10 +15,8 @@ import java.util.ArrayList; @@ -15,10 +15,8 @@ import java.util.ArrayList;
15 import java.util.List; 15 import java.util.List;
16 16
17 import adapters.ListAdapterAccesslog; 17 import adapters.ListAdapterAccesslog;
18 -import adapters.ListAdapterEvaluationLog;  
19 import api.Api; 18 import api.Api;
20 -import dataclasses.*;  
21 -import dataclasses.EvaluationLog; 19 +import api.TokenEncrypter;
22 import retrofit2.Call; 20 import retrofit2.Call;
23 import retrofit2.Callback; 21 import retrofit2.Callback;
24 import retrofit2.Response; 22 import retrofit2.Response;
@@ -36,8 +34,6 @@ public class Accesslog extends AppCompatActivity { @@ -36,8 +34,6 @@ public class Accesslog extends AppCompatActivity {
36 Intent intent = getIntent(); 34 Intent intent = getIntent();
37 Bundle b = intent.getExtras(); 35 Bundle b = intent.getExtras();
38 String assosiatedincident = b.getString("associatedincitent"); 36 String assosiatedincident = b.getString("associatedincitent");
39 - System.out.println("ASSOSIATED INCIDENT" + assosiatedincident);  
40 -  
41 37
42 Api.getInstance().getAccesslog(assosiatedincident).enqueue(new Callback<List<dataclasses.Accesslog>>() { 38 Api.getInstance().getAccesslog(assosiatedincident).enqueue(new Callback<List<dataclasses.Accesslog>>() {
43 @Override 39 @Override
@@ -49,26 +45,22 @@ public class Accesslog extends AppCompatActivity { @@ -49,26 +45,22 @@ public class Accesslog extends AppCompatActivity {
49 if (log != null) { 45 if (log != null) {
50 for (dataclasses.Accesslog e : log) { 46 for (dataclasses.Accesslog e : log) {
51 logs.add(e); 47 logs.add(e);
52 -  
53 } 48 }
54 49
55 insertLog(logs); 50 insertLog(logs);
56 } 51 }
57 } 52 }
58 -  
59 } 53 }
60 54
61 @Override 55 @Override
62 public void onFailure(Call<List<dataclasses.Accesslog>> call, Throwable t) { 56 public void onFailure(Call<List<dataclasses.Accesslog>> call, Throwable t) {
63 - t.printStackTrace(); 57 + Log.d("Error", t.getMessage());
64 58
65 } 59 }
66 }); 60 });
67 61
68 } 62 }
69 63
70 - //TODO GJØRE DET SLIK AT VI FÅR SATT INN GRUPPENAVN i AKSSLOGGEN  
71 -  
72 private void insertLog(List<dataclasses.Accesslog> log) { 64 private void insertLog(List<dataclasses.Accesslog> log) {
73 lv = findViewById(R.id.lv_accesslog); 65 lv = findViewById(R.id.lv_accesslog);
74 lv.setAdapter(new ListAdapterAccesslog(this, log)); 66 lv.setAdapter(new ListAdapterAccesslog(this, log));
@@ -76,7 +68,7 @@ public class Accesslog extends AppCompatActivity { @@ -76,7 +68,7 @@ public class Accesslog extends AppCompatActivity {
76 68
77 69
78 @Override 70 @Override
79 - public boolean onCreateOptionsMenu (Menu menu) { 71 + public boolean onCreateOptionsMenu(Menu menu) {
80 getMenuInflater().inflate(R.menu.main, menu); 72 getMenuInflater().inflate(R.menu.main, menu);
81 return true; 73 return true;
82 } 74 }
@@ -86,9 +78,7 @@ public class Accesslog extends AppCompatActivity { @@ -86,9 +78,7 @@ public class Accesslog extends AppCompatActivity {
86 public boolean onOptionsItemSelected(MenuItem item) { 78 public boolean onOptionsItemSelected(MenuItem item) {
87 switch (item.getItemId()) { 79 switch (item.getItemId()) {
88 case R.id.action_logout: 80 case R.id.action_logout:
89 - //TODO: LEGG TIL LOGG-UT-FUNKSJON  
90 - Toast.makeText(Accesslog.this, "Logger ut",  
91 - Toast.LENGTH_LONG).show(); 81 + TokenEncrypter.logOut(this);
92 return true; 82 return true;
93 83
94 case R.id.action_home: 84 case R.id.action_home:
@@ -103,9 +93,9 @@ public class Accesslog extends AppCompatActivity { @@ -103,9 +93,9 @@ public class Accesslog extends AppCompatActivity {
103 return true; 93 return true;
104 94
105 default: 95 default:
  96 +
106 return super.onOptionsItemSelected(item); 97 return super.onOptionsItemSelected(item);
107 98
108 } 99 }
109 } 100 }
110 -  
111 } 101 }
Risiko/app/src/main/java/activity/Activities.java
1 package activity; 1 package activity;
2 2
3 import android.content.Intent; 3 import android.content.Intent;
4 -import android.support.v7.app.AppCompatActivity;  
5 import android.os.Bundle; 4 import android.os.Bundle;
  5 +import android.support.v7.app.AppCompatActivity;
6 import android.support.v7.widget.Toolbar; 6 import android.support.v7.widget.Toolbar;
7 import android.util.Log; 7 import android.util.Log;
8 import android.view.Menu; 8 import android.view.Menu;
9 import android.view.MenuItem; 9 import android.view.MenuItem;
10 import android.widget.ListView; 10 import android.widget.ListView;
11 -import android.widget.Toast;  
12 -  
13 import com.risiko.risiko.R; 11 import com.risiko.risiko.R;
14 -  
15 import java.util.List; 12 import java.util.List;
16 import adapters.ListAdapterActivities; 13 import adapters.ListAdapterActivities;
17 import api.Api; 14 import api.Api;
@@ -46,13 +43,10 @@ public class Activities extends AppCompatActivity { @@ -46,13 +43,10 @@ public class Activities extends AppCompatActivity {
46 43
47 @Override 44 @Override
48 public void onFailure(Call<List<Activity>> call, Throwable t) { 45 public void onFailure(Call<List<Activity>> call, Throwable t) {
49 - //Something went completely south (maybe you lost internet connection)  
50 Log.d("Error", t.getMessage()); 46 Log.d("Error", t.getMessage());
51 } 47 }
52 }); 48 });
53 - }  
54 -  
55 - 49 + }
56 50
57 private void insertActivities(List<Activity> activities) { 51 private void insertActivities(List<Activity> activities) {
58 lv = findViewById(R.id.lv_activities); 52 lv = findViewById(R.id.lv_activities);
@@ -72,7 +66,7 @@ public class Activities extends AppCompatActivity { @@ -72,7 +66,7 @@ public class Activities extends AppCompatActivity {
72 } 66 }
73 67
74 @Override 68 @Override
75 - public boolean onCreateOptionsMenu (Menu menu) { 69 + public boolean onCreateOptionsMenu(Menu menu) {
76 getMenuInflater().inflate(R.menu.main, menu); 70 getMenuInflater().inflate(R.menu.main, menu);
77 return true; 71 return true;
78 } 72 }
@@ -100,5 +94,4 @@ public class Activities extends AppCompatActivity { @@ -100,5 +94,4 @@ public class Activities extends AppCompatActivity {
100 94
101 } 95 }
102 } 96 }
103 -  
104 } 97 }
Risiko/app/src/main/java/activity/EditEvaluation.java
1 package activity; 1 package activity;
2 2
3 import android.content.Intent; 3 import android.content.Intent;
4 -import android.icu.util.Measure;  
5 -import android.support.v7.app.AppCompatActivity;  
6 import android.os.Bundle; 4 import android.os.Bundle;
  5 +import android.support.v7.app.AppCompatActivity;
7 import android.support.v7.widget.Toolbar; 6 import android.support.v7.widget.Toolbar;
  7 +import android.util.Log;
8 import android.view.MenuItem; 8 import android.view.MenuItem;
9 import android.widget.ArrayAdapter; 9 import android.widget.ArrayAdapter;
10 import android.widget.Button; 10 import android.widget.Button;
11 import android.widget.EditText; 11 import android.widget.EditText;
12 import android.widget.Spinner; 12 import android.widget.Spinner;
13 -import android.widget.Toast;  
14 -  
15 import com.risiko.risiko.R; 13 import com.risiko.risiko.R;
16 -  
17 import java.text.DateFormat; 14 import java.text.DateFormat;
18 import java.text.SimpleDateFormat; 15 import java.text.SimpleDateFormat;
19 import java.util.Calendar; 16 import java.util.Calendar;
20 import java.util.Date; 17 import java.util.Date;
21 import java.util.Set; 18 import java.util.Set;
22 import java.util.TreeSet; 19 import java.util.TreeSet;
23 -  
24 import api.Api; 20 import api.Api;
25 import api.TokenEncrypter; 21 import api.TokenEncrypter;
26 -import dataclasses.*; 22 +import dataclasses.Evaluation;
  23 +import dataclasses.User;
27 import retrofit2.Call; 24 import retrofit2.Call;
28 import retrofit2.Callback; 25 import retrofit2.Callback;
29 import retrofit2.Response; 26 import retrofit2.Response;
30 27
31 public class EditEvaluation extends AppCompatActivity { 28 public class EditEvaluation extends AppCompatActivity {
  29 + Button editEvaluation;
  30 + String token;
32 private EditText etTitle; 31 private EditText etTitle;
33 private EditText etOutcome; 32 private EditText etOutcome;
34 private EditText etMeasures; 33 private EditText etMeasures;
35 private Spinner spinnerConsequence, spinnerProbability; 34 private Spinner spinnerConsequence, spinnerProbability;
36 - Button editEvaluation;  
37 - String allFieldsChanged, titleChanged, measuresChanged, outcomeChanged, consequenceChanged, probabilityChanged;  
38 - String token;  
39 -  
40 35
41 @Override 36 @Override
42 protected void onCreate(Bundle savedInstanceState) { 37 protected void onCreate(Bundle savedInstanceState) {
@@ -57,7 +52,6 @@ public class EditEvaluation extends AppCompatActivity { @@ -57,7 +52,6 @@ public class EditEvaluation extends AppCompatActivity {
57 String assosiatedActivity = b.getString("associatedActivity"); 52 String assosiatedActivity = b.getString("associatedActivity");
58 setupSpinners(consequence, probability); 53 setupSpinners(consequence, probability);
59 54
60 -  
61 etTitle = findViewById(R.id.et_editEval_title); 55 etTitle = findViewById(R.id.et_editEval_title);
62 etOutcome = findViewById(R.id.et_editEval_outcome); 56 etOutcome = findViewById(R.id.et_editEval_outcome);
63 etMeasures = findViewById(R.id.et_editEval_action); 57 etMeasures = findViewById(R.id.et_editEval_action);
@@ -89,36 +83,35 @@ public class EditEvaluation extends AppCompatActivity { @@ -89,36 +83,35 @@ public class EditEvaluation extends AppCompatActivity {
89 83
90 Set<String> setInput = new TreeSet(); 84 Set<String> setInput = new TreeSet();
91 85
92 - if(!newtitle.equals(title)) 86 + if (!newtitle.equals(title))
93 setInput.add("tittel"); 87 setInput.add("tittel");
94 - if(!newOutcome.equals(outcome)) 88 + if (!newOutcome.equals(outcome))
95 setInput.add("utfall"); 89 setInput.add("utfall");
96 - if(!newMeasures.equals(measures)) 90 + if (!newMeasures.equals(measures))
97 setInput.add("tiltak"); 91 setInput.add("tiltak");
98 - if(consequenceValue!=consequence) 92 + if (consequenceValue != consequence)
99 setInput.add("konsekvens"); 93 setInput.add("konsekvens");
100 - if(probabilityValue!=probability ) 94 + if (probabilityValue != probability)
101 setInput.add("sannsynlighet"); 95 setInput.add("sannsynlighet");
102 96
103 - StringBuilder sb= new StringBuilder(); 97 + StringBuilder sb = new StringBuilder();
104 98
105 - for(String tempString:setInput){ 99 + for (String tempString : setInput) {
106 sb.append(tempString).append(", "); 100 sb.append(tempString).append(", ");
107 } 101 }
108 102
109 String fieldschanged = sb.toString(); 103 String fieldschanged = sb.toString();
110 - System.out.println("FØLGENDE FELT BLE OPPDATERT: " + fieldschanged);  
111 logchanges(fieldschanged, logDate, id); 104 logchanges(fieldschanged, logDate, id);
112 105
113 Api.getInstance().editEvaluation(id, newtitle, newOutcome, newMeasures, consequenceValue, probabilityValue, assosiatedActivity).enqueue(new Callback<Evaluation>() { 106 Api.getInstance().editEvaluation(id, newtitle, newOutcome, newMeasures, consequenceValue, probabilityValue, assosiatedActivity).enqueue(new Callback<Evaluation>() {
114 @Override 107 @Override
115 public void onResponse(Call<Evaluation> call, Response<Evaluation> response) { 108 public void onResponse(Call<Evaluation> call, Response<Evaluation> response) {
116 - System.out.println(response); 109 +
117 } 110 }
118 111
119 @Override 112 @Override
120 public void onFailure(Call<Evaluation> call, Throwable t) { 113 public void onFailure(Call<Evaluation> call, Throwable t) {
121 - t.printStackTrace(); 114 + Log.d("Error", t.getMessage());
122 115
123 } 116 }
124 }); 117 });
@@ -126,7 +119,6 @@ public class EditEvaluation extends AppCompatActivity { @@ -126,7 +119,6 @@ public class EditEvaluation extends AppCompatActivity {
126 } 119 }
127 finish(); 120 finish();
128 goBackToActivities(); 121 goBackToActivities();
129 -  
130 }); 122 });
131 } 123 }
132 124
@@ -142,12 +134,12 @@ public class EditEvaluation extends AppCompatActivity { @@ -142,12 +134,12 @@ public class EditEvaluation extends AppCompatActivity {
142 Api.getInstance().newLogEntry(response.body().getName(), date, fieldsChanged, assosiatedEval).enqueue(new Callback<String>() { 134 Api.getInstance().newLogEntry(response.body().getName(), date, fieldsChanged, assosiatedEval).enqueue(new Callback<String>() {
143 @Override 135 @Override
144 public void onResponse(Call<String> call, Response<String> response) { 136 public void onResponse(Call<String> call, Response<String> response) {
145 - System.out.println(response); 137 +
146 } 138 }
147 139
148 @Override 140 @Override
149 public void onFailure(Call<String> call, Throwable t) { 141 public void onFailure(Call<String> call, Throwable t) {
150 - t.printStackTrace(); 142 + Log.d("Error", t.getMessage());
151 143
152 } 144 }
153 }); 145 });
@@ -159,10 +151,8 @@ public class EditEvaluation extends AppCompatActivity { @@ -159,10 +151,8 @@ public class EditEvaluation extends AppCompatActivity {
159 } 151 }
160 }); 152 });
161 153
162 -  
163 } 154 }
164 155
165 -  
166 private void goBackToActivities() { 156 private void goBackToActivities() {
167 Intent intent = new Intent(this, Activities.class); 157 Intent intent = new Intent(this, Activities.class);
168 startActivity(intent); 158 startActivity(intent);
@@ -193,19 +183,27 @@ public class EditEvaluation extends AppCompatActivity { @@ -193,19 +183,27 @@ public class EditEvaluation extends AppCompatActivity {
193 183
194 private int getConsequenceValue(String consequence) { 184 private int getConsequenceValue(String consequence) {
195 switch (consequence) { 185 switch (consequence) {
196 - case "Ufarlig": return 1;  
197 - case "Moderate": return 2;  
198 - case "Alvorlig": return 3;  
199 - default: return -1; 186 + case "Ufarlig":
  187 + return 1;
  188 + case "Moderate":
  189 + return 2;
  190 + case "Alvorlig":
  191 + return 3;
  192 + default:
  193 + return -1;
200 } 194 }
201 } 195 }
202 196
203 private int getProbabilityValue(String probability) { 197 private int getProbabilityValue(String probability) {
204 switch (probability) { 198 switch (probability) {
205 - case "Lav": return 1;  
206 - case "Middels": return 2;  
207 - case "Stor": return 3;  
208 - default: return -1; 199 + case "Lav":
  200 + return 1;
  201 + case "Middels":
  202 + return 2;
  203 + case "Stor":
  204 + return 3;
  205 + default:
  206 + return -1;
209 } 207 }
210 } 208 }
211 209
Risiko/app/src/main/java/activity/EditIncident.java
@@ -12,12 +12,9 @@ import android.widget.Button; @@ -12,12 +12,9 @@ import android.widget.Button;
12 import android.widget.EditText; 12 import android.widget.EditText;
13 import android.widget.Spinner; 13 import android.widget.Spinner;
14 import android.widget.Toast; 14 import android.widget.Toast;
15 -  
16 import com.risiko.risiko.R; 15 import com.risiko.risiko.R;
17 -  
18 import java.util.HashMap; 16 import java.util.HashMap;
19 import java.util.List; 17 import java.util.List;
20 -  
21 import api.Api; 18 import api.Api;
22 import api.TokenEncrypter; 19 import api.TokenEncrypter;
23 import dataclasses.Evaluation; 20 import dataclasses.Evaluation;
@@ -93,16 +90,13 @@ public class EditIncident extends AppCompatActivity { @@ -93,16 +90,13 @@ public class EditIncident extends AppCompatActivity {
93 Api.getInstance().editIncident(id, newdate, newlocation, newtitle, newdescription, associatedRisk).enqueue(new Callback<dataclasses.Incident>() { 90 Api.getInstance().editIncident(id, newdate, newlocation, newtitle, newdescription, associatedRisk).enqueue(new Callback<dataclasses.Incident>() {
94 @Override 91 @Override
95 public void onResponse(Call<Incident> call, Response<Incident> response) { 92 public void onResponse(Call<Incident> call, Response<Incident> response) {
96 - System.out.println(response);  
97 93
98 } 94 }
99 95
100 -  
101 @Override 96 @Override
102 public void onFailure(Call<Incident> call, Throwable t) { 97 public void onFailure(Call<Incident> call, Throwable t) {
103 - t.printStackTrace(); 98 + Log.d("Error", t.getMessage());
104 } 99 }
105 -  
106 }); 100 });
107 } 101 }
108 102
@@ -110,23 +104,18 @@ public class EditIncident extends AppCompatActivity { @@ -110,23 +104,18 @@ public class EditIncident extends AppCompatActivity {
110 goBackToIncidents(); 104 goBackToIncidents();
111 105
112 }); 106 });
113 -  
114 -  
115 } 107 }
116 } 108 }
117 } 109 }
118 110
119 @Override 111 @Override
120 public void onFailure(Call<List<dataclasses.Evaluation>> call, Throwable t) { 112 public void onFailure(Call<List<dataclasses.Evaluation>> call, Throwable t) {
121 - //Something went completely south (maybe you lost internet connection)  
122 Toast.makeText(EditIncident.this, "Something went wrong", 113 Toast.makeText(EditIncident.this, "Something went wrong",
123 Toast.LENGTH_LONG).show(); 114 Toast.LENGTH_LONG).show();
124 Log.d("Error", t.getMessage()); 115 Log.d("Error", t.getMessage());
125 } 116 }
126 }); 117 });
127 -  
128 -  
129 - } 118 + }
130 119
131 private void goBackToIncidents() { 120 private void goBackToIncidents() {
132 Intent intent = new Intent(this, activity.Incident.class); 121 Intent intent = new Intent(this, activity.Incident.class);
@@ -179,8 +168,6 @@ public class EditIncident extends AppCompatActivity { @@ -179,8 +168,6 @@ public class EditIncident extends AppCompatActivity {
179 168
180 } 169 }
181 } 170 }
182 -  
183 -  
184 } 171 }
185 172
186 173
Risiko/app/src/main/java/activity/EvaluationLog.java
1 package activity; 1 package activity;
2 2
3 import android.content.Intent; 3 import android.content.Intent;
4 -import android.support.v7.app.AppCompatActivity;  
5 import android.os.Bundle; 4 import android.os.Bundle;
  5 +import android.support.v7.app.AppCompatActivity;
6 import android.support.v7.widget.Toolbar; 6 import android.support.v7.widget.Toolbar;
  7 +import android.util.Log;
7 import android.view.Menu; 8 import android.view.Menu;
8 import android.view.MenuItem; 9 import android.view.MenuItem;
9 import android.widget.ListView; 10 import android.widget.ListView;
10 -import android.widget.Toast;  
11 -  
12 import com.risiko.risiko.R; 11 import com.risiko.risiko.R;
13 -  
14 import java.util.ArrayList; 12 import java.util.ArrayList;
15 -import java.util.Date;  
16 import java.util.List; 13 import java.util.List;
17 -  
18 -import adapters.ListAdapterActivities;  
19 import adapters.ListAdapterEvaluationLog; 14 import adapters.ListAdapterEvaluationLog;
20 import api.Api; 15 import api.Api;
21 import api.TokenEncrypter; 16 import api.TokenEncrypter;
22 -import dataclasses.Activity;  
23 -import dataclasses.Evaluation;  
24 import retrofit2.Call; 17 import retrofit2.Call;
25 import retrofit2.Callback; 18 import retrofit2.Callback;
26 import retrofit2.Response; 19 import retrofit2.Response;
@@ -28,7 +21,6 @@ import retrofit2.Response; @@ -28,7 +21,6 @@ import retrofit2.Response;
28 public class EvaluationLog extends AppCompatActivity { 21 public class EvaluationLog extends AppCompatActivity {
29 ListView lv; 22 ListView lv;
30 23
31 -  
32 @Override 24 @Override
33 protected void onCreate(Bundle savedInstanceState) { 25 protected void onCreate(Bundle savedInstanceState) {
34 super.onCreate(savedInstanceState); 26 super.onCreate(savedInstanceState);
@@ -39,36 +31,32 @@ public class EvaluationLog extends AppCompatActivity { @@ -39,36 +31,32 @@ public class EvaluationLog extends AppCompatActivity {
39 Intent intent = getIntent(); 31 Intent intent = getIntent();
40 Bundle b = intent.getExtras(); 32 Bundle b = intent.getExtras();
41 String assosiatedeval = b.getString("assosiatedeval"); 33 String assosiatedeval = b.getString("assosiatedeval");
42 -/*  
43 - List<dataclasses.EvaluationLog> log = new ArrayList<>();  
44 - log.add(new dataclasses.EvaluationLog("Ola Nordmann", "2015-02-02", "Alle", assosiatedeval));  
45 - log.add(new dataclasses.EvaluationLog("Kari Nordmann", "2015-01-02", "Tittel, konsekvens", assosiatedeval));  
46 - insertLog(log);*/  
47 -  
48 - Api.getInstance().getEvaluationLog(assosiatedeval).enqueue(new Callback<List<dataclasses.EvaluationLog>>() {  
49 - @Override  
50 - public void onResponse(Call<List<dataclasses.EvaluationLog>> call, Response<List<dataclasses.EvaluationLog>> response) {  
51 - if (response.isSuccessful()) {  
52 - List<dataclasses.EvaluationLog> log = response.body();  
53 - List<dataclasses.EvaluationLog> logs = new ArrayList<>();  
54 -  
55 - if (log != null) {  
56 - for (dataclasses.EvaluationLog e : log) {  
57 - logs.add(e);  
58 -  
59 - }  
60 - insertLog(logs);  
61 - }  
62 - }  
63 - }  
64 -  
65 -  
66 - @Override  
67 - public void onFailure(Call<List<dataclasses.EvaluationLog>> call, Throwable t) {  
68 - t.printStackTrace();  
69 -  
70 - }  
71 - }); 34 +
  35 + Api.getInstance().getEvaluationLog(assosiatedeval).enqueue(new Callback<List<dataclasses.EvaluationLog>>() {
  36 + @Override
  37 + public void onResponse(Call<List<dataclasses.EvaluationLog>> call, Response<List<dataclasses.EvaluationLog>> response) {
  38 + if (response.isSuccessful()) {
  39 + List<dataclasses.EvaluationLog> log = response.body();
  40 + List<dataclasses.EvaluationLog> logs = new ArrayList<>();
  41 +
  42 + if (log != null) {
  43 + for (dataclasses.EvaluationLog e : log) {
  44 + logs.add(e);
  45 +
  46 + }
  47 +
  48 + insertLog(logs);
  49 + }
  50 + }
  51 + }
  52 +
  53 +
  54 + @Override
  55 + public void onFailure(Call<List<dataclasses.EvaluationLog>> call, Throwable t) {
  56 + Log.d("Error", t.getMessage());
  57 +
  58 + }
  59 + });
72 } 60 }
73 61
74 private void insertLog(List<dataclasses.EvaluationLog> log) { 62 private void insertLog(List<dataclasses.EvaluationLog> log) {
@@ -76,9 +64,8 @@ public class EvaluationLog extends AppCompatActivity { @@ -76,9 +64,8 @@ public class EvaluationLog extends AppCompatActivity {
76 lv.setAdapter(new ListAdapterEvaluationLog(this, log)); 64 lv.setAdapter(new ListAdapterEvaluationLog(this, log));
77 } 65 }
78 66
79 -  
80 @Override 67 @Override
81 - public boolean onCreateOptionsMenu (Menu menu) { 68 + public boolean onCreateOptionsMenu(Menu menu) {
82 getMenuInflater().inflate(R.menu.main, menu); 69 getMenuInflater().inflate(R.menu.main, menu);
83 return true; 70 return true;
84 } 71 }
Risiko/app/src/main/java/activity/Evaluations.java
@@ -79,7 +79,6 @@ public class Evaluations extends AppCompatActivity { @@ -79,7 +79,6 @@ public class Evaluations extends AppCompatActivity {
79 79
80 @Override 80 @Override
81 public void onFailure(Call<List<Evaluation>> call, Throwable t) { 81 public void onFailure(Call<List<Evaluation>> call, Throwable t) {
82 - //Something went completely south (maybe you lost internet connection)  
83 Log.d("Error", t.getMessage()); 82 Log.d("Error", t.getMessage());
84 } 83 }
85 }); 84 });
Risiko/app/src/main/java/activity/Incident.java
@@ -14,19 +14,13 @@ import android.view.View; @@ -14,19 +14,13 @@ import android.view.View;
14 import android.widget.Button; 14 import android.widget.Button;
15 import android.widget.ListView; 15 import android.widget.ListView;
16 import android.widget.TextView; 16 import android.widget.TextView;
17 -import android.widget.Toast;  
18 -  
19 import com.risiko.risiko.R; 17 import com.risiko.risiko.R;
20 -  
21 -import java.security.MessageDigest;  
22 -import java.security.NoSuchAlgorithmException;  
23 import java.text.DateFormat; 18 import java.text.DateFormat;
24 import java.text.SimpleDateFormat; 19 import java.text.SimpleDateFormat;
25 import java.util.ArrayList; 20 import java.util.ArrayList;
26 import java.util.Calendar; 21 import java.util.Calendar;
27 import java.util.Date; 22 import java.util.Date;
28 import java.util.List; 23 import java.util.List;
29 -  
30 import adapters.ListAdapterIncidents; 24 import adapters.ListAdapterIncidents;
31 import api.Api; 25 import api.Api;
32 import api.TokenEncrypter; 26 import api.TokenEncrypter;
@@ -56,11 +50,6 @@ public class Incident extends AppCompatActivity { @@ -56,11 +50,6 @@ public class Incident extends AppCompatActivity {
56 50
57 dbs = new DatabaseSource(this); 51 dbs = new DatabaseSource(this);
58 52
59 -// ArrayList<dataclasses.Incident> incidentList = new ArrayList<>();  
60 -// dbs.getAllIncidents(incidentList);  
61 -// insertEvents(incidentList);  
62 -  
63 -  
64 Api.getInstance().getAllIncidents() 53 Api.getInstance().getAllIncidents()
65 .enqueue(new Callback<List<dataclasses.Incident>>() { 54 .enqueue(new Callback<List<dataclasses.Incident>>() {
66 55
@@ -103,8 +92,7 @@ public class Incident extends AppCompatActivity { @@ -103,8 +92,7 @@ public class Incident extends AppCompatActivity {
103 Log.d("Error", t.getMessage()); 92 Log.d("Error", t.getMessage());
104 } 93 }
105 }); 94 });
106 - }  
107 - 95 + }
108 96
109 private void insertEvents(List<dataclasses.Incident> incident) { 97 private void insertEvents(List<dataclasses.Incident> incident) {
110 DateFormat df = new SimpleDateFormat("dd/MM/yyyy HH:mm"); 98 DateFormat df = new SimpleDateFormat("dd/MM/yyyy HH:mm");
@@ -133,6 +121,7 @@ public class Incident extends AppCompatActivity { @@ -133,6 +121,7 @@ public class Incident extends AppCompatActivity {
133 121
134 @Override 122 @Override
135 public void onFailure(Call<String> call, Throwable t) { 123 public void onFailure(Call<String> call, Throwable t) {
  124 + Log.d("Error", t.getMessage());
136 125
137 } 126 }
138 }); 127 });
@@ -141,6 +130,7 @@ public class Incident extends AppCompatActivity { @@ -141,6 +130,7 @@ public class Incident extends AppCompatActivity {
141 130
142 @Override 131 @Override
143 public void onFailure(Call<User> call, Throwable t) { 132 public void onFailure(Call<User> call, Throwable t) {
  133 + Log.d("Error", t.getMessage());
144 134
145 } 135 }
146 }); 136 });
@@ -181,6 +171,7 @@ public class Incident extends AppCompatActivity { @@ -181,6 +171,7 @@ public class Incident extends AppCompatActivity {
181 171
182 @Override 172 @Override
183 public void onFailure(Call<User> call, Throwable t) { 173 public void onFailure(Call<User> call, Throwable t) {
  174 + Log.d("Error", t.getMessage());
184 175
185 } 176 }
186 }); 177 });
@@ -195,7 +186,7 @@ public class Incident extends AppCompatActivity { @@ -195,7 +186,7 @@ public class Incident extends AppCompatActivity {
195 186
196 @Override 187 @Override
197 public void onFailure(Call<Evaluation> call, Throwable t) { 188 public void onFailure(Call<Evaluation> call, Throwable t) {
198 - t.printStackTrace(); 189 + Log.d("Error", t.getMessage());
199 190
200 } 191 }
201 }); 192 });
@@ -206,10 +197,6 @@ public class Incident extends AppCompatActivity { @@ -206,10 +197,6 @@ public class Incident extends AppCompatActivity {
206 tvLocation.setText(chosenItem.getLocation()); 197 tvLocation.setText(chosenItem.getLocation());
207 tvDescription.setText(chosenItem.getDescription()); 198 tvDescription.setText(chosenItem.getDescription());
208 addedBy.setText(chosenItem.getCreatedby()); 199 addedBy.setText(chosenItem.getCreatedby());
209 -  
210 - Evaluation associatedEvaluation = dbs.getEvaluationById(chosenItem.getAssociatedeval());  
211 -  
212 -  
213 alertDialogBuilder.setCancelable(false) 200 alertDialogBuilder.setCancelable(false)
214 .setNegativeButton(getString(R.string.cancel), 201 .setNegativeButton(getString(R.string.cancel),
215 (dialog, id) -> dialog.cancel()); 202 (dialog, id) -> dialog.cancel());
@@ -236,7 +223,6 @@ public class Incident extends AppCompatActivity { @@ -236,7 +223,6 @@ public class Incident extends AppCompatActivity {
236 223
237 } 224 }
238 225
239 -  
240 private void deleteEventDialog() { 226 private void deleteEventDialog() {
241 new AlertDialog.Builder(this) 227 new AlertDialog.Builder(this)
242 .setTitle(R.string.delete) 228 .setTitle(R.string.delete)
@@ -293,5 +279,4 @@ public class Incident extends AppCompatActivity { @@ -293,5 +279,4 @@ public class Incident extends AppCompatActivity {
293 279
294 } 280 }
295 } 281 }
296 -  
297 } 282 }
Risiko/app/src/main/java/activity/Information.java
@@ -6,10 +6,7 @@ import android.os.Bundle; @@ -6,10 +6,7 @@ import android.os.Bundle;
6 import android.support.v7.widget.Toolbar; 6 import android.support.v7.widget.Toolbar;
7 import android.view.Menu; 7 import android.view.Menu;
8 import android.view.MenuItem; 8 import android.view.MenuItem;
9 -import android.widget.Toast;  
10 -  
11 import com.risiko.risiko.R; 9 import com.risiko.risiko.R;
12 -  
13 import api.TokenEncrypter; 10 import api.TokenEncrypter;
14 11
15 public class Information extends AppCompatActivity { 12 public class Information extends AppCompatActivity {
Risiko/app/src/main/java/activity/MainMenu.java
1 package activity; 1 package activity;
2 2
3 import android.content.Intent; 3 import android.content.Intent;
4 -import android.support.v7.app.AppCompatActivity;  
5 import android.os.Bundle; 4 import android.os.Bundle;
  5 +import android.support.v7.app.AppCompatActivity;
6 import android.support.v7.widget.Toolbar; 6 import android.support.v7.widget.Toolbar;
7 import android.view.Menu; 7 import android.view.Menu;
8 import android.view.MenuItem; 8 import android.view.MenuItem;
@@ -32,7 +32,7 @@ public class MainMenu extends AppCompatActivity { @@ -32,7 +32,7 @@ public class MainMenu extends AppCompatActivity {
32 toActivityList = findViewById(R.id.btn_to_activitylist); 32 toActivityList = findViewById(R.id.btn_to_activitylist);
33 toActivityList.setOnClickListener(newview -> startActivity(new Intent(this, Activities.class))); 33 toActivityList.setOnClickListener(newview -> startActivity(new Intent(this, Activities.class)));
34 34
35 - toSequences= findViewById(R.id.btn_to_sequense_of_activities); 35 + toSequences = findViewById(R.id.btn_to_sequense_of_activities);
36 toSequences.setOnClickListener(newview -> startActivity(new Intent(this, SequenceOfActivities.class))); 36 toSequences.setOnClickListener(newview -> startActivity(new Intent(this, SequenceOfActivities.class)));
37 37
38 toEventList = findViewById(R.id.btn_to_events); 38 toEventList = findViewById(R.id.btn_to_events);
@@ -44,7 +44,7 @@ public class MainMenu extends AppCompatActivity { @@ -44,7 +44,7 @@ public class MainMenu extends AppCompatActivity {
44 } 44 }
45 45
46 @Override 46 @Override
47 - public boolean onCreateOptionsMenu (Menu menu) { 47 + public boolean onCreateOptionsMenu(Menu menu) {
48 getMenuInflater().inflate(R.menu.main, menu); 48 getMenuInflater().inflate(R.menu.main, menu);
49 return true; 49 return true;
50 } 50 }
@@ -68,12 +68,10 @@ public class MainMenu extends AppCompatActivity { @@ -68,12 +68,10 @@ public class MainMenu extends AppCompatActivity {
68 return true; 68 return true;
69 69
70 70
71 -  
72 default: 71 default:
73 72
74 return super.onOptionsItemSelected(item); 73 return super.onOptionsItemSelected(item);
75 74
76 } 75 }
77 } 76 }
78 -  
79 } 77 }
Risiko/app/src/main/java/activity/MainPage.java
@@ -12,17 +12,9 @@ import android.view.View; @@ -12,17 +12,9 @@ import android.view.View;
12 import android.widget.Button; 12 import android.widget.Button;
13 import android.widget.EditText; 13 import android.widget.EditText;
14 import android.widget.TextView; 14 import android.widget.TextView;
15 -import android.widget.Toast;  
16 -  
17 import com.risiko.risiko.R; 15 import com.risiko.risiko.R;
18 -  
19 import api.APILoginService; 16 import api.APILoginService;
20 -import api.Api;  
21 -import api.TokenEncrypter;  
22 -import dataclasses.User;  
23 -import retrofit2.Call;  
24 -import retrofit2.Callback;  
25 -import retrofit2.Response; 17 +
26 18
27 public class MainPage extends AppCompatActivity { 19 public class MainPage extends AppCompatActivity {
28 Button toMainMenu; 20 Button toMainMenu;
@@ -52,6 +44,7 @@ public class MainPage extends AppCompatActivity { @@ -52,6 +44,7 @@ public class MainPage extends AppCompatActivity {
52 * First it checks the string values in password and username. If they pass the test the progress "loading" icon will be shown and the information will be sent to the LoginService. 44 * First it checks the string values in password and username. If they pass the test the progress "loading" icon will be shown and the information will be sent to the LoginService.
53 * 45 *
54 */ 46 */
  47 +
55 private void attemptLogin() { 48 private void attemptLogin() {
56 System.out.println("0"); 49 System.out.println("0");
57 50
Risiko/app/src/main/java/activity/NewEvaluation.java
1 package activity; 1 package activity;
2 2
3 import android.content.Intent; 3 import android.content.Intent;
4 -import android.support.v7.app.AppCompatActivity;  
5 import android.os.Bundle; 4 import android.os.Bundle;
  5 +import android.support.v7.app.AppCompatActivity;
6 import android.support.v7.widget.Toolbar; 6 import android.support.v7.widget.Toolbar;
  7 +import android.util.Log;
7 import android.view.Menu; 8 import android.view.Menu;
8 import android.view.MenuItem; 9 import android.view.MenuItem;
9 import android.widget.ArrayAdapter; 10 import android.widget.ArrayAdapter;
10 import android.widget.Button; 11 import android.widget.Button;
11 import android.widget.EditText; 12 import android.widget.EditText;
12 import android.widget.Spinner; 13 import android.widget.Spinner;
13 -import android.widget.Toast;  
14 14
15 import com.risiko.risiko.R; 15 import com.risiko.risiko.R;
16 16
@@ -26,11 +26,11 @@ import retrofit2.Response; @@ -26,11 +26,11 @@ import retrofit2.Response;
26 26
27 public class NewEvaluation extends AppCompatActivity { 27 public class NewEvaluation extends AppCompatActivity {
28 28
  29 + DatabaseSource dbs;
  30 + String token;
29 private EditText etNewEvalTitle, etNewEvalOutcome, etNewEvalAction; 31 private EditText etNewEvalTitle, etNewEvalOutcome, etNewEvalAction;
30 private Spinner spinnerConsequence, spinnerProbability; 32 private Spinner spinnerConsequence, spinnerProbability;
31 private Button btnNewEval; 33 private Button btnNewEval;
32 - DatabaseSource dbs;  
33 - String token;  
34 34
35 @Override 35 @Override
36 protected void onCreate(Bundle savedInstanceState) { 36 protected void onCreate(Bundle savedInstanceState) {
@@ -72,15 +72,14 @@ public class NewEvaluation extends AppCompatActivity { @@ -72,15 +72,14 @@ public class NewEvaluation extends AppCompatActivity {
72 } 72 }
73 73
74 74
75 - Api.getInstance().newEvaluation(title, UUID.randomUUID().toString() ,activityId,consequenceValue,action,outcome,probabilityValue, response.body().getName()).enqueue(new Callback<String>() { 75 + Api.getInstance().newEvaluation(title, UUID.randomUUID().toString(), activityId, consequenceValue, action, outcome, probabilityValue, response.body().getName()).enqueue(new Callback<String>() {
76 @Override 76 @Override
77 public void onResponse(Call<String> call, Response<String> response) { 77 public void onResponse(Call<String> call, Response<String> response) {
78 - System.out.println(response);  
79 } 78 }
80 79
81 @Override 80 @Override
82 public void onFailure(Call<String> call, Throwable t) { 81 public void onFailure(Call<String> call, Throwable t) {
83 - t.printStackTrace(); 82 + Log.d("Error", t.getMessage());
84 } 83 }
85 }); 84 });
86 } 85 }
@@ -90,12 +89,7 @@ public class NewEvaluation extends AppCompatActivity { @@ -90,12 +89,7 @@ public class NewEvaluation extends AppCompatActivity {
90 TokenEncrypter.logOut(NewEvaluation.this); 89 TokenEncrypter.logOut(NewEvaluation.this);
91 } 90 }
92 }); 91 });
93 - ;  
94 92
95 -  
96 -  
97 - //Evaluation newEval = new Evaluation(activityId, title, outcome, action, consequenceValue, probabilityValue);  
98 - //dbs.insertEvaluation(newEval);  
99 finish(); 93 finish();
100 } 94 }
101 }); 95 });
@@ -116,19 +110,27 @@ public class NewEvaluation extends AppCompatActivity { @@ -116,19 +110,27 @@ public class NewEvaluation extends AppCompatActivity {
116 110
117 private int getConsequenceValue(String consequence) { 111 private int getConsequenceValue(String consequence) {
118 switch (consequence) { 112 switch (consequence) {
119 - case "Ufarlig": return 1;  
120 - case "Moderate": return 2;  
121 - case "Alvorlig": return 3;  
122 - default: return -1; 113 + case "Ufarlig":
  114 + return 1;
  115 + case "Moderate":
  116 + return 2;
  117 + case "Alvorlig":
  118 + return 3;
  119 + default:
  120 + return -1;
123 } 121 }
124 } 122 }
125 123
126 private int getProbabilityValue(String probability) { 124 private int getProbabilityValue(String probability) {
127 switch (probability) { 125 switch (probability) {
128 - case "Lav": return 1;  
129 - case "Middels": return 2;  
130 - case "Stor": return 3;  
131 - default: return -1; 126 + case "Lav":
  127 + return 1;
  128 + case "Middels":
  129 + return 2;
  130 + case "Stor":
  131 + return 3;
  132 + default:
  133 + return -1;
132 } 134 }
133 } 135 }
134 136
@@ -140,7 +142,7 @@ public class NewEvaluation extends AppCompatActivity { @@ -140,7 +142,7 @@ public class NewEvaluation extends AppCompatActivity {
140 } 142 }
141 143
142 @Override 144 @Override
143 - public boolean onCreateOptionsMenu (Menu menu) { 145 + public boolean onCreateOptionsMenu(Menu menu) {
144 getMenuInflater().inflate(R.menu.main, menu); 146 getMenuInflater().inflate(R.menu.main, menu);
145 return true; 147 return true;
146 } 148 }
@@ -168,5 +170,4 @@ public class NewEvaluation extends AppCompatActivity { @@ -168,5 +170,4 @@ public class NewEvaluation extends AppCompatActivity {
168 170
169 } 171 }
170 } 172 }
171 -  
172 } 173 }
Risiko/app/src/main/java/activity/NewIncident.java
1 package activity; 1 package activity;
2 2
3 import android.content.Intent; 3 import android.content.Intent;
4 -import android.support.v7.app.AppCompatActivity;  
5 import android.os.Bundle; 4 import android.os.Bundle;
  5 +import android.support.v7.app.AppCompatActivity;
6 import android.support.v7.widget.Toolbar; 6 import android.support.v7.widget.Toolbar;
7 import android.util.Log; 7 import android.util.Log;
8 import android.view.Menu; 8 import android.view.Menu;
@@ -15,7 +15,6 @@ import android.widget.Toast; @@ -15,7 +15,6 @@ import android.widget.Toast;
15 15
16 import com.risiko.risiko.R; 16 import com.risiko.risiko.R;
17 17
18 -import java.util.ArrayList;  
19 import java.util.HashMap; 18 import java.util.HashMap;
20 import java.util.List; 19 import java.util.List;
21 import java.util.UUID; 20 import java.util.UUID;
@@ -24,7 +23,6 @@ import api.Api; @@ -24,7 +23,6 @@ import api.Api;
24 import api.TokenEncrypter; 23 import api.TokenEncrypter;
25 import database.DatabaseSource; 24 import database.DatabaseSource;
26 import dataclasses.Evaluation; 25 import dataclasses.Evaluation;
27 -import dataclasses.Incident;  
28 import dataclasses.User; 26 import dataclasses.User;
29 import retrofit2.Call; 27 import retrofit2.Call;
30 import retrofit2.Callback; 28 import retrofit2.Callback;
@@ -58,16 +56,11 @@ public class NewIncident extends AppCompatActivity { @@ -58,16 +56,11 @@ public class NewIncident extends AppCompatActivity {
58 spinnerAssociatedRisk = findViewById(R.id.spinner_associated_risk); 56 spinnerAssociatedRisk = findViewById(R.id.spinner_associated_risk);
59 spinnerReadAccess = findViewById(R.id.spinner_read_access); 57 spinnerReadAccess = findViewById(R.id.spinner_read_access);
60 58
61 - //TODO FJERN DENNE MIDLERTIDIGE DELEN FOR LESEAKSESS  
62 -  
63 List<String> list = User.getAllReadAccesses(); 59 List<String> list = User.getAllReadAccesses();
64 ArrayAdapter<String> adapter2 = new ArrayAdapter<String>(NewIncident.this, android.R.layout.simple_spinner_item, list); 60 ArrayAdapter<String> adapter2 = new ArrayAdapter<String>(NewIncident.this, android.R.layout.simple_spinner_item, list);
65 adapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); 61 adapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
66 spinnerReadAccess.setAdapter(adapter2); 62 spinnerReadAccess.setAdapter(adapter2);
67 63
68 -  
69 -// dbs.getAllEvaluation(evaluations);  
70 -  
71 Api.getInstance().getAllEvaluations() 64 Api.getInstance().getAllEvaluations()
72 .enqueue(new Callback<List<Evaluation>>() { 65 .enqueue(new Callback<List<Evaluation>>() {
73 66
@@ -75,7 +68,7 @@ public class NewIncident extends AppCompatActivity { @@ -75,7 +68,7 @@ public class NewIncident extends AppCompatActivity {
75 public void onResponse(Call<List<dataclasses.Evaluation>> call, Response<List<dataclasses.Evaluation>> response) { 68 public void onResponse(Call<List<dataclasses.Evaluation>> call, Response<List<dataclasses.Evaluation>> response) {
76 if (response.isSuccessful()) { 69 if (response.isSuccessful()) {
77 List<dataclasses.Evaluation> evaluations = response.body(); 70 List<dataclasses.Evaluation> evaluations = response.body();
78 - if (evaluations != null){ 71 + if (evaluations != null) {
79 HashMap<String, String> evalMap = convertToDictionaryWithIdAndTitle(evaluations); 72 HashMap<String, String> evalMap = convertToDictionaryWithIdAndTitle(evaluations);
80 ArrayAdapter<Object> adapter = new ArrayAdapter<>(NewIncident.this, android.R.layout.simple_spinner_item, evalMap.keySet().toArray()); 73 ArrayAdapter<Object> adapter = new ArrayAdapter<>(NewIncident.this, android.R.layout.simple_spinner_item, evalMap.keySet().toArray());
81 adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); 74 adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
@@ -93,7 +86,6 @@ public class NewIncident extends AppCompatActivity { @@ -93,7 +86,6 @@ public class NewIncident extends AppCompatActivity {
93 String associatedRisk = evalMap.get(associatedRiskTitle); 86 String associatedRisk = evalMap.get(associatedRiskTitle);
94 87
95 88
96 -  
97 Api.getInstance().getUser(token).enqueue(new Callback<User>() { 89 Api.getInstance().getUser(token).enqueue(new Callback<User>() {
98 @Override 90 @Override
99 public void onResponse(Call<User> call, Response<User> response) { 91 public void onResponse(Call<User> call, Response<User> response) {
@@ -113,7 +105,7 @@ public class NewIncident extends AppCompatActivity { @@ -113,7 +105,7 @@ public class NewIncident extends AppCompatActivity {
113 105
114 @Override 106 @Override
115 public void onFailure(Call<String> call, Throwable t) { 107 public void onFailure(Call<String> call, Throwable t) {
116 - t.printStackTrace(); 108 + Log.d("Error", t.getMessage());
117 } 109 }
118 }); 110 });
119 } 111 }
@@ -124,11 +116,6 @@ public class NewIncident extends AppCompatActivity { @@ -124,11 +116,6 @@ public class NewIncident extends AppCompatActivity {
124 } 116 }
125 }); 117 });
126 118
127 -  
128 -  
129 -  
130 -  
131 -// dbs.insertIncident(newIncident);  
132 finish(); 119 finish();
133 } 120 }
134 }); 121 });
@@ -143,7 +130,6 @@ public class NewIncident extends AppCompatActivity { @@ -143,7 +130,6 @@ public class NewIncident extends AppCompatActivity {
143 130
144 @Override 131 @Override
145 public void onFailure(Call<List<dataclasses.Evaluation>> call, Throwable t) { 132 public void onFailure(Call<List<dataclasses.Evaluation>> call, Throwable t) {
146 - //Something went completely south (maybe you lost internet connection)  
147 Toast.makeText(NewIncident.this, "Something went wrong", 133 Toast.makeText(NewIncident.this, "Something went wrong",
148 Toast.LENGTH_LONG).show(); 134 Toast.LENGTH_LONG).show();
149 Log.d("Error", t.getMessage()); 135 Log.d("Error", t.getMessage());
@@ -170,7 +156,7 @@ public class NewIncident extends AppCompatActivity { @@ -170,7 +156,7 @@ public class NewIncident extends AppCompatActivity {
170 } 156 }
171 157
172 @Override 158 @Override
173 - public boolean onCreateOptionsMenu (Menu menu) { 159 + public boolean onCreateOptionsMenu(Menu menu) {
174 getMenuInflater().inflate(R.menu.main, menu); 160 getMenuInflater().inflate(R.menu.main, menu);
175 return true; 161 return true;
176 } 162 }
@@ -198,5 +184,4 @@ public class NewIncident extends AppCompatActivity { @@ -198,5 +184,4 @@ public class NewIncident extends AppCompatActivity {
198 184
199 } 185 }
200 } 186 }
201 -  
202 } 187 }
Risiko/app/src/main/java/adapters/ListAdapterAccesslog.java
@@ -30,7 +30,6 @@ public class ListAdapterAccesslog extends ArrayAdapter&lt;Accesslog&gt; { @@ -30,7 +30,6 @@ public class ListAdapterAccesslog extends ArrayAdapter&lt;Accesslog&gt; {
30 } 30 }
31 31
32 32
33 -  
34 TextView logDate = convertView.findViewById(R.id.tv_accesslog_date); 33 TextView logDate = convertView.findViewById(R.id.tv_accesslog_date);
35 logDate.setText(accesslogg.getDate()); 34 logDate.setText(accesslogg.getDate());
36 35
@@ -41,14 +40,9 @@ public class ListAdapterAccesslog extends ArrayAdapter&lt;Accesslog&gt; { @@ -41,14 +40,9 @@ public class ListAdapterAccesslog extends ArrayAdapter&lt;Accesslog&gt; {
41 logGroup.setText(accesslogg.getGroupnr()); 40 logGroup.setText(accesslogg.getGroupnr());
42 41
43 42
44 -  
45 -  
46 return convertView; 43 return convertView;
47 } 44 }
48 45
49 -  
50 -  
51 -  
52 } 46 }
53 47
54 48
Risiko/app/src/main/java/adapters/ListAdapterEvaluations.java
@@ -7,8 +7,11 @@ import android.view.View; @@ -7,8 +7,11 @@ import android.view.View;
7 import android.view.ViewGroup; 7 import android.view.ViewGroup;
8 import android.widget.ArrayAdapter; 8 import android.widget.ArrayAdapter;
9 import android.widget.TextView; 9 import android.widget.TextView;
  10 +
10 import com.risiko.risiko.R; 11 import com.risiko.risiko.R;
  12 +
11 import java.util.List; 13 import java.util.List;
  14 +
12 import dataclasses.Evaluation; 15 import dataclasses.Evaluation;
13 16
14 public class ListAdapterEvaluations extends ArrayAdapter<Evaluation> { 17 public class ListAdapterEvaluations extends ArrayAdapter<Evaluation> {
Risiko/app/src/main/java/api/Endpoints.java
1 package api; 1 package api;
2 2
3 -import java.util.Date;  
4 -import java.util.HashMap;  
5 import java.util.List; 3 import java.util.List;
6 -import java.util.UUID;  
7 4
8 import dataclasses.Accesslog; 5 import dataclasses.Accesslog;
9 import dataclasses.Activity; 6 import dataclasses.Activity;
@@ -12,7 +9,6 @@ import dataclasses.EvaluationLog; @@ -12,7 +9,6 @@ import dataclasses.EvaluationLog;
12 import dataclasses.Incident; 9 import dataclasses.Incident;
13 import dataclasses.User; 10 import dataclasses.User;
14 import retrofit2.Call; 11 import retrofit2.Call;
15 -import retrofit2.http.Body;  
16 import retrofit2.http.DELETE; 12 import retrofit2.http.DELETE;
17 import retrofit2.http.Field; 13 import retrofit2.http.Field;
18 import retrofit2.http.FormUrlEncoded; 14 import retrofit2.http.FormUrlEncoded;
@@ -24,22 +20,14 @@ import retrofit2.http.Path; @@ -24,22 +20,14 @@ import retrofit2.http.Path;
24 /** 20 /**
25 * Interface for API api.Endpoints using Retrofit 21 * Interface for API api.Endpoints using Retrofit
26 */ 22 */
27 -public interface Endpoints {  
28 23
  24 +public interface Endpoints {
29 25
30 - // THE BASEURL HAS TO BE CHANGE TO THE IP-ADDRESS YOU ARE CONNECTED TO AT LOCALHOST  
31 26
32 - //HOS ALI  
33 - String BASEURL = "http://172.20.10.4:3000/";  
34 -// String BASEURL = "http://172.20.10.2:3000/";  
35 -// String BASEURL = "http://192.168.38.200:3000/"; 27 + // OBS: THE BASEURL HAS TO BE CHANGE TO THE IP-ADDRESS YOU ARE CONNECTED TO AT LOCALHOST
36 28
37 - //HOS KRISTIN  
38 -// String BASEURL = "http://192.168.84.71:3000/";  
39 - //String BASEURL = "http://172.20.10.2:3000/"; 29 + String BASEURL = "http://172.20.10.2:3000/";
40 30
41 - //ØYVIN FIX  
42 - //String BASEURL ="http://risikoapi.harm.no/";  
43 31
44 @FormUrlEncoded 32 @FormUrlEncoded
45 @POST("login") 33 @POST("login")
@@ -89,13 +77,13 @@ public interface Endpoints { @@ -89,13 +77,13 @@ public interface Endpoints {
89 77
90 @FormUrlEncoded 78 @FormUrlEncoded
91 @PATCH("evaluation/{id}") 79 @PATCH("evaluation/{id}")
92 - Call<Evaluation> editEvaluation(@Path("id") String id, @Field("title") String title, @Field("outcome") String outcome, @Field("measures") String measures, @Field("consequence") int consequence,  
93 - @Field("probability") int probability, @Field("associatedActivity") String associatedactivity); 80 + Call<Evaluation> editEvaluation(@Path("id") String id, @Field("title") String title, @Field("outcome") String outcome, @Field("measures") String measures, @Field("consequence") int consequence,
  81 + @Field("probability") int probability, @Field("associatedActivity") String associatedactivity);
94 82
95 @FormUrlEncoded 83 @FormUrlEncoded
96 @PATCH("incident/{id}") 84 @PATCH("incident/{id}")
97 - Call<Incident> editIncident(@Path("id") String id, @Field("date") String date, @Field("location") String location,  
98 - @Field("title") String title, @Field("description") String description, @Field("associatedEval") String associatedEval); 85 + Call<Incident> editIncident(@Path("id") String id, @Field("date") String date, @Field("location") String location,
  86 + @Field("title") String title, @Field("description") String description, @Field("associatedEval") String associatedEval);
99 87
100 @GET("evaluation/{assosiatedeval}/evaluationlog") 88 @GET("evaluation/{assosiatedeval}/evaluationlog")
101 Call<List<EvaluationLog>> getEvaluationLog(@Path("assosiatedeval") String assosiatedeval); 89 Call<List<EvaluationLog>> getEvaluationLog(@Path("assosiatedeval") String assosiatedeval);
Risiko/app/src/main/res/layout/accessloglist.xml
@@ -16,42 +16,38 @@ @@ -16,42 +16,38 @@
16 android:orientation="horizontal"> 16 android:orientation="horizontal">
17 17
18 <TextView 18 <TextView
19 - android:layout_alignParentLeft="true"  
20 android:id="@+id/tv_accesslog_date" 19 android:id="@+id/tv_accesslog_date"
21 android:layout_width="wrap_content" 20 android:layout_width="wrap_content"
22 android:layout_height="wrap_content" 21 android:layout_height="wrap_content"
  22 + android:layout_alignParentLeft="true"
23 android:layout_marginRight="10dp" 23 android:layout_marginRight="10dp"
24 - android:textSize="17dp"  
25 - android:text="Dato "/> 24 + android:text="Dato "
  25 + android:textSize="17dp" />
26 26
27 <TextView 27 <TextView
28 - android:layout_alignParentLeft="true"  
29 android:id="@+id/tv_accesslog_name" 28 android:id="@+id/tv_accesslog_name"
30 android:layout_width="wrap_content" 29 android:layout_width="wrap_content"
31 android:layout_height="wrap_content" 30 android:layout_height="wrap_content"
  31 + android:layout_alignParentLeft="true"
32 android:layout_marginBottom="10dp" 32 android:layout_marginBottom="10dp"
33 - android:textSize="17dp"  
34 android:layout_marginRight="10dp" 33 android:layout_marginRight="10dp"
35 - android:text="Ola Nordmann"/> 34 + android:text="Ola Nordmann"
  35 + android:textSize="17dp" />
36 36
37 <TextView 37 <TextView
38 - android:layout_alignParentLeft="true"  
39 android:id="@+id/tv_accesslog_group" 38 android:id="@+id/tv_accesslog_group"
40 android:layout_width="wrap_content" 39 android:layout_width="wrap_content"
41 android:layout_height="wrap_content" 40 android:layout_height="wrap_content"
  41 + android:layout_alignParentLeft="true"
42 android:layout_marginBottom="10dp" 42 android:layout_marginBottom="10dp"
43 - android:textSize="17dp"  
44 - android:text="Gruppe"/> 43 + android:text="Gruppe"
  44 + android:textSize="17dp" />
45 45
46 46
47 </LinearLayout> 47 </LinearLayout>
48 48
49 49
50 -  
51 </LinearLayout> 50 </LinearLayout>
52 51
53 52
54 -  
55 -  
56 -  
57 </RelativeLayout> 53 </RelativeLayout>
58 \ No newline at end of file 54 \ No newline at end of file
Risiko/app/src/main/res/layout/activity_activities.xml
@@ -2,56 +2,53 @@ @@ -2,56 +2,53 @@
2 2
3 <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"
4 xmlns:app="http://schemas.android.com/apk/res-auto" 4 xmlns:app="http://schemas.android.com/apk/res-auto"
5 - xmlns:tools="http://schemas.android.com/tools"  
6 android:layout_width="match_parent" 5 android:layout_width="match_parent"
7 android:layout_height="match_parent"> 6 android:layout_height="match_parent">
8 7
9 - <include layout="@layout/toolbar"/> 8 + <include layout="@layout/toolbar" />
10 9
11 <TextView 10 <TextView
12 android:id="@+id/headline" 11 android:id="@+id/headline"
13 android:layout_width="wrap_content" 12 android:layout_width="wrap_content"
14 android:layout_height="wrap_content" 13 android:layout_height="wrap_content"
  14 + android:layout_marginBottom="100dp"
  15 + android:layout_marginTop="70dp"
15 android:text="Liste over aktivititeter" 16 android:text="Liste over aktivititeter"
16 - android:textStyle="bold"  
17 - android:textSize="25dp"  
18 android:textColor="@color/colorPrimaryDark" 17 android:textColor="@color/colorPrimaryDark"
  18 + android:textSize="25dp"
  19 + android:textStyle="bold"
19 app:layout_constraintLeft_toLeftOf="parent" 20 app:layout_constraintLeft_toLeftOf="parent"
20 app:layout_constraintRight_toRightOf="parent" 21 app:layout_constraintRight_toRightOf="parent"
21 - app:layout_constraintTop_toTopOf="parent"  
22 - android:layout_marginTop="70dp"  
23 - android:layout_marginBottom="100dp" /> 22 + app:layout_constraintTop_toTopOf="parent" />
24 23
25 24
26 <android.support.constraint.ConstraintLayout 25 <android.support.constraint.ConstraintLayout
27 - app:layout_constraintTop_toBottomOf="@+id/headline"  
28 android:layout_width="match_parent" 26 android:layout_width="match_parent"
29 android:layout_height="match_parent" 27 android:layout_height="match_parent"
  28 + android:layout_marginBottom="20dp"
30 android:layout_marginVertical="70dp" 29 android:layout_marginVertical="70dp"
31 - android:layout_marginBottom="20dp"> 30 + app:layout_constraintTop_toBottomOf="@+id/headline">
32 31
33 32
34 - <android.support.v4.widget.SwipeRefreshLayout  
35 - xmlns:android="http://schemas.android.com/apk/res/android" 33 + <android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
36 android:id="@+id/swiperefresh" 34 android:id="@+id/swiperefresh"
37 - android:layout_marginTop="50dp"  
38 android:layout_width="match_parent" 35 android:layout_width="match_parent"
39 - android:layout_height="match_parent"> 36 + android:layout_height="match_parent"
  37 + android:layout_marginTop="50dp">
40 38
41 39
42 <LinearLayout 40 <LinearLayout
43 - android:layout_marginTop="200dp"  
44 - android:background="@color/colorWhite"  
45 android:layout_width="match_parent" 41 android:layout_width="match_parent"
46 android:layout_height="match_parent" 42 android:layout_height="match_parent"
  43 + android:layout_marginTop="200dp"
  44 + android:background="@color/colorWhite"
47 android:orientation="vertical"> 45 android:orientation="vertical">
48 46
49 <ListView 47 <ListView
50 android:id="@+id/lv_activities" 48 android:id="@+id/lv_activities"
51 - android:layout_margin="10dp"  
52 android:layout_width="match_parent" 49 android:layout_width="match_parent"
53 - android:layout_height="match_parent">  
54 - </ListView> 50 + android:layout_height="match_parent"
  51 + android:layout_margin="10dp"></ListView>
55 52
56 </LinearLayout> 53 </LinearLayout>
57 </android.support.v4.widget.SwipeRefreshLayout> 54 </android.support.v4.widget.SwipeRefreshLayout>
Risiko/app/src/main/res/layout/activity_edit_evaluation.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <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:tools="http://schemas.android.com/tools" 3 xmlns:tools="http://schemas.android.com/tools"
5 android:layout_width="match_parent" 4 android:layout_width="match_parent"
6 android:layout_height="match_parent" 5 android:layout_height="match_parent"
7 tools:context="com.risiko.risiko.activity.EditEvaluation"> 6 tools:context="com.risiko.risiko.activity.EditEvaluation">
8 7
9 - <include layout="@layout/toolbar"/> 8 + <include layout="@layout/toolbar" />
10 9
11 <LinearLayout 10 <LinearLayout
12 android:layout_width="match_parent" 11 android:layout_width="match_parent"
13 android:layout_height="match_parent" 12 android:layout_height="match_parent"
14 - android:orientation="vertical"  
15 - android:background="@color/colorWhite"  
16 - android:padding="10dp"  
17 - android:layout_marginTop="70dp"  
18 android:layout_marginBottom="15dp" 13 android:layout_marginBottom="15dp"
19 - android:layout_marginHorizontal="15dp"> 14 + android:layout_marginHorizontal="15dp"
  15 + android:layout_marginTop="70dp"
  16 + android:background="@color/colorWhite"
  17 + android:orientation="vertical"
  18 + android:padding="10dp">
20 19
21 20
22 <TextView 21 <TextView
@@ -25,7 +24,7 @@ @@ -25,7 +24,7 @@
25 android:text="Endre vurdering" 24 android:text="Endre vurdering"
26 android:textColor="@color/colorPrimaryDark" 25 android:textColor="@color/colorPrimaryDark"
27 android:textSize="25dp" 26 android:textSize="25dp"
28 - android:textStyle="bold"/> 27 + android:textStyle="bold" />
29 28
30 29
31 <EditText 30 <EditText
@@ -53,21 +52,21 @@ @@ -53,21 +52,21 @@
53 android:inputType="text" /> 52 android:inputType="text" />
54 53
55 <LinearLayout 54 <LinearLayout
56 - android:padding="10dp"  
57 - android:background="@color/colorLightGray"  
58 - android:layout_marginVertical="25dp"  
59 android:layout_width="match_parent" 55 android:layout_width="match_parent"
60 android:layout_height="wrap_content" 56 android:layout_height="wrap_content"
61 - android:orientation="horizontal"> 57 + android:layout_marginVertical="25dp"
  58 + android:background="@color/colorLightGray"
  59 + android:orientation="horizontal"
  60 + android:padding="10dp">
62 61
63 <TextView 62 <TextView
64 - android:layout_marginEnd="20dp"  
65 android:id="@+id/tv_consequence" 63 android:id="@+id/tv_consequence"
66 android:layout_width="wrap_content" 64 android:layout_width="wrap_content"
67 android:layout_height="wrap_content" 65 android:layout_height="wrap_content"
  66 + android:layout_marginEnd="20dp"
68 android:text="@string/consequence" 67 android:text="@string/consequence"
69 - android:textStyle="bold"  
70 - android:textSize="17sp"/> 68 + android:textSize="17sp"
  69 + android:textStyle="bold" />
71 70
72 <Spinner 71 <Spinner
73 android:id="@+id/spinner_consequence" 72 android:id="@+id/spinner_consequence"
@@ -77,11 +76,11 @@ @@ -77,11 +76,11 @@
77 </LinearLayout> 76 </LinearLayout>
78 77
79 <LinearLayout 78 <LinearLayout
80 - android:padding="10dp"  
81 - android:background="@color/colorLightGray"  
82 android:layout_width="match_parent" 79 android:layout_width="match_parent"
83 android:layout_height="wrap_content" 80 android:layout_height="wrap_content"
84 - android:orientation="horizontal"> 81 + android:background="@color/colorLightGray"
  82 + android:orientation="horizontal"
  83 + android:padding="10dp">
85 84
86 <TextView 85 <TextView
87 android:id="@+id/tv_probability" 86 android:id="@+id/tv_probability"
Risiko/app/src/main/res/layout/activity_edit_incident.xml
@@ -6,17 +6,17 @@ @@ -6,17 +6,17 @@
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"/> 9 + <include layout="@layout/toolbar" />
10 10
11 <LinearLayout 11 <LinearLayout
12 android:layout_width="match_parent" 12 android:layout_width="match_parent"
13 android:layout_height="match_parent" 13 android:layout_height="match_parent"
14 - android:orientation="vertical"  
15 - android:background="@color/colorWhite"  
16 - android:padding="10dp"  
17 - android:layout_marginTop="70dp" 14 + android:layout_marginBottom="15dp"
18 android:layout_marginHorizontal="15dp" 15 android:layout_marginHorizontal="15dp"
19 - android:layout_marginBottom="15dp"> 16 + android:layout_marginTop="70dp"
  17 + android:background="@color/colorWhite"
  18 + android:orientation="vertical"
  19 + android:padding="10dp">
20 20
21 21
22 <TextView 22 <TextView
@@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
26 android:textColor="@color/colorPrimaryDark" 26 android:textColor="@color/colorPrimaryDark"
27 android:textSize="25dp" 27 android:textSize="25dp"
28 android:textStyle="bold" 28 android:textStyle="bold"
29 - app:layout_constraintTop_toTopOf="parent"/> 29 + app:layout_constraintTop_toTopOf="parent" />
30 30
31 <EditText 31 <EditText
32 android:id="@+id/et_edit_incident_date" 32 android:id="@+id/et_edit_incident_date"
@@ -59,12 +59,12 @@ @@ -59,12 +59,12 @@
59 android:minLines="2" /> 59 android:minLines="2" />
60 60
61 <LinearLayout 61 <LinearLayout
62 - android:padding="10dp"  
63 - android:background="@color/colorLightGray"  
64 - android:layout_marginVertical="25dp"  
65 android:layout_width="match_parent" 62 android:layout_width="match_parent"
66 android:layout_height="wrap_content" 63 android:layout_height="wrap_content"
67 - android:orientation="horizontal"> 64 + android:layout_marginVertical="25dp"
  65 + android:background="@color/colorLightGray"
  66 + android:orientation="horizontal"
  67 + android:padding="10dp">
68 68
69 <TextView 69 <TextView
70 70
@@ -82,13 +82,13 @@ @@ -82,13 +82,13 @@
82 82
83 83
84 <LinearLayout 84 <LinearLayout
85 - android:padding="10dp"  
86 - android:background="@color/colorLightGray"  
87 - android:layout_marginTop="5dp"  
88 - android:layout_marginBottom="25dp"  
89 android:layout_width="match_parent" 85 android:layout_width="match_parent"
90 android:layout_height="wrap_content" 86 android:layout_height="wrap_content"
91 - android:orientation="horizontal"> 87 + android:layout_marginBottom="25dp"
  88 + android:layout_marginTop="5dp"
  89 + android:background="@color/colorLightGray"
  90 + android:orientation="horizontal"
  91 + android:padding="10dp">
92 92
93 <TextView 93 <TextView
94 94
@@ -105,7 +105,6 @@ @@ -105,7 +105,6 @@
105 </LinearLayout> 105 </LinearLayout>
106 106
107 107
108 -  
109 <Button 108 <Button
110 android:id="@+id/btn_edit_incident" 109 android:id="@+id/btn_edit_incident"
111 android:layout_width="wrap_content" 110 android:layout_width="wrap_content"
Risiko/app/src/main/res/layout/activity_evaluation_log.xml
@@ -2,56 +2,53 @@ @@ -2,56 +2,53 @@
2 2
3 <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"
4 xmlns:app="http://schemas.android.com/apk/res-auto" 4 xmlns:app="http://schemas.android.com/apk/res-auto"
5 - xmlns:tools="http://schemas.android.com/tools"  
6 android:layout_width="match_parent" 5 android:layout_width="match_parent"
7 android:layout_height="match_parent"> 6 android:layout_height="match_parent">
8 7
9 - <include layout="@layout/toolbar"/> 8 + <include layout="@layout/toolbar" />
10 9
11 <TextView 10 <TextView
12 android:id="@+id/headline" 11 android:id="@+id/headline"
13 android:layout_width="wrap_content" 12 android:layout_width="wrap_content"
14 android:layout_height="wrap_content" 13 android:layout_height="wrap_content"
  14 + android:layout_marginBottom="100dp"
  15 + android:layout_marginTop="70dp"
15 android:text="Hendelseslogg" 16 android:text="Hendelseslogg"
16 - android:textStyle="bold"  
17 - android:textSize="25dp"  
18 android:textColor="@color/colorPrimaryDark" 17 android:textColor="@color/colorPrimaryDark"
  18 + android:textSize="25dp"
  19 + android:textStyle="bold"
19 app:layout_constraintLeft_toLeftOf="parent" 20 app:layout_constraintLeft_toLeftOf="parent"
20 app:layout_constraintRight_toRightOf="parent" 21 app:layout_constraintRight_toRightOf="parent"
21 - app:layout_constraintTop_toTopOf="parent"  
22 - android:layout_marginTop="70dp"  
23 - android:layout_marginBottom="100dp" /> 22 + app:layout_constraintTop_toTopOf="parent" />
24 23
25 24
26 <android.support.constraint.ConstraintLayout 25 <android.support.constraint.ConstraintLayout
27 - app:layout_constraintTop_toBottomOf="@+id/headline"  
28 android:layout_width="match_parent" 26 android:layout_width="match_parent"
29 android:layout_height="match_parent" 27 android:layout_height="match_parent"
  28 + android:layout_marginBottom="20dp"
30 android:layout_marginVertical="70dp" 29 android:layout_marginVertical="70dp"
31 - android:layout_marginBottom="20dp"> 30 + app:layout_constraintTop_toBottomOf="@+id/headline">
32 31
33 32
34 - <android.support.v4.widget.SwipeRefreshLayout  
35 - xmlns:android="http://schemas.android.com/apk/res/android" 33 + <android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
36 android:id="@+id/swiperefresh" 34 android:id="@+id/swiperefresh"
37 - android:layout_marginTop="50dp"  
38 android:layout_width="match_parent" 35 android:layout_width="match_parent"
39 - android:layout_height="match_parent"> 36 + android:layout_height="match_parent"
  37 + android:layout_marginTop="50dp">
40 38
41 39
42 <LinearLayout 40 <LinearLayout