Snap for 5307677 from ea7fa41c0d to qt-release
Change-Id: I4ce29fdeed9f4d51eba79729c7fab3dd70c2811c
This commit is contained in:
@@ -20,9 +20,6 @@
|
||||
android:viewportHeight="24.0"
|
||||
android:tint="?android:attr/colorControlNormal">
|
||||
<path
|
||||
android:pathData="M20.8,13.56L13.5,9V3.5C13.5,2.67,12.83,2,12,2s-1.5,0.67-1.5,1.5V9l-7.3,4.56c-0.43,0.27-0.7,0.75-0.7,1.27v0.49
|
||||
c0,0.34,0.33,0.58,0.65,0.48l7.35-2.3V19l-1.6,1.2c-0.25,0.19-0.4,0.49-0.4,0.8v0.67c0,0.17,0.14,0.28,0.31,0.24
|
||||
c1.94-0.55,1.3-0.37,3.19-0.91c1.21,0.35,1.99,0.57,3.19,0.91c0.17,0.04,0.31-0.07,0.31-0.24V21c0-0.31-0.15-0.61-0.4-0.8L13.5,19
|
||||
v-5.5l7.35,2.3c0.32,0.1,0.65-0.14,0.65-0.48v-0.49C21.5,14.31,21.23,13.83,20.8,13.56z"
|
||||
android:pathData="M21,16v-2l-8,-5V3.5C13,2.67 12.33,2 11.5,2S10,2.67 10,3.5V9l-8,5v2l8,-2.5V19l-2,1.5V22l3.5,-1l3.5,1v-1.5L13,19v-5.5L21,16z"
|
||||
android:fillColor="#FFFFFFFF"/>
|
||||
</vector>
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
android:tint="?android:attr/colorAccent">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M15,14l-2,0l0,2l-2,0l0,-2l-2,0l0,-2l2,0l0,-2l2,0l0,2l2,0z"/>
|
||||
android:pathData="M16.67,4H14.5V2h-5v2H7.33C6.6,4 6,4.6 6,5.33V15v5.67C6,21.4 6.6,22 7.33,22h9.33C17.4,22 18,21.4 18,20.67V15V5.33C18,4.6 17.4,4 16.67,4zM16,15v5H8v-5V6h8V15z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M16.2,22.5H7.8c-1.3,0 -2.3,-1 -2.3,-2.3V5.8c0,-1.3 1,-2.3 2.3,-2.3h0.7v-2h7v2h0.7c1.3,0 2.3,1.1 2.3,2.3v14.3C18.5,21.5 17.5,22.5 16.2,22.5zM7.8,5.5c-0.2,0 -0.3,0.2 -0.3,0.3v14.3c0,0.2 0.2,0.3 0.3,0.3h8.3c0.2,0 0.3,-0.1 0.3,-0.3V5.8c0,-0.2 -0.1,-0.3 -0.3,-0.3h-2.7v-2h-3v2H7.8z"/>
|
||||
android:pathData="M15,12l-2,0l0,-2l-2,0l0,2l-2,0l0,2l2,0l0,2l2,0l0,-2l2,0z"/>
|
||||
</vector>
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:viewportWidth="48"
|
||||
android:viewportHeight="48"
|
||||
android:width="18dp"
|
||||
android:height="18dp">
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M36 16l-2 0 0 -4C34 6.48 29.52 2 24 2 18.48 2 14 6.48 14 12l0 4 -2 0c-2.21 0 -4 1.79 -4 4l0 20c0 2.21 1.79 4 4 4l24 0c2.21 0 4 -1.79 4 -4l0 -20c0 -2.21 -1.79 -4 -4 -4zM24 34c-2.21 0 -4 -1.79 -4 -4 0 -2.21 1.79 -4 4 -4 2.21 0 4 1.79 4 4 0 2.21 -1.79 4 -4 4zm6.2 -18l-12.4 0 0 -4c0 -3.42 2.78 -6.2 6.2 -6.2 3.42 0 6.2 2.78 6.2 6.2l0 4z"
|
||||
android:fillColor="?android:attr/colorControlNormal" />
|
||||
android:fillColor="?android:attr/colorControlNormal"
|
||||
android:pathData="M18,8h-1V6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6v2H6c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2V10C20,8.9 19.1,8 18,8zM9,6c0,-1.66 1.34,-3 3,-3s3,1.34 3,3v2H9V6zM18,20H6V10h12V20zM12,17c1.1,0 2,-0.9 2,-2c0,-1.1 -0.9,-2 -2,-2c-1.1,0 -2,0.9 -2,2C10,16.1 10.9,17 12,17z"/>
|
||||
</vector>
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0"
|
||||
android:tint="?android:attr/colorAccent">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M21.4 14.2l-1.94-1.45c.03-.25 .04 -.5 .04 -.76s-.01-.51-.04-.76L21.4 9.8c.42-.31
|
||||
.52 -.94 .24 -1.41l-1.6-2.76c-.28-.48-.88-.7-1.36-.5l-2.14 .91
|
||||
c-.48-.37-1.01-.68-1.57-.92l-.27-2.2c-.06-.52-.56-.92-1.11-.92h-3.18c-.55 0-1.05
|
||||
.4 -1.11 .92 l-.26 2.19c-.57 .24 -1.1 .55 -1.58 .92 l-2.14-.91c-.48-.2-1.08 .02
|
||||
-1.36 .5 l-1.6 2.76c-.28 .48 -.18 1.1 .24 1.42l1.94 1.45c-.03 .24 -.04 .49 -.04
|
||||
.75 s.01 .51 .04 .76 L2.6 14.2c-.42 .31 -.52 .94 -.24 1.41l1.6 2.76c.28 .48 .88
|
||||
.7 1.36 .5 l2.14-.91c.48 .37 1.01 .68 1.57 .92 l.27 2.19c.06 .53 .56 .93 1.11
|
||||
.93 h3.18c.55 0 1.04-.4 1.11-.92l.27-2.19c.56-.24 1.09-.55 1.57-.92l2.14 .91
|
||||
c.48 .2 1.08-.02 1.36-.5l1.6-2.76c.28-.48 .18 -1.1-.24-1.42zM12 15.5c-1.93
|
||||
0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5z"/>
|
||||
</vector>
|
||||
29
res/drawable/ic_settings_accent.xml
Normal file
29
res/drawable/ic_settings_accent.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0"
|
||||
android:tint="?android:attr/colorAccent">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M13.85,22.25h-3.7c-0.74,0 -1.36,-0.54 -1.45,-1.27l-0.27,-1.89c-0.27,-0.14 -0.53,-0.29 -0.79,-0.46l-1.8,0.72c-0.7,0.26 -1.47,-0.03 -1.81,-0.65L2.2,15.53c-0.35,-0.66 -0.2,-1.44 0.36,-1.88l1.53,-1.19c-0.01,-0.15 -0.02,-0.3 -0.02,-0.46c0,-0.15 0.01,-0.31 0.02,-0.46l-1.52,-1.19C1.98,9.9 1.83,9.09 2.2,8.47l1.85,-3.19c0.34,-0.62 1.11,-0.9 1.79,-0.63l1.81,0.73c0.26,-0.17 0.52,-0.32 0.78,-0.46l0.27,-1.91c0.09,-0.7 0.71,-1.25 1.44,-1.25h3.7c0.74,0 1.36,0.54 1.45,1.27l0.27,1.89c0.27,0.14 0.53,0.29 0.79,0.46l1.8,-0.72c0.71,-0.26 1.48,0.03 1.82,0.65l1.84,3.18c0.36,0.66 0.2,1.44 -0.36,1.88l-1.52,1.19c0.01,0.15 0.02,0.3 0.02,0.46s-0.01,0.31 -0.02,0.46l1.52,1.19c0.56,0.45 0.72,1.23 0.37,1.86l-1.86,3.22c-0.34,0.62 -1.11,0.9 -1.8,0.63l-1.8,-0.72c-0.26,0.17 -0.52,0.32 -0.78,0.46l-0.27,1.91C15.21,21.71 14.59,22.25 13.85,22.25zM13.32,20.72c0,0.01 0,0.01 0,0.02L13.32,20.72zM10.68,20.7l0,0.02C10.69,20.72 10.69,20.71 10.68,20.7zM10.62,20.25h2.76l0.37,-2.55l0.53,-0.22c0.44,-0.18 0.88,-0.44 1.34,-0.78l0.45,-0.34l2.38,0.96l1.38,-2.4l-2.03,-1.58l0.07,-0.56c0.03,-0.26 0.06,-0.51 0.06,-0.78c0,-0.27 -0.03,-0.53 -0.06,-0.78l-0.07,-0.56l2.03,-1.58l-1.39,-2.4l-2.39,0.96l-0.45,-0.35c-0.42,-0.32 -0.87,-0.58 -1.33,-0.77L13.75,6.3l-0.37,-2.55h-2.76L10.25,6.3L9.72,6.51C9.28,6.7 8.84,6.95 8.38,7.3L7.93,7.63L5.55,6.68L4.16,9.07l2.03,1.58l-0.07,0.56C6.09,11.47 6.06,11.74 6.06,12c0,0.26 0.02,0.53 0.06,0.78l0.07,0.56l-2.03,1.58l1.38,2.4l2.39,-0.96l0.45,0.35c0.43,0.33 0.86,0.58 1.33,0.77l0.53,0.22L10.62,20.25zM18.22,17.72c0,0.01 -0.01,0.02 -0.01,0.03L18.22,17.72zM5.77,17.71l0.01,0.02C5.78,17.72 5.77,17.71 5.77,17.71zM3.93,9.47L3.93,9.47C3.93,9.47 3.93,9.47 3.93,9.47zM18.22,6.27c0,0.01 0.01,0.02 0.01,0.02L18.22,6.27zM5.79,6.25L5.78,6.27C5.78,6.27 5.79,6.26 5.79,6.25zM13.31,3.28c0,0.01 0,0.01 0,0.02L13.31,3.28zM10.69,3.26l0,0.02C10.69,3.27 10.69,3.27 10.69,3.26z"/>
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M12,12m-3.5,0a3.5,3.5 0,1 1,7 0a3.5,3.5 0,1 1,-7 0"/>
|
||||
</vector>
|
||||
@@ -21,5 +21,5 @@
|
||||
android:viewportWidth="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M15.5,22c1.05,0 2.05,-0.16 3,-0.46c-4.06,-1.27 -7,-5.06 -7,-9.54s2.94,-8.27 7,-9.54C17.55,2.16 16.55,2 15.5,2c-5.52,0 -10,4.48 -10,10S9.98,22 15.5,22L15.5,22z"/>
|
||||
android:pathData="M6.28,4.81c0,0.16 0.01,0.32 0.02,0.48c0.38,6.58 5.83,12.03 12.41,12.41c0.16,0.01 0.32,0.02 0.47,0.02c-1.58,1.2 -3.53,1.88 -5.56,1.88c-0.46,0 -0.93,-0.03 -1.4,-0.1c-3.96,-0.58 -7.13,-3.75 -7.71,-7.71C4.13,9.24 4.8,6.75 6.28,4.81M8.27,0.6c-0.08,0 -0.17,0.02 -0.25,0.07c-3.8,2.2 -6.2,6.56 -5.49,11.4c0.7,4.82 4.59,8.7 9.4,9.4c0.57,0.08 1.13,0.12 1.69,0.12c4.15,0 7.78,-2.26 9.72,-5.62c0.2,-0.35 -0.07,-0.76 -0.44,-0.76c-0.05,0 -0.1,0.01 -0.15,0.02c-1.03,0.31 -2.12,0.48 -3.25,0.48c-0.22,0 -0.44,-0.01 -0.67,-0.02C13.23,15.38 8.62,10.77 8.29,5.17C8.21,3.81 8.38,2.49 8.75,1.26C8.86,0.91 8.59,0.6 8.27,0.6L8.27,0.6z"/>
|
||||
</vector>
|
||||
|
||||
@@ -1,28 +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.
|
||||
-->
|
||||
|
||||
<!-- Variant of progress_indeterminate_horizontal_material in frameworks/base/core/res, which
|
||||
draws the whole height of the progress bar instead having blank space above and below the
|
||||
bar. -->
|
||||
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:drawable="@drawable/vector_drawable_progress_indeterminate_horizontal_trimmed" >
|
||||
<target
|
||||
android:name="rect2_grp"
|
||||
android:animation="@*android:anim/progress_indeterminate_horizontal_rect2" />
|
||||
<target
|
||||
android:name="rect1_grp"
|
||||
android:animation="@*android:anim/progress_indeterminate_horizontal_rect1" />
|
||||
</animated-vector>
|
||||
@@ -1,53 +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.
|
||||
-->
|
||||
|
||||
<!-- Variant of vector_drawable_progress_indeterminate_horizontal in frameworks/base/core/res, which
|
||||
draws the whole height of the progress bar instead having blank space above and below the
|
||||
bar. -->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="10dp"
|
||||
android:width="360dp"
|
||||
android:viewportHeight="10"
|
||||
android:viewportWidth="360" >
|
||||
<group
|
||||
android:name="progress_group"
|
||||
android:translateX="180"
|
||||
android:translateY="5" >
|
||||
<path
|
||||
android:name="background_track"
|
||||
android:pathData="M -180.0,-5.0 l 360.0,0 l 0,10.0 l -360.0,0 Z"
|
||||
android:fillColor="?android:attr/colorControlActivated"
|
||||
android:fillAlpha="?android:attr/disabledAlpha"/>
|
||||
<group
|
||||
android:name="rect2_grp"
|
||||
android:translateX="-197.60001"
|
||||
android:scaleX="0.1" >
|
||||
<path
|
||||
android:name="rect2"
|
||||
android:pathData="M -144.0,-5.0 l 288.0,0 l 0,10.0 l -288.0,0 Z"
|
||||
android:fillColor="?android:attr/colorControlActivated" />
|
||||
</group>
|
||||
<group
|
||||
android:name="rect1_grp"
|
||||
android:translateX="-522.59998"
|
||||
android:scaleX="0.1" >
|
||||
<path
|
||||
android:name="rect1"
|
||||
android:pathData="M -144.0,-5.0 l 288.0,0 l 0,10.0 l -288.0,0 Z"
|
||||
android:fillColor="?android:attr/colorControlActivated" />
|
||||
</group>
|
||||
</group>
|
||||
</vector>
|
||||
@@ -1,74 +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.
|
||||
-->
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/ContextualCardStyle">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/homepage_card_padding_start"
|
||||
android:paddingEnd="@dimen/homepage_full_card_padding_end"
|
||||
android:paddingTop="@dimen/homepage_condition_full_card_padding_top"
|
||||
android:paddingBottom="@dimen/homepage_condition_full_card_padding_bottom"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="@dimen/homepage_card_icon_size"
|
||||
android:layout_height="@dimen/homepage_card_icon_size"
|
||||
android:tint="?android:attr/colorAccent"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:paddingStart="@dimen/homepage_condition_full_card_padding_start"
|
||||
android:paddingEnd="@dimen/homepage_condition_full_card_padding_end"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/homepage_condition_card_title_margin_bottom"
|
||||
android:textAppearance="@style/TextAppearance.ConditionCardTitle"/>
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/summary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextAppearance.ConditionCardSummary"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/vertical_divider"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/first_action"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/ConditionFullCardBorderlessButton"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
@@ -22,18 +22,20 @@
|
||||
style="@style/ContextualCardStyle">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/homepage_condition_half_card_padding_top"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/homepage_card_padding_start"
|
||||
android:paddingEnd="@dimen/homepage_card_padding_end"
|
||||
android:orientation="vertical">
|
||||
android:paddingEnd="@dimen/homepage_full_card_padding_end"
|
||||
android:paddingTop="@dimen/homepage_condition_full_card_padding_top"
|
||||
android:paddingBottom="@dimen/homepage_condition_full_card_padding_bottom"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@android:id/icon"
|
||||
@@ -41,35 +43,45 @@
|
||||
android:layout_height="@dimen/homepage_card_icon_size"
|
||||
android:tint="?android:attr/colorAccent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/title"
|
||||
android:layout_width="match_parent"
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:layout_marginTop="@dimen/homepage_condition_half_card_title_margin_top"
|
||||
android:layout_marginBottom="@dimen/homepage_condition_card_title_margin_bottom"
|
||||
android:textAppearance="@style/TextAppearance.ConditionCardTitle"/>
|
||||
android:layout_weight="1"
|
||||
android:paddingStart="@dimen/homepage_condition_full_card_padding_start"
|
||||
android:paddingEnd="@dimen/homepage_condition_full_card_padding_end"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/summary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:layout_marginBottom="@dimen/homepage_condition_half_card_summary_margin_bottom"
|
||||
android:textAppearance="@style/TextAppearance.ConditionCardSummary"/>
|
||||
<TextView
|
||||
android:id="@android:id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/homepage_condition_card_title_margin_bottom"
|
||||
android:textAppearance="@style/TextAppearance.ConditionCardTitle"/>
|
||||
|
||||
<include layout="@layout/horizontal_divider"/>
|
||||
<TextView
|
||||
android:id="@android:id/summary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextAppearance.ConditionCardSummary"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp">
|
||||
<include
|
||||
layout="@layout/horizontal_divider"/>
|
||||
</FrameLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/first_action"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollbars="none"
|
||||
style="@style/ConditionHalfCardBorderlessButton"/>
|
||||
|
||||
style="@style/ConditionFullCardBorderlessButton"/>
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
@@ -55,14 +55,22 @@
|
||||
android:id="@android:id/summary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:lines="2"
|
||||
android:ellipsize="end"
|
||||
android:layout_marginBottom="@dimen/homepage_condition_half_card_summary_margin_bottom"
|
||||
android:textAppearance="@style/TextAppearance.ConditionCardSummary"/>
|
||||
|
||||
<include layout="@layout/horizontal_divider"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp">
|
||||
<include
|
||||
layout="@layout/horizontal_divider"/>
|
||||
</FrameLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/first_action"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
android:layout_height="fill_parent"
|
||||
android:paddingStart="12dip"
|
||||
android:paddingEnd="12dp"
|
||||
android:src="@drawable/ic_settings"
|
||||
android:src="@drawable/ic_settings_accent"
|
||||
android:contentDescription="@string/apps_with_restrictions_settings_button"
|
||||
android:layout_gravity="center"
|
||||
android:clickable="true"
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_settings"
|
||||
android:src="@drawable/ic_settings_accent"
|
||||
android:contentDescription="@string/settings_button" />
|
||||
|
||||
|
||||
@@ -22,6 +22,6 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_settings"
|
||||
android:src="@drawable/ic_settings_accent"
|
||||
android:contentDescription="@string/settings_button" />
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_settings"
|
||||
android:src="@drawable/ic_settings_accent"
|
||||
android:contentDescription="@string/settings_button" />
|
||||
<!-- Additional overdraw background to stop parent's material ripple -->
|
||||
<FrameLayout
|
||||
@@ -42,7 +42,7 @@
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_settings"
|
||||
android:src="@drawable/ic_settings_accent"
|
||||
android:contentDescription="@string/settings_button" />
|
||||
</FrameLayout>
|
||||
</FrameLayout>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
android:layout_height="fill_parent"
|
||||
android:paddingStart="16dip"
|
||||
android:paddingEnd="16dip"
|
||||
android:src="@drawable/ic_settings"
|
||||
android:src="@drawable/ic_settings_accent"
|
||||
android:contentDescription="@string/settings_label"
|
||||
android:layout_gravity="center"
|
||||
android:background="?android:attr/selectableItemBackground" />
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
android:layout_gravity="center_vertical"
|
||||
android:padding="8dip"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:src="@drawable/ic_settings"
|
||||
android:src="@drawable/ic_settings_accent"
|
||||
android:contentDescription="@string/wifi_display_details" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -1,34 +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.
|
||||
-->
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dp"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<View
|
||||
android:id="@+id/progress_bar_background"
|
||||
style="@style/TrimmedHorizontalProgressBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/colorSecondary" />
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar_animation"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/TrimmedHorizontalProgressBar"
|
||||
android:indeterminate="true" />
|
||||
</FrameLayout>
|
||||
@@ -23,6 +23,7 @@
|
||||
<color name="homepage_support_background">#3F5FBD</color>
|
||||
<!-- 80% black for status bar of homepage -->
|
||||
<color name="homepage_status_bar_color">#cc000000</color>
|
||||
<color name="homepage_card_dismissal_background">@*android:color/material_grey_800</color>
|
||||
<color name="homepage_card_dismissal_background">@*android:color/material_grey_900</color>
|
||||
<color name="contextual_card_background">@*android:color/material_grey_900</color>
|
||||
</resources>
|
||||
|
||||
|
||||
@@ -100,8 +100,10 @@
|
||||
<color name="homepage_location_background">#2EC7DC</color>
|
||||
<color name="homepage_about_background">#9FA8DA</color>
|
||||
<color name="homepage_privacy_background">#5E97F6</color>
|
||||
|
||||
<color name="homepage_card_stroke_color">#1f000000</color>
|
||||
<color name="homepage_card_dismissal_background">@*android:color/material_grey_50</color>
|
||||
<color name="contextual_card_background">@*android:color/background_device_default_light</color>
|
||||
<!-- End of dashboard/homepage icon background colors -->
|
||||
|
||||
<color name="switchbar_text_color">@android:color/white</color>
|
||||
|
||||
@@ -368,8 +368,8 @@
|
||||
<dimen name="homepage_condition_half_card_padding_top">12dp</dimen>
|
||||
<dimen name="homepage_condition_half_card_title_margin_top">12dp</dimen>
|
||||
<dimen name="homepage_condition_half_card_summary_margin_bottom">12dp</dimen>
|
||||
<dimen name="homepage_condition_full_card_padding_start">24dp</dimen>
|
||||
<dimen name="homepage_condition_full_card_padding_end">24dp</dimen>
|
||||
<dimen name="homepage_condition_full_card_padding_start">12dp</dimen>
|
||||
<dimen name="homepage_condition_full_card_padding_end">16dp</dimen>
|
||||
<dimen name="homepage_condition_full_card_padding_top">12dp</dimen>
|
||||
<dimen name="homepage_condition_full_card_padding_bottom">12dp</dimen>
|
||||
<dimen name="homepage_condition_header_padding_top">10dp</dimen>
|
||||
|
||||
@@ -7078,7 +7078,7 @@
|
||||
<string name="keywords_display_auto_brightness">dim screen, touchscreen, battery, smart brightness, dynamic brightness</string>
|
||||
|
||||
<!-- Search keywords for adaptive sleep setting [CHAR LIMIT=NONE]-->
|
||||
<string name="keywords_display_adaptive_sleep">dim screen, sleep, battery, timeout, attention</string>
|
||||
<string name="keywords_display_adaptive_sleep">dim screen, sleep, battery, timeout, attention, display, screen, inactivity</string>
|
||||
|
||||
<!-- List of synonyms for the auto rotate (rotate the virtual display when the device rotates) setting, used to match in settings search [CHAR LIMIT=NONE] -->
|
||||
<string name="keywords_auto_rotate">rotate, flip, rotation, portrait, landscape, orientation, vertical, horizontal</string>
|
||||
|
||||
@@ -82,15 +82,6 @@
|
||||
<item name="android:scrollbarStyle">outsideOverlay</item>
|
||||
</style>
|
||||
|
||||
<style name="TrimmedHorizontalProgressBar"
|
||||
parent="android:Widget.Material.ProgressBar.Horizontal">
|
||||
<item name="android:indeterminateDrawable">
|
||||
@drawable/progress_indeterminate_horizontal_material_trimmed
|
||||
</item>
|
||||
<item name="android:minHeight">3dip</item>
|
||||
<item name="android:maxHeight">3dip</item>
|
||||
</style>
|
||||
|
||||
<style name="bt_item">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
@@ -286,6 +277,7 @@
|
||||
|
||||
<style name="TextAppearance.ConditionCardTitle"
|
||||
parent="@*android:style/TextAppearance.DeviceDefault.Subhead">
|
||||
<item name="android:fontFamily">@*android:string/config_headlineFontFamilyMedium</item>
|
||||
<item name="android:textSize">16sp</item>
|
||||
</style>
|
||||
|
||||
@@ -419,6 +411,7 @@
|
||||
<item name="android:layout_marginBottom">@dimen/homepage_card_vertical_margin</item>
|
||||
<item name="android:layout_marginStart">@dimen/homepage_card_side_margin</item>
|
||||
<item name="android:layout_marginEnd">@dimen/homepage_card_side_margin</item>
|
||||
<item name="cardBackgroundColor">@color/contextual_card_background</item>
|
||||
<item name="cardCornerRadius">@*android:dimen/config_dialogCornerRadius</item>
|
||||
<item name="cardElevation">0dp</item>
|
||||
<item name="strokeColor">@color/homepage_card_stroke_color</item>
|
||||
@@ -448,8 +441,9 @@
|
||||
|
||||
<style name="ConditionFullCardBorderlessButton"
|
||||
parent="@style/ConditionCardBorderlessButton">
|
||||
<item name="android:minWidth">24dp</item>
|
||||
<item name="android:layout_marginStart">20dp</item>
|
||||
<item name="android:textAlignment">viewStart</item>
|
||||
<item name="android:paddingStart">50dp</item>
|
||||
<item name="android:paddingEnd">50dp</item>
|
||||
</style>
|
||||
|
||||
<style name="ContextualCardDismissalButton"
|
||||
|
||||
@@ -52,6 +52,7 @@ import com.android.settingslib.net.NetworkCycleDataForUidLoader;
|
||||
import com.android.settingslib.net.UidDetail;
|
||||
import com.android.settingslib.net.UidDetailProvider;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceChangeListener,
|
||||
@@ -59,8 +60,10 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
|
||||
|
||||
private static final String TAG = "AppDataUsage";
|
||||
|
||||
public static final String ARG_APP_ITEM = "app_item";
|
||||
public static final String ARG_NETWORK_TEMPLATE = "network_template";
|
||||
static final String ARG_APP_ITEM = "app_item";
|
||||
static final String ARG_NETWORK_TEMPLATE = "network_template";
|
||||
static final String ARG_NETWORK_CYCLES = "network_cycles";
|
||||
static final String ARG_SELECTED_CYCLE = "selected_cycle";
|
||||
|
||||
private static final String KEY_TOTAL_USAGE = "total_usage";
|
||||
private static final String KEY_FOREGROUND_USAGE = "foreground_usage";
|
||||
@@ -99,6 +102,8 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
|
||||
private RestrictedSwitchPreference mUnrestrictedData;
|
||||
private DataSaverBackend mDataSaverBackend;
|
||||
private Context mContext;
|
||||
private ArrayList<Long> mCycles;
|
||||
private long mSelectedCycle;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
@@ -110,6 +115,10 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
|
||||
mAppItem = (args != null) ? (AppItem) args.getParcelable(ARG_APP_ITEM) : null;
|
||||
mTemplate = (args != null) ? (NetworkTemplate) args.getParcelable(ARG_NETWORK_TEMPLATE)
|
||||
: null;
|
||||
mCycles = (args != null) ? (ArrayList) args.getSerializable(ARG_NETWORK_CYCLES)
|
||||
: null;
|
||||
mSelectedCycle = (args != null) ? args.getLong(ARG_SELECTED_CYCLE) : 0L;
|
||||
|
||||
if (mTemplate == null) {
|
||||
mTemplate = DataUsageUtils.getDefaultTemplate(mContext,
|
||||
SubscriptionManager.getDefaultDataSubscriptionId());
|
||||
@@ -393,6 +402,9 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
|
||||
} else {
|
||||
builder.addUid(mAppItem.key);
|
||||
}
|
||||
if (mCycles != null) {
|
||||
builder.setCycles(mCycles);
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@@ -401,7 +413,23 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
|
||||
List<NetworkCycleDataForUid> data) {
|
||||
mUsageData = data;
|
||||
mCycleAdapter.updateCycleList(data);
|
||||
bindData(0 /* position */);
|
||||
if (mSelectedCycle > 0L) {
|
||||
final int numCycles = data.size();
|
||||
int position = 0;
|
||||
for (int i = 0; i < numCycles; i++) {
|
||||
final NetworkCycleDataForUid cycleData = data.get(i);
|
||||
if (cycleData.getEndTime() == mSelectedCycle) {
|
||||
position = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (position > 0) {
|
||||
mCycle.setSelection(position);
|
||||
}
|
||||
bindData(position);
|
||||
} else {
|
||||
bindData(0 /* position */);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -109,6 +109,7 @@ public class DataUsageList extends DataUsageBaseFragment {
|
||||
@VisibleForTesting
|
||||
int mNetworkType;
|
||||
private List<NetworkCycleChartData> mCycleData;
|
||||
private ArrayList<Long> mCycles;
|
||||
|
||||
private LoadingViewController mLoadingViewController;
|
||||
private UidDetailProvider mUidDetailProvider;
|
||||
@@ -411,10 +412,23 @@ public class DataUsageList extends DataUsageBaseFragment {
|
||||
}
|
||||
}
|
||||
|
||||
private void startAppDataUsage(AppItem item) {
|
||||
@VisibleForTesting
|
||||
void startAppDataUsage(AppItem item) {
|
||||
final Bundle args = new Bundle();
|
||||
args.putParcelable(AppDataUsage.ARG_APP_ITEM, item);
|
||||
args.putParcelable(AppDataUsage.ARG_NETWORK_TEMPLATE, mTemplate);
|
||||
if (mCycles == null) {
|
||||
mCycles = new ArrayList<>();
|
||||
for (NetworkCycleChartData data : mCycleData) {
|
||||
if (mCycles.isEmpty()) {
|
||||
mCycles.add(data.getEndTime());
|
||||
}
|
||||
mCycles.add(data.getStartTime());
|
||||
}
|
||||
}
|
||||
args.putSerializable(AppDataUsage.ARG_NETWORK_CYCLES, mCycles);
|
||||
args.putLong(AppDataUsage.ARG_SELECTED_CYCLE,
|
||||
mCycleData.get(mCycleSpinner.getSelectedItemPosition()).getEndTime());
|
||||
|
||||
new SubSettingLauncher(getContext())
|
||||
.setDestination(AppDataUsage.class.getName())
|
||||
|
||||
@@ -55,8 +55,7 @@ public class BluetoothSnoopLogPreferenceController extends DeveloperOptionsPrefe
|
||||
mListEntries = context.getResources().getStringArray(R.array.bt_hci_snoop_log_entries);
|
||||
}
|
||||
|
||||
// Default mode is FILTERED on userdebug/eng build, DISABLED on user build,
|
||||
// or can be changed by modifying the global setting.
|
||||
// Default mode is DISABLED. It can also be changed by modifying the global setting.
|
||||
public int getDefaultModeIndex() {
|
||||
if (!Build.IS_DEBUGGABLE) {
|
||||
return BTSNOOP_LOG_MODE_DISABLED_INDEX;
|
||||
@@ -71,7 +70,7 @@ public class BluetoothSnoopLogPreferenceController extends DeveloperOptionsPrefe
|
||||
}
|
||||
}
|
||||
|
||||
return BTSNOOP_LOG_MODE_FILTERED_INDEX;
|
||||
return BTSNOOP_LOG_MODE_DISABLED_INDEX;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,6 +31,7 @@ import android.telephony.euicc.EuiccManager;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.network.telephony.MobileNetworkActivity;
|
||||
import com.android.settings.widget.AddPreference;
|
||||
import com.android.settingslib.Utils;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
|
||||
import java.util.List;
|
||||
@@ -50,6 +51,7 @@ public class MobileNetworkSummaryController extends AbstractPreferenceController
|
||||
private SubscriptionManager mSubscriptionManager;
|
||||
private SubscriptionsChangeListener mChangeListener;
|
||||
private TelephonyManager mTelephonyMgr;
|
||||
private EuiccManager mEuiccManager;
|
||||
private AddPreference mPreference;
|
||||
|
||||
/**
|
||||
@@ -71,6 +73,7 @@ public class MobileNetworkSummaryController extends AbstractPreferenceController
|
||||
super(context);
|
||||
mSubscriptionManager = context.getSystemService(SubscriptionManager.class);
|
||||
mTelephonyMgr = mContext.getSystemService(TelephonyManager.class);
|
||||
mEuiccManager = mContext.getSystemService(EuiccManager.class);
|
||||
mChangeListener = new SubscriptionsChangeListener(context, this);
|
||||
lifecycle.addObserver(this);
|
||||
}
|
||||
@@ -97,7 +100,11 @@ public class MobileNetworkSummaryController extends AbstractPreferenceController
|
||||
final List<SubscriptionInfo> subs = SubscriptionUtil.getAvailableSubscriptions(
|
||||
mSubscriptionManager);
|
||||
if (subs.isEmpty()) {
|
||||
return mContext.getResources().getString(R.string.mobile_network_summary_add_a_network);
|
||||
if (mEuiccManager.isEnabled()) {
|
||||
return mContext.getResources().getString(
|
||||
R.string.mobile_network_summary_add_a_network);
|
||||
}
|
||||
return null;
|
||||
} else if (subs.size() == 1) {
|
||||
return subs.get(0).getDisplayName();
|
||||
} else {
|
||||
@@ -112,20 +119,22 @@ public class MobileNetworkSummaryController extends AbstractPreferenceController
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
|
||||
private boolean shouldEnableAddButton() {
|
||||
// The add button should only show up if the device is in multi-sim mode.
|
||||
return mTelephonyMgr.getMultiSimConfiguration() != UNKNOWN;
|
||||
private boolean shouldShowAddButton() {
|
||||
// The add button should only show up if the device is in multi-sim mode and the eSIM
|
||||
// manager is enabled.
|
||||
return mTelephonyMgr.getMultiSimConfiguration() != UNKNOWN && mEuiccManager.isEnabled();
|
||||
}
|
||||
|
||||
private void update() {
|
||||
if (mPreference == null) {
|
||||
return;
|
||||
}
|
||||
final boolean enableAddButton = shouldEnableAddButton();
|
||||
final boolean showAddButton = shouldShowAddButton();
|
||||
refreshSummary(mPreference);
|
||||
if (!enableAddButton) {
|
||||
if (!showAddButton) {
|
||||
mPreference.setOnAddClickListener(null);
|
||||
} else {
|
||||
mPreference.setAddWidgetEnabled(!mChangeListener.isAirplaneModeOn());
|
||||
mPreference.setOnAddClickListener(p -> {
|
||||
startAddSimFlow();
|
||||
});
|
||||
@@ -134,11 +143,11 @@ public class MobileNetworkSummaryController extends AbstractPreferenceController
|
||||
mSubscriptionManager);
|
||||
mPreference.setOnPreferenceClickListener(null);
|
||||
mPreference.setFragment(null);
|
||||
mPreference.setEnabled(true);
|
||||
mPreference.setEnabled(!mChangeListener.isAirplaneModeOn());
|
||||
if (subs.isEmpty()) {
|
||||
if (enableAddButton) {
|
||||
if (showAddButton) {
|
||||
mPreference.setEnabled(false);
|
||||
} else {
|
||||
} else if (mEuiccManager.isEnabled()) {
|
||||
mPreference.setOnPreferenceClickListener((Preference pref) -> {
|
||||
startAddSimFlow();
|
||||
return true;
|
||||
@@ -157,7 +166,7 @@ public class MobileNetworkSummaryController extends AbstractPreferenceController
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return true;
|
||||
return !Utils.isWifiOnly(mContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -167,6 +176,7 @@ public class MobileNetworkSummaryController extends AbstractPreferenceController
|
||||
|
||||
@Override
|
||||
public void onAirplaneModeChanged(boolean airplaneModeEnabled) {
|
||||
update();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -122,7 +122,7 @@ public class NetworkSelectSettings extends DashboardFragment {
|
||||
|
||||
final Activity activity = getActivity();
|
||||
if (activity != null) {
|
||||
mProgressHeader = setPinnedHeaderView(R.layout.wifi_progress_header)
|
||||
mProgressHeader = setPinnedHeaderView(R.layout.progress_header)
|
||||
.findViewById(R.id.progress_bar_animation);
|
||||
setProgressBarVisible(false);
|
||||
}
|
||||
|
||||
@@ -449,14 +449,14 @@ public class SliceBuilderUtils {
|
||||
int iconResource = data.getIconResource();
|
||||
|
||||
if (iconResource == 0) {
|
||||
iconResource = R.drawable.ic_settings;
|
||||
iconResource = R.drawable.ic_settings_accent;
|
||||
}
|
||||
try {
|
||||
return IconCompat.createWithResource(context, iconResource);
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Falling back to settings icon because there is an error getting slice icon "
|
||||
+ data.getUri(), e);
|
||||
return IconCompat.createWithResource(context, R.drawable.ic_settings);
|
||||
return IconCompat.createWithResource(context, R.drawable.ic_settings_accent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,11 +72,13 @@ public class AdaptiveHomepageIcon extends LayerDrawable {
|
||||
// If found anything, use it.
|
||||
if (bgColor != 0) {
|
||||
setBackgroundColor(bgColor);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.e(TAG, "Failed to set background color for " + tile.getPackageName());
|
||||
}
|
||||
setBackgroundColor(context.getColor(R.color.homepage_generic_icon_background));
|
||||
}
|
||||
|
||||
public void setBackgroundColor(int color) {
|
||||
|
||||
@@ -34,6 +34,7 @@ public class AddPreference extends RestrictedPreference implements View.OnClickL
|
||||
|
||||
private OnAddClickListener mListener;
|
||||
private View mWidgetFrame;
|
||||
private View mAddWidget;
|
||||
|
||||
public AddPreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
@@ -53,6 +54,12 @@ public class AddPreference extends RestrictedPreference implements View.OnClickL
|
||||
}
|
||||
}
|
||||
|
||||
public void setAddWidgetEnabled(boolean enabled) {
|
||||
if (mAddWidget != null) {
|
||||
mAddWidget.setEnabled(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getSecondTargetResId() {
|
||||
return R.layout.preference_widget_add;
|
||||
@@ -67,9 +74,9 @@ public class AddPreference extends RestrictedPreference implements View.OnClickL
|
||||
public void onBindViewHolder(PreferenceViewHolder holder) {
|
||||
super.onBindViewHolder(holder);
|
||||
mWidgetFrame = holder.findViewById(android.R.id.widget_frame);
|
||||
final View addWidget = holder.findViewById(getAddWidgetResId());
|
||||
addWidget.setEnabled(true);
|
||||
addWidget.setOnClickListener(this);
|
||||
mAddWidget = holder.findViewById(getAddWidgetResId());
|
||||
mAddWidget.setEnabled(true);
|
||||
mAddWidget.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -203,7 +203,7 @@ public class WifiSettings extends RestrictedSettingsFragment
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
final Activity activity = getActivity();
|
||||
if (activity != null) {
|
||||
mProgressHeader = setPinnedHeaderView(R.layout.wifi_progress_header)
|
||||
mProgressHeader = setPinnedHeaderView(R.layout.progress_header)
|
||||
.findViewById(R.id.progress_bar_animation);
|
||||
setProgressBarVisible(false);
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ public class WifiSlice implements CustomSliceable {
|
||||
|
||||
private IconCompat getEndIcon(AccessPoint accessPoint) {
|
||||
if (accessPoint.isActive()) {
|
||||
return IconCompat.createWithResource(mContext, R.drawable.ic_settings);
|
||||
return IconCompat.createWithResource(mContext, R.drawable.ic_settings_accent);
|
||||
} else if (accessPoint.getSecurity() != AccessPoint.SECURITY_NONE) {
|
||||
return IconCompat.createWithResource(mContext, R.drawable.ic_friction_lock_closed);
|
||||
} else if (accessPoint.isMetered()) {
|
||||
|
||||
@@ -345,6 +345,70 @@ public class AppDataUsageTest {
|
||||
assertThat(uids.get(2)).isEqualTo(789);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onCreateLoader_hasCyclesSpecified_shouldQueryDataUsageForSpecifiedCycles() {
|
||||
final long startTime = 1521583200000L;
|
||||
final long endTime = 1521676800000L;
|
||||
ArrayList<Long> testCycles = new ArrayList<>();
|
||||
testCycles.add(endTime);
|
||||
testCycles.add(startTime);
|
||||
final int uid = 123;
|
||||
final AppItem appItem = new AppItem(uid);
|
||||
appItem.category = AppItem.CATEGORY_APP;
|
||||
appItem.addUid(uid);
|
||||
|
||||
mFragment = new AppDataUsage();
|
||||
ReflectionHelpers.setField(mFragment, "mContext", RuntimeEnvironment.application);
|
||||
ReflectionHelpers.setField(mFragment, "mCycles", testCycles);
|
||||
ReflectionHelpers.setField(mFragment, "mAppItem", appItem);
|
||||
ReflectionHelpers.setField(mFragment, "mTemplate",
|
||||
NetworkTemplate.buildTemplateWifiWildcard());
|
||||
|
||||
final NetworkCycleDataForUidLoader loader = (NetworkCycleDataForUidLoader)
|
||||
mFragment.mUidDataCallbacks.onCreateLoader(0 /* id */, Bundle.EMPTY /* args */);
|
||||
|
||||
final ArrayList<Long> cycles = loader.getCycles();
|
||||
assertThat(cycles).hasSize(2);
|
||||
assertThat(cycles.get(0)).isEqualTo(endTime);
|
||||
assertThat(cycles.get(1)).isEqualTo(startTime);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onLoadFinished_hasSelectedCycleSpecified_shouldSelectSpecifiedCycle() {
|
||||
final long now = System.currentTimeMillis();
|
||||
final long tenDaysAgo = now - (DateUtils.DAY_IN_MILLIS * 10);
|
||||
final long twentyDaysAgo = now - (DateUtils.DAY_IN_MILLIS * 20);
|
||||
final long thirtyDaysAgo = now - (DateUtils.DAY_IN_MILLIS * 30);
|
||||
final List<NetworkCycleDataForUid> data = new ArrayList<>();
|
||||
NetworkCycleDataForUid.Builder builder = new NetworkCycleDataForUid.Builder();
|
||||
builder.setStartTime(thirtyDaysAgo).setEndTime(twentyDaysAgo).setTotalUsage(9876L);
|
||||
data.add(builder.build());
|
||||
builder = new NetworkCycleDataForUid.Builder();
|
||||
builder.setStartTime(twentyDaysAgo).setEndTime(tenDaysAgo).setTotalUsage(5678L);
|
||||
data.add(builder.build());
|
||||
builder = new NetworkCycleDataForUid.Builder();
|
||||
builder.setStartTime(tenDaysAgo).setEndTime(now).setTotalUsage(1234L);
|
||||
data.add(builder.build());
|
||||
|
||||
mFragment = new AppDataUsage();
|
||||
ReflectionHelpers.setField(mFragment, "mContext", RuntimeEnvironment.application);
|
||||
ReflectionHelpers.setField(mFragment, "mCycleAdapter", mock(CycleAdapter.class));
|
||||
ReflectionHelpers.setField(mFragment, "mSelectedCycle", tenDaysAgo);
|
||||
final Preference backgroundPref = mock(Preference.class);
|
||||
ReflectionHelpers.setField(mFragment, "mBackgroundUsage", backgroundPref);
|
||||
final Preference foregroundPref = mock(Preference.class);
|
||||
ReflectionHelpers.setField(mFragment, "mForegroundUsage", foregroundPref);
|
||||
final Preference totalPref = mock(Preference.class);
|
||||
ReflectionHelpers.setField(mFragment, "mTotalUsage", totalPref);
|
||||
final SpinnerPreference cycle = mock(SpinnerPreference.class);
|
||||
ReflectionHelpers.setField(mFragment, "mCycle", cycle);
|
||||
|
||||
mFragment.mUidDataCallbacks.onLoadFinished(null /* loader */, data);
|
||||
|
||||
verify(cycle).setSelection(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Config(shadows = {ShadowDataUsageUtils.class, ShadowSubscriptionManager.class})
|
||||
public void onCreate_noNetworkTemplateAndInvalidDataSubscription_shouldUseWifiTemplate() {
|
||||
ShadowDataUsageUtils.IS_MOBILE_DATA_SUPPORTED = true;
|
||||
@@ -355,6 +419,10 @@ public class AppDataUsageTest {
|
||||
mFragment = spy(new AppDataUsage());
|
||||
doReturn(Robolectric.setupActivity(FragmentActivity.class)).when(mFragment).getActivity();
|
||||
doReturn(RuntimeEnvironment.application).when(mFragment).getContext();
|
||||
final UidDetailProvider uidDetailProvider = mock(UidDetailProvider.class);
|
||||
doReturn(uidDetailProvider).when(mFragment).getUidDetailProvider();
|
||||
doReturn(new UidDetail()).when(uidDetailProvider).getUidDetail(anyInt(), anyBoolean());
|
||||
|
||||
ReflectionHelpers.setField(mFragment, "mDashboardFeatureProvider",
|
||||
FakeFeatureFactory.setupForTest().dashboardFeatureProvider);
|
||||
final Bundle args = new Bundle();
|
||||
|
||||
@@ -30,19 +30,27 @@ import android.net.ConnectivityManager;
|
||||
import android.net.NetworkTemplate;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import com.android.settings.SettingsActivity;
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
import com.android.settingslib.AppItem;
|
||||
import com.android.settingslib.NetworkPolicyEditor;
|
||||
import com.android.settingslib.core.instrumentation.VisibilityLoggerMixin;
|
||||
import com.android.settingslib.net.NetworkCycleChartData;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.util.ReflectionHelpers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
@@ -124,4 +132,32 @@ public class DataUsageListTest {
|
||||
assertThat(mDataUsageList.mTemplate).isNotNull();
|
||||
assertThat(mDataUsageList.mSubId).isEqualTo(3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void startAppDataUsage_shouldAddCyclesInfoToLaunchArguments() {
|
||||
final long startTime = 1521583200000L;
|
||||
final long endTime = 1521676800000L;
|
||||
final List<NetworkCycleChartData> data = new ArrayList<>();
|
||||
final NetworkCycleChartData.Builder builder = new NetworkCycleChartData.Builder();
|
||||
builder.setStartTime(startTime)
|
||||
.setEndTime(endTime);
|
||||
data.add(builder.build());
|
||||
ReflectionHelpers.setField(mDataUsageList, "mCycleData", data);
|
||||
final Spinner spinner = mock(Spinner.class);
|
||||
when(spinner.getSelectedItemPosition()).thenReturn(0);
|
||||
ReflectionHelpers.setField(mDataUsageList, "mCycleSpinner", spinner);
|
||||
final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
|
||||
|
||||
mDataUsageList.startAppDataUsage(new AppItem());
|
||||
|
||||
verify(mContext).startActivity(intent.capture());
|
||||
final Bundle arguments =
|
||||
intent.getValue().getBundleExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS);
|
||||
assertThat(arguments.getLong(AppDataUsage.ARG_SELECTED_CYCLE)).isEqualTo(endTime);
|
||||
final ArrayList<Long> cycles =
|
||||
(ArrayList) arguments.getSerializable(AppDataUsage.ARG_NETWORK_CYCLES);
|
||||
assertThat(cycles).hasSize(2);
|
||||
assertThat(cycles.get(0)).isEqualTo(endTime);
|
||||
assertThat(cycles.get(1)).isEqualTo(startTime);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.isNull;
|
||||
import static org.mockito.ArgumentMatchers.notNull;
|
||||
import static org.mockito.Mockito.atLeastOnce;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.spy;
|
||||
@@ -33,9 +34,12 @@ import static org.mockito.Mockito.when;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.provider.Settings;
|
||||
import android.telephony.SubscriptionInfo;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.telephony.euicc.EuiccManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.settings.network.telephony.MobileNetworkActivity;
|
||||
import com.android.settings.widget.AddPreference;
|
||||
@@ -61,7 +65,8 @@ public class MobileNetworkSummaryControllerTest {
|
||||
private Lifecycle mLifecycle;
|
||||
@Mock
|
||||
private TelephonyManager mTelephonyManager;
|
||||
|
||||
@Mock
|
||||
private EuiccManager mEuiccManager;
|
||||
@Mock
|
||||
private PreferenceScreen mPreferenceScreen;
|
||||
|
||||
@@ -74,7 +79,9 @@ public class MobileNetworkSummaryControllerTest {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = spy(Robolectric.setupActivity(Activity.class));
|
||||
when(mContext.getSystemService(eq(TelephonyManager.class))).thenReturn(mTelephonyManager);
|
||||
when(mContext.getSystemService(EuiccManager.class)).thenReturn(mEuiccManager);
|
||||
when(mTelephonyManager.getMultiSimConfiguration()).thenReturn(UNKNOWN);
|
||||
when(mEuiccManager.isEnabled()).thenReturn(true);
|
||||
|
||||
mController = new MobileNetworkSummaryController(mContext, mLifecycle);
|
||||
mPreference = spy(new AddPreference(mContext, null));
|
||||
@@ -88,6 +95,14 @@ public class MobileNetworkSummaryControllerTest {
|
||||
SubscriptionUtil.setAvailableSubscriptionsForTesting(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isAvailable_wifiOnlyMode_notAvailable() {
|
||||
ConnectivityManager cm = mock(ConnectivityManager.class);
|
||||
when(cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)).thenReturn(false);
|
||||
when(mContext.getSystemService(ConnectivityManager.class)).thenReturn(cm);
|
||||
assertThat(mController.isAvailable()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSummary_noSubscriptions_correctSummaryAndClickHandler() {
|
||||
mController.displayPreference(mPreferenceScreen);
|
||||
@@ -101,6 +116,14 @@ public class MobileNetworkSummaryControllerTest {
|
||||
EuiccManager.ACTION_PROVISION_EMBEDDED_SUBSCRIPTION);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSummary_noSubscriptionsNoEuiccMgr_correctSummaryAndClickHandler() {
|
||||
when(mEuiccManager.isEnabled()).thenReturn(false);
|
||||
assertThat(TextUtils.isEmpty(mController.getSummary())).isTrue();
|
||||
assertThat(mPreference.getOnPreferenceClickListener()).isNull();
|
||||
assertThat(mPreference.getFragment()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSummary_oneSubscription_correctSummaryAndClickHandler() {
|
||||
final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
|
||||
@@ -204,6 +227,15 @@ public class MobileNetworkSummaryControllerTest {
|
||||
verify(mPreference, never()).setOnAddClickListener(notNull());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addButton_noSubscriptionsMultiSimModeNoEuiccMgr_noAddClickListener() {
|
||||
when(mTelephonyManager.getMultiSimConfiguration()).thenReturn(DSDS);
|
||||
when(mEuiccManager.isEnabled()).thenReturn(false);
|
||||
mController.displayPreference(mPreferenceScreen);
|
||||
mController.onResume();
|
||||
verify(mPreference, never()).setOnAddClickListener(notNull());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addButton_noSubscriptionsMultiSimMode_hasAddClickListenerAndPrefDisabled() {
|
||||
when(mTelephonyManager.getMultiSimConfiguration()).thenReturn(DSDS);
|
||||
@@ -236,4 +268,73 @@ public class MobileNetworkSummaryControllerTest {
|
||||
verify(mPreference, never()).setOnAddClickListener(isNull());
|
||||
verify(mPreference).setOnAddClickListener(notNull());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addButton_oneSubscriptionAirplaneModeTurnedOn_addButtonGetsDisabled() {
|
||||
when(mTelephonyManager.getMultiSimConfiguration()).thenReturn(DSDS);
|
||||
final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
|
||||
SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(sub1));
|
||||
mController.displayPreference(mPreferenceScreen);
|
||||
mController.onResume();
|
||||
|
||||
Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 1);
|
||||
mController.onAirplaneModeChanged(true);
|
||||
|
||||
ArgumentCaptor<Boolean> captor = ArgumentCaptor.forClass(Boolean.class);
|
||||
verify(mPreference, atLeastOnce()).setAddWidgetEnabled(captor.capture());
|
||||
assertThat(captor.getValue()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onResume_oneSubscriptionAirplaneMode_isDisabled() {
|
||||
when(mTelephonyManager.getMultiSimConfiguration()).thenReturn(DSDS);
|
||||
Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 1);
|
||||
final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
|
||||
SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(sub1));
|
||||
mController.displayPreference(mPreferenceScreen);
|
||||
mController.onResume();
|
||||
|
||||
assertThat(mPreference.isEnabled()).isFalse();
|
||||
|
||||
ArgumentCaptor<Boolean> captor = ArgumentCaptor.forClass(Boolean.class);
|
||||
verify(mPreference, atLeastOnce()).setAddWidgetEnabled(captor.capture());
|
||||
assertThat(captor.getValue()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onAirplaneModeChanged_oneSubscriptionAirplaneModeGetsTurnedOn_isDisabled() {
|
||||
final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
|
||||
SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(sub1));
|
||||
mController.displayPreference(mPreferenceScreen);
|
||||
mController.onResume();
|
||||
|
||||
assertThat(mPreference.isEnabled()).isTrue();
|
||||
|
||||
Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 1);
|
||||
mController.onAirplaneModeChanged(true);
|
||||
|
||||
assertThat(mPreference.isEnabled()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onAirplaneModeChanged_oneSubscriptionAirplaneModeGetsTurnedOff_isEnabled() {
|
||||
when(mTelephonyManager.getMultiSimConfiguration()).thenReturn(DSDS);
|
||||
Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 1);
|
||||
final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
|
||||
SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(sub1));
|
||||
mController.displayPreference(mPreferenceScreen);
|
||||
mController.onResume();
|
||||
|
||||
assertThat(mPreference.isEnabled()).isFalse();
|
||||
|
||||
Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 0);
|
||||
mController.onAirplaneModeChanged(false);
|
||||
|
||||
assertThat(mPreference.isEnabled()).isTrue();
|
||||
|
||||
ArgumentCaptor<Boolean> captor = ArgumentCaptor.forClass(Boolean.class);
|
||||
verify(mPreference, atLeastOnce()).setAddWidgetEnabled(eq(false));
|
||||
verify(mPreference, atLeastOnce()).setAddWidgetEnabled(captor.capture());
|
||||
assertThat(captor.getValue()).isTrue();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public class SettingsSliceProviderTest {
|
||||
private static final String SUMMARY = "summary";
|
||||
private static final String SCREEN_TITLE = "screen title";
|
||||
private static final String FRAGMENT_NAME = "fragment name";
|
||||
private static final int ICON = R.drawable.ic_settings;
|
||||
private static final int ICON = R.drawable.ic_settings_accent;
|
||||
private static final Uri URI = Uri.parse("content://com.android.settings.slices/test");
|
||||
private static final String PREF_CONTROLLER = FakeToggleController.class.getName();
|
||||
|
||||
@@ -578,7 +578,7 @@ public class SettingsSliceProviderTest {
|
||||
values.put(SlicesDatabaseHelper.IndexColumns.TITLE, TITLE);
|
||||
values.put(SlicesDatabaseHelper.IndexColumns.SUMMARY, "s");
|
||||
values.put(SlicesDatabaseHelper.IndexColumns.SCREENTITLE, "s");
|
||||
values.put(SlicesDatabaseHelper.IndexColumns.ICON_RESOURCE, R.drawable.ic_settings);
|
||||
values.put(SlicesDatabaseHelper.IndexColumns.ICON_RESOURCE, R.drawable.ic_settings_accent);
|
||||
values.put(SlicesDatabaseHelper.IndexColumns.FRAGMENT, "test");
|
||||
values.put(SlicesDatabaseHelper.IndexColumns.CONTROLLER, PREF_CONTROLLER);
|
||||
values.put(SlicesDatabaseHelper.IndexColumns.PLATFORM_SLICE, isPlatformSlice);
|
||||
|
||||
@@ -63,7 +63,7 @@ public class SliceBuilderUtilsTest {
|
||||
private final String SCREEN_TITLE = "screen title";
|
||||
private final String KEYWORDS = "a, b, c";
|
||||
private final String FRAGMENT_NAME = "fragment name";
|
||||
private final int ICON = R.drawable.ic_settings;
|
||||
private final int ICON = R.drawable.ic_settings_accent;
|
||||
private final Uri URI = Uri.parse("content://com.android.settings.slices/test");
|
||||
private final Class TOGGLE_CONTROLLER = FakeToggleController.class;
|
||||
private final Class SLIDER_CONTROLLER = FakeSliderController.class;
|
||||
@@ -431,7 +431,7 @@ public class SliceBuilderUtilsTest {
|
||||
@Test
|
||||
public void buildIntentSlice_noIconPassed_returnsSliceWithIcon() {
|
||||
final int expectedIconResource = IconCompat.createWithResource(mContext,
|
||||
R.drawable.ic_settings).toIcon().getResId();
|
||||
R.drawable.ic_settings_accent).toIcon().getResId();
|
||||
final SliceData sliceData = getDummyData(CONTEXT_CONTROLLER, SliceData.SliceType.INTENT,
|
||||
0x0);
|
||||
|
||||
@@ -446,7 +446,7 @@ public class SliceBuilderUtilsTest {
|
||||
@Test
|
||||
public void buildDisabledDependentSlice_noIconPassed_returnsSliceWithIcon() {
|
||||
final int expectedIconResource = IconCompat.createWithResource(mContext,
|
||||
R.drawable.ic_settings).toIcon().getResId();
|
||||
R.drawable.ic_settings_accent).toIcon().getResId();
|
||||
final SliceData data = getDummyData(FakeUnavailablePreferenceController.class,
|
||||
SUMMARY, SliceData.SliceType.SWITCH, SCREEN_TITLE, 0 /* icon */,
|
||||
IS_DYNAMIC_SUMMARY_ALLOWED, null /* unavailableSliceSubtitle */);
|
||||
@@ -465,7 +465,7 @@ public class SliceBuilderUtilsTest {
|
||||
@Test
|
||||
public void buildToggleSlice_noIconPassed_returnsSliceWithIcon() {
|
||||
final int expectedIconResource = IconCompat.createWithResource(mContext,
|
||||
R.drawable.ic_settings).toIcon().getResId();
|
||||
R.drawable.ic_settings_accent).toIcon().getResId();
|
||||
final SliceData dummyData = getDummyData(TOGGLE_CONTROLLER, SliceData.SliceType.SWITCH,
|
||||
0x0);
|
||||
|
||||
@@ -480,7 +480,7 @@ public class SliceBuilderUtilsTest {
|
||||
@Test
|
||||
public void buildSliderSlice_noIconPassed_returnsSliceWithIcon() {
|
||||
final int expectedIconResource = IconCompat.createWithResource(mContext,
|
||||
R.drawable.ic_settings).toIcon().getResId();
|
||||
R.drawable.ic_settings_accent).toIcon().getResId();
|
||||
final SliceData data = getDummyData(SLIDER_CONTROLLER, SliceData.SliceType.SLIDER, 0x0);
|
||||
|
||||
final Slice slice = SliceBuilderUtils.buildSlice(mContext, data);
|
||||
@@ -493,7 +493,7 @@ public class SliceBuilderUtilsTest {
|
||||
|
||||
@Test
|
||||
public void getSafeIcon_replacesEmptyIconWithSettingsIcon() {
|
||||
final int settingsIcon = R.drawable.ic_settings;
|
||||
final int settingsIcon = R.drawable.ic_settings_accent;
|
||||
final int zeroIcon = 0x0;
|
||||
final SliceData data = getDummyData(TOGGLE_CONTROLLER, SliceData.SliceType.SWITCH,
|
||||
zeroIcon);
|
||||
@@ -507,7 +507,7 @@ public class SliceBuilderUtilsTest {
|
||||
|
||||
@Test
|
||||
public void getSafeIcon_invalidResource_shouldFallbackToSettingsIcon() {
|
||||
final int settingsIcon = R.drawable.ic_settings;
|
||||
final int settingsIcon = R.drawable.ic_settings_accent;
|
||||
final int badIcon = 0x12345678;
|
||||
final SliceData data = getDummyData(TOGGLE_CONTROLLER, SliceData.SliceType.SWITCH,
|
||||
badIcon);
|
||||
|
||||
@@ -43,6 +43,6 @@ public class ShadowTileUtils {
|
||||
@Implementation
|
||||
protected static Pair<String, Integer> getIconFromUri(Context context, String packageName,
|
||||
String uriString, Map<String, IContentProvider> providerMap) {
|
||||
return Pair.create(RuntimeEnvironment.application.getPackageName(), R.drawable.ic_settings);
|
||||
return Pair.create(RuntimeEnvironment.application.getPackageName(), R.drawable.ic_settings_accent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class AdaptiveHomepageIconTest {
|
||||
public void setBackgroundColor_externalTileWithBackgroundColorRawValue_shouldUpdateIcon() {
|
||||
final Tile tile = spy(new Tile(mActivityInfo, CategoryKey.CATEGORY_HOMEPAGE));
|
||||
mActivityInfo.metaData.putInt(META_DATA_PREFERENCE_ICON_BACKGROUND_ARGB, 0xff0000);
|
||||
doReturn(Icon.createWithResource(mContext, R.drawable.ic_settings))
|
||||
doReturn(Icon.createWithResource(mContext, R.drawable.ic_settings_accent))
|
||||
.when(tile).getIcon(mContext);
|
||||
final AdaptiveHomepageIcon icon =
|
||||
new AdaptiveHomepageIcon(mContext, new ColorDrawable(Color.BLACK));
|
||||
@@ -96,12 +96,26 @@ public class AdaptiveHomepageIconTest {
|
||||
assertThat(icon.mBackgroundColor).isEqualTo(0xff0000);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setBackgroundColor_tileWithoutBackgroundColor_shouldSetDefaultBackgroundColor() {
|
||||
final Tile tile = spy(new Tile(mActivityInfo, CategoryKey.CATEGORY_HOMEPAGE));
|
||||
doReturn(Icon.createWithResource(mContext, R.drawable.ic_settings))
|
||||
.when(tile).getIcon(mContext);
|
||||
final AdaptiveHomepageIcon icon =
|
||||
new AdaptiveHomepageIcon(mContext, new ColorDrawable(Color.BLACK));
|
||||
|
||||
icon.setBackgroundColor(mContext, tile);
|
||||
|
||||
assertThat(icon.mBackgroundColor).isEqualTo(
|
||||
mContext.getColor(R.color.homepage_generic_icon_background));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onBindTile_externalTileWithBackgroundColorHint_shouldUpdateIcon() {
|
||||
final Tile tile = spy(new Tile(mActivityInfo, CategoryKey.CATEGORY_HOMEPAGE));
|
||||
mActivityInfo.metaData.putInt(META_DATA_PREFERENCE_ICON_BACKGROUND_HINT,
|
||||
R.color.material_blue_500);
|
||||
doReturn(Icon.createWithResource(mContext, R.drawable.ic_settings))
|
||||
doReturn(Icon.createWithResource(mContext, R.drawable.ic_settings_accent))
|
||||
.when(tile).getIcon(mContext);
|
||||
|
||||
final AdaptiveHomepageIcon icon =
|
||||
|
||||
Reference in New Issue
Block a user