Merge changes Idbb63960,Id7889566

* changes:
  Delete some unused resources
  Move all contextual card related classes.
This commit is contained in:
TreeHugger Robot
2018-10-26 19:18:19 +00:00
committed by Android (Google) Code Review
101 changed files with 254 additions and 1224 deletions

View File

@@ -3108,7 +3108,7 @@
android:permission="android.permission.BIND_JOB_SERVICE" /> android:permission="android.permission.BIND_JOB_SERVICE" />
<provider <provider
android:name=".homepage.CardContentProvider" android:name=".homepage.contextualcards.CardContentProvider"
android:authorities="com.android.settings.homepage.CardContentProvider" android:authorities="com.android.settings.homepage.CardContentProvider"
android:exported="true" android:exported="true"
android:permission="android.permission.WRITE_SETTINGS_HOMEPAGE_DATA" /> android:permission="android.permission.WRITE_SETTINGS_HOMEPAGE_DATA" />

View File

@@ -1,44 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
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.
-->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/SuggestionConditionStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:paddingStart="14dp"
android:paddingEnd="14dp"
android:paddingBottom="@dimen/dashboard_padding_bottom">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardUseCompatPadding="true"
app:cardElevation="2dp"
app:cardCornerRadius="@dimen/suggestion_card_corner_radius">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/data"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none"/>
</androidx.cardview.widget.CardView>
</FrameLayout>

View File

@@ -1,35 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
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.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/SuggestionConditionStyle"
android:layout_width="match_parent"
android:layout_height="44dp"
android:contentDescription="@string/dashboard_suggestion_condition_footer_content_description"
android:gravity="end"
android:orientation="horizontal"
android:paddingTop="10dp"
android:paddingEnd="10dp">
<ImageView
android:id="@+id/collapse_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_expand_less" />
</LinearLayout>

View File

@@ -1,87 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
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.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/SuggestionConditionStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/condition_header_height"
android:layout_centerHorizontal="true">
<FrameLayout
android:id="@android:id/icon_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_centerVertical="true">
<include layout="@layout/condition_header_icon" />
</FrameLayout>
<ImageView
android:id="@+id/expand_indicator"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:paddingTop="4dp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:src="@drawable/ic_expand_more"/>
<TextView
android:id="@android:id/summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_toStartOf="@id/expand_indicator"
android:layout_centerVertical="true"
android:gravity="end"
android:textAppearance="@style/TextAppearance.SuggestionTitle"
android:textColor="?android:attr/colorAccent" />
<TextView
android:id="@android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="@android:id/icon_frame"
android:layout_toStartOf="@android:id/summary"
android:layout_centerVertical="true"
android:singleLine="true"
android:ellipsize="end"
android:textAppearance="@style/TextAppearance.SuggestionTitle"
android:textColor="?android:attr/textColorPrimary" />
<LinearLayout
android:id="@+id/additional_icons"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toStartOf="@android:id/summary"
android:layout_toEndOf="@android:id/icon_frame"
android:orientation="horizontal"
android:gravity="center_vertical"/>
</RelativeLayout>
</LinearLayout>

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
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.
-->
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/icon"
android:layout_width="@dimen/suggestion_card_icon_size"
android:layout_height="@dimen/suggestion_card_icon_size"
android:layout_marginStart="0dp"
android:layout_marginEnd="24dp"
android:tint="?android:attr/colorAccent" />

View File

@@ -1,91 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
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.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/condition_header_height"
android:background="?android:attr/selectableItemBackground"
android:orientation="horizontal">
<ImageView
android:id="@android:id/icon"
android:layout_width="@dimen/suggestion_card_icon_size"
android:layout_height="@dimen/suggestion_card_icon_size"
android:layout_marginTop="12dp"
android:layout_marginStart="14dp"
android:layout_marginEnd="24dp"
android:tint="?android:attr/colorAccent"/>
<TextView
android:id="@android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"/>
</LinearLayout>
<TextView
android:id="@android:id/summary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="62dp"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:paddingBottom="8dp"
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
android:alpha=".7"
android:textColor="?android:attr/textColorPrimary"/>
<androidx.appcompat.widget.ButtonBarLayout
android:id="@+id/buttonBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="62dp"
android:paddingBottom="1dp"
style="?android:attr/buttonBarStyle"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
<Button
android:id="@+id/first_action"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="0dp"
android:alpha=".8"
android:textAlignment="viewStart"
android:textColor="?android:attr/textColorPrimary"
style="?android:attr/buttonBarButtonStyle"/>
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</androidx.appcompat.widget.ButtonBarLayout>
<include layout="@layout/horizontal_divider"/>
</LinearLayout>

View File

@@ -1,29 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project
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.android.settings.homepage.conditional.FocusRecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dashboard_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="false"
android:clipToPadding="false"
android:focusable="false"
android:paddingStart="@dimen/dashboard_padding_start"
android:paddingEnd="@dimen/dashboard_padding_end"
android:paddingTop="@dimen/dashboard_padding_top"
android:paddingBottom="@dimen/dashboard_padding_bottom"
android:scrollbars="vertical"/>

View File

@@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2015 The Android Open Source Project
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.
-->
<View
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="8dp"
android:background="?android:attr/colorSecondary"/>

View File

@@ -1,60 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project
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.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dashboard_tile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="@dimen/dashboard_tile_minimum_height"
android:clickable="true"
android:focusable="true">
<ImageView
android:id="@android:id/icon"
android:layout_width="@dimen/dashboard_tile_image_size"
android:layout_height="@dimen/dashboard_tile_image_size"
android:scaleType="centerInside"
android:layout_marginStart="@dimen/dashboard_tile_image_margin"
android:layout_marginEnd="@dimen/dashboard_tile_image_margin" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView android:id="@android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.TileTitle"
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
<TextView android:id="@android:id/summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.Small"
android:textColor="?android:attr/textColorSecondary"
android:maxLines="1"
android:ellipsize="end"
android:paddingEnd="@dimen/dashboard_tile_image_margin" />
</LinearLayout>
</LinearLayout>

View File

@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 The Android Open Source Project
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.
-->
<!-- Style for a preference category without a header title.
Based on tall_preference_category, but invisible and with some 0dp attributes. -->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/title"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="0dip"
android:textAppearance="@android:style/TextAppearance.Material.Body2"
android:textColor="?android:attr/colorAccent"
android:paddingBottom="8dp"
android:paddingTop="16dip"
android:visible="false" />

View File

