From 4df1127a8c1809dc578a24afaa8c0bf368d08f51 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 11 Jul 2019 18:18:05 +0100 Subject: [PATCH] jetpack compliance, code cleanup, extracted resources --- .../automation/dialogs/EditEventDialog.java | 1 + .../triggers/TriggerProfilePercent.java | 2 +- .../res/layout/automation_action_item.xml | 9 +- .../res/layout/automation_dialog_action.xml | 46 +++--- .../automation_dialog_choose_action.xml | 40 ++--- .../automation_dialog_choose_trigger.xml | 40 ++--- .../layout/automation_dialog_edit_action.xml | 22 +-- .../layout/automation_dialog_edit_trigger.xml | 44 +++-- .../res/layout/automation_dialog_event.xml | 152 +++++++++--------- .../main/res/layout/automation_event_item.xml | 25 ++- .../main/res/layout/automation_fragment.xml | 28 ++-- app/src/main/res/values/strings.xml | 9 ++ .../ActionProfileSwitchPercentTest.java | 2 +- 13 files changed, 197 insertions(+), 223 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/EditEventDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/EditEventDialog.java index 1fa4b607e1..c4734c8a2e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/EditEventDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/EditEventDialog.java @@ -5,6 +5,7 @@ import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.Button; import android.widget.TextView; import android.widget.Toast; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerProfilePercent.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerProfilePercent.java index 2124601e15..f9f3c4b36d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerProfilePercent.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerProfilePercent.java @@ -118,7 +118,7 @@ public class TriggerProfilePercent extends Trigger { @Override public Optional icon() { - return Optional.of(R.drawable.remove); + return Optional.of(R.drawable.icon_actions_profileswitch); } @Override diff --git a/app/src/main/res/layout/automation_action_item.xml b/app/src/main/res/layout/automation_action_item.xml index add8e4968a..40ca024d56 100644 --- a/app/src/main/res/layout/automation_action_item.xml +++ b/app/src/main/res/layout/automation_action_item.xml @@ -16,9 +16,10 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" app:srcCompat="@drawable/ic_trash_outline" - android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:layout_alignParentTop="true" - android:layout_alignParentBottom="true"/> + android:layout_alignParentBottom="true" + android:contentDescription="@string/overview_quickwizard_item_remove_button" /> + android:layout_toStartOf="@id/iconTrash" + android:layout_alignParentStart="true"> - - + - + android:layout_gravity="center_horizontal" + android:paddingBottom="10dp" + android:textAppearance="?android:attr/textAppearanceLarge" /> - + - + - + - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/automation_dialog_choose_action.xml b/app/src/main/res/layout/automation_dialog_choose_action.xml index 291f175cd4..5929736550 100644 --- a/app/src/main/res/layout/automation_dialog_choose_action.xml +++ b/app/src/main/res/layout/automation_dialog_choose_action.xml @@ -1,36 +1,30 @@ - - + - + android:text="@string/please_choose_an_action_type" /> - + - + - + - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/automation_dialog_choose_trigger.xml b/app/src/main/res/layout/automation_dialog_choose_trigger.xml index 37e456702e..a7bf66aa7e 100644 --- a/app/src/main/res/layout/automation_dialog_choose_trigger.xml +++ b/app/src/main/res/layout/automation_dialog_choose_trigger.xml @@ -1,36 +1,30 @@ - - + - + android:text="@string/please_choose_a_trigger_type" /> - + - + - + - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/automation_dialog_edit_action.xml b/app/src/main/res/layout/automation_dialog_edit_action.xml index d354ebe2a4..7be2cf1478 100644 --- a/app/src/main/res/layout/automation_dialog_edit_action.xml +++ b/app/src/main/res/layout/automation_dialog_edit_action.xml @@ -1,15 +1,11 @@ - - - - + android:hint="@string/eventname" /> + android:text="@string/if_label"/> + android:text="@string/edit_short" /> @@ -70,7 +66,7 @@ + android:text="@string/then_label"/> + android:text="@string/edit_short" /> @@ -94,6 +90,4 @@ - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/automation_dialog_edit_trigger.xml b/app/src/main/res/layout/automation_dialog_edit_trigger.xml index e627d0bb5f..3ffbad2bd4 100644 --- a/app/src/main/res/layout/automation_dialog_edit_trigger.xml +++ b/app/src/main/res/layout/automation_dialog_edit_trigger.xml @@ -1,38 +1,32 @@ - - + - + android:text="@string/triggers" /> - + - + - + - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/automation_dialog_event.xml b/app/src/main/res/layout/automation_dialog_event.xml index 8cd9bee897..2792a6c5f6 100644 --- a/app/src/main/res/layout/automation_dialog_event.xml +++ b/app/src/main/res/layout/automation_dialog_event.xml @@ -1,102 +1,96 @@ - - + - + android:hint="@string/taskname" /> - + - - - - - - - - - + + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/condition" /> - + - + - + - + - + - + - + - + - + - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/automation_event_item.xml b/app/src/main/res/layout/automation_event_item.xml index 7c845d93bb..ce377a6aa0 100644 --- a/app/src/main/res/layout/automation_event_item.xml +++ b/app/src/main/res/layout/automation_event_item.xml @@ -1,34 +1,33 @@ - + android:layout_marginEnd="8dp" + android:layout_marginBottom="8dp" + android:background="@color/ribbonDefault" + android:padding="8dp"> + android:layout_alignParentEnd="true" + android:contentDescription="@string/remove_label" + android:orientation="horizontal" + android:src="@drawable/ic_trash_outline" /> - - - + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e1cc34c2c6..c8aa28de89 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1422,6 +1422,15 @@ Last bolus time %1$s %2$s min ago COB COB %1$s %2$.0f + Task name + Event name + EDIT + Please choose an action type: + Please choose a trigger type: + If: + Then: + Triggers: + REMOVE %1$d day diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitchPercentTest.java b/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitchPercentTest.java index 27f676d007..78a603701e 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitchPercentTest.java +++ b/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitchPercentTest.java @@ -39,7 +39,7 @@ public class ActionProfileSwitchPercentTest { @Test public void iconTest() { - Assert.assertEquals(Optional.of(R.drawable.remove), actionProfileSwitchPercent.icon()); + Assert.assertEquals(Optional.of(R.drawable.icon_actions_profileswitch), actionProfileSwitchPercent.icon()); } @Test