commit
UI updates
diff --git a/api-helper/app/src/main/res/drawable/bg_badge_post.xml b/api-helper/app/src/main/res/drawable/bg_badge_post.xml
new file mode 100644
index 0000000..c291e49
--- /dev/null
+++ b/api-helper/app/src/main/res/drawable/bg_badge_post.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+ <solid android:color="#26f9e2af" />
+ <stroke android:width="1dp" android:color="#59f9e2af" />
+ <corners android:radius="5dp" />
+</shape>
diff --git a/api-helper/app/src/main/res/drawable/bg_card.xml b/api-helper/app/src/main/res/drawable/bg_card.xml
new file mode 100644
index 0000000..9e7d2d1
--- /dev/null
+++ b/api-helper/app/src/main/res/drawable/bg_card.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+ <solid android:color="@color/surface0" />
+ <stroke android:width="1dp" android:color="@color/surface2" />
+ <corners android:radius="10dp" />
+</shape>
diff --git a/api-helper/app/src/main/res/drawable/bg_input.xml b/api-helper/app/src/main/res/drawable/bg_input.xml
new file mode 100644
index 0000000..6f7d52e
--- /dev/null
+++ b/api-helper/app/src/main/res/drawable/bg_input.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_focused="true">
+ <shape android:shape="rectangle">
+ <solid android:color="@color/surface0" />
+ <stroke android:width="1dp" android:color="@color/pink" />
+ <corners android:radius="9dp" />
+ </shape>
+ </item>
+ <item>
+ <shape android:shape="rectangle">
+ <solid android:color="@color/surface0" />
+ <stroke android:width="1dp" android:color="@color/surface2" />
+ <corners android:radius="9dp" />
+ </shape>
+ </item>
+</selector>
diff --git a/api-helper/app/src/main/res/drawable/bg_pill_key.xml b/api-helper/app/src/main/res/drawable/bg_pill_key.xml
new file mode 100644
index 0000000..98c7b5f
--- /dev/null
+++ b/api-helper/app/src/main/res/drawable/bg_pill_key.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+ <solid android:color="#00000000" />
+ <stroke android:width="1dp" android:color="#66c9a9f0" />
+ <corners android:radius="20dp" />
+</shape>
diff --git a/api-helper/app/src/main/res/drawable/bg_status.xml b/api-helper/app/src/main/res/drawable/bg_status.xml
new file mode 100644
index 0000000..c544b38
--- /dev/null
+++ b/api-helper/app/src/main/res/drawable/bg_status.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+ <solid android:color="@color/mantle" />
+ <stroke android:width="1dp" android:color="@color/surface2" />
+ <corners android:radius="8dp" />
+</shape>
diff --git a/api-helper/app/src/main/res/layout/activity_main.xml b/api-helper/app/src/main/res/layout/activity_main.xml
index 6e14734..3137f16 100644
--- a/api-helper/app/src/main/res/layout/activity_main.xml
+++ b/api-helper/app/src/main/res/layout/activity_main.xml
@@ -1,7 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ android:background="@color/base"
+ android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
@@ -9,144 +12,313 @@
android:orientation="vertical"
android:padding="20dp">
- <TextView
- android:layout_width="match_parent"
+ <!-- Header -->
+ <LinearLayout
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="Device Reporter"
- android:textSize="22sp"
- android:textStyle="bold"
- android:paddingBottom="12dp" />
+ android:orientation="horizontal"
+ android:baselineAligned="false">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Device Reporter"
+ android:textColor="@color/text"
+ android:textSize="22sp"
+ android:textStyle="bold"
+ android:fontFamily="monospace" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="."
+ android:textColor="@color/pink"
+ android:textSize="22sp"
+ android:textStyle="bold"
+ android:fontFamily="monospace" />
+ </LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="Base URL"
- android:textStyle="bold"
- android:paddingTop="8dp" />
+ android:layout_marginTop="4dp"
+ android:text="Reports this device's state to your Doughmination API."
+ android:textColor="@color/subtext0"
+ android:textSize="13sp"
+ android:fontFamily="monospace" />
- <EditText
- android:id="@+id/inputBaseUrl"
+ <!-- Endpoint chip, echoing the /docs cards -->
+ <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:hint="https://doughmination.uk/v2"
- android:inputType="textUri" />
+ android:orientation="vertical"
+ android:layout_marginTop="16dp"
+ android:background="@drawable/bg_card"
+ android:padding="14dp">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:gravity="center_vertical"
+ android:baselineAligned="false">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:background="@drawable/bg_badge_post"
+ android:paddingHorizontal="8dp"
+ android:paddingVertical="2dp"
+ android:text="POST"
+ android:textColor="@color/yellow"
+ android:textSize="12sp"
+ android:textStyle="bold"
+ android:fontFamily="monospace" />
+
+ <TextView
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:layout_marginStart="10dp"
+ android:text="/v2/devices"
+ android:textColor="@color/text"
+ android:textSize="14sp"
+ android:textStyle="bold"
+ android:fontFamily="monospace" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:background="@drawable/bg_pill_key"
+ android:paddingHorizontal="8dp"
+ android:paddingVertical="2dp"
+ android:text="key"
+ android:textColor="@color/mauve"
+ android:textSize="11sp"
+ android:fontFamily="monospace" />
+ </LinearLayout>
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="9dp"
+ android:text="Only 'device' is required; supplied fields are updated. Sends the X-Battery-Key header."
+ android:textColor="@color/subtext1"
+ android:textSize="13sp"
+ android:fontFamily="monospace" />
+ </LinearLayout>
+
+ <!-- Configuration -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="X-Battery-Key"
- android:textStyle="bold"
- android:paddingTop="8dp" />
+ android:layout_marginTop="22dp"
+ android:layout_marginBottom="10dp"
+ android:text="CONFIGURATION"
+ android:textColor="@color/pink"
+ android:textSize="12sp"
+ android:letterSpacing="0.08"
+ android:fontFamily="monospace" />
- <EditText
- android:id="@+id/inputApiKey"
+ <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:hint="your secret key"
- android:inputType="textPassword" />
+ android:orientation="vertical"
+ android:background="@drawable/bg_card"
+ android:padding="14dp">
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="Device name"
- android:textStyle="bold"
- android:paddingTop="8dp" />
+ <TextView style="@style/FieldLabel" android:text="Base URL" />
+
+ <EditText
+ android:id="@+id/inputBaseUrl"
+ style="@style/FieldInput"
+ android:hint="https://doughmination.uk/v2"
+ android:inputType="textUri" />
+
+ <TextView style="@style/FieldLabel" android:text="X-Battery-Key" />
- <EditText
- android:id="@+id/inputDevice"
+ <EditText
+ android:id="@+id/inputApiKey"
+ style="@style/FieldInput"
+ android:hint="your device key"
+ android:inputType="textPassword" />
+
+ <TextView style="@style/FieldLabel" android:text="Device name" />
+
+ <EditText
+ android:id="@+id/inputDevice"
+ style="@style/FieldInput"
+ android:hint="pixel"
+ android:inputType="text" />
+ </LinearLayout>
+
+ <!-- Peripherals -->
+ <TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:hint="pixel"
- android:inputType="text" />
+ android:layout_marginTop="22dp"
+ android:layout_marginBottom="10dp"
+ android:text="PERIPHERALS"
+ android:textColor="@color/pink"
+ android:textSize="12sp"
+ android:letterSpacing="0.08"
+ android:fontFamily="monospace" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:gravity="center_vertical"
- android:paddingTop="16dp">
+ android:orientation="vertical"
+ android:background="@drawable/bg_card"
+ android:padding="14dp">
- <TextView
- android:layout_width="0dp"
+ <LinearLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="Watch connected (manual)"
- android:textStyle="bold" />
+ android:orientation="horizontal"
+ android:gravity="center_vertical">
- <com.google.android.material.switchmaterial.SwitchMaterial
- android:id="@+id/switchWatch"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
- </LinearLayout>
+ <TextView
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="Watch connected (manual)"
+ android:textColor="@color/subtext1"
+ android:textSize="14sp"
+ android:fontFamily="monospace" />
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:gravity="center_vertical"
- android:paddingTop="8dp">
+ <com.google.android.material.switchmaterial.SwitchMaterial
+ android:id="@+id/switchWatch"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+ </LinearLayout>
- <TextView
- android:layout_width="0dp"
+ <LinearLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="Enable AirPods (Bluetooth) reporting"
- android:textStyle="bold" />
+ android:orientation="horizontal"
+ android:gravity="center_vertical"
+ android:layout_marginTop="6dp">
- <com.google.android.material.switchmaterial.SwitchMaterial
- android:id="@+id/switchAirpods"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
- </LinearLayout>
+ <TextView
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="AirPods (Bluetooth) reporting"
+ android:textColor="@color/subtext1"
+ android:textSize="14sp"
+ android:fontFamily="monospace" />
- <TextView
- android:id="@+id/textAirpodsDevice"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="No AirPods device selected"
- android:paddingTop="4dp" />
+ <com.google.android.material.switchmaterial.SwitchMaterial
+ android:id="@+id/switchAirpods"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+ </LinearLayout>
- <Button
- android:id="@+id/btnSelectAirpods"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="Select AirPods device"
- android:layout_marginTop="4dp" />
+ <TextView
+ android:id="@+id/textAirpodsDevice"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="6dp"
+ android:text="No AirPods device selected"
+ android:textColor="@color/subtext0"
+ android:textSize="12sp"
+ android:fontFamily="monospace" />
- <Button
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/btnSelectAirpods"
+ style="@style/Widget.MaterialComponents.Button.OutlinedButton"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="10dp"
+ android:text="Select AirPods device"
+ android:textColor="@color/mauve"
+ android:fontFamily="monospace"
+ app:cornerRadius="9dp"
+ app:strokeColor="@color/mauve"
+ app:rippleColor="@color/surface2" />
+ </LinearLayout>
+
+ <!-- Actions -->
+ <com.google.android.material.button.MaterialButton
android:id="@+id/btnSave"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:layout_marginTop="20dp"
android:text="Save settings"
- android:layout_marginTop="20dp" />
+ android:textColor="@color/base"
+ android:textAllCaps="false"
+ android:fontFamily="monospace"
+ app:backgroundTint="@color/pink"
+ app:cornerRadius="9dp" />
- <Button
- android:id="@+id/btnStart"
+ <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="Start reporting service"
- android:layout_marginTop="8dp" />
+ android:orientation="horizontal"
+ android:layout_marginTop="8dp"
+ android:baselineAligned="false">
- <Button
- android:id="@+id/btnStop"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="Stop reporting service"
- android:layout_marginTop="8dp" />
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/btnStart"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:layout_marginEnd="4dp"
+ android:text="Start"
+ android:textColor="@color/base"
+ android:textAllCaps="false"
+ android:fontFamily="monospace"
+ app:backgroundTint="@color/green"
+ app:cornerRadius="9dp" />
- <Button
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/btnStop"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:layout_marginStart="4dp"
+ android:text="Stop"
+ android:textColor="@color/base"
+ android:textAllCaps="false"
+ android:fontFamily="monospace"
+ app:backgroundTint="@color/red"
+ app:cornerRadius="9dp" />
+ </LinearLayout>
+
+ <com.google.android.material.button.MaterialButton
android:id="@+id/btnTest"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:layout_marginTop="8dp"
android:text="Send test report now"
- android:layout_marginTop="8dp" />
+ android:textColor="@color/base"
+ android:textAllCaps="false"
+ android:fontFamily="monospace"
+ app:backgroundTint="@color/yellow"
+ app:cornerRadius="9dp" />
+
+ <!-- Status -->
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="22dp"
+ android:layout_marginBottom="10dp"
+ android:text="LAST REPORT"
+ android:textColor="@color/pink"
+ android:textSize="12sp"
+ android:letterSpacing="0.08"
+ android:fontFamily="monospace" />
<TextView
android:id="@+id/textStatus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:background="@drawable/bg_status"
+ android:padding="12dp"
android:text="Idle."
- android:paddingTop="20dp"
+ android:textColor="@color/subtext1"
+ android:textSize="12sp"
+ android:fontFamily="monospace"
android:textIsSelectable="true" />
</LinearLayout>
diff --git a/api-helper/app/src/main/res/values/colors.xml b/api-helper/app/src/main/res/values/colors.xml
index a1a60dc..bc98c17 100644
--- a/api-helper/app/src/main/res/values/colors.xml
+++ b/api-helper/app/src/main/res/values/colors.xml
@@ -1,3 +1,23 @@
<resources>
- <color name="ic_launcher_background">#0B6E4F</color>
+ <!-- Doughmination "info dark" palette, mirrored from the /docs page. -->
+ <color name="base">#0a0b10</color>
+ <color name="mantle">#070810</color>
+ <color name="crust">#050609</color>
+ <color name="surface0">#12141c</color>
+ <color name="surface1">#1b1e2a</color>
+ <color name="surface2">#232838</color>
+ <color name="overlay1">#6b7391</color>
+ <color name="subtext0">#9aa3c2</color>
+ <color name="subtext1">#c9cfe0</color>
+ <color name="text">#f4f6fb</color>
+
+ <color name="pink">#f5a9b8</color>
+ <color name="mauve">#c9a9f0</color>
+ <color name="red">#f38ba8</color>
+ <color name="peach">#fab387</color>
+ <color name="yellow">#f9e2af</color>
+ <color name="green">#a6e3a1</color>
+ <color name="blue">#89b4fa</color>
+
+ <color name="ic_launcher_background">#0a0b10</color>
</resources>
diff --git a/api-helper/app/src/main/res/values/styles.xml b/api-helper/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..a03c39f
--- /dev/null
+++ b/api-helper/app/src/main/res/values/styles.xml
@@ -0,0 +1,24 @@
+<resources>
+
+ <style name="FieldLabel">
+ <item name="android:layout_width">match_parent</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:layout_marginTop">12dp</item>
+ <item name="android:layout_marginBottom">4dp</item>
+ <item name="android:textColor">@color/pink</item>
+ <item name="android:textSize">12sp</item>
+ <item name="android:fontFamily">monospace</item>
+ </style>
+
+ <style name="FieldInput">
+ <item name="android:layout_width">match_parent</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:background">@drawable/bg_input</item>
+ <item name="android:padding">12dp</item>
+ <item name="android:textColor">@color/text</item>
+ <item name="android:textColorHint">@color/overlay1</item>
+ <item name="android:textSize">15sp</item>
+ <item name="android:fontFamily">monospace</item>
+ </style>
+
+</resources>
diff --git a/api-helper/app/src/main/res/values/themes.xml b/api-helper/app/src/main/res/values/themes.xml
index 5ec47c3..8ff384c 100644
--- a/api-helper/app/src/main/res/values/themes.xml
+++ b/api-helper/app/src/main/res/values/themes.xml
@@ -1,3 +1,17 @@
<resources>
- <style name="Theme.DeviceReporter" parent="Theme.MaterialComponents.DayNight.DarkActionBar" />
+ <style name="Theme.DeviceReporter" parent="Theme.MaterialComponents.NoActionBar">
+ <item name="android:windowBackground">@color/base</item>
+ <item name="android:statusBarColor">@color/mantle</item>
+ <item name="android:navigationBarColor">@color/base</item>
+ <item name="colorPrimary">@color/pink</item>
+ <item name="colorOnPrimary">@color/base</item>
+ <item name="colorSecondary">@color/pink</item>
+ <item name="colorOnSecondary">@color/base</item>
+ <item name="colorControlActivated">@color/pink</item>
+ <item name="colorControlNormal">@color/subtext0</item>
+ <item name="android:textColor">@color/text</item>
+ <item name="android:textColorPrimary">@color/text</item>
+ <item name="android:textColorHint">@color/overlay1</item>
+ <item name="android:fontFamily">monospace</item>
+ </style>
</resources>