Commit bf51a0369f8d23c818ac230037f86951698b7451

Authored by kristinlaahneolsen
1 parent f1827fbd

Begynt på sekvensaktivitet (da har vi nesten i havn alle skjermbildene), og drop…

…down til ny vurdering
Risiko/app/src/main/AndroidManifest.xml
... ... @@ -21,7 +21,8 @@
21 21 <activity android:name="activity.Events" />
22 22 <activity android:name="activity.NewEvent" />
23 23 <activity android:name="activity.NewEvaluation" />
24   - <activity android:name="activity.Evaluations"></activity>
  24 + <activity android:name="activity.Evaluations" />
  25 + <activity android:name="activity.SequenceOfActivities"></activity>
25 26 </application>
26 27  
27 28 </manifest>
28 29 \ No newline at end of file
... ...
Risiko/app/src/main/java/activity/Evaluations.java
1 1 package activity;
2 2  
  3 +import android.content.Intent;
3 4 import android.graphics.Color;
4 5 import android.graphics.Typeface;
5 6 import android.support.v7.app.AlertDialog;
... ... @@ -27,12 +28,16 @@ public class Evaluations extends AppCompatActivity {
27 28 ListView lv;
28 29 String chosenEvaluation;
29 30 TextView consequence;
  31 + Button addNewEvaluation;
30 32  
31 33 @Override
32 34 protected void onCreate(Bundle savedInstanceState) {
33 35 super.onCreate(savedInstanceState);
34 36 setContentView(R.layout.activity_evaluations);
35 37  
  38 + addNewEvaluation = findViewById(R.id.btn_add_new_evaluation);
  39 + addNewEvaluation.setOnClickListener(view -> startActivity(new Intent(this, NewEvaluation.class)));
  40 +
36 41 //TODO Bytte ut Mockdata på sikt
37 42 ArrayList<Evaluation> evaluationList= new ArrayList<>();
38 43 evaluationList.add(new Evaluation("Tråkke over", "Skade foten", "Velge riktig skotøy", "Ufarlig", "Stor"));
... ...
Risiko/app/src/main/java/activity/Events.java
... ... @@ -51,7 +51,6 @@ public class Events extends AppCompatActivity {
51 51  
52 52 }
53 53 });
54   -
55 54 }
56 55  
57 56 private void showEventPopup() {
... ...
Risiko/app/src/main/java/activity/MainMenu.java
... ... @@ -11,37 +11,23 @@ import com.risiko.risiko.R;
11 11 public class MainMenu extends AppCompatActivity {
12 12 Button toActivityList;
13 13 Button toEventList;
  14 + Button toSequences;
  15 + Button toNewEvent;
14 16  
15 17 @Override
16 18 protected void onCreate(Bundle savedInstanceState) {
17 19 super.onCreate(savedInstanceState);
18 20 setContentView(R.layout.activity_main_menu);
  21 +
19 22 toActivityList = findViewById(R.id.btn_to_activitylist);
20   - toActivityList.setOnClickListener(new View.OnClickListener() {
21   - @Override
22   - public void onClick(View view) {
23   - toActivityListEvent();
24   - }
25   - });
26   -
27   -
28   - toActivityList = findViewById(R.id.btn_to_events);
29   - toActivityList.setOnClickListener(new View.OnClickListener() {
30   - @Override
31   - public void onClick(View view) {
32   - toEventListEvent();
33   - }
34   - });
35   -}
  23 + toActivityList.setOnClickListener(view -> startActivity(new Intent(this, Activities.class)));
36 24  
  25 + toEventList = findViewById(R.id.btn_to_events);
  26 + toEventList.setOnClickListener(view -> startActivity(new Intent(this, Events.class)));
37 27  
38   - public void toActivityListEvent(){
39   - Intent intent = new Intent(this, Activities.class);
40   - startActivity(intent);
41   - }
  28 + toNewEvent = findViewById(R.id.btn_to_new_event);
  29 + toNewEvent.setOnClickListener(view -> startActivity(new Intent(this, NewEvent.class)));
42 30  
43   - public void toEventListEvent(){
44   - Intent intent = new Intent(this, Events.class);
45   - startActivity(intent);
46 31 }
  32 +
47 33 }
... ...
Risiko/app/src/main/java/activity/NewEvaluation.java
... ... @@ -2,6 +2,8 @@ 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.Spinner;
5 7  
6 8 import com.risiko.risiko.R;
7 9  
... ... @@ -11,5 +13,15 @@ public class NewEvaluation extends AppCompatActivity {
11 13 protected void onCreate(Bundle savedInstanceState) {
12 14 super.onCreate(savedInstanceState);
13 15 setContentView(R.layout.activity_new_evaluation);
  16 +
  17 + Spinner consequenceSpinner = (Spinner) findViewById(R.id.spinner_consequence);
  18 + ArrayAdapter<CharSequence> consequenceAdapter = ArrayAdapter.createFromResource(this, R.array.consequence_array, android.R.layout.simple_spinner_item);
  19 + consequenceAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  20 + consequenceSpinner.setAdapter(consequenceAdapter);
  21 +
  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);
  24 + consequenceAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  25 + associatedRiskSpinner.setAdapter(associatedRiskAdapter);
14 26 }
15 27 }
... ...
Risiko/app/src/main/java/activity/SequenceOfActivities.java 0 → 100644
  1 +package activity;
  2 +
  3 +import android.support.v7.app.AppCompatActivity;
  4 +import android.os.Bundle;
  5 +
  6 +import com.risiko.risiko.R;
  7 +
  8 +public class SequenceOfActivities extends AppCompatActivity {
  9 +
  10 + @Override
  11 + protected void onCreate(Bundle savedInstanceState) {
  12 + super.onCreate(savedInstanceState);
  13 + setContentView(R.layout.activity_sequence_of_activities);
  14 + }
  15 +}
