Fast Pair Half Sheet UI implementation
Refactor doc: go/fp-halfsheet-aosp
Fix: 196262706
Fix: 196644352
Fix: 218771606
Test: Built band verified flow manually
Change-Id: I2496d111410e9bc715547b8fdbe708730304df8c
diff --git a/nearby/halfsheet/res/drawable/fast_pair_ic_info.xml b/nearby/halfsheet/res/drawable/fast_pair_ic_info.xml
index cc514e5..7d61d1c 100644
--- a/nearby/halfsheet/res/drawable/fast_pair_ic_info.xml
+++ b/nearby/halfsheet/res/drawable/fast_pair_ic_info.xml
@@ -17,7 +17,8 @@
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
- android:viewportHeight="24.0">
+ android:viewportHeight="24.0"
+ android:tint="@color/fast_pair_half_sheet_subtitle_color">
<path
android:fillColor="@color/fast_pair_half_sheet_subtitle_color"
android:pathData="M11,17h2v-6h-2v6zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM11,9h2L13,7h-2v2z"/>
diff --git a/nearby/halfsheet/res/layout/fast_pair_device_pairing_fragment.xml b/nearby/halfsheet/res/layout/fast_pair_device_pairing_fragment.xml
index 24fcd83..7fbe229 100644
--- a/nearby/halfsheet/res/layout/fast_pair_device_pairing_fragment.xml
+++ b/nearby/halfsheet/res/layout/fast_pair_device_pairing_fragment.xml
@@ -73,50 +73,67 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="horizontal"
app:layout_constraintTop_toBottomOf="@+id/connect_progressbar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
+
<ImageView
android:id="@+id/info_icon"
+ android:layout_width="24dp"
+ android:layout_height="24dp"
+ app:srcCompat="@drawable/fast_pair_ic_info"
android:layout_centerInParent="true"
android:contentDescription="@null"
android:layout_marginEnd="10dp"
android:layout_toStartOf="@id/connect_btn"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
- <Button
+ android:visibility="invisible" />
+
+ <com.google.android.material.button.MaterialButton
android:id="@+id/connect_btn"
- android:text="@string/common_connect"
- android:layout_height="wrap_content"
android:layout_width="@dimen/fast_pair_half_sheet_image_size"
+ android:layout_height="wrap_content"
+ android:text="@string/paring_action_connect"
android:layout_centerInParent="true"
- android:background="@color/fast_pair_half_sheet_button_color"
style="@style/HalfSheetButton" />
+
</RelativeLayout>
- <Button
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/settings_btn"
+ android:text="@string/paring_action_settings"
+ android:layout_height="wrap_content"
+ android:layout_width="@dimen/fast_pair_half_sheet_image_size"
+ app:layout_constraintTop_toBottomOf="@+id/connect_progressbar"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ android:visibility="invisible"
+ style="@style/HalfSheetButton" />
+
+ <com.google.android.material.button.MaterialButton
android:id="@+id/cancel_btn"
- android:text="@string/common_done"
- android:visibility="gone"
+ android:text="@string/paring_action_done"
+ android:visibility="invisible"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:gravity="start|center_vertical"
android:layout_marginTop="6dp"
- android:layout_marginBottom="16dp"
style="@style/HalfSheetButtonBorderless"/>
- <Button
+ <com.google.android.material.button.MaterialButton
android:id="@+id/setup_btn"
+ android:text="@string/paring_action_launch"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginTop="6dp"
android:layout_marginBottom="16dp"
android:background="@color/fast_pair_half_sheet_button_color"
- android:visibility="gone"
+ android:visibility="invisible"
android:layout_height="@dimen/fast_pair_half_sheet_bottom_button_height"
android:layout_width="wrap_content"
style="@style/HalfSheetButton" />
+
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
diff --git a/nearby/halfsheet/res/values/strings.xml b/nearby/halfsheet/res/values/strings.xml
index 12e3c23..01a82e4 100644
--- a/nearby/halfsheet/res/values/strings.xml
+++ b/nearby/halfsheet/res/values/strings.xml
@@ -16,9 +16,57 @@
<resources>
- <string name="common_done" description="After pairing process finish button text to dismiss halfsheet">Done</string>
- <string name="common_save">Save</string>
- <string name="common_connect" description="Button text to start connecting process">Connect</string>
- <string name="fast_pair_app_launch_button" description="String on app launch half sheet button.">Set up</string>
+ <!--
+ ============================================================
+ PAIRING FRAGMENT
+ ============================================================
+ -->
+ <!--
+ A button shown to remind user setup is in progress. [CHAR LIMIT=30]
+ -->
+ <string name="fast_pair_setup_in_progress">Starting Setup…</string>
+ <!--
+ Title text shown to remind user to setup a device through companion app. [CHAR LIMIT=40]
+ -->
+ <string name="fast_pair_title_setup">Set up device</string>
+ <!--
+ Title after we successfully pair with the audio device
+ [CHAR LIMIT=30]
+ -->
+ <string name="fast_pair_device_ready">Device connected</string>
+ <!-- Title text shown when peripheral device fail to connect to phone. [CHAR_LIMIT=30] -->
+ <string name="fast_pair_title_fail">Couldn\'t connect</string>
+
+ <!--
+ ============================================================
+ MISCELLANEOUS
+ ============================================================
+ -->
+
+ <!--
+ A button shown after paring process to dismiss the current activity.
+ [CHAR LIMIT=30]
+ -->
+ <string name="paring_action_done">Done</string>
+ <!--
+ A button shown for retroactive paring.
+ [CHAR LIMIT=30]
+ -->
+ <string name="paring_action_save">Save</string>
+ <!--
+ A button to start connecting process.
+ [CHAR LIMIT=30]
+ -->
+ <string name="paring_action_connect">Connect</string>
+ <!--
+ A button to launch a companion app.
+ [CHAR LIMIT=30]
+ -->
+ <string name="paring_action_launch">Set up</string>
+ <!--
+ A button to launch a bluetooth Settings page.
+ [CHAR LIMIT=20]
+ -->
+ <string name="paring_action_settings">Settings</string>
</resources>
\ No newline at end of file
diff --git a/nearby/halfsheet/res/values/styles.xml b/nearby/halfsheet/res/values/styles.xml
index b48da70..917bb63 100644
--- a/nearby/halfsheet/res/values/styles.xml
+++ b/nearby/halfsheet/res/values/styles.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
- <style name="HalfSheetStyle" parent="Theme.MaterialComponents.DayNight.NoActionBar">
+ <style name="HalfSheetStyle" parent="Theme.Material3.DayNight.NoActionBar">
<item name="android:windowFrame">@null</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowEnterAnimation">@anim/fast_pair_half_sheet_slide_in</item>
@@ -14,7 +14,7 @@
<item name="android:windowTranslucentNavigation">true</item>
</style>
- <style name="HalfSheetButton" parent="@style/Widget.MaterialComponents.Button.TextButton">
+ <style name="HalfSheetButton" parent="@style/Widget.Material3.Button.TonalButton">
<item name="android:textColor">@color/fast_pair_half_sheet_button_accent_text</item>
<item name="android:backgroundTint">@color/fast_pair_half_sheet_button_color</item>
<item name="android:textSize">@dimen/fast_pair_notification_text_size</item>
@@ -23,8 +23,7 @@
<item name="android:textAllCaps">false</item>
</style>
- <style name="HalfSheetButtonBorderless"
- parent="@style/Widget.MaterialComponents.Button.OutlinedButton">
+ <style name="HalfSheetButtonBorderless" parent="@style/Widget.Material3.Button.OutlinedButton">
<item name="android:textColor">@color/fast_pair_half_sheet_button_text</item>
<item name="android:strokeColor">@color/fast_pair_half_sheet_button_color</item>
<item name="android:textAllCaps">false</item>