Merge "Update filter logic for BatteryDiffEntries" into sc-dev
diff --git a/res/drawable-night/ic_enhanced_connectivity.xml b/res/drawable-night/ic_enhanced_connectivity.xml
new file mode 100644
index 0000000..cd25667
--- /dev/null
+++ b/res/drawable-night/ic_enhanced_connectivity.xml
@@ -0,0 +1,91 @@
+<!--
+ ~ Copyright (C) 2021 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.
+ -->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="412dp"
+ android:height="300dp"
+ android:viewportWidth="412"
+ android:viewportHeight="300">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M28.1,0L383.9,0A28.1,28.1 0,0 1,412 28.1L412,271.9A28.1,28.1 0,0 1,383.9 300L28.1,300A28.1,28.1 0,0 1,0 271.9L0,28.1A28.1,28.1 0,0 1,28.1 0z"/>
+ <path
+ android:pathData="M206,150m-108.79,0a108.79,108.79 0,1 1,217.58 0a108.79,108.79 0,1 1,-217.58 0"
+ android:strokeAlpha="0.2"
+ android:fillColor="#d2e3fc"
+ android:fillAlpha="0.2"/>
+ <path
+ android:pathData="M206,150m-93.27,0a93.27,93.27 0,1 1,186.54 0a93.27,93.27 0,1 1,-186.54 0"
+ android:strokeAlpha="0.2"
+ android:fillColor="#d2e3fc"
+ android:fillAlpha="0.2"/>
+ <path
+ android:pathData="M206,150m-77.85,0a77.85,77.85 0,1 1,155.7 0a77.85,77.85 0,1 1,-155.7 0"
+ android:strokeAlpha="0.2"
+ android:fillColor="#d2e3fc"
+ android:fillAlpha="0.2"/>
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M153.7,35.5H256.88A7.09,7.09 0,0 1,264 42.57V257.19a7.09,7.09 0,0 1,-7.12 7.06H153.7a7.09,7.09 0,0 1,-7.13 -7.06V42.57A7.1,7.1 0,0 1,153.7 35.5Z"/>
+ <path
+ android:pathData="M267.85,102.26L267.85,93.58a2.17,2.17 0,0 0,-2.17 -2.17L265.68,45.83A10.87,10.87 0,0 0,254.83 35L155,35a10.87,10.87 0,0 0,-10.85 10.85L144.15,254.17A10.87,10.87 0,0 0,155 265h99.83a10.87,10.87 0,0 0,10.85 -10.85L265.68,147.83a2.17,2.17 0,0 0,2.17 -2.17L267.85,124a2.17,2.17 0,0 0,-2.17 -2.17L265.68,104.43A2.17,2.17 0,0 0,267.85 102.26ZM263.51,254.17a8.7,8.7 0,0 1,-8.68 8.68L155,262.85a8.7,8.7 0,0 1,-8.68 -8.68L146.32,45.83A8.7,8.7 0,0 1,155 37.15h99.83a8.7,8.7 0,0 1,8.68 8.68Z"
+ android:fillColor="#80868b"/>
+ <path
+ android:pathData="M199.72,230.82h14a4.45,4.45 0,0 1,4.45 4.45h0a4.46,4.46 0,0 1,-4.45 4.46h-14a4.46,4.46 0,0 1,-4.45 -4.46h0a4.45,4.45 0,0 1,4.45 -4.45Z"
+ android:fillColor="#3c4043"/>
+ <path
+ android:pathData="M211.83,228.91h0a6.36,6.36 0,0 1,6.36 6.36h0a6.36,6.36 0,0 1,-6.35 6.37h0a6.37,6.37 0,0 1,-6.37 -6.37h0a6.36,6.36 0,0 1,6.36 -6.36Z"
+ android:fillColor="#669df6"/>
+ <path
+ android:pathData="M206.59,179.58m-15.27,0a15.27,15.27 0,1 1,30.54 0a15.27,15.27 0,1 1,-30.54 0"
+ android:fillColor="#f1f3f4"/>
+ <path
+ android:pathData="M191.32,179.58a15.27,15.24 0,1 0,30.54 0a15.27,15.24 0,1 0,-30.54 0z"
+ android:fillColor="#feefc3"/>
+ <path
+ android:pathData="M206.59,172.63l-5.72,4.29l0,8.59l3.57,0l0,-5.01l4.3,0l0,5.01l3.57,0l0,-8.59l-5.72,-4.29z"
+ android:fillColor="#fcc934"/>
+ <path
+ android:pathData="M168.97,105.11m-15.24,0a15.24,15.24 0,1 1,30.48 0a15.24,15.24 0,1 1,-30.48 0"
+ android:fillColor="#fad2cf"/>
+ <path
+ android:pathData="M172.6,111.39L172.6,100.28a0.92,0.92 0,0 0,-0.92 -0.92h-1.22L170.46,97.87h-2.9v1.42h-1.2a0.93,0.93 0,0 0,-0.93 0.92v11.07a0.93,0.93 0,0 0,0.93 0.92h5.31A0.92,0.92 0,0 0,172.6 111.39ZM171.15,100.77L171.15,106h-4.34v-5.2Z"
+ android:fillColor="#ee675c"/>
+ <path
+ android:pathData="M243.03,151.92m-15.27,0a15.27,15.27 0,1 1,30.54 0a15.27,15.27 0,1 1,-30.54 0"
+ android:fillColor="#fad2cf"/>
+ <path
+ android:pathData="M248.3,146.31a1.09,1.09 0,0 0,-1 -0.73h-8a1.1,1.1 0,0 0,-1 0.73l-1.5,4.34v5.8a0.71,0.71 0,0 0,0.71 0.73h0.79a0.72,0.72 0,0 0,0.72 -0.72h0v-0.72h8.68v0.72a0.73,0.73 0,0 0,0.73 0.73h0.72a0.73,0.73 0,0 0,0.73 -0.73v-5.79ZM240,153.54a1.09,1.09 0,1 1,1.09 -1.09h0a1.08,1.08 0,0 1,-1 1.12h0ZM246.52,153.54a1.09,1.09 0,1 1,1.08 -1.1v0a1.09,1.09 0,0 1,-1 1.12ZM238.75,149.28 L239.53,147.03L247,147.03l0.78,2.25Z"
+ android:fillColor="#ee675c"/>
+ <path
+ android:pathData="M168.97,151.92m-15.27,0a15.27,15.27 0,1 1,30.54 0a15.27,15.27 0,1 1,-30.54 0"
+ android:fillColor="#d2e3fc"/>
+ <path
+ android:pathData="M175.8,149.23a3.68,3.68 0,0 0,-3.69 -3.08h-5.63a3.73,3.73 0,0 0,-3.69 3.08s-1.17,6.76 -1.17,6.86a1.61,1.61 0,0 0,2.72 1.15l2.66,-2.63h4.61l2.66,2.63a1.61,1.61 0,0 0,2.73 -1.15C177,156 175.8,149.23 175.8,149.23ZM168.51,150.77L167,150.77v1.53h-0.77v-1.53h-1.53L164.7,150h1.53v-1.54L167,148.46L167,150h1.54ZM170.67,151a0.62,0.62 0,1 1,0.61 -0.63h0a0.62,0.62 0,0 1,-0.61 0.62ZM171.97,152.3a0.61,0.61 0,0 1,-0.63 -0.6,0.62 0.62,0 0,1 1.24,0h0a0.61,0.61 0,0 1,-0.61 0.61ZM171.97,149.69a0.62,0.62 0,1 1,0.61 -0.63h0a0.62,0.62 0,0 1,-0.61 0.62ZM173.28,151a0.62,0.62 0,1 1,0.62 -0.62h0a0.62,0.62 0,0 1,-0.62 0.62Z"
+ android:fillColor="#669df6"/>
+ <path
+ android:pathData="M243.03,105.11m-15.24,0a15.24,15.24 0,1 1,30.48 0a15.24,15.24 0,1 1,-30.48 0"
+ android:fillColor="#d2e3fc"/>
+ <path
+ android:pathData="M240,100.65a4.16,4.16 0,0 0,-0.1 5.88l0.1,0.1 0.76,-0.76a3.28,3.28 0,0 1,-0.92 -2.24,3 3,0 0,1 0.92,-2.22ZM247.51,99.12 L246.75,99.88a5.39,5.39 0,0 1,0 7.51l0.76,0.76a6.22,6.22 0,0 0,1.85 -4.52A6.52,6.52 0,0 0,247.54 99.12ZM239.22,99.88 L238.46,99.12a6.45,6.45 0,0 0,0 9l0.76,-0.76A5.39,5.39 0,0 1,239.25 99.88ZM245.96,100.65 L245.2,101.41a3.18,3.18 0,0 1,0.92 2.22,3 3,0 0,1 -0.92,2.24l0.76,0.76a4.24,4.24 0,0 0,1.28 -3,4.55 4.55,0 0,0 -1.26,-3ZM242.96,102.06a1.58,1.58 0,0 0,-1.6 1.56v0a1.63,1.63 0,0 0,0.92 1.47v5.53h1.28v-5.53a1.63,1.63 0,0 0,0.92 -1.47A1.58,1.58 0,0 0,243 102.06Z"
+ android:fillColor="#669df6"/>
+ <path
+ android:pathData="M206.59,77.45m-15.21,0a15.21,15.21 0,1 1,30.42 0a15.21,15.21 0,1 1,-30.42 0"
+ android:fillColor="#ceead6"/>
+ <path
+ android:pathData="M211.66,72.38h-1.9L211,74.92h-1.9l-1.29,-2.54h-1.27l1.27,2.54L206,74.92l-1.26,-2.54h-1.32l1.27,2.54h-1.9l-1.27,-2.54a1.26,1.26 0,0 0,-1.26 1.26h0v7.61a1.25,1.25 0,0 0,1.26 1.26h10.14a1.26,1.26 0,0 0,1.27 -1.26L212.93,73.65a1.27,1.27 0,0 0,-1.27 -1.27ZM211.66,81.26L201.52,81.26L201.52,76.19h10.14Z"
+ android:fillColor="#5bb974"/>
+</vector>
diff --git a/res/drawable/ic_enhanced_connectivity.xml b/res/drawable/ic_enhanced_connectivity.xml
new file mode 100644
index 0000000..45767bd
--- /dev/null
+++ b/res/drawable/ic_enhanced_connectivity.xml
@@ -0,0 +1,91 @@
+<!--
+ ~ Copyright (C) 2021 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.
+ -->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="412dp"
+ android:height="300dp"
+ android:viewportWidth="412"
+ android:viewportHeight="300">
+ <path
+ android:pathData="M28.1,0L383.9,0A28.1,28.1 0,0 1,412 28.1L412,271.9A28.1,28.1 0,0 1,383.9 300L28.1,300A28.1,28.1 0,0 1,0 271.9L0,28.1A28.1,28.1 0,0 1,28.1 0z"
+ android:fillColor="#fff"/>
+ <path
+ android:pathData="M206,150m-108.79,0a108.79,108.79 0,1 1,217.58 0a108.79,108.79 0,1 1,-217.58 0"
+ android:strokeAlpha="0.2"
+ android:fillColor="#669df6"
+ android:fillAlpha="0.2"/>
+ <path
+ android:pathData="M206,150m-93.27,0a93.27,93.27 0,1 1,186.54 0a93.27,93.27 0,1 1,-186.54 0"
+ android:strokeAlpha="0.2"
+ android:fillColor="#669df6"
+ android:fillAlpha="0.2"/>
+ <path
+ android:pathData="M206,150m-77.85,0a77.85,77.85 0,1 1,155.7 0a77.85,77.85 0,1 1,-155.7 0"
+ android:strokeAlpha="0.2"
+ android:fillColor="#669df6"
+ android:fillAlpha="0.2"/>
+ <path
+ android:pathData="M153.7,35.5H256.88A7.09,7.09 0,0 1,264 42.57V257.19a7.09,7.09 0,0 1,-7.12 7.06H153.7a7.09,7.09 0,0 1,-7.13 -7.06V42.57A7.1,7.1 0,0 1,153.7 35.5Z"
+ android:fillColor="#fff"/>
+ <path
+ android:pathData="M267.85,102.26L267.85,93.58a2.17,2.17 0,0 0,-2.17 -2.17L265.68,45.83A10.87,10.87 0,0 0,254.83 35L155,35a10.87,10.87 0,0 0,-10.85 10.85L144.15,254.17A10.87,10.87 0,0 0,155 265h99.83a10.87,10.87 0,0 0,10.85 -10.85L265.68,147.83a2.17,2.17 0,0 0,2.17 -2.17L267.85,124a2.17,2.17 0,0 0,-2.17 -2.17L265.68,104.43A2.17,2.17 0,0 0,267.85 102.26ZM263.51,254.17a8.7,8.7 0,0 1,-8.68 8.68L155,262.85a8.7,8.7 0,0 1,-8.68 -8.68L146.32,45.83A8.7,8.7 0,0 1,155 37.15h99.83a8.7,8.7 0,0 1,8.68 8.68Z"
+ android:fillColor="#dadce0"/>
+ <path
+ android:pathData="M199.72,230.82h14a4.45,4.45 0,0 1,4.45 4.45h0a4.46,4.46 0,0 1,-4.45 4.46h-14a4.46,4.46 0,0 1,-4.45 -4.46h0a4.45,4.45 0,0 1,4.45 -4.45Z"
+ android:fillColor="#e8f0fe"/>
+ <path
+ android:pathData="M211.83,228.91h0a6.36,6.36 0,0 1,6.36 6.36h0a6.36,6.36 0,0 1,-6.35 6.37h0a6.37,6.37 0,0 1,-6.37 -6.37h0a6.36,6.36 0,0 1,6.36 -6.36Z"
+ android:fillColor="#1a73e8"/>
+ <path
+ android:pathData="M206.59,179.58m-15.27,0a15.27,15.27 0,1 1,30.54 0a15.27,15.27 0,1 1,-30.54 0"
+ android:fillColor="#f1f3f4"/>
+ <path
+ android:pathData="M191.32,179.58a15.27,15.24 0,1 0,30.54 0a15.27,15.24 0,1 0,-30.54 0z"
+ android:fillColor="#feefc3"/>
+ <path
+ android:pathData="M206.59,172.63l-5.72,4.29l0,8.59l3.57,0l0,-5.01l4.3,0l0,5.01l3.57,0l0,-8.59l-5.72,-4.29z"
+ android:fillColor="#f9ab00"/>
+ <path
+ android:pathData="M168.97,105.11m-15.24,0a15.24,15.24 0,1 1,30.48 0a15.24,15.24 0,1 1,-30.48 0"
+ android:fillColor="#fad2cf"/>
+ <path
+ android:pathData="M172.6,111.39L172.6,100.28a0.92,0.92 0,0 0,-0.92 -0.92h-1.22L170.46,97.87h-2.9v1.42h-1.2a0.93,0.93 0,0 0,-0.93 0.92v11.07a0.93,0.93 0,0 0,0.93 0.92h5.31A0.92,0.92 0,0 0,172.6 111.39ZM171.15,100.77L171.15,106h-4.34v-5.2Z"
+ android:fillColor="#d93025"/>
+ <path
+ android:pathData="M243.03,151.92m-15.27,0a15.27,15.27 0,1 1,30.54 0a15.27,15.27 0,1 1,-30.54 0"
+ android:fillColor="#fad2cf"/>
+ <path
+ android:pathData="M248.3,146.31a1.09,1.09 0,0 0,-1 -0.73h-8a1.1,1.1 0,0 0,-1 0.73l-1.5,4.34v5.8a0.71,0.71 0,0 0,0.71 0.73h0.79a0.72,0.72 0,0 0,0.72 -0.72h0v-0.72h8.68v0.72a0.73,0.73 0,0 0,0.73 0.73h0.72a0.73,0.73 0,0 0,0.73 -0.73v-5.79ZM240,153.54a1.09,1.09 0,1 1,1.09 -1.09h0a1.08,1.08 0,0 1,-1 1.12h0ZM246.52,153.54a1.09,1.09 0,1 1,1.08 -1.1v0a1.09,1.09 0,0 1,-1 1.12ZM238.75,149.28 L239.53,147.03L247,147.03l0.78,2.25Z"
+ android:fillColor="#d93025"/>
+ <path
+ android:pathData="M168.97,151.92m-15.27,0a15.27,15.27 0,1 1,30.54 0a15.27,15.27 0,1 1,-30.54 0"
+ android:fillColor="#d2e3fc"/>
+ <path
+ android:pathData="M175.8,149.23a3.68,3.68 0,0 0,-3.69 -3.08h-5.63a3.73,3.73 0,0 0,-3.69 3.08s-1.17,6.76 -1.17,6.86a1.61,1.61 0,0 0,2.72 1.15l2.66,-2.63h4.61l2.66,2.63a1.61,1.61 0,0 0,2.73 -1.15C177,156 175.8,149.23 175.8,149.23ZM168.51,150.77L167,150.77v1.53h-0.77v-1.53h-1.53L164.7,150h1.53v-1.54L167,148.46L167,150h1.54ZM170.67,151a0.62,0.62 0,1 1,0.61 -0.63h0a0.62,0.62 0,0 1,-0.61 0.62ZM171.97,152.3a0.61,0.61 0,0 1,-0.63 -0.6,0.62 0.62,0 0,1 1.24,0h0a0.61,0.61 0,0 1,-0.61 0.61ZM171.97,149.69a0.62,0.62 0,1 1,0.61 -0.63h0a0.62,0.62 0,0 1,-0.61 0.62ZM173.28,151a0.62,0.62 0,1 1,0.62 -0.62h0a0.62,0.62 0,0 1,-0.62 0.62Z"
+ android:fillColor="#1a73e8"/>
+ <path
+ android:pathData="M243.03,105.11m-15.24,0a15.24,15.24 0,1 1,30.48 0a15.24,15.24 0,1 1,-30.48 0"
+ android:fillColor="#d2e3fc"/>
+ <path
+ android:pathData="M240,100.65a4.16,4.16 0,0 0,-0.1 5.88l0.1,0.1 0.76,-0.76a3.28,3.28 0,0 1,-0.92 -2.24,3 3,0 0,1 0.92,-2.22ZM247.51,99.12 L246.75,99.88a5.39,5.39 0,0 1,0 7.51l0.76,0.76a6.22,6.22 0,0 0,1.85 -4.52A6.52,6.52 0,0 0,247.54 99.12ZM239.22,99.88 L238.46,99.12a6.45,6.45 0,0 0,0 9l0.76,-0.76A5.39,5.39 0,0 1,239.25 99.88ZM245.96,100.65 L245.2,101.41a3.18,3.18 0,0 1,0.92 2.22,3 3,0 0,1 -0.92,2.24l0.76,0.76a4.24,4.24 0,0 0,1.28 -3,4.55 4.55,0 0,0 -1.26,-3ZM242.96,102.06a1.58,1.58 0,0 0,-1.6 1.56v0a1.63,1.63 0,0 0,0.92 1.47v5.53h1.28v-5.53a1.63,1.63 0,0 0,0.92 -1.47A1.58,1.58 0,0 0,243 102.06Z"
+ android:fillColor="#1a73e8"/>
+ <path
+ android:pathData="M206.59,77.45m-15.21,0a15.21,15.21 0,1 1,30.42 0a15.21,15.21 0,1 1,-30.42 0"
+ android:fillColor="#ceead6"/>
+ <path
+ android:pathData="M211.66,72.38h-1.9L211,74.92h-1.9l-1.29,-2.54h-1.27l1.27,2.54L206,74.92l-1.26,-2.54h-1.32l1.27,2.54h-1.9l-1.27,-2.54a1.26,1.26 0,0 0,-1.26 1.26h0v7.61a1.25,1.25 0,0 0,1.26 1.26h10.14a1.26,1.26 0,0 0,1.27 -1.26L212.93,73.65a1.27,1.27 0,0 0,-1.27 -1.27ZM211.66,81.26L201.52,81.26L201.52,76.19h10.14Z"
+ android:fillColor="#1e8e3e"/>
+</vector>
diff --git a/res/layout/accessibility_autoclick_preview.xml b/res/layout/accessibility_autoclick_preview.xml
deleted file mode 100644
index 4fa3f8f..0000000
--- a/res/layout/accessibility_autoclick_preview.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2019 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:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <ImageView
- android:layout_width="match_parent"
- android:layout_height="@dimen/autoclick_preview_height"
- android:contentDescription="@null"
- android:scaleType="fitCenter"
- android:src="@drawable/accessibility_dwell"/>
-
-</FrameLayout>
diff --git a/res/layout/manage_applications_apps.xml b/res/layout/manage_applications_apps.xml
index d814164..f8f4a76 100644
--- a/res/layout/manage_applications_apps.xml
+++ b/res/layout/manage_applications_apps.xml
@@ -14,50 +14,48 @@
limitations under the License.
-->
-<FrameLayout
+<androidx.constraintlayout.widget.ConstraintLayout
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="match_parent">
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/apps_list"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:clipToPadding="false"
+ android:scrollbars="none"
+ android:visibility="invisible"
+ settings:fastScrollEnabled="true"
+ settings:fastScrollHorizontalThumbDrawable="@drawable/thumb_drawable"
+ settings:fastScrollHorizontalTrackDrawable="@drawable/line_drawable"
+ settings:fastScrollVerticalThumbDrawable="@drawable/thumb_drawable"
+ settings:fastScrollVerticalTrackDrawable="@drawable/line_drawable"
+ settings:layout_constraintTop_toBottomOf="@id/pinned_header"/>
+
+ <TextView
+ android:id="@android:id/empty"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:gravity="center"
+ android:textAlignment="gravity"
+ android:text="@string/no_applications"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:visibility="invisible"
+ settings:layout_constraintTop_toBottomOf="@id/pinned_header"
+ settings:layout_constraintBottom_toBottomOf="parent"/>
+
+ <include layout="@layout/loading_container"
+ settings:layout_constraintTop_toBottomOf="@id/pinned_header"
+ settings:layout_constraintBottom_toBottomOf="parent"/>
+
<FrameLayout
android:id="@+id/pinned_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:elevation="2dp"/>
+ android:background="?android:colorBackground"
+ settings:layout_constraintTop_toTopOf="parent"/>
- <FrameLayout
- android:id="@+id/list_container"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:visibility="gone">
-
- <androidx.recyclerview.widget.RecyclerView
- android:id="@+id/apps_list"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:clipToPadding="false"
- android:scrollbars="none"
- settings:fastScrollEnabled="true"
- settings:fastScrollHorizontalThumbDrawable="@drawable/thumb_drawable"
- settings:fastScrollHorizontalTrackDrawable="@drawable/line_drawable"
- settings:fastScrollVerticalThumbDrawable="@drawable/thumb_drawable"
- settings:fastScrollVerticalTrackDrawable="@drawable/line_drawable"/>
-
- <TextView
- android:id="@android:id/empty"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:gravity="bottom|center_horizontal"
- android:layout_gravity="center"
- android:text="@string/no_applications"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:visibility="invisible"/>
-
- </FrameLayout>
-
- <include layout="@layout/loading_container"/>
-
-</FrameLayout>
-
+</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index fe0ada0..1b8179a 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -149,8 +149,6 @@
<dimen name="wifi_assistant_height">182dp</dimen>
<dimen name="wifi_assistant_image_top">32dp</dimen>
<dimen name="wifi_assistant_image_start">24dp</dimen>
- <!-- appbar height is equal search bar height (48dp) plus search bar top and bottom margin -->
- <dimen name="app_bar_height">80dp</dimen>
<!-- CryptKeeper top margin for password/pin screen -->
<dimen name="crypt_keeper_password_top_margin">88dip</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 23c020a..4001099 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -6788,6 +6788,10 @@
<string name="adaptive_connectivity_title">Adaptive connectivity</string>
<!-- Summary of Adaptive connectivity preference. [CHAR LIMIT=NONE] -->
<string name="adaptive_connectivity_summary">Extends battery life and improves device performance by automatically managing your network connections</string>
+ <!-- Switch on text of Adaptive connectivity preference. [CHAR LIMIT=NONE]-->
+ <string name="adaptive_connectivity_switch_on">On</string>
+ <!-- Switch off text of Adaptive connectivity preference. [CHAR LIMIT=NONE]-->
+ <string name="adaptive_connectivity_switch_off">Off</string>
<!-- Title of preference group for credential storage settings [CHAR LIMIT=30] -->
<string name="credentials_title">Credential storage</string>
@@ -11585,10 +11589,10 @@
<!-- [CHAR LIMIT=60] Title of work profile setting page -->
<string name="managed_profile_settings_title">Work profile settings</string>
- <!-- [CHAR LIMIT=60] The preference title for enabling cross-profile remote contact search -->
- <string name="managed_profile_contact_search_title">Contact search</string>
- <!-- [CHAR LIMIT=NONE] The preference summary for enabling cross-profile remote contact search -->
- <string name="managed_profile_contact_search_summary">Allow contact searches by your organization to identify callers and contacts</string>
+ <!-- [CHAR LIMIT=NONE] Settings toggle. This setting lets a user's personal apps identify contacts using the user's work directory. -->
+ <string name="managed_profile_contact_search_title">Let personal apps identify contacts using work directory</string>
+ <!-- [CHAR LIMIT=NONE] Settings toggle description. This setting lets a user's personal apps identify contacts using the user's work directory. "Searches" is a noun. -->
+ <string name="managed_profile_contact_search_summary">Searches and incoming calls may be visible to your IT admin</string>
<!-- [CHAR LIMIT=NONE] Settings label. This setting lets the user show their work events on their personal calendar. The adjective 'Cross-profile' is referring to the work and personal profiles a user has on their phone. -->
<string name="cross_profile_calendar_title">Cross-profile calendar</string>
<!-- [CHAR LIMIT=NONE] Setting description. If the user turns on this setting, they can see their work events on their personal calendar. -->
diff --git a/res/xml/accessibility_autoclick_settings.xml b/res/xml/accessibility_autoclick_settings.xml
index ee27cea..06b3dce 100644
--- a/res/xml/accessibility_autoclick_settings.xml
+++ b/res/xml/accessibility_autoclick_settings.xml
@@ -19,14 +19,13 @@
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/accessibility_autoclick_preference_title">
- <com.android.settingslib.widget.LayoutPreference
- android:key="accessibility_autoclick_preview"
- android:layout="@layout/accessibility_autoclick_preview"
+ <com.android.settingslib.widget.IllustrationPreference
+ android:key="accessibility_autoclick_banner"
android:persistent="false"
android:selectable="false"
- android:title="@string/summary_placeholder"
settings:allowDividerBelow="true"
- settings:searchable="false" />
+ settings:searchable="false"
+ settings:lottie_rawRes="@drawable/accessibility_dwell" />
<com.android.settingslib.widget.RadioButtonPreference
android:key="accessibility_control_autoclick_default"
diff --git a/res/xml/adaptive_connectivity_settings.xml b/res/xml/adaptive_connectivity_settings.xml
index ff9bdb0..d5941ad 100644
--- a/res/xml/adaptive_connectivity_settings.xml
+++ b/res/xml/adaptive_connectivity_settings.xml
@@ -19,20 +19,18 @@
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/adaptive_connectivity_title">
- <com.android.settingslib.widget.LayoutPreference
- android:key="adaptive_connectivity_header"
- android:layout="@layout/adaptive_connectivity_header"
- android:persistent="false"
- android:selectable="false"
- android:title="@string/summary_placeholder"
- settings:allowDividerBelow="true"
- settings:searchable="false"/>
+ <com.android.settingslib.widget.TopIntroPreference
+ settings:searchable="false"
+ android:title="@string/adaptive_connectivity_summary"/>
- <SwitchPreference
+ <com.android.settingslib.widget.IllustrationPreference
+ android:key="adaptive_connectivity_header"
+ settings:searchable="false"
+ settings:lottie_rawRes="@drawable/ic_enhanced_connectivity"/>
+
+ <com.android.settingslib.widget.MainSwitchPreference
android:key="adaptive_connectivity"
android:title="@string/adaptive_connectivity_title"
- android:summary="@string/adaptive_connectivity_summary"
- settings:allowDividerAbove="true"
settings:controller="com.android.settings.network.AdaptiveConnectivityTogglePreferenceController"/>
</PreferenceScreen>
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index 12f63ea..f3cdd6c 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -574,7 +574,7 @@
/**
* Switch to a specific Fragment with taking care of validation, Title and BackStack
*/
- private Fragment switchToFragment(String fragmentName, Bundle args, boolean validate,
+ private void switchToFragment(String fragmentName, Bundle args, boolean validate,
int titleResId, CharSequence title) {
Log.d(LOG_TAG, "Switching to fragment " + fragmentName);
if (validate && !isValidFragment(fragmentName)) {
@@ -582,6 +582,9 @@
+ fragmentName);
}
Fragment f = Utils.getTargetFragment(this, fragmentName, args);
+ if (f == null) {
+ return;
+ }
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.main_content, f);
if (titleResId > 0) {
@@ -592,7 +595,6 @@
transaction.commitAllowingStateLoss();
getSupportFragmentManager().executePendingTransactions();
Log.d(LOG_TAG, "Executed frag manager pendingTransactions");
- return f;
}
private void updateTilesList() {
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 708dbed..e79852b 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -1158,13 +1158,17 @@
== ProfileSelectFragment.ProfileType.PERSONAL : false;
final boolean isWork = args != null ? args.getInt(ProfileSelectFragment.EXTRA_PROFILE)
== ProfileSelectFragment.ProfileType.WORK : false;
- if (activity.getSystemService(UserManager.class).getUserProfiles().size() > 1
- && ProfileFragmentBridge.FRAGMENT_MAP.get(fragmentName) != null
- && !isWork && !isPersonal) {
- f = Fragment.instantiate(activity, ProfileFragmentBridge.FRAGMENT_MAP.get(fragmentName),
- args);
- } else {
- f = Fragment.instantiate(activity, fragmentName, args);
+ try {
+ if (activity.getSystemService(UserManager.class).getUserProfiles().size() > 1
+ && ProfileFragmentBridge.FRAGMENT_MAP.get(fragmentName) != null
+ && !isWork && !isPersonal) {
+ f = Fragment.instantiate(activity,
+ ProfileFragmentBridge.FRAGMENT_MAP.get(fragmentName), args);
+ } else {
+ f = Fragment.instantiate(activity, fragmentName, args);
+ }
+ } catch (Exception e) {
+ Log.e(TAG, "Unable to get target fragment", e);
}
return f;
}
diff --git a/src/com/android/settings/applications/RunningServices.java b/src/com/android/settings/applications/RunningServices.java
index 4d13241..b1689d5 100644
--- a/src/com/android/settings/applications/RunningServices.java
+++ b/src/com/android/settings/applications/RunningServices.java
@@ -72,7 +72,11 @@
public void onResume() {
super.onResume();
boolean haveData = mRunningProcessesView.doResume(this, mRunningProcessesAvail);
- mLoadingViewController.handleLoadingContainer(haveData /* done */, false /* animate */);
+ if (haveData) {
+ mLoadingViewController.showContent(false /* animate */);
+ } else {
+ mLoadingViewController.showLoadingView();
+ }
}
@Override
diff --git a/src/com/android/settings/applications/manageapplications/ManageApplications.java b/src/com/android/settings/applications/manageapplications/ManageApplications.java
index 6d67524..43e929b 100644
--- a/src/com/android/settings/applications/manageapplications/ManageApplications.java
+++ b/src/com/android/settings/applications/manageapplications/ManageApplications.java
@@ -208,7 +208,6 @@
private ApplicationsAdapter mApplications;
private View mLoadingContainer;
- private View mListContainer;
private SearchView mSearchView;
// Size resource used for packages whose size computation failed for some reason
@@ -402,25 +401,21 @@
mRootView = inflater.inflate(R.layout.manage_applications_apps, null);
mLoadingContainer = mRootView.findViewById(R.id.loading_container);
- mListContainer = mRootView.findViewById(R.id.list_container);
- if (mListContainer != null) {
- // Create adapter and list view here
- mEmptyView = mListContainer.findViewById(android.R.id.empty);
+ mEmptyView = mRootView.findViewById(android.R.id.empty);
+ mRecyclerView = mRootView.findViewById(R.id.apps_list);
- mApplications = new ApplicationsAdapter(mApplicationsState, this, mFilter,
- savedInstanceState);
- if (savedInstanceState != null) {
- mApplications.mHasReceivedLoadEntries =
- savedInstanceState.getBoolean(EXTRA_HAS_ENTRIES, false);
- mApplications.mHasReceivedBridgeCallback =
- savedInstanceState.getBoolean(EXTRA_HAS_BRIDGE, false);
- }
- mRecyclerView = mListContainer.findViewById(R.id.apps_list);
- mRecyclerView.setItemAnimator(null);
- mRecyclerView.setLayoutManager(new LinearLayoutManager(
- getContext(), RecyclerView.VERTICAL, false /* reverseLayout */));
- mRecyclerView.setAdapter(mApplications);
+ mApplications = new ApplicationsAdapter(mApplicationsState, this, mFilter,
+ savedInstanceState);
+ if (savedInstanceState != null) {
+ mApplications.mHasReceivedLoadEntries =
+ savedInstanceState.getBoolean(EXTRA_HAS_ENTRIES, false);
+ mApplications.mHasReceivedBridgeCallback =
+ savedInstanceState.getBoolean(EXTRA_HAS_BRIDGE, false);
}
+ mRecyclerView.setItemAnimator(null);
+ mRecyclerView.setLayoutManager(new LinearLayoutManager(
+ getContext(), RecyclerView.VERTICAL, false /* reverseLayout */));
+ mRecyclerView.setAdapter(mApplications);
// We have to do this now because PreferenceFrameLayout looks at it
// only when the view is added.
@@ -985,16 +980,8 @@
// overlapped by floating filter.
if (hasFilter) {
mManageApplications.mSpinnerHeader.setVisibility(View.VISIBLE);
- mManageApplications.mRecyclerView.setPadding(0 /* left */,
- mContext.getResources().getDimensionPixelSize(
- R.dimen.app_bar_height) /* top */,
- 0 /* right */,
- 0 /* bottom */);
} else {
mManageApplications.mSpinnerHeader.setVisibility(View.GONE);
- mManageApplications.mRecyclerView.setPadding(0 /* left */, 0 /* top */,
- 0 /* right */,
- 0 /* bottom */);
}
}
}
@@ -1044,7 +1031,8 @@
mManageApplications = manageApplications;
mLoadingViewController = new LoadingViewController(
mManageApplications.mLoadingContainer,
- mManageApplications.mListContainer
+ mManageApplications.mRecyclerView,
+ mManageApplications.mEmptyView
);
mContext = manageApplications.getActivity();
mIconDrawableFactory = IconDrawableFactory.newInstance(mContext);
@@ -1303,11 +1291,9 @@
mOriginalEntries = entries;
notifyDataSetChanged();
if (getItemCount() == 0) {
- mManageApplications.mRecyclerView.setVisibility(View.GONE);
- mManageApplications.mEmptyView.setVisibility(View.VISIBLE);
+ mLoadingViewController.showEmpty(false /* animate */);
} else {
- mManageApplications.mEmptyView.setVisibility(View.GONE);
- mManageApplications.mRecyclerView.setVisibility(View.VISIBLE);
+ mLoadingViewController.showContent(false /* animate */);
if (mManageApplications.mSearchView != null
&& mManageApplications.mSearchView.isVisibleToUser()) {
@@ -1324,10 +1310,6 @@
mLastIndex = -1;
}
- if (mSession.getAllApps().size() != 0
- && mManageApplications.mListContainer.getVisibility() != View.VISIBLE) {
- mLoadingViewController.showContent(true /* animate */);
- }
if (mManageApplications.mListType == LIST_TYPE_USAGE_ACCESS) {
// No enabled or disabled filters for usage access.
return;
diff --git a/src/com/android/settings/biometrics/BiometricEnrollActivity.java b/src/com/android/settings/biometrics/BiometricEnrollActivity.java
index 3b8f255..26d8a45 100644
--- a/src/com/android/settings/biometrics/BiometricEnrollActivity.java
+++ b/src/com/android/settings/biometrics/BiometricEnrollActivity.java
@@ -242,6 +242,7 @@
// This will need to be updated if the device has sensors other than BIOMETRIC_STRONG
if (!setupWizard && authenticators == BiometricManager.Authenticators.DEVICE_CREDENTIAL) {
launchCredentialOnlyEnroll();
+ finish();
} else if (canUseFace && canUseFingerprint) {
if (mParentalOptionsRequired && mGkPwHandle != null) {
launchFaceAndFingerprintEnroll();
@@ -405,22 +406,6 @@
super.onApplyThemeResource(theme, newResid, first);
}
- @Override
- protected void onStop() {
- super.onStop();
-
- if (mConfirmingCredentials
- || mParentalOptionsRequired
- || mMultiBiometricEnrollHelper != null) {
- return;
- }
-
- if (!isChangingConfigurations()) {
- Log.d(TAG, "Finishing in onStop");
- finish();
- }
- }
-
private void setOrConfirmCredentialsNow() {
if (!mConfirmingCredentials) {
mConfirmingCredentials = true;
diff --git a/src/com/android/settings/connecteddevice/usb/UsbDetailsFragment.java b/src/com/android/settings/connecteddevice/usb/UsbDetailsFragment.java
index 8d14cf9..8850acd 100644
--- a/src/com/android/settings/connecteddevice/usb/UsbDetailsFragment.java
+++ b/src/com/android/settings/connecteddevice/usb/UsbDetailsFragment.java
@@ -107,7 +107,7 @@
@Override
protected boolean isPageSearchEnabled(Context context) {
return checkIfUsbDataSignalingIsDisabled(
- context, UserHandle.myUserId()) != null;
+ context, UserHandle.myUserId()) == null;
}
@Override
diff --git a/src/com/android/settings/network/AdaptiveConnectivityPreferenceController.java b/src/com/android/settings/network/AdaptiveConnectivityPreferenceController.java
index 33d1d5b..a938515 100644
--- a/src/com/android/settings/network/AdaptiveConnectivityPreferenceController.java
+++ b/src/com/android/settings/network/AdaptiveConnectivityPreferenceController.java
@@ -48,7 +48,7 @@
public CharSequence getSummary() {
return Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.ADAPTIVE_CONNECTIVITY_ENABLED, 1) == 1
- ? mContext.getString(R.string.switch_on_text)
- : mContext.getString(R.string.switch_off_text);
+ ? mContext.getString(R.string.adaptive_connectivity_switch_on)
+ : mContext.getString(R.string.adaptive_connectivity_switch_off);
}
}
diff --git a/src/com/android/settings/network/AdaptiveConnectivityTogglePreferenceController.java b/src/com/android/settings/network/AdaptiveConnectivityTogglePreferenceController.java
index e1e56a8..e3d779c 100644
--- a/src/com/android/settings/network/AdaptiveConnectivityTogglePreferenceController.java
+++ b/src/com/android/settings/network/AdaptiveConnectivityTogglePreferenceController.java
@@ -22,12 +22,14 @@
import androidx.preference.PreferenceScreen;
-import com.android.settings.core.TogglePreferenceController;
+import com.android.settings.widget.SettingsMainSwitchPreferenceController;
/**
- * {@link TogglePreferenceController} that controls whether Adaptive connectivity option is enabled.
+ * {@link SettingsMainSwitchPreferenceController}
+ * that controls whether Adaptive connectivity option is enabled.
*/
-public class AdaptiveConnectivityTogglePreferenceController extends TogglePreferenceController {
+public class AdaptiveConnectivityTogglePreferenceController extends
+ SettingsMainSwitchPreferenceController {
private final WifiManager mWifiManager;
diff --git a/src/com/android/settings/network/ProviderModelSliceHelper.java b/src/com/android/settings/network/ProviderModelSliceHelper.java
index 16d5c92..6ecaae5 100644
--- a/src/com/android/settings/network/ProviderModelSliceHelper.java
+++ b/src/com/android/settings/network/ProviderModelSliceHelper.java
@@ -80,8 +80,7 @@
public boolean hasCarrier() {
if (isAirplaneModeEnabled()
|| mSubscriptionManager == null || mTelephonyManager == null
- || mSubscriptionManager.getDefaultDataSubscriptionId()
- == mSubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+ || mSubscriptionManager.getActiveSubscriptionIdList().length <= 0) {
return false;
}
return true;
diff --git a/src/com/android/settings/notification/history/NotificationSbnViewHolder.java b/src/com/android/settings/notification/history/NotificationSbnViewHolder.java
index c98b036..166ee5d 100644
--- a/src/com/android/settings/notification/history/NotificationSbnViewHolder.java
+++ b/src/com/android/settings/notification/history/NotificationSbnViewHolder.java
@@ -65,9 +65,6 @@
}
void setTitle(CharSequence title) {
- if (title == null) {
- return;
- }
mTitle.setText(title);
}
diff --git a/src/com/android/settings/widget/LoadingViewController.java b/src/com/android/settings/widget/LoadingViewController.java
index 294e55e..66eebf3 100644
--- a/src/com/android/settings/widget/LoadingViewController.java
+++ b/src/com/android/settings/widget/LoadingViewController.java
@@ -22,34 +22,66 @@
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
+import androidx.annotation.Nullable;
+
/**
- * A helper class that manages show/hide loading spinner.
+ * A helper class that manages show/hide loading spinner, content view and empty view (optional).
*/
public class LoadingViewController {
private static final long DELAY_SHOW_LOADING_CONTAINER_THRESHOLD_MS = 100L;
- public final Handler mFgHandler;
- public final View mLoadingView;
- public final View mContentView;
+ private final Handler mFgHandler;
+ private final View mLoadingView;
+ private final View mContentView;
+ private final View mEmptyView;
public LoadingViewController(View loadingView, View contentView) {
+ this(loadingView, contentView, null /* emptyView*/);
+ }
+
+ public LoadingViewController(View loadingView, View contentView, @Nullable View emptyView) {
mLoadingView = loadingView;
mContentView = contentView;
+ mEmptyView = emptyView;
mFgHandler = new Handler(Looper.getMainLooper());
}
private Runnable mShowLoadingContainerRunnable = new Runnable() {
public void run() {
- handleLoadingContainer(false /* done */, false /* animate */);
+ showLoadingView();
}
};
+ /**
+ * Shows content view and hides loading view & empty view.
+ */
public void showContent(boolean animate) {
// Cancel any pending task to show the loading animation and show the list of
// apps directly.
mFgHandler.removeCallbacks(mShowLoadingContainerRunnable);
- handleLoadingContainer(true /* show */, animate);
+ handleLoadingContainer(true /* showContent */, false /* showEmpty*/, animate);
+ }
+
+ /**
+ * Shows empty view and hides loading view & content view.
+ */
+ public void showEmpty(boolean animate) {
+ if (mEmptyView == null) {
+ return;
+ }
+
+ // Cancel any pending task to show the loading animation and show the list of
+ // apps directly.
+ mFgHandler.removeCallbacks(mShowLoadingContainerRunnable);
+ handleLoadingContainer(false /* showContent */, true /* showEmpty */, animate);
+ }
+
+ /**
+ * Shows loading view and hides content view & empty view.
+ */
+ public void showLoadingView() {
+ handleLoadingContainer(false /* showContent */, false /* showEmpty */, false /* animate */);
}
public void showLoadingViewDelayed() {
@@ -57,8 +89,9 @@
mShowLoadingContainerRunnable, DELAY_SHOW_LOADING_CONTAINER_THRESHOLD_MS);
}
- public void handleLoadingContainer(boolean done, boolean animate) {
- handleLoadingContainer(mLoadingView, mContentView, done, animate);
+ private void handleLoadingContainer(boolean showContent, boolean showEmpty, boolean animate) {
+ handleLoadingContainer(mLoadingView, mContentView, mEmptyView,
+ showContent, showEmpty, animate);
}
/**
@@ -75,6 +108,25 @@
setViewShown(content, done, animate);
}
+ /**
+ * Show/hide loading view and content view and empty view.
+ *
+ * @param loading The loading spinner view
+ * @param content The content view
+ * @param empty The empty view shows no item summary to users.
+ * @param showContent If true, content is set visible and loading is set invisible.
+ * @param showEmpty If true, empty is set visible and loading is set invisible.
+ * @param animate Whether or not content/loading views should animate in/out.
+ */
+ public static void handleLoadingContainer(View loading, View content, View empty,
+ boolean showContent, boolean showEmpty, boolean animate) {
+ if (empty != null) {
+ setViewShown(empty, showEmpty, animate);
+ }
+ setViewShown(content, showContent, animate);
+ setViewShown(loading, !showContent && !showEmpty, animate);
+ }
+
private static void setViewShown(final View view, boolean shown, boolean animate) {
if (animate) {
Animation animation = AnimationUtils.loadAnimation(view.getContext(),
diff --git a/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java b/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java
index 86f5fe8..25eca7a 100644
--- a/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java
@@ -28,7 +28,6 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
@@ -49,7 +48,6 @@
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
-import android.view.ViewGroup;
import android.widget.SearchView;
import androidx.fragment.app.FragmentActivity;
@@ -156,22 +154,6 @@
}
@Test
- public void onCreateView_shouldNotShowLoadingContainer() {
- ReflectionHelpers.setField(mFragment, "mResetAppsHelper", mock(ResetAppsHelper.class));
- doNothing().when(mFragment).createHeader();
-
- final LayoutInflater layoutInflater = mock(LayoutInflater.class);
- final View view = mock(View.class);
- final View loadingContainer = mock(View.class);
- when(layoutInflater.inflate(anyInt(), eq(null))).thenReturn(view);
- when(view.findViewById(R.id.loading_container)).thenReturn(loadingContainer);
-
- mFragment.onCreateView(layoutInflater, mock(ViewGroup.class), null);
-
- verify(loadingContainer, never()).setVisibility(View.VISIBLE);
- }
-
- @Test
public void onCreateOptionsMenu_shouldSetSearchQueryListener() {
final SearchView searchView = mock(SearchView.class);
final MenuItem searchMenu = mock(MenuItem.class);
@@ -221,7 +203,6 @@
@Test
public void updateLoading_appLoaded_shouldNotDelayCallToHandleLoadingContainer() {
ReflectionHelpers.setField(mFragment, "mLoadingContainer", mock(View.class));
- ReflectionHelpers.setField(mFragment, "mListContainer", mock(View.class));
final ManageApplications.ApplicationsAdapter adapter =
spy(new ManageApplications.ApplicationsAdapter(mState, mFragment,
AppFilterRegistry.getInstance().get(FILTER_APPS_ALL), new Bundle()));
@@ -243,7 +224,6 @@
@Test
public void updateLoading_appNotLoaded_shouldDelayCallToHandleLoadingContainer() {
ReflectionHelpers.setField(mFragment, "mLoadingContainer", mock(View.class));
- ReflectionHelpers.setField(mFragment, "mListContainer", mock(View.class));
final ManageApplications.ApplicationsAdapter adapter =
spy(new ManageApplications.ApplicationsAdapter(mState, mFragment,
AppFilterRegistry.getInstance().get(FILTER_APPS_ALL), new Bundle()));
@@ -272,7 +252,6 @@
when(listContainer.getVisibility()).thenReturn(View.INVISIBLE);
when(listContainer.getContext()).thenReturn(context);
ReflectionHelpers.setField(mFragment, "mLoadingContainer", loadingContainer);
- ReflectionHelpers.setField(mFragment, "mListContainer", listContainer);
final ManageApplications.ApplicationsAdapter adapter =
spy(new ManageApplications.ApplicationsAdapter(mState, mFragment,
AppFilterRegistry.getInstance().get(FILTER_APPS_ALL), new Bundle()));
@@ -296,7 +275,7 @@
adapter.onRebuildComplete(null);
- verify(loadingViewController).showContent(true /* animate */);
+ verify(loadingViewController).showEmpty(false /* animate */);
}
@Test
@@ -304,15 +283,16 @@
final String query = "Test";
final RecyclerView recyclerView = mock(RecyclerView.class);
final View emptyView = mock(View.class);
+ final View loadingContainer = mock(View.class);
ReflectionHelpers.setField(mFragment, "mRecyclerView", recyclerView);
ReflectionHelpers.setField(mFragment, "mEmptyView", emptyView);
+ ReflectionHelpers.setField(mFragment, "mLoadingContainer", loadingContainer);
final SearchView searchView = mock(SearchView.class);
ReflectionHelpers.setField(mFragment, "mSearchView", searchView);
when(searchView.isVisibleToUser()).thenReturn(true);
when(searchView.getQuery()).thenReturn(query);
final View listContainer = mock(View.class);
when(listContainer.getVisibility()).thenReturn(View.VISIBLE);
- ReflectionHelpers.setField(mFragment, "mListContainer", listContainer);
ReflectionHelpers.setField(
mFragment, "mFilterAdapter", mock(ManageApplications.FilterSpinnerAdapter.class));
final ArrayList<ApplicationsState.AppEntry> appList = new ArrayList<>();
@@ -491,8 +471,6 @@
mFragment.mFilterAdapter.updateFilterView(true);
assertThat(mFragment.mSpinnerHeader.getVisibility()).isEqualTo(View.VISIBLE);
- assertThat(mFragment.mRecyclerView.getPaddingTop()).isEqualTo(
- mContext.getResources().getDimensionPixelSize(R.dimen.app_bar_height));
}
@Test