... ...
Risiko/app/src/main/res/layout/activity_new_evaluation.xml
... ... @@ -10,6 +10,7 @@
10 10 android:layout_width="match_parent"
11 11 android:layout_height="match_parent"
12 12 android:orientation="vertical"
  13 +
13 14 android:layout_margin="15dp">
14 15  
15 16  
... ... @@ -18,40 +19,46 @@
18 19 android:layout_height="wrap_content"
19 20 android:text="Ny vurdering"
20 21 android:textSize="25dp"
21   - android:textStyle="bold"
22   - app:layout_constraintTop_toTopOf="parent"/>
  22 + android:textStyle="bold"/>
23 23  
24 24  
25 25 <EditText
  26 + android:layout_marginVertical="10dp"
26 27 android:layout_width="match_parent"
27 28 android:layout_height="wrap_content"
28 29 android:hint="Tittel:"
29 30 android:inputType="text"/>
30 31  
31 32 <EditText
  33 + android:layout_marginVertical="10dp"
32 34 android:layout_width="match_parent"
33 35 android:layout_height="wrap_content"
34 36 android:hint="Mulig utfall:"
35 37 android:inputType="text"/>
36 38  
37 39 <EditText
  40 + android:layout_marginVertical="10dp"
38 41 android:layout_width="match_parent"
39 42 android:layout_height="wrap_content"
40 43 android:hint="Tiltak:"
41 44 android:inputType="text"/>
42 45  
43 46 <LinearLayout
  47 + android:padding="10dp"
  48 + android:background="@color/colorLightGray"
44 49 android:layout_marginVertical="25dp"
45 50 android:layout_width="match_parent"
46 51 android:layout_height="wrap_content"
47 52 android:orientation="horizontal">
48 53  
49 54 <TextView
50   -
  55 + android:layout_marginEnd="20dp"
51 56 android:id="@+id/tv_consequence"
52 57 android:layout_width="wrap_content"
53 58 android:layout_height="wrap_content"
54   - android:text="Konsekvens" />
  59 + android:text="@string/consequence"
  60 + android:textStyle="bold"
  61 + android:textSize="17sp"/>
55 62  
56 63 <Spinner
57 64 android:id="@+id/spinner_consequence"
... ... @@ -61,17 +68,20 @@
61 68 </LinearLayout>
62 69  
63 70 <LinearLayout
64   -
  71 + android:padding="10dp"
  72 + android:background="@color/colorLightGray"