@@ -16,11 +16,82 @@
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android" 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_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
style="@style/ContextualCardStyle"> style="@style/ContextualCardStyle">
<include layout="@layout/condition_tile"/> <LinearLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/condition_header_height"
android:background="?android:attr/selectableItemBackground"
android:orientation="horizontal">
<ImageView
android:id="@android:id/icon"
android:layout_width="@dimen/suggestion_card_icon_size"
android:layout_height="@dimen/suggestion_card_icon_size"
android:layout_marginTop="12dp"
android:layout_marginStart="14dp"
android:layout_marginEnd="24dp"
android:tint="?android:attr/colorAccent"/>
<TextView
android:id="@android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"/>
</LinearLayout>
<TextView
android:id="@android:id/summary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="62dp"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:paddingBottom="8dp"
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
android:alpha=".7"
android:textColor="?android:attr/textColorPrimary"/>
<androidx.appcompat.widget.ButtonBarLayout
android:id="@+id/buttonBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="62dp"
android:paddingBottom="1dp"
style="?android:attr/buttonBarStyle"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
<Button
android:id="@+id/first_action"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="0dp"
android:alpha=".8"
android:textAlignment="viewStart"
android:textColor="?android:attr/textColorPrimary"
style="?android:attr/buttonBarButtonStyle"/>
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</androidx.appcompat.widget.ButtonBarLayout>
<include layout="@layout/horizontal_divider"/>
</LinearLayout>
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>

View File

@@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
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.
-->
<ImageView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/icon"
android:layout_width="@dimen/dashboard_tile_foreground_image_size"
android:layout_height="match_parent"
android:scaleType="centerInside"
android:layout_marginStart="@dimen/dashboard_tile_image_margin"
android:layout_marginEnd="@dimen/dashboard_tile_image_margin" />

View File

@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
* Copyright 2016, The Android Open Source Project
*
* 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.
*/
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main_content"
android:layout_height="match_parent"
android:layout_width="match_parent"/>

View File

@@ -1,34 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2017 The Android Open Source Project
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.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:background="?android:attr/selectableItemBackground"
android:clipToPadding="false">
<include layout="@layout/search_icon_view"/>
<android.app.slice.widget.SliceView
android:id="@android:id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>

View File

@@ -1,79 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
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.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:paddingStart="@dimen/preference_no_icon_padding_start"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:orientation="horizontal">
<!-- Shows the data plan usage in chart -->
<com.android.settings.widget.DonutView
android:id="@+id/donut"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_marginEnd="8dp"
android:layout_gravity="center"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:gravity="end|center_vertical"
settings:applyColorAccent="false"
settings:showPercentString="false"
settings:thickness="6dp"/>
<LinearLayout
android:id="@+id/data_plan_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="2dp"
android:orientation="vertical">
<!-- Shows the data plan usage -->
<TextView
android:id="@android:id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:paddingTop="0dp"
android:fontFamily="@*android:string/config_headlineFontFamily"
android:textAppearance="@android:style/TextAppearance.Material.Title"/>
<!-- Shows the data plan name -->
<TextView
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="5dp"
android:maxLines="3"
android:textAppearance="@android:style/TextAppearance.Material.Subhead"
android:textColor="?android:attr/textColorSecondary"/>
<!-- Shows the data plan description -->
<TextView
android:id="@android:id/text2"
android:textStyle="italic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="5"
android:textAppearance="@android:style/TextAppearance.Material.Subhead"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
</LinearLayout>

View File

@@ -29,7 +29,7 @@
<include layout="@layout/search_bar"/> <include layout="@layout/search_bar"/>
<FrameLayout <FrameLayout
android:id="@+id/suggestion_content" android:id="@+id/contextual_cards_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 The Android Open Source Project
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.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/SuggestionConditionStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="2dp"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/suggestion_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="16dp"
android:scrollbars="none"/>
</LinearLayout>

View File

@@ -1,93 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2017 The Android Open Source Project
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.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/suggestion_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="true"
app:cardElevation="2dp"
app:cardCornerRadius="@dimen/suggestion_card_corner_radius">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="112dp"
android:paddingBottom="8dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@android:id/icon"
android:layout_width="@dimen/suggestion_card_icon_size"
android:layout_height="@dimen/suggestion_card_icon_size"
style="@style/SuggestionCardIcon"
android:layout_marginTop="16dp"
android:layout_marginBottom="6dp" />
<FrameLayout
android:id="@+id/close_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentEnd="true"
android:paddingTop="8dp"
android:paddingEnd="8dp"
android:orientation="horizontal"
android:contentDescription="@string/dlg_close">
<ImageView
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_gravity="end|top"
android:alpha="0.54"
android:src="@drawable/ic_suggestion_close_button"/>
</FrameLayout>
</RelativeLayout>
<TextView
android:id="@android:id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/SuggestionCardText"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.SuggestionTitle"
android:fadingEdge="horizontal" />
<TextView
android:id="@android:id/summary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/SuggestionCardText"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.SuggestionSummary" />
</LinearLayout>
</androidx.cardview.widget.CardView>

View File

@@ -1,84 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2017 The Android Open Source Project
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.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/suggestion_card"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="true"
app:cardElevation="2dp"
app:cardCornerRadius="@dimen/suggestion_card_corner_radius">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="112dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@android:id/icon"
android:layout_width="@dimen/suggestion_card_icon_size"
android:layout_height="@dimen/suggestion_card_icon_size"
style="@style/SuggestionCardIcon"
android:layout_marginTop="16dp"
android:layout_marginBottom="8dp" />
<FrameLayout
android:id="@+id/close_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentEnd="true"
android:gravity="end|top"
android:paddingTop="8dp"
android:paddingEnd="8dp"
android:orientation="horizontal"
android:contentDescription="@string/dlg_close">
<ImageView
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_gravity="end|top"
android:alpha="0.54"
android:src="@drawable/ic_suggestion_close_button"/>
</FrameLayout>
</RelativeLayout>
<TextView
android:id="@android:id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
style="@style/SuggestionCardText"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="16dp"
android:gravity="center_vertical"
android:textAppearance="@style/TextAppearance.SuggestionTitle"
android:maxLines="3"
android:ellipsize="end"
android:fadingEdge="horizontal" />
</LinearLayout>
</androidx.cardview.widget.CardView>

View File

@@ -1,104 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2017 The Android Open Source Project
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.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/suggestion_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="true"
app:cardElevation="2dp"
app:cardCornerRadius="@dimen/suggestion_card_corner_radius">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="160dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@android:id/icon"
android:layout_width="@dimen/suggestion_card_icon_size"
android:layout_height="@dimen/suggestion_card_icon_size"
style="@style/SuggestionCardIcon"
android:layout_marginTop="16dp"
android:layout_marginBottom="6dp" />
<FrameLayout
android:id="@+id/close_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentEnd="true"
android:paddingTop="8dp"
android:paddingEnd="8dp"
android:orientation="horizontal"
android:contentDescription="@string/dlg_close">
<ImageView
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_gravity="end|top"
android:alpha="0.54"
android:src="@drawable/ic_suggestion_close_button"/>
</FrameLayout>
</RelativeLayout>
<TextView
android:id="@android:id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/SuggestionCardText"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.SuggestionTitle"
android:fadingEdge="horizontal" />
<TextView
android:id="@android:id/summary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/SuggestionCardText"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.SuggestionSummary" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/SuggestionCardButton">
<Button
android:id="@android:id/primary"
style="@style/ActionPrimaryButton"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/suggestion_button_text" />
</FrameLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>

