From c1eaa136602fd93106c38912a79b5279a831741e Mon Sep 17 00:00:00 2001 From: Yabin Huang Date: Fri, 9 Apr 2021 15:52:49 -0700 Subject: Demo updating a view without losing focus Add a FocusArea to the Cards tab to demonstrate how to update a view properly. Fixes: 185377477 Test: manual Change-Id: I66038ef4677ee904246bf1dd16503fca4b27c9c1 --- .../res/drawable/button_background.xml | 21 ++++++ .../res/drawable/custom_button_background.xml | 22 ++++++ RotaryPlayground/res/drawable/ic_play_arrow.xml | 30 ++++++++ .../res/drawable/ic_play_arrow_off.xml | 35 +++++++++ RotaryPlayground/res/drawable/ic_stop.xml | 28 +++++++ RotaryPlayground/res/layout/rotary_cards.xml | 85 ++++++++++++++++++---- RotaryPlayground/res/values/attrs.xml | 21 ++++++ .../android/car/rotaryplayground/CustomButton.java | 65 +++++++++++++++++ .../android/car/rotaryplayground/RotaryCards.java | 61 ++++++++++++++++ 9 files changed, 353 insertions(+), 15 deletions(-) create mode 100644 RotaryPlayground/res/drawable/button_background.xml create mode 100644 RotaryPlayground/res/drawable/custom_button_background.xml create mode 100644 RotaryPlayground/res/drawable/ic_play_arrow.xml create mode 100644 RotaryPlayground/res/drawable/ic_play_arrow_off.xml create mode 100644 RotaryPlayground/res/drawable/ic_stop.xml create mode 100644 RotaryPlayground/res/values/attrs.xml create mode 100644 RotaryPlayground/src/com/android/car/rotaryplayground/CustomButton.java diff --git a/RotaryPlayground/res/drawable/button_background.xml b/RotaryPlayground/res/drawable/button_background.xml new file mode 100644 index 0000000..25566c5 --- /dev/null +++ b/RotaryPlayground/res/drawable/button_background.xml @@ -0,0 +1,21 @@ + + + + + + + diff --git a/RotaryPlayground/res/drawable/custom_button_background.xml b/RotaryPlayground/res/drawable/custom_button_background.xml new file mode 100644 index 0000000..d4716fa --- /dev/null +++ b/RotaryPlayground/res/drawable/custom_button_background.xml @@ -0,0 +1,22 @@ + + + + + + + diff --git a/RotaryPlayground/res/drawable/ic_play_arrow.xml b/RotaryPlayground/res/drawable/ic_play_arrow.xml new file mode 100644 index 0000000..5c0c252 --- /dev/null +++ b/RotaryPlayground/res/drawable/ic_play_arrow.xml @@ -0,0 +1,30 @@ + + + + + + + + diff --git a/RotaryPlayground/res/drawable/ic_play_arrow_off.xml b/RotaryPlayground/res/drawable/ic_play_arrow_off.xml new file mode 100644 index 0000000..8ad935f --- /dev/null +++ b/RotaryPlayground/res/drawable/ic_play_arrow_off.xml @@ -0,0 +1,35 @@ + + + + + + + + + diff --git a/RotaryPlayground/res/drawable/ic_stop.xml b/RotaryPlayground/res/drawable/ic_stop.xml new file mode 100644 index 0000000..fc42b32 --- /dev/null +++ b/RotaryPlayground/res/drawable/ic_stop.xml @@ -0,0 +1,28 @@ + + + + + + + diff --git a/RotaryPlayground/res/layout/rotary_cards.xml b/RotaryPlayground/res/layout/rotary_cards.xml index e3d9e87..2ffdfdc 100644 --- a/RotaryPlayground/res/layout/rotary_cards.xml +++ b/RotaryPlayground/res/layout/rotary_cards.xml @@ -149,7 +149,8 @@ android:layout_width="@dimen/card_width" android:layout_height="match_parent" android:padding="@dimen/card_padding" - android:orientation="vertical"> + android:orientation="vertical" + app:defaultFocus="@+id/default_focus"> -