From a213bf0839be7e5a541b3704760f0c29494af49e Mon Sep 17 00:00:00 2001 From: Doris Ling Date: Wed, 10 Jan 2018 17:26:48 -0800 Subject: [PATCH] Separate suggestions and conditions. This is the initial change for updating the suggestion cards: - add a feature flag to swap between the new and current UI - change suggestions to a standalone dashboard item. It becomes a horizontal scroll list that won't collapse/expand. - the expand/collapse logic now only control the conditions list - add draft for the new suggestion UI elements, but detail to fine-tune to match the UI spec will come in following changes. Bug: 70573674 Test: make RunSettingsRoboTests Change-Id: I00c901e2598b26a34288fc73fd6031cc26a29ac6 --- res/drawable/ic_suggestion_close_button.xml | 25 + res/layout/condition_container.xml | 44 ++ res/layout/suggestion_container.xml | 64 +++ res/layout/suggestion_tile_v2.xml | 77 +++ res/layout/suggestion_tile_with_button_v2.xml | 84 ++++ res/values-sw400dp/dimens.xml | 7 + res/values/dimens.xml | 7 + res/values/strings.xml | 3 + res/values/styles.xml | 7 + .../android/settings/core/FeatureFlags.java | 1 + .../dashboard/DashboardAdapterV2.java | 442 +++++++++++++++++ .../settings/dashboard/DashboardDataV2.java | 446 ++++++++++++++++++ .../dashboard/DashboardFeatureProvider.java | 5 + .../DashboardFeatureProviderImpl.java | 7 + .../settings/dashboard/DashboardSummary.java | 73 ++- .../conditional/ConditionAdapterV2.java | 186 ++++++++ .../suggestions/SuggestionAdapterV2.java | 231 +++++++++ .../SuggestionDismissController.java | 4 + .../dashboard/DashboardAdapterV2Test.java | 263 +++++++++++ .../conditional/ConditionAdapterV2Test.java | 135 ++++++ .../suggestions/SuggestionAdapterTest.java | 44 +- .../suggestions/SuggestionAdapterV2Test.java | 224 +++++++++ 22 files changed, 2333 insertions(+), 46 deletions(-) create mode 100644 res/drawable/ic_suggestion_close_button.xml create mode 100644 res/layout/condition_container.xml create mode 100644 res/layout/suggestion_container.xml create mode 100644 res/layout/suggestion_tile_v2.xml create mode 100644 res/layout/suggestion_tile_with_button_v2.xml create mode 100644 src/com/android/settings/dashboard/DashboardAdapterV2.java create mode 100644 src/com/android/settings/dashboard/DashboardDataV2.java create mode 100644 src/com/android/settings/dashboard/conditional/ConditionAdapterV2.java create mode 100644 src/com/android/settings/dashboard/suggestions/SuggestionAdapterV2.java create mode 100644 tests/robotests/src/com/android/settings/dashboard/DashboardAdapterV2Test.java create mode 100644 tests/robotests/src/com/android/settings/dashboard/conditional/ConditionAdapterV2Test.java create mode 100644 tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionAdapterV2Test.java diff --git a/res/drawable/ic_suggestion_close_button.xml b/res/drawable/ic_suggestion_close_button.xml new file mode 100644 index 00000000000..615b2156737 --- /dev/null +++ b/res/drawable/ic_suggestion_close_button.xml @@ -0,0 +1,25 @@ + + + + + diff --git a/res/layout/condition_container.xml b/res/layout/condition_container.xml new file mode 100644 index 00000000000..808c4ac51a5 --- /dev/null +++ b/res/layout/condition_container.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + diff --git a/res/layout/suggestion_container.xml b/res/layout/suggestion_container.xml new file mode 100644 index 00000000000..2aa104333db --- /dev/null +++ b/res/layout/suggestion_container.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + diff --git a/res/layout/suggestion_tile_v2.xml b/res/layout/suggestion_tile_v2.xml new file mode 100644 index 00000000000..e180897af06 --- /dev/null +++ b/res/layout/suggestion_tile_v2.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/layout/suggestion_tile_with_button_v2.xml b/res/layout/suggestion_tile_with_button_v2.xml new file mode 100644 index 00000000000..01be23658fc --- /dev/null +++ b/res/layout/suggestion_tile_with_button_v2.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + +