SystemUI: Update smartspace to 13-QPR1
Credits to https://github.com/BenzoRom/frameworks_packages_SystemUIGoogle (Jason Edson <jaysonedson@gmail.com>) for SystemUIGoogle jar and resources.
Change-Id: I82c310ca72a5b4ae33b414fda223d127abd0d8d2
diff --git a/packages/SystemUI/bcsmartspace/res/drawable/bg_flight_qr_code.xml b/packages/SystemUI/bcsmartspace/res/drawable/bg_flight_qr_code.xml
new file mode 100644
index 0000000..898fd1d
--- /dev/null
+++ b/packages/SystemUI/bcsmartspace/res/drawable/bg_flight_qr_code.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <solid android:color="#ffffff"/>
+ <corners android:radius="20dp"/>
+</shape>
diff --git a/packages/SystemUI/bcsmartspace/res/drawable/bg_image_generic.xml b/packages/SystemUI/bcsmartspace/res/drawable/bg_image_generic.xml
index 72c39f6..fced0b5 100644
--- a/packages/SystemUI/bcsmartspace/res/drawable/bg_image_generic.xml
+++ b/packages/SystemUI/bcsmartspace/res/drawable/bg_image_generic.xml
@@ -1,5 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
-<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
<solid android:color="@android:color/white"/>
<corners android:radius="4dp"/>
</shape>
diff --git a/packages/SystemUI/bcsmartspace/res/drawable/bg_rounded_secondary_card.xml b/packages/SystemUI/bcsmartspace/res/drawable/bg_rounded_secondary_card.xml
new file mode 100644
index 0000000..8aad169
--- /dev/null
+++ b/packages/SystemUI/bcsmartspace/res/drawable/bg_rounded_secondary_card.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <solid android:color="#ffffffff"/>
+ <corners android:radius="@dimen/enhanced_smartspace_secondary_card_corner_radius"/>
+</shape>
diff --git a/packages/SystemUI/bcsmartspace/res/drawable/bg_smartspace_card_secondary.xml b/packages/SystemUI/bcsmartspace/res/drawable/bg_smartspace_card_secondary.xml
deleted file mode 100644
index 7973a2b..0000000
--- a/packages/SystemUI/bcsmartspace/res/drawable/bg_smartspace_card_secondary.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<shape xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
- <solid android:color="?androidprv:attr/colorListDivider"/>
- <corners android:radius="@dimen/enhanced_smartspace_secondary_card_corner_radius"/>
-</shape>
diff --git a/packages/SystemUI/bcsmartspace/res/drawable/bg_smartspace_combination_sub_card.xml b/packages/SystemUI/bcsmartspace/res/drawable/bg_smartspace_combination_sub_card.xml
index c2a767d..ac57986 100644
--- a/packages/SystemUI/bcsmartspace/res/drawable/bg_smartspace_combination_sub_card.xml
+++ b/packages/SystemUI/bcsmartspace/res/drawable/bg_smartspace_combination_sub_card.xml
@@ -1,5 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
-<shape xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
- <solid android:color="?androidprv:attr/colorPopupBackground"/>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+ android:shape="rectangle">
+ <solid android:color="?androidprv:attr/colorAccentPrimary"/>
<corners android:radius="@dimen/enhanced_smartspace_combination_sub_card_corner_radius"/>
</shape>
diff --git a/packages/SystemUI/bcsmartspace/res/drawable/bg_smartspace_media_item.xml b/packages/SystemUI/bcsmartspace/res/drawable/bg_smartspace_media_item.xml
index a964c7b..79691fe 100644
--- a/packages/SystemUI/bcsmartspace/res/drawable/bg_smartspace_media_item.xml
+++ b/packages/SystemUI/bcsmartspace/res/drawable/bg_smartspace_media_item.xml
@@ -1,5 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
-<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
<solid android:color="@android:color/white"/>
<corners android:radius="20dp"/>
</shape>
diff --git a/packages/SystemUI/bcsmartspace/res/drawable/outline_rounded_secondary_card.xml b/packages/SystemUI/bcsmartspace/res/drawable/outline_rounded_secondary_card.xml
new file mode 100644
index 0000000..f19ad91
--- /dev/null
+++ b/packages/SystemUI/bcsmartspace/res/drawable/outline_rounded_secondary_card.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <solid
+ android:color="@android:color/transparent"/>
+ <corners
+ android:radius="@dimen/enhanced_smartspace_secondary_card_corner_radius"/>
+</shape>
diff --git a/packages/SystemUI/bcsmartspace/res/drawable/page_indicator_dot.xml b/packages/SystemUI/bcsmartspace/res/drawable/page_indicator_dot.xml
index ece3fb6..2c39011 100644
--- a/packages/SystemUI/bcsmartspace/res/drawable/page_indicator_dot.xml
+++ b/packages/SystemUI/bcsmartspace/res/drawable/page_indicator_dot.xml
@@ -1,4 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
-<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
- <size android:height="@dimen/page_indicator_dot_size" android:width="@dimen/page_indicator_dot_size"/>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="oval">
+ <size
+ android:height="@dimen/page_indicator_dot_size"
+ android:width="@dimen/page_indicator_dot_size"/>
</shape>
diff --git a/packages/SystemUI/bcsmartspace/res/drawable/videocam.xml b/packages/SystemUI/bcsmartspace/res/drawable/videocam.xml
index a0a09dd..c7f5f52 100644
--- a/packages/SystemUI/bcsmartspace/res/drawable/videocam.xml
+++ b/packages/SystemUI/bcsmartspace/res/drawable/videocam.xml
@@ -1,5 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
-<vector android:tint="?android:textColorSecondary" android:height="24.0dip" android:width="24.0dip" android:viewportWidth="24.0" android:viewportHeight="24.0"
- xmlns:android="http://schemas.android.com/apk/res/android">
- <path android:fillColor="@android:color/white" android:pathData="M4,20Q3.175,20 2.588,19.413Q2,18.825 2,18V6Q2,5.175 2.588,4.588Q3.175,4 4,4H16Q16.825,4 17.413,4.588Q18,5.175 18,6V10.5L22,6.5V17.5L18,13.5V18Q18,18.825 17.413,19.413Q16.825,20 16,20ZM4,18H16Q16,18 16,18Q16,18 16,18V6Q16,6 16,6Q16,6 16,6H4Q4,6 4,6Q4,6 4,6V18Q4,18 4,18Q4,18 4,18ZM4,18Q4,18 4,18Q4,18 4,18V6Q4,6 4,6Q4,6 4,6Q4,6 4,6Q4,6 4,6V18Q4,18 4,18Q4,18 4,18Z" />
-</vector>
\ No newline at end of file
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:tint="?android:attr/textColorSecondary"
+ android:height="24dp"
+ android:width="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M4,20Q3.175,20 2.588,19.413Q2,18.825 2,18V6Q2,5.175 2.588,4.588Q3.175,4 4,4H16Q16.825,4 17.413,4.588Q18,5.175 18,6V10.5L22,6.5V17.5L18,13.5V18Q18,18.825 17.413,19.413Q16.825,20 16,20ZM4,18H16Q16,18 16,18Q16,18 16,18V6Q16,6 16,6Q16,6 16,6H4Q4,6 4,6Q4,6 4,6V18Q4,18 4,18Q4,18 4,18ZM4,18Q4,18 4,18Q4,18 4,18V6Q4,6 4,6Q4,6 4,6Q4,6 4,6Q4,6 4,6V18Q4,18 4,18Q4,18 4,18Z"/>
+</vector>
diff --git a/packages/SystemUI/bcsmartspace/res/drawable/videocam_off.xml b/packages/SystemUI/bcsmartspace/res/drawable/videocam_off.xml
index 54b7d45..5248f456 100644
--- a/packages/SystemUI/bcsmartspace/res/drawable/videocam_off.xml
+++ b/packages/SystemUI/bcsmartspace/res/drawable/videocam_off.xml
@@ -1,5 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
-<vector android:tint="?android:textColorSecondary" android:height="24.0dip" android:width="24.0dip" android:viewportWidth="24.0" android:viewportHeight="24.0"
- xmlns:android="http://schemas.android.com/apk/res/android">
- <path android:fillColor="@android:color/white" android:pathData="M22,17.5 L18,13.5V15.175L16,13.175V6Q16,6 16,6Q16,6 16,6H8.825L6.825,4H16Q16.825,4 17.413,4.588Q18,5.175 18,6V10.5L22,6.5ZM20.55,23.35 L16.95,19.75Q16.725,19.875 16.5,19.938Q16.275,20 16,20H4Q3.175,20 2.588,19.413Q2,18.825 2,18V6Q2,5.725 2.062,5.5Q2.125,5.275 2.25,5.05L0.65,3.45L2.05,2.05L21.95,21.95ZM4,18H15.15Q15.15,18 15.15,18Q15.15,18 15.15,18L4,6.85Q4,6.85 4,6.85Q4,6.85 4,6.85V18Q4,18 4,18Q4,18 4,18ZM12.45,9.625Q12.45,9.625 12.45,9.625Q12.45,9.625 12.45,9.625ZM9.55,12.4Q9.55,12.4 9.55,12.4Q9.55,12.4 9.55,12.4Q9.55,12.4 9.55,12.4Q9.55,12.4 9.55,12.4Q9.55,12.4 9.55,12.4Q9.55,12.4 9.55,12.4Z" />
-</vector>
\ No newline at end of file
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:height="24dp"
+ android:width="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24"
+ android:tint="?android:attr/textColorSecondary">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M22,17.5 L18,13.5V15.175L16,13.175V6Q16,6 16,6Q16,6 16,6H8.825L6.825,4H16Q16.825,4 17.413,4.588Q18,5.175 18,6V10.5L22,6.5ZM20.55,23.35 L16.95,19.75Q16.725,19.875 16.5,19.938Q16.275,20 16,20H4Q3.175,20 2.588,19.413Q2,18.825 2,18V6Q2,5.725 2.062,5.5Q2.125,5.275 2.25,5.05L0.65,3.45L2.05,2.05L21.95,21.95ZM4,18H15.15Q15.15,18 15.15,18Q15.15,18 15.15,18L4,6.85Q4,6.85 4,6.85Q4,6.85 4,6.85V18Q4,18 4,18Q4,18 4,18ZM12.45,9.625Q12.45,9.625 12.45,9.625Q12.45,9.625 12.45,9.625ZM9.55,12.4Q9.55,12.4 9.55,12.4Q9.55,12.4 9.55,12.4Q9.55,12.4 9.55,12.4Q9.55,12.4 9.55,12.4Q9.55,12.4 9.55,12.4Q9.55,12.4 9.55,12.4Z"/>
+</vector>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_base_card_doorbell.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_base_card_doorbell.xml
deleted file mode 100644
index 8378808..0000000
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_base_card_doorbell.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<com.google.android.systemui.smartspace.BcSmartspaceCard xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:baselineAligned="false">
- <include android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="4" layout="@layout/smartspace_title_subtile_pane"/>
-</com.google.android.systemui.smartspace.BcSmartspaceCard>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_base_card_package_delivery.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_base_card_package_delivery.xml
index 15a3d54..9451136 100644
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_base_card_package_delivery.xml
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_base_card_package_delivery.xml
@@ -1,4 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
-<com.google.android.systemui.smartspace.BcSmartspaceCard xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:baselineAligned="false">
- <include android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="5" layout="@layout/smartspace_title_subtile_pane"/>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.google.android.systemui.smartspace.BcSmartspaceCard
+ 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:baselineAligned="false">
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/secondary_card_group"
+ android:visibility="gone"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:paddingEnd="@dimen/enhanced_smartspace_secondary_card_padding_end"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"/>
+
+ <include
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toEndOf="@+id/secondary_card_group"
+ app:layout_constraintTop_toTopOf="parent"
+ layout="@layout/smartspace_title_subtitle_pane"/>
</com.google.android.systemui.smartspace.BcSmartspaceCard>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_base_template_card.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_base_template_card.xml
new file mode 100644
index 0000000..fd157b1
--- /dev/null
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_base_template_card.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.google.android.systemui.smartspace.uitemplate.BaseTemplateCard
+ 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="@dimen/enhanced_smartspace_card_height"
+ android:baselineAligned="false">
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/secondary_card_group"
+ android:visibility="gone"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:paddingEnd="@dimen/enhanced_smartspace_secondary_card_padding_end"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"/>
+
+ <include
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toEndOf="@+id/secondary_card_group"
+ app:layout_constraintTop_toTopOf="parent"
+ layout="@layout/smartspace_title_subtitle_pane"/>
+</com.google.android.systemui.smartspace.uitemplate.BaseTemplateCard>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_base_template_card_with_date.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_base_template_card_with_date.xml
new file mode 100644
index 0000000..4ccd6bf
--- /dev/null
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_base_template_card_with_date.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.google.android.systemui.smartspace.uitemplate.BaseTemplateCard
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:paddingTop="@dimen/enhanced_smartspace_padding_top"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/enhanced_smartspace_card_height"
+ android:baselineAligned="false">
+
+ <RelativeLayout
+ android:id="@+id/text_group"
+ android:clipChildren="false"
+ android:clipToPadding="false"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent">
+
+ <com.google.android.systemui.smartspace.IcuDateTextView
+ android:id="@+id/date"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentStart="true"
+ style="@style/EnhancedSmartspaceTextTitle"/>
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/smartspace_subtitle_group"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/enhanced_smartspace_subtitle_margin_top"
+ android:layout_below="@+id/date">
+ <include layout="@layout/smartspace_subtitle_pane"/>
+ </androidx.constraintlayout.widget.ConstraintLayout>
+
+ <LinearLayout
+ android:id="@+id/smartspace_extras_group"
+ android:orientation="horizontal"
+ android:visibility="invisible"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="8dp"
+ android:layout_below="@+id/smartspace_subtitle_group">
+ <include layout="@layout/smartspace_extras"/>
+ </LinearLayout>
+ </RelativeLayout>
+</com.google.android.systemui.smartspace.uitemplate.BaseTemplateCard>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card.xml
index 05479d7..afac1b1 100644
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card.xml
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card.xml
@@ -1,4 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
-<com.google.android.systemui.smartspace.BcSmartspaceCard xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:baselineAligned="false">
- <include android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="3" layout="@layout/smartspace_title_subtile_pane"/>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.google.android.systemui.smartspace.BcSmartspaceCard
+ 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="@dimen/enhanced_smartspace_card_height"
+ android:baselineAligned="false">
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/secondary_card_group"
+ android:visibility="gone"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:paddingEnd="@dimen/enhanced_smartspace_secondary_card_padding_end"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"/>
+
+ <include
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toEndOf="@+id/secondary_card_group"
+ app:layout_constraintTop_toTopOf="parent"
+ layout="@layout/smartspace_title_subtitle_pane"/>
</com.google.android.systemui.smartspace.BcSmartspaceCard>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_at_store.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_at_store.xml
deleted file mode 100644
index 0011f7d..0000000
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_at_store.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<com.google.android.systemui.smartspace.BcSmartspaceCard xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:baselineAligned="false">
- <include android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" layout="@layout/smartspace_title_subtile_pane"/>
-</com.google.android.systemui.smartspace.BcSmartspaceCard>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_combination.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_combination.xml
index f029a6f..8feff1f 100644
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_combination.xml
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_combination.xml
@@ -1,5 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
-<com.google.android.systemui.smartspace.BcSmartspaceCardCombination xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:background="@drawable/bg_smartspace_card_secondary" android:padding="@dimen/enhanced_smartspace_combination_card_padding" android:layout_width="match_parent" android:layout_height="match_parent">
- <include android:id="@+id/first_sub_card" android:layout_width="0dp" android:layout_height="match_parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@+id/second_sub_card" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" layout="@layout/smartspace_combination_sub_card"/>
- <include android:id="@+id/second_sub_card" android:visibility="gone" android:layout_width="0dp" android:layout_height="match_parent" android:layout_marginStart="8dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@+id/first_sub_card" app:layout_constraintTop_toTopOf="parent" layout="@layout/smartspace_combination_sub_card"/>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.google.android.systemui.smartspace.BcSmartspaceCardCombination
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent">
+
+ <include
+ android:id="@+id/first_sub_card"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ layout="@layout/smartspace_combination_sub_card"/>
+
+ <include
+ android:id="@+id/second_sub_card"
+ android:visibility="gone"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_marginStart="8dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintStart_toEndOf="@+id/first_sub_card"
+ app:layout_constraintTop_toTopOf="parent"
+ layout="@layout/smartspace_combination_sub_card"/>
</com.google.android.systemui.smartspace.BcSmartspaceCardCombination>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_combination_at_store.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_combination_at_store.xml
index a8b5bda..f855bde 100644
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_combination_at_store.xml
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_combination_at_store.xml
@@ -1,5 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
-<com.google.android.systemui.smartspace.BcSmartspaceCardCombinationAtStore xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:background="@drawable/bg_smartspace_card_secondary" android:padding="@dimen/enhanced_smartspace_combination_card_padding" android:layout_width="match_parent" android:layout_height="match_parent">
- <include android:id="@+id/first_sub_card" android:layout_width="0dp" android:layout_height="match_parent" android:layout_marginEnd="8dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@+id/second_sub_card" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" layout="@layout/smartspace_card_shopping_list"/>
- <include android:id="@+id/second_sub_card" android:layout_width="0dp" android:layout_height="match_parent" android:layout_marginStart="8dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintDimensionRatio="1:1" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" layout="@layout/smartspace_combination_sub_card"/>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.google.android.systemui.smartspace.BcSmartspaceCardCombinationAtStore
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent">
+
+ <include
+ android:id="@+id/first_sub_card"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_marginEnd="8dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toStartOf="@+id/second_sub_card"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ layout="@layout/smartspace_card_shopping_list"/>
+
+ <include
+ android:id="@+id/second_sub_card"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_marginStart="8dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ layout="@layout/smartspace_combination_sub_card"/>
</com.google.android.systemui.smartspace.BcSmartspaceCardCombinationAtStore>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_date.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_date.xml
index 0b807c3..c877c70 100644
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_date.xml
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_date.xml
@@ -1,11 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
-<com.google.android.systemui.smartspace.BcSmartspaceCard xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:paddingTop="@dimen/enhanced_smartspace_padding_top" android:layout_width="match_parent" android:layout_height="match_parent" android:baselineAligned="false">
- <RelativeLayout android:clipChildren="false" android:clipToPadding="false" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="3">
- <com.google.android.systemui.smartspace.IcuDateTextView android:id="@+id/date" android:focusable="true" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_alignParentStart="true" android:layout_alignParentEnd="true" style="@style/EnhancedSmartspaceTextTitle"/>
- <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/smartspace_subtitle_group" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/enhanced_smartspace_subtitle_margin_top" android:layout_below="@+id/date">
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.google.android.systemui.smartspace.BcSmartspaceCard
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:paddingTop="@dimen/enhanced_smartspace_padding_top"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/enhanced_smartspace_card_height"
+ android:baselineAligned="false">
+
+ <RelativeLayout
+ android:id="@+id/text_group"
+ android:clipChildren="false"
+ android:clipToPadding="false"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent">
+
+ <com.google.android.systemui.smartspace.IcuDateTextView
+ android:id="@+id/date"
+ android:focusable="true"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_alignParentStart="true"
+ android:layout_alignParentEnd="true"
+ style="@style/EnhancedSmartspaceTextTitle"/>
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/smartspace_subtitle_group"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/enhanced_smartspace_subtitle_margin_top"
+ android:layout_below="@+id/date">
<include layout="@layout/smartspace_subtitle_pane"/>
</androidx.constraintlayout.widget.ConstraintLayout>
- <LinearLayout android:orientation="horizontal" android:id="@+id/smartspace_extras_group" android:visibility="invisible" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="8dp" android:layout_below="@+id/smartspace_subtitle_group">
+
+ <LinearLayout
+ android:id="@+id/smartspace_extras_group"
+ android:orientation="horizontal"
+ android:visibility="invisible"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="8dp"
+ android:layout_below="@+id/smartspace_subtitle_group">
<include layout="@layout/smartspace_extras"/>
</LinearLayout>
</RelativeLayout>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_doorbell.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_doorbell.xml
index dd59161..26502cb 100644
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_doorbell.xml
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_doorbell.xml
@@ -1,8 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
-<com.google.android.systemui.smartspace.BcSmartspaceCardDoorbell xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:clipToPadding="false" android:layout_width="match_parent" android:layout_height="match_parent">
- <androidx.cardview.widget.CardView android:id="@+id/loading_screen" android:visibility="gone" android:layout_width="0dp" android:layout_height="match_parent" app:cardBackgroundColor="@android:color/transparent" app:cardCornerRadius="@dimen/enhanced_smartspace_secondary_card_corner_radius" app:cardElevation="0dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent">
- <ProgressBar android:layout_gravity="center" android:id="@+id/indeterminateBar" android:layout_width="32dp" android:layout_height="32dp" android:indeterminateTint="?android:attr/textColorSecondary"/>
- <ImageView android:layout_gravity="center" android:id="@+id/loading_screen_icon" android:layout_width="32dp" android:layout_height="32dp" android:src="@drawable/videocam"/>
- </androidx.cardview.widget.CardView>
- <ImageView android:id="@+id/image_view" android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="fitEnd" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"/>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.google.android.systemui.smartspace.BcSmartspaceCardDoorbell
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:clipToPadding="false"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent">
+
+ <FrameLayout
+ android:id="@+id/loading_screen"
+ android:background="@drawable/bg_rounded_secondary_card"
+ android:visibility="gone"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:clipToOutline="true"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent">
+
+ <ProgressBar
+ android:id="@+id/indeterminateBar"
+ android:layout_gravity="center"
+ android:layout_width="40dp"
+ android:layout_height="40dp"/>
+
+ <ImageView
+ android:id="@+id/loading_screen_icon"
+ android:layout_gravity="center"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
+ android:src="@drawable/videocam"/>
+ </FrameLayout>
+
+ <ImageView
+ android:id="@+id/image_view"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:scaleType="centerInside"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"/>
</com.google.android.systemui.smartspace.BcSmartspaceCardDoorbell>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_flight.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_flight.xml
index f4461ab9..fe2d554 100644
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_flight.xml
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_flight.xml
@@ -1,14 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
-<com.google.android.systemui.smartspace.BcSmartspaceCardFlight xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:background="@drawable/bg_smartspace_card_secondary" android:padding="8dp" android:layout_width="match_parent" android:layout_height="match_parent">
- <ImageView android:id="@+id/card_prompt_logo" android:layout_width="32dp" android:layout_height="32dp" android:layout_margin="4dp" app:layout_constraintBottom_toTopOf="@+id/card_prompt" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_chainStyle="packed"/>
- <TextView android:textSize="12sp" android:textColor="?androidprv:attr/textColorOnAccent" android:gravity="center_horizontal" android:id="@+id/card_prompt" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="4dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/card_prompt_logo" style="@style/EnhancedSmartspaceTextSubtitle"/>
- <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/boarding_pass_ui" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingStart="8dp" android:paddingEnd="8dp">
- <TextView android:textSize="14sp" android:textColor="?androidprv:attr/textColorOnAccent" android:id="@+id/gate_title" android:clipChildren="false" android:clipToPadding="false" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/smartspace_flight_card_gate_header" android:letterSpacing="0.025" android:lineHeight="20dp" app:layout_constraintBottom_toTopOf="@+id/seat_title" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_chainStyle="packed" style="@style/EnhancedSmartspaceTextTitle"/>
- <TextView android:textSize="14sp" android:textColor="?androidprv:attr/textColorOnAccent" android:id="@+id/gate_value" android:clipChildren="false" android:clipToPadding="false" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="-" android:alpha="0.7" android:layout_marginStart="4dp" android:layout_marginEnd="10dp" android:letterSpacing="0.025" android:lineHeight="20dp" app:layout_constraintBottom_toBottomOf="@+id/gate_title" app:layout_constraintStart_toEndOf="@id/title_barrier" app:layout_constraintTop_toTopOf="@id/gate_title" style="@style/EnhancedSmartspaceTextSubtitle"/>
- <TextView android:textSize="14sp" android:textColor="?androidprv:attr/textColorOnAccent" android:id="@+id/seat_title" android:clipChildren="false" android:clipToPadding="false" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="15dp" android:text="@string/smartspace_flight_card_seat_header" android:letterSpacing="0.025" android:lineHeight="20dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/gate_title" style="@style/EnhancedSmartspaceTextTitle"/>
- <TextView android:textSize="14sp" android:textColor="?androidprv:attr/textColorOnAccent" android:id="@+id/seat_value" android:clipChildren="false" android:clipToPadding="false" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="-" android:alpha="0.7" android:layout_marginStart="4dp" android:layout_marginEnd="10dp" android:letterSpacing="0.025" android:lineHeight="20dp" app:layout_constraintBottom_toBottomOf="@+id/seat_title" app:layout_constraintStart_toEndOf="@id/title_barrier" app:layout_constraintTop_toTopOf="@id/seat_title" style="@style/EnhancedSmartspaceTextSubtitle"/>
- <androidx.constraintlayout.widget.Barrier android:id="@+id/title_barrier" android:layout_width="wrap_content" android:layout_height="wrap_content" app:barrierDirection="end" app:constraint_referenced_ids="gate_title,seat_title"/>
- <androidx.constraintlayout.widget.Barrier android:id="@+id/value_barrier" android:layout_width="wrap_content" android:layout_height="wrap_content" app:barrierDirection="end" app:constraint_referenced_ids="gate_value,seat_value"/>
- <ImageView android:id="@+id/flight_qr_code" android:background="@drawable/bg_image_generic" android:padding="4dp" android:layout_width="60dp" android:layout_height="60dp" android:layout_marginStart="10dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@id/value_barrier" app:layout_constraintTop_toTopOf="parent"/>
- </androidx.constraintlayout.widget.ConstraintLayout>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.google.android.systemui.smartspace.BcSmartspaceCardFlight
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent">
+
+ <ImageView
+ android:id="@+id/flight_qr_code"
+ android:background="@drawable/bg_flight_qr_code"
+ android:padding="10dp"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:contentDescription="@string/smartspace_flight_qr_code"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"/>
</com.google.android.systemui.smartspace.BcSmartspaceCardFlight>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_generic_image_with_bg.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_generic_image_with_bg.xml
index 09239aa..3ec886f 100644
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_generic_image_with_bg.xml
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_generic_image_with_bg.xml
@@ -1,4 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
-<com.google.android.systemui.smartspace.BcSmartspaceCardGenericImage xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:background="@drawable/bg_smartspace_card_secondary" android:padding="16dp" android:layout_width="match_parent" android:layout_height="match_parent">
- <ImageView android:id="@+id/image_view" android:background="@drawable/bg_image_generic" android:padding="4dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:scaleType="centerInside" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"/>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.google.android.systemui.smartspace.BcSmartspaceCardGenericImage
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:padding="16dp"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <ImageView
+ android:id="@+id/image_view"
+ android:background="@drawable/bg_image_generic"
+ android:padding="4dp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:scaleType="centerInside"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"/>
</com.google.android.systemui.smartspace.BcSmartspaceCardGenericImage>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_generic_landscape_image.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_generic_landscape_image.xml
index 8d65411..89deb72 100644
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_generic_landscape_image.xml
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_generic_landscape_image.xml
@@ -1,6 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
-<com.google.android.systemui.smartspace.BcSmartspaceCardGenericImage xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:clipChildren="false" android:clipToPadding="false" android:layout_width="match_parent" android:layout_height="match_parent">
- <androidx.cardview.widget.CardView android:layout_width="match_parent" android:layout_height="0dp" app:cardBackgroundColor="@android:color/transparent" app:cardCornerRadius="28dp" app:cardElevation="0dp" app:layout_constraintDimensionRatio="7:4" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent">
- <ImageView android:id="@+id/image_view" android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="centerCrop"/>
- </androidx.cardview.widget.CardView>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.google.android.systemui.smartspace.BcSmartspaceCardGenericImage
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:clipChildren="false"
+ android:clipToPadding="false"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent">
+
+ <FrameLayout
+ android:background="@drawable/outline_rounded_secondary_card"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:clipToOutline="true"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintDimensionRatio="7:4"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent">
+
+ <ImageView
+ android:id="@+id/image_view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:scaleType="centerCrop"/>
+ </FrameLayout>
</com.google.android.systemui.smartspace.BcSmartspaceCardGenericImage>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_generic_portrait_image.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_generic_portrait_image.xml
index d06d860..09bdc15 100644
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_generic_portrait_image.xml
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_generic_portrait_image.xml
@@ -1,6 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
-<com.google.android.systemui.smartspace.BcSmartspaceCardGenericImage xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:clipChildren="false" android:clipToPadding="false" android:layout_width="match_parent" android:layout_height="match_parent">
- <androidx.cardview.widget.CardView android:layout_width="0dp" android:layout_height="match_parent" app:cardBackgroundColor="@android:color/transparent" app:cardCornerRadius="16dp" app:cardElevation="0dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintDimensionRatio="4:7" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent">
- <ImageView android:id="@+id/image_view" android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="centerCrop"/>
- </androidx.cardview.widget.CardView>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.google.android.systemui.smartspace.BcSmartspaceCardGenericImage
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:clipChildren="false"
+ android:clipToPadding="false"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <FrameLayout
+ android:background="@drawable/outline_rounded_secondary_card"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:clipToOutline="true"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintDimensionRatio="4:7"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent">
+
+ <ImageView
+ android:id="@+id/image_view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:scaleType="centerCrop"/>
+ </FrameLayout>
</com.google.android.systemui.smartspace.BcSmartspaceCardGenericImage>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_loyalty.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_loyalty.xml
index 62777f3..8d7b7bf 100644
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_loyalty.xml
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_loyalty.xml
@@ -1,7 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
-<com.google.android.systemui.smartspace.BcSmartspaceCardLoyalty xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:background="@drawable/bg_smartspace_card_secondary" android:clipChildren="false" android:clipToPadding="false" android:layout_width="match_parent" android:layout_height="match_parent">
- <ImageView android:id="@+id/image_view" android:layout_width="32dp" android:layout_height="32dp" android:layout_margin="4dp" app:layout_constraintBottom_toTopOf="@+id/card_prompt" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_chainStyle="packed"/>
- <TextView android:textSize="12sp" android:textColor="?androidprv:attr/textColorOnAccent" android:gravity="center_horizontal" android:id="@+id/card_prompt" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_margin="4dp" android:maxLines="2" android:lineHeight="20dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/image_view" style="@style/EnhancedSmartspaceTextSubtitle"/>
- <ImageView android:id="@+id/loyalty_program_logo" android:layout_width="32dp" android:layout_height="32dp" android:layout_margin="4dp" app:layout_constraintBottom_toTopOf="@+id/loyalty_program_name" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_chainStyle="packed"/>
- <TextView android:textSize="12sp" android:textColor="?androidprv:attr/textColorOnAccent" android:gravity="center_horizontal" android:id="@+id/loyalty_program_name" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_margin="4dp" android:maxLines="1" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/loyalty_program_logo" style="@style/EnhancedSmartspaceTextSubtitle"/>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.google.android.systemui.smartspace.BcSmartspaceCardLoyalty
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:clipChildren="false"
+ android:clipToPadding="false"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent">
+
+ <ImageView
+ android:id="@+id/image_view"
+ android:layout_width="32dp"
+ android:layout_height="32dp"
+ android:layout_margin="4dp"
+ app:layout_constraintBottom_toTopOf="@+id/card_prompt"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_chainStyle="packed"/>
+
+ <TextView
+ android:id="@+id/card_prompt"
+ android:textSize="12sp"
+ android:gravity="center_horizontal"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="4dp"
+ android:maxLines="2"
+ android:lineHeight="20dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/image_view"
+ style="@style/EnhancedSmartspaceTextSubtitle"/>
+
+ <ImageView
+ android:id="@+id/loyalty_program_logo"
+ android:layout_width="32dp"
+ android:layout_height="32dp"
+ android:layout_margin="4dp"
+ app:layout_constraintBottom_toTopOf="@+id/loyalty_program_name"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_chainStyle="packed"/>
+
+ <TextView
+ android:id="@+id/loyalty_program_name"
+ android:textSize="12sp"
+ android:gravity="center_horizontal"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="4dp"
+ android:maxLines="1"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/loyalty_program_logo"
+ style="@style/EnhancedSmartspaceTextSubtitle"/>
</com.google.android.systemui.smartspace.BcSmartspaceCardLoyalty>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_shopping_list.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_shopping_list.xml
index 61e1f12..a768d21 100644
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_shopping_list.xml
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_shopping_list.xml
@@ -1,10 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
-<com.google.android.systemui.smartspace.BcSmartspaceCardShoppingList xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:background="@drawable/bg_smartspace_card_secondary" android:padding="12dp" android:clipChildren="false" android:clipToPadding="false" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingStart="16dp">
- <ImageView android:id="@+id/card_prompt_icon" android:layout_width="32dp" android:layout_height="32dp" android:layout_margin="3dp" app:layout_constraintBottom_toTopOf="@id/card_prompt" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_chainStyle="packed"/>
- <TextView android:textSize="12sp" android:textColor="?androidprv:attr/textColorOnAccent" android:gravity="center_horizontal" android:id="@+id/card_prompt" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_margin="3dp" android:maxLines="2" android:lineHeight="20dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/card_prompt_icon" style="@style/EnhancedSmartspaceTextSubtitle"/>
- <ImageView android:id="@+id/list_icon" android:layout_width="20dp" android:layout_height="20dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent"/>
- <TextView android:textSize="14sp" android:textColor="?androidprv:attr/textColorOnAccent" android:id="@+id/empty_list_message" android:layout_width="0dp" android:layout_height="wrap_content" android:maxLines="4" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@id/list_icon" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="0" style="@style/EnhancedSmartspaceTextSubtitle"/>
- <TextView android:textSize="14sp" android:textColor="?androidprv:attr/textColorOnAccent" android:id="@+id/list_item_1" android:layout_width="0dp" android:layout_height="wrap_content" android:maxLines="1" app:layout_constraintBottom_toTopOf="@+id/list_item_2" app:layout_constraintEnd_toStartOf="@+id/list_icon" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_chainStyle="packed" style="@style/EnhancedSmartspaceTextSubtitle"/>
- <TextView android:textSize="14sp" android:textColor="?androidprv:attr/textColorOnAccent" android:id="@+id/list_item_2" android:layout_width="0dp" android:layout_height="wrap_content" android:maxLines="1" app:layout_constraintBottom_toTopOf="@+id/list_item_3" app:layout_constraintEnd_toStartOf="@+id/list_icon" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/list_item_1" style="@style/EnhancedSmartspaceTextSubtitle"/>
- <TextView android:textSize="14sp" android:textColor="?androidprv:attr/textColorOnAccent" android:id="@+id/list_item_3" android:layout_width="0dp" android:layout_height="wrap_content" android:maxLines="1" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@+id/list_icon" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/list_item_2" style="@style/EnhancedSmartspaceTextSubtitle"/>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.google.android.systemui.smartspace.BcSmartspaceCardShoppingList
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:clipChildren="false"
+ android:clipToPadding="false"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent">
+
+ <ImageView
+ android:id="@+id/card_prompt_icon"
+ android:layout_width="32dp"
+ android:layout_height="32dp"
+ android:layout_margin="3dp"
+ app:layout_constraintBottom_toTopOf="@+id/card_prompt"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_chainStyle="packed"/>
+
+ <TextView
+ android:id="@+id/card_prompt"
+ android:textSize="12sp"
+ android:gravity="center_horizontal"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="3dp"
+ android:maxLines="2"
+ android:lineHeight="20dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/card_prompt_icon"
+ style="@style/EnhancedSmartspaceTextSubtitle"/>
+
+ <ImageView
+ android:id="@+id/list_icon"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent"/>
+
+ <TextView
+ android:id="@+id/empty_list_message"
+ android:textSize="14sp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:maxLines="4"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toStartOf="@+id/list_icon"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_bias="0"
+ style="@style/EnhancedSmartspaceTextSubtitle"/>
+
+ <TextView
+ android:id="@+id/list_item_1"
+ android:textSize="14sp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:maxLines="1"
+ app:layout_constraintBottom_toTopOf="@+id/list_item_2"
+ app:layout_constraintEnd_toStartOf="@+id/list_icon"
+ app:layout_constraintHorizontal_bias="0"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_chainStyle="packed"
+ style="@style/EnhancedSmartspaceTextSubtitle"/>
+
+ <TextView
+ android:id="@+id/list_item_2"
+ android:textSize="14sp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:maxLines="1"
+ app:layout_constraintBottom_toTopOf="@+id/list_item_3"
+ app:layout_constraintEnd_toStartOf="@+id/list_icon"
+ app:layout_constraintHorizontal_bias="0"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/list_item_1"
+ style="@style/EnhancedSmartspaceTextSubtitle"/>
+
+ <TextView
+ android:id="@+id/list_item_3"
+ android:textSize="14sp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:maxLines="1"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toStartOf="@+id/list_icon"
+ app:layout_constraintHorizontal_bias="0"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/list_item_2"
+ style="@style/EnhancedSmartspaceTextSubtitle"/>
</com.google.android.systemui.smartspace.BcSmartspaceCardShoppingList>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_sports.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_sports.xml
index 0f8a8cc..9d8115d 100644
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_sports.xml
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_sports.xml
@@ -1,8 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
-<com.google.android.systemui.smartspace.BcSmartspaceCardSports xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:background="@drawable/bg_smartspace_card_secondary" android:paddingTop="12dp" android:paddingBottom="20dp" android:clipChildren="false" android:clipToPadding="false" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingStart="12dp" android:paddingEnd="12dp">
- <TextView android:textColor="?androidprv:attr/textColorOnAccent" android:id="@+id/match_time_summary" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" style="@style/EnhancedSmartspaceTextSubtitle"/>
- <ImageView android:id="@+id/first_competitor_logo" android:layout_width="0dp" android:layout_height="0dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintDimensionRatio="1:1" app:layout_constraintEnd_toStartOf="@id/first_competitor_score" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/match_time_summary" app:tint="?android:attr/textColorPrimary"/>
- <ImageView android:id="@+id/second_competitor_logo" android:layout_width="0dp" android:layout_height="0dp" app:layout_constraintBottom_toBottomOf="@id/first_competitor_logo" app:layout_constraintDimensionRatio="1:1" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@id/second_competitor_score" app:layout_constraintTop_toTopOf="@id/first_competitor_logo" app:tint="?android:attr/textColorPrimary"/>
- <TextView android:textColor="?androidprv:attr/textColorOnAccent" android:id="@+id/first_competitor_score" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="4dp" app:layout_constraintBottom_toBottomOf="@id/first_competitor_logo" app:layout_constraintEnd_toStartOf="@id/second_competitor_score" app:layout_constraintStart_toEndOf="@id/first_competitor_logo" app:layout_constraintTop_toTopOf="@id/first_competitor_logo" style="@style/EnhancedSmartspaceTextSubtitle"/>
- <TextView android:textColor="?androidprv:attr/textColorOnAccent" android:id="@+id/second_competitor_score" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="12dp" android:layout_marginEnd="4dp" app:layout_constraintBottom_toBottomOf="@id/second_competitor_logo" app:layout_constraintEnd_toStartOf="@id/second_competitor_logo" app:layout_constraintStart_toEndOf="@id/first_competitor_score" app:layout_constraintTop_toTopOf="@id/second_competitor_logo" style="@style/EnhancedSmartspaceTextSubtitle"/>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.google.android.systemui.smartspace.BcSmartspaceCardSports
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:paddingTop="12dp"
+ android:paddingBottom="20dp"
+ android:clipChildren="false"
+ android:clipToPadding="false"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <TextView
+ android:id="@+id/match_time_summary"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ style="@style/EnhancedSmartspaceTextSubtitle"/>
+
+ <ImageView
+ android:id="@+id/first_competitor_logo"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintEnd_toStartOf="@+id/first_competitor_score"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/match_time_summary"
+ app:tint="?android:attr/textColorPrimary"/>
+
+ <ImageView
+ android:id="@+id/second_competitor_logo"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ app:layout_constraintBottom_toBottomOf="@+id/first_competitor_logo"
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toEndOf="@+id/second_competitor_score"
+ app:layout_constraintTop_toTopOf="@+id/first_competitor_logo"
+ app:tint="?android:attr/textColorPrimary"/>
+
+ <TextView
+ android:id="@+id/first_competitor_score"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="4dp"
+ app:layout_constraintBottom_toBottomOf="@+id/first_competitor_logo"
+ app:layout_constraintEnd_toStartOf="@+id/second_competitor_score"
+ app:layout_constraintStart_toEndOf="@+id/first_competitor_logo"
+ app:layout_constraintTop_toTopOf="@+id/first_competitor_logo"
+ style="@style/EnhancedSmartspaceTextSubtitle"/>
+
+ <TextView
+ android:id="@+id/second_competitor_score"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="12dp"
+ android:layout_marginEnd="4dp"
+ app:layout_constraintBottom_toBottomOf="@+id/second_competitor_logo"
+ app:layout_constraintEnd_toStartOf="@+id/second_competitor_logo"
+ app:layout_constraintStart_toEndOf="@+id/first_competitor_score"
+ app:layout_constraintTop_toTopOf="@+id/second_competitor_logo"
+ style="@style/EnhancedSmartspaceTextSubtitle"/>
</com.google.android.systemui.smartspace.BcSmartspaceCardSports>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_weather_forecast.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_weather_forecast.xml
index bdacf33..2a474d9 100644
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_weather_forecast.xml
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_weather_forecast.xml
@@ -1,2 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
-<com.google.android.systemui.smartspace.BcSmartspaceCardWeatherForecast xmlns:android="http://schemas.android.com/apk/res/android" android:background="@drawable/bg_smartspace_card_secondary" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingStart="12dp" android:paddingEnd="12dp"/>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.google.android.systemui.smartspace.BcSmartspaceCardWeatherForecast
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"/>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_weather_forecast_column.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_weather_forecast_column.xml
index c16d386..293f880 100644
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_weather_forecast_column.xml
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_weather_forecast_column.xml
@@ -1,6 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
-<androidx.constraintlayout.widget.ConstraintLayout xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="wrap_content" android:layout_height="0dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintHorizontal_chainStyle="spread_inside" app:layout_constraintTop_toTopOf="parent">
- <TextView android:textSize="14sp" android:textColor="?androidprv:attr/textColorOnAccent" android:id="@+id/temperature_value" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="16dp" app:layout_constraintBottom_toTopOf="@+id/weather_icon" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_chainStyle="spread_inside" style="@style/EnhancedSmartspaceTextSubtitle"/>
- <ImageView android:id="@+id/weather_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:scaleType="centerInside" app:layout_constraintBottom_toTopOf="@+id/timestamp" app:layout_constraintDimensionRatio="1:1" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/temperature_value"/>
- <TextView android:textSize="12sp" android:textColor="?androidprv:attr/textColorOnAccent" android:id="@+id/timestamp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="16dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/weather_icon" style="@style/EnhancedSmartspaceTextSubtitle"/>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<androidx.constraintlayout.widget.ConstraintLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="wrap_content"
+ android:layout_height="0dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintHorizontal_chainStyle="spread_inside"
+ app:layout_constraintTop_toTopOf="parent">
+
+ <TextView
+ android:id="@+id/temperature_value"
+ android:textSize="14sp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="16dp"
+ app:layout_constraintBottom_toTopOf="@+id/weather_icon"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_chainStyle="spread_inside"
+ style="@style/EnhancedSmartspaceTextSubtitle"/>
+
+ <ImageView
+ android:id="@+id/weather_icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:scaleType="centerInside"
+ app:layout_constraintBottom_toTopOf="@+id/timestamp"
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/temperature_value"/>
+
+ <TextView
+ android:id="@+id/timestamp"
+ android:textSize="12sp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="16dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/weather_icon"
+ style="@style/EnhancedSmartspaceTextSubtitle"/>
</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_carousel_column_template_card.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_carousel_column_template_card.xml
new file mode 100644
index 0000000..0dd2cba
--- /dev/null
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_carousel_column_template_card.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<androidx.constraintlayout.widget.ConstraintLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="wrap_content"
+ android:layout_height="0dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintHorizontal_chainStyle="spread_inside"
+ app:layout_constraintTop_toTopOf="parent">
+
+ <TextView
+ android:id="@+id/upper_text"
+ android:textSize="14sp"
+ android:visibility="gone"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="16dp"
+ app:layout_constraintBottom_toTopOf="@+id/icon"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_chainStyle="spread_inside"
+ style="@style/EnhancedSmartspaceTextSubtitle"/>
+
+ <ImageView
+ android:id="@+id/icon"
+ android:visibility="gone"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:scaleType="centerInside"
+ app:layout_constraintBottom_toTopOf="@+id/lower_text"
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/upper_text"/>
+
+ <TextView
+ android:id="@+id/lower_text"
+ android:textSize="12sp"
+ android:visibility="gone"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="16dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/icon"
+ style="@style/EnhancedSmartspaceTextSubtitle"/>
+</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_carousel_template_card.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_carousel_template_card.xml
new file mode 100644
index 0000000..bbc2bd9
--- /dev/null
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_carousel_template_card.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.google.android.systemui.smartspace.uitemplate.CarouselTemplateCard
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"/>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_combination_sub_card.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_combination_sub_card.xml
index 7e03db3..bb916f0 100644
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_combination_sub_card.xml
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_combination_sub_card.xml
@@ -1,5 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
-<androidx.constraintlayout.widget.ConstraintLayout xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/first_sub_card" android:background="@drawable/bg_smartspace_combination_sub_card" android:padding="8dp" android:layout_width="0dp" android:layout_height="match_parent">
- <ImageView android:id="@+id/sub_card_icon" android:layout_width="22dp" android:layout_height="22dp" android:layout_margin="2dp" app:layout_constraintBottom_toTopOf="@id/sub_card_text" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"/>
- <TextView android:textSize="14sp" android:textColor="?androidprv:attr/textColorOnAccent" android:ellipsize="end" android:gravity="center_horizontal" android:id="@+id/sub_card_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="2dp" android:maxLines="2" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/sub_card_icon" style="@style/EnhancedSmartspaceTextSubtitle"/>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<androidx.constraintlayout.widget.ConstraintLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:id="@+id/first_sub_card"
+ android:background="@drawable/bg_smartspace_combination_sub_card"
+ android:padding="8dp"
+ android:layout_width="0dp"
+ android:layout_height="match_parent">
+
+ <ImageView
+ android:id="@+id/sub_card_icon"
+ android:layout_width="22dp"
+ android:layout_height="22dp"
+ android:layout_margin="2dp"
+ app:layout_constraintBottom_toTopOf="@+id/sub_card_text"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"/>
+
+ <TextView
+ android:id="@+id/sub_card_text"
+ android:textSize="14sp"
+ android:textColor="?androidprv:attr/textColorOnAccent"
+ android:ellipsize="end"
+ android:gravity="center_horizontal"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="2dp"
+ android:maxLines="2"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/sub_card_icon"
+ style="@style/EnhancedSmartspaceTextSubtitle"/>
</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_combined_cards_template_card.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_combined_cards_template_card.xml
new file mode 100644
index 0000000..499abda
--- /dev/null
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_combined_cards_template_card.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.google.android.systemui.smartspace.uitemplate.CombinedCardsTemplateCard
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:clipChildren="false"
+ android:clipToPadding="false"
+ android:layout_width="0dp"
+ android:layout_height="match_parent">
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/first_sub_card_container"
+ android:background="@drawable/bg_smartspace_combination_sub_card"
+ android:visibility="gone"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintEnd_toStartOf="@+id/second_sub_card_container"
+ app:layout_constraintStart_toStartOf="parent"/>
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/second_sub_card_container"
+ android:background="@drawable/bg_smartspace_combination_sub_card"
+ android:visibility="gone"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_marginStart="8dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintStart_toEndOf="@+id/first_sub_card_container"
+ app:layout_constraintTop_toTopOf="parent"/>
+</com.google.android.systemui.smartspace.uitemplate.CombinedCardsTemplateCard>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_enhanced.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_enhanced.xml
index 34332ea..2f92364 100644
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_enhanced.xml
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_enhanced.xml
@@ -1,5 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
-<com.google.android.systemui.smartspace.BcSmartspaceView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/bc_smartspace_view" android:layout_width="match_parent" android:layout_height="wrap_content">
- <com.google.android.systemui.smartspace.InterceptingViewPager android:layout_gravity="center" android:id="@+id/smartspace_card_pager" android:layout_width="match_parent" android:layout_height="@dimen/enhanced_smartspace_height"/>
- <com.google.android.systemui.smartspace.PageIndicator android:layout_gravity="bottom|left|center_vertical|center_horizontal|center|start" android:id="@+id/smartspace_page_indicator" android:paddingTop="@dimen/page_indicator_padding_top_bottom" android:paddingBottom="@dimen/page_indicator_padding_top_bottom" android:visibility="visible" android:layout_width="wrap_content" android:layout_height="wrap_content" android:importantForAccessibility="no" android:paddingStart="@dimen/page_indicator_padding_start"/>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.google.android.systemui.smartspace.BcSmartspaceView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/bc_smartspace_view"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <com.google.android.systemui.smartspace.InterceptingViewPager
+ android:id="@+id/smartspace_card_pager"
+ android:layout_gravity="center"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/enhanced_smartspace_height"/>
+
+ <com.google.android.systemui.smartspace.PageIndicator
+ android:id="@+id/smartspace_page_indicator"
+ android:layout_gravity="start|bottom"
+ android:paddingTop="@dimen/page_indicator_padding_top"
+ android:visibility="visible"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:importantForAccessibility="no"/>
</com.google.android.systemui.smartspace.BcSmartspaceView>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_extras.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_extras.xml
index 2bbe120..e83a6b3 100644
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_extras.xml
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_extras.xml
@@ -1,6 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
<merge xmlns:android="http://schemas.android.com/apk/res/android">
- <ImageView android:layout_gravity="center_vertical" android:id="@+id/alarm_icon" android:visibility="gone" android:layout_width="@dimen/enhanced_smartspace_icon_size" android:layout_height="@dimen/enhanced_smartspace_icon_size" android:scaleType="centerInside" android:layout_marginEnd="4dp"/>
- <com.google.android.systemui.smartspace.DoubleShadowTextView android:layout_gravity="center_vertical" android:id="@+id/alarm_text" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="4dp" style="@style/EnhancedSmartspaceTextSubtitle"/>
- <ImageView android:layout_gravity="center_vertical" android:id="@+id/dnd_icon" android:visibility="gone" android:layout_width="@dimen/enhanced_smartspace_icon_size" android:layout_height="@dimen/enhanced_smartspace_icon_size" android:scaleType="centerInside"/>
+
+ <ImageView
+ android:id="@+id/alarm_icon"
+ android:layout_gravity="center_vertical"
+ android:visibility="gone"
+ android:layout_width="@dimen/enhanced_smartspace_icon_size"
+ android:layout_height="@dimen/enhanced_smartspace_icon_size"
+ android:scaleType="centerInside"
+ android:layout_marginEnd="4dp"/>
+
+ <com.google.android.systemui.smartspace.DoubleShadowTextView
+ android:id="@+id/alarm_text"
+ android:layout_gravity="center_vertical"
+ android:visibility="gone"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="4dp"
+ style="@style/EnhancedSmartspaceTextSubtitle"/>
+
+ <com.google.android.systemui.smartspace.DoubleShadowTextView
+ android:id="@+id/supplemental_line_text"
+ android:layout_gravity="center_vertical"
+ android:visibility="gone"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="4dp"
+ style="@style/EnhancedSmartspaceTextSubtitle"/>
+
+ <ImageView
+ android:id="@+id/dnd_icon"
+ android:layout_gravity="center_vertical"
+ android:visibility="gone"
+ android:layout_width="@dimen/enhanced_smartspace_icon_size"
+ android:layout_height="@dimen/enhanced_smartspace_icon_size"
+ android:scaleType="centerInside"/>
</merge>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_head_to_head_template_card.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_head_to_head_template_card.xml
new file mode 100644
index 0000000..7ca8125
--- /dev/null
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_head_to_head_template_card.xml
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.google.android.systemui.smartspace.uitemplate.HeadToHeadTemplateCard
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:paddingTop="12dp"
+ android:paddingBottom="20dp"
+ android:clipChildren="false"
+ android:clipToPadding="false"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <TextView
+ android:id="@+id/head_to_head_title"
+ android:visibility="gone"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ style="@style/EnhancedSmartspaceTextSubtitle"/>
+
+ <ImageView
+ android:id="@+id/first_competitor_icon"
+ android:visibility="gone"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintEnd_toStartOf="@+id/first_competitor_text"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/head_to_head_title"
+ app:tint="?android:attr/textColorPrimary"/>
+
+ <ImageView
+ android:id="@+id/second_competitor_icon"
+ android:visibility="gone"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ app:layout_constraintBottom_toBottomOf="@+id/first_competitor_icon"
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toEndOf="@+id/second_competitor_text"
+ app:layout_constraintTop_toTopOf="@+id/first_competitor_icon"
+ app:tint="?android:attr/textColorPrimary"/>
+
+ <TextView
+ android:id="@+id/first_competitor_text"
+ android:visibility="gone"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="4dp"
+ app:layout_constraintBottom_toBottomOf="@+id/first_competitor_icon"
+ app:layout_constraintEnd_toStartOf="@+id/second_competitor_text"
+ app:layout_constraintStart_toEndOf="@+id/first_competitor_icon"
+ app:layout_constraintTop_toTopOf="@+id/first_competitor_icon"
+ style="@style/EnhancedSmartspaceTextSubtitle"/>
+
+ <TextView
+ android:id="@+id/second_competitor_text"
+ android:visibility="gone"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="12dp"
+ android:layout_marginEnd="4dp"
+ app:layout_constraintBottom_toBottomOf="@+id/second_competitor_icon"
+ app:layout_constraintEnd_toStartOf="@+id/second_competitor_icon"
+ app:layout_constraintStart_toEndOf="@+id/first_competitor_text"
+ app:layout_constraintTop_toTopOf="@+id/second_competitor_icon"
+ style="@style/EnhancedSmartspaceTextSubtitle"/>
+</com.google.android.systemui.smartspace.uitemplate.HeadToHeadTemplateCard>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_sub_card_template_card.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_sub_card_template_card.xml
new file mode 100644
index 0000000..f6b93f2
--- /dev/null
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_sub_card_template_card.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.google.android.systemui.smartspace.uitemplate.SubCardTemplateCard
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:clipChildren="false"
+ android:clipToPadding="false"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent">
+
+ <ImageView
+ android:id="@+id/image_view"
+ android:visibility="gone"
+ android:layout_width="32dp"
+ android:layout_height="32dp"
+ android:layout_margin="4dp"
+ app:layout_constraintBottom_toTopOf="@+id/card_prompt"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_chainStyle="packed"/>
+
+ <TextView
+ android:id="@+id/card_prompt"
+ android:textSize="12sp"
+ android:gravity="center_horizontal"
+ android:visibility="gone"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="4dp"
+ android:maxLines="2"
+ android:lineHeight="20dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/image_view"
+ style="@style/EnhancedSmartspaceTextSubtitle"/>
+</com.google.android.systemui.smartspace.uitemplate.SubCardTemplateCard>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_sub_image_template_card.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_sub_image_template_card.xml
new file mode 100644
index 0000000..8e885db
--- /dev/null
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_sub_image_template_card.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.google.android.systemui.smartspace.uitemplate.SubImageTemplateCard
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:clipChildren="false"
+ android:clipToPadding="false"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent">
+
+ <ImageView
+ android:id="@+id/image_view"
+ android:background="@drawable/outline_rounded_secondary_card"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:scaleType="centerInside"
+ android:clipToOutline="true"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"/>
+</com.google.android.systemui.smartspace.uitemplate.SubImageTemplateCard>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_sub_list_template_card.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_sub_list_template_card.xml
new file mode 100644
index 0000000..e7dc1a1
--- /dev/null
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_sub_list_template_card.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.google.android.systemui.smartspace.uitemplate.SubListTemplateCard
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:clipChildren="false"
+ android:clipToPadding="false"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent">
+
+ <ImageView
+ android:id="@+id/list_icon"
+ android:visibility="gone"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent"/>
+
+ <TextView
+ android:id="@+id/list_item_1"
+ android:textSize="14sp"
+ android:visibility="gone"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:maxLines="1"
+ app:layout_constraintBottom_toTopOf="@+id/list_item_2"
+ app:layout_constraintEnd_toStartOf="@+id/list_icon"
+ app:layout_constraintHorizontal_bias="0"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_chainStyle="packed"
+ style="@style/EnhancedSmartspaceTextSubtitle"/>
+
+ <TextView
+ android:id="@+id/list_item_2"
+ android:textSize="14sp"
+ android:visibility="gone"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:maxLines="1"
+ app:layout_constraintBottom_toTopOf="@+id/list_item_3"
+ app:layout_constraintEnd_toStartOf="@+id/list_icon"
+ app:layout_constraintHorizontal_bias="0"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/list_item_1"
+ style="@style/EnhancedSmartspaceTextSubtitle"/>
+
+ <TextView
+ android:id="@+id/list_item_3"
+ android:textSize="14sp"
+ android:visibility="gone"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:maxLines="1"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toStartOf="@+id/list_icon"
+ app:layout_constraintHorizontal_bias="0"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/list_item_2"
+ style="@style/EnhancedSmartspaceTextSubtitle"/>
+</com.google.android.systemui.smartspace.uitemplate.SubListTemplateCard>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_subtitle_pane.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_subtitle_pane.xml
index 79742bc..d4d0eb6 100644
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_subtitle_pane.xml
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_subtitle_pane.xml
@@ -1,5 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
-<merge xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto">
- <com.google.android.systemui.smartspace.DoubleShadowTextView android:textColor="?android:attr/textColorPrimary" android:id="@+id/subtitle_text" android:focusable="true" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constrainedWidth="true" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@id/base_action_icon_subtitle" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" style="@style/EnhancedSmartspaceTextSubtitle"/>
- <com.google.android.systemui.smartspace.DoubleShadowTextView android:textColor="?android:attr/textColorPrimary" android:ellipsize="none" android:id="@+id/base_action_icon_subtitle" android:focusable="true" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="@dimen/enhanced_smartspace_icon_margin" app:layout_constraintBaseline_toBaselineOf="@id/subtitle_text" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@id/subtitle_text" app:layout_constraintWidth_min="wrap" style="@style/EnhancedSmartspaceTextSubtitle"/>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<merge xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto">
+
+ <com.google.android.systemui.smartspace.DoubleShadowTextView
+ android:id="@+id/subtitle_text"
+ android:textColor="?android:attr/textColorPrimary"
+ android:focusable="true"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:layout_constrainedWidth="true"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toStartOf="@+id/base_action_icon_subtitle"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ style="@style/EnhancedSmartspaceTextSubtitle"/>
+
+ <com.google.android.systemui.smartspace.DoubleShadowTextView
+ android:id="@+id/base_action_icon_subtitle"
+ android:textColor="?android:attr/textColorPrimary"
+ android:ellipsize="none"
+ android:focusable="true"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="@dimen/enhanced_smartspace_base_action_icon_margin"
+ app:layout_constraintBaseline_toBaselineOf="@+id/subtitle_text"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toEndOf="@+id/subtitle_text"
+ app:layout_constraintWidth_max="280dp"
+ app:layout_constraintWidth_min="wrap"
+ style="@style/EnhancedSmartspaceTextSubtitle"/>
</merge>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_title_subtile_pane.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_title_subtile_pane.xml
deleted file mode 100644
index 5708eb2..0000000
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_title_subtile_pane.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:clipChildren="false" android:clipToPadding="false" android:layout_width="match_parent" android:layout_height="match_parent">
- <Space android:id="@+id/top_padding" android:layout_width="match_parent" android:layout_height="0dp" app:layout_constrainedHeight="true" app:layout_constraintBottom_toTopOf="@id/title_text" app:layout_constraintHeight_max="@dimen/enhanced_smartspace_padding_top" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_weight="1"/>
- <com.google.android.systemui.smartspace.DoubleShadowTextView android:id="@+id/title_text" android:focusable="true" android:layout_width="0dp" android:layout_height="wrap_content" app:layout_constraintBottom_toTopOf="@id/smartspace_subtitle_group" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/top_padding" style="@style/EnhancedSmartspaceTextTitle"/>
- <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/smartspace_subtitle_group" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/enhanced_smartspace_subtitle_margin_top" app:layout_constraintBottom_toTopOf="@id/smartspace_extras_group" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/title_text">
- <include layout="@layout/smartspace_subtitle_pane"/>
- </androidx.constraintlayout.widget.ConstraintLayout>
- <LinearLayout android:gravity="top" android:orientation="horizontal" android:id="@+id/smartspace_extras_group" android:visibility="invisible" android:layout_width="wrap_content" android:layout_height="0dp" android:layout_marginTop="8dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintHeight_min="wrap" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/smartspace_subtitle_group">
- <include layout="@layout/smartspace_extras"/>
- </LinearLayout>
-</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_title_subtitle_pane.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_title_subtitle_pane.xml
new file mode 100644
index 0000000..b5d36da
--- /dev/null
+++ b/packages/SystemUI/bcsmartspace/res/layout/smartspace_title_subtitle_pane.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2022 Benzo Rom
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<androidx.constraintlayout.widget.ConstraintLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:id="@+id/text_group"
+ android:clipChildren="false"
+ android:clipToPadding="false"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <Space
+ android:id="@+id/top_padding"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ app:layout_constrainedHeight="true"
+ app:layout_constraintBottom_toTopOf="@+id/title_text"
+ app:layout_constraintHeight_max="@dimen/enhanced_smartspace_padding_top"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_weight="1"/>
+
+ <com.google.android.systemui.smartspace.DoubleShadowTextView
+ android:id="@+id/title_text"
+ android:focusable="true"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:layout_constraintBottom_toTopOf="@+id/smartspace_subtitle_group"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/top_padding"
+ style="@style/EnhancedSmartspaceTextTitle"/>
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/smartspace_subtitle_group"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/enhanced_smartspace_subtitle_margin_top"
+ app:layout_constraintBottom_toTopOf="@+id/smartspace_extras_group"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/title_text">
+ <include layout="@layout/smartspace_subtitle_pane"/>
+ </androidx.constraintlayout.widget.ConstraintLayout>
+
+ <LinearLayout
+ android:id="@+id/smartspace_extras_group"
+ android:gravity="top"
+ android:orientation="horizontal"
+ android:visibility="invisible"
+ android:layout_width="wrap_content"
+ android:layout_height="0dp"
+ android:layout_marginTop="8dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintHeight_min="wrap"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/smartspace_subtitle_group">
+ <include layout="@layout/smartspace_extras"/>
+ </LinearLayout>
+</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/packages/SystemUI/bcsmartspace/res/values/colors.xml b/packages/SystemUI/bcsmartspace/res/values/colors.xml
index 5fcb897..49cb267 100644
--- a/packages/SystemUI/bcsmartspace/res/values/colors.xml
+++ b/packages/SystemUI/bcsmartspace/res/values/colors.xml
@@ -1,3 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ambient_text_shadow_color">#40000000</color>
+ <color name="key_text_shadow_color">#89000000</color>
+ <color name="smartspace_button_background">@android:color/system_accent2_200</color>
+ <color name="smartspace_button_text">@android:color/system_accent2_700</color>
</resources>
diff --git a/packages/SystemUI/bcsmartspace/res/values/dimens.xml b/packages/SystemUI/bcsmartspace/res/values/dimens.xml
index 0058a80..5386953 100644
--- a/packages/SystemUI/bcsmartspace/res/values/dimens.xml
+++ b/packages/SystemUI/bcsmartspace/res/values/dimens.xml
@@ -1,30 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
<dimen name="ambient_text_shadow_radius">1.5dip</dimen>
- <dimen name="enhanced_smartspace_combination_card_padding">8.0dip</dimen>
- <dimen name="enhanced_smartspace_combination_sub_card_corner_radius">20.0dip</dimen>
- <dimen name="enhanced_smartspace_dismiss_margin">16.0dip</dimen>
- <dimen name="enhanced_smartspace_height">104.0dip</dimen>
- <dimen name="enhanced_smartspace_icon_margin">6.0dip</dimen>
- <dimen name="enhanced_smartspace_icon_size">20.0dip</dimen>
- <dimen name="enhanced_smartspace_margin_start_launcher">16.0dip</dimen>
- <dimen name="enhanced_smartspace_padding_top">16.0dip</dimen>
- <dimen name="enhanced_smartspace_secondary_card_corner_radius">28.0dip</dimen>
- <dimen name="enhanced_smartspace_secondary_card_end_margin">1.0dip</dimen>
- <dimen name="enhanced_smartspace_secondary_card_start_margin">8.0dip</dimen>
+ <dimen name="enhanced_smartspace_base_action_icon_margin">8dp</dimen>
+ <dimen name="enhanced_smartspace_card_height">76dp</dimen>
+ <dimen name="enhanced_smartspace_combination_card_padding">8dp</dimen>
+ <dimen name="enhanced_smartspace_combination_sub_card_corner_radius">20dp</dimen>
+ <dimen name="enhanced_smartspace_dismiss_margin">16dp</dimen>
+ <dimen name="enhanced_smartspace_height">104dp</dimen>
+ <dimen name="enhanced_smartspace_icon_inset">2dp</dimen>
+ <dimen name="enhanced_smartspace_icon_margin">4dp</dimen>
+ <dimen name="enhanced_smartspace_icon_size">20dp</dimen>
+ <dimen name="enhanced_smartspace_margin_start_launcher">16dp</dimen>
+ <dimen name="enhanced_smartspace_padding_top">22dp</dimen>
+ <dimen name="enhanced_smartspace_secondary_card_corner_radius">20dp</dimen>
+ <dimen name="enhanced_smartspace_secondary_card_end_margin">1dp</dimen>
+ <dimen name="enhanced_smartspace_secondary_card_padding_end">12dp</dimen>
+ <dimen name="enhanced_smartspace_secondary_card_start_margin">1dp</dimen>
<dimen name="enhanced_smartspace_subtitle_margin_top">9dp</dimen>
- <dimen name="enhanced_smartspace_subtitle_size">16.0sp</dimen>
- <dimen name="enhanced_smartspace_title_size">20.0sp</dimen>
- <color name="key_text_shadow_color">#89000000</color>
+ <dimen name="enhanced_smartspace_subtitle_size">16sp</dimen>
+ <dimen name="enhanced_smartspace_title_size">20sp</dimen>
<dimen name="key_text_shadow_dx">0.5dip</dimen>
<dimen name="key_text_shadow_dy">0.5dip</dimen>
<dimen name="key_text_shadow_radius">0.5dip</dimen>
<dimen name="page_indicator_dot_margin">3dp</dimen>
<dimen name="page_indicator_dot_size">6dp</dimen>
- <dimen name="page_indicator_padding_start">2dp</dimen>
- <dimen name="page_indicator_padding_top_bottom">8dp</dimen>
+ <dimen name="page_indicator_padding_top">10dp</dimen>
<dimen name="page_indicator_width">16dp</dimen>
- <dimen name="smartspace_icon_shadow">1.0dip</dimen>
<dimen name="smartspaceLetterSpacing">0.02</dimen>
- <dimen name="status_bar_header_height_keyguard">40.0dip</dimen>
</resources>
diff --git a/packages/SystemUI/bcsmartspace/res/values/strings.xml b/packages/SystemUI/bcsmartspace/res/values/strings.xml
index 73fea0d..35b8783 100644
--- a/packages/SystemUI/bcsmartspace/res/values/strings.xml
+++ b/packages/SystemUI/bcsmartspace/res/values/strings.xml
@@ -5,10 +5,10 @@
<string name="generic_smartspace_concatenated_desc">%1$s, %2$s</string>
<string name="smartspace_flight_card_gate_header">Gate</string>
<string name="smartspace_flight_card_seat_header">Seat</string>
+ <string name="smartspace_flight_qr_code">QR code</string>
<string name="smartspace_hours_mins">%1$s %2$s</string>
<string name="smartspace_icu_date_pattern">EEEMMMd</string>
<string name="smartspace_now">Now</string>
<string name="smartspace_pill_text_format">%1$s: %2$s</string>
<string name="smartspace_shopping_list_overflow">+ %1$d more</string>
- <string name="weather_description">%1$s, %2$s</string>
</resources>
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcNextAlarmData.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcNextAlarmData.java
new file mode 100644
index 0000000..c6e3991
--- /dev/null
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcNextAlarmData.java
@@ -0,0 +1,63 @@
+package com.google.android.systemui.smartspace;
+
+import android.app.smartspace.SmartspaceAction;
+import android.app.smartspace.SmartspaceTarget;
+import android.app.smartspace.SmartspaceUtils;
+import android.app.smartspace.uitemplatedata.BaseTemplateData;
+import android.app.smartspace.uitemplatedata.TapAction;
+import android.content.Intent;
+import android.graphics.drawable.Drawable;
+import android.text.TextUtils;
+import android.view.View;
+import com.android.systemui.plugins.BcSmartspaceDataPlugin;
+import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
+
+public final class BcNextAlarmData {
+ public static final SmartspaceAction SHOW_ALARMS_ACTION = new SmartspaceAction.Builder("nextAlarmId", "Next alarm").setIntent(new Intent("android.intent.action.SHOW_ALARMS")).build();
+ public String mDescription;
+ public SmartspaceTarget mHolidayAlarmsTarget;
+ public Drawable mImage;
+
+ public CharSequence getHolidayAlarmText(BaseTemplateData.SubItemInfo subItemInfo) {
+ SmartspaceAction headerAction;
+ if (subItemInfo != null && !SmartspaceUtils.isEmpty(subItemInfo.getText())) {
+ return subItemInfo.getText().getText();
+ }
+ SmartspaceTarget smartspaceTarget = this.mHolidayAlarmsTarget;
+ if (smartspaceTarget != null && (headerAction = smartspaceTarget.getHeaderAction()) != null) {
+ return headerAction.getTitle();
+ }
+ return null;
+ }
+
+ public void setOnClickListener(View view, TapAction tapAction, BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier, int i) {
+ BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo;
+ SmartspaceTarget smartspaceTarget = this.mHolidayAlarmsTarget;
+ if (smartspaceTarget == null) {
+ BcSmartspaceCardLoggingInfo.Builder builder = new BcSmartspaceCardLoggingInfo.Builder();
+ builder.mInstanceId = InstanceId.create("upcoming_alarm_card_94510_12684");
+ builder.mFeatureType = 23;
+ builder.mDisplaySurface = i;
+ bcSmartspaceCardLoggingInfo = new BcSmartspaceCardLoggingInfo(builder);
+ } else {
+ BcSmartspaceCardLoggingInfo.Builder builder2 = new BcSmartspaceCardLoggingInfo.Builder();
+ builder2.mInstanceId = InstanceId.create(smartspaceTarget);
+ builder2.mFeatureType = this.mHolidayAlarmsTarget.getFeatureType();
+ builder2.mDisplaySurface = i;
+ bcSmartspaceCardLoggingInfo = new BcSmartspaceCardLoggingInfo(builder2);
+ }
+ if (tapAction == null || (tapAction.getIntent() == null && tapAction.getPendingIntent() == null)) {
+ BcSmartSpaceUtil.setOnClickListener(view, this.mHolidayAlarmsTarget, SHOW_ALARMS_ACTION, smartspaceEventNotifier, "BcNextAlarmData", bcSmartspaceCardLoggingInfo, 0);
+ } else {
+ BcSmartSpaceUtil.setOnClickListener(view, this.mHolidayAlarmsTarget, tapAction, smartspaceEventNotifier, "BcNextAlarmData", bcSmartspaceCardLoggingInfo, 0);
+ }
+ }
+
+ public String getDescription(BaseTemplateData.SubItemInfo subItemInfo) {
+ CharSequence holidayAlarmText = getHolidayAlarmText(subItemInfo);
+ if (!TextUtils.isEmpty(holidayAlarmText)) {
+ return this.mDescription + " · " + ((Object) holidayAlarmText);
+ }
+ return this.mDescription;
+ }
+}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartSpaceUtil.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartSpaceUtil.java
index 490426d..ebe996d 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartSpaceUtil.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartSpaceUtil.java
@@ -4,8 +4,8 @@
import android.app.smartspace.SmartspaceAction;
import android.app.smartspace.SmartspaceTarget;
import android.app.smartspace.SmartspaceTargetEvent;
+import android.app.smartspace.uitemplatedata.TapAction;
import android.content.ActivityNotFoundException;
-import android.content.ComponentName;
import android.content.ContentUris;
import android.content.Context;
import android.content.Intent;
@@ -13,151 +13,109 @@
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.os.Bundle;
-import android.os.UserHandle;
import android.provider.CalendarContract;
import android.util.Log;
import android.view.View;
-
import com.android.systemui.bcsmartspace.R;
import com.android.systemui.plugins.BcSmartspaceDataPlugin;
import com.android.systemui.plugins.FalsingManager;
-
import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLogger;
import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
public final class BcSmartSpaceUtil {
- private static FalsingManager sFalsingManager;
- private static BcSmartspaceDataPlugin.IntentStarter sIntentStarter;
+ public static FalsingManager sFalsingManager;
+ public static BcSmartspaceDataPlugin.IntentStarter sIntentStarter;
- public static void setOnClickListener(
- View view,
- SmartspaceTarget smartspaceTarget,
- SmartspaceAction smartspaceAction,
- String str,
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
- setOnClickListener(
- view,
- smartspaceTarget,
- smartspaceAction,
- null,
- str,
- smartspaceEventNotifier,
- bcSmartspaceCardLoggingInfo,
- 0);
- }
-
- public static void setOnClickListener(
- View view,
- SmartspaceTarget smartspaceTarget,
- SmartspaceAction smartspaceAction,
- String str,
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo,
- int i) {
- setOnClickListener(
- view,
- smartspaceTarget,
- smartspaceAction,
- null,
- str,
- smartspaceEventNotifier,
- bcSmartspaceCardLoggingInfo,
- i);
- }
-
- public static void setOnClickListener(
- View view,
- final SmartspaceTarget smartspaceTarget,
- final SmartspaceAction smartspaceAction,
- final View.OnClickListener onClickListener,
- final String str,
- final BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- final BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo,
- final int i) {
- if (view == null || smartspaceAction == null) {
- Log.e(str, "No tap action can be set up");
- return;
- }
- final boolean z =
- smartspaceAction.getExtras() != null
- && smartspaceAction.getExtras().getBoolean("show_on_lockscreen");
- final boolean z2 =
- smartspaceAction.getIntent() == null && smartspaceAction.getPendingIntent() == null;
- BcSmartspaceDataPlugin.IntentStarter intentStarter = sIntentStarter;
- if (intentStarter == null) {
- intentStarter = defaultIntentStarter(str);
- }
- final BcSmartspaceDataPlugin.IntentStarter intentStarter2 = intentStarter;
- view.setOnClickListener(
- new View.OnClickListener() {
- @Override
- public final void onClick(View view2) {
+ public static void setOnClickListener(View view, final SmartspaceTarget smartspaceTarget, final SmartspaceAction smartspaceAction, final BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier, final String str, final BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo, final int i) {
+ if (view != null && smartspaceAction != null) {
+ final boolean z = smartspaceAction.getExtras() != null && smartspaceAction.getExtras().getBoolean("show_on_lockscreen");
+ final boolean z2 = smartspaceAction.getIntent() == null && smartspaceAction.getPendingIntent() == null;
+ BcSmartspaceDataPlugin.IntentStarter intentStarter = sIntentStarter;
+ if (intentStarter == null) {
+ intentStarter = new SmartspaceIntentStarter(str);
+ }
+ final BcSmartspaceDataPlugin.IntentStarter intentStarter2 = intentStarter;
+ view.setOnClickListener(new View.OnClickListener() { // from class: com.google.android.systemui.smartspace.BcSmartSpaceUtil.1
+ @Override // android.view.View.OnClickListener
+ public void onClick(View v) {
+ FalsingManager falsingManager = BcSmartSpaceUtil.sFalsingManager;
+ if (falsingManager == null || !falsingManager.isFalseTap(1)) {
if (bcSmartspaceCardLoggingInfo != null) {
- if (bcSmartspaceCardLoggingInfo.getSubcardInfo() != null) {
- bcSmartspaceCardLoggingInfo
- .getSubcardInfo()
- .setClickedSubcardIndex(i);
+ if (bcSmartspaceCardLoggingInfo.mSubcardInfo != null) {
+ bcSmartspaceCardLoggingInfo.mSubcardInfo.mClickedSubcardIndex = i;
}
- BcSmartspaceCardLogger.log(
- BcSmartspaceEvent.SMARTSPACE_CARD_CLICK,
- bcSmartspaceCardLoggingInfo);
+ BcSmartspaceCardLogger.log(BcSmartspaceEvent.SMARTSPACE_CARD_CLICK, bcSmartspaceCardLoggingInfo);
}
- FalsingManager falsingManager = sFalsingManager;
- if (falsingManager == null || !falsingManager.isFalseTap(1)) {
- if (!z) {
- intentStarter2.startFromAction(smartspaceAction, view2, z2);
- }
- if (onClickListener != null) {
- onClickListener.onClick(view2);
- }
- if (smartspaceEventNotifier == null) {
- Log.w(
- str,
- "Cannot notify target interaction smartspace event: event"
- + " notifier null.");
- } else {
- smartspaceEventNotifier.notifySmartspaceEvent(
- new SmartspaceTargetEvent.Builder(1)
- .setSmartspaceTarget(smartspaceTarget)
- .setSmartspaceActionId(smartspaceAction.getId())
- .build());
- }
+ if (!z2) {
+ intentStarter2.startFromAction(smartspaceAction, v, z);
+ }
+ if (smartspaceEventNotifier == null) {
+ Log.w(str, "Cannot notify target interaction smartspace event: event notifier null.");
+ } else {
+ smartspaceEventNotifier.notifySmartspaceEvent(new SmartspaceTargetEvent.Builder(1).setSmartspaceTarget(smartspaceTarget).setSmartspaceActionId(smartspaceAction.getId()).build());
}
}
- });
- }
-
- public static String getDimensionRatio(Bundle bundle) {
- if (bundle != null
- && bundle.containsKey("imageRatioWidth")
- && bundle.containsKey("imageRatioHeight")) {
- int i = bundle.getInt("imageRatioWidth");
- int i2 = bundle.getInt("imageRatioHeight");
- if (i > 0 && i2 > 0) {
- return i + ":" + i2;
- }
+ }
+ });
+ return;
}
- return null;
+ Log.e(str, "No tap action can be set up");
}
- public static Drawable getIconDrawable(Icon icon, Context context) {
- Drawable drawable;
+ public static void setOnClickListener(View view, final SmartspaceTarget smartspaceTarget, final TapAction tapAction, final BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier, final String str, final BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo, final int i) {
+ if (view != null && tapAction != null) {
+ final boolean shouldShowOnLockscreen = tapAction.shouldShowOnLockscreen();
+ view.setOnClickListener(new View.OnClickListener() { // from class: com.google.android.systemui.smartspace.BcSmartSpaceUtil.2
+ @Override // android.view.View.OnClickListener
+ public void onClick(View view2) {
+ FalsingManager falsingManager = BcSmartSpaceUtil.sFalsingManager;
+ if (falsingManager == null || !falsingManager.isFalseTap(1)) {
+ if (bcSmartspaceCardLoggingInfo != null) {
+ if (bcSmartspaceCardLoggingInfo.mSubcardInfo != null) {
+ bcSmartspaceCardLoggingInfo.mSubcardInfo.mClickedSubcardIndex = i;
+ }
+ BcSmartspaceCardLogger.log(BcSmartspaceEvent.SMARTSPACE_CARD_CLICK, bcSmartspaceCardLoggingInfo);
+ }
+ BcSmartspaceDataPlugin.IntentStarter intentStarter = BcSmartSpaceUtil.sIntentStarter;
+ if (intentStarter == null) {
+ intentStarter = new SmartspaceIntentStarter(str);
+ }
+ boolean z = tapAction == null || (tapAction.getIntent() == null && tapAction.getPendingIntent() == null);
+ if (!z) {
+ intentStarter.startFromAction(tapAction, view2, shouldShowOnLockscreen);
+ }
+ if (smartspaceEventNotifier == null) {
+ Log.w(str, "Cannot notify target interaction smartspace event: event notifier null.");
+ } else {
+ smartspaceEventNotifier.notifySmartspaceEvent(new SmartspaceTargetEvent.Builder(1).setSmartspaceTarget(smartspaceTarget).setSmartspaceActionId(tapAction.getId().toString()).build());
+ }
+ }
+ }
+ });
+ return;
+ }
+ Log.e(str, "No tap action can be set up");
+ }
+
+ public static void setOnClickListener(BcSmartspaceCardSecondary bcSmartspaceCardSecondary, SmartspaceTarget smartspaceTarget, TapAction tapAction, BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier, String str, BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
+ setOnClickListener(bcSmartspaceCardSecondary, smartspaceTarget, tapAction, smartspaceEventNotifier, str, bcSmartspaceCardLoggingInfo, 0);
+ }
+
+ public static Drawable getIconDrawable(Context context, Icon icon) {
+ Drawable bitmapDrawable;
if (icon == null) {
return null;
}
if (icon.getType() == 1 || icon.getType() == 5) {
- drawable = new BitmapDrawable(context.getResources(), icon.getBitmap());
+ bitmapDrawable = new BitmapDrawable(context.getResources(), icon.getBitmap());
} else {
- drawable = icon.loadDrawable(context);
+ bitmapDrawable = icon.loadDrawable(context);
}
- if (drawable != null) {
- int dimensionPixelSize =
- context.getResources()
- .getDimensionPixelSize(R.dimen.enhanced_smartspace_icon_size);
- drawable.setBounds(0, 0, dimensionPixelSize, dimensionPixelSize);
+ if (bitmapDrawable != null) {
+ int dimensionPixelSize = context.getResources().getDimensionPixelSize(R.dimen.enhanced_smartspace_icon_size);
+ bitmapDrawable.setBounds(0, 0, dimensionPixelSize, dimensionPixelSize);
}
- return drawable;
+ return bitmapDrawable;
}
public static void setFalsingManager(FalsingManager falsingManager) {
@@ -168,64 +126,60 @@
sIntentStarter = intentStarter;
}
- private static BcSmartspaceDataPlugin.IntentStarter defaultIntentStarter(final String str) {
- return new BcSmartspaceDataPlugin.IntentStarter() {
- @Override
- public void startIntent(View view, Intent intent, boolean z) {
- try {
- view.getContext().startActivity(intent);
- } catch (ActivityNotFoundException | NullPointerException | SecurityException e) {
- Log.e(str, "Cannot invoke smartspace intent", e);
- }
- }
-
- @Override
- public void startPendingIntent(PendingIntent pendingIntent, boolean z) {
- try {
- pendingIntent.send();
- } catch (PendingIntent.CanceledException e) {
- Log.e(str, "Cannot invoke canceled smartspace intent", e);
- }
- }
- };
+ public static Intent getOpenCalendarIntent() {
+ return new Intent("android.intent.action.VIEW").setData(ContentUris.appendId(CalendarContract.CONTENT_URI.buildUpon().appendPath("time"), System.currentTimeMillis()).build()).addFlags(270532608);
}
- public static boolean isLoggable(String str) {
- return Log.isLoggable(str, 2);
+ /* renamed from: com.google.android.systemui.smartspace.BcSmartSpaceUtil$AnonymousClass1 reason: case insensitive filesystem */
+ public static class SmartspaceIntentStarter implements BcSmartspaceDataPlugin.IntentStarter {
+ public final String tag;
+
+ public SmartspaceIntentStarter(String str) {
+ this.tag = str;
+ }
+
+ public void startIntent(View view, Intent intent, boolean z) {
+ try {
+ view.getContext().startActivity(intent);
+ } catch (ActivityNotFoundException | NullPointerException | SecurityException e) {
+ Log.e(this.tag, "Cannot invoke smartspace intent", e);
+ }
+ }
+
+ public void startPendingIntent(PendingIntent pendingIntent, boolean z) {
+ try {
+ pendingIntent.send();
+ } catch (PendingIntent.CanceledException e) {
+ Log.e(this.tag, "Cannot invoke canceled smartspace intent", e);
+ }
+ }
}
- public static int getLoggingDisplaySurface(String str, float f, boolean z) {
- str.hashCode();
- if (!str.equals("com.google.android.apps.nexuslauncher")) {
- if (!str.equals("com.android.systemui")) {
- return 0;
+ public static String getDimensionRatio(Bundle bundle) {
+ if (bundle.containsKey("imageRatioWidth") && bundle.containsKey("imageRatioHeight")) {
+ int i = bundle.getInt("imageRatioWidth");
+ int i2 = bundle.getInt("imageRatioHeight");
+ if (i > 0 && i2 > 0) {
+ return i + ":" + i2;
}
+ return null;
+ }
+ return null;
+ }
+
+ public static int getLoggingDisplaySurface(String str, boolean z, float f) {
+ if (str.equals("com.google.android.apps.nexuslauncher")) {
+ return 1;
+ }
+ if (str.equals("com.android.systemui")) {
if (f == 1.0f) {
return 3;
}
- if (z) {
- return 5;
- }
return f == 0.0f ? 2 : -1;
+ } else if (z) {
+ return 5;
+ } else {
+ return 0;
}
- return 1;
- }
-
- public static SmartspaceTarget createUpcomingAlarmTarget(
- ComponentName componentName, UserHandle userHandle) {
- return new SmartspaceTarget.Builder(
- "upcoming_alarm_card_94510_12684", componentName, userHandle)
- .setFeatureType(23)
- .build();
- }
-
- public static Intent getOpenCalendarIntent() {
- return new Intent("android.intent.action.VIEW")
- .setData(
- ContentUris.appendId(
- CalendarContract.CONTENT_URI.buildUpon().appendPath("time"),
- System.currentTimeMillis())
- .build())
- .addFlags(270532608);
}
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCard.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCard.java
index fa479ee..7ea7602 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCard.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCard.java
@@ -3,55 +3,49 @@
import android.app.smartspace.SmartspaceAction;
import android.app.smartspace.SmartspaceTarget;
import android.content.Context;
-import android.content.Intent;
-import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
-import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.ImageView;
-import android.widget.LinearLayout;
import android.widget.TextView;
-
-import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
-
+import androidx.constraintlayout.widget.ConstraintLayout;
import com.android.launcher3.icons.GraphicsUtils;
import com.android.systemui.bcsmartspace.R;
+import com.android.systemui.animation.Interpolators;
import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-
import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
import com.google.android.systemui.smartspace.logging.BcSmartspaceCardMetadataLoggingInfo;
-
+import com.google.android.systemui.smartspace.logging.BcSmartspaceSubcardLoggingInfo;
import java.util.List;
import java.util.Locale;
-import java.util.UUID;
-public class BcSmartspaceCard extends LinearLayout {
- private static final SmartspaceAction SHOW_ALARMS_ACTION =
- new SmartspaceAction.Builder("nextAlarmId", "Next alarm")
- .setIntent(new Intent("android.intent.action.SHOW_ALARMS"))
- .build();
- private DoubleShadowTextView mBaseActionIconSubtitleView;
- private IcuDateTextView mDateView;
- private ImageView mDndImageView;
- private float mDozeAmount;
- private BcSmartspaceDataPlugin.SmartspaceEventNotifier mEventNotifier;
- private ViewGroup mExtrasGroup;
- private DoubleShadowIconDrawable mIconDrawable;
- private int mIconTintColor;
+public class BcSmartspaceCard extends ConstraintLayout {
+ public DoubleShadowTextView mBaseActionIconSubtitleView;
+ public IcuDateTextView mDateView;
+ public final DoubleShadowIconDrawable mDndIconDrawable;
+ public ImageView mDndImageView;
+ public float mDozeAmount;
+ public BcSmartspaceDataPlugin.SmartspaceEventNotifier mEventNotifier;
+ public ViewGroup mExtrasGroup;
+ public final DoubleShadowIconDrawable mIconDrawable;
+ public int mIconTintColor;
public boolean mIsDreaming;
- private BcSmartspaceCardLoggingInfo mLoggingInfo;
- private ImageView mNextAlarmImageView;
- private TextView mNextAlarmTextView;
- private BcSmartspaceCardSecondary mSecondaryCard;
- private TextView mSubtitleTextView;
- private SmartspaceTarget mTarget;
- private TextView mTitleTextView;
- private int mTopPadding;
- private boolean mUsePageIndicatorUi;
+ public final DoubleShadowIconDrawable mNextAlarmIconDrawable;
+ public ImageView mNextAlarmImageView;
+ public TextView mNextAlarmTextView;
+ public String mPrevSmartspaceTargetId;
+ public BcSmartspaceCardSecondary mSecondaryCard;
+ public ViewGroup mSecondaryCardGroup;
+ public TextView mSubtitleTextView;
+ public SmartspaceTarget mTarget;
+ public ViewGroup mTextGroup;
+ public TextView mTitleTextView;
+ public int mTopPadding;
+ public boolean mUsePageIndicatorUi;
+ public boolean mValidSecondaryCard;
public BcSmartspaceCard(Context context) {
this(context, null);
@@ -59,309 +53,173 @@
public BcSmartspaceCard(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
- mSecondaryCard = null;
- mIsDreaming = false;
- mIconTintColor = GraphicsUtils.getAttrColor(getContext(), 16842806);
- mDateView = null;
- mTitleTextView = null;
- mSubtitleTextView = null;
- mBaseActionIconSubtitleView = null;
- mExtrasGroup = null;
- mDndImageView = null;
- mNextAlarmImageView = null;
- mNextAlarmTextView = null;
+ this.mSecondaryCard = null;
+ this.mPrevSmartspaceTargetId = "";
+ this.mIconTintColor = GraphicsUtils.getAttrColor(getContext(), 16842806);
+ this.mTextGroup = null;
+ this.mSecondaryCardGroup = null;
+ this.mDateView = null;
+ this.mTitleTextView = null;
+ this.mSubtitleTextView = null;
+ this.mBaseActionIconSubtitleView = null;
+ this.mExtrasGroup = null;
+ this.mDndImageView = null;
+ this.mNextAlarmImageView = null;
+ this.mNextAlarmTextView = null;
+ this.mIsDreaming = false;
+ this.mIconDrawable = new DoubleShadowIconDrawable(context);
+ this.mNextAlarmIconDrawable = new DoubleShadowIconDrawable(context);
+ this.mDndIconDrawable = new DoubleShadowIconDrawable(context);
}
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- mDateView = (IcuDateTextView) findViewById(R.id.date);
- mTitleTextView = (TextView) findViewById(R.id.title_text);
- mSubtitleTextView = (TextView) findViewById(R.id.subtitle_text);
- mBaseActionIconSubtitleView =
- (DoubleShadowTextView) findViewById(R.id.base_action_icon_subtitle);
- mExtrasGroup = (ViewGroup) findViewById(R.id.smartspace_extras_group);
- mTopPadding = getPaddingTop();
- ViewGroup viewGroup = mExtrasGroup;
- if (viewGroup != null) {
- mDndImageView = (ImageView) viewGroup.findViewById(R.id.dnd_icon);
- mNextAlarmImageView = (ImageView) mExtrasGroup.findViewById(R.id.alarm_icon);
- mNextAlarmTextView = (TextView) mExtrasGroup.findViewById(R.id.alarm_text);
- }
- }
-
- public void setEventNotifier(
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier) {
- mEventNotifier = smartspaceEventNotifier;
- }
-
- public void setSmartspaceTarget(
- SmartspaceTarget smartspaceTarget,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo,
- boolean z) {
- String str;
- int i;
- mTarget = smartspaceTarget;
- SmartspaceAction headerAction = smartspaceTarget.getHeaderAction();
- SmartspaceAction baseAction = smartspaceTarget.getBaseAction();
- mLoggingInfo = bcSmartspaceCardLoggingInfo;
- mUsePageIndicatorUi = z;
- if (headerAction != null) {
- BcSmartspaceCardSecondary bcSmartspaceCardSecondary = mSecondaryCard;
- if (bcSmartspaceCardSecondary != null) {
- mSecondaryCard.setVisibility(
- bcSmartspaceCardSecondary.setSmartspaceActions(
- smartspaceTarget,
- mEventNotifier,
- bcSmartspaceCardLoggingInfo)
- ? View.VISIBLE
- : View.GONE);
- }
- Drawable iconDrawable =
- BcSmartSpaceUtil.getIconDrawable(headerAction.getIcon(), getContext());
- mIconDrawable =
- iconDrawable == null
- ? null
- : new DoubleShadowIconDrawable(iconDrawable, getContext());
- CharSequence title = headerAction.getTitle();
- CharSequence subtitle = headerAction.getSubtitle();
- boolean z2 = smartspaceTarget.getFeatureType() == 1 || !TextUtils.isEmpty(title);
- boolean z3 = !TextUtils.isEmpty(subtitle);
- updateZenVisibility();
- if (!z2) {
- title = subtitle;
- }
- setTitle(title, headerAction.getContentDescription(), z2 != z3);
- if (!z2 || !z3) {
- subtitle = null;
- }
- setSubtitle(subtitle, headerAction.getContentDescription());
- updateIconTint();
- }
- if (baseAction != null && mBaseActionIconSubtitleView != null) {
- Drawable iconDrawable2 =
- baseAction.getIcon() == null
- ? null
- : BcSmartSpaceUtil.getIconDrawable(baseAction.getIcon(), getContext());
- if (iconDrawable2 == null) {
- mBaseActionIconSubtitleView.setVisibility(View.INVISIBLE);
- mBaseActionIconSubtitleView.setOnClickListener(null);
- mBaseActionIconSubtitleView.setContentDescription(null);
- } else {
- iconDrawable2.setTintList(null);
- mBaseActionIconSubtitleView.setText(baseAction.getSubtitle());
- mBaseActionIconSubtitleView.setCompoundDrawablesRelative(
- iconDrawable2, null, null, null);
- mBaseActionIconSubtitleView.setVisibility(View.VISIBLE);
- int subcardType = getSubcardType(baseAction);
- if (subcardType != -1) {
- i = getClickedIndex(bcSmartspaceCardLoggingInfo, subcardType);
- } else {
- Log.d(
- "BcSmartspaceCard",
- String.format(
- "Subcard expected but missing type. loggingInfo=%s,"
- + " baseAction=%s",
- bcSmartspaceCardLoggingInfo.toString(), baseAction.toString()));
- i = 0;
- }
- BcSmartSpaceUtil.setOnClickListener(
- mBaseActionIconSubtitleView,
- smartspaceTarget,
- baseAction,
- "BcSmartspaceCard",
- mEventNotifier,
- bcSmartspaceCardLoggingInfo,
- i);
- setFormattedContentDescription(
- mBaseActionIconSubtitleView,
- baseAction.getSubtitle(),
- baseAction.getContentDescription());
- }
- }
- if (mDateView != null) {
- if (headerAction != null) {
- str = headerAction.getId();
- } else if (baseAction != null) {
- str = baseAction.getId();
- } else {
- str = UUID.randomUUID().toString();
- }
- BcSmartSpaceUtil.setOnClickListener(
- mDateView,
- smartspaceTarget,
- new SmartspaceAction.Builder(str, "unusedTitle")
- .setIntent(BcSmartSpaceUtil.getOpenCalendarIntent())
- .build(),
- "BcSmartspaceCard",
- mEventNotifier,
- bcSmartspaceCardLoggingInfo);
- }
- if (hasIntent(headerAction)) {
- BcSmartSpaceUtil.setOnClickListener(
- this,
- smartspaceTarget,
- headerAction,
- "BcSmartspaceCard",
- mEventNotifier,
- bcSmartspaceCardLoggingInfo,
- (smartspaceTarget.getFeatureType() == 1
- && bcSmartspaceCardLoggingInfo.getFeatureType() == 39)
- ? getClickedIndex(bcSmartspaceCardLoggingInfo, 1)
- : 0);
- } else if (hasIntent(baseAction)) {
- BcSmartSpaceUtil.setOnClickListener(
- this,
- smartspaceTarget,
- baseAction,
- "BcSmartspaceCard",
- mEventNotifier,
- bcSmartspaceCardLoggingInfo);
- } else {
- BcSmartSpaceUtil.setOnClickListener(
- this,
- smartspaceTarget,
- headerAction,
- "BcSmartspaceCard",
- mEventNotifier,
- bcSmartspaceCardLoggingInfo);
- }
- }
-
- private int getClickedIndex(BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo, int i) {
- if (bcSmartspaceCardLoggingInfo == null
- || bcSmartspaceCardLoggingInfo.getSubcardInfo() == null
- || bcSmartspaceCardLoggingInfo.getSubcardInfo().getSubcards() == null) {
+ public static int getClickedIndex(BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo, int i) {
+ List<BcSmartspaceCardMetadataLoggingInfo> list;
+ BcSmartspaceSubcardLoggingInfo bcSmartspaceSubcardLoggingInfo = bcSmartspaceCardLoggingInfo.mSubcardInfo;
+ if (bcSmartspaceSubcardLoggingInfo == null || (list = bcSmartspaceSubcardLoggingInfo.mSubcards) == null) {
return 0;
}
- List<BcSmartspaceCardMetadataLoggingInfo> subcards =
- bcSmartspaceCardLoggingInfo.getSubcardInfo().getSubcards();
- for (int i2 = 0; i2 < subcards.size(); i2++) {
- BcSmartspaceCardMetadataLoggingInfo bcSmartspaceCardMetadataLoggingInfo =
- subcards.get(i2);
- if (bcSmartspaceCardMetadataLoggingInfo != null
- && bcSmartspaceCardMetadataLoggingInfo.getCardTypeId() == i) {
+ for (int i2 = 0; i2 < list.size(); i2++) {
+ BcSmartspaceCardMetadataLoggingInfo bcSmartspaceCardMetadataLoggingInfo = list.get(i2);
+ if (bcSmartspaceCardMetadataLoggingInfo != null && bcSmartspaceCardMetadataLoggingInfo.mCardTypeId == i) {
return i2 + 1;
}
}
return 0;
}
- private int getSubcardType(SmartspaceAction smartspaceAction) {
- if (smartspaceAction == null
- || smartspaceAction.getExtras() == null
- || smartspaceAction.getExtras().isEmpty()) {
- return -1;
- }
- return smartspaceAction.getExtras().getInt("subcardType", -1);
- }
-
- public void setSecondaryCard(BcSmartspaceCardSecondary bcSmartspaceCardSecondary) {
- mSecondaryCard = bcSmartspaceCardSecondary;
- if (getChildAt(1) != null) {
- removeViewAt(1);
- }
- if (bcSmartspaceCardSecondary != null) {
- LinearLayout.LayoutParams layoutParams =
- new LinearLayout.LayoutParams(
- 0,
- getResources()
- .getDimensionPixelSize(R.dimen.enhanced_smartspace_height));
- layoutParams.weight = 3.0f;
- layoutParams.setMarginStart(
- getResources()
- .getDimensionPixelSize(
- R.dimen.enhanced_smartspace_secondary_card_start_margin));
- layoutParams.setMarginEnd(
- getResources()
- .getDimensionPixelSize(
- R.dimen.enhanced_smartspace_secondary_card_end_margin));
- addView(bcSmartspaceCardSecondary, 1, layoutParams);
- }
- }
-
- public void setDozeAmount(float f) {
- mDozeAmount = f;
- BcSmartspaceCardSecondary bcSmartspaceCardSecondary = mSecondaryCard;
- if (bcSmartspaceCardSecondary != null) {
- bcSmartspaceCardSecondary.setAlpha(1.0f - f);
- }
- if (getTarget() != null
- && getTarget().getBaseAction() != null
- && getTarget().getBaseAction().getExtras() != null) {
- Bundle extras = getTarget().getBaseAction().getExtras();
- if (mTitleTextView != null && extras.getBoolean("hide_title_on_aod")) {
- mTitleTextView.setAlpha(1.0f - f);
+ public final void setDozeAmount(float f) {
+ this.mDozeAmount = f;
+ if (this.mTarget != null && this.mTarget.getBaseAction() != null && this.mTarget.getBaseAction().getExtras() != null) {
+ Bundle extras = this.mTarget.getBaseAction().getExtras();
+ if (this.mTitleTextView != null && extras.getBoolean("hide_title_on_aod")) {
+ this.mTitleTextView.setAlpha(1.0f - f);
}
- if (mSubtitleTextView != null && extras.getBoolean("hide_subtitle_on_aod")) {
- mSubtitleTextView.setAlpha(1.0f - f);
+ if (this.mSubtitleTextView != null && extras.getBoolean("hide_subtitle_on_aod")) {
+ this.mSubtitleTextView.setAlpha(1.0f - f);
}
}
- ImageView imageView = mDndImageView;
- if (imageView != null) {
- imageView.setAlpha(mDozeAmount);
+ if (this.mDndImageView != null) {
+ this.mDndImageView.setAlpha(this.mDozeAmount);
+ }
+ if (this.mTextGroup != null) {
+ ViewGroup viewGroup = this.mSecondaryCardGroup;
+ int i = 0;
+ int i2 = 1;
+ boolean z = this.mDozeAmount == 1.0f || !this.mValidSecondaryCard;
+ if (z) {
+ i = 8;
+ }
+ BcSmartspaceTemplateDataUtils.updateVisibility(viewGroup, i);
+ ViewGroup viewGroup2 = this.mSecondaryCardGroup;
+ if (viewGroup2 != null && viewGroup2.getVisibility() != 8) {
+ ViewGroup viewGroup3 = this.mTextGroup;
+ if (!isRtl()) {
+ i2 = -1;
+ }
+ viewGroup3.setTranslationX(Interpolators.EMPHASIZED.getInterpolation(this.mDozeAmount) * this.mSecondaryCardGroup.getWidth() * i2);
+ this.mSecondaryCardGroup.setAlpha(Math.max(0.0f, Math.min(1.0f, ((1.0f - this.mDozeAmount) * 9.0f) - 6.0f)));
+ return;
+ }
+ this.mTextGroup.setTranslationX(0.0f);
}
}
- public void setPrimaryTextColor(int i) {
- TextView textView = mTitleTextView;
- if (textView != null) {
- textView.setTextColor(i);
+ public final void setPrimaryTextColor(int i) {
+ if (this.mTitleTextView != null) {
+ this.mTitleTextView.setTextColor(i);
}
- IcuDateTextView icuDateTextView = mDateView;
- if (icuDateTextView != null) {
- icuDateTextView.setTextColor(i);
+ if (this.mDateView != null) {
+ this.mDateView.setTextColor(i);
}
- TextView textView2 = mSubtitleTextView;
- if (textView2 != null) {
- textView2.setTextColor(i);
+ if (this.mSubtitleTextView != null) {
+ this.mSubtitleTextView.setTextColor(i);
}
- DoubleShadowTextView doubleShadowTextView = mBaseActionIconSubtitleView;
- if (doubleShadowTextView != null) {
- doubleShadowTextView.setTextColor(i);
+ if (this.mBaseActionIconSubtitleView != null) {
+ this.mBaseActionIconSubtitleView.setTextColor(i);
}
- mIconTintColor = i;
- updateZenColors();
+ if (this.mSecondaryCard != null) {
+ this.mSecondaryCard.setTextColor(i);
+ }
+ this.mIconTintColor = i;
+ if (this.mNextAlarmTextView != null) {
+ this.mNextAlarmTextView.setTextColor(i);
+ }
+ if (this.mNextAlarmImageView != null && this.mNextAlarmImageView.getDrawable() != null) {
+ this.mNextAlarmImageView.getDrawable().setTint(this.mIconTintColor);
+ }
+ if (this.mDndImageView != null && this.mDndImageView.getDrawable() != null) {
+ this.mDndImageView.getDrawable().setTint(this.mIconTintColor);
+ }
updateIconTint();
}
- @Override
- public AccessibilityNodeInfo createAccessibilityNodeInfo() {
- AccessibilityNodeInfo createAccessibilityNodeInfo = super.createAccessibilityNodeInfo();
- AccessibilityNodeInfoCompat.wrap(createAccessibilityNodeInfo).setRoleDescription(" ");
- return createAccessibilityNodeInfo;
+ public final void setSubtitle(CharSequence charSequence, CharSequence charSequence2, boolean z) {
+ DoubleShadowIconDrawable doubleShadowIconDrawable;
+ int i;
+ if (this.mSubtitleTextView == null) {
+ Log.w("BcSmartspaceCard", "No subtitle view to update");
+ return;
+ }
+ this.mSubtitleTextView.setText(charSequence);
+ DoubleShadowIconDrawable doubleShadowIconDrawable2 = null;
+ if (!TextUtils.isEmpty(charSequence) && z) {
+ doubleShadowIconDrawable = this.mIconDrawable;
+ } else {
+ doubleShadowIconDrawable = null;
+ }
+ this.mSubtitleTextView.setCompoundDrawablesRelative(doubleShadowIconDrawable, null, null, null);
+ SmartspaceTarget smartspaceTarget = this.mTarget;
+ if (smartspaceTarget != null && smartspaceTarget.getFeatureType() == 5 && !this.mUsePageIndicatorUi) {
+ i = 2;
+ } else {
+ i = 1;
+ }
+ this.mSubtitleTextView.setMaxLines(i);
+ setFormattedContentDescription(this.mSubtitleTextView, charSequence, charSequence2);
+ if (z) {
+ doubleShadowIconDrawable2 = this.mIconDrawable;
+ }
+ BcSmartspaceTemplateDataUtils.offsetTextViewForIcon(this.mSubtitleTextView, doubleShadowIconDrawable2, isRtl());
}
- void setTitle(CharSequence charSequence, CharSequence charSequence2, boolean z) {
+ public final void setTitle(CharSequence charSequence, CharSequence charSequence2, boolean z) {
+ SmartspaceAction headerAction;
+ Bundle extras;
boolean z2;
- TextView textView = mTitleTextView;
- if (textView == null) {
+ DoubleShadowIconDrawable doubleShadowIconDrawable;
+ if (this.mTitleTextView == null) {
Log.w("BcSmartspaceCard", "No title view to update");
return;
}
- textView.setText(charSequence);
- SmartspaceAction headerAction = mTarget.getHeaderAction();
- Bundle extras = headerAction == null ? null : headerAction.getExtras();
+ this.mTitleTextView.setText(charSequence);
+ DoubleShadowIconDrawable doubleShadowIconDrawable2 = null;
+ if (this.mTarget == null) {
+ headerAction = null;
+ } else {
+ headerAction = this.mTarget.getHeaderAction();
+ }
+ if (headerAction == null) {
+ extras = null;
+ } else {
+ extras = headerAction.getExtras();
+ }
if (extras != null && extras.containsKey("titleEllipsize")) {
String string = extras.getString("titleEllipsize");
try {
- mTitleTextView.setEllipsize(TextUtils.TruncateAt.valueOf(string));
- } catch (IllegalArgumentException unused) {
- Log.w("BcSmartspaceCard", "Invalid TruncateAt value: " + string);
+ this.mTitleTextView.setEllipsize(TextUtils.TruncateAt.valueOf(string));
+ } catch (IllegalArgumentException e) {
+ Log.e("BcSmartspaceCard", "Invalid TruncateAt value: " + string);
}
- } else if (mTarget.getFeatureType() == 2
- && Locale.ENGLISH
- .getLanguage()
- .equals(mContext.getResources().getConfiguration().locale.getLanguage())) {
- mTitleTextView.setEllipsize(TextUtils.TruncateAt.MIDDLE);
+ } else if (this.mTarget != null && this.mTarget.getFeatureType() == 2 && Locale.ENGLISH.getLanguage().equals(getContext().getResources().getConfiguration().locale.getLanguage())) {
+ this.mTitleTextView.setEllipsize(TextUtils.TruncateAt.MIDDLE);
} else {
- mTitleTextView.setEllipsize(TextUtils.TruncateAt.END);
+ this.mTitleTextView.setEllipsize(TextUtils.TruncateAt.END);
}
boolean z3 = false;
if (extras != null) {
int i = extras.getInt("titleMaxLines");
if (i != 0) {
- mTitleTextView.setMaxLines(i);
+ this.mTitleTextView.setMaxLines(i);
}
z2 = extras.getBoolean("disableTitleIcon");
} else {
@@ -371,195 +229,109 @@
z3 = true;
}
if (z3) {
- setFormattedContentDescription(mTitleTextView, charSequence, charSequence2);
+ setFormattedContentDescription(this.mTitleTextView, charSequence, charSequence2);
}
- mTitleTextView.setCompoundDrawablesRelative(z3 ? mIconDrawable : null, null, null, null);
- }
-
- void setSubtitle(CharSequence charSequence, CharSequence charSequence2) {
- TextView textView = mSubtitleTextView;
- if (textView == null) {
- Log.w("BcSmartspaceCard", "No subtitle view to update");
- return;
- }
- textView.setText(charSequence);
- mSubtitleTextView.setCompoundDrawablesRelative(
- TextUtils.isEmpty(charSequence) ? null : mIconDrawable, null, null, null);
- mSubtitleTextView.setMaxLines(
- (mTarget.getFeatureType() != 5 || mUsePageIndicatorUi) ? 1 : 2);
- setFormattedContentDescription(mSubtitleTextView, charSequence, charSequence2);
- }
-
- void updateIconTint() {
- SmartspaceTarget smartspaceTarget = mTarget;
- if (smartspaceTarget == null || mIconDrawable == null) {
- return;
- }
- boolean z = true;
- if (smartspaceTarget.getFeatureType() == 1) {
- z = false;
- }
- if (z) {
- mIconDrawable.setTint(mIconTintColor);
+ if (z3) {
+ doubleShadowIconDrawable = this.mIconDrawable;
} else {
- mIconDrawable.setTintList(null);
+ doubleShadowIconDrawable = null;
+ }
+ this.mTitleTextView.setCompoundDrawablesRelative(doubleShadowIconDrawable, null, null, null);
+ if (z3) {
+ doubleShadowIconDrawable2 = this.mIconDrawable;
+ }
+ BcSmartspaceTemplateDataUtils.offsetTextViewForIcon(this.mTitleTextView, doubleShadowIconDrawable2, isRtl());
+ }
+
+ public final void updateIconTint() {
+ if (this.mTarget != null && this.mIconDrawable != null) {
+ boolean z = this.mTarget.getFeatureType() != 1;
+ if (z) {
+ this.mIconDrawable.setTint(this.mIconTintColor);
+ } else {
+ this.mIconDrawable.setTintList(null);
+ }
}
}
- void updateZenColors() {
- TextView textView = mNextAlarmTextView;
- if (textView != null) {
- textView.setTextColor(mIconTintColor);
- }
- updateTint(mNextAlarmImageView);
- updateTint(mDndImageView);
- }
-
- private void updateTint(ImageView imageView) {
- if (imageView == null || imageView.getDrawable() == null) {
+ public final void updateZenVisibility() {
+ if (this.mExtrasGroup == null) {
return;
}
- imageView.getDrawable().setTint(mIconTintColor);
- }
-
- public void setDnd(Drawable drawable, String str) {
- ImageView imageView = mDndImageView;
- if (imageView == null) {
- return;
- }
- if (drawable == null) {
- imageView.setVisibility(View.GONE);
- } else {
- imageView.setImageDrawable(
- new DoubleShadowIconDrawable(drawable.mutate(), getContext()));
- mDndImageView.setContentDescription(str);
- mDndImageView.setVisibility(View.VISIBLE);
- }
- updateZenVisibility();
- }
-
- public void setNextAlarm(Drawable drawable, String str, SmartspaceTarget smartspaceTarget) {
- ImageView imageView = mNextAlarmImageView;
- if (imageView == null || mNextAlarmTextView == null) {
- return;
- }
- if (drawable == null) {
- imageView.setVisibility(View.GONE);
- mNextAlarmTextView.setVisibility(View.GONE);
- } else {
- String maybeAppendHolidayInfoToNextAlarm =
- maybeAppendHolidayInfoToNextAlarm(str, smartspaceTarget);
- mNextAlarmImageView.setImageDrawable(
- new DoubleShadowIconDrawable(drawable.mutate(), getContext()));
- mNextAlarmImageView.setVisibility(View.VISIBLE);
- mNextAlarmTextView.setContentDescription(
- getContext()
- .getString(
- R.string.accessibility_next_alarm,
- maybeAppendHolidayInfoToNextAlarm));
- mNextAlarmTextView.setText(maybeAppendHolidayInfoToNextAlarm);
- mNextAlarmTextView.setVisibility(View.VISIBLE);
- setNextAlarmClickListener(mNextAlarmImageView, smartspaceTarget);
- setNextAlarmClickListener(mNextAlarmTextView, smartspaceTarget);
- }
- updateZenVisibility();
- }
-
- private void setNextAlarmClickListener(View view, SmartspaceTarget smartspaceTarget) {
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo;
- if (smartspaceTarget == null) {
- bcSmartspaceCardLoggingInfo =
- new BcSmartspaceCardLoggingInfo.Builder()
- .setInstanceId(InstanceId.create("upcoming_alarm_card_94510_12684"))
- .setFeatureType(23)
- .setDisplaySurface(
- BcSmartSpaceUtil.getLoggingDisplaySurface(
- getContext().getPackageName(), mDozeAmount, mIsDreaming))
- .build();
- } else {
- bcSmartspaceCardLoggingInfo =
- new BcSmartspaceCardLoggingInfo.Builder()
- .setInstanceId(InstanceId.create(smartspaceTarget))
- .setFeatureType(smartspaceTarget.getFeatureType())
- .setDisplaySurface(
- BcSmartSpaceUtil.getLoggingDisplaySurface(
- getContext().getPackageName(), mDozeAmount, mIsDreaming))
- .build();
- }
- BcSmartSpaceUtil.setOnClickListener(
- view,
- smartspaceTarget,
- SHOW_ALARMS_ACTION,
- "BcSmartspaceCard",
- mEventNotifier,
- bcSmartspaceCardLoggingInfo);
- }
-
- private String maybeAppendHolidayInfoToNextAlarm(
- String str, SmartspaceTarget smartspaceTarget) {
- CharSequence holidayAlarmsText = getHolidayAlarmsText(smartspaceTarget);
- if (!TextUtils.isEmpty(holidayAlarmsText)) {
- return str + " · " + ((Object) holidayAlarmsText);
- }
- return str;
- }
-
- public static CharSequence getHolidayAlarmsText(SmartspaceTarget smartspaceTarget) {
- SmartspaceAction headerAction;
- if (smartspaceTarget == null
- || (headerAction = smartspaceTarget.getHeaderAction()) == null) {
- return null;
- }
- return headerAction.getTitle();
- }
-
- private void updateZenVisibility() {
- if (mExtrasGroup == null) {
- return;
- }
- ImageView imageView = mDndImageView;
- boolean z = true;
+ ImageView imageView = this.mDndImageView;
+ boolean z3 = true;
int i = 0;
- boolean z2 = imageView != null && imageView.getVisibility() == 0;
- ImageView imageView2 = mNextAlarmImageView;
- boolean z3 = imageView2 != null && imageView2.getVisibility() == 0;
- if ((!z2 && !z3) || (mUsePageIndicatorUi && mTarget.getFeatureType() != 1)) {
- z = false;
+ boolean z = imageView != null && imageView.getVisibility() == 0;
+ ImageView imageView2 = this.mNextAlarmImageView;
+ boolean z2 = imageView2 != null && imageView2.getVisibility() == 0;
+ if ((!z && !z2) || (this.mUsePageIndicatorUi && (this.mTarget == null || this.mTarget.getFeatureType() != 1))) {
+ z3 = false;
}
- int i2 = mTopPadding;
- if (!z) {
- mExtrasGroup.setVisibility(View.INVISIBLE);
+ int i2 = this.mTopPadding;
+ if (!z3) {
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mExtrasGroup, 4);
i = i2;
} else {
- mExtrasGroup.setVisibility(View.VISIBLE);
- updateZenColors();
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mExtrasGroup, 0);
+ if (this.mNextAlarmTextView != null) {
+ this.mNextAlarmTextView.setTextColor(this.mIconTintColor);
+ }
+ if (this.mNextAlarmImageView != null && this.mNextAlarmImageView.getDrawable() != null) {
+ this.mNextAlarmImageView.getDrawable().setTint(this.mIconTintColor);
+ }
+ if (this.mDndImageView != null && this.mDndImageView.getDrawable() != null) {
+ this.mDndImageView.getDrawable().setTint(this.mIconTintColor);
+ }
}
setPadding(getPaddingLeft(), i, getPaddingRight(), getPaddingBottom());
}
- public SmartspaceTarget getTarget() {
- return mTarget;
+ public final AccessibilityNodeInfo createAccessibilityNodeInfo() {
+ AccessibilityNodeInfo createAccessibilityNodeInfo = super.createAccessibilityNodeInfo();
+ createAccessibilityNodeInfo.getExtras().putCharSequence("AccessibilityNodeInfo.roleDescription", " ");
+ return createAccessibilityNodeInfo;
}
- private void setFormattedContentDescription(
- TextView textView, CharSequence charSequence, CharSequence charSequence2) {
- if (TextUtils.isEmpty(charSequence)) {
- charSequence = charSequence2;
- } else if (!TextUtils.isEmpty(charSequence2)) {
- charSequence =
- mContext.getString(
- R.string.generic_smartspace_concatenated_desc,
- charSequence2,
- charSequence);
+ public final void onFinishInflate() {
+ super.onFinishInflate();
+ this.mTextGroup = (ViewGroup) findViewById(R.id.text_group);
+ this.mSecondaryCardGroup = (ViewGroup) findViewById(R.id.secondary_card_group);
+ this.mDateView = (IcuDateTextView) findViewById(R.id.date);
+ this.mTitleTextView = (TextView) findViewById(R.id.title_text);
+ this.mSubtitleTextView = (TextView) findViewById(R.id.subtitle_text);
+ this.mBaseActionIconSubtitleView = (DoubleShadowTextView) findViewById(R.id.base_action_icon_subtitle);
+ this.mExtrasGroup = (ViewGroup) findViewById(R.id.smartspace_extras_group);
+ this.mTopPadding = getPaddingTop();
+ if (this.mExtrasGroup != null) {
+ this.mDndImageView = (ImageView) this.mExtrasGroup.findViewById(R.id.dnd_icon);
+ this.mNextAlarmImageView = (ImageView) this.mExtrasGroup.findViewById(R.id.alarm_icon);
+ this.mNextAlarmTextView = (TextView) this.mExtrasGroup.findViewById(R.id.alarm_text);
}
- textView.setContentDescription(charSequence);
}
- private boolean hasIntent(SmartspaceAction smartspaceAction) {
- return (smartspaceAction == null
- || (smartspaceAction.getIntent() == null
- && smartspaceAction.getPendingIntent() == null))
- ? false
- : true;
+ public final void setFormattedContentDescription(TextView textView, CharSequence charSequence, CharSequence charSequence2) {
+ String string;
+ String str;
+ if (TextUtils.isEmpty(charSequence)) {
+ string = String.valueOf(charSequence2);
+ } else if (TextUtils.isEmpty(charSequence2)) {
+ string = String.valueOf(charSequence);
+ } else {
+ string = getContext().getString(R.string.generic_smartspace_concatenated_desc, charSequence2, charSequence);
+ }
+ Object[] objArr = new Object[4];
+ if (textView == this.mTitleTextView) {
+ str = "TITLE";
+ } else if (textView == this.mSubtitleTextView) {
+ str = "SUBTITLE";
+ } else {
+ str = "SUPPLEMENTAL";
+ }
+ objArr[0] = str;
+ objArr[1] = charSequence;
+ objArr[2] = charSequence2;
+ objArr[3] = string;
+ Log.i("BcSmartspaceCard", String.format("setFormattedContentDescription: textView=%s, text=%s, iconDescription=%s, contentDescription=%s", objArr));
+ textView.setContentDescription(string);
}
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardCombination.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardCombination.java
index 565a6f0..044efdd 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardCombination.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardCombination.java
@@ -7,89 +7,26 @@
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
-import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
-
import androidx.constraintlayout.widget.ConstraintLayout;
-
import com.android.systemui.bcsmartspace.R;
import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-
import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
-
import java.util.List;
public class BcSmartspaceCardCombination extends BcSmartspaceCardSecondary {
- protected ConstraintLayout mFirstSubCard;
- protected ConstraintLayout mSecondSubCard;
+ public ConstraintLayout mFirstSubCard;
+ public ConstraintLayout mSecondSubCard;
public BcSmartspaceCardCombination(Context context) {
super(context);
}
- public BcSmartspaceCardCombination(Context context, AttributeSet attributeSet) {
- super(context, attributeSet);
- }
-
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- mFirstSubCard = (ConstraintLayout) findViewById(R.id.first_sub_card);
- mSecondSubCard = (ConstraintLayout) findViewById(R.id.second_sub_card);
- }
-
- @Override
- public boolean setSmartspaceActions(
- SmartspaceTarget smartspaceTarget,
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
- SmartspaceAction smartspaceAction;
- List actionChips = smartspaceTarget.getActionChips();
- if (actionChips == null
- || actionChips.size() < 1
- || (smartspaceAction = (SmartspaceAction) actionChips.get(0)) == null) {
- return false;
- }
- ConstraintLayout constraintLayout = mFirstSubCard;
- boolean z =
- constraintLayout != null
- && fillSubCard(
- constraintLayout,
- smartspaceTarget,
- smartspaceAction,
- smartspaceEventNotifier,
- bcSmartspaceCardLoggingInfo);
- boolean z2 = actionChips.size() > 1 && actionChips.get(1) != null;
- boolean fillSubCard =
- z2
- ? fillSubCard(
- mSecondSubCard,
- smartspaceTarget,
- (SmartspaceAction) actionChips.get(1),
- smartspaceEventNotifier,
- bcSmartspaceCardLoggingInfo)
- : true;
- if (getLayoutParams() instanceof LinearLayout.LayoutParams) {
- LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) getLayoutParams();
- if (z2 && fillSubCard) {
- layoutParams.weight = 3.0f;
- } else {
- layoutParams.weight = 1.0f;
- }
- setLayoutParams(layoutParams);
- }
- return z && fillSubCard;
- }
-
- public boolean fillSubCard(
- ConstraintLayout constraintLayout,
- SmartspaceTarget smartspaceTarget,
- SmartspaceAction smartspaceAction,
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
+ public final boolean fillSubCard(ConstraintLayout constraintLayout, SmartspaceTarget smartspaceTarget, SmartspaceAction smartspaceAction, BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier, BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
boolean z;
+ CharSequence charSequence;
TextView textView = (TextView) constraintLayout.findViewById(R.id.sub_card_text);
ImageView imageView = (ImageView) constraintLayout.findViewById(R.id.sub_card_icon);
if (textView == null) {
@@ -99,40 +36,83 @@
Log.w("BcSmartspaceCardCombination", "No sub-card image field to update");
return false;
} else {
- BcSmartSpaceUtil.setOnClickListener(
- constraintLayout,
- smartspaceTarget,
- smartspaceAction,
- "BcSmartspaceCardCombination",
- smartspaceEventNotifier,
- bcSmartspaceCardLoggingInfo);
- Drawable iconDrawable =
- BcSmartSpaceUtil.getIconDrawable(smartspaceAction.getIcon(), getContext());
+ BcSmartSpaceUtil.setOnClickListener(constraintLayout, smartspaceTarget, smartspaceAction, smartspaceEventNotifier, "BcSmartspaceCardCombination", bcSmartspaceCardLoggingInfo, 0);
+ Drawable iconDrawable = BcSmartSpaceUtil.getIconDrawable(getContext(), smartspaceAction.getIcon());
boolean z2 = true;
if (iconDrawable == null) {
- imageView.setVisibility(View.GONE);
+ BcSmartspaceTemplateDataUtils.updateVisibility(imageView, 8);
z = false;
} else {
imageView.setImageDrawable(iconDrawable);
- imageView.setVisibility(View.VISIBLE);
+ BcSmartspaceTemplateDataUtils.updateVisibility(imageView, 0);
z = true;
}
CharSequence title = smartspaceAction.getTitle();
if (TextUtils.isEmpty(title)) {
- textView.setVisibility(View.GONE);
+ BcSmartspaceTemplateDataUtils.updateVisibility(textView, 8);
z2 = z;
} else {
textView.setText(title);
- textView.setVisibility(View.VISIBLE);
+ BcSmartspaceTemplateDataUtils.updateVisibility(textView, 0);
}
- constraintLayout.setContentDescription(
- z2 ? smartspaceAction.getContentDescription() : null);
if (z2) {
- constraintLayout.setVisibility(View.VISIBLE);
+ charSequence = smartspaceAction.getContentDescription();
} else {
- constraintLayout.setVisibility(View.GONE);
+ charSequence = null;
+ }
+ constraintLayout.setContentDescription(charSequence);
+ if (z2) {
+ BcSmartspaceTemplateDataUtils.updateVisibility(constraintLayout, 0);
+ } else {
+ BcSmartspaceTemplateDataUtils.updateVisibility(constraintLayout, 8);
}
return z2;
}
}
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final void setTextColor(int i) {
+ }
+
+ public BcSmartspaceCardCombination(Context context, AttributeSet attributeSet) {
+ super(context, attributeSet);
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final void resetUi() {
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mFirstSubCard, 8);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mSecondSubCard, 8);
+ }
+
+ public final void onFinishInflate() {
+ super.onFinishInflate();
+ this.mFirstSubCard = findViewById(R.id.first_sub_card);
+ this.mSecondSubCard = findViewById(R.id.second_sub_card);
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public boolean setSmartspaceActions(SmartspaceTarget smartspaceTarget, BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier, BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
+ SmartspaceAction smartspaceAction;
+ boolean z3;
+ List<SmartspaceAction> actionChips = smartspaceTarget.getActionChips();
+ if (actionChips == null || actionChips.size() < 1 || (smartspaceAction = actionChips.get(0)) == null) {
+ return false;
+ }
+ boolean z = this.mFirstSubCard != null && fillSubCard(this.mFirstSubCard, smartspaceTarget, smartspaceAction, smartspaceEventNotifier, bcSmartspaceCardLoggingInfo);
+ if (actionChips.size() > 1 && actionChips.get(1) != null) {
+ z3 = fillSubCard(this.mSecondSubCard, smartspaceTarget, actionChips.get(1), smartspaceEventNotifier, bcSmartspaceCardLoggingInfo);
+ } else {
+ z3 = true;
+ }
+ if (getLayoutParams() instanceof LinearLayout.LayoutParams) {
+ LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) getLayoutParams();
+ if (actionChips.size() > 1 && actionChips.get(1) != null && z3) {
+ layoutParams.weight = 3.0f;
+ } else {
+ layoutParams.weight = 1.0f;
+ }
+ setLayoutParams(layoutParams);
+ }
+ return z && z3;
+ }
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardCombinationAtStore.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardCombinationAtStore.java
index 993e078..3e2f0fd 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardCombinationAtStore.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardCombinationAtStore.java
@@ -4,14 +4,10 @@
import android.app.smartspace.SmartspaceTarget;
import android.content.Context;
import android.util.AttributeSet;
-
import androidx.constraintlayout.widget.ConstraintLayout;
-
import com.android.systemui.bcsmartspace.R;
import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-
import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
-
import java.util.List;
public class BcSmartspaceCardCombinationAtStore extends BcSmartspaceCardCombination {
@@ -23,37 +19,19 @@
super(context, attributeSet);
}
- @Override
- public boolean setSmartspaceActions(
- SmartspaceTarget smartspaceTarget,
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardCombination, com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final boolean setSmartspaceActions(SmartspaceTarget smartspaceTarget, BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier, BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
SmartspaceAction smartspaceAction;
- List actionChips = smartspaceTarget.getActionChips();
- if (actionChips == null
- || actionChips.isEmpty()
- || (smartspaceAction = (SmartspaceAction) actionChips.get(0)) == null) {
+ List<SmartspaceAction> actionChips = smartspaceTarget.getActionChips();
+ if (actionChips == null || actionChips.isEmpty() || (smartspaceAction = actionChips.get(0)) == null) {
return false;
}
- ConstraintLayout constraintLayout = mFirstSubCard;
- boolean z =
- (constraintLayout instanceof BcSmartspaceCardShoppingList)
- && ((BcSmartspaceCardShoppingList) constraintLayout)
- .setSmartspaceActions(
- smartspaceTarget,
- smartspaceEventNotifier,
- bcSmartspaceCardLoggingInfo);
- ConstraintLayout constraintLayout2 = mSecondSubCard;
- boolean z2 =
- constraintLayout2 != null
- && fillSubCard(
- constraintLayout2,
- smartspaceTarget,
- smartspaceAction,
- smartspaceEventNotifier,
- bcSmartspaceCardLoggingInfo);
+ ConstraintLayout constraintLayout = this.mFirstSubCard;
+ boolean z = (constraintLayout instanceof BcSmartspaceCardShoppingList) && ((BcSmartspaceCardShoppingList) constraintLayout).setSmartspaceActions(smartspaceTarget, smartspaceEventNotifier, bcSmartspaceCardLoggingInfo);
+ ConstraintLayout constraintLayout2 = this.mSecondSubCard;
+ boolean z2 = constraintLayout2 != null && fillSubCard(constraintLayout2, smartspaceTarget, smartspaceAction, smartspaceEventNotifier, bcSmartspaceCardLoggingInfo);
if (z) {
- mFirstSubCard.setBackgroundResource(R.drawable.bg_smartspace_combination_sub_card);
+ this.mFirstSubCard.setBackgroundResource(R.drawable.bg_smartspace_combination_sub_card);
}
return z && z2;
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardDoorbell.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardDoorbell.java
index 4435659..91a9116 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardDoorbell.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardDoorbell.java
@@ -4,7 +4,8 @@
import android.app.smartspace.SmartspaceTarget;
import android.content.ContentResolver;
import android.content.Context;
-import android.content.res.Resources;
+import android.content.res.AssetManager;
+import android.content.res.ColorStateList;
import android.graphics.Bitmap;
import android.graphics.ImageDecoder;
import android.graphics.drawable.AnimationDrawable;
@@ -17,223 +18,233 @@
import android.util.Log;
import android.util.Size;
import android.view.View;
+import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ProgressBar;
-
-import androidx.cardview.widget.CardView;
import androidx.constraintlayout.widget.ConstraintLayout;
-import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.RoundedBitmapDrawable;
import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory;
-
import com.android.launcher3.icons.RoundDrawableWrapper;
import com.android.systemui.bcsmartspace.R;
import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-
import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
-
import java.io.IOException;
import java.io.InputStream;
+import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.List;
-import java.util.Map;
-import java.util.function.Function;
+import java.util.Objects;
import java.util.stream.Collectors;
public class BcSmartspaceCardDoorbell extends BcSmartspaceCardGenericImage {
- private ImageView mLoadingIcon;
- private CardView mLoadingScreenView;
- private ProgressBar mProgressBar;
- private final Map<Uri, DrawableWithUri> mUriToDrawable = new HashMap();
- private int mGifFrameDurationInMs = 200;
+ public int mGifFrameDurationInMs;
+ public ImageView mLoadingIcon;
+ public ViewGroup mLoadingScreenView;
+ public String mPreviousTargetId;
+ public ProgressBar mProgressBar;
+ public final HashMap mUriToDrawable;
public BcSmartspaceCardDoorbell(Context context) {
super(context);
+ this.mUriToDrawable = new HashMap();
+ this.mGifFrameDurationInMs = 200;
}
public BcSmartspaceCardDoorbell(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
+ this.mUriToDrawable = new HashMap();
+ this.mGifFrameDurationInMs = 200;
}
- @Override
- public boolean setSmartspaceActions(
- SmartspaceTarget smartspaceTarget,
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardGenericImage, com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final boolean setSmartspaceActions(SmartspaceTarget smartspaceTarget, BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier, BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
if (!isSysUiContext()) {
return false;
}
SmartspaceAction baseAction = smartspaceTarget.getBaseAction();
- Bundle extras = baseAction == null ? null : baseAction.getExtras();
+ Bundle extras = baseAction != null ? baseAction.getExtras() : null;
List<Uri> imageUris = getImageUris(smartspaceTarget);
if (!imageUris.isEmpty()) {
if (extras != null && extras.containsKey("frameDurationMs")) {
- mGifFrameDurationInMs = extras.getInt("frameDurationMs");
+ this.mGifFrameDurationInMs = extras.getInt("frameDurationMs");
}
+ maybeResetImageView(smartspaceTarget);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mImageView, 0);
loadImageUris(imageUris);
- hideLoadingState(extras);
Log.d("BcSmartspaceCardBell", "imageUri is set");
return true;
} else if (extras != null && extras.containsKey("imageBitmap")) {
- setRoundedBitmapDrawable((Bitmap) extras.get("imageBitmap"));
- hideLoadingState(extras);
- Log.d("BcSmartspaceCardBell", "imageBitmap is set");
+ Bitmap bitmap = (Bitmap) extras.get("imageBitmap");
+ maybeResetImageView(smartspaceTarget);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mImageView, 0);
+ if (bitmap != null) {
+ setRoundedBitmapDrawable(bitmap);
+ Log.d("BcSmartspaceCardBell", "imageBitmap is set");
+ return true;
+ }
return true;
} else if (extras == null || !extras.containsKey("loadingScreenState")) {
return false;
} else {
- int i = extras.getInt("loadingScreenState");
+ int i3 = extras.getInt("loadingScreenState");
String dimensionRatio = BcSmartSpaceUtil.getDimensionRatio(extras);
if (dimensionRatio == null) {
return false;
}
- showLoadingScreen(dimensionRatio, i);
+ maybeResetImageView(smartspaceTarget);
+ showLoadingScreen(dimensionRatio, extras, i3);
return true;
}
}
- private void hideLoadingState(Bundle bundle) {
- if (bundle == null || bundle.getBoolean("hideLoadingScreen")) {
- mLoadingScreenView.setVisibility(View.GONE);
- }
- if (mLoadingScreenView.getVisibility() == 0) {
- mProgressBar.setVisibility(View.GONE);
- mLoadingIcon.setVisibility(View.GONE);
- }
- }
-
- private void showLoadingScreen(String str, int i) {
- ((ConstraintLayout.LayoutParams) mLoadingScreenView.getLayoutParams()).dimensionRatio = str;
- mLoadingScreenView.setVisibility(View.VISIBLE);
- toggleProgressBarAndLoadingIcon(i);
- }
-
- private void toggleProgressBarAndLoadingIcon(int i) {
- if (i == 2) {
- mLoadingIcon.setImageDrawable(
- ContextCompat.getDrawable(getContext(), R.drawable.videocam));
- }
- if (i == 3) {
- mLoadingIcon.setImageDrawable(
- ContextCompat.getDrawable(getContext(), R.drawable.videocam_off));
- }
- boolean z = true;
- int i2 = 0;
- if (i != 1) {
- z = false;
- }
- mProgressBar.setVisibility(z ? View.VISIBLE : View.GONE);
- ImageView imageView = mLoadingIcon;
- if (z) {
- i2 = 8;
- }
- imageView.setVisibility(i2);
- }
-
- private void setRoundedBitmapDrawable(Bitmap bitmap) {
- if (bitmap.getHeight() != 0) {
- int dimension = (int) getResources().getDimension(R.dimen.enhanced_smartspace_height);
- bitmap =
- Bitmap.createScaledBitmap(
- bitmap,
- (int) (dimension * (bitmap.getWidth() / bitmap.getHeight())),
- dimension,
- true);
- }
- RoundedBitmapDrawable create = RoundedBitmapDrawableFactory.create(getResources(), bitmap);
- create.setCornerRadius(
- getResources()
- .getDimension(R.dimen.enhanced_smartspace_secondary_card_corner_radius));
- mImageView.setImageDrawable(create);
- }
-
- private void loadImageUris(List<Uri> list) {
- final ContentResolver contentResolver =
- getContext().getApplicationContext().getContentResolver();
- final int dimensionPixelOffset =
- getResources().getDimensionPixelOffset(R.dimen.enhanced_smartspace_height);
- final float dimension =
- getResources()
- .getDimension(R.dimen.enhanced_smartspace_secondary_card_corner_radius);
- addFramesToAnimatedDrawable(
- (List)
- list.stream()
- .map(
- new Function() {
- @Override
- public final Object apply(Object obj) {
- DrawableWithUri drawableWithUri =
- new DrawableWithUri(
- (Uri) obj,
- contentResolver,
- dimensionPixelOffset,
- dimension);
- new LoadUriTask().execute(drawableWithUri);
- return drawableWithUri;
- }
- })
- .filter(drawableWithUri -> drawableWithUri != null)
- .collect(Collectors.toList()));
- }
-
- private void addFramesToAnimatedDrawable(List<Drawable> list) {
- AnimationDrawable animationDrawable = new AnimationDrawable();
- for (Drawable drawable : list) {
- animationDrawable.addFrame(drawable, mGifFrameDurationInMs);
- }
- mImageView.setImageDrawable(animationDrawable);
- animationDrawable.start();
- }
-
- private List<Uri> getImageUris(SmartspaceTarget smartspaceTarget) {
- return (List<Uri>)
- smartspaceTarget.getIconGrid().stream()
- .filter(
- smartspaceAction ->
- smartspaceAction.getExtras().containsKey("imageUri"))
- .map(smartspaceAction -> smartspaceAction.getExtras().getString("imageUri"))
- .map(uri -> Uri.parse(uri))
- .collect(Collectors.toList());
- }
-
private boolean isSysUiContext() {
return getContext().getPackageName().equals("com.android.systemui");
}
- public static class DrawableWithUri extends RoundDrawableWrapper {
- ContentResolver mContentResolver;
- Drawable mDrawable;
- int mHeightInPx;
- Uri mUri;
+ private List<Uri> getImageUris(SmartspaceTarget smartspaceTarget) {
+ return (List) smartspaceTarget.getIconGrid().stream().filter(action -> {
+ return action.getExtras().containsKey("imageUri");
+ }).map(action2 -> {
+ return action2.getExtras().getString("imageUri");
+ }).map(obj -> {
+ return Uri.parse(obj);
+ }).collect(Collectors.toList());
+ }
- DrawableWithUri(Uri uri, ContentResolver contentResolver, int i, float f) {
- super(new ColorDrawable(0), f);
- mUri = uri;
- mHeightInPx = i;
- mContentResolver = contentResolver;
+ private void loadImageUris(List<Uri> list) {
+ addFramesToAnimatedDrawable((List) list.stream().map(uri -> {
+ return computeImageUri(getContext().getApplicationContext().getContentResolver(), getResources().getDimensionPixelOffset(R.dimen.enhanced_smartspace_height), getResources().getDimension(R.dimen.enhanced_smartspace_secondary_card_corner_radius), new WeakReference(this.mImageView), new WeakReference(this.mLoadingScreenView), uri);
+ }).filter(d -> {
+ return Objects.nonNull(d);
+ }).collect(Collectors.toList()));
+ }
+
+ private void addFramesToAnimatedDrawable(List<Drawable> list) {
+ AnimationDrawable animationDrawable = new AnimationDrawable();
+ for (Drawable drawable : list) {
+ animationDrawable.addFrame(drawable, this.mGifFrameDurationInMs);
+ }
+ this.mImageView.setImageDrawable(animationDrawable);
+ animationDrawable.start();
+ }
+
+ private DrawableWithUri computeImageUri(ContentResolver contentResolver, int i, float f, WeakReference weakReference, WeakReference weakReference2, Uri uri) {
+ return (DrawableWithUri) this.mUriToDrawable.computeIfAbsent(uri, newUri -> {
+ return drawImageUri(contentResolver, i, f, weakReference, weakReference2, (Uri) newUri);
+ });
+ }
+
+ public static DrawableWithUri drawImageUri(ContentResolver contentResolver, int i, float f, WeakReference weakReference, WeakReference weakReference2, Uri uri) {
+ DrawableWithUri drawableWithUri = new DrawableWithUri(f, i, contentResolver, uri, weakReference, weakReference2);
+ new LoadUriTask().execute(drawableWithUri);
+ return drawableWithUri;
+ }
+
+ private void setRoundedBitmapDrawable(Bitmap bm) {
+ if (bm.getHeight() != 0) {
+ int dimension = (int) getResources().getDimension(R.dimen.enhanced_smartspace_height);
+ bm = Bitmap.createScaledBitmap(bm, dimension * (bm.getWidth() / bm.getHeight()), dimension, true);
+ }
+ RoundedBitmapDrawable create = RoundedBitmapDrawableFactory.create(getResources(), bm);
+ create.setCornerRadius(getResources().getDimension(R.dimen.enhanced_smartspace_secondary_card_corner_radius));
+ this.mImageView.setImageDrawable(create);
+ }
+
+ public final void maybeResetImageView(SmartspaceTarget smartspaceTarget) {
+ this.mPreviousTargetId = smartspaceTarget.getSmartspaceTargetId();
+ if (!smartspaceTarget.getSmartspaceTargetId().equals(this.mPreviousTargetId)) {
+ this.mImageView.getLayoutParams().width = -2;
+ this.mImageView.setImageDrawable(null);
+ this.mUriToDrawable.clear();
}
}
- @Override
- public void onFinishInflate() {
+ private void showLoadingScreen(String str, Bundle extras, int i) {
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mImageView, 8);
+ ((ConstraintLayout.LayoutParams) this.mLoadingScreenView.getLayoutParams()).dimensionRatio = str;
+ this.mLoadingScreenView.setBackgroundTintList(ColorStateList.valueOf(getContext().getColor(R.color.smartspace_button_background)));
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mLoadingScreenView, 0);
+ toggleProgressBarAndLoadingIcon(extras, i);
+ }
+
+ private void toggleProgressBarAndLoadingIcon(Bundle extras, int i) {
+ boolean showProgress;
+ int vis;
+ if (extras.containsKey("progressBarWidth")) {
+ this.mProgressBar.getLayoutParams().width = (int) (getContext().getResources().getDisplayMetrics().density * extras.getInt("progressBarWidth"));
+ }
+ if (extras.containsKey("progressBarHeight")) {
+ this.mProgressBar.getLayoutParams().height = (int) (getContext().getResources().getDisplayMetrics().density * extras.getInt("progressBarHeight"));
+ }
+ this.mProgressBar.setIndeterminateTintList(ColorStateList.valueOf(getContext().getColor(R.color.smartspace_button_text)));
+ if (i == 1) {
+ showProgress = true;
+ } else if (i == 4) {
+ showProgress = extras.getBoolean("progressBarVisible", true);
+ } else {
+ showProgress = false;
+ }
+ if (showProgress) {
+ vis = 0;
+ } else {
+ vis = 8;
+ }
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mProgressBar, showProgress ? 0 : 8);
+ if (extras.containsKey("loadingIconWidth")) {
+ this.mLoadingIcon.getLayoutParams().width = (int) (getContext().getResources().getDisplayMetrics().density * extras.getInt("loadingIconWidth"));
+ }
+ if (extras.containsKey("loadingIconHeight")) {
+ this.mLoadingIcon.getLayoutParams().height = (int) (getContext().getResources().getDisplayMetrics().density * extras.getInt("loadingIconHeight"));
+ }
+ if (i == 2) {
+ this.mLoadingIcon.setImageDrawable(getContext().getDrawable(R.drawable.videocam));
+ } else if (i == 3) {
+ this.mLoadingIcon.setImageDrawable(getContext().getDrawable(R.drawable.videocam_off));
+ } else if (i == 4 || extras.containsKey("loadingScreenIcon")) {
+ this.mLoadingIcon.setImageBitmap((Bitmap) extras.get("loadingScreenIcon"));
+ if (extras.getBoolean("tintLoadingIcon", false)) {
+ this.mLoadingIcon.setColorFilter(getContext().getColor(R.color.smartspace_button_text));
+ }
+ }
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mLoadingIcon, vis);
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardGenericImage
+ public final void onFinishInflate() {
super.onFinishInflate();
- mLoadingScreenView = (CardView) findViewById(R.id.loading_screen);
- mProgressBar = (ProgressBar) findViewById(R.id.indeterminateBar);
- mLoadingIcon = (ImageView) findViewById(R.id.loading_screen_icon);
+ this.mLoadingScreenView = (ViewGroup) findViewById(R.id.loading_screen);
+ this.mProgressBar = (ProgressBar) findViewById(R.id.indeterminateBar);
+ this.mLoadingIcon = (ImageView) findViewById(R.id.loading_screen_icon);
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardGenericImage, com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final void resetUi() {
+ super.resetUi();
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mImageView, 8);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mLoadingScreenView, 8);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mProgressBar, 8);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mLoadingIcon, 8);
}
public static Drawable getSampleBitmapDrawable(InputStream inputStream, final int i) {
try {
return ImageDecoder.decodeDrawable(
- ImageDecoder.createSource((Resources) null, inputStream),
+ ImageDecoder.createSource(null, inputStream),
new ImageDecoder.OnHeaderDecodedListener() {
@Override
public final void onHeaderDecoded(
ImageDecoder imageDecoder,
ImageDecoder.ImageInfo imageInfo,
ImageDecoder.Source source) {
+ float f;
imageDecoder.setAllocator(3);
- imageDecoder.setTargetSize((int) (i * getTargetRatio(imageInfo)), i);
+ Size size = imageInfo.getSize();
+ if (size.getHeight() != 0) {
+ f = size.getWidth() / size.getHeight();
+ } else {
+ f = 0.0f;
+ }
+ imageDecoder.setTargetSize((int) (i * f), i);
}
});
} catch (IOException e) {
@@ -242,42 +253,56 @@
}
}
- private static float getTargetRatio(ImageDecoder.ImageInfo imageInfo) {
- Size size = imageInfo.getSize();
- if (size.getHeight() != 0) {
- return size.getWidth() / size.getHeight();
+ public static class DrawableWithUri extends RoundDrawableWrapper {
+ public ContentResolver mContentResolver;
+ public Drawable mDrawable;
+ public int mHeightInPx;
+ public WeakReference<ImageView> mImageViewWeakReference;
+ public WeakReference<View> mLoadingScreenWeakReference;
+ public Uri mUri;
+
+ public DrawableWithUri(float f, int height, ContentResolver contentResolver, Uri uri, WeakReference imageViewWeakReference, WeakReference loadingScreenWeakReference) {
+ super(new ColorDrawable(0), f);
+ this.mUri = uri;
+ this.mHeightInPx = height;
+ this.mContentResolver = contentResolver;
+ this.mImageViewWeakReference = imageViewWeakReference;
+ this.mLoadingScreenWeakReference = loadingScreenWeakReference;
}
- return 0.0f;
}
public static class LoadUriTask extends AsyncTask<DrawableWithUri, Void, DrawableWithUri> {
- private LoadUriTask() {}
-
- public DrawableWithUri doInBackground(DrawableWithUri... drawableWithUriArr) {
+ @Override // android.os.AsyncTask
+ public final DrawableWithUri doInBackground(DrawableWithUri[] drawableWithUriArr) {
if (drawableWithUriArr.length > 0) {
DrawableWithUri drawableWithUri = drawableWithUriArr[0];
try {
- drawableWithUri.mDrawable =
- BcSmartspaceCardDoorbell.getSampleBitmapDrawable(
- drawableWithUri.mContentResolver.openInputStream(
- drawableWithUri.mUri),
- drawableWithUri.mHeightInPx);
+ drawableWithUri.mDrawable = BcSmartspaceCardDoorbell.getSampleBitmapDrawable(drawableWithUri.mContentResolver.openInputStream(drawableWithUri.mUri), drawableWithUri.mHeightInPx);
} catch (Exception e) {
- Log.w(
- "BcSmartspaceCardBell",
- "open uri:" + drawableWithUri.mUri + " got exception:" + e);
+ Log.w("BcSmartspaceCardBell", "open uri:" + drawableWithUri.mUri + " got exception:" + e);
}
return drawableWithUri;
}
return null;
}
- public void onPostExecute(DrawableWithUri drawableWithUri) {
- Drawable drawable;
- if (drawableWithUri == null || (drawable = drawableWithUri.mDrawable) == null) {
- return;
+ @Override // android.os.AsyncTask
+ public final void onPostExecute(DrawableWithUri drawableWithUri) {
+ if (drawableWithUri != null) {
+ if (drawableWithUri.mDrawable != null) {
+ drawableWithUri.setDrawable(drawableWithUri.mDrawable);
+ ImageView imageView = drawableWithUri.mImageViewWeakReference.get();
+ int intrinsicWidth = drawableWithUri.mDrawable.getIntrinsicWidth();
+ if (imageView.getLayoutParams().width != intrinsicWidth) {
+ Log.d("BcSmartspaceCardBell", "imageView requestLayout " + drawableWithUri.mUri);
+ imageView.getLayoutParams().width = intrinsicWidth;
+ imageView.requestLayout();
+ }
+ } else {
+ BcSmartspaceTemplateDataUtils.updateVisibility(drawableWithUri.mImageViewWeakReference.get(), 8);
+ }
+ BcSmartspaceTemplateDataUtils.updateVisibility(drawableWithUri.mLoadingScreenWeakReference.get(), 8);
}
- drawableWithUri.setDrawable(drawable);
}
}
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardFlight.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardFlight.java
index ef8ed64..cded215 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardFlight.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardFlight.java
@@ -7,134 +7,55 @@
import android.os.Bundle;
import android.util.AttributeSet;
import android.util.Log;
-import android.view.View;
import android.widget.ImageView;
-import android.widget.TextView;
-
-import androidx.constraintlayout.widget.ConstraintLayout;
-
import com.android.systemui.bcsmartspace.R;
import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-
import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
public class BcSmartspaceCardFlight extends BcSmartspaceCardSecondary {
- private ConstraintLayout mBoardingPassUI;
- private ImageView mCardPromptLogoView;
- private TextView mCardPromptView;
- private TextView mGateValueView;
- private ImageView mQrCodeView;
- private TextView mSeatValueView;
+ public ImageView mQrCodeView;
public BcSmartspaceCardFlight(Context context) {
super(context);
}
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final void setTextColor(int i) {
+ }
+
public BcSmartspaceCardFlight(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
- @Override
- public boolean setSmartspaceActions(
- SmartspaceTarget smartspaceTarget,
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
- SmartspaceAction baseAction = smartspaceTarget.getBaseAction();
- Bundle extras = baseAction == null ? null : baseAction.getExtras();
- boolean z = true;
- if (extras != null) {
- mBoardingPassUI.setVisibility(View.GONE);
- mCardPromptView.setVisibility(View.GONE);
- mCardPromptLogoView.setVisibility(View.GONE);
- if (extras.containsKey("cardPrompt") || extras.containsKey("cardPromptBitmap")) {
- if (extras.containsKey("cardPrompt")) {
- setCardPrompt(extras.getString("cardPrompt"));
- mCardPromptView.setVisibility(View.VISIBLE);
- }
- if (!extras.containsKey("cardPromptBitmap")) {
- return true;
- }
- setCardPromptLogo((Bitmap) extras.get("cardPromptBitmap"));
- mCardPromptLogoView.setVisibility(View.VISIBLE);
- return true;
- }
- if (extras.containsKey("qrCodeBitmap")) {
- setFlightQrCode((Bitmap) extras.get("qrCodeBitmap"));
- mBoardingPassUI.setVisibility(View.VISIBLE);
- } else {
- z = false;
- }
- if (extras.containsKey("gate")) {
- setFlightGateText(extras.getString("gate"));
- } else {
- setFlightGateText("-");
- }
- if (extras.containsKey("seat")) {
- setFlightSeatText(extras.getString("seat"));
- return z;
- }
- setFlightSeatText("-");
- return z;
- }
- return false;
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final void resetUi() {
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mQrCodeView, 8);
}
- @Override
- protected void onFinishInflate() {
+ public final void onFinishInflate() {
super.onFinishInflate();
- mCardPromptView = (TextView) findViewById(R.id.card_prompt);
- mCardPromptLogoView = (ImageView) findViewById(R.id.card_prompt_logo);
- ConstraintLayout constraintLayout = (ConstraintLayout) findViewById(R.id.boarding_pass_ui);
- mBoardingPassUI = constraintLayout;
- if (constraintLayout != null) {
- mGateValueView = (TextView) constraintLayout.findViewById(R.id.gate_value);
- mSeatValueView = (TextView) mBoardingPassUI.findViewById(R.id.seat_value);
- mQrCodeView = (ImageView) mBoardingPassUI.findViewById(R.id.flight_qr_code);
- }
+ this.mQrCodeView = (ImageView) findViewById(R.id.flight_qr_code);
}
- protected void setCardPrompt(String str) {
- TextView textView = mCardPromptView;
- if (textView == null) {
- Log.w("BcSmartspaceCardFlight", "No card prompt view to update");
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final boolean setSmartspaceActions(SmartspaceTarget smartspaceTarget, BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier, BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
+ Bundle extras;
+ SmartspaceAction baseAction = smartspaceTarget.getBaseAction();
+ if (baseAction == null) {
+ extras = null;
} else {
- textView.setText(str);
+ extras = baseAction.getExtras();
}
- }
-
- protected void setCardPromptLogo(Bitmap bitmap) {
- ImageView imageView = mCardPromptLogoView;
- if (imageView == null) {
- Log.w("BcSmartspaceCardFlight", "No card prompt logo view to update");
- } else {
- imageView.setImageBitmap(bitmap);
+ if (extras == null || !extras.containsKey("qrCodeBitmap")) {
+ return false;
}
- }
-
- void setFlightGateText(CharSequence charSequence) {
- TextView textView = mGateValueView;
- if (textView == null) {
- Log.w("BcSmartspaceCardFlight", "No flight gate value view to update");
- } else {
- textView.setText(charSequence);
- }
- }
-
- void setFlightSeatText(CharSequence charSequence) {
- TextView textView = mSeatValueView;
- if (textView == null) {
- Log.w("BcSmartspaceCardFlight", "No flight seat value view to update");
- } else {
- textView.setText(charSequence);
- }
- }
-
- void setFlightQrCode(Bitmap bitmap) {
- ImageView imageView = mQrCodeView;
- if (imageView == null) {
+ Bitmap bitmap = (Bitmap) extras.get("qrCodeBitmap");
+ if (this.mQrCodeView == null) {
Log.w("BcSmartspaceCardFlight", "No flight QR code view to update");
} else {
- imageView.setImageBitmap(bitmap);
+ this.mQrCodeView.setImageBitmap(bitmap);
}
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mQrCodeView, 0);
+ return true;
}
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardGenericImage.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardGenericImage.java
index 9176054..ddea963 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardGenericImage.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardGenericImage.java
@@ -9,71 +9,71 @@
import android.util.Log;
import android.view.ViewGroup;
import android.widget.ImageView;
-
import androidx.constraintlayout.widget.ConstraintLayout;
-
import com.android.systemui.bcsmartspace.R;
import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-
import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
public class BcSmartspaceCardGenericImage extends BcSmartspaceCardSecondary {
- protected ImageView mImageView;
+ public ImageView mImageView;
public BcSmartspaceCardGenericImage(Context context) {
super(context);
}
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public void setTextColor(int i) {
+ }
+
public BcSmartspaceCardGenericImage(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
- @Override
- public boolean setSmartspaceActions(
- SmartspaceTarget smartspaceTarget,
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
- SmartspaceAction baseAction = smartspaceTarget.getBaseAction();
- Bundle extras = baseAction == null ? null : baseAction.getExtras();
- if (extras == null || !extras.containsKey("imageBitmap")) {
- return false;
- }
- if (extras.containsKey("imageScaleType")) {
- String string = extras.getString("imageScaleType");
- try {
- mImageView.setScaleType(ImageView.ScaleType.valueOf(string));
- } catch (IllegalArgumentException unused) {
- Log.w("SmartspaceGenericImg", "Invalid imageScaleType value: " + string);
- }
- }
- String dimensionRatio = BcSmartSpaceUtil.getDimensionRatio(extras);
- if (dimensionRatio != null) {
- ((ConstraintLayout.LayoutParams) mImageView.getLayoutParams()).dimensionRatio =
- dimensionRatio;
- }
- if (extras.containsKey("imageLayoutWidth")) {
- ((ViewGroup.MarginLayoutParams)
- ((ConstraintLayout.LayoutParams) mImageView.getLayoutParams()))
- .width =
- extras.getInt("imageLayoutWidth");
- }
- if (extras.containsKey("imageLayoutHeight")) {
- ((ViewGroup.MarginLayoutParams)
- ((ConstraintLayout.LayoutParams) mImageView.getLayoutParams()))
- .height =
- extras.getInt("imageLayoutHeight");
- }
- setImageBitmap((Bitmap) extras.get("imageBitmap"));
- return true;
- }
-
- @Override
- public void onFinishInflate() {
- super.onFinishInflate();
- mImageView = (ImageView) findViewById(R.id.image_view);
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public void resetUi() {
+ this.mImageView.setImageBitmap(null);
}
public void setImageBitmap(Bitmap bitmap) {
- mImageView.setImageBitmap(bitmap);
+ this.mImageView.setImageBitmap(bitmap);
+ }
+
+ public void onFinishInflate() {
+ super.onFinishInflate();
+ this.mImageView = (ImageView) findViewById(R.id.image_view);
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public boolean setSmartspaceActions(SmartspaceTarget smartspaceTarget, BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier, BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
+ Bundle extras;
+ SmartspaceAction baseAction = smartspaceTarget.getBaseAction();
+ if (baseAction == null) {
+ extras = null;
+ } else {
+ extras = baseAction.getExtras();
+ }
+ if (extras != null && extras.containsKey("imageBitmap")) {
+ if (extras.containsKey("imageScaleType")) {
+ String string = extras.getString("imageScaleType");
+ try {
+ this.mImageView.setScaleType(ImageView.ScaleType.valueOf(string));
+ } catch (IllegalArgumentException e) {
+ Log.e("SmartspaceGenericImg", "Invalid imageScaleType value: " + string);
+ }
+ }
+ String dimensionRatio = BcSmartSpaceUtil.getDimensionRatio(extras);
+ if (dimensionRatio != null) {
+ ((ConstraintLayout.LayoutParams) this.mImageView.getLayoutParams()).dimensionRatio = dimensionRatio;
+ }
+ if (extras.containsKey("imageLayoutWidth")) {
+ ((ViewGroup.MarginLayoutParams) this.mImageView.getLayoutParams()).width = extras.getInt("imageLayoutWidth");
+ }
+ if (extras.containsKey("imageLayoutHeight")) {
+ ((ViewGroup.MarginLayoutParams) this.mImageView.getLayoutParams()).height = extras.getInt("imageLayoutHeight");
+ }
+ setImageBitmap((Bitmap) extras.get("imageBitmap"));
+ return true;
+ }
+ return false;
}
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardLoyalty.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardLoyalty.java
index c6b70ca..d60a12d 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardLoyalty.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardLoyalty.java
@@ -7,19 +7,16 @@
import android.os.Bundle;
import android.util.AttributeSet;
import android.util.Log;
-import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
-
import com.android.systemui.bcsmartspace.R;
import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-
import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
public class BcSmartspaceCardLoyalty extends BcSmartspaceCardGenericImage {
- private TextView mCardPromptView;
- private ImageView mLoyaltyProgramLogoView;
- private TextView mLoyaltyProgramNameView;
+ public TextView mCardPromptView;
+ public ImageView mLoyaltyProgramLogoView;
+ public TextView mLoyaltyProgramNameView;
public BcSmartspaceCardLoyalty(Context context) {
super(context);
@@ -29,74 +26,82 @@
super(context, attributeSet);
}
- @Override
- public boolean setSmartspaceActions(
- SmartspaceTarget smartspaceTarget,
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
- super.setSmartspaceActions(
- smartspaceTarget, smartspaceEventNotifier, bcSmartspaceCardLoggingInfo);
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardGenericImage, com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final void setTextColor(int i) {
+ this.mLoyaltyProgramNameView.setTextColor(i);
+ this.mCardPromptView.setTextColor(i);
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardGenericImage
+ public final void onFinishInflate() {
+ super.onFinishInflate();
+ this.mLoyaltyProgramLogoView = (ImageView) findViewById(R.id.loyalty_program_logo);
+ this.mLoyaltyProgramNameView = (TextView) findViewById(R.id.loyalty_program_name);
+ this.mCardPromptView = (TextView) findViewById(R.id.card_prompt);
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardGenericImage, com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final void resetUi() {
+ super.resetUi();
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mImageView, 8);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mLoyaltyProgramLogoView, 8);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mLoyaltyProgramNameView, 8);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mCardPromptView, 8);
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardGenericImage
+ public final void setImageBitmap(Bitmap bitmap) {
+ super.setImageBitmap(bitmap);
+ this.mLoyaltyProgramLogoView.setImageBitmap(bitmap);
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardGenericImage, com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final boolean setSmartspaceActions(SmartspaceTarget smartspaceTarget, BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier, BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
+ Bundle extras;
+ super.setSmartspaceActions(smartspaceTarget, smartspaceEventNotifier, bcSmartspaceCardLoggingInfo);
SmartspaceAction baseAction = smartspaceTarget.getBaseAction();
- Bundle extras = baseAction == null ? null : baseAction.getExtras();
- mImageView.setVisibility(View.GONE);
- mLoyaltyProgramLogoView.setVisibility(View.GONE);
- mLoyaltyProgramNameView.setVisibility(View.GONE);
- mCardPromptView.setVisibility(View.GONE);
- if (extras != null) {
- boolean containsKey = extras.containsKey("imageBitmap");
- if (extras.containsKey("cardPrompt")) {
- setCardPrompt(extras.getString("cardPrompt"));
- mCardPromptView.setVisibility(View.VISIBLE);
- if (containsKey) {
- mImageView.setVisibility(View.VISIBLE);
- }
- return true;
- } else if (!extras.containsKey("loyaltyProgramName")) {
- if (containsKey) {
- mLoyaltyProgramLogoView.setVisibility(View.VISIBLE);
- }
- return containsKey;
+ if (baseAction == null) {
+ extras = null;
+ } else {
+ extras = baseAction.getExtras();
+ }
+ if (extras == null) {
+ return false;
+ }
+ boolean containsKey = extras.containsKey("imageBitmap");
+ if (extras.containsKey("cardPrompt")) {
+ String string = extras.getString("cardPrompt");
+ TextView textView = this.mCardPromptView;
+ if (textView == null) {
+ Log.w("BcSmartspaceCardLoyalty", "No card prompt view to update");
} else {
- setLoyaltyProgramName(extras.getString("loyaltyProgramName"));
- mLoyaltyProgramNameView.setVisibility(View.VISIBLE);
- if (containsKey) {
- mLoyaltyProgramLogoView.setVisibility(View.VISIBLE);
- }
+ textView.setText(string);
+ }
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mCardPromptView, 0);
+ if (containsKey) {
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mImageView, 0);
return true;
}
- }
- return false;
- }
-
- @Override
- public void onFinishInflate() {
- super.onFinishInflate();
- mLoyaltyProgramLogoView = (ImageView) findViewById(R.id.loyalty_program_logo);
- mLoyaltyProgramNameView = (TextView) findViewById(R.id.loyalty_program_name);
- mCardPromptView = (TextView) findViewById(R.id.card_prompt);
- }
-
- @Override
- public void setImageBitmap(Bitmap bitmap) {
- super.setImageBitmap(bitmap);
- mLoyaltyProgramLogoView.setImageBitmap(bitmap);
- }
-
- void setCardPrompt(String str) {
- TextView textView = mCardPromptView;
- if (textView == null) {
- Log.w("BcSmartspaceCardLoyalty", "No card prompt view to update");
+ return true;
+ } else if (extras.containsKey("loyaltyProgramName")) {
+ String string2 = extras.getString("loyaltyProgramName");
+ TextView textView2 = this.mLoyaltyProgramNameView;
+ if (textView2 == null) {
+ Log.w("BcSmartspaceCardLoyalty", "No loyalty program name view to update");
+ } else {
+ textView2.setText(string2);
+ }
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mLoyaltyProgramNameView, 0);
+ if (containsKey) {
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mLoyaltyProgramLogoView, 0);
+ return true;
+ }
+ return true;
} else {
- textView.setText(str);
- }
- }
-
- void setLoyaltyProgramName(String str) {
- TextView textView = mLoyaltyProgramNameView;
- if (textView == null) {
- Log.w("BcSmartspaceCardLoyalty", "No loyalty program name view to update");
- } else {
- textView.setText(str);
+ if (containsKey) {
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mLoyaltyProgramLogoView, 0);
+ }
+ return containsKey;
}
}
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardSecondary.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardSecondary.java
index 30b818c..968a55e3 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardSecondary.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardSecondary.java
@@ -3,24 +3,27 @@
import android.app.smartspace.SmartspaceTarget;
import android.content.Context;
import android.util.AttributeSet;
-
import androidx.constraintlayout.widget.ConstraintLayout;
-
import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-
import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
public abstract class BcSmartspaceCardSecondary extends ConstraintLayout {
- public abstract boolean setSmartspaceActions(
- SmartspaceTarget smartspaceTarget,
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo);
+ public String mPrevSmartspaceTargetId;
+
+ public abstract boolean setSmartspaceActions(SmartspaceTarget smartspaceTarget, BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier, BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo);
+
+ public abstract void setTextColor(int i);
public BcSmartspaceCardSecondary(Context context) {
super(context);
+ this.mPrevSmartspaceTargetId = "";
}
public BcSmartspaceCardSecondary(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
+ this.mPrevSmartspaceTargetId = "";
+ }
+
+ public void resetUi() {
}
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardShoppingList.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardShoppingList.java
index 6928a40..71914a27 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardShoppingList.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardShoppingList.java
@@ -7,149 +7,135 @@
import android.os.Bundle;
import android.util.AttributeSet;
import android.util.Log;
-import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
-
import com.android.systemui.bcsmartspace.R;
import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-
import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
-
import java.util.Locale;
public class BcSmartspaceCardShoppingList extends BcSmartspaceCardSecondary {
- private static final int[] LIST_ITEM_TEXT_VIEW_IDS = {
- R.id.list_item_1, R.id.list_item_2, R.id.list_item_3
- };
- private ImageView mCardPromptIconView;
- private TextView mCardPromptView;
- private TextView mEmptyListMessageView;
- private ImageView mListIconView;
+ public static final int[] LIST_ITEM_TEXT_VIEW_IDS = {R.id.list_item_1, R.id.list_item_2, R.id.list_item_3};
+ public ImageView mCardPromptIconView;
+ public TextView mCardPromptView;
+ public TextView mEmptyListMessageView;
+ public ImageView mListIconView;
+ public TextView[] mListItems;
public BcSmartspaceCardShoppingList(Context context) {
super(context);
+ this.mListItems = new TextView[3];
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final void resetUi() {
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mEmptyListMessageView, 8);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mListIconView, 8);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mCardPromptIconView, 8);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mCardPromptView, 8);
+ for (int i = 0; i < 3; i++) {
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mListItems[i], 8);
+ }
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final void setTextColor(int i) {
+ this.mCardPromptView.setTextColor(i);
+ this.mEmptyListMessageView.setTextColor(i);
+ for (int i2 = 0; i2 < 3; i2++) {
+ TextView textView = this.mListItems[i2];
+ if (textView == null) {
+ Log.w("BcSmartspaceCardShoppingList", String.format(Locale.US, "Missing list item view to update at row: %d", Integer.valueOf(i2 + 1)));
+ return;
+ }
+ textView.setTextColor(i);
+ }
}
public BcSmartspaceCardShoppingList(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
+ this.mListItems = new TextView[3];
}
- @Override
- public boolean setSmartspaceActions(
- SmartspaceTarget smartspaceTarget,
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
+ public final void onFinishInflate() {
+ super.onFinishInflate();
+ this.mCardPromptView = (TextView) findViewById(R.id.card_prompt);
+ this.mEmptyListMessageView = (TextView) findViewById(R.id.empty_list_message);
+ this.mCardPromptIconView = (ImageView) findViewById(R.id.card_prompt_icon);
+ this.mListIconView = (ImageView) findViewById(R.id.list_icon);
+ for (int i = 0; i < 3; i++) {
+ this.mListItems[i] = (TextView) findViewById(LIST_ITEM_TEXT_VIEW_IDS[i]);
+ }
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final boolean setSmartspaceActions(SmartspaceTarget smartspaceTarget, BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier, BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
+ Bundle extras;
SmartspaceAction baseAction = smartspaceTarget.getBaseAction();
Bitmap bitmap = null;
- Bundle extras = baseAction == null ? null : baseAction.getExtras();
+ if (baseAction == null) {
+ extras = null;
+ } else {
+ extras = baseAction.getExtras();
+ }
if (extras != null) {
- mEmptyListMessageView.setVisibility(View.GONE);
- mListIconView.setVisibility(View.GONE);
- mCardPromptIconView.setVisibility(View.GONE);
- mCardPromptView.setVisibility(View.GONE);
- for (int i = 0; i < 3; i++) {
- TextView textView = (TextView) findViewById(LIST_ITEM_TEXT_VIEW_IDS[i]);
- if (textView != null) {
- textView.setVisibility(View.GONE);
- }
- }
if (extras.containsKey("appIcon")) {
bitmap = (Bitmap) extras.get("appIcon");
} else if (extras.containsKey("imageBitmap")) {
bitmap = (Bitmap) extras.get("imageBitmap");
}
- setIconBitmap(bitmap);
+ this.mCardPromptIconView.setImageBitmap(bitmap);
+ this.mListIconView.setImageBitmap(bitmap);
if (extras.containsKey("cardPrompt")) {
- setCardPrompt(extras.getString("cardPrompt"));
- mCardPromptView.setVisibility(View.VISIBLE);
+ String string = extras.getString("cardPrompt");
+ TextView textView = this.mCardPromptView;
+ if (textView == null) {
+ Log.w("BcSmartspaceCardShoppingList", "No card prompt view to update");
+ } else {
+ textView.setText(string);
+ }
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mCardPromptView, 0);
if (bitmap != null) {
- mCardPromptIconView.setVisibility(View.VISIBLE);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mCardPromptIconView, 0);
+ return true;
}
return true;
} else if (extras.containsKey("emptyListString")) {
- setEmptyListMessage(extras.getString("emptyListString"));
- mEmptyListMessageView.setVisibility(View.VISIBLE);
- mListIconView.setVisibility(View.VISIBLE);
+ String string2 = extras.getString("emptyListString");
+ TextView textView2 = this.mEmptyListMessageView;
+ if (textView2 == null) {
+ Log.w("BcSmartspaceCardShoppingList", "No empty list message view to update");
+ } else {
+ textView2.setText(string2);
+ }
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mEmptyListMessageView, 0);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mListIconView, 0);
return true;
} else if (extras.containsKey("listItems")) {
String[] stringArray = extras.getStringArray("listItems");
if (stringArray.length == 0) {
return false;
}
- mListIconView.setVisibility(View.VISIBLE);
- setShoppingItems(stringArray, extras.getInt("listSize", -1));
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mListIconView, 0);
+ for (int i = 0; i < 3; i++) {
+ TextView textView3 = this.mListItems[i];
+ if (textView3 == null) {
+ Log.w("BcSmartspaceCardShoppingList", String.format(Locale.US, "Missing list item view to update at row: %d", Integer.valueOf(i + 1)));
+ return true;
+ }
+ if (i < stringArray.length) {
+ BcSmartspaceTemplateDataUtils.updateVisibility(textView3, 0);
+ textView3.setText(stringArray[i]);
+ } else {
+ BcSmartspaceTemplateDataUtils.updateVisibility(textView3, 8);
+ textView3.setText("");
+ }
+ }
return true;
+ } else {
+ return false;
}
}
return false;
}
-
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- mCardPromptView = (TextView) findViewById(R.id.card_prompt);
- mEmptyListMessageView = (TextView) findViewById(R.id.empty_list_message);
- mCardPromptIconView = (ImageView) findViewById(R.id.card_prompt_icon);
- mListIconView = (ImageView) findViewById(R.id.list_icon);
- }
-
- void setIconBitmap(Bitmap bitmap) {
- mCardPromptIconView.setImageBitmap(bitmap);
- mListIconView.setImageBitmap(bitmap);
- }
-
- void setCardPrompt(String str) {
- TextView textView = mCardPromptView;
- if (textView == null) {
- Log.w("BcSmartspaceCardShoppingList", "No card prompt view to update");
- } else {
- textView.setText(str);
- }
- }
-
- void setEmptyListMessage(String str) {
- TextView textView = mEmptyListMessageView;
- if (textView == null) {
- Log.w("BcSmartspaceCardShoppingList", "No empty list message view to update");
- } else {
- textView.setText(str);
- }
- }
-
- void setShoppingItems(String[] strArr, int i) {
- if (strArr == null) {
- Log.w("BcSmartspaceCardShoppingList", "Shopping list items array is null.");
- return;
- }
- int[] iArr = LIST_ITEM_TEXT_VIEW_IDS;
- if (iArr.length < 3) {
- Log.w(
- "BcSmartspaceCardShoppingList",
- String.format(
- Locale.US,
- "Missing %d list item view(s) to update",
- Integer.valueOf(3 - iArr.length)));
- return;
- }
- for (int i2 = 0; i2 < 3; i2++) {
- TextView textView = (TextView) findViewById(LIST_ITEM_TEXT_VIEW_IDS[i2]);
- if (textView == null) {
- Log.w(
- "BcSmartspaceCardShoppingList",
- String.format(
- Locale.US,
- "Missing list item view to update at row: %d",
- Integer.valueOf(i2 + 1)));
- return;
- }
- if (i2 < strArr.length) {
- textView.setVisibility(View.VISIBLE);
- textView.setText(strArr[i2]);
- } else {
- textView.setVisibility(View.GONE);
- textView.setText("");
- }
- }
- }
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardSports.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardSports.java
index 178aae2..70904e1 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardSports.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardSports.java
@@ -9,13 +9,17 @@
import android.util.Log;
import android.widget.ImageView;
import android.widget.TextView;
-
import com.android.systemui.bcsmartspace.R;
import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-
import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
public class BcSmartspaceCardSports extends BcSmartspaceCardSecondary {
+ public ImageView mFirstCompetitorLogo;
+ public TextView mFirstCompetitorScore;
+ public ImageView mSecondCompetitorLogo;
+ public TextView mSecondCompetitorScore;
+ public TextView mSummaryView;
+
public BcSmartspaceCardSports(Context context) {
super(context);
}
@@ -24,82 +28,96 @@
super(context, attributeSet);
}
- @Override
- public boolean setSmartspaceActions(
- SmartspaceTarget smartspaceTarget,
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final void resetUi() {
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mSummaryView, 4);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mFirstCompetitorScore, 4);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mSecondCompetitorScore, 4);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mFirstCompetitorLogo, 4);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mSecondCompetitorLogo, 4);
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final void setTextColor(int i) {
+ this.mSummaryView.setTextColor(i);
+ this.mFirstCompetitorScore.setTextColor(i);
+ this.mSecondCompetitorScore.setTextColor(i);
+ }
+
+ public final void onFinishInflate() {
+ super.onFinishInflate();
+ this.mSummaryView = (TextView) findViewById(R.id.match_time_summary);
+ this.mFirstCompetitorScore = (TextView) findViewById(R.id.first_competitor_score);
+ this.mSecondCompetitorScore = (TextView) findViewById(R.id.second_competitor_score);
+ this.mFirstCompetitorLogo = (ImageView) findViewById(R.id.first_competitor_logo);
+ this.mSecondCompetitorLogo = (ImageView) findViewById(R.id.second_competitor_logo);
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final boolean setSmartspaceActions(SmartspaceTarget smartspaceTarget, BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier, BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
+ Bundle extras;
+ boolean z;
SmartspaceAction baseAction = smartspaceTarget.getBaseAction();
- Bundle extras = baseAction == null ? null : baseAction.getExtras();
- boolean z = false;
- if (extras != null) {
- if (extras.containsKey("matchTimeSummary")) {
- setMatchTimeSummaryText(extras.getString("matchTimeSummary"));
- z = true;
+ if (baseAction == null) {
+ extras = null;
+ } else {
+ extras = baseAction.getExtras();
+ }
+ if (extras == null) {
+ return false;
+ }
+ if (extras.containsKey("matchTimeSummary")) {
+ String string = extras.getString("matchTimeSummary");
+ if (this.mSummaryView == null) {
+ Log.w("BcSmartspaceCardSports", "No match time summary view to update");
+ } else {
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mSummaryView, 0);
+ this.mSummaryView.setText(string);
}
- if (extras.containsKey("firstCompetitorScore")) {
- setFirstCompetitorScore(extras.getString("firstCompetitorScore"));
- z = true;
+ z = true;
+ } else {
+ z = false;
+ }
+ if (extras.containsKey("firstCompetitorScore")) {
+ String string2 = extras.getString("firstCompetitorScore");
+ if (this.mFirstCompetitorScore == null) {
+ Log.w("BcSmartspaceCardSports", "No first competitor logo view to update");
+ } else {
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mFirstCompetitorScore, 0);
+ this.mFirstCompetitorScore.setText(string2);
}
- if (extras.containsKey("secondCompetitorScore")) {
- setSecondCompetitorScore(extras.getString("secondCompetitorScore"));
- z = true;
+ z = true;
+ }
+ if (extras.containsKey("secondCompetitorScore")) {
+ String string3 = extras.getString("secondCompetitorScore");
+ if (this.mSecondCompetitorScore == null) {
+ Log.w("BcSmartspaceCardSports", "No second competitor logo view to update");
+ } else {
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mSecondCompetitorScore, 0);
+ this.mSecondCompetitorScore.setText(string3);
}
- if (extras.containsKey("firstCompetitorLogo")) {
- setFirstCompetitorLogo((Bitmap) extras.get("firstCompetitorLogo"));
- z = true;
+ z = true;
+ }
+ if (extras.containsKey("firstCompetitorLogo")) {
+ Bitmap bitmap = (Bitmap) extras.get("firstCompetitorLogo");
+ if (this.mFirstCompetitorLogo == null) {
+ Log.w("BcSmartspaceCardSports", "No first competitor logo view to update");
+ } else {
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mFirstCompetitorLogo, 0);
+ this.mFirstCompetitorLogo.setImageBitmap(bitmap);
}
- if (!extras.containsKey("secondCompetitorLogo")) {
- return z;
+ z = true;
+ }
+ if (extras.containsKey("secondCompetitorLogo")) {
+ Bitmap bitmap2 = (Bitmap) extras.get("secondCompetitorLogo");
+ if (this.mSecondCompetitorLogo == null) {
+ Log.w("BcSmartspaceCardSports", "No second competitor logo view to update");
+ return true;
}
- setSecondCompetitorLogo((Bitmap) extras.get("secondCompetitorLogo"));
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mSecondCompetitorLogo, 0);
+ this.mSecondCompetitorLogo.setImageBitmap(bitmap2);
return true;
}
- return false;
- }
-
- void setMatchTimeSummaryText(String str) {
- TextView textView = (TextView) findViewById(R.id.match_time_summary);
- if (textView == null) {
- Log.w("BcSmartspaceCardSports", "No match time summary view to update");
- } else {
- textView.setText(str);
- }
- }
-
- void setFirstCompetitorScore(String str) {
- TextView textView = (TextView) findViewById(R.id.first_competitor_score);
- if (textView == null) {
- Log.w("BcSmartspaceCardSports", "No first competitor logo view to update");
- } else {
- textView.setText(str);
- }
- }
-
- void setSecondCompetitorScore(String str) {
- TextView textView = (TextView) findViewById(R.id.second_competitor_score);
- if (textView == null) {
- Log.w("BcSmartspaceCardSports", "No second competitor logo view to update");
- } else {
- textView.setText(str);
- }
- }
-
- void setFirstCompetitorLogo(Bitmap bitmap) {
- ImageView imageView = (ImageView) findViewById(R.id.first_competitor_logo);
- if (imageView == null) {
- Log.w("BcSmartspaceCardSports", "No first competitor logo view to update");
- } else {
- imageView.setImageBitmap(bitmap);
- }
- }
-
- void setSecondCompetitorLogo(Bitmap bitmap) {
- ImageView imageView = (ImageView) findViewById(R.id.second_competitor_logo);
- if (imageView == null) {
- Log.w("BcSmartspaceCardSports", "No second competitor logo view to update");
- } else {
- imageView.setImageBitmap(bitmap);
- }
+ return z;
}
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardWeatherForecast.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardWeatherForecast.java
index 8d7425a..09e339d 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardWeatherForecast.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardWeatherForecast.java
@@ -11,18 +11,18 @@
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
-
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.Constraints;
-
import com.android.systemui.bcsmartspace.R;
import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-
import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
-import java.util.Locale;
-
public class BcSmartspaceCardWeatherForecast extends BcSmartspaceCardSecondary {
+
+ public interface ItemUpdateFunction {
+ void update(View view, int i);
+ }
+
public BcSmartspaceCardWeatherForecast(Context context) {
super(context);
}
@@ -31,210 +31,142 @@
super(context, attributeSet);
}
- @Override
- protected void onFinishInflate() {
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final void setTextColor(int i) {
+ updateFields((view, i2) -> {
+ ((TextView) view).setTextColor(i);
+ }, 4, R.id.temperature_value, "temperature value");
+ updateFields((view2, i22) -> {
+ ((TextView) view2).setTextColor(i);
+ }, 4, R.id.timestamp, "timestamp");
+ }
+
+ public final void onFinishInflate() {
super.onFinishInflate();
- createWeatherForecastColumns();
- }
-
- @Override
- public boolean setSmartspaceActions(
- SmartspaceTarget smartspaceTarget,
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
- SmartspaceAction baseAction = smartspaceTarget.getBaseAction();
- Bundle extras = baseAction == null ? null : baseAction.getExtras();
- boolean z = false;
- if (extras != null) {
- if (extras.containsKey("temperatureValues")) {
- setTemperatureValues(extras.getStringArray("temperatureValues"));
- z = true;
- }
- if (extras.containsKey("weatherIcons")) {
- setWeatherIcons((Bitmap[]) extras.get("weatherIcons"));
- z = true;
- }
- if (!extras.containsKey("timestamps")) {
- return z;
- }
- setTimestamps(extras.getStringArray("timestamps"));
- return true;
- }
- return false;
- }
-
- void setTemperatureValues(String[] strArr) {
- if (strArr == null) {
- Log.w("BcSmartspaceCardWeatherForecast", "Temperature values array is null.");
- } else if (getChildCount() < 4) {
- Log.w(
- "BcSmartspaceCardWeatherForecast",
- String.format(
- Locale.US,
- "Missing %d temperature value view(s) to update.",
- Integer.valueOf(4 - getChildCount())));
- } else {
- if (strArr.length < 4) {
- Log.w(
- "BcSmartspaceCardWeatherForecast",
- String.format(
- Locale.US,
- "Missing %d temperature value(s). Hiding incomplete columns.",
- Integer.valueOf(4 - strArr.length)));
- hideIncompleteColumns(4 - strArr.length);
- }
- int min = Math.min(4, strArr.length);
- for (int i = 0; i < min; i++) {
- TextView textView = (TextView) getChildAt(i).findViewById(R.id.temperature_value);
- if (textView == null) {
- Log.w(
- "BcSmartspaceCardWeatherForecast",
- String.format(
- Locale.US,
- "Missing temperature value view to update at column: %d.",
- Integer.valueOf(i + 1)));
- return;
- }
- textView.setText(strArr[i]);
- }
- }
- }
-
- void setWeatherIcons(Bitmap[] bitmapArr) {
- if (bitmapArr == null) {
- Log.w("BcSmartspaceCardWeatherForecast", "Weather icons array is null.");
- } else if (getChildCount() < 4) {
- Log.w(
- "BcSmartspaceCardWeatherForecast",
- String.format(
- Locale.US,
- "Missing %d weather icon view(s) to update.",
- Integer.valueOf(4 - getChildCount())));
- } else {
- if (bitmapArr.length < 4) {
- Log.w(
- "BcSmartspaceCardWeatherForecast",
- String.format(
- Locale.US,
- "Missing %d weather icon(s). Hiding incomplete columns.",
- Integer.valueOf(4 - bitmapArr.length)));
- hideIncompleteColumns(4 - bitmapArr.length);
- }
- int min = Math.min(4, bitmapArr.length);
- for (int i = 0; i < min; i++) {
- ImageView imageView = (ImageView) getChildAt(i).findViewById(R.id.weather_icon);
- if (imageView == null) {
- Log.w(
- "BcSmartspaceCardWeatherForecast",
- String.format(
- Locale.US,
- "Missing weather logo view to update at column: %d.",
- Integer.valueOf(i + 1)));
- return;
- }
- imageView.setImageBitmap(bitmapArr[i]);
- }
- }
- }
-
- void setTimestamps(String[] strArr) {
- if (strArr == null) {
- Log.w("BcSmartspaceCardWeatherForecast", "Timestamps array is null.");
- } else if (getChildCount() < 4) {
- Log.w(
- "BcSmartspaceCardWeatherForecast",
- String.format(
- Locale.US,
- "Missing %d timestamp view(s) to update.",
- Integer.valueOf(4 - getChildCount())));
- } else {
- if (strArr.length < 4) {
- Log.w(
- "BcSmartspaceCardWeatherForecast",
- String.format(
- Locale.US,
- "Missing %d timestamp(s). Hiding incomplete columns.",
- Integer.valueOf(4 - strArr.length)));
- hideIncompleteColumns(4 - strArr.length);
- }
- int min = Math.min(4, strArr.length);
- for (int i = 0; i < min; i++) {
- TextView textView = (TextView) getChildAt(i).findViewById(R.id.timestamp);
- if (textView == null) {
- Log.w(
- "BcSmartspaceCardWeatherForecast",
- String.format(
- Locale.US,
- "Missing timestamp view to update at column: %d.",
- Integer.valueOf(i + 1)));
- return;
- }
- textView.setText(strArr[i]);
- }
- }
- }
-
- private void createWeatherForecastColumns() {
- View[] viewArr = new ConstraintLayout[4];
+ ConstraintLayout[] constraintLayoutArr = new ConstraintLayout[4];
for (int i = 0; i < 4; i++) {
- ConstraintLayout constraintLayout =
- (ConstraintLayout)
- ViewGroup.inflate(
- getContext(),
- R.layout.smartspace_card_weather_forecast_column,
- null);
- constraintLayout.setId(View.generateViewId());
- viewArr[i] = constraintLayout;
+ ConstraintLayout constraintLayout3 = (ConstraintLayout) ViewGroup.inflate(getContext(), R.layout.smartspace_card_weather_forecast_column, null);
+ constraintLayout3.setId(View.generateViewId());
+ constraintLayoutArr[i] = constraintLayout3;
}
- int i2 = 0;
- while (i2 < 4) {
- Constraints.LayoutParams layoutParams = new Constraints.LayoutParams(-2, 0);
- View view = viewArr[i2];
- ConstraintLayout constraintLayout2 =
- i2 > 0 ? ((ConstraintLayout) viewArr[i2 - 1]) : null;
- ConstraintLayout constraintLayout3 =
- i2 < 3 ? ((ConstraintLayout) viewArr[i2 + 1]) : null;
+ for (int i2 = 0; i2 < 4; i2++) {
+ Constraints.LayoutParams lp = new Constraints.LayoutParams(-2, 0);
+ ConstraintLayout constraintLayout = constraintLayoutArr[i2];
+ ConstraintLayout constraintLayout2 = null;
+ if (i2 > 0) {
+ constraintLayout2 = constraintLayoutArr[i2 - 1];
+ }
+ ConstraintLayout constraintLayout22 = null;
+ if (i2 < 3) {
+ constraintLayout22 = constraintLayoutArr[i2 + 1];
+ }
if (i2 == 0) {
- layoutParams.startToStart = 0;
- layoutParams.horizontalChainStyle = 1;
+ lp.startToStart = 0;
+ lp.horizontalChainStyle = 1;
} else {
- layoutParams.startToEnd = constraintLayout2.getId();
+ lp.startToEnd = constraintLayout2.getId();
}
if (i2 == 3) {
- layoutParams.endToEnd = 0;
+ lp.endToEnd = 0;
} else {
- layoutParams.endToStart = constraintLayout3.getId();
+ lp.endToStart = constraintLayout22.getId();
}
- layoutParams.topToTop = 0;
- layoutParams.bottomToBottom = 0;
- addView(view, layoutParams);
- i2++;
+ lp.topToTop = 0;
+ lp.bottomToBottom = 0;
+ addView(constraintLayout, lp);
}
}
- private void hideIncompleteColumns(int i) {
- int i2 = 1;
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final boolean setSmartspaceActions(SmartspaceTarget smartspaceTarget, BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier, BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
+ Bundle extras;
+ SmartspaceAction baseAction = smartspaceTarget.getBaseAction();
+ if (baseAction == null) {
+ extras = null;
+ } else {
+ extras = baseAction.getExtras();
+ }
+ boolean z = false;
+ if (extras == null) {
+ return false;
+ }
+ if (extras.containsKey("temperatureValues")) {
+ String[] temperatureValues = extras.getStringArray("temperatureValues");
+ if (temperatureValues == null) {
+ Log.w("BcSmartspaceCardWeatherForecast", "Temperature values array is null.");
+ } else {
+ updateFields((view, i) -> {
+ ((TextView) view).setText(temperatureValues[i]);
+ }, temperatureValues.length, R.id.temperature_value, "temperature value");
+ }
+ z = true;
+ }
+ if (extras.containsKey("weatherIcons")) {
+ Bitmap[] weatherIcons = (Bitmap[]) extras.get("weatherIcons");
+ if (weatherIcons == null) {
+ Log.w("BcSmartspaceCardWeatherForecast", "Weather icons array is null.");
+ } else {
+ updateFields((view2, i2) -> {
+ ((ImageView) view2).setImageBitmap(weatherIcons[i2]);
+ }, weatherIcons.length, R.id.weather_icon, "weather icon");
+ }
+ z = true;
+ }
+ if (extras.containsKey("timestamps")) {
+ String[] timestamps = extras.getStringArray("timestamps");
+ if (timestamps == null) {
+ Log.w("BcSmartspaceCardWeatherForecast", "Timestamps array is null.");
+ return true;
+ }
+ updateFields((view3, i3) -> {
+ ((TextView) view3).setText(timestamps[i3]);
+ }, timestamps.length, R.id.timestamp, "timestamp");
+ return true;
+ }
+ return z;
+ }
+
+ public final void updateFields(ItemUpdateFunction itemUpdateFunction, int i, int i2, String str) {
+ int i3;
+ int i4;
if (getChildCount() < 4) {
- Log.w(
- "BcSmartspaceCardWeatherForecast",
- String.format(
- Locale.US,
- "Missing %d columns to update.",
- Integer.valueOf(4 - getChildCount())));
+ Log.w("BcSmartspaceForecast", "Missing %d " + str + " view(s) to update." + (4 - getChildCount()));
return;
}
- int i3 = 3 - i;
- int i4 = 0;
- while (i4 < 4) {
- getChildAt(i4).setVisibility(i4 <= i3 ? View.VISIBLE : View.GONE);
- i4++;
+ if (i < 4) {
+ int i5 = 4 - i;
+ Log.w("BcSmartspaceForecast", "Missing %d " + str + "(s). Hiding incomplete columns." + i5);
+ if (getChildCount() < 4) {
+ Log.w("BcSmartspaceForecast", "Missing %d columns to update." + (4 - getChildCount()));
+ } else {
+ int i6 = 3 - i5;
+ for (int i7 = 0; i7 < 4; i7++) {
+ View childAt = getChildAt(i7);
+ if (i7 <= i6) {
+ i4 = 0;
+ } else {
+ i4 = 8;
+ }
+ int i42 = i4;
+ BcSmartspaceTemplateDataUtils.updateVisibility(childAt, i42);
+ }
+ ConstraintLayout.LayoutParams layoutParams = (ConstraintLayout.LayoutParams) getChildAt(0).getLayoutParams();
+ if (i5 == 0) {
+ i3 = 1;
+ } else {
+ i3 = 0;
+ }
+ layoutParams.horizontalChainStyle = i3;
+ }
}
- ConstraintLayout.LayoutParams layoutParams =
- (ConstraintLayout.LayoutParams)
- ((ConstraintLayout) getChildAt(0)).getLayoutParams();
- if (i != 0) {
- i2 = 0;
+ int min = Math.min(4, i);
+ for (int i8 = 0; i8 < min; i8++) {
+ View findViewById = getChildAt(i8).findViewById(i2);
+ if (findViewById == null) {
+ Log.w("BcSmartspaceForecast", "Missing " + str + " view to update at column: %d." + (i8 + 1));
+ return;
+ }
+ itemUpdateFunction.update(findViewById, i8);
}
- layoutParams.horizontalChainStyle = i2;
}
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceDataProvider.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceDataProvider.java
index 25ed655..bbd13388 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceDataProvider.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceDataProvider.java
@@ -2,108 +2,90 @@
import android.app.smartspace.SmartspaceTarget;
import android.app.smartspace.SmartspaceTargetEvent;
+import android.os.Debug;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-
import com.android.systemui.bcsmartspace.R;
import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
-import java.util.Set;
-import java.util.function.Consumer;
+import java.util.Objects;
-public class BcSmartspaceDataProvider implements BcSmartspaceDataPlugin {
- private final Set<BcSmartspaceDataPlugin.SmartspaceTargetListener> mSmartspaceTargetListeners =
- new HashSet();
- private final List<SmartspaceTarget> mSmartspaceTargets = new ArrayList();
- private Set<View> mViews = new HashSet();
- private Set<View.OnAttachStateChangeListener> mAttachListeners = new HashSet();
- private BcSmartspaceDataPlugin.SmartspaceEventNotifier mEventNotifier = null;
- private View.OnAttachStateChangeListener mStateChangeListener =
- new View.OnAttachStateChangeListener() {
- @Override
- public void onViewAttachedToWindow(View view) {
- mViews.add(view);
- for (View.OnAttachStateChangeListener onAttachStateChangeListener :
- mAttachListeners) {
- onAttachStateChangeListener.onViewAttachedToWindow(view);
- }
- }
+public final class BcSmartspaceDataProvider implements BcSmartspaceDataPlugin {
+ public static final boolean DEBUG = Log.isLoggable("BcSmartspaceDataPlugin", 3);
+ public final HashSet<BcSmartspaceDataPlugin.SmartspaceTargetListener> mSmartspaceTargetListeners = new HashSet<>();
+ public final ArrayList<SmartspaceTarget> mSmartspaceTargets = new ArrayList<>();
+ public HashSet<View> mViews = new HashSet<>();
+ public HashSet<View.OnAttachStateChangeListener> mAttachListeners = new HashSet<>();
+ public BcSmartspaceDataPlugin.SmartspaceEventNotifier mEventNotifier = null;
+ public View.OnAttachStateChangeListener mStateChangeListener = new View.OnAttachStateChangeListener() { // from class: com.google.android.systemui.smartspace.BcSmartspaceDataProvider.1
+ @Override // android.view.View.OnAttachStateChangeListener
+ public void onViewAttachedToWindow(View view) {
+ BcSmartspaceDataProvider.this.mViews.add(view);
+ BcSmartspaceDataProvider.this.mAttachListeners.forEach(listener -> {
+ listener.onViewAttachedToWindow(view);
+ });
+ }
- @Override
- public void onViewDetachedFromWindow(View view) {
- mViews.remove(view);
- view.removeOnAttachStateChangeListener(this);
- for (View.OnAttachStateChangeListener onAttachStateChangeListener :
- mAttachListeners) {
- onAttachStateChangeListener.onViewDetachedFromWindow(view);
- }
- }
- };
+ @Override // android.view.View.OnAttachStateChangeListener
+ public void onViewDetachedFromWindow(View view) {
+ BcSmartspaceDataProvider.this.mViews.remove(view);
+ view.removeOnAttachStateChangeListener(this);
+ BcSmartspaceDataProvider.this.mAttachListeners.forEach(listener -> {
+ listener.onViewDetachedFromWindow(view);
+ });
+ }
+ };
- @Override
- public void registerListener(
- BcSmartspaceDataPlugin.SmartspaceTargetListener smartspaceTargetListener) {
- mSmartspaceTargetListeners.add(smartspaceTargetListener);
- smartspaceTargetListener.onSmartspaceTargetsUpdated(mSmartspaceTargets);
+ public void registerListener(BcSmartspaceDataPlugin.SmartspaceTargetListener listener) {
+ this.mSmartspaceTargetListeners.add(listener);
+ listener.onSmartspaceTargetsUpdated(this.mSmartspaceTargets);
}
- @Override
- public void unregisterListener(
- BcSmartspaceDataPlugin.SmartspaceTargetListener smartspaceTargetListener) {
- mSmartspaceTargetListeners.remove(smartspaceTargetListener);
+ public void unregisterListener(BcSmartspaceDataPlugin.SmartspaceTargetListener listener) {
+ this.mSmartspaceTargetListeners.remove(listener);
}
- @Override
- public void registerSmartspaceEventNotifier(
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier) {
- mEventNotifier = smartspaceEventNotifier;
+ public void registerSmartspaceEventNotifier(BcSmartspaceDataPlugin.SmartspaceEventNotifier notifier) {
+ this.mEventNotifier = notifier;
}
- @Override
- public void notifySmartspaceEvent(SmartspaceTargetEvent smartspaceTargetEvent) {
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier = mEventNotifier;
- if (smartspaceEventNotifier != null) {
- smartspaceEventNotifier.notifySmartspaceEvent(smartspaceTargetEvent);
+ public void notifySmartspaceEvent(SmartspaceTargetEvent event) {
+ if (this.mEventNotifier != null) {
+ this.mEventNotifier.notifySmartspaceEvent(event);
}
}
- @Override
- public BcSmartspaceDataPlugin.SmartspaceView getView(ViewGroup viewGroup) {
- View inflate =
- LayoutInflater.from(viewGroup.getContext())
- .inflate(R.layout.smartspace_enhanced, viewGroup, false);
- inflate.addOnAttachStateChangeListener(mStateChangeListener);
+ public BcSmartspaceDataPlugin.SmartspaceView getView(ViewGroup parent) {
+ View inflate = LayoutInflater.from(parent.getContext()).inflate(R.layout.smartspace_enhanced, parent, false);
+ inflate.addOnAttachStateChangeListener(this.mStateChangeListener);
return (BcSmartspaceDataPlugin.SmartspaceView) inflate;
}
- @Override
- public void addOnAttachStateChangeListener(
- View.OnAttachStateChangeListener onAttachStateChangeListener) {
- mAttachListeners.add(onAttachStateChangeListener);
- for (View view : mViews) {
- onAttachStateChangeListener.onViewAttachedToWindow(view);
- }
+ public void addOnAttachStateChangeListener(View.OnAttachStateChangeListener listener) {
+ this.mAttachListeners.add(listener);
+ HashSet<View> hashSet = this.mViews;
+ Objects.requireNonNull(listener);
+ hashSet.forEach(v -> mStateChangeListener.onViewAttachedToWindow(v));
}
- @Override
- public void onTargetsAvailable(List<SmartspaceTarget> list) {
- mSmartspaceTargets.clear();
- for (SmartspaceTarget smartspaceTarget : list) {
+ public void onTargetsAvailable(List<SmartspaceTarget> targets) {
+ if (DEBUG) {
+ Log.d("BcSmartspaceDataPlugin", this + " onTargetsAvailable called. Callers = " + Debug.getCallers(3));
+ Log.d("BcSmartspaceDataPlugin", " targets.size() = " + targets.size());
+ Log.d("BcSmartspaceDataPlugin", " targets = " + targets);
+ }
+ this.mSmartspaceTargets.clear();
+ for (SmartspaceTarget smartspaceTarget : targets) {
if (smartspaceTarget.getFeatureType() != 15) {
- mSmartspaceTargets.add(smartspaceTarget);
+ this.mSmartspaceTargets.add(smartspaceTarget);
}
}
- mSmartspaceTargetListeners.forEach(
- new Consumer() {
- @Override
- public final void accept(Object obj) {
- ((BcSmartspaceDataPlugin.SmartspaceTargetListener) obj)
- .onSmartspaceTargetsUpdated(mSmartspaceTargets);
- }
- });
+ this.mSmartspaceTargetListeners.forEach(listener -> {
+ listener.onSmartspaceTargetsUpdated(this.mSmartspaceTargets);
+ });
}
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceEvent.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceEvent.java
index 11e673e..c34181a 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceEvent.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceEvent.java
@@ -8,15 +8,15 @@
SMARTSPACE_CARD_SEEN(800),
ENABLED_SMARTSPACE(822),
DISABLED_SMARTSPACE(823);
-
+
private final int mId;
- BcSmartspaceEvent(int i) {
- mId = i;
+ BcSmartspaceEvent(int id) {
+ this.mId = id;
}
- @Override
+ @Override // com.google.android.systemui.smartspace.EventEnum
public int getId() {
- return mId;
+ return this.mId;
}
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceTemplateDataUtils.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceTemplateDataUtils.java
new file mode 100644
index 0000000..f12f01b
--- /dev/null
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceTemplateDataUtils.java
@@ -0,0 +1,91 @@
+package com.google.android.systemui.smartspace;
+
+import android.app.smartspace.SmartspaceUtils;
+import android.app.smartspace.uitemplatedata.Icon;
+import android.app.smartspace.uitemplatedata.Text;
+import android.util.Log;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+import com.android.systemui.bcsmartspace.R;
+
+public final class BcSmartspaceTemplateDataUtils {
+ public static int getSecondaryCardRes(int i) {
+ switch (i) {
+ case 2:
+ return R.layout.smartspace_sub_image_template_card;
+ case 3:
+ return R.layout.smartspace_sub_list_template_card;
+ case 4:
+ return R.layout.smartspace_carousel_template_card;
+ case 5:
+ return R.layout.smartspace_head_to_head_template_card;
+ case 6:
+ return R.layout.smartspace_combined_cards_template_card;
+ case 7:
+ return R.layout.smartspace_sub_card_template_card;
+ default:
+ return 0;
+ }
+ }
+
+ public static void offsetImageViewForIcon(ImageView imageView, DoubleShadowIconDrawable doubleShadowIconDrawable) {
+ if (doubleShadowIconDrawable == null) {
+ imageView.setTranslationX(0.0f);
+ imageView.setTranslationY(0.0f);
+ return;
+ }
+ float f = -doubleShadowIconDrawable.mIconInsetSize;
+ imageView.setTranslationX(f);
+ imageView.setTranslationY(f);
+ }
+
+ public static void offsetTextViewForIcon(TextView textView, DoubleShadowIconDrawable doubleShadowIconDrawable, boolean z) {
+ int i;
+ if (doubleShadowIconDrawable == null) {
+ textView.setTranslationX(0.0f);
+ return;
+ }
+ if (z) {
+ i = 1;
+ } else {
+ i = -1;
+ }
+ textView.setTranslationX(i * doubleShadowIconDrawable.mIconInsetSize);
+ }
+
+ public static void setIcon(ImageView imageView, Icon icon) {
+ if (imageView == null) {
+ Log.w("BcSmartspaceTemplateDataUtils", "Cannot set. The image view is null");
+ return;
+ }
+ if (icon == null) {
+ Log.w("BcSmartspaceTemplateDataUtils", "Cannot set. The given icon is null");
+ updateVisibility(imageView, 8);
+ }
+ imageView.setImageIcon(icon.getIcon());
+ if (icon.getContentDescription() != null) {
+ imageView.setContentDescription(icon.getContentDescription());
+ }
+ }
+
+ public static void setText(TextView textView, Text text) {
+ if (textView == null) {
+ Log.w("BcSmartspaceTemplateDataUtils", "Cannot set. The text view is null");
+ return;
+ }
+ if (SmartspaceUtils.isEmpty(text)) {
+ Log.w("BcSmartspaceTemplateDataUtils", "Cannot set. The given text is empty");
+ updateVisibility(textView, 8);
+ }
+ textView.setText(text.getText());
+ textView.setEllipsize(text.getTruncateAtType());
+ textView.setMaxLines(text.getMaxLines());
+ }
+
+ public static void updateVisibility(View view, int i) {
+ if (view != null && view.getVisibility() != i) {
+ view.setVisibility(i);
+ }
+ }
+}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceView.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceView.java
index d8e0b2b..072d3cc 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceView.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceView.java
@@ -11,6 +11,7 @@
import android.content.Context;
import android.database.ContentObserver;
import android.graphics.drawable.Drawable;
+import android.os.Debug;
import android.os.Handler;
import android.os.Parcelable;
import android.provider.Settings;
@@ -21,17 +22,17 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
-
+import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.viewpager.widget.ViewPager;
-
import com.android.systemui.bcsmartspace.R;
import com.android.systemui.plugins.BcSmartspaceDataPlugin;
import com.android.systemui.plugins.FalsingManager;
-
+import com.google.android.systemui.smartspace.CardPagerAdapter;
import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLogger;
import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggerUtil;
import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
-
+import com.google.android.systemui.smartspace.logging.BcSmartspaceSubcardLoggingInfo;
+import com.google.android.systemui.smartspace.uitemplate.BaseTemplateCard;
import java.time.DateTimeException;
import java.time.Instant;
import java.util.ArrayList;
@@ -40,235 +41,135 @@
import java.util.List;
import java.util.stream.Collectors;
-public class BcSmartspaceView extends FrameLayout
- implements BcSmartspaceDataPlugin.SmartspaceTargetListener,
- BcSmartspaceDataPlugin.SmartspaceView {
- private static ArraySet<String> mLastReceivedTargets = new ArraySet<>();
- private static int sLastSurface = -1;
- private BcSmartspaceDataPlugin mDataProvider;
- private PageIndicator mPageIndicator;
- private List<? extends Parcelable> mPendingTargets;
- private Animator mRunningAnimation;
- private ViewPager mViewPager;
- private boolean mIsAodEnabled = false;
- private int mCardPosition = 0;
- private boolean mAnimateSmartspaceUpdate = false;
- private int mScrollState = 0;
- private final ContentObserver mAodObserver =
- new ContentObserver(new Handler()) {
- @Override
- public void onChange(boolean z) {
- onSettingsChanged();
- }
- };
- private final CardPagerAdapter mAdapter = new CardPagerAdapter(this);
- private final ViewPager.OnPageChangeListener mOnPageChangeListener =
- new ViewPager.OnPageChangeListener() {
- private int mCurrentPosition = -1;
-
- @Override
- public void onPageScrollStateChanged(int i) {
- mScrollState = i;
- if (i != 0 || mPendingTargets == null) {
- return;
- }
- BcSmartspaceView bcSmartspaceView = BcSmartspaceView.this;
- onSmartspaceTargetsUpdated(mPendingTargets);
- mPendingTargets = null;
- }
-
- @Override
- public void onPageScrolled(int i, float f, int i2) {
- if (mPageIndicator != null) {
- mPageIndicator.setPageOffset(i, f);
- }
- }
-
- @Override
- public void onPageSelected(int i) {
- mCardPosition = i;
- BcSmartspaceCard cardAtPosition = mAdapter.getCardAtPosition(mCurrentPosition);
- mCurrentPosition = i;
- SmartspaceTarget targetAtPosition =
- mAdapter.getTargetAtPosition(mCurrentPosition);
- logSmartspaceEvent(
- targetAtPosition,
- mCurrentPosition,
- BcSmartspaceEvent.SMARTSPACE_CARD_SEEN);
- if (mDataProvider == null) {
- Log.w(
- "BcSmartspaceView",
- "Cannot notify target hidden/shown smartspace events: data provider"
- + " null");
- return;
- }
- if (cardAtPosition == null) {
- Log.w(
- "BcSmartspaceView",
- "Cannot notify target hidden smartspace event: hidden card null.");
- } else {
- SmartspaceTarget target = cardAtPosition.getTarget();
- if (target == null) {
- Log.w(
- "BcSmartspaceView",
- "Cannot notify target hidden smartspace event: hidden card"
- + " smartspace target null.");
- } else {
- SmartspaceTargetEvent.Builder builder =
- new SmartspaceTargetEvent.Builder(3);
- builder.setSmartspaceTarget(target);
- SmartspaceAction baseAction = target.getBaseAction();
- if (baseAction != null) {
- builder.setSmartspaceActionId(baseAction.getId());
- }
- mDataProvider.notifySmartspaceEvent(builder.build());
- }
- }
- if (targetAtPosition == null) {
- Log.w(
- "BcSmartspaceView",
- "Cannot notify target shown smartspace event: shown card smartspace"
- + " target null.");
- return;
- }
- SmartspaceTargetEvent.Builder builder2 = new SmartspaceTargetEvent.Builder(2);
- builder2.setSmartspaceTarget(targetAtPosition);
- SmartspaceAction baseAction2 = targetAtPosition.getBaseAction();
- if (baseAction2 != null) {
- builder2.setSmartspaceActionId(baseAction2.getId());
- }
- mDataProvider.notifySmartspaceEvent(builder2.build());
- }
- };
+public class BcSmartspaceView extends FrameLayout implements BcSmartspaceDataPlugin.SmartspaceTargetListener, BcSmartspaceDataPlugin.SmartspaceView {
+ public static final String TAG = "BcSmartspaceView";
+ public static final boolean DEBUG = Log.isLoggable(TAG, 3);
+ public final CardPagerAdapter mAdapter;
+ public boolean mAnimateSmartspaceUpdate;
+ public final ContentObserver mAodObserver;
+ public int mCardPosition;
+ public BcSmartspaceDataPlugin mDataProvider;
+ public boolean mIsAodEnabled;
+ public ArraySet<String> mLastReceivedTargets;
+ public final ViewPager.OnPageChangeListener mOnPageChangeListener;
+ public PageIndicator mPageIndicator;
+ public List<? extends Parcelable> mPendingTargets;
+ public Animator mRunningAnimation;
+ public int mScrollState;
+ public ViewPager mViewPager;
public BcSmartspaceView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
- }
-
- @Override // com.android.systemui.plugins.BcSmartspaceDataPlugin.SmartspaceView
- public final int getCurrentCardTopPadding() {
- BcSmartspaceCard bcSmartspaceCard;
- CardPagerAdapter.ViewHolder viewHolder = mAdapter.getViewHolder().get(mViewPager.getCurrentItem());
- ViewGroup viewGroup = null;
- if (viewHolder == null) {
- bcSmartspaceCard = null;
- } else {
- bcSmartspaceCard = viewHolder.card;
- }
- if (bcSmartspaceCard != null) {
- CardPagerAdapter.ViewHolder viewHolder2 = mAdapter.getViewHolder().get(mViewPager.getCurrentItem());
- if (viewHolder2 != null) {
- viewGroup = viewHolder2.card;
+ this.mLastReceivedTargets = new ArraySet<>();
+ this.mIsAodEnabled = false;
+ this.mCardPosition = 0;
+ this.mAnimateSmartspaceUpdate = false;
+ this.mScrollState = 0;
+ this.mAodObserver = new ContentObserver(new Handler()) { // from class: com.google.android.systemui.smartspace.BcSmartspaceView.1
+ @Override // android.database.ContentObserver
+ public void onChange(boolean z) {
+ BcSmartspaceView.this.onSettingsChanged();
}
- return viewGroup.getPaddingTop();
- }
- return 0;
- }
-
- public void setSelectedPage(int page) {
- mViewPager.setCurrentItem(page, false);
- mPageIndicator.setPageOffset(page, 0.0f);
- }
-
- @Override // com.android.systemui.plugins.BcSmartspaceDataPlugin.SmartspaceView
- public final int getSelectedPage() {
- return mViewPager.getCurrentItem();
- }
-
- @Override // com.android.systemui.plugins.BcSmartspaceDataPlugin.SmartspaceView
- public final void setIsDreaming(boolean z) {
- mAdapter.mIsDreaming = z;
- }
-
- @Override
- public void onVisibilityAggregated(boolean z) {
- super.onVisibilityAggregated(z);
- BcSmartspaceDataPlugin bcSmartspaceDataPlugin = mDataProvider;
- if (bcSmartspaceDataPlugin != null) {
- bcSmartspaceDataPlugin.notifySmartspaceEvent(
- new SmartspaceTargetEvent.Builder(z ? 6 : 7).build());
- }
- }
-
- public void logCurrentDisplayedCardSeen() {
- SmartspaceTarget targetAtPosition = mAdapter.getTargetAtPosition(mCardPosition);
- if (targetAtPosition == null) {
- Log.w("BcSmartspaceView", "Current card is not present in the Adapter; cannot log.");
- } else {
- logSmartspaceEvent(
- targetAtPosition, mCardPosition, BcSmartspaceEvent.SMARTSPACE_CARD_SEEN);
- }
- if (mAdapter.getNextAlarmImage() != null) {
- SmartspaceTarget createUpcomingAlarmTarget =
- BcSmartSpaceUtil.createUpcomingAlarmTarget(
- new ComponentName(getContext(), getClass()), getContext().getUser());
- BcSmartspaceEvent bcSmartspaceEvent = BcSmartspaceEvent.SMARTSPACE_CARD_SEEN;
- logSmartspaceEvent(createUpcomingAlarmTarget, 0, bcSmartspaceEvent);
- SmartspaceTarget holidayAlarmsTarget = mAdapter.getHolidayAlarmsTarget();
- if (TextUtils.isEmpty(BcSmartspaceCard.getHolidayAlarmsText(holidayAlarmsTarget))) {
- return;
+ };
+ this.mAdapter = new CardPagerAdapter(this);
+ this.mOnPageChangeListener = new ViewPager.OnPageChangeListener() { // from class: com.google.android.systemui.smartspace.BcSmartspaceView.2
+ public void onPageScrollStateChanged(int state) {
+ List<? extends Parcelable> list;
+ BcSmartspaceView.this.mScrollState = state;
+ if (state == 0 && (list = BcSmartspaceView.this.mPendingTargets) != null) {
+ BcSmartspaceView.this.onSmartspaceTargetsUpdated(list);
+ }
}
- logSmartspaceEvent(holidayAlarmsTarget, 0, bcSmartspaceEvent);
+
+ public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
+ if (BcSmartspaceView.this.mPageIndicator != null) {
+ BcSmartspaceView.this.mPageIndicator.setPageOffset(position, positionOffset);
+ }
+ }
+
+ public void onPageSelected(int position) {
+ SmartspaceTarget targetAtPosition = BcSmartspaceView.this.mAdapter.getTargetAtPosition(BcSmartspaceView.this.mCardPosition);
+ BcSmartspaceView.this.mCardPosition = position;
+ SmartspaceTarget targetAtPosition2 = BcSmartspaceView.this.mAdapter.getTargetAtPosition(position);
+ BcSmartspaceView.this.logSmartspaceEvent(targetAtPosition2, BcSmartspaceView.this.mCardPosition, BcSmartspaceEvent.SMARTSPACE_CARD_SEEN);
+ if (BcSmartspaceView.this.mDataProvider == null) {
+ Log.w(BcSmartspaceView.TAG, "Cannot notify target hidden/shown smartspace events: data provider null");
+ return;
+ }
+ if (targetAtPosition == null) {
+ Log.w(BcSmartspaceView.TAG, "Cannot notify target hidden smartspace event: previous target is null.");
+ } else {
+ SmartspaceTargetEvent.Builder builder = new SmartspaceTargetEvent.Builder(3);
+ builder.setSmartspaceTarget(targetAtPosition);
+ SmartspaceAction baseAction = targetAtPosition.getBaseAction();
+ if (baseAction != null) {
+ builder.setSmartspaceActionId(baseAction.getId());
+ }
+ BcSmartspaceView.this.mDataProvider.notifySmartspaceEvent(builder.build());
+ }
+ SmartspaceTargetEvent.Builder builder2 = new SmartspaceTargetEvent.Builder(2);
+ builder2.setSmartspaceTarget(targetAtPosition2);
+ SmartspaceAction baseAction2 = targetAtPosition2.getBaseAction();
+ if (baseAction2 != null) {
+ builder2.setSmartspaceActionId(baseAction2.getId());
+ }
+ BcSmartspaceView.this.mDataProvider.notifySmartspaceEvent(builder2.build());
+ }
+ };
+ }
+
+ @Override // android.view.View
+ public void onVisibilityAggregated(boolean isVisible) {
+ super.onVisibilityAggregated(isVisible);
+ if (this.mDataProvider != null) {
+ this.mDataProvider.notifySmartspaceEvent(new SmartspaceTargetEvent.Builder(isVisible ? 6 : 7).build());
}
}
- @Override
+ @Override // android.view.View
protected void onFinishInflate() {
super.onFinishInflate();
- mViewPager = (ViewPager) findViewById(R.id.smartspace_card_pager);
- mPageIndicator = (PageIndicator) findViewById(R.id.smartspace_page_indicator);
+ this.mViewPager = findViewById(R.id.smartspace_card_pager);
+ this.mPageIndicator = (PageIndicator) findViewById(R.id.smartspace_page_indicator);
}
- @Override
+ @Override // android.view.ViewGroup, android.view.View
protected void onAttachedToWindow() {
super.onAttachedToWindow();
- mViewPager.setAdapter(mAdapter);
- mViewPager.addOnPageChangeListener(mOnPageChangeListener);
- mPageIndicator.setNumPages(mAdapter.getCount());
+ this.mViewPager.setAdapter(this.mAdapter);
+ this.mViewPager.addOnPageChangeListener(this.mOnPageChangeListener);
+ this.mPageIndicator.setNumPages(this.mAdapter.getCount());
try {
- getContext()
- .getContentResolver()
- .registerContentObserver(
- Settings.Secure.getUriFor("doze_always_on"), false, mAodObserver, -1);
- mIsAodEnabled = isAodEnabled(getContext());
+ getContext().getContentResolver().registerContentObserver(Settings.Secure.getUriFor("doze_always_on"), false, this.mAodObserver, -1);
+ this.mIsAodEnabled = isAodEnabled(getContext());
} catch (Exception e) {
- Log.w("BcSmartspaceView", "Unable to register Doze Always on content observer.", e);
+ Log.w(TAG, "Unable to register Doze Always on content observer.", e);
}
- BcSmartspaceDataPlugin bcSmartspaceDataPlugin = mDataProvider;
- if (bcSmartspaceDataPlugin != null) {
- registerDataProvider(bcSmartspaceDataPlugin);
+ if (this.mDataProvider != null) {
+ registerDataProvider(this.mDataProvider);
}
}
- @Override
+ @Override // android.view.ViewGroup, android.view.View
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
- getContext().getContentResolver().unregisterContentObserver(mAodObserver);
- BcSmartspaceDataPlugin bcSmartspaceDataPlugin = mDataProvider;
- if (bcSmartspaceDataPlugin != null) {
- bcSmartspaceDataPlugin.unregisterListener(this);
+ getContext().getContentResolver().unregisterContentObserver(this.mAodObserver);
+ if (this.mDataProvider != null) {
+ this.mDataProvider.unregisterListener(this);
}
}
- @Override
+ @Override // android.widget.FrameLayout, android.view.View
protected void onMeasure(int i, int i2) {
int size = View.MeasureSpec.getSize(i2);
- int dimensionPixelSize =
- getContext()
- .getResources()
- .getDimensionPixelSize(R.dimen.enhanced_smartspace_height);
+ int dimensionPixelSize = getContext().getResources().getDimensionPixelSize(R.dimen.enhanced_smartspace_height);
if (size > 0 && size < dimensionPixelSize) {
- float f = size;
- float f2 = dimensionPixelSize;
- float f3 = f / f2;
- super.onMeasure(
- View.MeasureSpec.makeMeasureSpec(
- Math.round(View.MeasureSpec.getSize(i) / f3), 1073741824),
- View.MeasureSpec.makeMeasureSpec(dimensionPixelSize, 1073741824));
+ float f3 = size / dimensionPixelSize;
+ super.onMeasure(View.MeasureSpec.makeMeasureSpec(Math.round(View.MeasureSpec.getSize(i) / f3), 1073741824), View.MeasureSpec.makeMeasureSpec(dimensionPixelSize, 1073741824));
setScaleX(f3);
setScaleY(f3);
setPivotX(0.0f);
- setPivotY(f2 / 2.0f);
+ setPivotY(dimensionPixelSize / 2.0f);
return;
}
super.onMeasure(i, i2);
@@ -277,215 +178,304 @@
resetPivot();
}
- @Override
- public void registerDataProvider(BcSmartspaceDataPlugin bcSmartspaceDataPlugin) {
- mDataProvider = bcSmartspaceDataPlugin;
- bcSmartspaceDataPlugin.registerListener(this);
- mAdapter.setDataProvider(mDataProvider);
+ public void registerDataProvider(BcSmartspaceDataPlugin plugin) {
+ this.mDataProvider = plugin;
+ plugin.registerListener(this);
+ this.mAdapter.setDataProvider(this.mDataProvider);
}
- @Override
public void onSmartspaceTargetsUpdated(List<? extends Parcelable> list) {
int i;
- boolean z = true;
- if (mScrollState != 0 && mAdapter.getCount() > 1) {
- mPendingTargets = list;
+ BaseTemplateCard baseTemplateCard;
+ BcSmartspaceCard bcSmartspaceCard;
+ if (DEBUG) {
+ Log.d(TAG, "@" + Integer.toHexString(hashCode()) + ", onTargetsAvailable called. Callers = " + Debug.getCallers(5));
+ Log.d(TAG, " targets.size() = " + list.size());
+ Log.d(TAG, " targets = " + list);
+ }
+ if (this.mScrollState != 0 && this.mAdapter.getCount() > 1) {
+ this.mPendingTargets = list;
return;
}
- if (getLayoutDirection() != 1) {
- z = false;
- }
- int currentItem = mViewPager.getCurrentItem();
+ this.mPendingTargets = null;
+ boolean z = getLayoutDirection() == 1;
+ int i2 = this.mViewPager.getCurrentItem();
if (z) {
- i = mAdapter.getCount() - currentItem;
- ArrayList arrayList = new ArrayList(list);
+ i = this.mAdapter.getCount() - i2;
+ ArrayList<? extends Parcelable> arrayList = new ArrayList<>(list);
Collections.reverse(arrayList);
list = arrayList;
} else {
- i = currentItem;
+ i = i2;
}
- BcSmartspaceCard cardAtPosition = mAdapter.getCardAtPosition(currentItem);
- mAdapter.setTargets(list);
- int count = mAdapter.getCount();
+ CardPagerAdapter.ViewHolder viewHolder = this.mAdapter.mViewHolders.get(i2);
+ if (viewHolder == null) {
+ baseTemplateCard = null;
+ } else {
+ baseTemplateCard = viewHolder.mCard;
+ }
+ CardPagerAdapter.ViewHolder viewHolder2 = this.mAdapter.mViewHolders.get(i2);
+ if (viewHolder2 == null) {
+ bcSmartspaceCard = null;
+ } else {
+ bcSmartspaceCard = viewHolder2.mLegacyCard;
+ }
+ this.mAdapter.mAODTargets.clear();
+ this.mAdapter.mLockscreenTargets.clear();
+ this.mAdapter.mHasDifferentTargets = false;
+ this.mAdapter.mNextAlarmData.mHolidayAlarmsTarget = null;
+ list.forEach(obj -> {
+ int q;
+ SmartspaceTarget it = (SmartspaceTarget) obj;
+ if (it.getFeatureType() == 34) {
+ this.mAdapter.mNextAlarmData.mHolidayAlarmsTarget = it;
+ return;
+ }
+ if (it.getBaseAction() != null && it.getBaseAction().getExtras() != null) {
+ q = it.getBaseAction().getExtras().getInt("SCREEN_EXTRA", 3);
+ } else {
+ q = 3;
+ }
+ if ((q & 2) != 0) {
+ this.mAdapter.mAODTargets.add(it);
+ }
+ if ((q & 1) != 0) {
+ this.mAdapter.mLockscreenTargets.add(it);
+ }
+ if (q != 3) {
+ this.mAdapter.mHasDifferentTargets = true;
+ }
+ });
+ this.mAdapter.addDefaultDateCardIfEmpty(this.mAdapter.mAODTargets);
+ this.mAdapter.addDefaultDateCardIfEmpty(this.mAdapter.mLockscreenTargets);
+ this.mAdapter.updateTargetVisibility();
+ this.mAdapter.notifyDataSetChanged();
+ int count = this.mAdapter.getCount();
if (z) {
- mViewPager.setCurrentItem(Math.max(0, Math.min(count - 1, count - i)), false);
+ this.mViewPager.setCurrentItem(Math.max(0, Math.min(count - 1, count - i)), false);
}
- PageIndicator pageIndicator = mPageIndicator;
- if (pageIndicator != null) {
- pageIndicator.setNumPages(count);
+ if (this.mPageIndicator != null) {
+ this.mPageIndicator.setNumPages(count);
}
- if (mAnimateSmartspaceUpdate) {
- animateSmartspaceUpdate(cardAtPosition);
+ if (this.mAnimateSmartspaceUpdate) {
+ if (baseTemplateCard != null) {
+ animateSmartspaceUpdate(baseTemplateCard);
+ } else if (bcSmartspaceCard != null) {
+ animateSmartspaceUpdate(bcSmartspaceCard);
+ }
}
- for (int i2 = 0; i2 < count; i2++) {
- SmartspaceTarget targetAtPosition = mAdapter.getTargetAtPosition(i2);
- if (!mLastReceivedTargets.contains(targetAtPosition.getSmartspaceTargetId())) {
- logSmartspaceEvent(
- targetAtPosition, i2, BcSmartspaceEvent.SMARTSPACE_CARD_RECEIVED);
+ for (int i3 = 0; i3 < count; i3++) {
+ SmartspaceTarget targetAtPosition = this.mAdapter.getTargetAtPosition(i3);
+ if (!this.mLastReceivedTargets.contains(targetAtPosition.getSmartspaceTargetId())) {
+ logSmartspaceEvent(targetAtPosition, i3, BcSmartspaceEvent.SMARTSPACE_CARD_RECEIVED);
SmartspaceTargetEvent.Builder builder = new SmartspaceTargetEvent.Builder(8);
builder.setSmartspaceTarget(targetAtPosition);
SmartspaceAction baseAction = targetAtPosition.getBaseAction();
if (baseAction != null) {
builder.setSmartspaceActionId(baseAction.getId());
}
- mDataProvider.notifySmartspaceEvent(builder.build());
+ this.mDataProvider.notifySmartspaceEvent(builder.build());
}
}
- mLastReceivedTargets.clear();
- mLastReceivedTargets.addAll(
- (Collection)
- mAdapter.getTargets().stream()
- .map(smartspaceTarget -> smartspaceTarget.getSmartspaceTargetId())
- .collect(Collectors.toList()));
- mAdapter.notifyDataSetChanged();
+ this.mLastReceivedTargets.clear();
+ this.mLastReceivedTargets.addAll((Collection) this.mAdapter.mSmartspaceTargets.stream().map((v0) -> {
+ return v0.getSmartspaceTargetId();
+ }).collect(Collectors.toList()));
+ this.mAdapter.notifyDataSetChanged();
}
- public void logSmartspaceEvent(
- SmartspaceTarget smartspaceTarget, int i, BcSmartspaceEvent bcSmartspaceEvent) {
+ public void logSmartspaceEvent(SmartspaceTarget smartspaceTarget, int rank, BcSmartspaceEvent bcSmartspaceEvent) {
int i2;
+ BcSmartspaceSubcardLoggingInfo createSubcardLoggingInfo;
if (bcSmartspaceEvent == BcSmartspaceEvent.SMARTSPACE_CARD_RECEIVED) {
try {
- i2 =
- (int)
- Instant.now()
- .minusMillis(smartspaceTarget.getCreationTimeMillis())
- .toEpochMilli();
+ i2 = (int) Instant.now().minusMillis(smartspaceTarget.getCreationTimeMillis()).toEpochMilli();
} catch (ArithmeticException | DateTimeException e) {
- Log.e(
- "BcSmartspaceView",
- "received_latency_millis will be -1 due to exception ",
- e);
+ Log.e(TAG, "received_latency_millis will be -1 due to exception ", e);
i2 = -1;
}
} else {
i2 = 0;
}
- BcSmartspaceCardLoggingInfo build =
- new BcSmartspaceCardLoggingInfo.Builder()
- .setInstanceId(InstanceId.create(smartspaceTarget))
- .setFeatureType(smartspaceTarget.getFeatureType())
- .setDisplaySurface(
- BcSmartSpaceUtil.getLoggingDisplaySurface(
- getContext().getPackageName(), mAdapter.getDozeAmount(), mAdapter.getIsDreaming()))
- .setRank(i)
- .setCardinality(mAdapter.getCount())
- .setReceivedLatency(i2)
- .setSubcardInfo(
- BcSmartspaceCardLoggerUtil.createSubcardLoggingInfo(
- smartspaceTarget))
- .build();
- BcSmartspaceCardLoggerUtil.forcePrimaryFeatureTypeAndInjectWeatherSubcard(
- build, smartspaceTarget, 39);
- BcSmartspaceCardLogger.log(bcSmartspaceEvent, build);
+ BcSmartspaceCardLoggingInfo.Builder builder = new BcSmartspaceCardLoggingInfo.Builder();
+ builder.mInstanceId = InstanceId.create(smartspaceTarget);
+ builder.mFeatureType = smartspaceTarget.getFeatureType();
+ String packageName = getContext().getPackageName();
+ CardPagerAdapter cardPagerAdapter = this.mAdapter;
+ builder.mDisplaySurface = BcSmartSpaceUtil.getLoggingDisplaySurface(packageName, cardPagerAdapter.mIsDreaming, cardPagerAdapter.mDozeAmount);
+ builder.mRank = rank;
+ builder.mCardinality = this.mAdapter.getCount();
+ builder.mReceivedLatency = i2;
+ builder.mUid = BcSmartspaceCardLoggerUtil.getUid(getContext().getPackageManager(), smartspaceTarget);
+ if (smartspaceTarget.getTemplateData() != null) {
+ createSubcardLoggingInfo = BcSmartspaceCardLoggerUtil.createSubcardLoggingInfo(smartspaceTarget.getTemplateData());
+ } else {
+ createSubcardLoggingInfo = BcSmartspaceCardLoggerUtil.createSubcardLoggingInfo(smartspaceTarget);
+ }
+ builder.mSubcardInfo = createSubcardLoggingInfo;
+ BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo = new BcSmartspaceCardLoggingInfo(builder);
+ if (smartspaceTarget.getTemplateData() != null) {
+ BcSmartspaceCardLoggerUtil.tryForcePrimaryFeatureType(bcSmartspaceCardLoggingInfo);
+ } else {
+ BcSmartspaceCardLoggerUtil.tryForcePrimaryFeatureTypeAndInjectWeatherSubcard(bcSmartspaceCardLoggingInfo, smartspaceTarget);
+ }
+ BcSmartspaceCardLogger.log(bcSmartspaceEvent, bcSmartspaceCardLoggingInfo);
}
- private void animateSmartspaceUpdate(final BcSmartspaceCard bcSmartspaceCard) {
- if (bcSmartspaceCard != null
- && mRunningAnimation == null
- && bcSmartspaceCard.getParent() == null) {
- final ViewGroup viewGroup = (ViewGroup) mViewPager.getParent();
- bcSmartspaceCard.measure(
- View.MeasureSpec.makeMeasureSpec(mViewPager.getWidth(), 1073741824),
- View.MeasureSpec.makeMeasureSpec(mViewPager.getHeight(), 1073741824));
- bcSmartspaceCard.layout(
- mViewPager.getLeft(),
- mViewPager.getTop(),
- mViewPager.getRight(),
- mViewPager.getBottom());
+ public void animateSmartspaceUpdate(final ConstraintLayout constraintLayout) {
+ if (this.mRunningAnimation == null && constraintLayout.getParent() == null) {
+ final ViewGroup viewGroup = (ViewGroup) this.mViewPager.getParent();
+ constraintLayout.measure(View.MeasureSpec.makeMeasureSpec(this.mViewPager.getWidth(), 1073741824), View.MeasureSpec.makeMeasureSpec(this.mViewPager.getHeight(), 1073741824));
+ constraintLayout.layout(this.mViewPager.getLeft(), this.mViewPager.getTop(), this.mViewPager.getRight(), this.mViewPager.getBottom());
AnimatorSet animatorSet = new AnimatorSet();
- float dimension =
- getContext()
- .getResources()
- .getDimension(R.dimen.enhanced_smartspace_dismiss_margin);
- animatorSet.play(
- ObjectAnimator.ofFloat(
- bcSmartspaceCard,
- View.TRANSLATION_Y,
- 0.0f,
- (-getHeight()) - dimension));
- animatorSet.play(ObjectAnimator.ofFloat(bcSmartspaceCard, View.ALPHA, 1.0f, 0.0f));
- animatorSet.play(
- ObjectAnimator.ofFloat(
- mViewPager, View.TRANSLATION_Y, getHeight() + dimension, 0.0f));
- animatorSet.addListener(
- new AnimatorListenerAdapter() {
- @Override
- public void onAnimationStart(Animator animator) {
- viewGroup.getOverlay().add(bcSmartspaceCard);
- }
+ float dimension = getContext().getResources().getDimension(R.dimen.enhanced_smartspace_dismiss_margin);
+ animatorSet.play(ObjectAnimator.ofFloat(constraintLayout, View.TRANSLATION_Y, 0.0f, (-getHeight()) - dimension));
+ animatorSet.play(ObjectAnimator.ofFloat(constraintLayout, View.ALPHA, 1.0f, 0.0f));
+ animatorSet.play(ObjectAnimator.ofFloat(this.mViewPager, View.TRANSLATION_Y, getHeight() + dimension, 0.0f));
+ animatorSet.addListener(new AnimatorListenerAdapter() { // from class: com.google.android.systemui.smartspace.BcSmartspaceView.3
+ @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
+ public void onAnimationEnd(Animator animator) {
+ constraintLayout.setTranslationY(0.0f);
+ constraintLayout.setAlpha(1.0f);
+ viewGroup.getOverlay().remove((View) constraintLayout);
+ BcSmartspaceView bcSmartspaceView = BcSmartspaceView.this;
+ bcSmartspaceView.mRunningAnimation = null;
+ bcSmartspaceView.mAnimateSmartspaceUpdate = false;
+ }
- @Override
- public void onAnimationEnd(Animator animator) {
- viewGroup.getOverlay().remove(bcSmartspaceCard);
- mRunningAnimation = null;
- mAnimateSmartspaceUpdate = false;
- }
- });
- mRunningAnimation = animatorSet;
+ @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
+ public void onAnimationStart(Animator animator) {
+ viewGroup.getOverlay().add((View) constraintLayout);
+ }
+ });
+ this.mRunningAnimation = animatorSet;
animatorSet.start();
}
}
- @Override
+ public final int getCurrentCardTopPadding() {
+ BcSmartspaceCard bcSmartspaceCard;
+ BaseTemplateCard baseTemplateCard;
+ CardPagerAdapter.ViewHolder viewHolder = this.mAdapter.mViewHolders.get(this.mViewPager.getCurrentItem());
+ ViewGroup viewGroup = null;
+ if (viewHolder == null) {
+ bcSmartspaceCard = null;
+ } else {
+ bcSmartspaceCard = viewHolder.mLegacyCard;
+ }
+ if (bcSmartspaceCard != null) {
+ CardPagerAdapter.ViewHolder viewHolder2 = this.mAdapter.mViewHolders.get(this.mViewPager.getCurrentItem());
+ if (viewHolder2 != null) {
+ viewGroup = viewHolder2.mLegacyCard;
+ }
+ return viewGroup.getPaddingTop();
+ }
+ CardPagerAdapter.ViewHolder viewHolder3 = this.mAdapter.mViewHolders.get(this.mViewPager.getCurrentItem());
+ if (viewHolder3 == null) {
+ baseTemplateCard = null;
+ } else {
+ baseTemplateCard = viewHolder3.mCard;
+ }
+ if (baseTemplateCard != null) {
+ CardPagerAdapter.ViewHolder viewHolder4 = this.mAdapter.mViewHolders.get(this.mViewPager.getCurrentItem());
+ if (viewHolder4 != null) {
+ viewGroup = viewHolder4.mCard;
+ }
+ return viewGroup.getPaddingTop();
+ }
+ return 0;
+ }
+
+ public int getSelectedPage() {
+ return this.mViewPager.getCurrentItem();
+ }
+
+ public void setSelectedPage(int i) {
+ this.mViewPager.setCurrentItem(i, false);
+ this.mPageIndicator.setPageOffset(i, 0.0f);
+ }
+
public void setPrimaryTextColor(int i) {
- mAdapter.setPrimaryTextColor(i);
- mPageIndicator.setPrimaryColor(i);
+ this.mAdapter.setPrimaryTextColor(i);
+ this.mPageIndicator.setPrimaryColor(i);
}
- @Override
public void setDozeAmount(float f) {
- mPageIndicator.setAlpha(1.0f - f);
- mAdapter.setDozeAmount(f);
- int loggingDisplaySurface =
- BcSmartSpaceUtil.getLoggingDisplaySurface(
- getContext().getPackageName(), mAdapter.getDozeAmount(), mAdapter.getIsDreaming());
- if (loggingDisplaySurface == -1 || loggingDisplaySurface == sLastSurface) {
+ this.mPageIndicator.setAlpha(1.0f - f);
+ ArrayList<SmartspaceTarget> arrayList = this.mAdapter.mSmartspaceTargets;
+ this.mAdapter.setDozeAmount(f);
+ CardPagerAdapter cardPagerAdapter2 = this.mAdapter;
+ if (cardPagerAdapter2.mHasDifferentTargets && cardPagerAdapter2.mSmartspaceTargets != arrayList && cardPagerAdapter2.getCount() > 0) {
+ this.mViewPager.setCurrentItem(0, false);
+ this.mPageIndicator.setPageOffset(0, 0.0f);
+ }
+ this.mPageIndicator.setNumPages(this.mAdapter.getCount());
+ String packageName = getContext().getPackageName();
+ CardPagerAdapter cardPagerAdapter3 = this.mAdapter;
+ int loggingDisplaySurface = BcSmartSpaceUtil.getLoggingDisplaySurface(packageName, cardPagerAdapter3.mIsDreaming, cardPagerAdapter3.mDozeAmount);
+ if (loggingDisplaySurface == -1) {
return;
}
- sLastSurface = loggingDisplaySurface;
- if (loggingDisplaySurface == 3 && !mIsAodEnabled) {
+ if (loggingDisplaySurface == 3 && !this.mIsAodEnabled) {
return;
}
- logCurrentDisplayedCardSeen();
+ if (DEBUG) {
+ Log.d(TAG, "@" + Integer.toHexString(hashCode()) + ", setDozeAmount: Logging SMARTSPACE_CARD_SEEN, currentSurface = " + loggingDisplaySurface);
+ }
+ BcSmartspaceEvent bcSmartspaceEvent = BcSmartspaceEvent.SMARTSPACE_CARD_SEEN;
+ SmartspaceTarget targetAtPosition = this.mAdapter.getTargetAtPosition(this.mCardPosition);
+ if (targetAtPosition == null) {
+ Log.w(TAG, "Current card is not present in the Adapter; cannot log.");
+ } else {
+ logSmartspaceEvent(targetAtPosition, this.mCardPosition, bcSmartspaceEvent);
+ }
+ if (this.mAdapter.mNextAlarmData.mImage != null) {
+ logSmartspaceEvent(new SmartspaceTarget.Builder("upcoming_alarm_card_94510_12684", new ComponentName(getContext(), getClass()), getContext().getUser()).setFeatureType(23).build(), 0, bcSmartspaceEvent);
+ if (!TextUtils.isEmpty(this.mAdapter.mNextAlarmData.getHolidayAlarmText(null))) {
+ logSmartspaceEvent(this.mAdapter.mNextAlarmData.mHolidayAlarmsTarget, 0, bcSmartspaceEvent);
+ }
+ }
}
- @Override
- public void setIntentStarter(BcSmartspaceDataPlugin.IntentStarter intentStarter) {
- BcSmartSpaceUtil.setIntentStarter(intentStarter);
+ public void setIsDreaming(boolean isDreaming) {
+ this.mAdapter.mIsDreaming = isDreaming;
}
- @Override
- public void setFalsingManager(FalsingManager falsingManager) {
- BcSmartSpaceUtil.setFalsingManager(falsingManager);
+ public void setKeyguardBypassEnabled(boolean isEnabled) {
+ this.mAdapter.mKeyguardBypassEnabled = isEnabled;
+ this.mAdapter.updateTargetVisibility();
}
- @Override
public void setDnd(Drawable drawable, String str) {
- mAdapter.setDnd(drawable, str);
+ this.mAdapter.setDnd(drawable, str);
}
- @Override
public void setNextAlarm(Drawable drawable, String str) {
- mAdapter.setNextAlarm(drawable, str);
+ this.mAdapter.setNextAlarm(drawable, str);
}
- @Override
public void setMediaTarget(SmartspaceTarget smartspaceTarget) {
- mAdapter.setMediaTarget(smartspaceTarget);
+ this.mAdapter.setMediaTarget(smartspaceTarget);
}
- @Override
+ @Override // android.view.View
public void setOnLongClickListener(View.OnLongClickListener onLongClickListener) {
- mViewPager.setOnLongClickListener(onLongClickListener);
+ this.mViewPager.setOnLongClickListener(onLongClickListener);
}
- public void onSettingsChanged() {
- mIsAodEnabled = isAodEnabled(getContext());
+ private void onSettingsChanged() {
+ this.mIsAodEnabled = isAodEnabled(getContext());
}
private static boolean isAodEnabled(Context context) {
- return Settings.Secure.getIntForUser(
- context.getContentResolver(), "doze_always_on", 0, context.getUserId())
- == 1;
+ return Settings.Secure.getIntForUser(context.getContentResolver(), "doze_always_on", 0, context.getUserId()) == 1;
+ }
+
+ public void setFalsingManager(FalsingManager falsingManager) {
+ BcSmartSpaceUtil.sFalsingManager = falsingManager;
+ }
+
+ public void setIntentStarter(BcSmartspaceDataPlugin.IntentStarter intentStarter) {
+ BcSmartSpaceUtil.sIntentStarter = intentStarter;
}
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/CardPagerAdapter.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/CardPagerAdapter.java
index 55e1730..d867628 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/CardPagerAdapter.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/CardPagerAdapter.java
@@ -1,353 +1,810 @@
package com.google.android.systemui.smartspace;
+import android.app.smartspace.SmartspaceAction;
import android.app.smartspace.SmartspaceTarget;
-import android.app.smartspace.SmartspaceTargetEvent;
+import android.app.smartspace.SmartspaceUtils;
+import android.app.smartspace.uitemplatedata.BaseTemplateData;
+import android.app.smartspace.uitemplatedata.TapAction;
import android.content.ComponentName;
import android.graphics.drawable.Drawable;
-import android.os.Parcelable;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.util.Log;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-
+import android.widget.ImageView;
+import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.viewpager.widget.PagerAdapter;
-
import com.android.internal.graphics.ColorUtils;
import com.android.launcher3.icons.GraphicsUtils;
import com.android.systemui.bcsmartspace.R;
import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-
import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggerUtil;
import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
-
+import com.google.android.systemui.smartspace.logging.BcSmartspaceSubcardLoggingInfo;
+import com.google.android.systemui.smartspace.uitemplate.BaseTemplateCard;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
-import java.util.function.Consumer;
+import java.util.UUID;
+import java.util.function.IntPredicate;
+import java.util.stream.IntStream;
public class CardPagerAdapter extends PagerAdapter {
- private int mCurrentTextColor;
- private BcSmartspaceDataPlugin mDataProvider;
- private int mPrimaryTextColor;
- private final View mRoot;
- private List<SmartspaceTarget> mSmartspaceTargets = new ArrayList();
- private final List<SmartspaceTarget> mTargetsExcludingMediaAndHolidayAlarms = new ArrayList();
- private final List<SmartspaceTarget> mMediaTargets = new ArrayList();
- private boolean mHasOnlyDefaultDateCard = false;
- private final SparseArray<ViewHolder> mHolders = new SparseArray<>();
+ public static final int MAX_FEATURE_TYPE = 41;
+ public static final int MIN_FEATURE_TYPE = -2;
+ public final View mRoot;
+ public BcSmartspaceDataPlugin mDataProvider;
+ public int mCurrentTextColor;
+ public int mPrimaryTextColor;
+ public ArrayList<SmartspaceTarget> mSmartspaceTargets = new ArrayList<>();
+ public ArrayList<SmartspaceTarget> mAODTargets = new ArrayList<>();
+ public ArrayList<SmartspaceTarget> mLockscreenTargets = new ArrayList<>();
+ public final ArrayList<SmartspaceTarget> mMediaTargets = new ArrayList<>();
+ public final SparseArray<ViewHolder> mViewHolders = new SparseArray<>();
+ public final LazyServerFlagLoader mEnableCardRecycling = new LazyServerFlagLoader("enable_card_recycling");
+ public final LazyServerFlagLoader mEnableReducedCardRecycling = new LazyServerFlagLoader("enable_reduced_card_recycling");
+ public final SparseArray<BaseTemplateCard> mRecycledCards = new SparseArray<>();
+ public final SparseArray<BcSmartspaceCard> mRecycledLegacyCards = new SparseArray<>();
+ public BcNextAlarmData mNextAlarmData = new BcNextAlarmData();
public boolean mIsDreaming = false;
- private float mDozeAmount = 0.0f;
- private int mDozeColor = -1;
- private String mDndDescription = null;
- private Drawable mDndImage = null;
- private String mNextAlarmDescription = null;
- private Drawable mNextAlarmImage = null;
- private SmartspaceTarget mHolidayAlarmsTarget = null;
+ public float mDozeAmount = 0.0f;
+ public float mLastDozeAmount = 0.0f;
+ public int mDozeColor = -1;
+ public String mDndDescription = null;
+ public Drawable mDndImage = null;
+ public boolean mKeyguardBypassEnabled = false;
+ public boolean mHasDifferentTargets = false;
+
+ List<SmartspaceTarget> getTargets() {
+ return this.mSmartspaceTargets;
+ }
public CardPagerAdapter(View view) {
- mRoot = view;
+ this.mRoot = view;
int attrColor = GraphicsUtils.getAttrColor(view.getContext(), 16842806);
- mPrimaryTextColor = attrColor;
- mCurrentTextColor = attrColor;
+ this.mPrimaryTextColor = attrColor;
+ this.mCurrentTextColor = attrColor;
+ }
+
+ public static int getBaseLegacyCardRes(int layout) {
+ return layout != 1 ? R.layout.smartspace_card : R.layout.smartspace_card_date;
+ }
+
+ public static int getLegacySecondaryCardRes(int layout) {
+ if (layout != -2) {
+ if (layout == -1) {
+ return R.layout.smartspace_card_combination;
+ }
+ if (layout == 3) {
+ return R.layout.smartspace_card_generic_landscape_image;
+ }
+ if (layout == 4) {
+ return R.layout.smartspace_card_flight;
+ }
+ if (layout == 9) {
+ return R.layout.smartspace_card_sports;
+ }
+ if (layout == 10) {
+ return R.layout.smartspace_card_weather_forecast;
+ }
+ if (layout == 13) {
+ return R.layout.smartspace_card_shopping_list;
+ }
+ if (layout == 14) {
+ return R.layout.smartspace_card_loyalty;
+ }
+ if (layout == 18) {
+ return R.layout.smartspace_card_generic_landscape_image;
+ }
+ if (layout != 20 && layout != 30) {
+ return 0;
+ }
+ return R.layout.smartspace_card_doorbell;
+ }
+ return R.layout.smartspace_card_combination_at_store;
+ }
+
+ public static boolean useRecycledViewForAction(SmartspaceAction smartspaceAction, SmartspaceAction smartspaceAction2) {
+ if (smartspaceAction == null && smartspaceAction2 == null) {
+ return true;
+ }
+ if (smartspaceAction != null && smartspaceAction2 != null) {
+ Bundle extras = smartspaceAction.getExtras();
+ Bundle extras2 = smartspaceAction2.getExtras();
+ if (extras == null && extras2 == null) {
+ return true;
+ }
+ Bundle extras3 = smartspaceAction.getExtras();
+ Bundle extras4 = smartspaceAction2.getExtras();
+ return (extras3 == null || extras4 == null || !smartspaceAction.getExtras().keySet().equals(smartspaceAction2.getExtras().keySet())) ? false : true;
+ }
+ return false;
+ }
+
+ public static boolean useRecycledViewForActionsList(final List<SmartspaceAction> list, final List<SmartspaceAction> list2) {
+ if (list == null && list2 == null) {
+ return true;
+ }
+ return list != null && list2 != null && list.size() == list2.size() && IntStream.range(0, list.size()).allMatch(new IntPredicate() { // from class: com.google.android.systemui.smartspace.CardPagerAdapter.1
+ @Override // java.util.function.IntPredicate
+ public boolean test(int i) {
+ return CardPagerAdapter.useRecycledViewForAction((SmartspaceAction) list.get(i), (SmartspaceAction) list2.get(i));
+ }
+ });
+ }
+
+ public static boolean useRecycledViewForNewTarget(SmartspaceTarget smartspaceTarget, SmartspaceTarget smartspaceTarget2) {
+ if (smartspaceTarget2 == null || !smartspaceTarget.getSmartspaceTargetId().equals(smartspaceTarget2.getSmartspaceTargetId()) || !useRecycledViewForAction(smartspaceTarget.getHeaderAction(), smartspaceTarget2.getHeaderAction()) || !useRecycledViewForAction(smartspaceTarget.getBaseAction(), smartspaceTarget2.getBaseAction()) || !useRecycledViewForActionsList(smartspaceTarget.getActionChips(), smartspaceTarget2.getActionChips()) || !useRecycledViewForActionsList(smartspaceTarget.getIconGrid(), smartspaceTarget2.getIconGrid())) {
+ return false;
+ }
+ BaseTemplateData templateData = smartspaceTarget.getTemplateData();
+ BaseTemplateData templateData2 = smartspaceTarget2.getTemplateData();
+ return (templateData == null || templateData2 == null || !templateData.equals(templateData2)) ? false : true;
+ }
+
+ public void refreshCards() {
+ for (int i = 0; i < this.mViewHolders.size(); i++) {
+ SparseArray<ViewHolder> sparseArray = this.mViewHolders;
+ ViewHolder viewHolder = sparseArray.get(sparseArray.keyAt(i));
+ if (viewHolder != null) {
+ onBindViewHolder(viewHolder);
+ }
+ }
+ }
+
+ @Override
+ public void destroyItem(ViewGroup viewGroup, int position, Object obj) {
+ ViewHolder viewHolder = (ViewHolder) obj;
+ if (viewHolder == null) {
+ return;
+ }
+ BcSmartspaceCard bcSmartspaceCard = viewHolder.mLegacyCard;
+ if (bcSmartspaceCard != null) {
+ SmartspaceTarget smartspaceTarget = bcSmartspaceCard.mTarget;
+ if (smartspaceTarget != null && this.mEnableCardRecycling.get()) {
+ this.mRecycledLegacyCards.put(getFeatureType(smartspaceTarget), bcSmartspaceCard);
+ }
+ viewGroup.removeView(bcSmartspaceCard);
+ }
+ BaseTemplateCard baseTemplateCard = viewHolder.mCard;
+ if (baseTemplateCard != null) {
+ if (baseTemplateCard.mTarget != null && this.mEnableCardRecycling.get()) {
+ this.mRecycledCards.put(baseTemplateCard.mTarget.getFeatureType(), baseTemplateCard);
+ }
+ viewGroup.removeView(viewHolder.mCard);
+ }
+ if (this.mViewHolders.get(position) == viewHolder) {
+ this.mViewHolders.remove(position);
+ }
}
@Override
public int getCount() {
- return mSmartspaceTargets.size();
- }
-
- @Override
- public boolean isViewFromObject(View view, Object obj) {
- return view == ((ViewHolder) obj).card;
- }
-
- @Override
- public void destroyItem(ViewGroup viewGroup, int i, Object obj) {
- ViewHolder viewHolder = (ViewHolder) obj;
- viewGroup.removeView(viewHolder.card);
- if (mHolders.get(i) == viewHolder) {
- mHolders.remove(i);
- }
- }
-
- public BcSmartspaceCard getCardAtPosition(int i) {
- ViewHolder viewHolder = mHolders.get(i);
- if (viewHolder == null) {
- return null;
- }
- return viewHolder.card;
- }
-
- public SmartspaceTarget getTargetAtPosition(int i) {
- if (mSmartspaceTargets.isEmpty() || i < 0 || i >= mSmartspaceTargets.size()) {
- return null;
- }
- return mSmartspaceTargets.get(i);
- }
-
- public List<SmartspaceTarget> getTargets() {
- return mSmartspaceTargets;
+ return this.mSmartspaceTargets.size();
}
@Override
public int getItemPosition(Object obj) {
ViewHolder viewHolder = (ViewHolder) obj;
- SmartspaceTarget targetAtPosition = getTargetAtPosition(viewHolder.position);
- if (viewHolder.target == targetAtPosition) {
+ SmartspaceTarget targetAtPosition = getTargetAtPosition(viewHolder.mPosition);
+ if (viewHolder.mTarget == targetAtPosition) {
return -1;
}
- if (targetAtPosition == null
- || getFeatureType(targetAtPosition) != getFeatureType(viewHolder.target)
- || !Objects.equals(
- targetAtPosition.getSmartspaceTargetId(),
- viewHolder.target.getSmartspaceTargetId())) {
- return -2;
+ if (targetAtPosition != null && getFeatureType(targetAtPosition) == getFeatureType(viewHolder.mTarget) && Objects.equals(targetAtPosition.getSmartspaceTargetId(), viewHolder.mTarget.getSmartspaceTargetId())) {
+ viewHolder.mTarget = targetAtPosition;
+ onBindViewHolder(viewHolder);
+ return -1;
}
- viewHolder.target = targetAtPosition;
- onBindViewHolder(viewHolder);
- return -1;
+ return -2;
}
- @Override
- public ViewHolder instantiateItem(ViewGroup viewGroup, int i) {
- SmartspaceTarget smartspaceTarget = mSmartspaceTargets.get(i);
- BcSmartspaceCard createBaseCard =
- createBaseCard(viewGroup, getFeatureType(smartspaceTarget));
- ViewHolder viewHolder = new ViewHolder(i, createBaseCard, smartspaceTarget);
+ public SmartspaceTarget getTargetAtPosition(int position) {
+ if (!this.mSmartspaceTargets.isEmpty() && position >= 0 && position < this.mSmartspaceTargets.size()) {
+ return this.mSmartspaceTargets.get(position);
+ }
+ return null;
+ }
+
+ @Override // androidx.viewpager.widget.PagerAdapter
+ public final Object instantiateItem(ViewGroup viewGroup, int i) {
+ BcSmartspaceCard bcSmartspaceCard;
+ ViewHolder viewHolder;
+ BaseTemplateCard baseTemplateCard;
+ BaseTemplateData.SubItemInfo subItemInfo;
+ int i2;
+ int secondaryCardRes;
+ SmartspaceTarget smartspaceTarget = (SmartspaceTarget) this.mSmartspaceTargets.get(i);
+ if (smartspaceTarget.getTemplateData() != null) {
+ Log.i("SsCardPagerAdapter", "Use UI template for the feature: " + smartspaceTarget.getFeatureType());
+ if (this.mEnableCardRecycling.get()) {
+ baseTemplateCard = (BaseTemplateCard) this.mRecycledCards.removeReturnOld(smartspaceTarget.getFeatureType());
+ } else {
+ baseTemplateCard = null;
+ }
+ if (baseTemplateCard == null || (this.mEnableReducedCardRecycling.get() && !useRecycledViewForNewTarget(smartspaceTarget, baseTemplateCard.mTarget))) {
+ BaseTemplateData templateData = smartspaceTarget.getTemplateData();
+ if (templateData != null) {
+ subItemInfo = templateData.getPrimaryItem();
+ } else {
+ subItemInfo = null;
+ }
+ if (subItemInfo != null && (!SmartspaceUtils.isEmpty(subItemInfo.getText()) || subItemInfo.getIcon() != null)) {
+ i2 = R.layout.smartspace_base_template_card;
+ } else {
+ i2 = R.layout.smartspace_base_template_card_with_date;
+ }
+ LayoutInflater from = LayoutInflater.from(viewGroup.getContext());
+ BaseTemplateCard baseTemplateCard2 = (BaseTemplateCard) from.inflate(i2, viewGroup, false);
+ if (templateData != null && (secondaryCardRes = BcSmartspaceTemplateDataUtils.getSecondaryCardRes(templateData.getTemplateType())) != 0) {
+ BcSmartspaceCardSecondary bcSmartspaceCardSecondary = (BcSmartspaceCardSecondary) from.inflate(secondaryCardRes, (ViewGroup) baseTemplateCard2, false);
+ if (bcSmartspaceCardSecondary != null) {
+ Log.i("SsCardPagerAdapter", "Secondary card is found");
+ }
+ ViewGroup viewGroup2 = baseTemplateCard2.mSecondaryCardPane;
+ if (viewGroup2 != null) {
+ baseTemplateCard2.mSecondaryCard = bcSmartspaceCardSecondary;
+ BcSmartspaceTemplateDataUtils.updateVisibility(viewGroup2, 8);
+ baseTemplateCard2.mSecondaryCardPane.removeAllViews();
+ if (bcSmartspaceCardSecondary != null) {
+ ConstraintLayout.LayoutParams layoutParams = new ConstraintLayout.LayoutParams(-2, baseTemplateCard2.getResources().getDimensionPixelSize(R.dimen.enhanced_smartspace_card_height));
+ layoutParams.setMarginStart(baseTemplateCard2.getResources().getDimensionPixelSize(R.dimen.enhanced_smartspace_secondary_card_start_margin));
+ layoutParams.startToStart = 0;
+ layoutParams.topToTop = 0;
+ layoutParams.bottomToBottom = 0;
+ baseTemplateCard2.mSecondaryCardPane.addView(bcSmartspaceCardSecondary, layoutParams);
+ }
+ }
+ }
+ baseTemplateCard = baseTemplateCard2;
+ }
+ viewHolder = new ViewHolder(i, null, smartspaceTarget, baseTemplateCard);
+ viewGroup.addView(baseTemplateCard);
+ } else {
+ if (this.mEnableCardRecycling.get()) {
+ bcSmartspaceCard = (BcSmartspaceCard) this.mRecycledLegacyCards.removeReturnOld(getFeatureType(smartspaceTarget));
+ } else {
+ bcSmartspaceCard = null;
+ }
+ if (bcSmartspaceCard == null || (this.mEnableReducedCardRecycling.get() && !useRecycledViewForNewTarget(smartspaceTarget, bcSmartspaceCard.mTarget))) {
+ int featureType = getFeatureType(smartspaceTarget);
+ LayoutInflater from2 = LayoutInflater.from(viewGroup.getContext());
+ BcSmartspaceCard bcSmartspaceCard2 = (BcSmartspaceCard) from2.inflate(getBaseLegacyCardRes(featureType), viewGroup, false);
+ int legacySecondaryCardRes = getLegacySecondaryCardRes(featureType);
+ if (legacySecondaryCardRes != 0) {
+ BcSmartspaceCardSecondary bcSmartspaceCardSecondary2 = (BcSmartspaceCardSecondary) from2.inflate(legacySecondaryCardRes, (ViewGroup) bcSmartspaceCard2, false);
+ ViewGroup viewGroup3 = bcSmartspaceCard2.mSecondaryCardGroup;
+ if (viewGroup3 != null) {
+ bcSmartspaceCard2.mSecondaryCard = bcSmartspaceCardSecondary2;
+ BcSmartspaceTemplateDataUtils.updateVisibility(viewGroup3, 8);
+ bcSmartspaceCard2.mSecondaryCardGroup.removeAllViews();
+ if (bcSmartspaceCardSecondary2 != null) {
+ ConstraintLayout.LayoutParams layoutParams2 = new ConstraintLayout.LayoutParams(-2, bcSmartspaceCard2.getResources().getDimensionPixelSize(R.dimen.enhanced_smartspace_card_height));
+ layoutParams2.setMarginStart(bcSmartspaceCard2.getResources().getDimensionPixelSize(R.dimen.enhanced_smartspace_secondary_card_start_margin));
+ layoutParams2.startToStart = 0;
+ layoutParams2.topToTop = 0;
+ layoutParams2.bottomToBottom = 0;
+ bcSmartspaceCard2.mSecondaryCardGroup.addView(bcSmartspaceCardSecondary2, layoutParams2);
+ }
+ }
+ }
+ bcSmartspaceCard = bcSmartspaceCard2;
+ }
+ viewHolder = new ViewHolder(i, bcSmartspaceCard, smartspaceTarget, null);
+ viewGroup.addView(bcSmartspaceCard);
+ }
onBindViewHolder(viewHolder);
- viewGroup.addView(createBaseCard);
- mHolders.put(i, viewHolder);
+ this.mViewHolders.put(i, viewHolder);
return viewHolder;
}
- private int getFeatureType(SmartspaceTarget smartspaceTarget) {
- List actionChips = smartspaceTarget.getActionChips();
- int featureType = smartspaceTarget.getFeatureType();
- return (actionChips == null || actionChips.isEmpty())
- ? featureType
- : (featureType == 13 && actionChips.size() == 1) ? -2 : -1;
+ public boolean isViewFromObject(View view, Object obj) {
+ ViewHolder viewHolder = (ViewHolder) obj;
+ return view == viewHolder.mLegacyCard || view == viewHolder.mCard;
}
- private BcSmartspaceCard createBaseCard(ViewGroup viewGroup, int i) {
+ public void onBindViewHolder(ViewHolder viewHolder) {
+ BcSmartspaceSubcardLoggingInfo createSubcardLoggingInfo;
+ BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier;
+ TapAction tapAction;
+ BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo;
+ int i;
+ String uuid;
+ Drawable drawable;
int i2;
int i3;
- if (i == -2) {
- i2 = R.layout.smartspace_card_at_store;
- } else if (i == 1) {
- i2 = R.layout.smartspace_card_date;
- } else if (i == 20) {
- i2 = R.layout.smartspace_base_card_package_delivery;
- } else if (i == 30) {
- i2 = R.layout.smartspace_base_card_doorbell;
+ int i4;
+ BcSmartspaceDataPlugin.SmartspaceEventNotifier eventNotifier;
+ String uuid2;
+ BcNextAlarmData bcNextAlarmData;
+ int i5;
+ int i6;
+ String str;
+ DoubleShadowIconDrawable doubleShadowIconDrawable;
+ int i7;
+ TapAction tapAction2;
+ int i8;
+ SmartspaceTarget smartspaceTarget = this.mSmartspaceTargets.get(viewHolder.mPosition);
+ BcSmartspaceCardLoggingInfo.Builder builder = new BcSmartspaceCardLoggingInfo.Builder();
+ builder.mInstanceId = InstanceId.create(smartspaceTarget);
+ builder.mFeatureType = smartspaceTarget.getFeatureType();
+ builder.mDisplaySurface = BcSmartSpaceUtil.getLoggingDisplaySurface(this.mRoot.getContext().getPackageName(), this.mIsDreaming, this.mDozeAmount);
+ builder.mRank = viewHolder.mPosition;
+ builder.mCardinality = this.mSmartspaceTargets.size();
+ builder.mUid = BcSmartspaceCardLoggerUtil.getUid(this.mRoot.getContext().getPackageManager(), smartspaceTarget);
+ if (smartspaceTarget.getTemplateData() != null) {
+ createSubcardLoggingInfo = BcSmartspaceCardLoggerUtil.createSubcardLoggingInfo(smartspaceTarget.getTemplateData());
} else {
- i2 = R.layout.smartspace_card;
+ createSubcardLoggingInfo = BcSmartspaceCardLoggerUtil.createSubcardLoggingInfo(smartspaceTarget);
}
- LayoutInflater from = LayoutInflater.from(viewGroup.getContext());
- BcSmartspaceCard bcSmartspaceCard = (BcSmartspaceCard) from.inflate(i2, viewGroup, false);
- if (i == -2) {
- i3 = R.layout.smartspace_card_combination_at_store;
- } else if (i == -1) {
- i3 = R.layout.smartspace_card_combination;
- } else {
- if (i != 3) {
- if (i == 4) {
- i3 = R.layout.smartspace_card_flight;
- } else if (i == 9) {
- i3 = R.layout.smartspace_card_sports;
- } else if (i == 10) {
- i3 = R.layout.smartspace_card_weather_forecast;
- } else if (i == 13) {
- i3 = R.layout.smartspace_card_shopping_list;
- } else if (i == 14) {
- i3 = R.layout.smartspace_card_loyalty;
- } else if (i != 18) {
- i3 = (i == 20 || i == 30) ? R.layout.smartspace_card_doorbell : 0;
+ builder.mSubcardInfo = createSubcardLoggingInfo;
+ BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo2 = new BcSmartspaceCardLoggingInfo(builder);
+ if (smartspaceTarget.getTemplateData() != null) {
+ BcSmartspaceCardLoggerUtil.tryForcePrimaryFeatureType(bcSmartspaceCardLoggingInfo2);
+ BaseTemplateCard baseTemplateCard = viewHolder.mCard;
+ if (baseTemplateCard == null) {
+ Log.w("SsCardPagerAdapter", "No ui-template card view can be binded");
+ return;
+ }
+ baseTemplateCard.mIsDreaming = this.mIsDreaming;
+ if (this.mDataProvider == null) {
+ eventNotifier = null;
+ } else {
+ eventNotifier = smartspaceTargetEvent -> {
+ this.mDataProvider.notifySmartspaceEvent(smartspaceTargetEvent);
+ };
+ }
+ BcNextAlarmData bcNextAlarmData2 = this.mNextAlarmData;
+ if (!smartspaceTarget.getSmartspaceTargetId().equals(baseTemplateCard.mPrevSmartspaceTargetId)) {
+ baseTemplateCard.mTarget = null;
+ baseTemplateCard.mTemplateData = null;
+ baseTemplateCard.mFeatureType = 0;
+ baseTemplateCard.mLoggingInfo = null;
+ baseTemplateCard.setOnClickListener(null);
+ baseTemplateCard.resetTextView(baseTemplateCard.mTitleTextView);
+ baseTemplateCard.resetTextView(baseTemplateCard.mSubtitleTextView);
+ baseTemplateCard.resetTextView(baseTemplateCard.mSubtitleSupplementalView);
+ baseTemplateCard.resetTextView(baseTemplateCard.mSupplementalLineTextView);
+ baseTemplateCard.resetTextView(baseTemplateCard.mNextAlarmTextView);
+ ImageView imageView = baseTemplateCard.mNextAlarmImageView;
+ if (imageView != null) {
+ imageView.setImageDrawable(null);
+ }
+ BcSmartspaceTemplateDataUtils.updateVisibility(baseTemplateCard.mTitleTextView, 8);
+ BcSmartspaceTemplateDataUtils.updateVisibility(baseTemplateCard.mSubtitleTextView, 8);
+ BcSmartspaceTemplateDataUtils.updateVisibility(baseTemplateCard.mSubtitleSupplementalView, 8);
+ BcSmartspaceTemplateDataUtils.updateVisibility(baseTemplateCard.mSecondaryCardPane, 8);
+ BcSmartspaceTemplateDataUtils.updateVisibility(baseTemplateCard.mDndImageView, 8);
+ BcSmartspaceTemplateDataUtils.updateVisibility(baseTemplateCard.mNextAlarmImageView, 8);
+ BcSmartspaceTemplateDataUtils.updateVisibility(baseTemplateCard.mNextAlarmTextView, 8);
+ BcSmartspaceTemplateDataUtils.updateVisibility(baseTemplateCard.mExtrasGroup, 4);
+ }
+ baseTemplateCard.mPrevSmartspaceTargetId = smartspaceTarget.getSmartspaceTargetId();
+ baseTemplateCard.mTarget = smartspaceTarget;
+ baseTemplateCard.mTemplateData = smartspaceTarget.getTemplateData();
+ baseTemplateCard.mFeatureType = smartspaceTarget.getFeatureType();
+ baseTemplateCard.mLoggingInfo = bcSmartspaceCardLoggingInfo2;
+ baseTemplateCard.mShouldShowPageIndicator = this.mSmartspaceTargets.size() > 1;
+ baseTemplateCard.mValidSecondaryCard = false;
+ ViewGroup viewGroup = baseTemplateCard.mTextGroup;
+ if (viewGroup != null) {
+ viewGroup.setTranslationX(0.0f);
+ }
+ if (baseTemplateCard.mTemplateData == null) {
+ doubleShadowIconDrawable = null;
+ i6 = 8;
+ } else {
+ BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo3 = baseTemplateCard.mLoggingInfo;
+ if (bcSmartspaceCardLoggingInfo3 == null) {
+ BcSmartspaceCardLoggingInfo.Builder builder2 = new BcSmartspaceCardLoggingInfo.Builder();
+ builder2.mDisplaySurface = BcSmartSpaceUtil.getLoggingDisplaySurface(baseTemplateCard.getContext().getPackageName(), baseTemplateCard.mIsDreaming, baseTemplateCard.mDozeAmount);
+ builder2.mFeatureType = baseTemplateCard.mFeatureType;
+ builder2.mUid = BcSmartspaceCardLoggerUtil.getUid(baseTemplateCard.getContext().getPackageManager(), baseTemplateCard.mTarget);
+ bcSmartspaceCardLoggingInfo3 = new BcSmartspaceCardLoggingInfo(builder2);
+ }
+ baseTemplateCard.mLoggingInfo = bcSmartspaceCardLoggingInfo3;
+ if (baseTemplateCard.mSecondaryCard != null) {
+ Log.i("SsBaseTemplateCard", "Secondary card is not null");
+ BcSmartspaceCardSecondary bcSmartspaceCardSecondary = baseTemplateCard.mSecondaryCard;
+ String smartspaceTargetId = smartspaceTarget.getSmartspaceTargetId();
+ if (!bcSmartspaceCardSecondary.mPrevSmartspaceTargetId.equals(smartspaceTargetId)) {
+ bcSmartspaceCardSecondary.mPrevSmartspaceTargetId = smartspaceTargetId;
+ bcSmartspaceCardSecondary.resetUi();
+ }
+ baseTemplateCard.mValidSecondaryCard = baseTemplateCard.mSecondaryCard.setSmartspaceActions(smartspaceTarget, eventNotifier, baseTemplateCard.mLoggingInfo);
+ }
+ ViewGroup viewGroup2 = baseTemplateCard.mSecondaryCardPane;
+ if (viewGroup2 != null) {
+ if (baseTemplateCard.mDozeAmount != 1.0f && baseTemplateCard.mValidSecondaryCard) {
+ i8 = 0;
+ } else {
+ i8 = 8;
+ }
+ BcSmartspaceTemplateDataUtils.updateVisibility(viewGroup2, i8);
+ }
+ BaseTemplateData.SubItemInfo primaryItem = baseTemplateCard.mTemplateData.getPrimaryItem();
+ if (baseTemplateCard.mDateView == null) {
+ bcNextAlarmData = bcNextAlarmData2;
+ i5 = 8;
+ } else {
+ if (primaryItem != null && primaryItem.getTapAction() != null) {
+ uuid2 = primaryItem.getTapAction().getId().toString();
+ } else {
+ uuid2 = UUID.randomUUID().toString();
+ }
+ TapAction build = new TapAction.Builder(uuid2).setIntent(BcSmartSpaceUtil.getOpenCalendarIntent()).build();
+ bcNextAlarmData = bcNextAlarmData2;
+ i5 = 8;
+ BcSmartSpaceUtil.setOnClickListener(baseTemplateCard, baseTemplateCard.mTarget, build, eventNotifier, "SsBaseTemplateCard", bcSmartspaceCardLoggingInfo2, 0);
+ }
+ baseTemplateCard.setUpTextView(baseTemplateCard.mTitleTextView, baseTemplateCard.mTemplateData.getPrimaryItem(), eventNotifier);
+ baseTemplateCard.setUpTextView(baseTemplateCard.mSubtitleTextView, baseTemplateCard.mTemplateData.getSubtitleItem(), eventNotifier);
+ baseTemplateCard.setUpTextView(baseTemplateCard.mSubtitleSupplementalView, baseTemplateCard.mTemplateData.getSubtitleSupplementalItem(), eventNotifier);
+ BaseTemplateData.SubItemInfo supplementalAlarmItem = baseTemplateCard.mTemplateData.getSupplementalAlarmItem();
+ ImageView imageView2 = baseTemplateCard.mNextAlarmImageView;
+ if (imageView2 != null && baseTemplateCard.mNextAlarmTextView != null) {
+ if (bcNextAlarmData.mImage == null) {
+ BcSmartspaceTemplateDataUtils.updateVisibility(imageView2, i5);
+ BcSmartspaceTemplateDataUtils.updateVisibility(baseTemplateCard.mNextAlarmTextView, i5);
+ BcSmartspaceTemplateDataUtils.offsetImageViewForIcon(baseTemplateCard.mNextAlarmImageView, null);
+ } else {
+ DoubleShadowIconDrawable doubleShadowIconDrawable2 = new DoubleShadowIconDrawable(baseTemplateCard.getContext());
+ doubleShadowIconDrawable2.setIcon(bcNextAlarmData.mImage);
+ baseTemplateCard.mNextAlarmImageView.setImageDrawable(doubleShadowIconDrawable2);
+ BcSmartspaceTemplateDataUtils.offsetImageViewForIcon(baseTemplateCard.mNextAlarmImageView, doubleShadowIconDrawable2);
+ BcSmartspaceTemplateDataUtils.updateVisibility(baseTemplateCard.mNextAlarmImageView, 0);
+ String description = bcNextAlarmData.getDescription(supplementalAlarmItem);
+ baseTemplateCard.mNextAlarmTextView.setContentDescription(baseTemplateCard.getContext().getString(R.string.accessibility_next_alarm, description));
+ baseTemplateCard.mNextAlarmTextView.setText(description);
+ BcSmartspaceTemplateDataUtils.updateVisibility(baseTemplateCard.mNextAlarmTextView, 0);
+ if (supplementalAlarmItem == null) {
+ tapAction2 = null;
+ } else {
+ tapAction2 = supplementalAlarmItem.getTapAction();
+ }
+ bcNextAlarmData.setOnClickListener(baseTemplateCard.mNextAlarmImageView, tapAction2, eventNotifier, BcSmartSpaceUtil.getLoggingDisplaySurface(baseTemplateCard.getContext().getPackageName(), baseTemplateCard.mIsDreaming, baseTemplateCard.mDozeAmount));
+ bcNextAlarmData.setOnClickListener(baseTemplateCard.mNextAlarmTextView, tapAction2, eventNotifier, BcSmartSpaceUtil.getLoggingDisplaySurface(baseTemplateCard.getContext().getPackageName(), baseTemplateCard.mIsDreaming, baseTemplateCard.mDozeAmount));
+ }
+ }
+ baseTemplateCard.setUpTextView(baseTemplateCard.mSupplementalLineTextView, baseTemplateCard.mTemplateData.getSupplementalLineItem(), eventNotifier);
+ baseTemplateCard.updateZenVisibility();
+ if (baseTemplateCard.mTemplateData.getPrimaryItem() != null && baseTemplateCard.mTemplateData.getPrimaryItem().getTapAction() != null) {
+ i6 = i5;
+ str = "SsBaseTemplateCard";
+ i7 = 2;
+ doubleShadowIconDrawable = null;
+ BcSmartSpaceUtil.setOnClickListener(baseTemplateCard, smartspaceTarget, baseTemplateCard.mTemplateData.getPrimaryItem().getTapAction(), eventNotifier, "SsBaseTemplateCard", baseTemplateCard.mLoggingInfo, 0);
+ } else {
+ i6 = i5;
+ str = "SsBaseTemplateCard";
+ doubleShadowIconDrawable = null;
+ i7 = 2;
+ }
+ ViewGroup viewGroup3 = baseTemplateCard.mSecondaryCardPane;
+ if (viewGroup3 == null) {
+ Log.i(str, "Secondary card pane is null");
+ } else {
+ ViewGroup.LayoutParams layoutParams = (ConstraintLayout.LayoutParams) viewGroup3.getLayoutParams();
+ ((ConstraintLayout.LayoutParams) layoutParams).matchConstraintMaxWidth = baseTemplateCard.getWidth() / i7;
+ baseTemplateCard.mSecondaryCardPane.setLayoutParams(layoutParams);
}
}
- i3 = R.layout.smartspace_card_generic_landscape_image;
+ if (baseTemplateCard.mDndImageView != null) {
+ if (this.mDndImage == null) {
+ BcSmartspaceTemplateDataUtils.updateVisibility(baseTemplateCard.mDndImageView, i6);
+ BcSmartspaceTemplateDataUtils.offsetImageViewForIcon(baseTemplateCard.mDndImageView, doubleShadowIconDrawable);
+ } else {
+ DoubleShadowIconDrawable doubleShadowIconDrawable3 = new DoubleShadowIconDrawable(baseTemplateCard.getContext());
+ doubleShadowIconDrawable3.setIcon(this.mDndImage.mutate());
+ baseTemplateCard.mDndImageView.setImageDrawable(doubleShadowIconDrawable3);
+ baseTemplateCard.mDndImageView.setContentDescription(this.mDndDescription);
+ BcSmartspaceTemplateDataUtils.updateVisibility(baseTemplateCard.mDndImageView, 0);
+ BcSmartspaceTemplateDataUtils.offsetImageViewForIcon(baseTemplateCard.mDndImageView, doubleShadowIconDrawable3);
+ }
+ baseTemplateCard.updateZenVisibility();
+ }
+ baseTemplateCard.setPrimaryTextColor(this.mCurrentTextColor);
+ baseTemplateCard.setDozeAmount(this.mDozeAmount);
+ return;
}
- if (i3 != 0) {
- bcSmartspaceCard.setSecondaryCard(
- (BcSmartspaceCardSecondary)
- from.inflate(i3, (ViewGroup) bcSmartspaceCard, false));
+ BcSmartspaceCardLoggerUtil.tryForcePrimaryFeatureTypeAndInjectWeatherSubcard(bcSmartspaceCardLoggingInfo2, smartspaceTarget);
+ BcSmartspaceCard bcSmartspaceCard = viewHolder.mLegacyCard;
+ if (bcSmartspaceCard == null) {
+ Log.w("SsCardPagerAdapter", "No legacy card view can be binded");
+ return;
}
- return bcSmartspaceCard;
- }
-
- private void onBindViewHolder(ViewHolder viewHolder) {
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier;
- SmartspaceTarget smartspaceTarget = mSmartspaceTargets.get(viewHolder.position);
- BcSmartspaceCard bcSmartspaceCard = viewHolder.card;
- BcSmartspaceCardLoggingInfo build =
- new BcSmartspaceCardLoggingInfo.Builder()
- .setInstanceId(InstanceId.create(smartspaceTarget))
- .setFeatureType(smartspaceTarget.getFeatureType())
- .setDisplaySurface(
- BcSmartSpaceUtil.getLoggingDisplaySurface(
- mRoot.getContext().getPackageName(), mDozeAmount, mIsDreaming))
- .setRank(viewHolder.position)
- .setCardinality(mSmartspaceTargets.size())
- .setSubcardInfo(
- BcSmartspaceCardLoggerUtil.createSubcardLoggingInfo(
- smartspaceTarget))
- .build();
- bcSmartspaceCard.mIsDreaming = mIsDreaming;
- final BcSmartspaceDataPlugin bcSmartspaceDataPlugin = mDataProvider;
- if (bcSmartspaceDataPlugin == null) {
+ bcSmartspaceCard.mIsDreaming = this.mIsDreaming;
+ if (this.mDataProvider == null) {
smartspaceEventNotifier = null;
} else {
- smartspaceEventNotifier = (smartspaceTargetEvent) -> {
- bcSmartspaceDataPlugin.notifySmartspaceEvent(smartspaceTargetEvent);
+ smartspaceEventNotifier = smartspaceTargetEvent2 -> {
+ this.mDataProvider.notifySmartspaceEvent(smartspaceTargetEvent2);
};
}
- bcSmartspaceCard.setEventNotifier(smartspaceEventNotifier);
- BcSmartspaceCardLoggerUtil.forcePrimaryFeatureTypeAndInjectWeatherSubcard(
- build, smartspaceTarget, 39);
- boolean z = true;
- if (mSmartspaceTargets.size() <= 1) {
- z = false;
+ String smartspaceTargetId2 = smartspaceTarget.getSmartspaceTargetId();
+ if (!bcSmartspaceCard.mPrevSmartspaceTargetId.equals(smartspaceTargetId2)) {
+ bcSmartspaceCard.mPrevSmartspaceTargetId = smartspaceTargetId2;
+ bcSmartspaceCard.mEventNotifier = null;
+ BcSmartspaceTemplateDataUtils.updateVisibility(bcSmartspaceCard.mSecondaryCardGroup, 8);
+ bcSmartspaceCard.mIconDrawable.setIcon(null);
+ bcSmartspaceCard.updateZenVisibility();
+ bcSmartspaceCard.setTitle(null, null, false);
+ bcSmartspaceCard.setSubtitle(null, null, false);
+ bcSmartspaceCard.updateIconTint();
+ bcSmartspaceCard.setOnClickListener(null);
}
- bcSmartspaceCard.setSmartspaceTarget(smartspaceTarget, build, z);
- bcSmartspaceCard.setPrimaryTextColor(mCurrentTextColor);
- bcSmartspaceCard.setDozeAmount(mDozeAmount);
- bcSmartspaceCard.setDnd(mDndImage, mDndDescription);
- bcSmartspaceCard.setNextAlarm(mNextAlarmImage, mNextAlarmDescription, mHolidayAlarmsTarget);
+ bcSmartspaceCard.mTarget = smartspaceTarget;
+ bcSmartspaceCard.mEventNotifier = smartspaceEventNotifier;
+ SmartspaceAction headerAction = smartspaceTarget.getHeaderAction();
+ SmartspaceAction baseAction = smartspaceTarget.getBaseAction();
+ bcSmartspaceCard.mUsePageIndicatorUi = this.mSmartspaceTargets.size() > 1;
+ bcSmartspaceCard.mValidSecondaryCard = false;
+ ViewGroup viewGroup4 = bcSmartspaceCard.mTextGroup;
+ if (viewGroup4 != null) {
+ viewGroup4.setTranslationX(0.0f);
+ }
+ if (headerAction != null) {
+ BcSmartspaceCardSecondary bcSmartspaceCardSecondary2 = bcSmartspaceCard.mSecondaryCard;
+ if (bcSmartspaceCardSecondary2 != null) {
+ String smartspaceTargetId3 = smartspaceTarget.getSmartspaceTargetId();
+ if (!bcSmartspaceCardSecondary2.mPrevSmartspaceTargetId.equals(smartspaceTargetId3)) {
+ bcSmartspaceCardSecondary2.mPrevSmartspaceTargetId = smartspaceTargetId3;
+ bcSmartspaceCardSecondary2.resetUi();
+ }
+ bcSmartspaceCard.mValidSecondaryCard = bcSmartspaceCard.mSecondaryCard.setSmartspaceActions(smartspaceTarget, bcSmartspaceCard.mEventNotifier, bcSmartspaceCardLoggingInfo2);
+ }
+ ViewGroup viewGroup5 = bcSmartspaceCard.mSecondaryCardGroup;
+ if (bcSmartspaceCard.mDozeAmount != 1.0f && bcSmartspaceCard.mValidSecondaryCard) {
+ i4 = 8;
+ } else {
+ i4 = 0;
+ }
+ BcSmartspaceTemplateDataUtils.updateVisibility(viewGroup5, i4);
+ Drawable iconDrawable = BcSmartSpaceUtil.getIconDrawable(bcSmartspaceCard.getContext(), headerAction.getIcon());
+ boolean z6 = iconDrawable != null;
+ bcSmartspaceCard.mIconDrawable.setIcon(iconDrawable);
+ CharSequence title = headerAction.getTitle();
+ CharSequence subtitle = headerAction.getSubtitle();
+ boolean z7 = smartspaceTarget.getFeatureType() == 1 || !TextUtils.isEmpty(title);
+ boolean z11 = !TextUtils.isEmpty(subtitle);
+ bcSmartspaceCard.updateZenVisibility();
+ if (!z7) {
+ title = subtitle;
+ }
+ CharSequence contentDescription = headerAction.getContentDescription();
+ boolean z8 = z7 != z11 && z6;
+ bcSmartspaceCard.setTitle(title, contentDescription, z8);
+ if (!z7 || !z11) {
+ subtitle = null;
+ }
+ bcSmartspaceCard.setSubtitle(subtitle, headerAction.getContentDescription(), z6);
+ bcSmartspaceCard.updateIconTint();
+ }
+ if (bcSmartspaceCard.mBaseActionIconSubtitleView != null) {
+ if (baseAction != null && baseAction.getIcon() != null) {
+ drawable = BcSmartSpaceUtil.getIconDrawable(bcSmartspaceCard.getContext(), baseAction.getIcon());
+ } else {
+ drawable = null;
+ }
+ if (baseAction != null && baseAction.getIcon() != null && drawable != null) {
+ drawable.setTintList(null);
+ bcSmartspaceCard.mBaseActionIconSubtitleView.setText(baseAction.getSubtitle());
+ bcSmartspaceCard.mBaseActionIconSubtitleView.setCompoundDrawablesRelative(drawable, null, null, null);
+ BcSmartspaceTemplateDataUtils.updateVisibility(bcSmartspaceCard.mBaseActionIconSubtitleView, 0);
+ if (baseAction.getExtras() != null && !baseAction.getExtras().isEmpty()) {
+ i2 = baseAction.getExtras().getInt("subcardType", -1);
+ } else {
+ i2 = -1;
+ }
+ if (i2 != -1) {
+ i3 = BcSmartspaceCard.getClickedIndex(bcSmartspaceCardLoggingInfo2, i2);
+ } else {
+ Log.d("BcSmartspaceCard", String.format("Subcard expected but missing type. loggingInfo=%s, baseAction=%s", bcSmartspaceCardLoggingInfo2, baseAction));
+ i3 = 0;
+ }
+ tapAction = null;
+ bcSmartspaceCardLoggingInfo = bcSmartspaceCardLoggingInfo2;
+ BcSmartSpaceUtil.setOnClickListener(bcSmartspaceCard.mBaseActionIconSubtitleView, smartspaceTarget, baseAction, bcSmartspaceCard.mEventNotifier, "BcSmartspaceCard", bcSmartspaceCardLoggingInfo2, i3);
+ bcSmartspaceCard.setFormattedContentDescription(bcSmartspaceCard.mBaseActionIconSubtitleView, baseAction.getSubtitle(), baseAction.getContentDescription());
+ } else {
+ tapAction = null;
+ bcSmartspaceCardLoggingInfo = bcSmartspaceCardLoggingInfo2;
+ BcSmartspaceTemplateDataUtils.updateVisibility(bcSmartspaceCard.mBaseActionIconSubtitleView, 4);
+ bcSmartspaceCard.mBaseActionIconSubtitleView.setOnClickListener(null);
+ bcSmartspaceCard.mBaseActionIconSubtitleView.setContentDescription(null);
+ }
+ } else {
+ tapAction = null;
+ bcSmartspaceCardLoggingInfo = bcSmartspaceCardLoggingInfo2;
+ }
+ if (bcSmartspaceCard.mDateView != null) {
+ if (headerAction != null) {
+ uuid = headerAction.getId();
+ } else if (baseAction != null) {
+ uuid = baseAction.getId();
+ } else {
+ uuid = UUID.randomUUID().toString();
+ }
+ BcSmartSpaceUtil.setOnClickListener(bcSmartspaceCard.mDateView, smartspaceTarget, new SmartspaceAction.Builder(uuid, "unusedTitle").setIntent(BcSmartSpaceUtil.getOpenCalendarIntent()).build(), bcSmartspaceCard.mEventNotifier, "BcSmartspaceCard", bcSmartspaceCardLoggingInfo, 0);
+ }
+ if (headerAction != null && (headerAction.getIntent() != null || headerAction.getPendingIntent() != null)) {
+ if (smartspaceTarget.getFeatureType() == 1 && bcSmartspaceCardLoggingInfo.mFeatureType == 39) {
+ i = BcSmartspaceCard.getClickedIndex(bcSmartspaceCardLoggingInfo, 1);
+ } else {
+ i = 0;
+ }
+ BcSmartSpaceUtil.setOnClickListener(bcSmartspaceCard, smartspaceTarget, headerAction, bcSmartspaceCard.mEventNotifier, "BcSmartspaceCard", bcSmartspaceCardLoggingInfo, i);
+ } else if (baseAction != null && (baseAction.getIntent() != null || baseAction.getPendingIntent() != null)) {
+ BcSmartSpaceUtil.setOnClickListener(bcSmartspaceCard, smartspaceTarget, baseAction, bcSmartspaceCard.mEventNotifier, "BcSmartspaceCard", bcSmartspaceCardLoggingInfo, 0);
+ } else {
+ BcSmartSpaceUtil.setOnClickListener(bcSmartspaceCard, smartspaceTarget, headerAction, bcSmartspaceCard.mEventNotifier, "BcSmartspaceCard", bcSmartspaceCardLoggingInfo, 0);
+ }
+ ViewGroup viewGroup6 = bcSmartspaceCard.mSecondaryCardGroup;
+ if (viewGroup6 != null) {
+ ViewGroup.LayoutParams layoutParams2 = (ConstraintLayout.LayoutParams) viewGroup6.getLayoutParams();
+ if (getFeatureType(smartspaceTarget) == -2) {
+ ((ConstraintLayout.LayoutParams) layoutParams2).matchConstraintMaxWidth = (bcSmartspaceCard.getWidth() * 3) / 4;
+ } else {
+ ((ConstraintLayout.LayoutParams) layoutParams2).matchConstraintMaxWidth = bcSmartspaceCard.getWidth() / 2;
+ }
+ bcSmartspaceCard.mSecondaryCardGroup.setLayoutParams(layoutParams2);
+ }
+ bcSmartspaceCard.setPrimaryTextColor(this.mCurrentTextColor);
+ bcSmartspaceCard.setDozeAmount(this.mDozeAmount);
+ Drawable drawable3 = this.mDndImage;
+ ImageView imageView4 = bcSmartspaceCard.mDndImageView;
+ if (imageView4 != null) {
+ if (drawable3 == null) {
+ BcSmartspaceTemplateDataUtils.updateVisibility(imageView4, 8);
+ BcSmartspaceTemplateDataUtils.offsetImageViewForIcon(bcSmartspaceCard.mDndImageView, null);
+ } else {
+ bcSmartspaceCard.mDndIconDrawable.setIcon(drawable3.mutate());
+ bcSmartspaceCard.mDndImageView.setImageDrawable(bcSmartspaceCard.mDndIconDrawable);
+ bcSmartspaceCard.mDndImageView.setContentDescription(this.mDndDescription);
+ BcSmartspaceTemplateDataUtils.offsetImageViewForIcon(bcSmartspaceCard.mDndImageView, bcSmartspaceCard.mDndIconDrawable);
+ BcSmartspaceTemplateDataUtils.updateVisibility(bcSmartspaceCard.mDndImageView, 0);
+ }
+ bcSmartspaceCard.updateZenVisibility();
+ }
+ BcNextAlarmData bcNextAlarmData3 = this.mNextAlarmData;
+ ImageView imageView5 = bcSmartspaceCard.mNextAlarmImageView;
+ if (imageView5 != null && bcSmartspaceCard.mNextAlarmTextView != null) {
+ Drawable drawable4 = bcNextAlarmData3.mImage;
+ if (drawable4 == null) {
+ BcSmartspaceTemplateDataUtils.updateVisibility(imageView5, 8);
+ BcSmartspaceTemplateDataUtils.updateVisibility(bcSmartspaceCard.mNextAlarmTextView, 8);
+ BcSmartspaceTemplateDataUtils.offsetImageViewForIcon(bcSmartspaceCard.mNextAlarmImageView, null);
+ } else {
+ bcSmartspaceCard.mNextAlarmIconDrawable.setIcon(drawable4);
+ bcSmartspaceCard.mNextAlarmImageView.setImageDrawable(bcSmartspaceCard.mNextAlarmIconDrawable);
+ BcSmartspaceTemplateDataUtils.offsetImageViewForIcon(bcSmartspaceCard.mNextAlarmImageView, bcSmartspaceCard.mNextAlarmIconDrawable);
+ BcSmartspaceTemplateDataUtils.updateVisibility(bcSmartspaceCard.mNextAlarmImageView, 0);
+ String description2 = bcNextAlarmData3.getDescription(null);
+ bcSmartspaceCard.mNextAlarmTextView.setContentDescription(bcSmartspaceCard.getContext().getString(R.string.accessibility_next_alarm, description2));
+ bcSmartspaceCard.mNextAlarmTextView.setText(description2);
+ BcSmartspaceTemplateDataUtils.updateVisibility(bcSmartspaceCard.mNextAlarmTextView, 0);
+ bcNextAlarmData3.setOnClickListener(bcSmartspaceCard.mNextAlarmImageView, tapAction, bcSmartspaceCard.mEventNotifier, BcSmartSpaceUtil.getLoggingDisplaySurface(bcSmartspaceCard.getContext().getPackageName(), bcSmartspaceCard.mIsDreaming, bcSmartspaceCard.mDozeAmount));
+ bcNextAlarmData3.setOnClickListener(bcSmartspaceCard.mNextAlarmTextView, tapAction, bcSmartspaceCard.mEventNotifier, BcSmartSpaceUtil.getLoggingDisplaySurface(bcSmartspaceCard.getContext().getPackageName(), bcSmartspaceCard.mIsDreaming, bcSmartspaceCard.mDozeAmount));
+ }
+ bcSmartspaceCard.updateZenVisibility();
+ }
}
- private boolean isHolidayAlarmsTarget(SmartspaceTarget smartspaceTarget) {
- return smartspaceTarget.getFeatureType() == 34;
- }
-
- public void setTargets(List<? extends Parcelable> list) {
- mTargetsExcludingMediaAndHolidayAlarms.clear();
- mHolidayAlarmsTarget = null;
- list.forEach(
- new Consumer() {
- @Override
- public final void accept(Object obj) {
- SmartspaceTarget smartspaceTarget = (SmartspaceTarget) (Parcelable) obj;
- if (isHolidayAlarmsTarget(smartspaceTarget)) {
- mHolidayAlarmsTarget = smartspaceTarget;
- } else {
- mTargetsExcludingMediaAndHolidayAlarms.add(smartspaceTarget);
- }
- }
- });
- boolean z = true;
- if (mTargetsExcludingMediaAndHolidayAlarms.isEmpty()) {
- mTargetsExcludingMediaAndHolidayAlarms.add(
- new SmartspaceTarget.Builder(
- "date_card_794317_92634",
- new ComponentName(mRoot.getContext(), CardPagerAdapter.class),
- mRoot.getContext().getUser())
- .setFeatureType(1)
- .build());
- }
- if (mTargetsExcludingMediaAndHolidayAlarms.size() != 1
- || mTargetsExcludingMediaAndHolidayAlarms.get(0).getFeatureType() != 1) {
- z = false;
- }
- mHasOnlyDefaultDateCard = z;
- updateTargetVisibility();
- notifyDataSetChanged();
- }
-
- public void setDataProvider(BcSmartspaceDataPlugin bcSmartspaceDataPlugin) {
- mDataProvider = bcSmartspaceDataPlugin;
+ public void setDataProvider(BcSmartspaceDataPlugin plugin) {
+ this.mDataProvider = plugin;
}
public void setPrimaryTextColor(int i) {
- mPrimaryTextColor = i;
- setDozeAmount(mDozeAmount);
- }
-
- public void setDozeAmount(float f) {
- mCurrentTextColor = ColorUtils.blendARGB(mPrimaryTextColor, mDozeColor, f);
- mDozeAmount = f;
- updateTargetVisibility();
- refreshCardColors();
- }
-
- public float getDozeAmount() {
- return mDozeAmount;
- }
-
- public boolean getIsDreaming() {
- return mIsDreaming;
+ this.mPrimaryTextColor = i;
+ setDozeAmount(this.mDozeAmount);
}
public void setDnd(Drawable drawable, String str) {
- mDndImage = drawable;
- mDndDescription = str;
+ this.mDndImage = drawable;
+ this.mDndDescription = str;
refreshCards();
}
public void setNextAlarm(Drawable drawable, String str) {
- mNextAlarmImage = drawable;
- mNextAlarmDescription = str;
+ BcNextAlarmData bcNextAlarmData = this.mNextAlarmData;
+ bcNextAlarmData.mImage = drawable;
+ if (drawable != null) {
+ drawable.mutate();
+ }
+ bcNextAlarmData.mDescription = str;
refreshCards();
}
public void setMediaTarget(SmartspaceTarget smartspaceTarget) {
- mMediaTargets.clear();
+ this.mMediaTargets.clear();
if (smartspaceTarget != null) {
- mMediaTargets.add(smartspaceTarget);
+ this.mMediaTargets.add(smartspaceTarget);
}
updateTargetVisibility();
}
- public Drawable getNextAlarmImage() {
- return mNextAlarmImage;
- }
-
- public SmartspaceTarget getHolidayAlarmsTarget() {
- return mHolidayAlarmsTarget;
- }
-
- private void refreshCards() {
- for (int i = 0; i < mHolders.size(); i++) {
- onBindViewHolder(mHolders.get(i));
+ public void setDozeAmount(float f) {
+ this.mCurrentTextColor = ColorUtils.blendARGB(this.mPrimaryTextColor, this.mDozeColor, f);
+ this.mLastDozeAmount = this.mDozeAmount;
+ this.mDozeAmount = f;
+ updateTargetVisibility();
+ for (int i = 0; i < this.mViewHolders.size(); i++) {
+ SparseArray<ViewHolder> sparseArray = this.mViewHolders;
+ ViewHolder viewHolder = sparseArray.get(sparseArray.keyAt(i));
+ if (viewHolder != null) {
+ BcSmartspaceCard bcSmartspaceCard = viewHolder.mLegacyCard;
+ if (bcSmartspaceCard != null) {
+ bcSmartspaceCard.setPrimaryTextColor(this.mCurrentTextColor);
+ bcSmartspaceCard.setDozeAmount(this.mDozeAmount);
+ }
+ BaseTemplateCard baseTemplateCard = viewHolder.mCard;
+ if (baseTemplateCard != null) {
+ baseTemplateCard.setPrimaryTextColor(this.mCurrentTextColor);
+ baseTemplateCard.setDozeAmount(this.mDozeAmount);
+ }
+ }
}
}
- private void refreshCardColors() {
- for (int i = 0; i < mHolders.size(); i++) {
- mHolders.get(i).card.setPrimaryTextColor(mCurrentTextColor);
- mHolders.get(i).card.setDozeAmount(mDozeAmount);
- }
- }
-
- private void updateTargetVisibility() {
- boolean z;
- if (mMediaTargets.isEmpty()) {
- mSmartspaceTargets = mTargetsExcludingMediaAndHolidayAlarms;
+ public void updateTargetVisibility() {
+ ArrayList<SmartspaceTarget> targets;
+ ArrayList<SmartspaceTarget> targets2;
+ if (Float.compare(this.mDozeAmount, 1.0f) == 0) {
+ if (isMediaPreferred(this.mAODTargets)) {
+ targets2 = this.mMediaTargets;
+ } else {
+ targets2 = this.mAODTargets;
+ }
+ this.mSmartspaceTargets = targets2;
notifyDataSetChanged();
return;
}
- float f = mDozeAmount;
- if (f == 0.0f || !(z = mHasOnlyDefaultDateCard)) {
- mSmartspaceTargets = mTargetsExcludingMediaAndHolidayAlarms;
- notifyDataSetChanged();
- } else if (f != 1.0f || !z) {
+ if (isMediaPreferred(this.mLockscreenTargets) && this.mKeyguardBypassEnabled) {
+ targets = this.mMediaTargets;
} else {
- mSmartspaceTargets = mMediaTargets;
+ targets = this.mLockscreenTargets;
+ }
+ this.mSmartspaceTargets = targets;
+ if (Float.compare(this.mLastDozeAmount, 0.0f) == 0 || Float.compare(this.mLastDozeAmount, 1.0f) == 0 || Float.compare(this.mDozeAmount, 0.0f) == 0) {
notifyDataSetChanged();
}
}
- public SparseArray<ViewHolder> getViewHolder() {
- return mHolders;
+ public static int getFeatureType(SmartspaceTarget target) {
+ List<SmartspaceAction> actionChips = target.getActionChips();
+ int featureType = target.getFeatureType();
+ if (actionChips != null && !actionChips.isEmpty()) {
+ if (featureType != 13 || actionChips.size() != 1) {
+ return -1;
+ }
+ return -2;
+ }
+ return featureType;
+ }
+
+ public void addDefaultDateCardIfEmpty(ArrayList<SmartspaceTarget> targets) {
+ if (targets.isEmpty()) {
+ targets.add(new SmartspaceTarget.Builder("date_card_794317_92634", new ComponentName(this.mRoot.getContext(), CardPagerAdapter.class), this.mRoot.getContext().getUser()).setFeatureType(1).build());
+ }
+ }
+
+ public boolean isMediaPreferred(ArrayList<SmartspaceTarget> targets) {
+ return targets.size() == 1 && targets.get(0).getFeatureType() == 1 && !this.mMediaTargets.isEmpty();
}
public static class ViewHolder {
- public final BcSmartspaceCard card;
- public final int position;
- public SmartspaceTarget target;
+ public final BaseTemplateCard mCard;
+ public final BcSmartspaceCard mLegacyCard;
+ public final int mPosition;
+ public SmartspaceTarget mTarget;
- ViewHolder(int i, BcSmartspaceCard bcSmartspaceCard, SmartspaceTarget smartspaceTarget) {
- position = i;
- card = bcSmartspaceCard;
- target = smartspaceTarget;
+ public ViewHolder(int position, BcSmartspaceCard legacyCard, SmartspaceTarget target, BaseTemplateCard card) {
+ this.mPosition = position;
+ this.mLegacyCard = legacyCard;
+ this.mTarget = target;
+ this.mCard = card;
}
}
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/DoubleShadowIconDrawable.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/DoubleShadowIconDrawable.java
index 382a5f5..14e3017 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/DoubleShadowIconDrawable.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/DoubleShadowIconDrawable.java
@@ -1,88 +1,108 @@
package com.google.android.systemui.smartspace;
import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.BlurMaskFilter;
+import android.graphics.BlendMode;
import android.graphics.Canvas;
-import android.graphics.Paint;
-import android.graphics.drawable.BitmapDrawable;
+import android.graphics.Color;
+import android.graphics.ColorFilter;
+import android.graphics.PorterDuff;
+import android.graphics.PorterDuffColorFilter;
+import android.graphics.RenderEffect;
+import android.graphics.RenderNode;
+import android.graphics.Shader;
import android.graphics.drawable.Drawable;
-import android.graphics.drawable.LayerDrawable;
-
+import android.graphics.drawable.InsetDrawable;
import com.android.internal.graphics.ColorUtils;
import com.android.systemui.bcsmartspace.R;
-public class DoubleShadowIconDrawable extends LayerDrawable {
- private Drawable mIconDrawable;
- private Drawable mShadowDrawable;
+public class DoubleShadowIconDrawable extends Drawable {
+ public int mAmbientShadowRadius;
+ public final int mCanvasSize;
+ public RenderNode mDoubleShadowNode;
+ public InsetDrawable mIconDrawable;
+ public final int mIconInsetSize;
+ public int mKeyShadowOffsetX;
+ public int mKeyShadowOffsetY;
+ public int mKeyShadowRadius;
+ public boolean mShowShadow;
- public DoubleShadowIconDrawable(Drawable drawable, Context context) {
- super(new Drawable[0]);
- int dimensionPixelSize =
- context.getResources().getDimensionPixelSize(R.dimen.enhanced_smartspace_icon_size);
- generateIconAndShadow(
- drawable, context, dimensionPixelSize, dimensionPixelSize, dimensionPixelSize);
+ public DoubleShadowIconDrawable(Context context) {
+ int dimensionPixelSize = context.getResources().getDimensionPixelSize(R.dimen.enhanced_smartspace_icon_size);
+ int dimensionPixelSize2 = context.getResources().getDimensionPixelSize(R.dimen.enhanced_smartspace_icon_inset);
+ this.mIconInsetSize = dimensionPixelSize2;
+ int i = (dimensionPixelSize2 * 2) + dimensionPixelSize;
+ this.mCanvasSize = i;
+ this.mAmbientShadowRadius = context.getResources().getDimensionPixelSize(R.dimen.ambient_text_shadow_radius);
+ this.mKeyShadowRadius = context.getResources().getDimensionPixelSize(R.dimen.key_text_shadow_radius);
+ this.mKeyShadowOffsetX = context.getResources().getDimensionPixelSize(R.dimen.key_text_shadow_dx);
+ this.mKeyShadowOffsetY = context.getResources().getDimensionPixelSize(R.dimen.key_text_shadow_dy);
+ setBounds(0, 0, i, i);
}
- private void generateIconAndShadow(Drawable drawable, Context context, int i, int i2, int i3) {
- Bitmap createBitmap = Bitmap.createBitmap(i3, i3, Bitmap.Config.ARGB_8888);
- Canvas canvas = new Canvas(createBitmap);
- drawable.setBounds(0, 0, i, i2);
- int i4 = i3 / 2;
- canvas.translate(((-i) / 2) + i4, ((-i2) / 2) + i4);
- drawable.draw(canvas);
- mIconDrawable = new BitmapDrawable(context.getResources(), createBitmap);
- Drawable generateShadowDrawable = generateShadowDrawable(createBitmap, context);
- mShadowDrawable = generateShadowDrawable;
- addLayer(generateShadowDrawable);
- addLayer(mIconDrawable);
- setBounds(0, 0, i3, i3);
+ @Override // android.graphics.drawable.Drawable
+ public int getOpacity() {
+ return 0;
}
- private static Drawable generateShadowDrawable(Bitmap bitmap, Context context) {
- Bitmap createBitmap =
- Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
- Canvas canvas = new Canvas(createBitmap);
- float dimensionPixelSize =
- context.getResources().getDimensionPixelSize(R.dimen.ambient_text_shadow_radius);
- float dimensionPixelSize2 =
- context.getResources().getDimensionPixelSize(R.dimen.key_text_shadow_radius);
- float dimensionPixelSize3 =
- context.getResources().getDimensionPixelSize(R.dimen.key_text_shadow_dx);
- float dimensionPixelSize4 =
- context.getResources().getDimensionPixelSize(R.dimen.key_text_shadow_dy);
- int[] iArr = new int[2];
- Paint paint = new Paint(3);
- Paint paint2 = new Paint(3);
- if (dimensionPixelSize != 0.0f) {
- paint.setMaskFilter(new BlurMaskFilter(dimensionPixelSize, BlurMaskFilter.Blur.NORMAL));
- Bitmap extractAlpha = bitmap.extractAlpha(paint, iArr);
- paint2.setAlpha(64);
- canvas.drawBitmap(extractAlpha, iArr[0], iArr[1], paint2);
+ public void setIcon(Drawable drawable) {
+ RenderNode renderNode = null;
+ if (drawable == null) {
+ this.mIconDrawable = null;
+ return;
}
- if (dimensionPixelSize2 != 0.0f) {
- paint.setMaskFilter(
- new BlurMaskFilter(dimensionPixelSize2, BlurMaskFilter.Blur.NORMAL));
- Bitmap extractAlpha2 = bitmap.extractAlpha(paint, iArr);
- paint2.setAlpha(72);
- canvas.drawBitmap(
- extractAlpha2,
- iArr[0] + dimensionPixelSize3,
- iArr[1] + dimensionPixelSize4,
- paint2);
+ InsetDrawable insetDrawable = new InsetDrawable(drawable, this.mIconInsetSize);
+ this.mIconDrawable = insetDrawable;
+ int i = this.mCanvasSize;
+ insetDrawable.setBounds(0, 0, i, i);
+ if (this.mIconDrawable != null) {
+ RenderNode renderNode2 = new RenderNode("DoubleShadowNode");
+ int i2 = this.mCanvasSize;
+ renderNode2.setPosition(0, 0, i2, i2);
+ RenderEffect createShadowRenderEffect = createShadowRenderEffect(this.mAmbientShadowRadius, 0, 0, 48);
+ RenderEffect createShadowRenderEffect2 = createShadowRenderEffect(this.mKeyShadowRadius, this.mKeyShadowOffsetX, this.mKeyShadowOffsetY, 72);
+ if (createShadowRenderEffect != null && createShadowRenderEffect2 != null) {
+ renderNode2.setRenderEffect(RenderEffect.createBlendModeEffect(createShadowRenderEffect, createShadowRenderEffect2, BlendMode.DARKEN));
+ renderNode = renderNode2;
+ }
}
- return new BitmapDrawable(context.getResources(), createBitmap);
+ this.mDoubleShadowNode = renderNode;
}
- @Override
- public void setTint(int i) {
- Drawable drawable = mIconDrawable;
- if (drawable != null) {
- drawable.setTint(i);
+ public static RenderEffect createShadowRenderEffect(int i, int i2, int i3, int i4) {
+ return RenderEffect.createColorFilterEffect(new PorterDuffColorFilter(Color.argb(i4, 0, 0, 0), PorterDuff.Mode.MULTIPLY), RenderEffect.createOffsetEffect(i2, i3, RenderEffect.createBlurEffect(i, i, Shader.TileMode.CLAMP)));
+ }
+
+ @Override // android.graphics.drawable.Drawable
+ public void setAlpha(int i) {
+ this.mIconDrawable.setAlpha(i);
+ }
+
+ @Override // android.graphics.drawable.Drawable
+ public void setColorFilter(ColorFilter colorFilter) {
+ this.mIconDrawable.setColorFilter(colorFilter);
+ }
+
+ @Override // android.graphics.drawable.Drawable
+ public void setTint(int alpha) {
+ if (this.mIconDrawable != null) {
+ this.mIconDrawable.setTint(alpha);
}
- Drawable drawable2 = mShadowDrawable;
- if (drawable2 != null) {
- drawable2.setAlpha(ColorUtils.calculateLuminance(i) > 0.5d ? 255 : 0);
+ this.mShowShadow = ColorUtils.calculateLuminance(alpha) > 0.5d;
+ }
+
+ @Override // android.graphics.drawable.Drawable
+ public void draw(Canvas canvas) {
+ RenderNode renderNode;
+ if (canvas.isHardwareAccelerated() && (renderNode = this.mDoubleShadowNode) != null && this.mShowShadow) {
+ if (!renderNode.hasDisplayList()) {
+ this.mIconDrawable.draw(this.mDoubleShadowNode.beginRecording());
+ this.mDoubleShadowNode.endRecording();
+ }
+ canvas.drawRenderNode(this.mDoubleShadowNode);
+ }
+ InsetDrawable insetDrawable = this.mIconDrawable;
+ if (insetDrawable != null) {
+ insetDrawable.draw(canvas);
}
}
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/DoubleShadowTextView.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/DoubleShadowTextView.java
index 3384dc5..ac6897d 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/DoubleShadowTextView.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/DoubleShadowTextView.java
@@ -4,72 +4,60 @@
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.widget.TextView;
-
import androidx.core.graphics.ColorUtils;
-
import com.android.systemui.bcsmartspace.R;
public class DoubleShadowTextView extends TextView {
- private final float mAmbientShadowBlur;
- private final int mAmbientShadowColor;
- private boolean mDrawShadow;
- private final float mKeyShadowBlur;
- private final int mKeyShadowColor;
- private final float mKeyShadowOffsetX;
- private final float mKeyShadowOffsetY;
+ public final float mAmbientShadowBlur;
+ public final int mAmbientShadowColor;
+ public boolean mDrawShadow;
+ public final float mKeyShadowBlur;
+ public final int mKeyShadowColor;
+ public final float mKeyShadowOffsetX;
+ public final float mKeyShadowOffsetY;
public DoubleShadowTextView(Context context) {
this(context, null);
}
- public DoubleShadowTextView(Context context, AttributeSet attributeSet) {
- this(context, attributeSet, 0);
+ public DoubleShadowTextView(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
}
- public DoubleShadowTextView(Context context, AttributeSet attributeSet, int i) {
- super(context, attributeSet, i);
+ public DoubleShadowTextView(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
updateDrawShadow(getCurrentTextColor());
- mKeyShadowBlur =
- context.getResources().getDimensionPixelSize(R.dimen.key_text_shadow_radius);
- mKeyShadowOffsetX =
- context.getResources().getDimensionPixelSize(R.dimen.key_text_shadow_dx);
- mKeyShadowOffsetY =
- context.getResources().getDimensionPixelSize(R.dimen.key_text_shadow_dy);
- mKeyShadowColor = context.getResources().getColor(R.color.key_text_shadow_color);
- mAmbientShadowBlur =
- context.getResources().getDimensionPixelSize(R.dimen.ambient_text_shadow_radius);
- mAmbientShadowColor = context.getResources().getColor(R.color.ambient_text_shadow_color);
+ this.mKeyShadowBlur = context.getResources().getDimensionPixelSize(R.dimen.key_text_shadow_radius);
+ this.mKeyShadowOffsetX = context.getResources().getDimensionPixelSize(R.dimen.key_text_shadow_dx);
+ this.mKeyShadowOffsetY = context.getResources().getDimensionPixelSize(R.dimen.key_text_shadow_dy);
+ this.mKeyShadowColor = context.getResources().getColor(R.color.key_text_shadow_color);
+ this.mAmbientShadowBlur = context.getResources().getDimensionPixelSize(R.dimen.ambient_text_shadow_radius);
+ this.mAmbientShadowColor = context.getResources().getColor(R.color.ambient_text_shadow_color);
}
- @Override
+ @Override // android.widget.TextView, android.view.View
public void onDraw(Canvas canvas) {
- if (!mDrawShadow) {
+ if (!this.mDrawShadow) {
getPaint().clearShadowLayer();
super.onDraw(canvas);
return;
}
- getPaint().setShadowLayer(mAmbientShadowBlur, 0.0f, 0.0f, mAmbientShadowColor);
+ getPaint().setShadowLayer(this.mAmbientShadowBlur, 0.0f, 0.0f, this.mAmbientShadowColor);
super.onDraw(canvas);
canvas.save();
- canvas.clipRect(
- getScrollX(),
- getScrollY() + getExtendedPaddingTop(),
- getScrollX() + getWidth(),
- getScrollY() + getHeight());
- getPaint()
- .setShadowLayer(
- mKeyShadowBlur, mKeyShadowOffsetX, mKeyShadowOffsetY, mKeyShadowColor);
+ canvas.clipRect(getScrollX(), getExtendedPaddingTop() + getScrollY(), getWidth() + getScrollX(), getHeight() + getScrollY());
+ getPaint().setShadowLayer(this.mKeyShadowBlur, this.mKeyShadowOffsetX, this.mKeyShadowOffsetY, this.mKeyShadowColor);
super.onDraw(canvas);
canvas.restore();
}
- @Override
- public void setTextColor(int i) {
- super.setTextColor(i);
- updateDrawShadow(i);
+ @Override // android.widget.TextView
+ public void setTextColor(int color) {
+ super.setTextColor(color);
+ updateDrawShadow(color);
}
- private void updateDrawShadow(int i) {
- mDrawShadow = ColorUtils.calculateLuminance(i) > 0.5d;
+ private void updateDrawShadow(int color) {
+ this.mDrawShadow = ColorUtils.calculateLuminance(color) > 0.5d;
}
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/IcuDateTextView.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/IcuDateTextView.java
index ebadccf..b181af5 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/IcuDateTextView.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/IcuDateTextView.java
@@ -9,18 +9,16 @@
import android.os.Handler;
import android.os.SystemClock;
import android.util.AttributeSet;
-
import com.android.systemui.bcsmartspace.R;
-
import java.util.Locale;
import java.util.Objects;
public class IcuDateTextView extends DoubleShadowTextView {
- private DateFormat mFormatter;
- private Handler mHandler;
- private final BroadcastReceiver mIntentReceiver;
- private String mText;
- private final Runnable mTicker;
+ public DateFormat mFormatter;
+ public Handler mHandler;
+ public final BroadcastReceiver mIntentReceiver;
+ public String mText;
+ public final Runnable mTicker;
public IcuDateTextView(Context context) {
this(context, null);
@@ -28,82 +26,68 @@
public IcuDateTextView(Context context, AttributeSet attributeSet) {
super(context, attributeSet, 0);
- mTicker =
- new Runnable() {
- @Override
- public final void run() {
- onTimeTick();
- }
- };
- mIntentReceiver =
- new BroadcastReceiver() {
- @Override
- public void onReceive(Context context2, Intent intent) {
- onTimeChanged(
- !"android.intent.action.TIME_TICK".equals(intent.getAction()));
- }
- };
+ this.mTicker = this::onTimeTick;
+ this.mIntentReceiver = new BroadcastReceiver() { // from class: com.google.android.systemui.smartspace.IcuDateTextView.1
+ @Override // android.content.BroadcastReceiver
+ public void onReceive(Context context2, Intent intent) {
+ IcuDateTextView.this.onTimeChanged(!"android.intent.action.TIME_TICK".equals(intent.getAction()));
+ }
+ };
}
- @Override
+ @Override // android.widget.TextView, android.view.View
protected void onAttachedToWindow() {
super.onAttachedToWindow();
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.intent.action.TIME_SET");
intentFilter.addAction("android.intent.action.TIMEZONE_CHANGED");
- getContext().registerReceiver(mIntentReceiver, intentFilter);
+ getContext().registerReceiver(this.mIntentReceiver, intentFilter);
onTimeChanged(true);
- mHandler = new Handler();
+ this.mHandler = new Handler();
}
- @Override
+ @Override // android.view.View
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
- if (mHandler != null) {
- getContext().unregisterReceiver(mIntentReceiver);
- mHandler = null;
+ if (this.mHandler != null) {
+ getContext().unregisterReceiver(this.mIntentReceiver);
+ this.mHandler = null;
}
}
- public void onTimeTick() {
+ private void onTimeTick() {
onTimeChanged(false);
- if (mHandler != null) {
+ if (this.mHandler != null) {
long uptimeMillis = SystemClock.uptimeMillis();
- mHandler.postAtTime(mTicker, uptimeMillis + (1000 - (uptimeMillis % 1000)));
+ this.mHandler.postAtTime(this.mTicker, uptimeMillis + (1000 - (uptimeMillis % 1000)));
}
}
- @Override
- public void onVisibilityAggregated(boolean z) {
- super.onVisibilityAggregated(z);
- Handler handler = mHandler;
- if (handler != null) {
- handler.removeCallbacks(mTicker);
- if (!z) {
- return;
+ @Override // android.view.View
+ public void onVisibilityAggregated(boolean isVisible) {
+ super.onVisibilityAggregated(isVisible);
+ if (this.mHandler != null) {
+ this.mHandler.removeCallbacks(this.mTicker);
+ if (isVisible) {
+ this.mTicker.run();
}
- mTicker.run();
}
}
- public void onTimeChanged(boolean z) {
+ public void onTimeChanged(boolean force) {
if (!isShown()) {
return;
}
- if (mFormatter == null || z) {
- DateFormat instanceForSkeleton =
- DateFormat.getInstanceForSkeleton(
- getContext().getString(R.string.smartspace_icu_date_pattern),
- Locale.getDefault());
- mFormatter = instanceForSkeleton;
- instanceForSkeleton.setContext(DisplayContext.CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE);
+ if (this.mFormatter == null || force) {
+ DateFormat format = DateFormat.getInstanceForSkeleton(getContext().getString(R.string.smartspace_icu_date_pattern), Locale.getDefault());
+ this.mFormatter = format;
+ format.setContext(DisplayContext.CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE);
}
- String format = mFormatter.format(Long.valueOf(System.currentTimeMillis()));
- if (Objects.equals(mText, format)) {
- return;
+ String format2 = this.mFormatter.format(Long.valueOf(System.currentTimeMillis()));
+ if (!Objects.equals(this.mText, format2)) {
+ this.mText = format2;
+ setText(format2);
+ setContentDescription(format2);
}
- mText = format;
- setText(format);
- setContentDescription(format);
}
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/InstanceId.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/InstanceId.java
index ca36cc1..9a7c0f5 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/InstanceId.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/InstanceId.java
@@ -1,7 +1,6 @@
package com.google.android.systemui.smartspace;
import android.app.smartspace.SmartspaceTarget;
-
import java.util.UUID;
public class InstanceId {
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/InterceptingViewPager.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/InterceptingViewPager.java
index b952091..c7b8bc7 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/InterceptingViewPager.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/InterceptingViewPager.java
@@ -4,60 +4,65 @@
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.ViewConfiguration;
-
import androidx.viewpager.widget.ViewPager;
public class InterceptingViewPager extends ViewPager {
- private boolean mHasPerformedLongPress;
- private boolean mHasPostedLongPress;
- private final EventProxy mSuperOnTouch = (motionEvent) -> {
- return super.onTouchEvent(motionEvent);
- };
- private final EventProxy mSuperOnIntercept = (motionEvent) -> {
- return super.onInterceptTouchEvent(motionEvent);
- };
- private final Runnable mLongPressCallback = () -> {
- triggerLongPress();
- };
+ public boolean mHasPerformedLongPress;
+ public boolean mHasPostedLongPress;
+ public final Runnable mLongPressCallback;
+ public final EventProxy mSuperOnIntercept;
+ public final EventProxy mSuperOnTouch;
public interface EventProxy {
boolean delegateEvent(MotionEvent motionEvent);
}
+ public boolean superOnTouchEvent(MotionEvent event) {
+ return super.onTouchEvent(event);
+ }
+
+ public boolean superOnInterceptTouchEvent(MotionEvent event) {
+ return super.onInterceptTouchEvent(event);
+ }
+
public InterceptingViewPager(Context context) {
super(context);
+ this.mSuperOnTouch = this::superOnTouchEvent;
+ this.mSuperOnIntercept = this::superOnInterceptTouchEvent;
+ this.mLongPressCallback = this::triggerLongPress;
}
- public InterceptingViewPager(Context context, AttributeSet attributeSet) {
- super(context, attributeSet);
+ public InterceptingViewPager(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ this.mSuperOnTouch = this::superOnTouchEvent;
+ this.mSuperOnIntercept = this::superOnInterceptTouchEvent;
+ this.mLongPressCallback = this::triggerLongPress;
}
- @Override
- public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
- return handleTouchOverride(motionEvent, mSuperOnIntercept);
+ public boolean onInterceptTouchEvent(MotionEvent event) {
+ return handleTouchOverride(event, this.mSuperOnIntercept);
}
- @Override
- public boolean onTouchEvent(MotionEvent motionEvent) {
- return handleTouchOverride(motionEvent, mSuperOnTouch);
+ public boolean onTouchEvent(MotionEvent event) {
+ return handleTouchOverride(event, this.mSuperOnTouch);
}
- private boolean handleTouchOverride(MotionEvent motionEvent, EventProxy eventProxy) {
- int action = motionEvent.getAction();
+ private boolean handleTouchOverride(MotionEvent event, EventProxy proxy) {
+ int action = event.getAction();
if (action == 0) {
- mHasPerformedLongPress = false;
+ this.mHasPerformedLongPress = false;
if (isLongClickable()) {
cancelScheduledLongPress();
- mHasPostedLongPress = true;
- postDelayed(mLongPressCallback, ViewConfiguration.getLongPressTimeout());
+ this.mHasPostedLongPress = true;
+ postDelayed(this.mLongPressCallback, ViewConfiguration.getLongPressTimeout());
}
} else if (action == 1 || action == 3) {
cancelScheduledLongPress();
}
- if (mHasPerformedLongPress) {
+ if (this.mHasPerformedLongPress) {
cancelScheduledLongPress();
return true;
- } else if (!eventProxy.delegateEvent(motionEvent)) {
+ } else if (!proxy.delegateEvent(event)) {
return false;
} else {
cancelScheduledLongPress();
@@ -66,14 +71,14 @@
}
private void cancelScheduledLongPress() {
- if (mHasPostedLongPress) {
- mHasPostedLongPress = false;
- removeCallbacks(mLongPressCallback);
+ if (this.mHasPostedLongPress) {
+ this.mHasPostedLongPress = false;
+ removeCallbacks(this.mLongPressCallback);
}
}
public void triggerLongPress() {
- mHasPerformedLongPress = true;
+ this.mHasPerformedLongPress = true;
if (performLongClick()) {
getParent().requestDisallowInterceptTouchEvent(true);
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/LazyServerFlagLoader.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/LazyServerFlagLoader.java
new file mode 100644
index 0000000..7eb44e2
--- /dev/null
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/LazyServerFlagLoader.java
@@ -0,0 +1,26 @@
+package com.google.android.systemui.smartspace;
+
+import android.provider.DeviceConfig;
+
+public final class LazyServerFlagLoader {
+ public final String mPropertyKey;
+ public Boolean mValue = null;
+
+ public LazyServerFlagLoader(String key) {
+ this.mPropertyKey = key;
+ }
+
+ public boolean get() {
+ if (this.mValue == null) {
+ this.mValue = Boolean.valueOf(DeviceConfig.getBoolean("launcher", this.mPropertyKey, true));
+ DeviceConfig.addOnPropertiesChangedListener("launcher", (v0) -> {
+ v0.run();
+ }, properties -> {
+ if (properties.getKeyset().contains(this.mPropertyKey)) {
+ this.mValue = Boolean.valueOf(properties.getBoolean(this.mPropertyKey, true));
+ }
+ });
+ }
+ return this.mValue.booleanValue();
+ }
+}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/NewCardInfo.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/NewCardInfo.java
index 83fd3e2..25a8df4 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/NewCardInfo.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/NewCardInfo.java
@@ -10,80 +10,64 @@
import android.provider.MediaStore;
import android.text.TextUtils;
import android.util.Log;
-
-import com.android.systemui.smartspace.nano.SmartspaceProto.CardWrapper;
-import com.android.systemui.smartspace.nano.SmartspaceProto.SmartspaceUpdate;
-
+import com.android.systemui.smartspace.nano.SmartspaceProto;
import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-public class NewCardInfo {
- private final SmartspaceUpdate.SmartspaceCard mCard;
- private final Intent mIntent;
- private final boolean mIsPrimary;
- private final PackageInfo mPackageInfo;
- private final long mPublishTime;
+public final class NewCardInfo {
+ public final SmartspaceProto.SmartspaceUpdate.SmartspaceCard mCard;
+ public final Intent mIntent;
+ public final boolean mIsPrimary;
+ public final PackageInfo mPackageInfo;
+ public final long mPublishTime;
- public NewCardInfo(
- SmartspaceUpdate.SmartspaceCard smartspaceCard,
- Intent intent,
- boolean z,
- long j,
- PackageInfo packageInfo) {
- mCard = smartspaceCard;
- mIsPrimary = z;
- mIntent = intent;
- mPublishTime = j;
- mPackageInfo = packageInfo;
+ public NewCardInfo(SmartspaceProto.SmartspaceUpdate.SmartspaceCard smartspaceCard, Intent intent, boolean z, long j, PackageInfo packageInfo) {
+ this.mCard = smartspaceCard;
+ this.mIsPrimary = z;
+ this.mIntent = intent;
+ this.mPublishTime = j;
+ this.mPackageInfo = packageInfo;
}
public boolean isPrimary() {
- return mIsPrimary;
+ return this.mIsPrimary;
}
public Bitmap retrieveIcon(Context context) {
- SmartspaceUpdate.SmartspaceCard.Image image = mCard.icon;
- if (image == null) {
+ if (this.mCard.icon == null) {
return null;
}
- Bitmap bitmap = (Bitmap) retrieveFromIntent(image.key, mIntent);
+ Bitmap bitmap = (Bitmap) retrieveFromIntent(this.mCard.icon.key, this.mIntent);
if (bitmap != null) {
return bitmap;
}
try {
- } catch (Exception unused) {
- Log.e(
- "NewCardInfo",
- "retrieving bitmap uri=" + image.uri + " gsaRes=" + image.gsaResourceName);
- }
- if (!TextUtils.isEmpty(image.uri)) {
- try {
- return MediaStore.Images.Media.getBitmap(
- context.getContentResolver(), Uri.parse(image.uri));
- } catch (IOException e) {
- Log.e("NewCardInfo", "failed to get bitmap from uri");
+ if (!TextUtils.isEmpty(this.mCard.icon.uri)) {
+ return MediaStore.Images.Media.getBitmap(context.getContentResolver(), Uri.parse(this.mCard.icon.uri));
}
+ if (!TextUtils.isEmpty(this.mCard.icon.gsaResourceName)) {
+ Intent.ShortcutIconResource shortcutIconResource = new Intent.ShortcutIconResource();
+ shortcutIconResource.packageName = "com.google.android.googlequicksearchbox";
+ shortcutIconResource.resourceName = this.mCard.icon.gsaResourceName;
+ return createIconBitmap(shortcutIconResource, context);
+ }
+ return null;
+ } catch (Exception e) {
+ Log.e("NewCardInfo", "retrieving bitmap uri=" + this.mCard.icon.uri + " gsaRes=" + this.mCard.icon.gsaResourceName);
+ return null;
}
- if (!TextUtils.isEmpty(image.gsaResourceName)) {
- Intent.ShortcutIconResource shortcutIconResource = new Intent.ShortcutIconResource();
- shortcutIconResource.packageName = "com.google.android.googlequicksearchbox";
- shortcutIconResource.resourceName = image.gsaResourceName;
- return createIconBitmap(shortcutIconResource, context);
- }
- return null;
}
- public CardWrapper toWrapper(Context context) {
- CardWrapper cardWrapper = new CardWrapper();
+ public SmartspaceProto.CardWrapper toWrapper(Context context) {
+ SmartspaceProto.CardWrapper cardWrapper = new SmartspaceProto.CardWrapper();
Bitmap retrieveIcon = retrieveIcon(context);
if (retrieveIcon != null) {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
retrieveIcon.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream);
cardWrapper.icon = byteArrayOutputStream.toByteArray();
}
- cardWrapper.card = mCard;
- cardWrapper.publishTime = mPublishTime;
- PackageInfo packageInfo = mPackageInfo;
+ cardWrapper.card = this.mCard;
+ cardWrapper.publishTime = this.mPublishTime;
+ PackageInfo packageInfo = this.mPackageInfo;
if (packageInfo != null) {
cardWrapper.gsaVersionCode = packageInfo.versionCode;
cardWrapper.gsaUpdateTime = packageInfo.lastUpdateTime;
@@ -92,35 +76,29 @@
}
private static <T> T retrieveFromIntent(String str, Intent intent) {
- if (!TextUtils.isEmpty(str)) {
- return (T) intent.getParcelableExtra(str);
+ if (TextUtils.isEmpty(str)) {
+ return null;
}
- return null;
+ return (T) intent.getParcelableExtra(str);
}
- static Bitmap createIconBitmap(
- Intent.ShortcutIconResource shortcutIconResource, Context context) {
+ static Bitmap createIconBitmap(Intent.ShortcutIconResource shortcutIconResource, Context context) {
try {
- Resources resourcesForApplication =
- context.getPackageManager()
- .getResourcesForApplication(shortcutIconResource.packageName);
+ Resources resourcesForApplication = context.getPackageManager().getResourcesForApplication(shortcutIconResource.packageName);
if (resourcesForApplication != null) {
- return BitmapFactory.decodeResource(
- resourcesForApplication,
- resourcesForApplication.getIdentifier(
- shortcutIconResource.resourceName, null, null));
+ return BitmapFactory.decodeResource(resourcesForApplication, resourcesForApplication.getIdentifier(shortcutIconResource.resourceName, null, null));
}
- } catch (Exception unused) {
+ return null;
+ } catch (Exception e) {
+ return null;
}
- return null;
}
public int getUserId() {
- return mIntent.getIntExtra("uid", -1);
+ return this.mIntent.getIntExtra("uid", -1);
}
public boolean shouldDiscard() {
- SmartspaceUpdate.SmartspaceCard smartspaceCard = mCard;
- return smartspaceCard == null || smartspaceCard.shouldDiscard;
+ return this.mCard == null || this.mCard.shouldDiscard;
}
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/PageIndicator.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/PageIndicator.java
index 1ac372b..6bde5ea 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/PageIndicator.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/PageIndicator.java
@@ -5,148 +5,143 @@
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.Log;
-import android.view.View;
+import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
-
-import androidx.appcompat.content.res.AppCompatResources;
-
import com.android.systemui.bcsmartspace.R;
public class PageIndicator extends LinearLayout {
- private int mPrimaryColor = getAttrColor(getContext(), 16842806);
- private int mCurrentPageIndex = -1;
- private int mNumPages = -1;
+ public int mCurrentPageIndex;
+ public int mNumPages;
+ public int mPrimaryColor;
public PageIndicator(Context context) {
super(context);
+ this.mPrimaryColor = getAttrColor(getContext(), 16842806);
+ this.mCurrentPageIndex = -1;
+ this.mNumPages = -1;
}
- public PageIndicator(Context context, AttributeSet attributeSet) {
- super(context, attributeSet);
+ public PageIndicator(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ this.mPrimaryColor = getAttrColor(getContext(), 16842806);
+ this.mCurrentPageIndex = -1;
+ this.mNumPages = -1;
}
- public PageIndicator(Context context, AttributeSet attributeSet, int i) {
- super(context, attributeSet, i);
+ public PageIndicator(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ this.mPrimaryColor = getAttrColor(getContext(), 16842806);
+ this.mCurrentPageIndex = -1;
+ this.mNumPages = -1;
}
- public PageIndicator(Context context, AttributeSet attributeSet, int i, int i2) {
- super(context, attributeSet, i, i2);
+ public PageIndicator(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+ super(context, attrs, defStyleAttr, defStyleRes);
+ this.mPrimaryColor = getAttrColor(getContext(), 16842806);
+ this.mCurrentPageIndex = -1;
+ this.mNumPages = -1;
}
- public void setNumPages(int i) {
- if (i <= 0) {
- Log.w("PageIndicator", "Total number of pages invalid: " + i + ". Assuming 1 page.");
- i = 1;
+ public static int getAttrColor(Context context, int attr) {
+ TypedArray obtainStyledAttributes = context.obtainStyledAttributes(new int[]{attr});
+ int color = obtainStyledAttributes.getColor(0, 0);
+ obtainStyledAttributes.recycle();
+ return color;
+ }
+
+ public void setNumPages(int pages) {
+ if (pages <= 0) {
+ Log.w("PageIndicator", "Total number of pages invalid: " + pages + ". Assuming 1 page.");
+ pages = 1;
}
- if (i < 2) {
- setVisibility(View.GONE);
+ if (pages < 2) {
+ BcSmartspaceTemplateDataUtils.updateVisibility(this, 8);
return;
}
- setVisibility(View.VISIBLE);
- if (i == mNumPages) {
- return;
+ BcSmartspaceTemplateDataUtils.updateVisibility(this, 0);
+ if (pages != this.mNumPages) {
+ this.mNumPages = pages;
+ initializePageIndicators();
}
- mNumPages = i;
- initializePageIndicators();
}
- public void setPageOffset(int i, float f) {
- int i2 = (f > 0.0f ? 1 : (f == 0.0f ? 0 : -1));
- if (!(i2 == 0 && i == mCurrentPageIndex) && i >= 0 && i < getChildCount() - 1) {
- ImageView imageView = (ImageView) getChildAt(i);
- int i3 = i + 1;
- ImageView imageView2 = (ImageView) getChildAt(i3);
- if (imageView == null || imageView2 == null) {
- return;
+ public void setPrimaryColor(int color) {
+ this.mPrimaryColor = color;
+ for (int i = 0; i < getChildCount(); i++) {
+ ((ImageView) getChildAt(i)).getDrawable().setTint(this.mPrimaryColor);
+ }
+ }
+
+ public void setPageOffset(int position, float positionOffset) {
+ int i4 = Float.compare(positionOffset, 0.0f);
+ if ((i4 != 0 || position != this.mCurrentPageIndex) && position >= 0 && position < getChildCount() - 1) {
+ ImageView imageView = (ImageView) getChildAt(position);
+ int childIndex = position + 1;
+ ImageView imageView2 = (ImageView) getChildAt(childIndex);
+ if (imageView != null && imageView2 != null) {
+ if (i4 == 0 || positionOffset >= 0.99f) {
+ if (this.mCurrentPageIndex >= 0 && this.mCurrentPageIndex < getChildCount()) {
+ getChildAt(this.mCurrentPageIndex).setAlpha(0.4f);
+ }
+ this.mCurrentPageIndex = i4 == 0 ? position : childIndex;
+ }
+ imageView.setAlpha(((1.0f - positionOffset) * 0.6f) + 0.4f);
+ imageView2.setAlpha((0.6f * positionOffset) + 0.4f);
+ if (positionOffset >= 0.5d) {
+ childIndex = position + 2;
+ }
+ Object[] offset = {Integer.valueOf(childIndex), Integer.valueOf(this.mNumPages)};
+ setContentDescription(getContext().getString(R.string.accessibility_smartspace_page, offset));
}
- imageView.setAlpha(((1.0f - f) * 0.6f) + 0.4f);
- imageView2.setAlpha((0.6f * f) + 0.4f);
- Context context = getContext();
- int i4 = R.string.accessibility_smartspace_page;
- Object[] objArr = new Object[2];
- objArr[0] = Integer.valueOf(((double) f) < 0.5d ? i3 : i + 2);
- objArr[1] = Integer.valueOf(mNumPages);
- setContentDescription(context.getString(i4, objArr));
- if (i2 != 0 && f < 0.99f) {
- return;
- }
- if (i2 != 0) {
- i = i3;
- }
- mCurrentPageIndex = i;
}
}
private void initializePageIndicators() {
- LinearLayout.LayoutParams layoutParams;
- int childCount = getChildCount() - mNumPages;
+ LinearLayout.LayoutParams lp;
+ int childCount = getChildCount() - this.mNumPages;
for (int i = 0; i < childCount; i++) {
removeViewAt(0);
}
- int dimensionPixelSize =
- getContext()
- .getResources()
- .getDimensionPixelSize(R.dimen.page_indicator_dot_margin);
+ int dimensionPixelSize = getContext().getResources().getDimensionPixelSize(R.dimen.page_indicator_dot_margin);
int i2 = 0;
- while (i2 < mNumPages) {
- ImageView imageView =
- i2 < getChildCount() ? (ImageView) getChildAt(i2) : new ImageView(getContext());
+ while (i2 < this.mNumPages) {
+ ImageView imageView = i2 < getChildCount() ? (ImageView) getChildAt(i2) : new ImageView(getContext());
if (i2 < getChildCount()) {
- layoutParams = (LinearLayout.LayoutParams) imageView.getLayoutParams();
+ lp = (LinearLayout.LayoutParams) imageView.getLayoutParams();
} else {
- layoutParams = new LinearLayout.LayoutParams(-2, -2);
+ lp = new LinearLayout.LayoutParams(-2, -2);
}
if (i2 == 0) {
- layoutParams.setMarginStart(0);
+ lp.setMarginStart(0);
} else {
- layoutParams.setMarginStart(dimensionPixelSize);
+ lp.setMarginStart(dimensionPixelSize);
}
- if (i2 == mNumPages - 1) {
- layoutParams.setMarginEnd(0);
+ if (i2 == this.mNumPages - 1) {
+ lp.setMarginEnd(0);
} else {
- layoutParams.setMarginEnd(dimensionPixelSize);
+ lp.setMarginEnd(dimensionPixelSize);
}
if (i2 < getChildCount()) {
- imageView.setLayoutParams(layoutParams);
+ imageView.setLayoutParams(lp);
} else {
- Drawable drawable =
- AppCompatResources.getDrawable(getContext(), R.drawable.page_indicator_dot);
- drawable.setTint(mPrimaryColor);
+ Drawable drawable = getContext().getResources().getDrawable(R.drawable.page_indicator_dot, getContext().getTheme());
+ drawable.setTint(this.mPrimaryColor);
imageView.setImageDrawable(drawable);
- addView(imageView, layoutParams);
+ addView(imageView, lp);
}
- int i3 = mCurrentPageIndex;
- if (i3 < 0) {
- mCurrentPageIndex = 0;
+ int index = this.mCurrentPageIndex;
+ if (index < 0) {
+ this.mCurrentPageIndex = 0;
} else {
- int i4 = mNumPages;
- if (i3 >= i4) {
- mCurrentPageIndex = i4 - 1;
+ int numPages = this.mNumPages;
+ if (index >= numPages) {
+ this.mCurrentPageIndex = numPages - 1;
}
}
- imageView.setAlpha(i2 == mCurrentPageIndex ? 1.0f : 0.4f);
+ imageView.setAlpha(i2 == this.mCurrentPageIndex ? 1.0f : 0.4f);
i2++;
}
- setContentDescription(
- getContext()
- .getString(
- R.string.accessibility_smartspace_page,
- 1,
- Integer.valueOf(mNumPages)));
- }
-
- public void setPrimaryColor(int i) {
- mPrimaryColor = i;
- for (int i2 = 0; i2 < getChildCount(); i2++) {
- ((ImageView) getChildAt(i2)).getDrawable().setTint(mPrimaryColor);
- }
- }
-
- public static int getAttrColor(Context context, int i) {
- TypedArray obtainStyledAttributes = context.obtainStyledAttributes(new int[] {i});
- int color = obtainStyledAttributes.getColor(0, 0);
- obtainStyledAttributes.recycle();
- return color;
+ setContentDescription(getContext().getString(R.string.accessibility_smartspace_page, 1, Integer.valueOf(this.mNumPages)));
}
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/ProtoStore.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/ProtoStore.java
index 6477ad6..c764d76 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/ProtoStore.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/ProtoStore.java
@@ -2,65 +2,54 @@
import android.content.Context;
import android.util.Log;
-
+import com.android.systemui.smartspace.nano.SmartspaceProto;
import com.google.protobuf.nano.MessageNano;
-
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
public class ProtoStore {
- private final Context mContext;
+ public final Context mContext;
public ProtoStore(Context context) {
- mContext = context.getApplicationContext();
+ this.mContext = context.getApplicationContext();
}
- public void store(MessageNano messageNano, String str) {
+ public void store(SmartspaceProto.CardWrapper cardWrapper, String str) {
try {
- FileOutputStream openFileOutput = mContext.openFileOutput(str, 0);
- if (messageNano != null) {
- openFileOutput.write(MessageNano.toByteArray(messageNano));
+ FileOutputStream openFileOutput = this.mContext.openFileOutput(str, 0);
+ if (cardWrapper != null) {
+ openFileOutput.write(MessageNano.toByteArray(cardWrapper));
} else {
Log.d("ProtoStore", "deleting " + str);
- mContext.deleteFile(str);
+ this.mContext.deleteFile(str);
}
- if (openFileOutput == null) {
- return;
+ if (openFileOutput != null) {
+ openFileOutput.close();
}
- openFileOutput.close();
- } catch (FileNotFoundException unused) {
+ } catch (FileNotFoundException e) {
Log.d("ProtoStore", "file does not exist");
- } catch (Exception e) {
- Log.e("ProtoStore", "unable to write file", e);
+ } catch (Exception ex) {
+ Log.e("ProtoStore", "unable to write file", ex);
}
}
public <T extends MessageNano> boolean load(String str, T t) {
- File fileStreamPath = mContext.getFileStreamPath(str);
+ File fileStreamPath = this.mContext.getFileStreamPath(str);
try {
FileInputStream fileInputStream = new FileInputStream(fileStreamPath);
- try {
- int length = (int) fileStreamPath.length();
- byte[] bArr = new byte[length];
- fileInputStream.read(bArr, 0, length);
- MessageNano.mergeFrom(t, bArr);
- fileInputStream.close();
- return true;
- } catch (Throwable th) {
- try {
- fileInputStream.close();
- } catch (Throwable th2) {
- th.addSuppressed(th2);
- }
- throw th;
- }
- } catch (FileNotFoundException unused) {
+ int length = (int) fileStreamPath.length();
+ byte[] bArr = new byte[length];
+ fileInputStream.read(bArr, 0, length);
+ MessageNano.mergeFrom(t, bArr);
+ fileInputStream.close();
+ return true;
+ } catch (FileNotFoundException e) {
Log.d("ProtoStore", "no cached data");
return false;
- } catch (Exception e) {
- Log.e("ProtoStore", "unable to load data", e);
+ } catch (Exception ex) {
+ Log.e("ProtoStore", "unable to load data", ex);
return false;
}
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardLogger.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardLogger.java
index 73f1032..f96c771 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardLogger.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardLogger.java
@@ -1,36 +1,44 @@
package com.google.android.systemui.smartspace.logging;
+import android.os.Debug;
import android.util.Log;
-
import com.android.systemui.shared.system.SysUiStatsLog;
-
-import com.google.android.systemui.smartspace.BcSmartSpaceUtil;
+import com.android.systemui.smartspace.nano.SmartspaceProto;
import com.google.android.systemui.smartspace.EventEnum;
+import com.google.protobuf.nano.MessageNano;
+import java.util.ArrayList;
+import java.util.List;
-public class BcSmartspaceCardLogger {
- private static final boolean IS_VERBOSE = BcSmartSpaceUtil.isLoggable("StatsLog");
+public final class BcSmartspaceCardLogger {
+ public static final String TAG = "StatsLog";
+ public static final boolean IS_VERBOSE = Log.isLoggable(TAG, 2);
- public static void log(
- EventEnum eventEnum, BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
- SysUiStatsLog.write(
- 352,
- eventEnum.getId(),
- bcSmartspaceCardLoggingInfo.getInstanceId(),
- 0,
- bcSmartspaceCardLoggingInfo.getDisplaySurface(),
- bcSmartspaceCardLoggingInfo.getRank(),
- bcSmartspaceCardLoggingInfo.getCardinality(),
- bcSmartspaceCardLoggingInfo.getFeatureType(),
- -1,
- 0,
- 0,
- Integer.toString(bcSmartspaceCardLoggingInfo.getReceivedLatency()));
+ public static void log(EventEnum eventEnum, BcSmartspaceCardLoggingInfo cardInfo) {
+ byte[] subcardList;
+ BcSmartspaceSubcardLoggingInfo subcardInfo = cardInfo.mSubcardInfo;
+ if (subcardInfo != null && subcardInfo.mSubcards != null && !subcardInfo.mSubcards.isEmpty()) {
+ SmartspaceProto.SmartSpaceSubcards subcards = new SmartspaceProto.SmartSpaceSubcards();
+ subcards.clickedSubcardIndex = subcardInfo.mClickedSubcardIndex;
+ List<BcSmartspaceCardMetadataLoggingInfo> metadataLogging = subcardInfo.mSubcards;
+ ArrayList<SmartspaceProto.SmartSpaceCardMetadata> metadata = new ArrayList<>();
+ metadataLogging.forEach(metaDataLoggingList -> {
+ SmartspaceProto.SmartSpaceCardMetadata cardMetadata = new SmartspaceProto.SmartSpaceCardMetadata();
+ cardMetadata.instanceId = metaDataLoggingList.mInstanceId;
+ cardMetadata.cardTypeId = metaDataLoggingList.mCardTypeId;
+ metadata.add(cardMetadata);
+ });
+ subcards.subcards = (SmartspaceProto.SmartSpaceCardMetadata[]) metadata.toArray(new SmartspaceProto.SmartSpaceCardMetadata[0]);
+ subcardList = MessageNano.toByteArray(subcards);
+ } else {
+ subcardList = null;
+ }
+ writeLog(eventEnum, cardInfo, subcardList);
+ }
+
+ static void writeLog(EventEnum eventEnum, BcSmartspaceCardLoggingInfo cardInfo, byte[] subcards) {
+ SysUiStatsLog.write(352, eventEnum.getId(), cardInfo.mInstanceId, 0, cardInfo.mDisplaySurface, cardInfo.mRank, cardInfo.mCardinality, cardInfo.mFeatureType, cardInfo.mUid, 0, 0, cardInfo.mReceivedLatency, subcards);
if (IS_VERBOSE) {
- Log.d(
- "StatsLog",
- String.format(
- "\nLogged Smartspace event(%s), info(%s)",
- eventEnum, bcSmartspaceCardLoggingInfo.toString()));
+ Log.d(TAG, String.format("\nLogged Smartspace event(%s), info(%s), callers=%s", eventEnum, cardInfo.toString(), Debug.getCallers(5)));
}
}
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardLoggerUtil.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardLoggerUtil.java
index aa71432..200f5bc 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardLoggerUtil.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardLoggerUtil.java
@@ -2,97 +2,124 @@
import android.app.smartspace.SmartspaceAction;
import android.app.smartspace.SmartspaceTarget;
-
-import com.android.systemui.smartspace.nano.SmartspaceProto.SmartSpaceCardMetadata;
-import com.android.systemui.smartspace.nano.SmartspaceProto.SmartSpaceSubcards;
-
+import android.app.smartspace.uitemplatedata.BaseTemplateData;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import android.text.TextUtils;
import com.google.android.systemui.smartspace.InstanceId;
-import com.google.protobuf.nano.MessageNano;
-
+import com.google.android.systemui.smartspace.logging.BcSmartspaceCardMetadataLoggingInfo;
+import com.google.android.systemui.smartspace.logging.BcSmartspaceSubcardLoggingInfo;
import java.util.ArrayList;
import java.util.List;
-public class BcSmartspaceCardLoggerUtil {
- public static byte[] convertSubcardInfoToBytes(
- BcSmartspaceSubcardLoggingInfo bcSmartspaceSubcardLoggingInfo) {
- if (bcSmartspaceSubcardLoggingInfo == null
- || bcSmartspaceSubcardLoggingInfo.getSubcards() == null
- || bcSmartspaceSubcardLoggingInfo.getSubcards().isEmpty()) {
- return null;
- }
- SmartSpaceSubcards smartSpaceSubcards = new SmartSpaceSubcards();
- smartSpaceSubcards.clickedSubcardIndex =
- bcSmartspaceSubcardLoggingInfo.getClickedSubcardIndex();
- List<BcSmartspaceCardMetadataLoggingInfo> subcards =
- bcSmartspaceSubcardLoggingInfo.getSubcards();
- ArrayList arrayList = new ArrayList();
- for (int i = 0; i < subcards.size(); i++) {
- BcSmartspaceCardMetadataLoggingInfo bcSmartspaceCardMetadataLoggingInfo =
- subcards.get(i);
- SmartSpaceCardMetadata smartSpaceCardMetadata = new SmartSpaceCardMetadata();
- smartSpaceCardMetadata.instanceId = bcSmartspaceCardMetadataLoggingInfo.getInstanceId();
- smartSpaceCardMetadata.cardTypeId = bcSmartspaceCardMetadataLoggingInfo.getCardTypeId();
- arrayList.add(smartSpaceCardMetadata);
- }
- smartSpaceSubcards.subcards =
- (SmartSpaceCardMetadata[])
- arrayList.toArray(new SmartSpaceCardMetadata[arrayList.size()]);
- return MessageNano.toByteArray(smartSpaceSubcards);
- }
-
- public static void forcePrimaryFeatureTypeAndInjectWeatherSubcard(
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo,
- SmartspaceTarget smartspaceTarget,
- int i) {
- if (bcSmartspaceCardLoggingInfo == null
- || bcSmartspaceCardLoggingInfo.getFeatureType() != 1) {
- return;
- }
- bcSmartspaceCardLoggingInfo.setFeatureType(i);
- if ("date_card_794317_92634".equals(smartspaceTarget.getSmartspaceTargetId())) {
- return;
- }
- if (bcSmartspaceCardLoggingInfo.getSubcardInfo() == null) {
- bcSmartspaceCardLoggingInfo.setSubcardInfo(
- new BcSmartspaceSubcardLoggingInfo.Builder()
- .setClickedSubcardIndex(0)
- .setSubcards(new ArrayList())
- .build());
- }
- if (bcSmartspaceCardLoggingInfo.getSubcardInfo().getSubcards() == null) {
- bcSmartspaceCardLoggingInfo.getSubcardInfo().setSubcards(new ArrayList());
- }
- bcSmartspaceCardLoggingInfo
- .getSubcardInfo()
- .getSubcards()
- .add(
- new BcSmartspaceCardMetadataLoggingInfo.Builder()
- .setInstanceId(InstanceId.create(smartspaceTarget))
- .setCardTypeId(1)
- .build());
- }
-
- public static BcSmartspaceSubcardLoggingInfo createSubcardLoggingInfo(
- SmartspaceTarget smartspaceTarget) {
- if (smartspaceTarget == null
- || smartspaceTarget.getBaseAction() == null
- || smartspaceTarget.getBaseAction().getExtras() == null
- || smartspaceTarget.getBaseAction().getExtras().isEmpty()
- || smartspaceTarget.getBaseAction().getExtras().getInt("subcardType", -1) == -1) {
+public final class BcSmartspaceCardLoggerUtil {
+ public static BcSmartspaceSubcardLoggingInfo createSubcardLoggingInfo(SmartspaceTarget smartspaceTarget) {
+ if (smartspaceTarget == null || smartspaceTarget.getBaseAction() == null || smartspaceTarget.getBaseAction().getExtras() == null || smartspaceTarget.getBaseAction().getExtras().isEmpty() || smartspaceTarget.getBaseAction().getExtras().getInt("subcardType", -1) == -1) {
return null;
}
SmartspaceAction baseAction = smartspaceTarget.getBaseAction();
int create = InstanceId.create(baseAction.getExtras().getString("subcardId"));
- BcSmartspaceCardMetadataLoggingInfo build =
- new BcSmartspaceCardMetadataLoggingInfo.Builder()
- .setInstanceId(create)
- .setCardTypeId(baseAction.getExtras().getInt("subcardType"))
- .build();
+ int i = baseAction.getExtras().getInt("subcardType");
+ BcSmartspaceCardMetadataLoggingInfo.Builder builder = new BcSmartspaceCardMetadataLoggingInfo.Builder();
+ builder.mInstanceId = create;
+ builder.mCardTypeId = i;
+ BcSmartspaceCardMetadataLoggingInfo bcSmartspaceCardMetadataLoggingInfo = new BcSmartspaceCardMetadataLoggingInfo(builder);
ArrayList arrayList = new ArrayList();
- arrayList.add(build);
- return new BcSmartspaceSubcardLoggingInfo.Builder()
- .setSubcards(arrayList)
- .setClickedSubcardIndex(0)
- .build();
+ arrayList.add(bcSmartspaceCardMetadataLoggingInfo);
+ BcSmartspaceSubcardLoggingInfo.Builder builder2 = new BcSmartspaceSubcardLoggingInfo.Builder();
+ builder2.mSubcards = arrayList;
+ builder2.mClickedSubcardIndex = 0;
+ return new BcSmartspaceSubcardLoggingInfo(builder2);
+ }
+
+ public static int getUid(PackageManager packageManager, SmartspaceTarget smartspaceTarget) {
+ int i = -1;
+ if (packageManager != null) {
+ i = -1;
+ if (smartspaceTarget != null) {
+ i = -1;
+ if (smartspaceTarget.getComponentName() != null) {
+ i = -1;
+ if (!TextUtils.isEmpty(smartspaceTarget.getComponentName().getPackageName())) {
+ if ("package_name".equals(smartspaceTarget.getComponentName().getPackageName())) {
+ i = -1;
+ } else {
+ try {
+ ApplicationInfo applicationInfo = packageManager.getApplicationInfo(smartspaceTarget.getComponentName().getPackageName(), PackageManager.ApplicationInfoFlags.of(0L));
+ i = -1;
+ if (applicationInfo != null) {
+ i = applicationInfo.uid;
+ }
+ } catch (PackageManager.NameNotFoundException e) {
+ i = -1;
+ }
+ }
+ }
+ }
+ }
+ }
+ return i;
+ }
+
+ public static void createSubcardLoggingInfoHelper(ArrayList arrayList, BaseTemplateData.SubItemInfo subItemInfo) {
+ if (subItemInfo != null && subItemInfo.getLoggingInfo() != null) {
+ BaseTemplateData.SubItemLoggingInfo loggingInfo = subItemInfo.getLoggingInfo();
+ BcSmartspaceCardMetadataLoggingInfo.Builder builder = new BcSmartspaceCardMetadataLoggingInfo.Builder();
+ builder.mCardTypeId = loggingInfo.getFeatureType();
+ builder.mInstanceId = loggingInfo.getInstanceId();
+ arrayList.add(new BcSmartspaceCardMetadataLoggingInfo(builder));
+ }
+ }
+
+ public static boolean tryForcePrimaryFeatureType(BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
+ if (bcSmartspaceCardLoggingInfo.mFeatureType != 1) {
+ return false;
+ }
+ bcSmartspaceCardLoggingInfo.mFeatureType = 39;
+ bcSmartspaceCardLoggingInfo.mInstanceId = InstanceId.create("date_card_794317_92634");
+ return true;
+ }
+
+ public static void tryForcePrimaryFeatureTypeAndInjectWeatherSubcard(BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo, SmartspaceTarget smartspaceTarget) {
+ if (tryForcePrimaryFeatureType(bcSmartspaceCardLoggingInfo) && smartspaceTarget != null && !"date_card_794317_92634".equals(smartspaceTarget.getSmartspaceTargetId())) {
+ if (bcSmartspaceCardLoggingInfo.mSubcardInfo == null) {
+ BcSmartspaceSubcardLoggingInfo.Builder builder = new BcSmartspaceSubcardLoggingInfo.Builder();
+ builder.mClickedSubcardIndex = 0;
+ builder.mSubcards = new ArrayList();
+ bcSmartspaceCardLoggingInfo.mSubcardInfo = new BcSmartspaceSubcardLoggingInfo(builder);
+ }
+ BcSmartspaceSubcardLoggingInfo bcSmartspaceSubcardLoggingInfo = bcSmartspaceCardLoggingInfo.mSubcardInfo;
+ if (bcSmartspaceSubcardLoggingInfo.mSubcards == null) {
+ bcSmartspaceSubcardLoggingInfo.mSubcards = new ArrayList();
+ }
+ if (bcSmartspaceCardLoggingInfo.mSubcardInfo.mSubcards.size() == 0 || (bcSmartspaceCardLoggingInfo.mSubcardInfo.mSubcards.get(0) != null && bcSmartspaceCardLoggingInfo.mSubcardInfo.mSubcards.get(0).mCardTypeId != 1)) {
+ List<BcSmartspaceCardMetadataLoggingInfo> list = bcSmartspaceCardLoggingInfo.mSubcardInfo.mSubcards;
+ BcSmartspaceCardMetadataLoggingInfo.Builder builder2 = new BcSmartspaceCardMetadataLoggingInfo.Builder();
+ builder2.mInstanceId = InstanceId.create(smartspaceTarget);
+ builder2.mCardTypeId = 1;
+ list.add(0, new BcSmartspaceCardMetadataLoggingInfo(builder2));
+ BcSmartspaceSubcardLoggingInfo bcSmartspaceSubcardLoggingInfo2 = bcSmartspaceCardLoggingInfo.mSubcardInfo;
+ int i = bcSmartspaceSubcardLoggingInfo2.mClickedSubcardIndex;
+ if (i > 0) {
+ bcSmartspaceSubcardLoggingInfo2.mClickedSubcardIndex = i + 1;
+ }
+ }
+ }
+ }
+
+ public static BcSmartspaceSubcardLoggingInfo createSubcardLoggingInfo(BaseTemplateData baseTemplateData) {
+ if (baseTemplateData == null) {
+ return null;
+ }
+ ArrayList arrayList = new ArrayList();
+ createSubcardLoggingInfoHelper(arrayList, baseTemplateData.getSubtitleItem());
+ createSubcardLoggingInfoHelper(arrayList, baseTemplateData.getSubtitleSupplementalItem());
+ createSubcardLoggingInfoHelper(arrayList, baseTemplateData.getSupplementalLineItem());
+ if (arrayList.isEmpty()) {
+ return null;
+ }
+ BcSmartspaceSubcardLoggingInfo.Builder builder = new BcSmartspaceSubcardLoggingInfo.Builder();
+ builder.mSubcards = arrayList;
+ return new BcSmartspaceSubcardLoggingInfo(builder);
}
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardLoggingInfo.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardLoggingInfo.java
index 808ae13..5b99d9d 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardLoggingInfo.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardLoggingInfo.java
@@ -1,124 +1,75 @@
package com.google.android.systemui.smartspace.logging;
-public class BcSmartspaceCardLoggingInfo {
- private final int mCardinality;
- private final int mDisplaySurface;
- private int mFeatureType;
- private final int mInstanceId;
- private final int mRank;
- private final int mReceivedLatency;
- private BcSmartspaceSubcardLoggingInfo mSubcardInfo;
+import java.util.Objects;
- private BcSmartspaceCardLoggingInfo(Builder builder) {
- mInstanceId = builder.mInstanceId;
- mDisplaySurface = builder.mDisplaySurface;
- mRank = builder.mRank;
- mCardinality = builder.mCardinality;
- mFeatureType = builder.mFeatureType;
- mReceivedLatency = builder.mReceivedLatency;
- mSubcardInfo = builder.mSubcardInfo;
+public final class BcSmartspaceCardLoggingInfo {
+ public final int mCardinality;
+ public final int mDisplaySurface;
+ public int mFeatureType;
+ public int mInstanceId;
+ public final int mRank;
+ public final int mReceivedLatency;
+ public BcSmartspaceSubcardLoggingInfo mSubcardInfo;
+ public final int mUid;
+
+ public static final class Builder {
+ public int mCardinality;
+ public int mDisplaySurface = 1;
+ public int mFeatureType;
+ public int mInstanceId;
+ public int mRank;
+ public int mReceivedLatency;
+ public BcSmartspaceSubcardLoggingInfo mSubcardInfo;
+ public int mUid;
}
- public int getInstanceId() {
- return mInstanceId;
- }
-
- public int getDisplaySurface() {
- return mDisplaySurface;
- }
-
- public int getRank() {
- return mRank;
- }
-
- public int getCardinality() {
- return mCardinality;
- }
-
- public int getFeatureType() {
- return mFeatureType;
- }
-
- public int getReceivedLatency() {
- return mReceivedLatency;
- }
-
- public BcSmartspaceSubcardLoggingInfo getSubcardInfo() {
- return mSubcardInfo;
- }
-
- public void setFeatureType(int i) {
- mFeatureType = i;
- }
-
- public void setSubcardInfo(BcSmartspaceSubcardLoggingInfo bcSmartspaceSubcardLoggingInfo) {
- mSubcardInfo = bcSmartspaceSubcardLoggingInfo;
- }
-
- public String toString() {
- return "instance_id = "
- + getInstanceId()
- + ", feature type = "
- + getFeatureType()
- + ", display surface = "
- + getDisplaySurface()
- + ", rank = "
- + getRank()
- + ", cardinality = "
- + getCardinality()
- + ", receivedLatencyMillis = "
- + getReceivedLatency()
- + ", subcardInfo = "
- + getSubcardInfo();
- }
-
- public static class Builder {
- private int mCardinality;
- private int mDisplaySurface = 1;
- private int mFeatureType;
- private int mInstanceId;
- private int mRank;
- private int mReceivedLatency;
- private BcSmartspaceSubcardLoggingInfo mSubcardInfo;
-
- public Builder setInstanceId(int i) {
- mInstanceId = i;
- return this;
+ public final boolean equals(Object obj) {
+ boolean z = true;
+ if (this == obj) {
+ return true;
}
-
- public Builder setDisplaySurface(int i) {
- mDisplaySurface = i;
- return this;
+ if (!(obj instanceof BcSmartspaceCardLoggingInfo)) {
+ return false;
}
-
- public Builder setRank(int i) {
- mRank = i;
- return this;
+ BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo = (BcSmartspaceCardLoggingInfo) obj;
+ if (this.mInstanceId != bcSmartspaceCardLoggingInfo.mInstanceId || this.mDisplaySurface != bcSmartspaceCardLoggingInfo.mDisplaySurface || this.mRank != bcSmartspaceCardLoggingInfo.mRank || this.mCardinality != bcSmartspaceCardLoggingInfo.mCardinality || this.mFeatureType != bcSmartspaceCardLoggingInfo.mFeatureType || this.mReceivedLatency != bcSmartspaceCardLoggingInfo.mReceivedLatency || this.mUid != bcSmartspaceCardLoggingInfo.mUid || !Objects.equals(this.mSubcardInfo, bcSmartspaceCardLoggingInfo.mSubcardInfo)) {
+ z = false;
}
+ return z;
+ }
- public Builder setCardinality(int i) {
- mCardinality = i;
- return this;
- }
+ public final String toString() {
+ StringBuilder m = LogBuilder.m("instance_id = ");
+ m.append(this.mInstanceId);
+ m.append(", feature type = ");
+ m.append(this.mFeatureType);
+ m.append(", display surface = ");
+ m.append(this.mDisplaySurface);
+ m.append(", rank = ");
+ m.append(this.mRank);
+ m.append(", cardinality = ");
+ m.append(this.mCardinality);
+ m.append(", receivedLatencyMillis = ");
+ m.append(this.mReceivedLatency);
+ m.append(", uid = ");
+ m.append(this.mUid);
+ m.append(", subcardInfo = ");
+ m.append(this.mSubcardInfo);
+ return m.toString();
+ }
- public Builder setFeatureType(int i) {
- mFeatureType = i;
- return this;
- }
+ public BcSmartspaceCardLoggingInfo(Builder builder) {
+ this.mInstanceId = builder.mInstanceId;
+ this.mDisplaySurface = builder.mDisplaySurface;
+ this.mRank = builder.mRank;
+ this.mCardinality = builder.mCardinality;
+ this.mFeatureType = builder.mFeatureType;
+ this.mReceivedLatency = builder.mReceivedLatency;
+ this.mUid = builder.mUid;
+ this.mSubcardInfo = builder.mSubcardInfo;
+ }
- public Builder setReceivedLatency(int i) {
- mReceivedLatency = i;
- return this;
- }
-
- public Builder setSubcardInfo(
- BcSmartspaceSubcardLoggingInfo bcSmartspaceSubcardLoggingInfo) {
- mSubcardInfo = bcSmartspaceSubcardLoggingInfo;
- return this;
- }
-
- public BcSmartspaceCardLoggingInfo build() {
- return new BcSmartspaceCardLoggingInfo(this);
- }
+ public final int hashCode() {
+ return Objects.hash(Integer.valueOf(this.mInstanceId), Integer.valueOf(this.mDisplaySurface), Integer.valueOf(this.mRank), Integer.valueOf(this.mCardinality), Integer.valueOf(this.mFeatureType), Integer.valueOf(this.mReceivedLatency), Integer.valueOf(this.mUid), this.mSubcardInfo);
}
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardMetadataLoggingInfo.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardMetadataLoggingInfo.java
index ae47291..8efb86f 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardMetadataLoggingInfo.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardMetadataLoggingInfo.java
@@ -1,46 +1,44 @@
package com.google.android.systemui.smartspace.logging;
-public class BcSmartspaceCardMetadataLoggingInfo {
- private final int mCardTypeId;
- private final int mInstanceId;
+import java.util.Objects;
- private BcSmartspaceCardMetadataLoggingInfo(Builder builder) {
- mInstanceId = builder.mInstanceId;
- mCardTypeId = builder.mCardTypeId;
+public final class BcSmartspaceCardMetadataLoggingInfo {
+ public final int mCardTypeId;
+ public final int mInstanceId;
+
+ public static final class Builder {
+ public int mCardTypeId;
+ public int mInstanceId;
}
- public int getInstanceId() {
- return mInstanceId;
- }
-
- public int getCardTypeId() {
- return mCardTypeId;
- }
-
- public String toString() {
- return "BcSmartspaceCardMetadataLoggingInfo{mInstanceId="
- + mInstanceId
- + ", mCardTypeId="
- + mCardTypeId
- + '}';
- }
-
- public static class Builder {
- private int mCardTypeId;
- private int mInstanceId;
-
- public Builder setInstanceId(int i) {
- mInstanceId = i;
- return this;
+ public final boolean equals(Object obj) {
+ boolean z = true;
+ if (this == obj) {
+ return true;
}
-
- public Builder setCardTypeId(int i) {
- mCardTypeId = i;
- return this;
+ if (!(obj instanceof BcSmartspaceCardMetadataLoggingInfo)) {
+ return false;
}
-
- public BcSmartspaceCardMetadataLoggingInfo build() {
- return new BcSmartspaceCardMetadataLoggingInfo(this);
+ BcSmartspaceCardMetadataLoggingInfo bcSmartspaceCardMetadataLoggingInfo = (BcSmartspaceCardMetadataLoggingInfo) obj;
+ if (this.mInstanceId != bcSmartspaceCardMetadataLoggingInfo.mInstanceId || this.mCardTypeId != bcSmartspaceCardMetadataLoggingInfo.mCardTypeId) {
+ z = false;
}
+ return z;
+ }
+
+ public final String toString() {
+ StringBuilder m = LogBuilder.m("BcSmartspaceCardMetadataLoggingInfo{mInstanceId=");
+ m.append(this.mInstanceId);
+ m.append(", mCardTypeId=");
+ return LogBuilder.m(m, this.mCardTypeId, '}');
+ }
+
+ public BcSmartspaceCardMetadataLoggingInfo(Builder builder) {
+ this.mInstanceId = builder.mInstanceId;
+ this.mCardTypeId = builder.mCardTypeId;
+ }
+
+ public final int hashCode() {
+ return Objects.hash(Integer.valueOf(this.mInstanceId), Integer.valueOf(this.mCardTypeId));
}
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceSubcardLoggingInfo.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceSubcardLoggingInfo.java
index 7d00cb1..24350ac 100644
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceSubcardLoggingInfo.java
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceSubcardLoggingInfo.java
@@ -2,60 +2,50 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
-public class BcSmartspaceSubcardLoggingInfo {
- private int mClickedSubcardIndex;
- private List<BcSmartspaceCardMetadataLoggingInfo> mSubcards;
+public final class BcSmartspaceSubcardLoggingInfo {
+ public int mClickedSubcardIndex;
+ public List<BcSmartspaceCardMetadataLoggingInfo> mSubcards;
- private BcSmartspaceSubcardLoggingInfo(Builder builder) {
- if (builder.mSubcards == null) {
- mSubcards = new ArrayList();
+ public static final class Builder {
+ public int mClickedSubcardIndex;
+ public List<BcSmartspaceCardMetadataLoggingInfo> mSubcards;
+ }
+
+ public final boolean equals(Object obj) {
+ boolean z = true;
+ if (this == obj) {
+ return true;
+ }
+ if (!(obj instanceof BcSmartspaceSubcardLoggingInfo)) {
+ return false;
+ }
+ BcSmartspaceSubcardLoggingInfo bcSmartspaceSubcardLoggingInfo = (BcSmartspaceSubcardLoggingInfo) obj;
+ if (this.mClickedSubcardIndex != bcSmartspaceSubcardLoggingInfo.mClickedSubcardIndex || !Objects.equals(this.mSubcards, bcSmartspaceSubcardLoggingInfo.mSubcards)) {
+ z = false;
+ }
+ return z;
+ }
+
+ public final String toString() {
+ StringBuilder m = LogBuilder.m("BcSmartspaceSubcardLoggingInfo{mSubcards=");
+ m.append(this.mSubcards);
+ m.append(", mClickedSubcardIndex=");
+ return LogBuilder.m(m, this.mClickedSubcardIndex, '}');
+ }
+
+ public BcSmartspaceSubcardLoggingInfo(Builder builder) {
+ List<BcSmartspaceCardMetadataLoggingInfo> list = builder.mSubcards;
+ if (list != null) {
+ this.mSubcards = list;
} else {
- mSubcards = builder.mSubcards;
+ this.mSubcards = new ArrayList();
}
- mClickedSubcardIndex = builder.mClickedSubcardIndex;
+ this.mClickedSubcardIndex = builder.mClickedSubcardIndex;
}
- public List<BcSmartspaceCardMetadataLoggingInfo> getSubcards() {
- return mSubcards;
- }
-
- public void setSubcards(List<BcSmartspaceCardMetadataLoggingInfo> list) {
- mSubcards = list;
- }
-
- public int getClickedSubcardIndex() {
- return mClickedSubcardIndex;
- }
-
- public void setClickedSubcardIndex(int i) {
- mClickedSubcardIndex = i;
- }
-
- public String toString() {
- return "BcSmartspaceSubcardLoggingInfo{mSubcards="
- + mSubcards
- + ", mClickedSubcardIndex="
- + mClickedSubcardIndex
- + '}';
- }
-
- public static class Builder {
- private int mClickedSubcardIndex;
- private List<BcSmartspaceCardMetadataLoggingInfo> mSubcards;
-
- public Builder setSubcards(List<BcSmartspaceCardMetadataLoggingInfo> list) {
- mSubcards = list;
- return this;
- }
-
- public Builder setClickedSubcardIndex(int i) {
- mClickedSubcardIndex = i;
- return this;
- }
-
- public BcSmartspaceSubcardLoggingInfo build() {
- return new BcSmartspaceSubcardLoggingInfo(this);
- }
+ public final int hashCode() {
+ return Objects.hash(this.mSubcards, Integer.valueOf(this.mClickedSubcardIndex));
}
}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/LogBuilder.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/LogBuilder.java
new file mode 100644
index 0000000..63c215f
--- /dev/null
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/LogBuilder.java
@@ -0,0 +1,96 @@
+package com.google.android.systemui.smartspace.logging;
+
+import android.util.Log;
+import java.io.PrintWriter;
+
+public class LogBuilder {
+ public static StringBuilder m(String str) {
+ StringBuilder sb = new StringBuilder();
+ sb.append(str);
+ return sb;
+ }
+
+ public static void m(String str, String str2, String str3) {
+ Log.w(str3, str + str2);
+ }
+
+ public static String m(StringBuilder sb, int i, char c) {
+ sb.append(i);
+ sb.append(c);
+ return sb.toString();
+ }
+
+ public static void m(StringBuilder sb, int i, String str) {
+ sb.append(i);
+ Log.d(str, sb.toString());
+ }
+
+ public static StringBuilder m(StringBuilder sb, boolean z, PrintWriter printWriter, String str) {
+ sb.append(z);
+ printWriter.println(sb);
+ StringBuilder sb2 = new StringBuilder();
+ sb2.append(str);
+ return sb2;
+ }
+
+ public static String mnolog(String str, String str2, String str3) {
+ return str + str2 + str3;
+ }
+
+ public static StringBuilder m(char c) {
+ StringBuilder sb = new StringBuilder();
+ sb.append(c);
+ return sb;
+ }
+
+ public static StringBuilder m(String str, String str2) {
+ StringBuilder sb = new StringBuilder();
+ sb.append(str);
+ sb.append(str2);
+ return sb;
+ }
+
+ public static String m(StringBuilder sb, String str, String str2) {
+ sb.append(str);
+ sb.append(str2);
+ return sb.toString();
+ }
+
+ public static void m(String str, int i, String str2) {
+ Log.d(str2, str + i);
+ }
+
+ public static StringBuilder m(PrintWriter printWriter, String str, String str2) {
+ printWriter.println(str);
+ StringBuilder sb = new StringBuilder();
+ sb.append(str2);
+ return sb;
+ }
+
+ public static StringBuilder m(StringBuilder sb, float f, PrintWriter printWriter, String str) {
+ sb.append(f);
+ printWriter.println(sb);
+ StringBuilder sb2 = new StringBuilder();
+ sb2.append(str);
+ return sb2;
+ }
+
+ public static StringBuilder m(String str, int i, String str2, int i2, String str3) {
+ StringBuilder sb = new StringBuilder();
+ sb.append(str);
+ sb.append(i);
+ sb.append(str2);
+ sb.append(i2);
+ sb.append(str3);
+ return sb;
+ }
+
+ public static void m(StringBuilder sb, boolean z, String str) {
+ sb.append(z);
+ Log.d(str, sb.toString());
+ }
+
+ public static String stringPlus(Object obj, String str) {
+ return str + obj;
+ }
+}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/uitemplate/BaseTemplateCard.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/uitemplate/BaseTemplateCard.java
new file mode 100644
index 0000000..493650e
--- /dev/null
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/uitemplate/BaseTemplateCard.java
@@ -0,0 +1,324 @@
+package com.google.android.systemui.smartspace.uitemplate;
+
+import android.app.smartspace.SmartspaceTarget;
+import android.app.smartspace.SmartspaceUtils;
+import android.app.smartspace.uitemplatedata.BaseTemplateData;
+import android.app.smartspace.uitemplatedata.Icon;
+import android.app.smartspace.uitemplatedata.TapAction;
+import android.app.smartspace.uitemplatedata.Text;
+import android.content.Context;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.ViewGroup;
+import android.view.accessibility.AccessibilityNodeInfo;
+import android.widget.ImageView;
+import androidx.constraintlayout.widget.ConstraintLayout;
+import com.android.launcher3.icons.GraphicsUtils;
+import com.android.systemui.bcsmartspace.R;
+import com.android.systemui.animation.Interpolators;
+import com.android.systemui.plugins.BcSmartspaceDataPlugin;
+import com.google.android.systemui.smartspace.BcSmartSpaceUtil;
+import com.google.android.systemui.smartspace.BcSmartspaceCardSecondary;
+import com.google.android.systemui.smartspace.BcSmartspaceTemplateDataUtils;
+import com.google.android.systemui.smartspace.DoubleShadowIconDrawable;
+import com.google.android.systemui.smartspace.DoubleShadowTextView;
+import com.google.android.systemui.smartspace.IcuDateTextView;
+import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
+import com.google.android.systemui.smartspace.logging.BcSmartspaceCardMetadataLoggingInfo;
+import com.google.android.systemui.smartspace.logging.BcSmartspaceSubcardLoggingInfo;
+import java.util.List;
+
+public class BaseTemplateCard extends ConstraintLayout {
+ public IcuDateTextView mDateView;
+ public ImageView mDndImageView;
+ public float mDozeAmount;
+ public ViewGroup mExtrasGroup;
+ public int mFeatureType;
+ public int mIconTintColor;
+ public boolean mIsDreaming;
+ public BcSmartspaceCardLoggingInfo mLoggingInfo;
+ public ImageView mNextAlarmImageView;
+ public DoubleShadowTextView mNextAlarmTextView;
+ public String mPrevSmartspaceTargetId;
+ public BcSmartspaceCardSecondary mSecondaryCard;
+ public ViewGroup mSecondaryCardPane;
+ public boolean mShouldShowPageIndicator;
+ public DoubleShadowTextView mSubtitleSupplementalView;
+ public DoubleShadowTextView mSubtitleTextView;
+ public DoubleShadowTextView mSupplementalLineTextView;
+ public SmartspaceTarget mTarget;
+ public BaseTemplateData mTemplateData;
+ public ViewGroup mTextGroup;
+ public DoubleShadowTextView mTitleTextView;
+ public int mTopPadding;
+ public boolean mValidSecondaryCard;
+
+ public BaseTemplateCard(Context context) {
+ this(context, null);
+ }
+
+ public BaseTemplateCard(Context context, AttributeSet attributeSet) {
+ super(context, attributeSet);
+ this.mSecondaryCard = null;
+ this.mFeatureType = 0;
+ this.mLoggingInfo = null;
+ this.mIconTintColor = GraphicsUtils.getAttrColor(getContext(), 16842806);
+ this.mPrevSmartspaceTargetId = "";
+ this.mTextGroup = null;
+ this.mSecondaryCardPane = null;
+ this.mDateView = null;
+ this.mTitleTextView = null;
+ this.mSubtitleTextView = null;
+ this.mSubtitleSupplementalView = null;
+ this.mExtrasGroup = null;
+ this.mDndImageView = null;
+ this.mNextAlarmImageView = null;
+ this.mNextAlarmTextView = null;
+ this.mSupplementalLineTextView = null;
+ }
+
+ public static boolean shouldTint(BaseTemplateData.SubItemInfo subItemInfo) {
+ if (subItemInfo != null && subItemInfo.getIcon() != null) {
+ return subItemInfo.getIcon().shouldTint();
+ }
+ return false;
+ }
+
+ public final void resetTextView(DoubleShadowTextView doubleShadowTextView) {
+ if (doubleShadowTextView == null) {
+ return;
+ }
+ doubleShadowTextView.setCompoundDrawablesRelative(null, null, null, null);
+ doubleShadowTextView.setOnClickListener(null);
+ doubleShadowTextView.setContentDescription(null);
+ doubleShadowTextView.setText((CharSequence) null);
+ BcSmartspaceTemplateDataUtils.offsetTextViewForIcon(doubleShadowTextView, null, isRtl());
+ }
+
+ public final void setDozeAmount(float f) {
+ this.mDozeAmount = f;
+ ImageView imageView = this.mDndImageView;
+ if (imageView != null) {
+ imageView.setAlpha(f);
+ }
+ SmartspaceTarget smartspaceTarget = this.mTarget;
+ if (smartspaceTarget != null && smartspaceTarget.getBaseAction() != null && this.mTarget.getBaseAction().getExtras() != null) {
+ Bundle extras = this.mTarget.getBaseAction().getExtras();
+ if (this.mTitleTextView != null && extras.getBoolean("hide_title_on_aod")) {
+ this.mTitleTextView.setAlpha(1.0f - f);
+ }
+ if (this.mSubtitleTextView != null && extras.getBoolean("hide_subtitle_on_aod")) {
+ this.mSubtitleTextView.setAlpha(1.0f - f);
+ }
+ }
+ if (this.mTextGroup != null) {
+ ViewGroup viewGroup = this.mSecondaryCardPane;
+ int i = 0;
+ int i2 = 1;
+ boolean z = this.mDozeAmount == 1.0f || !this.mValidSecondaryCard;
+ if (z) {
+ i = 8;
+ }
+ BcSmartspaceTemplateDataUtils.updateVisibility(viewGroup, i);
+ ViewGroup viewGroup2 = this.mSecondaryCardPane;
+ if (viewGroup2 != null && viewGroup2.getVisibility() != 8) {
+ ViewGroup viewGroup3 = this.mTextGroup;
+ if (!isRtl()) {
+ i2 = -1;
+ }
+ viewGroup3.setTranslationX(Interpolators.EMPHASIZED.getInterpolation(this.mDozeAmount) * this.mSecondaryCardPane.getWidth() * i2);
+ this.mSecondaryCardPane.setAlpha(Math.max(0.0f, Math.min(1.0f, ((1.0f - this.mDozeAmount) * 9.0f) - 6.0f)));
+ return;
+ }
+ this.mTextGroup.setTranslationX(0.0f);
+ }
+ }
+
+ public final void setPrimaryTextColor(int i) {
+ this.mIconTintColor = i;
+ if (this.mTitleTextView != null) {
+ this.mTitleTextView.setTextColor(i);
+ if (this.mTemplateData != null) {
+ updateTextViewIconTint(this.mTitleTextView, shouldTint(this.mTemplateData.getPrimaryItem()));
+ }
+ }
+ if (this.mDateView != null) {
+ this.mDateView.setTextColor(i);
+ }
+ if (this.mSubtitleTextView != null) {
+ this.mSubtitleTextView.setTextColor(i);
+ if (this.mTemplateData != null) {
+ updateTextViewIconTint(this.mSubtitleTextView, shouldTint(this.mTemplateData.getSubtitleItem()));
+ }
+ }
+ if (this.mSubtitleSupplementalView != null) {
+ this.mSubtitleSupplementalView.setTextColor(i);
+ if (this.mTemplateData != null) {
+ updateTextViewIconTint(this.mSubtitleSupplementalView, shouldTint(this.mTemplateData.getSubtitleSupplementalItem()));
+ }
+ }
+ updateZenColors();
+ }
+
+ public final void setUpTextView(DoubleShadowTextView doubleShadowTextView, BaseTemplateData.SubItemInfo subItemInfo, BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier) {
+ BcSmartspaceSubcardLoggingInfo bcSmartspaceSubcardLoggingInfo;
+ List<BcSmartspaceCardMetadataLoggingInfo> list;
+ CharSequence text;
+ CharSequence charSequence;
+ if (doubleShadowTextView == null) {
+ Log.d("SsBaseTemplateCard", "No text view can be set up");
+ return;
+ }
+ resetTextView(doubleShadowTextView);
+ if (subItemInfo == null) {
+ Log.d("SsBaseTemplateCard", "Passed-in item info is null");
+ BcSmartspaceTemplateDataUtils.updateVisibility(doubleShadowTextView, 8);
+ return;
+ }
+ Text text2 = subItemInfo.getText();
+ BcSmartspaceTemplateDataUtils.setText(doubleShadowTextView, subItemInfo.getText());
+ if (!SmartspaceUtils.isEmpty(text2)) {
+ doubleShadowTextView.setTextColor(this.mIconTintColor);
+ }
+ Icon icon = subItemInfo.getIcon();
+ int i = 0;
+ if (icon != null) {
+ DoubleShadowIconDrawable doubleShadowIconDrawable = new DoubleShadowIconDrawable(getContext());
+ doubleShadowIconDrawable.setIcon(BcSmartSpaceUtil.getIconDrawable(getContext(), icon.getIcon()));
+ doubleShadowTextView.setCompoundDrawablesRelative(doubleShadowIconDrawable, null, null, null);
+ if (SmartspaceUtils.isEmpty(text2)) {
+ text = "";
+ } else {
+ text = text2.getText();
+ }
+ CharSequence contentDescription = icon.getContentDescription();
+ if (TextUtils.isEmpty(text)) {
+ charSequence = contentDescription;
+ } else {
+ charSequence = text;
+ if (!TextUtils.isEmpty(contentDescription)) {
+ charSequence = this.mContext.getString(R.string.generic_smartspace_concatenated_desc, contentDescription, text);
+ }
+ }
+ doubleShadowTextView.setContentDescription(charSequence);
+ updateTextViewIconTint(doubleShadowTextView, icon.shouldTint());
+ BcSmartspaceTemplateDataUtils.offsetTextViewForIcon(doubleShadowTextView, doubleShadowIconDrawable, isRtl());
+ }
+ BcSmartspaceTemplateDataUtils.updateVisibility(doubleShadowTextView, 0);
+ SmartspaceTarget smartspaceTarget = this.mTarget;
+ TapAction tapAction = subItemInfo.getTapAction();
+ BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo = this.mLoggingInfo;
+ if (bcSmartspaceCardLoggingInfo != null && (bcSmartspaceSubcardLoggingInfo = bcSmartspaceCardLoggingInfo.mSubcardInfo) != null && (list = bcSmartspaceSubcardLoggingInfo.mSubcards) != null && !list.isEmpty() && subItemInfo.getLoggingInfo() != null) {
+ int featureType = subItemInfo.getLoggingInfo().getFeatureType();
+ BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo2 = this.mLoggingInfo;
+ if (featureType != bcSmartspaceCardLoggingInfo2.mFeatureType) {
+ List<BcSmartspaceCardMetadataLoggingInfo> list2 = bcSmartspaceCardLoggingInfo2.mSubcardInfo.mSubcards;
+ BaseTemplateData.SubItemLoggingInfo loggingInfo = subItemInfo.getLoggingInfo();
+ int i2 = 0;
+ while (true) {
+ if (i2 < list2.size()) {
+ BcSmartspaceCardMetadataLoggingInfo bcSmartspaceCardMetadataLoggingInfo = list2.get(i2);
+ if (bcSmartspaceCardMetadataLoggingInfo.mInstanceId == loggingInfo.getInstanceId() && bcSmartspaceCardMetadataLoggingInfo.mCardTypeId == loggingInfo.getFeatureType()) {
+ i = i2 + 1;
+ break;
+ }
+ i2++;
+ } else {
+ break;
+ }
+ }
+ }
+ }
+ BcSmartSpaceUtil.setOnClickListener(doubleShadowTextView, smartspaceTarget, tapAction, smartspaceEventNotifier, "SsBaseTemplateCard", bcSmartspaceCardLoggingInfo, i);
+ }
+
+ public final void updateZenColors() {
+ ImageView imageView = this.mNextAlarmImageView;
+ if (imageView != null && imageView.getDrawable() != null) {
+ imageView.getDrawable().setTint(this.mIconTintColor);
+ }
+ DoubleShadowTextView doubleShadowTextView = this.mNextAlarmTextView;
+ if (doubleShadowTextView != null) {
+ doubleShadowTextView.setTextColor(this.mIconTintColor);
+ }
+ ImageView imageView2 = this.mDndImageView;
+ if (imageView2 != null && imageView2.getDrawable() != null) {
+ imageView2.getDrawable().setTint(this.mIconTintColor);
+ }
+ DoubleShadowTextView doubleShadowTextView2 = this.mSupplementalLineTextView;
+ if (doubleShadowTextView2 != null) {
+ doubleShadowTextView2.setTextColor(this.mIconTintColor);
+ BaseTemplateData baseTemplateData = this.mTemplateData;
+ if (baseTemplateData != null) {
+ updateTextViewIconTint(this.mSupplementalLineTextView, shouldTint(baseTemplateData.getSupplementalLineItem()));
+ }
+ }
+ }
+
+ public final void updateZenVisibility() {
+ if (this.mExtrasGroup == null) {
+ return;
+ }
+ ImageView imageView = this.mDndImageView;
+ boolean z4 = true;
+ int i = 0;
+ boolean z = imageView != null && imageView.getVisibility() == 0;
+ ImageView imageView2 = this.mNextAlarmImageView;
+ boolean z2 = imageView2 != null && imageView2.getVisibility() == 0;
+ DoubleShadowTextView doubleShadowTextView = this.mSupplementalLineTextView;
+ boolean z3 = doubleShadowTextView != null && doubleShadowTextView.getVisibility() == 0;
+ if ((!z && !z2 && !z3) || (this.mShouldShowPageIndicator && this.mDateView == null)) {
+ z4 = false;
+ }
+ int i2 = this.mTopPadding;
+ if (!z4) {
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mExtrasGroup, 4);
+ i = i2;
+ } else {
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mExtrasGroup, 0);
+ updateZenColors();
+ }
+ setPadding(getPaddingLeft(), i, getPaddingRight(), getPaddingBottom());
+ }
+
+ public final AccessibilityNodeInfo createAccessibilityNodeInfo() {
+ AccessibilityNodeInfo createAccessibilityNodeInfo = super.createAccessibilityNodeInfo();
+ createAccessibilityNodeInfo.getExtras().putCharSequence("AccessibilityNodeInfo.roleDescription", " ");
+ return createAccessibilityNodeInfo;
+ }
+
+ public final void onFinishInflate() {
+ super.onFinishInflate();
+ this.mTextGroup = (ViewGroup) findViewById(R.id.text_group);
+ this.mSecondaryCardPane = (ViewGroup) findViewById(R.id.secondary_card_group);
+ this.mDateView = (IcuDateTextView) findViewById(R.id.date);
+ this.mTitleTextView = (DoubleShadowTextView) findViewById(R.id.title_text);
+ this.mSubtitleTextView = (DoubleShadowTextView) findViewById(R.id.subtitle_text);
+ this.mSubtitleSupplementalView = (DoubleShadowTextView) findViewById(R.id.base_action_icon_subtitle);
+ this.mExtrasGroup = (ViewGroup) findViewById(R.id.smartspace_extras_group);
+ this.mTopPadding = getPaddingTop();
+ ViewGroup viewGroup = this.mExtrasGroup;
+ if (viewGroup != null) {
+ this.mDndImageView = (ImageView) viewGroup.findViewById(R.id.dnd_icon);
+ this.mNextAlarmImageView = (ImageView) this.mExtrasGroup.findViewById(R.id.alarm_icon);
+ this.mNextAlarmTextView = (DoubleShadowTextView) this.mExtrasGroup.findViewById(R.id.alarm_text);
+ this.mSupplementalLineTextView = (DoubleShadowTextView) this.mExtrasGroup.findViewById(R.id.supplemental_line_text);
+ }
+ }
+
+ public final void updateTextViewIconTint(DoubleShadowTextView doubleShadowTextView, boolean z) {
+ Drawable[] compoundDrawablesRelative = doubleShadowTextView.getCompoundDrawablesRelative();
+ for (Drawable drawable : compoundDrawablesRelative) {
+ if (drawable != null) {
+ if (z) {
+ drawable.setTint(this.mIconTintColor);
+ } else {
+ drawable.setTintList(null);
+ }
+ }
+ }
+ }
+}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/uitemplate/CarouselTemplateCard.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/uitemplate/CarouselTemplateCard.java
new file mode 100644
index 0000000..5f90115
--- /dev/null
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/uitemplate/CarouselTemplateCard.java
@@ -0,0 +1,158 @@
+package com.google.android.systemui.smartspace.uitemplate;
+
+import android.app.smartspace.SmartspaceTarget;
+import android.app.smartspace.uitemplatedata.CarouselTemplateData;
+import android.content.Context;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+import androidx.constraintlayout.widget.ConstraintLayout;
+import androidx.constraintlayout.widget.Constraints;
+import com.android.systemui.bcsmartspace.R;
+import com.android.systemui.plugins.BcSmartspaceDataPlugin;
+import com.google.android.systemui.smartspace.BcSmartSpaceUtil;
+import com.google.android.systemui.smartspace.BcSmartspaceCardSecondary;
+import com.google.android.systemui.smartspace.BcSmartspaceTemplateDataUtils;
+import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
+import java.util.List;
+import java.util.Locale;
+import java.util.function.Predicate;
+
+public class CarouselTemplateCard extends BcSmartspaceCardSecondary {
+ public static final int clinit = 0;
+
+ public CarouselTemplateCard(Context context) {
+ super(context);
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final void resetUi() {
+ for (int i = 0; i < getChildCount(); i++) {
+ View childAt = getChildAt(i);
+ BcSmartspaceTemplateDataUtils.updateVisibility(childAt.findViewById(R.id.upper_text), 8);
+ BcSmartspaceTemplateDataUtils.updateVisibility(childAt.findViewById(R.id.icon), 8);
+ BcSmartspaceTemplateDataUtils.updateVisibility(childAt.findViewById(R.id.lower_text), 8);
+ }
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final void setTextColor(int i) {
+ for (int i2 = 0; i2 < getChildCount(); i2++) {
+ ((TextView) getChildAt(i2).findViewById(R.id.upper_text)).setTextColor(i);
+ ((TextView) getChildAt(i2).findViewById(R.id.lower_text)).setTextColor(i);
+ }
+ }
+
+ public CarouselTemplateCard(Context context, AttributeSet attributeSet) {
+ super(context, attributeSet);
+ }
+
+ public final void onFinishInflate() {
+ ConstraintLayout constraintLayout;
+ ConstraintLayout constraintLayout2;
+ super/*android.view.ViewGroup*/.onFinishInflate();
+ ConstraintLayout[] constraintLayoutArr = new ConstraintLayout[4];
+ for (int i = 0; i < 4; i++) {
+ ConstraintLayout constraintLayout3 = (ConstraintLayout) ViewGroup.inflate(getContext(), R.layout.smartspace_carousel_column_template_card, null);
+ constraintLayout3.setId(View.generateViewId());
+ constraintLayoutArr[i] = constraintLayout3;
+ }
+ for (int i2 = 0; i2 < 4; i2++) {
+ Constraints.LayoutParams layoutParams = new Constraints.LayoutParams(-2, 0);
+ ConstraintLayout constraintLayout4 = constraintLayoutArr[i2];
+ if (i2 > 0) {
+ constraintLayout = constraintLayoutArr[i2 - 1];
+ } else {
+ constraintLayout = null;
+ }
+ if (i2 < 3) {
+ constraintLayout2 = constraintLayoutArr[i2 + 1];
+ } else {
+ constraintLayout2 = null;
+ }
+ if (i2 == 0) {
+ ((ConstraintLayout.LayoutParams) layoutParams).startToStart = 0;
+ ((ConstraintLayout.LayoutParams) layoutParams).horizontalChainStyle = 1;
+ } else {
+ ((ConstraintLayout.LayoutParams) layoutParams).startToEnd = constraintLayout.getId();
+ }
+ if (i2 == 3) {
+ ((ConstraintLayout.LayoutParams) layoutParams).endToEnd = 0;
+ } else {
+ ((ConstraintLayout.LayoutParams) layoutParams).endToStart = constraintLayout2.getId();
+ }
+ ((ConstraintLayout.LayoutParams) layoutParams).topToTop = 0;
+ ((ConstraintLayout.LayoutParams) layoutParams).bottomToBottom = 0;
+ addView(constraintLayout4, layoutParams);
+ }
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final boolean setSmartspaceActions(SmartspaceTarget smartspaceTarget, BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier, BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
+ int i;
+ int i2;
+ CarouselTemplateData templateData = (CarouselTemplateData) smartspaceTarget.getTemplateData();
+ if (templateData != null && templateData.getCarouselItems() != null) {
+ List carouselItems = templateData.getCarouselItems();
+ int intExact = Math.toIntExact(carouselItems.stream().filter(new Predicate() { // from class: com.google.android.systemui.smartspace.uitemplate.CarouselTemplateCard$$ExternalSyntheticLambda0
+ @Override // java.util.function.Predicate
+ public final boolean test(Object obj) {
+ boolean z;
+ CarouselTemplateData.CarouselItem carouselItem = (CarouselTemplateData.CarouselItem) obj;
+ int i3 = CarouselTemplateCard.clinit;
+ if (carouselItem.getImage() != null && carouselItem.getLowerText() != null && carouselItem.getUpperText() != null) {
+ z = true;
+ } else {
+ z = false;
+ }
+ return z;
+ }
+ }).count());
+ if (intExact < 4) {
+ int i3 = 4 - intExact;
+ Log.w("CarouselTemplateCard", String.format(Locale.US, "Hiding %d incomplete column(s).", Integer.valueOf(i3)));
+ for (int i4 = 0; i4 < 4; i4++) {
+ View childAt = getChildAt(i4);
+ if (i4 <= 3 - i3) {
+ i2 = 0;
+ } else {
+ i2 = 8;
+ }
+ BcSmartspaceTemplateDataUtils.updateVisibility(childAt, i2);
+ }
+ ConstraintLayout.LayoutParams layoutParams = (ConstraintLayout.LayoutParams) getChildAt(0).getLayoutParams();
+ if (i3 == 0) {
+ i = 1;
+ } else {
+ i = 0;
+ }
+ layoutParams.horizontalChainStyle = i;
+ }
+ for (int i5 = 0; i5 < intExact; i5++) {
+ TextView textView = (TextView) getChildAt(i5).findViewById(R.id.upper_text);
+ ImageView imageView = (ImageView) getChildAt(i5).findViewById(R.id.icon);
+ TextView textView2 = (TextView) getChildAt(i5).findViewById(R.id.lower_text);
+ BcSmartspaceTemplateDataUtils.setText(textView, ((CarouselTemplateData.CarouselItem) carouselItems.get(i5)).getUpperText());
+ BcSmartspaceTemplateDataUtils.updateVisibility(textView, 0);
+ BcSmartspaceTemplateDataUtils.setIcon(imageView, ((CarouselTemplateData.CarouselItem) carouselItems.get(i5)).getImage());
+ BcSmartspaceTemplateDataUtils.updateVisibility(imageView, 0);
+ BcSmartspaceTemplateDataUtils.setText(textView2, ((CarouselTemplateData.CarouselItem) carouselItems.get(i5)).getLowerText());
+ BcSmartspaceTemplateDataUtils.updateVisibility(textView2, 0);
+ }
+ if (templateData.getCarouselAction() != null) {
+ BcSmartSpaceUtil.setOnClickListener(this, smartspaceTarget, templateData.getCarouselAction(), smartspaceEventNotifier, "CarouselTemplateCard", bcSmartspaceCardLoggingInfo);
+ }
+ for (CarouselTemplateData.CarouselItem carouselItem : templateData.getCarouselItems()) {
+ if (carouselItem.getTapAction() != null) {
+ BcSmartSpaceUtil.setOnClickListener(this, smartspaceTarget, carouselItem.getTapAction(), smartspaceEventNotifier, "CarouselTemplateCard", bcSmartspaceCardLoggingInfo);
+ }
+ }
+ return true;
+ }
+ Log.w("CarouselTemplateCard", "CarouselTemplateData is null or has no CarouselItem");
+ return false;
+ }
+}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/uitemplate/CombinedCardsTemplateCard.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/uitemplate/CombinedCardsTemplateCard.java
new file mode 100644
index 0000000..51f619d
--- /dev/null
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/uitemplate/CombinedCardsTemplateCard.java
@@ -0,0 +1,102 @@
+package com.google.android.systemui.smartspace.uitemplate;
+
+import android.app.smartspace.SmartspaceTarget;
+import android.app.smartspace.uitemplatedata.BaseTemplateData;
+import android.app.smartspace.uitemplatedata.CombinedCardsTemplateData;
+import android.content.Context;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.ViewGroup;
+import androidx.constraintlayout.widget.ConstraintLayout;
+import com.android.systemui.bcsmartspace.R;
+import com.android.systemui.plugins.BcSmartspaceDataPlugin;
+import com.google.android.systemui.smartspace.BcSmartspaceCardSecondary;
+import com.google.android.systemui.smartspace.BcSmartspaceTemplateDataUtils;
+import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
+import java.util.List;
+
+public class CombinedCardsTemplateCard extends BcSmartspaceCardSecondary {
+ public ConstraintLayout mFirstSubCard;
+ public ConstraintLayout mSecondSubCard;
+
+ public CombinedCardsTemplateCard(Context context) {
+ super(context);
+ }
+
+ public CombinedCardsTemplateCard(Context context, AttributeSet attributeSet) {
+ super(context, attributeSet);
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final void setTextColor(int i) {
+ if (this.mFirstSubCard.getChildCount() != 0) {
+ ((BcSmartspaceCardSecondary) this.mFirstSubCard.getChildAt(0)).setTextColor(i);
+ }
+ if (this.mSecondSubCard.getChildCount() != 0) {
+ ((BcSmartspaceCardSecondary) this.mSecondSubCard.getChildAt(0)).setTextColor(i);
+ }
+ }
+
+ public final void onFinishInflate() {
+ super/*android.view.ViewGroup*/.onFinishInflate();
+ this.mFirstSubCard = findViewById(R.id.first_sub_card_container);
+ this.mSecondSubCard = findViewById(R.id.second_sub_card_container);
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final void resetUi() {
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mFirstSubCard, 8);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mSecondSubCard, 8);
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final boolean setSmartspaceActions(SmartspaceTarget smartspaceTarget, BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier, BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
+ BaseTemplateData baseTemplateData;
+ CombinedCardsTemplateData templateData = (CombinedCardsTemplateData) smartspaceTarget.getTemplateData();
+ if (templateData != null && !templateData.getCombinedCardDataList().isEmpty()) {
+ List combinedCardDataList = templateData.getCombinedCardDataList();
+ BaseTemplateData baseTemplateData2 = (BaseTemplateData) combinedCardDataList.get(0);
+ if (combinedCardDataList.size() > 1) {
+ baseTemplateData = (BaseTemplateData) combinedCardDataList.get(1);
+ } else {
+ baseTemplateData = null;
+ }
+ if (!setupSubCard(this.mFirstSubCard, baseTemplateData2, smartspaceTarget, smartspaceEventNotifier, bcSmartspaceCardLoggingInfo)) {
+ return false;
+ }
+ if (baseTemplateData != null && !setupSubCard(this.mSecondSubCard, baseTemplateData, smartspaceTarget, smartspaceEventNotifier, bcSmartspaceCardLoggingInfo)) {
+ return false;
+ }
+ return true;
+ }
+ Log.w("CombinedCardsTemplateCard", "TemplateData is null or empty");
+ return false;
+ }
+
+ public final boolean setupSubCard(ConstraintLayout constraintLayout, BaseTemplateData baseTemplateData, SmartspaceTarget smartspaceTarget, BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier, BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
+ if (baseTemplateData == null) {
+ BcSmartspaceTemplateDataUtils.updateVisibility(constraintLayout, 8);
+ Log.w("CombinedCardsTemplateCard", "Sub-card templateData is null or empty");
+ return false;
+ }
+ int secondaryCardRes = BcSmartspaceTemplateDataUtils.getSecondaryCardRes(baseTemplateData.getTemplateType());
+ if (secondaryCardRes == 0) {
+ BcSmartspaceTemplateDataUtils.updateVisibility(constraintLayout, 8);
+ Log.w("CombinedCardsTemplateCard", "Combined sub-card res is null. Cannot set it up");
+ return false;
+ }
+ BcSmartspaceCardSecondary r0 = (BcSmartspaceCardSecondary) LayoutInflater.from(constraintLayout.getContext()).inflate(secondaryCardRes, (ViewGroup) constraintLayout, false);
+ r0.setSmartspaceActions(new SmartspaceTarget.Builder(smartspaceTarget.getSmartspaceTargetId(), smartspaceTarget.getComponentName(), smartspaceTarget.getUserHandle()).setTemplateData(baseTemplateData).build(), smartspaceEventNotifier, bcSmartspaceCardLoggingInfo);
+ constraintLayout.removeAllViews();
+ ConstraintLayout.LayoutParams layoutParams = new ConstraintLayout.LayoutParams(-2, getResources().getDimensionPixelSize(R.dimen.enhanced_smartspace_card_height));
+ layoutParams.startToStart = 0;
+ layoutParams.endToEnd = 0;
+ layoutParams.topToTop = 0;
+ layoutParams.bottomToBottom = 0;
+ BcSmartspaceTemplateDataUtils.updateVisibility(r0, 0);
+ constraintLayout.addView(r0, layoutParams);
+ BcSmartspaceTemplateDataUtils.updateVisibility(constraintLayout, 0);
+ return true;
+ }
+}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/uitemplate/HeadToHeadTemplateCard.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/uitemplate/HeadToHeadTemplateCard.java
new file mode 100644
index 0000000..1d183e8
--- /dev/null
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/uitemplate/HeadToHeadTemplateCard.java
@@ -0,0 +1,164 @@
+package com.google.android.systemui.smartspace.uitemplate;
+
+import android.app.smartspace.SmartspaceTarget;
+import android.app.smartspace.uitemplatedata.HeadToHeadTemplateData;
+import android.app.smartspace.uitemplatedata.Icon;
+import android.app.smartspace.uitemplatedata.Text;
+import android.content.Context;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.widget.ImageView;
+import android.widget.TextView;
+import com.android.systemui.bcsmartspace.R;
+import com.android.systemui.plugins.BcSmartspaceDataPlugin;
+import com.google.android.systemui.smartspace.BcSmartSpaceUtil;
+import com.google.android.systemui.smartspace.BcSmartspaceCardSecondary;
+import com.google.android.systemui.smartspace.BcSmartspaceTemplateDataUtils;
+import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
+
+public class HeadToHeadTemplateCard extends BcSmartspaceCardSecondary {
+ public ImageView mFirstCompetitorIcon;
+ public TextView mFirstCompetitorText;
+ public TextView mHeadToHeadTitle;
+ public ImageView mSecondCompetitorIcon;
+ public TextView mSecondCompetitorText;
+
+ public HeadToHeadTemplateCard(Context context) {
+ super(context);
+ }
+
+ public HeadToHeadTemplateCard(Context context, AttributeSet attributeSet) {
+ super(context, attributeSet);
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final void setTextColor(int i) {
+ this.mFirstCompetitorText.setTextColor(i);
+ this.mSecondCompetitorText.setTextColor(i);
+ }
+
+ public final void onFinishInflate() {
+ super/*android.view.ViewGroup*/.onFinishInflate();
+ this.mHeadToHeadTitle = (TextView) findViewById(R.id.head_to_head_title);
+ this.mFirstCompetitorText = (TextView) findViewById(R.id.first_competitor_text);
+ this.mSecondCompetitorText = (TextView) findViewById(R.id.second_competitor_text);
+ this.mFirstCompetitorIcon = (ImageView) findViewById(R.id.first_competitor_icon);
+ this.mSecondCompetitorIcon = (ImageView) findViewById(R.id.second_competitor_icon);
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final void resetUi() {
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mHeadToHeadTitle, 8);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mFirstCompetitorText, 8);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mSecondCompetitorText, 8);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mFirstCompetitorIcon, 8);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mSecondCompetitorIcon, 8);
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final boolean setSmartspaceActions(SmartspaceTarget smartspaceTarget, BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier, BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
+ boolean z;
+ boolean z2;
+ boolean z3;
+ boolean z4;
+ boolean z5;
+ boolean z6;
+ boolean z7;
+ HeadToHeadTemplateData templateData = (HeadToHeadTemplateData) smartspaceTarget.getTemplateData();
+ if (templateData == null) {
+ Log.w("HeadToHeadTemplateCard", "HeadToHeadTemplateData is null");
+ return false;
+ }
+ if (templateData.getHeadToHeadTitle() != null) {
+ Text headToHeadTitle = templateData.getHeadToHeadTitle();
+ TextView textView = this.mHeadToHeadTitle;
+ if (textView == null) {
+ Log.w("HeadToHeadTemplateCard", "No head-to-head title view to update");
+ z7 = false;
+ } else {
+ BcSmartspaceTemplateDataUtils.setText(textView, headToHeadTitle);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mHeadToHeadTitle, 0);
+ z7 = true;
+ }
+ if (z7) {
+ z = true;
+ boolean z8 = z;
+ if (templateData.getHeadToHeadFirstCompetitorText() != null) {
+ Text headToHeadFirstCompetitorText = templateData.getHeadToHeadFirstCompetitorText();
+ TextView textView2 = this.mFirstCompetitorText;
+ if (textView2 == null) {
+ Log.w("HeadToHeadTemplateCard", "No first competitor text view to update");
+ z6 = false;
+ } else {
+ BcSmartspaceTemplateDataUtils.setText(textView2, headToHeadFirstCompetitorText);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mFirstCompetitorText, 0);
+ z6 = true;
+ }
+ if (!z6 && !z) {
+ z8 = false;
+ } else {
+ z8 = true;
+ }
+ }
+ boolean z9 = z8;
+ if (templateData.getHeadToHeadSecondCompetitorText() != null) {
+ Text headToHeadSecondCompetitorText = templateData.getHeadToHeadSecondCompetitorText();
+ TextView textView3 = this.mSecondCompetitorText;
+ if (textView3 == null) {
+ Log.w("HeadToHeadTemplateCard", "No second competitor text view to update");
+ z5 = false;
+ } else {
+ BcSmartspaceTemplateDataUtils.setText(textView3, headToHeadSecondCompetitorText);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mSecondCompetitorText, 0);
+ z5 = true;
+ }
+ if (!z5 && !z8) {
+ z9 = false;
+ } else {
+ z9 = true;
+ }
+ }
+ boolean z10 = z9;
+ if (templateData.getHeadToHeadFirstCompetitorIcon() != null) {
+ Icon headToHeadFirstCompetitorIcon = templateData.getHeadToHeadFirstCompetitorIcon();
+ ImageView imageView = this.mFirstCompetitorIcon;
+ if (imageView == null) {
+ Log.w("HeadToHeadTemplateCard", "No first competitor icon view to update");
+ z4 = false;
+ } else {
+ BcSmartspaceTemplateDataUtils.setIcon(imageView, headToHeadFirstCompetitorIcon);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mFirstCompetitorIcon, 0);
+ z4 = true;
+ }
+ if (!z4 && !z9) {
+ z10 = false;
+ } else {
+ z10 = true;
+ }
+ }
+ z2 = z10;
+ if (templateData.getHeadToHeadSecondCompetitorIcon() != null) {
+ Icon headToHeadSecondCompetitorIcon = templateData.getHeadToHeadSecondCompetitorIcon();
+ ImageView imageView2 = this.mSecondCompetitorIcon;
+ if (imageView2 == null) {
+ Log.w("HeadToHeadTemplateCard", "No second competitor icon view to update");
+ z3 = false;
+ } else {
+ BcSmartspaceTemplateDataUtils.setIcon(imageView2, headToHeadSecondCompetitorIcon);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mSecondCompetitorIcon, 0);
+ z3 = true;
+ }
+ if (!z3) {
+ z2 = false;
+ }
+ z2 = true;
+ }
+ if (z2 && templateData.getHeadToHeadAction() != null) {
+ BcSmartSpaceUtil.setOnClickListener(this, smartspaceTarget, templateData.getHeadToHeadAction(), smartspaceEventNotifier, "HeadToHeadTemplateCard", bcSmartspaceCardLoggingInfo);
+ }
+ return z2;
+ }
+ }
+ return false;
+ }
+}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/uitemplate/SubCardTemplateCard.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/uitemplate/SubCardTemplateCard.java
new file mode 100644
index 0000000..1d0e42e
--- /dev/null
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/uitemplate/SubCardTemplateCard.java
@@ -0,0 +1,72 @@
+package com.google.android.systemui.smartspace.uitemplate;
+
+import android.app.smartspace.SmartspaceTarget;
+import android.app.smartspace.SmartspaceUtils;
+import android.app.smartspace.uitemplatedata.SubCardTemplateData;
+import android.content.Context;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.widget.ImageView;
+import android.widget.TextView;
+import com.android.systemui.bcsmartspace.R;
+import com.android.systemui.plugins.BcSmartspaceDataPlugin;
+import com.google.android.systemui.smartspace.BcSmartSpaceUtil;
+import com.google.android.systemui.smartspace.BcSmartspaceCardSecondary;
+import com.google.android.systemui.smartspace.BcSmartspaceTemplateDataUtils;
+import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
+
+public class SubCardTemplateCard extends BcSmartspaceCardSecondary {
+ public ImageView mImageView;
+ public TextView mTextView;
+
+ public SubCardTemplateCard(Context context) {
+ super(context);
+ }
+
+ public SubCardTemplateCard(Context context, AttributeSet attributeSet) {
+ super(context, attributeSet);
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final void setTextColor(int i) {
+ this.mTextView.setTextColor(i);
+ }
+
+ public final void onFinishInflate() {
+ super/*android.view.ViewGroup*/.onFinishInflate();
+ this.mImageView = (ImageView) findViewById(R.id.image_view);
+ this.mTextView = (TextView) findViewById(R.id.card_prompt);
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final void resetUi() {
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mImageView, 8);
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mTextView, 8);
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final boolean setSmartspaceActions(SmartspaceTarget smartspaceTarget, BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier, BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
+ boolean z;
+ SubCardTemplateData templateData = (SubCardTemplateData) smartspaceTarget.getTemplateData();
+ if (templateData == null) {
+ Log.w("SubCardTemplateCard", "SubCardTemplateData is null");
+ return false;
+ }
+ if (templateData.getSubCardIcon() != null) {
+ BcSmartspaceTemplateDataUtils.setIcon(this.mImageView, templateData.getSubCardIcon());
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mImageView, 0);
+ z = true;
+ } else {
+ z = false;
+ }
+ if (!SmartspaceUtils.isEmpty(templateData.getSubCardText())) {
+ BcSmartspaceTemplateDataUtils.setText(this.mTextView, templateData.getSubCardText());
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mTextView, 0);
+ z = true;
+ }
+ if (z && templateData.getSubCardAction() != null) {
+ BcSmartSpaceUtil.setOnClickListener(this, smartspaceTarget, templateData.getSubCardAction(), smartspaceEventNotifier, "SubCardTemplateCard", bcSmartspaceCardLoggingInfo);
+ }
+ return z;
+ }
+}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/uitemplate/SubImageTemplateCard.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/uitemplate/SubImageTemplateCard.java
new file mode 100644
index 0000000..d936e2c
--- /dev/null
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/uitemplate/SubImageTemplateCard.java
@@ -0,0 +1,283 @@
+package com.google.android.systemui.smartspace.uitemplate;
+
+import android.app.smartspace.SmartspaceTarget;
+import android.app.smartspace.uitemplatedata.SubImageTemplateData;
+import android.app.smartspace.uitemplatedata.TapAction;
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.res.ColorStateList;
+import android.content.res.Resources;
+import android.graphics.ImageDecoder;
+import android.graphics.drawable.AnimationDrawable;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.Icon;
+import android.net.Uri;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.os.Handler;
+import android.text.TextUtils;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.util.Size;
+import android.widget.ImageView;
+import androidx.constraintlayout.widget.ConstraintLayout;
+import com.android.systemui.bcsmartspace.R;
+import com.android.systemui.plugins.BcSmartspaceDataPlugin;
+import com.google.android.systemui.smartspace.BcSmartSpaceUtil;
+import com.google.android.systemui.smartspace.BcSmartspaceCardSecondary;
+import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
+import com.google.android.systemui.smartspace.logging.LogBuilder;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.ref.WeakReference;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.TreeMap;
+import java.util.function.Consumer;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
+
+public class SubImageTemplateCard extends BcSmartspaceCardSecondary {
+ public static final int clinit = 0;
+ public final Handler mHandler;
+ public final HashMap mIconDrawableCache;
+ public final int mImageHeight;
+ public ImageView mImageView;
+
+ public static final class LoadUriTask extends AsyncTask<DrawableWrapper, Void, DrawableWrapper> {
+ @Override // android.os.AsyncTask
+ public final void onPostExecute(DrawableWrapper drawableWrapper) {
+ DrawableWrapper drawableWrapper2 = drawableWrapper;
+ drawableWrapper2.mListener.onDrawableLoaded(drawableWrapper2.mDrawable);
+ }
+
+ @Override // android.os.AsyncTask
+ public final DrawableWrapper doInBackground(DrawableWrapper[] drawableWrapperArr) {
+ Drawable drawable;
+ DrawableWrapper[] drawableWrapperArr2 = drawableWrapperArr;
+ DrawableWrapper drawableWrapper = null;
+ if (drawableWrapperArr2.length > 0) {
+ DrawableWrapper drawableWrapper2 = drawableWrapperArr2[0];
+ try {
+ InputStream openInputStream = drawableWrapper2.mContentResolver.openInputStream(drawableWrapper2.mUri);
+ final int i = drawableWrapper2.mHeightInPx;
+ try {
+ drawable = ImageDecoder.decodeDrawable(ImageDecoder.createSource((Resources) null, openInputStream), new ImageDecoder.OnHeaderDecodedListener() { // from class: com.google.android.systemui.smartspace.uitemplate.SubImageTemplateCard$$ExternalSyntheticLambda2
+ @Override // android.graphics.ImageDecoder.OnHeaderDecodedListener
+ public final void onHeaderDecoded(ImageDecoder imageDecoder, ImageDecoder.ImageInfo imageInfo, ImageDecoder.Source source) {
+ float f;
+ imageDecoder.setAllocator(3);
+ Size size = imageInfo.getSize();
+ if (size.getHeight() != 0) {
+ f = size.getWidth() / size.getHeight();
+ } else {
+ f = 0.0f;
+ }
+ imageDecoder.setTargetSize((int) (i * f), i);
+ }
+ });
+ } catch (IOException e) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Unable to decode stream: ");
+ sb.append(e);
+ Log.e("SubImageTemplateCard", sb.toString());
+ drawable = null;
+ }
+ drawableWrapper2.mDrawable = drawable;
+ } catch (Exception e2) {
+ StringBuilder m = LogBuilder.m("open uri:");
+ m.append(drawableWrapper2.mUri);
+ m.append(" got exception:");
+ m.append(e2);
+ Log.w("SubImageTemplateCard", m.toString());
+ }
+ drawableWrapper = drawableWrapper2;
+ }
+ return drawableWrapper;
+ }
+ }
+
+ public SubImageTemplateCard(Context context) {
+ this(context, null);
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final void setTextColor(int i) {
+ }
+
+ public static final class DrawableWrapper {
+ public final ContentResolver mContentResolver;
+ public Drawable mDrawable;
+ public final int mHeightInPx;
+ public final Icon.OnDrawableLoadedListener mListener;
+ public final Uri mUri;
+
+ public DrawableWrapper(Uri uri, ContentResolver contentResolver, int i, Icon.OnDrawableLoadedListener listener) {
+ this.mUri = uri;
+ this.mHeightInPx = i;
+ this.mContentResolver = contentResolver;
+ this.mListener = listener;
+ }
+ }
+
+ public SubImageTemplateCard(Context context, AttributeSet attributeSet) {
+ super(context, attributeSet);
+ this.mIconDrawableCache = new HashMap();
+ this.mHandler = new Handler();
+ this.mImageHeight = getResources().getDimensionPixelOffset(R.dimen.enhanced_smartspace_card_height);
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final void resetUi() {
+ HashMap hashMap = this.mIconDrawableCache;
+ if (hashMap != null) {
+ hashMap.clear();
+ }
+ ImageView imageView = this.mImageView;
+ if (imageView != null) {
+ imageView.getLayoutParams().width = -2;
+ this.mImageView.setImageDrawable(null);
+ this.mImageView.setBackgroundTintList(null);
+ }
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final boolean setSmartspaceActions(SmartspaceTarget smartspaceTarget, BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier, BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
+ String sb;
+ SubImageTemplateData templateData = (SubImageTemplateData) smartspaceTarget.getTemplateData();
+ if (templateData != null && templateData.getSubImages() != null && !templateData.getSubImages().isEmpty()) {
+ final List subImages = templateData.getSubImages();
+ TapAction subImageAction = templateData.getSubImageAction();
+ if (this.mImageView == null) {
+ Log.w("SubImageTemplateCard", "No image view can be updated. Skipping background update...");
+ } else if (subImageAction != null && subImageAction.getExtras() != null) {
+ Bundle extras = subImageAction.getExtras();
+ String string = extras.getString("imageDimensionRatio", "");
+ if (!TextUtils.isEmpty(string)) {
+ this.mImageView.getLayoutParams().width = 0;
+ ((ConstraintLayout.LayoutParams) this.mImageView.getLayoutParams()).dimensionRatio = string;
+ }
+ if (extras.getBoolean("shouldShowBackground", false)) {
+ this.mImageView.setBackgroundTintList(ColorStateList.valueOf(getContext().getColor(R.color.smartspace_button_background)));
+ }
+ }
+ int i = 200;
+ if (subImageAction != null) {
+ if (subImageAction.getExtras() == null) {
+ i = 200;
+ } else {
+ i = subImageAction.getExtras().getInt("GifFrameDurationMillis", 200);
+ }
+ }
+ ContentResolver contentResolver = getContext().getApplicationContext().getContentResolver();
+ final TreeMap treeMap = new TreeMap();
+ final WeakReference weakReference = new WeakReference(this.mImageView);
+ final String str = this.mPrevSmartspaceTargetId;
+ for (int i2 = 0; i2 < subImages.size(); i2++) {
+ android.app.smartspace.uitemplatedata.Icon icon = (android.app.smartspace.uitemplatedata.Icon) subImages.get(i2);
+ if (icon != null && icon.getIcon() != null) {
+ Icon icon2 = icon.getIcon();
+ StringBuilder sb2 = new StringBuilder(icon2.getType());
+ switch (icon2.getType()) {
+ case 1:
+ case 5:
+ sb2.append(icon2.getBitmap().hashCode());
+ sb = sb2.toString();
+ break;
+ case 2:
+ sb2.append(icon2.getResPackage());
+ sb2.append(String.format("0x%08x", Integer.valueOf(icon2.getResId())));
+ sb = sb2.toString();
+ break;
+ case 3:
+ sb2.append(Arrays.hashCode(icon2.getDataBytes()));
+ sb = sb2.toString();
+ break;
+ case 4:
+ case 6:
+ sb2.append(icon2.getUriString());
+ sb = sb2.toString();
+ break;
+ default:
+ sb = sb2.toString();
+ break;
+ }
+ final String str2 = sb;
+ final int i3 = i2;
+ final int i4 = i;
+ Icon.OnDrawableLoadedListener listener = new Icon.OnDrawableLoadedListener() { // from class: com.google.android.systemui.smartspace.uitemplate.SubImageTemplateCard$$ExternalSyntheticLambda0
+ @Override // android.graphics.drawable.Icon.OnDrawableLoadedListener
+ public final void onDrawableLoaded(Drawable drawable) {
+ SubImageTemplateCard subImageTemplateCard = SubImageTemplateCard.this;
+ String str3 = str;
+ String str4 = str2;
+ Map map = treeMap;
+ int i5 = i3;
+ List list = subImages;
+ final int i6 = i4;
+ WeakReference weakReference2 = weakReference;
+ if (!str3.equals(subImageTemplateCard.mPrevSmartspaceTargetId)) {
+ Log.d("SubImageTemplateCard", "SmartspaceTarget has changed. Skip the loaded result...");
+ return;
+ }
+ subImageTemplateCard.mIconDrawableCache.put(str4, drawable);
+ map.put(Integer.valueOf(i5), drawable);
+ if (map.size() == list.size()) {
+ final AnimationDrawable animationDrawable = new AnimationDrawable();
+ List list2 = (List) map.values().stream().filter(new Predicate() { // from class: com.google.android.systemui.smartspace.uitemplate.SubImageTemplateCard$$ExternalSyntheticLambda3
+ @Override // java.util.function.Predicate
+ public final boolean test(Object obj) {
+ return Objects.nonNull((Drawable) obj);
+ }
+ }).collect(Collectors.toList());
+ if (list2.isEmpty()) {
+ Log.w("SubImageTemplateCard", "All images are failed to load. Reset imageView");
+ ImageView imageView = subImageTemplateCard.mImageView;
+ if (imageView != null) {
+ imageView.getLayoutParams().width = -2;
+ subImageTemplateCard.mImageView.setImageDrawable(null);
+ subImageTemplateCard.mImageView.setBackgroundTintList(null);
+ return;
+ }
+ return;
+ }
+ list2.forEach(obj -> animationDrawable.addFrame((Drawable) obj, i6));
+ ImageView imageView2 = (ImageView) weakReference2.get();
+ imageView2.setImageDrawable(animationDrawable);
+ int intrinsicWidth = animationDrawable.getIntrinsicWidth();
+ if (imageView2.getLayoutParams().width != intrinsicWidth) {
+ Log.d("SubImageTemplateCard", "imageView requestLayout");
+ imageView2.getLayoutParams().width = intrinsicWidth;
+ imageView2.requestLayout();
+ }
+ animationDrawable.start();
+ }
+ }
+ };
+ if (this.mIconDrawableCache.containsKey(sb) && this.mIconDrawableCache.get(sb) != null) {
+ listener.onDrawableLoaded((Drawable) this.mIconDrawableCache.get(sb));
+ } else if (icon2.getType() == 4) {
+ new LoadUriTask().execute(new DrawableWrapper(icon2.getUri(), contentResolver, this.mImageHeight, listener));
+ } else {
+ icon2.loadDrawableAsync(getContext(), listener, this.mHandler);
+ }
+ }
+ }
+ if (subImageAction != null) {
+ BcSmartSpaceUtil.setOnClickListener(this, smartspaceTarget, subImageAction, smartspaceEventNotifier, "SubImageTemplateCard", bcSmartspaceCardLoggingInfo);
+ return true;
+ }
+ return true;
+ }
+ Log.w("SubImageTemplateCard", "SubImageTemplateData is null or has no SubImage");
+ return false;
+ }
+
+ public final void onFinishInflate() {
+ super/*android.view.ViewGroup*/.onFinishInflate();
+ this.mImageView = (ImageView) findViewById(R.id.image_view);
+ }
+}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/uitemplate/SubListTemplateCard.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/uitemplate/SubListTemplateCard.java
new file mode 100644
index 0000000..786aadb
--- /dev/null
+++ b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/uitemplate/SubListTemplateCard.java
@@ -0,0 +1,107 @@
+package com.google.android.systemui.smartspace.uitemplate;
+
+import android.app.smartspace.SmartspaceTarget;
+import android.app.smartspace.uitemplatedata.SubListTemplateData;
+import android.app.smartspace.uitemplatedata.Text;
+import android.content.Context;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.widget.ImageView;
+import android.widget.TextView;
+import com.android.systemui.bcsmartspace.R;
+import com.android.systemui.plugins.BcSmartspaceDataPlugin;
+import com.google.android.systemui.smartspace.BcSmartSpaceUtil;
+import com.google.android.systemui.smartspace.BcSmartspaceCardSecondary;
+import com.google.android.systemui.smartspace.BcSmartspaceTemplateDataUtils;
+import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
+import java.util.List;
+import java.util.Locale;
+
+public class SubListTemplateCard extends BcSmartspaceCardSecondary {
+ public static final int[] LIST_ITEM_TEXT_VIEW_IDS = {2131362736, 2131362737, 2131362738};
+ public ImageView mListIconView;
+ public TextView[] mListItems;
+
+ public SubListTemplateCard(Context context) {
+ super(context);
+ this.mListItems = new TextView[3];
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final void setTextColor(int i) {
+ for (int i2 = 0; i2 < 3; i2++) {
+ TextView textView = this.mListItems[i2];
+ if (textView == null) {
+ Log.w("SubListTemplateCard", String.format(Locale.US, "Missing list item view to update at row: %d", Integer.valueOf(i2 + 1)));
+ return;
+ }
+ textView.setTextColor(i);
+ }
+ }
+
+ public SubListTemplateCard(Context context, AttributeSet attributeSet) {
+ super(context, attributeSet);
+ this.mListItems = new TextView[3];
+ }
+
+ public final void onFinishInflate() {
+ super/*android.view.ViewGroup*/.onFinishInflate();
+ this.mListIconView = (ImageView) findViewById(R.id.list_icon);
+ for (int i = 0; i < 3; i++) {
+ this.mListItems[i] = (TextView) findViewById(LIST_ITEM_TEXT_VIEW_IDS[i]);
+ }
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final void resetUi() {
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mListIconView, 8);
+ for (int i = 0; i < 3; i++) {
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mListItems[i], 8);
+ }
+ }
+
+ @Override // com.google.android.systemui.smartspace.BcSmartspaceCardSecondary
+ public final boolean setSmartspaceActions(SmartspaceTarget smartspaceTarget, BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier, BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
+ SubListTemplateData templateData = (SubListTemplateData) smartspaceTarget.getTemplateData();
+ if (templateData == null) {
+ Log.w("SubListTemplateCard", "SubListTemplateData is null");
+ return false;
+ }
+ if (templateData.getSubListIcon() != null) {
+ BcSmartspaceTemplateDataUtils.setIcon(this.mListIconView, templateData.getSubListIcon());
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mListIconView, 0);
+ } else {
+ BcSmartspaceTemplateDataUtils.updateVisibility(this.mListIconView, 8);
+ }
+ if (templateData.getSubListTexts() != null) {
+ List subListTexts = templateData.getSubListTexts();
+ if (subListTexts.isEmpty()) {
+ return false;
+ }
+ int i = 0;
+ while (true) {
+ if (i >= 3) {
+ break;
+ }
+ TextView textView = this.mListItems[i];
+ if (textView == null) {
+ Log.w("SubListTemplateCard", String.format(Locale.US, "Missing list item view to update at row: %d", Integer.valueOf(i + 1)));
+ break;
+ }
+ if (i < subListTexts.size()) {
+ BcSmartspaceTemplateDataUtils.setText(textView, (Text) subListTexts.get(i));
+ BcSmartspaceTemplateDataUtils.updateVisibility(textView, 0);
+ } else {
+ textView.setText("");
+ BcSmartspaceTemplateDataUtils.updateVisibility(textView, 8);
+ }
+ i++;
+ }
+ }
+ if (templateData.getSubListAction() != null) {
+ BcSmartSpaceUtil.setOnClickListener(this, smartspaceTarget, templateData.getSubListAction(), smartspaceEventNotifier, "SubListTemplateCard", bcSmartspaceCardLoggingInfo);
+ return true;
+ }
+ return true;
+ }
+}