View File

@@ -1,43 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2017 The Android Open Source Project
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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:orientation="vertical"
android:paddingStart="?android:attr/dialogPreferredPadding"
android:paddingEnd="?android:attr/dialogPreferredPadding"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:ellipsize="marquee"
android:fadingEdge="horizontal"/>
<TextView
android:id="@+id/summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/title"
android:layout_alignStart="@id/title"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
android:maxLines="4"/>
</LinearLayout>

View File

@@ -17,10 +17,6 @@
<resources> <resources>
<dimen name="settings_side_margin">112dp</dimen> <dimen name="settings_side_margin">112dp</dimen>
<!-- Dashboard padding in its container -->
<dimen name="dashboard_padding_start">160dp</dimen>
<dimen name="dashboard_padding_end">160dp</dimen>
<!-- ActionBar contentInsetStart --> <!-- ActionBar contentInsetStart -->
<dimen name="actionbar_contentInsetStart">128dp</dimen> <dimen name="actionbar_contentInsetStart">128dp</dimen>
<dimen name="actionbar_subsettings_contentInsetStart">128dp</dimen> <dimen name="actionbar_subsettings_contentInsetStart">128dp</dimen>

View File

@@ -31,18 +31,6 @@
<dimen name="actionbar_contentInsetStart">80dp</dimen> <dimen name="actionbar_contentInsetStart">80dp</dimen>
<dimen name="actionbar_subsettings_contentInsetStart">80dp</dimen> <dimen name="actionbar_subsettings_contentInsetStart">80dp</dimen>
<!-- Dashboard margins between each tiles within the layout -->
<dimen name="dashboard_cell_gap_x">24dp</dimen>
<dimen name="dashboard_cell_gap_y">0dp</dimen>
<!-- Dashboard padding in its container -->
<dimen name="dashboard_padding_start">80dp</dimen>
<dimen name="dashboard_padding_end">80dp</dimen>
<!-- Dashboard category padding start / end -->
<dimen name="dashboard_category_padding_start">24dp</dimen>
<dimen name="dashboard_category_padding_end">24dp</dimen>
<!-- SwitchBar sub settings margin start / end --> <!-- SwitchBar sub settings margin start / end -->
<dimen name="switchbar_subsettings_margin_start">80dp</dimen> <dimen name="switchbar_subsettings_margin_start">80dp</dimen>
<dimen name="switchbar_subsettings_margin_end">80dp</dimen> <dimen name="switchbar_subsettings_margin_end">80dp</dimen>

View File

@@ -79,19 +79,6 @@
<dimen name="actionbar_contentInsetStart">16dp</dimen> <dimen name="actionbar_contentInsetStart">16dp</dimen>
<dimen name="actionbar_subsettings_contentInsetStart">72dp</dimen> <dimen name="actionbar_subsettings_contentInsetStart">72dp</dimen>
<!-- Dashboard padding in its container -->
<dimen name="dashboard_padding_start">0dp</dimen>
<dimen name="dashboard_padding_end">0dp</dimen>
<dimen name="dashboard_padding_top">0dp</dimen>
<dimen name="dashboard_padding_bottom">0dp</dimen>
<!-- Dashboard category padding start / end -->
<dimen name="dashboard_category_padding_start">0dp</dimen>
<dimen name="dashboard_category_padding_end">0dp</dimen>
<!-- Dashboard tile minimum height -->
<dimen name="dashboard_tile_minimum_height">72dp</dimen>
<!-- Dashboard image tile size --> <!-- Dashboard image tile size -->
<dimen name="dashboard_tile_image_size">36dp</dimen> <dimen name="dashboard_tile_image_size">36dp</dimen>
@@ -101,9 +88,6 @@
<!-- Dashboard foreground image inset (from background edge to foreground edge) --> <!-- Dashboard foreground image inset (from background edge to foreground edge) -->
<dimen name="dashboard_tile_foreground_image_inset">6dp</dimen> <dimen name="dashboard_tile_foreground_image_inset">6dp</dimen>
<!-- Dashboard tile image margin start / end -->
<dimen name="dashboard_tile_image_margin">18dp</dimen>
<!-- SwitchBar sub settings margin start / end --> <!-- SwitchBar sub settings margin start / end -->
<dimen name="switchbar_subsettings_margin_start">72dp</dimen> <dimen name="switchbar_subsettings_margin_start">72dp</dimen>
<dimen name="switchbar_subsettings_margin_end">16dp</dimen> <dimen name="switchbar_subsettings_margin_end">16dp</dimen>

View File

@@ -25,9 +25,6 @@
<!-- Strings for Dialog deny button --> <!-- Strings for Dialog deny button -->
<string name="deny">Deny</string> <string name="deny">Deny</string>
<!-- Strings for Dialog close button [CHAR LIMIT=20] -->
<string name="dlg_close">Close</string>
<!-- Device Info screen. Used for a status item's value when the proper value is not known --> <!-- Device Info screen. Used for a status item's value when the proper value is not known -->
<string name="device_info_default">Unknown</string> <string name="device_info_default">Unknown</string>
<!-- [CHAR LIMIT=NONE] Device Info screen. Countdown for user taps to enable development settings --> <!-- [CHAR LIMIT=NONE] Device Info screen. Countdown for user taps to enable development settings -->
@@ -6871,9 +6868,6 @@
<item quantity="other">Show %d hidden items</item> <item quantity="other">Show %d hidden items</item>
</plurals> </plurals>
<!-- Content description for suggestion footer button. Double tapping will cause suggestion list to collapse [CHAR LIMIT=NONE]-->
<string name="dashboard_suggestion_condition_footer_content_description">Collapse</string>
<!-- Title for setting tile leading to network and Internet settings [CHAR LIMIT=40]--> <!-- Title for setting tile leading to network and Internet settings [CHAR LIMIT=40]-->
<string name="network_dashboard_title">Network &amp; internet</string> <string name="network_dashboard_title">Network &amp; internet</string>
<!-- Summary for Network and Internet settings, explaining it contains mobile network setting [CHAR LIMIT=NONE]--> <!-- Summary for Network and Internet settings, explaining it contains mobile network setting [CHAR LIMIT=NONE]-->

View File

@@ -333,10 +333,6 @@
<item name="android:padding">8dp</item> <item name="android:padding">8dp</item>
</style> </style>
<style name="SuggestionConditionStyle">
<item name="android:background">?android:attr/colorPrimary</item>
</style>
<style name="SuggestionCardText"> <style name="SuggestionCardText">
<item name="android:textAlignment">viewStart</item> <item name="android:textAlignment">viewStart</item>
</style> </style>

