jetpack compliance, code cleanup, extracted resources

This commit is contained in:
Milos Kozak 2019-07-11 18:18:05 +01:00
parent 829ef9b6ad
commit 4df1127a8c
13 changed files with 197 additions and 223 deletions

View file

@ -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;

View file

@ -118,7 +118,7 @@ public class TriggerProfilePercent extends Trigger {
@Override
public Optional<Integer> icon() {
return Optional.of(R.drawable.remove);
return Optional.of(R.drawable.icon_actions_profileswitch);
}
@Override

View file

@ -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" />
<LinearLayout
android:id="@+id/layoutText"
@ -27,8 +28,8 @@
android:orientation="vertical"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_toLeftOf="@id/iconTrash"
android:layout_alignParentLeft="true">
android:layout_toStartOf="@id/iconTrash"
android:layout_alignParentStart="true">
<TextView
android:id="@+id/viewActionTitle"

View file

@ -1,39 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minWidth="300dp"
android:padding="10dp">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
<TextView
android:id="@+id/viewActionTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:layout_gravity="center_horizontal"
android:paddingBottom="10dp"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/viewActionTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingBottom="10dp"
android:textAppearance="?android:attr/textAppearanceLarge" />
<LinearLayout
android:id="@+id/layout_root"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:padding="10dp" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:padding="10dp"
android:id="@+id/layout_root" />
<include layout="@layout/mdtp_done_button" />
<include layout="@layout/mdtp_done_button" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
</ScrollView>

View file

@ -1,36 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="info.nightscout.androidaps.plugins.general.automation.dialogs.EditEventDialog">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:padding="10dp">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:padding="10dp">
android:text="@string/please_choose_an_action_type" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Please choose an action type:"/>
<RadioGroup
android:id="@+id/radioGroup"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginVertical="5dp" />
<RadioGroup
android:id="@+id/radioGroup"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginVertical="5dp"/>
<include layout="@layout/mdtp_done_button" />
<include layout="@layout/mdtp_done_button" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</FrameLayout>
</ScrollView>

View file

@ -1,36 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="info.nightscout.androidaps.plugins.general.automation.dialogs.EditEventDialog">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:padding="10dp">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:padding="10dp">
android:text="@string/please_choose_a_trigger_type" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Please choose a trigger type:"/>
<RadioGroup
android:id="@+id/radioGroup"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginVertical="5dp" />
<RadioGroup
android:id="@+id/radioGroup"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginVertical="5dp"/>
<include layout="@layout/mdtp_done_button" />
<include layout="@layout/mdtp_done_button" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</FrameLayout>
</ScrollView>

View file

@ -1,15 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="info.nightscout.androidaps.plugins.general.automation.dialogs.EditEventDialog">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusableInTouchMode="true"
@ -20,7 +16,7 @@
android:id="@+id/inputEventTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Event Name" />
android:hint="@string/eventname" />
<View
android:layout_width="fill_parent"
@ -36,7 +32,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="if:"/>
android:text="@string/if_label"/>
<TextView
android:id="@+id/editTrigger"
@ -44,7 +40,7 @@
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:text="Edit" />
android:text="@string/edit_short" />
</RelativeLayout>
@ -70,7 +66,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="then:"/>
android:text="@string/then_label"/>
<TextView
android:id="@+id/editAction"
@ -78,7 +74,7 @@
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:text="Edit" />
android:text="@string/edit_short" />
</RelativeLayout>
@ -94,6 +90,4 @@
</LinearLayout>
</ScrollView>
</FrameLayout>
</ScrollView>

View file

@ -1,38 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="info.nightscout.androidaps.plugins.general.automation.dialogs.EditEventDialog">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:padding="10dp">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:padding="10dp">
android:text="@string/triggers" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Triggers:"/>
<LinearLayout
android:id="@+id/layoutTrigger"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:orientation="vertical" />
<LinearLayout
android:id="@+id/layoutTrigger"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:orientation="vertical" />
<include layout="@layout/mdtp_done_button" />
<include layout="@layout/mdtp_done_button" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</FrameLayout>
</ScrollView>

View file

@ -1,102 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="info.nightscout.androidaps.plugins.general.automation.dialogs.EditEventDialog">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:padding="10dp">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/inputEventTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:padding="10dp">
android:hint="@string/taskname" />
<android.support.design.widget.TextInputEditText
android:id="@+id/inputEventTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Task Name" />
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="@color/listdelimiter" />
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:background="@color/listdelimiter" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/condition"/>
<TextView
android:id="@+id/editTrigger"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:padding="8dp"
android:background="@color/ribbonDefault"
android:text="Edit" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/triggerDescription"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:orientation="vertical" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/condition" />
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:background="@color/listdelimiter" />
<TextView
android:id="@+id/editTrigger"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:background="@color/ribbonDefault"
android:padding="8dp"
android:text="@string/edit_short" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/action"/>
<TextView
android:id="@+id/triggerDescription"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:orientation="vertical" />
<TextView
android:id="@+id/editAction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:padding="8dp"
android:background="@color/ribbonDefault"
android:text="Add" />
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="@color/listdelimiter" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView
android:id="@+id/actionListView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/action" />
<include layout="@layout/mdtp_done_button" />
<TextView
android:id="@+id/editAction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:background="@color/ribbonDefault"
android:padding="8dp"
android:text="@string/add_short" />
</LinearLayout>
</RelativeLayout>
</ScrollView>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/actionListView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp" />
</FrameLayout>
<include layout="@layout/mdtp_done_button" />
</LinearLayout>
</ScrollView>

View file

@ -1,34 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/rootLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:padding="8dp"
android:background="@color/ribbonDefault">
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:background="@color/ribbonDefault"
android:padding="8dp">
<ImageView
android:id="@+id/iconTrash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:src="@drawable/ic_trash_outline"
android:contentDescription="Remove"/>
android:layout_alignParentEnd="true"
android:contentDescription="@string/remove_label"
android:orientation="horizontal"
android:src="@drawable/ic_trash_outline" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_toLeftOf="@id/iconTrash"
android:layout_toStartOf="@id/iconTrash"
android:orientation="vertical"
app:layout_constraintTop_toTopOf="parent">
<TextView

View file

@ -1,12 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context="info.nightscout.androidaps.plugins.general.automation.AutomationFragment">
<android.support.v7.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/eventListView"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -15,22 +14,23 @@
android:layout_alignParentTop="true"
android:layout_marginBottom="-100dp" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fabAddEvent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:src="@drawable/ic_add_black_24dp"
app:backgroundTint="@color/defaulttext" />
<TextView
android:id="@+id/logView"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_alignParentBottom="true" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fabAddEvent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:clickable="true"
android:focusable="true"
android:src="@drawable/ic_add_black_24dp"
tools:ignore="RelativeOverlap" />
</RelativeLayout>

View file

@ -1422,6 +1422,15 @@
<string name="lastboluscompared">Last bolus time %1$s %2$s min ago</string>
<string name="triggercoblabel">COB</string>
<string name="cobcompared">COB %1$s %2$.0f</string>
<string name="taskname">Task name</string>
<string name="eventname">Event name</string>
<string name="edit_short">EDIT</string>
<string name="please_choose_an_action_type">Please choose an action type:</string>
<string name="please_choose_a_trigger_type">Please choose a trigger type:</string>
<string name="if_label">If:</string>
<string name="then_label">Then:</string>
<string name="triggers">Triggers:</string>
<string name="remove_label">REMOVE</string>
<plurals name="objective_days">
<item quantity="one">%1$d day</item>

View file

@ -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