65 73 android:layout_width="match_parent"
66 74 android:layout_height="wrap_content"
67 75 android:orientation="horizontal">
68 76  
69 77 <TextView
70   -
  78 + android:layout_marginEnd="20dp"
71 79 android:id="@+id/tv_associated_risk"
72 80 android:layout_width="wrap_content"
73 81 android:layout_height="wrap_content"
74   - android:text="Sannsynlighet" />
  82 + android:textSize="17sp"
  83 + android:textStyle="bold"
  84 + android:text="@string/probability" />
75 85  
76 86 <Spinner
77 87 android:id="@+id/spinner_associated_risk"
... ... @@ -81,7 +91,9 @@
81 91 </LinearLayout>
82 92  
83 93 <Button
84   - android:layout_width="wrap_content"
  94 + android:layout_marginTop="30dp"
  95 + android:layout_gravity="center"
  96 + android:layout_width="150dp"
85 97 android:layout_height="wrap_content"
86 98 android:text="Legg til "/>
87 99  
... ...
Risiko/app/src/main/res/layout/activity_new_event.xml
... ... @@ -43,10 +43,14 @@
43 43 android:layout_width="match_parent"
44 44 android:layout_height="wrap_content"
45 45 android:hint="Beskrivelse:"
46   - android:inputType="text"/>
  46 + android:minLines="2"
  47 + android:maxLines="5"
  48 + android:inputType="textMultiLine"/>
47 49  
48 50 <LinearLayout
49   - android:layout_marginVertical="25dp"
  51 + android:padding="10dp"
  52 + android:background="@color/colorLightGray"
  53 + android:layout_marginVertical="35dp"
50 54 android:layout_width="match_parent"
51 55 android:layout_height="wrap_content"
52 56 android:orientation="horizontal">
... ... @@ -66,7 +70,7 @@
66 70 </LinearLayout>
67 71  
68 72 <Button
69   -
  73 + android:layout_gravity="center"
70 74 android:layout_width="wrap_content"
71 75 android:layout_height="wrap_content"
72 76 android:text="Lagre hendelse"/>
... ...
Risiko/app/src/main/res/layout/activity_sequence_of_activities.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  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"
  5 + android:layout_width="match_parent"
  6 + android:layout_height="match_parent"
  7 + tools:context="com.risiko.risiko.activity.SequenceOfActivities">
  8 +
  9 +</android.support.constraint.ConstraintLayout>
... ...
Risiko/app/src/main/res/layout/spinner_item.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:layout_width="match_parent"
  4 + android:layout_height="match_parent">
  5 +
  6 + <TextView
  7 + android:layout_width="wrap_content"
  8 + android:layout_height="wrap_content"
  9 + android:text="TEST"
  10 + android:textSize="30dp"/>
  11 +
  12 +</LinearLayout>
... ...
Risiko/app/src/main/res/values/array.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<resources>
  3 +
  4 + <string-array name="consequence_array">
  5 + <item>Ufarlig</item>
  6 + <item>Moderate</item>
  7 + <item>Alvorlig</item>
  8 + </string-array>
  9 +
  10 + <string-array name="associated_risk_array">
  11 + <item>Lav</item>
  12 + <item>Middels</item>
  13 + <item>Stor</item>
  14 + </string-array>
  15 +
  16 +
  17 +</resources>
... ...
Risiko/app/src/main/res/values/colors.xml
... ... @@ -5,4 +5,5 @@
5 5 <color name="colorAccent">#FF4081</color>
6 6 <color name="colorLightGreen">#e2ffe2</color>
7 7 <color name="colorDarkGreen">#0f7c44</color>
  8 + <color name="colorLightGray">#E0E0E0</color>
8 9 </resources>
... ...
Risiko/app/src/main/res/values/strings.xml
... ... @@ -22,4 +22,5 @@
22 22 <string name="place">Sted:</string>
23 23 <string name="description">Beskrivelse:</string>
24 24 <string name="associated_risk">Tilknyttet risiko</string>
  25 +
25 26 </resources>
... ...