View File

@@ -75,7 +75,7 @@
<PreferenceCategory <PreferenceCategory
android:key="uri_category" android:key="uri_category"
android:layout="@layout/headerless_preference_category" android:layout="@layout/preference_category_no_label"
settings:allowDividerAbove="false" settings:allowDividerAbove="false"
settings:allowDividerBelow="false"> settings:allowDividerBelow="false">
<com.android.settings.applications.LayoutPreference <com.android.settings.applications.LayoutPreference

View File

@@ -29,13 +29,11 @@ import androidx.fragment.app.FragmentTransaction;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.core.FeatureFlags; import com.android.settings.core.FeatureFlags;
import com.android.settings.core.SettingsBaseActivity; import com.android.settings.core.SettingsBaseActivity;
import com.android.settings.homepage.contextualcards.ContextualCardsFragment;
import com.android.settings.overlay.FeatureFactory; import com.android.settings.overlay.FeatureFactory;
public class SettingsHomepageActivity extends SettingsBaseActivity { public class SettingsHomepageActivity extends SettingsBaseActivity {
private static final String SUGGESTION_TAG = "suggestion";
private static final String MAIN_TAG = "main";
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@@ -54,21 +52,21 @@ public class SettingsHomepageActivity extends SettingsBaseActivity {
FeatureFactory.getFactory(this).getSearchFeatureProvider() FeatureFactory.getFactory(this).getSearchFeatureProvider()
.initSearchToolbar(this, toolbar); .initSearchToolbar(this, toolbar);
showFragment(new PersonalSettingsFragment(), R.id.suggestion_content, SUGGESTION_TAG); showFragment(new ContextualCardsFragment(), R.id.contextual_cards_content);
showFragment(new TopLevelSettings(), R.id.main_content, MAIN_TAG); showFragment(new TopLevelSettings(), R.id.main_content);
} }
public static boolean isDynamicHomepageEnabled(Context context) { public static boolean isDynamicHomepageEnabled(Context context) {
return FeatureFlagUtils.isEnabled(context, FeatureFlags.DYNAMIC_HOMEPAGE); return FeatureFlagUtils.isEnabled(context, FeatureFlags.DYNAMIC_HOMEPAGE);
} }
private void showFragment(Fragment fragment, int id, String tag) { private void showFragment(Fragment fragment, int id) {
final FragmentManager fragmentManager = getSupportFragmentManager(); final FragmentManager fragmentManager = getSupportFragmentManager();
final FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); final FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
final Fragment showFragment = fragmentManager.findFragmentById(id); final Fragment showFragment = fragmentManager.findFragmentById(id);
if (showFragment == null) { if (showFragment == null) {
fragmentTransaction.add(id, fragment, tag); fragmentTransaction.add(id, fragment);
} else { } else {
fragmentTransaction.show(showFragment); fragmentTransaction.show(showFragment);
} }

View File

@@ -1,50 +0,0 @@
/*
* Copyright 2015, The Android Open Source Project
*
* 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.
*/
package com.android.settings.homepage.conditional;
import android.content.Context;
import android.util.AttributeSet;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
/**
* Version of RecyclerView that can have listeners for onWindowFocusChanged.
*/
public class FocusRecyclerView extends RecyclerView {
private FocusListener mListener;
public FocusRecyclerView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
@Override
public void onWindowFocusChanged(boolean hasWindowFocus) {
super.onWindowFocusChanged(hasWindowFocus);
if (mListener != null) {
mListener.onWindowFocusChanged(hasWindowFocus);
}
}
public void setListener(FocusListener listener) {
mListener = listener;
}
public interface FocusListener {
void onWindowFocusChanged(boolean hasWindowFocus);
}
}

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage; package com.android.settings.homepage.contextualcards;
import android.content.ContentProvider; import android.content.ContentProvider;
import android.content.ContentValues; import android.content.ContentValues;
@@ -41,14 +41,12 @@ public class CardContentProvider extends ContentProvider {
public static final String CARD_AUTHORITY = "com.android.settings.homepage.CardContentProvider"; public static final String CARD_AUTHORITY = "com.android.settings.homepage.CardContentProvider";
/** URI matcher for ContentProvider queries. */ /** URI matcher for ContentProvider queries. */
private static final UriMatcher sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH); private static final UriMatcher URI_MATCHER = new UriMatcher(UriMatcher.NO_MATCH);
/** URI matcher type for cards table */ /** URI matcher type for cards table */
private static final int MATCH_CARDS = 100; private static final int MATCH_CARDS = 100;
/** URI matcher type for card log table */
private static final int MATCH_CARD_LOG = 200;
static { static {
sUriMatcher.addURI(CARD_AUTHORITY, CardDatabaseHelper.CARD_TABLE, MATCH_CARDS); URI_MATCHER.addURI(CARD_AUTHORITY, CardDatabaseHelper.CARD_TABLE, MATCH_CARDS);
} }
private CardDatabaseHelper mDBHelper; private CardDatabaseHelper mDBHelper;
@@ -170,7 +168,7 @@ public class CardContentProvider extends ContentProvider {
@VisibleForTesting @VisibleForTesting
String getTableFromMatch(Uri uri) { String getTableFromMatch(Uri uri) {
final int match = sUriMatcher.match(uri); final int match = URI_MATCHER.match(uri);
String table; String table;
switch (match) { switch (match) {
case MATCH_CARDS: case MATCH_CARDS:

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage; package com.android.settings.homepage.contextualcards;
import android.content.Context; import android.content.Context;
import android.database.Cursor; import android.database.Cursor;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage; package com.android.settings.homepage.contextualcards;
import android.annotation.IntDef; import android.annotation.IntDef;
import android.database.Cursor; import android.database.Cursor;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage; package com.android.settings.homepage.contextualcards;
/** /**
* Data controller for {@link ContextualCard}. * Data controller for {@link ContextualCard}.

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage; package com.android.settings.homepage.contextualcards;
import static android.app.slice.Slice.HINT_ERROR; import static android.app.slice.Slice.HINT_ERROR;
@@ -32,17 +32,17 @@ import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import androidx.slice.Slice; import androidx.slice.Slice;
import com.android.settings.homepage.deviceinfo.BatterySlice; import com.android.settings.homepage.contextualcards.deviceinfo.BatterySlice;
import com.android.settings.homepage.deviceinfo.DataUsageSlice; import com.android.settings.homepage.contextualcards.deviceinfo.DataUsageSlice;
import com.android.settings.homepage.deviceinfo.DeviceInfoSlice; import com.android.settings.homepage.contextualcards.deviceinfo.DeviceInfoSlice;
import com.android.settingslib.utils.AsyncLoaderCompat; import com.android.settingslib.utils.AsyncLoaderCompat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class CardContentLoader extends AsyncLoaderCompat<List<ContextualCard>> { public class ContextualCardLoader extends AsyncLoaderCompat<List<ContextualCard>> {
private static final String TAG = "CardContentLoader"; private static final String TAG = "ContextualCardLoader";
static final int CARD_CONTENT_LOADER_ID = 1; static final int CARD_CONTENT_LOADER_ID = 1;
private Context mContext; private Context mContext;
@@ -51,7 +51,7 @@ public class CardContentLoader extends AsyncLoaderCompat<List<ContextualCard>> {
void onFinishCardLoading(List<ContextualCard> contextualCards); void onFinishCardLoading(List<ContextualCard> contextualCards);
} }
CardContentLoader(Context context) { ContextualCardLoader(Context context) {
super(context); super(context);
mContext = context.getApplicationContext(); mContext = context.getApplicationContext();
} }
@@ -79,7 +79,7 @@ public class CardContentLoader extends AsyncLoaderCompat<List<ContextualCard>> {
} }
} }
} }
return filter(result); return filterEligibleCards(result);
} }
@VisibleForTesting @VisibleForTesting
@@ -92,8 +92,8 @@ public class CardContentLoader extends AsyncLoaderCompat<List<ContextualCard>> {
final long appVersionCode = getAppVersionCode(); final long appVersionCode = getAppVersionCode();
final String packageName = mContext.getPackageName(); final String packageName = mContext.getPackageName();
final double rankingScore = 0.0; final double rankingScore = 0.0;
final List<ContextualCard> result = new ArrayList() {{ final List<ContextualCard> result = new ArrayList();
add(new ContextualCard.Builder() result.add(new ContextualCard.Builder()
.setSliceUri(DataUsageSlice.DATA_USAGE_CARD_URI) .setSliceUri(DataUsageSlice.DATA_USAGE_CARD_URI)
.setName(DataUsageSlice.PATH_DATA_USAGE) .setName(DataUsageSlice.PATH_DATA_USAGE)
.setPackageName(packageName) .setPackageName(packageName)
@@ -102,7 +102,7 @@ public class CardContentLoader extends AsyncLoaderCompat<List<ContextualCard>> {
.setCardType(ContextualCard.CardType.SLICE) .setCardType(ContextualCard.CardType.SLICE)
.setIsHalfWidth(false) .setIsHalfWidth(false)
.build()); .build());
add(new ContextualCard.Builder() result.add(new ContextualCard.Builder()
.setSliceUri(BatterySlice.BATTERY_CARD_URI) .setSliceUri(BatterySlice.BATTERY_CARD_URI)
.setName(BatterySlice.PATH_BATTERY_INFO) .setName(BatterySlice.PATH_BATTERY_INFO)
.setPackageName(packageName) .setPackageName(packageName)
@@ -111,7 +111,7 @@ public class CardContentLoader extends AsyncLoaderCompat<List<ContextualCard>> {
.setCardType(ContextualCard.CardType.SLICE) .setCardType(ContextualCard.CardType.SLICE)
.setIsHalfWidth(false) .setIsHalfWidth(false)
.build()); .build());
add(new ContextualCard.Builder() result.add(new ContextualCard.Builder()
.setSliceUri(DeviceInfoSlice.DEVICE_INFO_CARD_URI) .setSliceUri(DeviceInfoSlice.DEVICE_INFO_CARD_URI)
.setName(DeviceInfoSlice.PATH_DEVICE_INFO) .setName(DeviceInfoSlice.PATH_DEVICE_INFO)
.setPackageName(packageName) .setPackageName(packageName)
@@ -120,14 +120,13 @@ public class CardContentLoader extends AsyncLoaderCompat<List<ContextualCard>> {
.setCardType(ContextualCard.CardType.SLICE) .setCardType(ContextualCard.CardType.SLICE)
.setIsHalfWidth(false) .setIsHalfWidth(false)
.build()); .build());
}};
return result; return result;
} }
@VisibleForTesting @VisibleForTesting
List<ContextualCard> filter(List<ContextualCard> candidates) { List<ContextualCard> filterEligibleCards(List<ContextualCard> candidates) {
return candidates.stream().filter(card -> isCardEligibleToDisplay(card)).collect( return candidates.stream().filter(card -> isCardEligibleToDisplay(card))
Collectors.toList()); .collect(Collectors.toList());
} }
@VisibleForTesting @VisibleForTesting

View File

@@ -14,13 +14,13 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage; package com.android.settings.homepage.contextualcards;
import com.android.settings.homepage.ContextualCard.CardType; import com.android.settings.homepage.contextualcards.ContextualCard.CardType;
import com.android.settings.homepage.conditional.ConditionContextualCardController; import com.android.settings.homepage.contextualcards.conditional.ConditionContextualCardController;
import com.android.settings.homepage.conditional.ConditionContextualCardRenderer; import com.android.settings.homepage.contextualcards.conditional.ConditionContextualCardRenderer;
import com.android.settings.homepage.slices.SliceContextualCardController; import com.android.settings.homepage.contextualcards.slices.SliceContextualCardController;
import com.android.settings.homepage.slices.SliceContextualCardRenderer; import com.android.settings.homepage.contextualcards.slices.SliceContextualCardRenderer;
import java.util.Set; import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;

View File

@@ -14,9 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage; package com.android.settings.homepage.contextualcards;
import static com.android.settings.homepage.CardContentLoader.CARD_CONTENT_LOADER_ID; import static com.android.settings.homepage.contextualcards.ContextualCardLoader.CARD_CONTENT_LOADER_ID;
import static java.util.stream.Collectors.groupingBy; import static java.util.stream.Collectors.groupingBy;
@@ -43,7 +43,7 @@ import java.util.stream.Collectors;
/** /**
* This is a centralized manager of multiple {@link ContextualCardController}. * This is a centralized manager of multiple {@link ContextualCardController}.
* *
* {@link ContextualCardManager} first loads data from {@link CardContentLoader} and gets back a * {@link ContextualCardManager} first loads data from {@link ContextualCardLoader} and gets back a
* list of {@link ContextualCard}. All subclasses of {@link ContextualCardController} are loaded * list of {@link ContextualCard}. All subclasses of {@link ContextualCardController} are loaded
* here, which will then trigger the {@link ContextualCardController} to load its data and listen to * here, which will then trigger the {@link ContextualCardController} to load its data and listen to
* corresponding changes. When every single {@link ContextualCardController} updates its data, the * corresponding changes. When every single {@link ContextualCardController} updates its data, the
@@ -52,7 +52,7 @@ import java.util.stream.Collectors;
* {@link ContextualCardsAdapter} and {@link BaseAdapter#notifyDataSetChanged()} will be called to * {@link ContextualCardsAdapter} and {@link BaseAdapter#notifyDataSetChanged()} will be called to
* get the page refreshed. * get the page refreshed.
*/ */
public class ContextualCardManager implements CardContentLoader.CardContentLoaderListener, public class ContextualCardManager implements ContextualCardLoader.CardContentLoaderListener,
ContextualCardUpdateListener { ContextualCardUpdateListener {
private static final String TAG = "ContextualCardManager"; private static final String TAG = "ContextualCardManager";
@@ -80,7 +80,7 @@ public class ContextualCardManager implements CardContentLoader.CardContentLoade
} }
} }
void loadContextualCards(PersonalSettingsFragment fragment) { void loadContextualCards(ContextualCardsFragment fragment) {
final CardContentLoaderCallbacks cardContentLoaderCallbacks = final CardContentLoaderCallbacks cardContentLoaderCallbacks =
new CardContentLoaderCallbacks(mContext); new CardContentLoaderCallbacks(mContext);
cardContentLoaderCallbacks.setListener(this); cardContentLoaderCallbacks.setListener(this);
@@ -157,13 +157,13 @@ public class ContextualCardManager implements CardContentLoader.CardContentLoade
LoaderManager.LoaderCallbacks<List<ContextualCard>> { LoaderManager.LoaderCallbacks<List<ContextualCard>> {
private Context mContext; private Context mContext;
private CardContentLoader.CardContentLoaderListener mListener; private ContextualCardLoader.CardContentLoaderListener mListener;
CardContentLoaderCallbacks(Context context) { CardContentLoaderCallbacks(Context context) {
mContext = context.getApplicationContext(); mContext = context.getApplicationContext();
} }
protected void setListener(CardContentLoader.CardContentLoaderListener listener) { protected void setListener(ContextualCardLoader.CardContentLoaderListener listener) {
mListener = listener; mListener = listener;
} }
@@ -171,7 +171,7 @@ public class ContextualCardManager implements CardContentLoader.CardContentLoade
@Override @Override
public Loader<List<ContextualCard>> onCreateLoader(int id, @Nullable Bundle bundle) { public Loader<List<ContextualCard>> onCreateLoader(int id, @Nullable Bundle bundle) {
if (id == CARD_CONTENT_LOADER_ID) { if (id == CARD_CONTENT_LOADER_ID) {
return new CardContentLoader(mContext); return new ContextualCardLoader(mContext);
} else { } else {
throw new IllegalArgumentException("Unknown loader id: " + id); throw new IllegalArgumentException("Unknown loader id: " + id);
} }

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage; package com.android.settings.homepage.contextualcards;
import android.view.View; import android.view.View;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage; package com.android.settings.homepage.contextualcards;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage; package com.android.settings.homepage.contextualcards;
import android.content.Context; import android.content.Context;
import android.view.LayoutInflater; import android.view.LayoutInflater;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage; package com.android.settings.homepage.contextualcards;
import androidx.recyclerview.widget.DiffUtil; import androidx.recyclerview.widget.DiffUtil;

View File

@@ -14,9 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage; package com.android.settings.homepage.contextualcards;
import static com.android.settings.homepage.ContextualCardsAdapter.SPAN_COUNT; import static com.android.settings.homepage.contextualcards.ContextualCardsAdapter.SPAN_COUNT;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@@ -30,9 +30,9 @@ import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.core.InstrumentedFragment; import com.android.settings.core.InstrumentedFragment;
public class PersonalSettingsFragment extends InstrumentedFragment { public class ContextualCardsFragment extends InstrumentedFragment {
private static final String TAG = "PersonalSettingsFragment"; private static final String TAG = "ContextualCardsFragment";
private RecyclerView mCardsContainer; private RecyclerView mCardsContainer;
private GridLayoutManager mLayoutManager; private GridLayoutManager mLayoutManager;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage; package com.android.settings.homepage.contextualcards;
import android.content.Context; import android.content.Context;
import android.util.Log; import android.util.Log;
@@ -22,10 +22,10 @@ import android.util.Log;
import androidx.collection.ArraySet; import androidx.collection.ArraySet;
import androidx.lifecycle.LifecycleOwner; import androidx.lifecycle.LifecycleOwner;
import com.android.settings.homepage.conditional.ConditionContextualCardController; import com.android.settings.homepage.contextualcards.conditional.ConditionContextualCardController;
import com.android.settings.homepage.conditional.ConditionContextualCardRenderer; import com.android.settings.homepage.contextualcards.conditional.ConditionContextualCardRenderer;
import com.android.settings.homepage.slices.SliceContextualCardController; import com.android.settings.homepage.contextualcards.slices.SliceContextualCardController;
import com.android.settings.homepage.slices.SliceContextualCardRenderer; import com.android.settings.homepage.contextualcards.slices.SliceContextualCardRenderer;
import java.util.Set; import java.util.Set;

View File

@@ -20,11 +20,11 @@ import static android.provider.SettingsSlicesContract.KEY_WIFI;
import android.annotation.Nullable; import android.annotation.Nullable;
import com.android.settings.homepage.deviceinfo.BatterySlice; import com.android.settings.homepage.contextualcards.deviceinfo.BatterySlice;
import com.android.settings.homepage.deviceinfo.DataUsageSlice; import com.android.settings.homepage.contextualcards.deviceinfo.DataUsageSlice;
import com.android.settings.homepage.deviceinfo.DeviceInfoSlice; import com.android.settings.homepage.contextualcards.deviceinfo.DeviceInfoSlice;
import com.android.settings.homepage.deviceinfo.StorageSlice; import com.android.settings.homepage.contextualcards.deviceinfo.EmergencyInfoSlice;
import com.android.settings.homepage.deviceinfo.EmergencyInfoSlice; import com.android.settings.homepage.contextualcards.deviceinfo.StorageSlice;
import com.android.settings.intelligence.ContextualCardProto.ContextualCard; import com.android.settings.intelligence.ContextualCardProto.ContextualCard;
import com.android.settings.intelligence.ContextualCardProto.ContextualCardList; import com.android.settings.intelligence.ContextualCardProto.ContextualCardList;
import com.android.settings.wifi.WifiSlice; import com.android.settings.wifi.WifiSlice;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import android.content.Context; import android.content.Context;
import android.os.PowerManager; import android.os.PowerManager;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;

View File

@@ -14,14 +14,14 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import android.content.Context; import android.content.Context;
import android.util.ArrayMap; import android.util.ArrayMap;
import com.android.settings.homepage.ContextualCard; import com.android.settings.homepage.contextualcards.ContextualCard;
import com.android.settings.homepage.ContextualCardController; import com.android.settings.homepage.contextualcards.ContextualCardController;
import com.android.settings.homepage.ContextualCardUpdateListener; import com.android.settings.homepage.contextualcards.ContextualCardUpdateListener;
import com.android.settingslib.core.lifecycle.LifecycleObserver; import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnStart; import com.android.settingslib.core.lifecycle.events.OnStart;
import com.android.settingslib.core.lifecycle.events.OnStop; import com.android.settingslib.core.lifecycle.events.OnStop;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import android.content.Context; import android.content.Context;
import android.text.TextUtils; import android.text.TextUtils;
@@ -27,9 +27,9 @@ import androidx.recyclerview.widget.RecyclerView;
import com.android.internal.logging.nano.MetricsProto; import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.homepage.ContextualCard; import com.android.settings.homepage.contextualcards.ContextualCard;
import com.android.settings.homepage.ControllerRendererPool; import com.android.settings.homepage.contextualcards.ContextualCardRenderer;
import com.android.settings.homepage.ContextualCardRenderer; import com.android.settings.homepage.contextualcards.ControllerRendererPool;
import com.android.settings.overlay.FeatureFactory; import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider; import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
public interface ConditionListener { public interface ConditionListener {
void onConditionsChanged(); void onConditionsChanged();

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import android.content.Context; import android.content.Context;
import android.util.Log; import android.util.Log;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import android.content.Context; import android.content.Context;

View File

@@ -14,11 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import androidx.annotation.VisibleForTesting; import com.android.settings.homepage.contextualcards.ContextualCard;
import com.android.settings.homepage.ContextualCard;
/** /**
* Data class representing a conditional {@link ContextualCard}. * Data class representing a conditional {@link ContextualCard}.

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import android.content.Context; import android.content.Context;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import static android.content.Context.NOTIFICATION_SERVICE; import static android.content.Context.NOTIFICATION_SERVICE;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import android.content.Context; import android.content.Context;
import android.media.AudioManager; import android.media.AudioManager;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.deviceinfo; package com.android.settings.homepage.contextualcards.deviceinfo;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.ContentResolver; import android.content.ContentResolver;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.deviceinfo; package com.android.settings.homepage.contextualcards.deviceinfo;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.ContentResolver; import android.content.ContentResolver;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.deviceinfo; package com.android.settings.homepage.contextualcards.deviceinfo;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.ContentResolver; import android.content.ContentResolver;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.deviceinfo; package com.android.settings.homepage.contextualcards.deviceinfo;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.ContentResolver; import android.content.ContentResolver;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.deviceinfo; package com.android.settings.homepage.contextualcards.deviceinfo;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.ContentResolver; import android.content.ContentResolver;

View File

@@ -14,13 +14,11 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.slices; package com.android.settings.homepage.contextualcards.slices;
import com.android.settings.homepage.ContextualCard; import com.android.settings.homepage.contextualcards.ContextualCard;
import com.android.settings.homepage.ContextualCardController; import com.android.settings.homepage.contextualcards.ContextualCardController;
import com.android.settings.homepage.ContextualCardUpdateListener; import com.android.settings.homepage.contextualcards.ContextualCardUpdateListener;
import java.util.List;
/** /**
* Card controller for {@link ContextualCard} built as slices. * Card controller for {@link ContextualCard} built as slices.

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.slices; package com.android.settings.homepage.contextualcards.slices;
import android.content.ContentResolver; import android.content.ContentResolver;
import android.content.Context; import android.content.Context;
@@ -35,8 +35,8 @@ import androidx.slice.widget.SliceLiveData;
import androidx.slice.widget.SliceView; import androidx.slice.widget.SliceView;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.homepage.ContextualCard; import com.android.settings.homepage.contextualcards.ContextualCard;
import com.android.settings.homepage.ContextualCardRenderer; import com.android.settings.homepage.contextualcards.ContextualCardRenderer;
import java.util.Map; import java.util.Map;

View File

@@ -20,10 +20,10 @@ import android.content.Context;
import android.net.Uri; import android.net.Uri;
import android.util.ArrayMap; import android.util.ArrayMap;
import com.android.settings.homepage.deviceinfo.BatterySlice; import com.android.settings.homepage.contextualcards.deviceinfo.BatterySlice;
import com.android.settings.homepage.deviceinfo.DataUsageSlice; import com.android.settings.homepage.contextualcards.deviceinfo.DataUsageSlice;
import com.android.settings.homepage.deviceinfo.DeviceInfoSlice; import com.android.settings.homepage.contextualcards.deviceinfo.DeviceInfoSlice;
import com.android.settings.homepage.deviceinfo.StorageSlice; import com.android.settings.homepage.contextualcards.deviceinfo.StorageSlice;
import com.android.settings.wifi.WifiSlice; import com.android.settings.wifi.WifiSlice;
import java.util.Map; import java.util.Map;

View File

@@ -42,7 +42,7 @@ import com.android.settings.R;
import com.android.settings.bluetooth.BluetoothSliceBuilder; import com.android.settings.bluetooth.BluetoothSliceBuilder;
import com.android.settings.core.BasePreferenceController; import com.android.settings.core.BasePreferenceController;
import com.android.settings.flashlight.FlashlightSliceBuilder; import com.android.settings.flashlight.FlashlightSliceBuilder;
import com.android.settings.homepage.deviceinfo.EmergencyInfoSlice; import com.android.settings.homepage.contextualcards.deviceinfo.EmergencyInfoSlice;
import com.android.settings.location.LocationSliceBuilder; import com.android.settings.location.LocationSliceBuilder;
import com.android.settings.network.telephony.Enhanced4gLteSliceHelper; import com.android.settings.network.telephony.Enhanced4gLteSliceHelper;
import com.android.settings.notification.ZenModeSliceBuilder; import com.android.settings.notification.ZenModeSliceBuilder;

View File

@@ -12,10 +12,9 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*
*/ */
package com.android.settings.homepage; package com.android.settings.homepage.contextualcards;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;

View File

@@ -12,10 +12,9 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*
*/ */
package com.android.settings.homepage; package com.android.settings.homepage.contextualcards;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;

View File

@@ -14,11 +14,11 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage; package com.android.settings.homepage.contextualcards;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import com.android.settings.homepage.conditional.ConditionalContextualCard; import com.android.settings.homepage.contextualcards.conditional.ConditionalContextualCard;
import com.android.settings.testutils.SettingsRobolectricTestRunner; import com.android.settings.testutils.SettingsRobolectricTestRunner;
import org.junit.Test; import org.junit.Test;

View File

@@ -14,17 +14,16 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage; package com.android.settings.homepage.contextualcards;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import android.content.Context; import android.content.Context;
import android.net.Uri; import android.net.Uri;
import com.android.settings.homepage.deviceinfo.BatterySlice; import com.android.settings.homepage.contextualcards.deviceinfo.BatterySlice;
import com.android.settings.homepage.deviceinfo.DataUsageSlice; import com.android.settings.homepage.contextualcards.deviceinfo.DataUsageSlice;
import com.android.settings.homepage.deviceinfo.DeviceInfoSlice; import com.android.settings.homepage.contextualcards.deviceinfo.DeviceInfoSlice;
import com.android.settings.homepage.deviceinfo.StorageSlice;
import com.android.settings.slices.SettingsSliceProvider; import com.android.settings.slices.SettingsSliceProvider;
import com.android.settings.testutils.SettingsRobolectricTestRunner; import com.android.settings.testutils.SettingsRobolectricTestRunner;
@@ -39,16 +38,16 @@ import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@RunWith(SettingsRobolectricTestRunner.class) @RunWith(SettingsRobolectricTestRunner.class)
public class CardContentLoaderTest { public class ContextualCardLoaderTest {
private Context mContext; private Context mContext;
private CardContentLoader mCardContentLoader; private ContextualCardLoader mContextualCardLoader;
private SettingsSliceProvider mProvider; private SettingsSliceProvider mProvider;
@Before @Before
public void setUp() { public void setUp() {
mContext = RuntimeEnvironment.application; mContext = RuntimeEnvironment.application;
mCardContentLoader = new CardContentLoader(mContext); mContextualCardLoader = new ContextualCardLoader(mContext);
mProvider = new SettingsSliceProvider(); mProvider = new SettingsSliceProvider();
ShadowContentResolver.registerProviderInternal(SettingsSliceProvider.SLICE_AUTHORITY, ShadowContentResolver.registerProviderInternal(SettingsSliceProvider.SLICE_AUTHORITY,
mProvider); mProvider);
@@ -56,7 +55,7 @@ public class CardContentLoaderTest {
@Test @Test
public void createStaticCards_shouldReturnFourCards() { public void createStaticCards_shouldReturnFourCards() {
final List<ContextualCard> defaultData = mCardContentLoader.createStaticCards(); final List<ContextualCard> defaultData = mContextualCardLoader.createStaticCards();
assertThat(defaultData).hasSize(3); assertThat(defaultData).hasSize(3);
} }
@@ -68,7 +67,7 @@ public class CardContentLoaderTest {
final Uri batteryInfo = BatterySlice.BATTERY_CARD_URI; final Uri batteryInfo = BatterySlice.BATTERY_CARD_URI;
final List<Uri> expectedUris = Arrays.asList(dataUsage, deviceInfo, batteryInfo); final List<Uri> expectedUris = Arrays.asList(dataUsage, deviceInfo, batteryInfo);
final List<Uri> actualCardUris = mCardContentLoader.createStaticCards().stream().map( final List<Uri> actualCardUris = mContextualCardLoader.createStaticCards().stream().map(
ContextualCard::getSliceUri).collect(Collectors.toList()); ContextualCard::getSliceUri).collect(Collectors.toList());
assertThat(actualCardUris).containsExactlyElementsIn(expectedUris); assertThat(actualCardUris).containsExactlyElementsIn(expectedUris);
@@ -83,7 +82,7 @@ public class CardContentLoaderTest {
.setSummaryText("custom_summary") .setSummaryText("custom_summary")
.build(); .build();
assertThat(mCardContentLoader.isCardEligibleToDisplay(customCard)).isTrue(); assertThat(mContextualCardLoader.isCardEligibleToDisplay(customCard)).isTrue();
} }
@Test @Test
@@ -91,7 +90,7 @@ public class CardContentLoaderTest {
final String sliceUri = "contet://com.android.settings.slices/action/flashlight"; final String sliceUri = "contet://com.android.settings.slices/action/flashlight";
assertThat( assertThat(
mCardContentLoader.isCardEligibleToDisplay(getContextualCard(sliceUri))).isFalse(); mContextualCardLoader.isCardEligibleToDisplay(getContextualCard(sliceUri))).isFalse();
} }
@Test @Test
@@ -99,7 +98,7 @@ public class CardContentLoaderTest {
final String sliceUri = "content://com.android.settings.test.slices/action/flashlight"; final String sliceUri = "content://com.android.settings.test.slices/action/flashlight";
assertThat( assertThat(
mCardContentLoader.isCardEligibleToDisplay(getContextualCard(sliceUri))).isFalse(); mContextualCardLoader.isCardEligibleToDisplay(getContextualCard(sliceUri))).isFalse();
} }
private ContextualCard getContextualCard(String sliceUri) { private ContextualCard getContextualCard(String sliceUri) {

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import static org.mockito.Mockito.never; import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.never; import static org.mockito.Mockito.never;
@@ -26,7 +26,7 @@ import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.homepage.ContextualCardUpdateListener; import com.android.settings.homepage.contextualcards.ContextualCardUpdateListener;
import com.android.settings.testutils.SettingsRobolectricTestRunner; import com.android.settings.testutils.SettingsRobolectricTestRunner;
import org.junit.Before; import org.junit.Before;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
@@ -31,8 +31,8 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.homepage.ContextualCard; import com.android.settings.homepage.contextualcards.ContextualCard;
import com.android.settings.homepage.ControllerRendererPool; import com.android.settings.homepage.contextualcards.ControllerRendererPool;
import com.android.settings.testutils.SettingsRobolectricTestRunner; import com.android.settings.testutils.SettingsRobolectricTestRunner;
import org.junit.Before; import org.junit.Before;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.conditional; package com.android.settings.homepage.contextualcards.conditional;
import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.Mockito.spy; import static org.mockito.Mockito.spy;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.deviceinfo; package com.android.settings.homepage.contextualcards.deviceinfo;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.deviceinfo; package com.android.settings.homepage.contextualcards.deviceinfo;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.deviceinfo; package com.android.settings.homepage.contextualcards.deviceinfo;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.deviceinfo; package com.android.settings.homepage.contextualcards.deviceinfo;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.homepage.slices; package com.android.settings.homepage.contextualcards.slices;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
@@ -31,8 +31,8 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.slice.Slice; import androidx.slice.Slice;
import com.android.settings.homepage.ContextualCard; import com.android.settings.homepage.contextualcards.ContextualCard;
import com.android.settings.homepage.PersonalSettingsFragment; import com.android.settings.homepage.contextualcards.ContextualCardsFragment;
import com.android.settings.testutils.SettingsRobolectricTestRunner; import com.android.settings.testutils.SettingsRobolectricTestRunner;
import org.junit.Before; import org.junit.Before;
@@ -56,7 +56,7 @@ public class SliceContextualCardRendererTest {
public void setUp() { public void setUp() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application; mContext = RuntimeEnvironment.application;
mLifecycleOwner = new PersonalSettingsFragment(); mLifecycleOwner = new ContextualCardsFragment();
mRenderer = new SliceContextualCardRenderer(mContext, mLifecycleOwner); mRenderer = new SliceContextualCardRenderer(mContext, mLifecycleOwner);
} }

Some files were not shown because too many files have changed in this diff Show More