- refactor application setting to use paged list view
- refactor sound setting to use paged list view
- removed unused UI classes
- ui changes according to spec
Test: manually verified
Change-Id: Iace0f88ed627621682d0e6c0cb0c07badc466076
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 64b6b86..ad37334 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -61,6 +61,7 @@
<activity
android:name=".home.HomepageActivity"
android:label="@string/settings_label"
+ android:theme="@style/CarSettingTheme"
android:launchMode="singleTask"
android:exported="true">
<intent-filter>
diff --git a/res/layout/paged_list.xml b/res/anim/trans_fade_in.xml
similarity index 66%
rename from res/layout/paged_list.xml
rename to res/anim/trans_fade_in.xml
index 527c86f..86ea64c 100644
--- a/res/layout/paged_list.xml
+++ b/res/anim/trans_fade_in.xml
@@ -15,12 +15,10 @@
~ limitations under the License
-->
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent" >
- <com.android.car.view.PagedListView
- android:id="@+id/list"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
-</FrameLayout>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <alpha
+ android:fromAlpha="0.2"
+ android:toAlpha="1"
+ android:duration="@android:integer/config_mediumAnimTime" />
+</set>
diff --git a/res/layout/paged_list.xml b/res/anim/trans_fade_out.xml
similarity index 66%
copy from res/layout/paged_list.xml
copy to res/anim/trans_fade_out.xml
index 527c86f..aaa22d5 100644
--- a/res/layout/paged_list.xml
+++ b/res/anim/trans_fade_out.xml
@@ -15,12 +15,10 @@
~ limitations under the License
-->
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent" >
- <com.android.car.view.PagedListView
- android:id="@+id/list"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
-</FrameLayout>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <alpha
+ android:fromAlpha="1.0"
+ android:toAlpha="0.2"
+ android:duration="@android:integer/config_mediumAnimTime" />
+</set>
\ No newline at end of file
diff --git a/res/layout/paged_list.xml b/res/anim/trans_right_in.xml
similarity index 66%
copy from res/layout/paged_list.xml
copy to res/anim/trans_right_in.xml
index 527c86f..1a93266 100644
--- a/res/layout/paged_list.xml
+++ b/res/anim/trans_right_in.xml
@@ -15,12 +15,10 @@
~ limitations under the License
-->
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent" >
- <com.android.car.view.PagedListView
- android:id="@+id/list"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
-</FrameLayout>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <translate
+ android:fromXDelta="100%p"
+ android:toXDelta="0"
+ android:interpolator="@android:interpolator/linear_out_slow_in"
+ android:duration="@android:integer/config_mediumAnimTime" />
+</set>
\ No newline at end of file
diff --git a/res/layout/paged_list.xml b/res/anim/trans_right_out.xml
similarity index 66%
copy from res/layout/paged_list.xml
copy to res/anim/trans_right_out.xml
index 527c86f..9e1bc6e 100644
--- a/res/layout/paged_list.xml
+++ b/res/anim/trans_right_out.xml
@@ -15,12 +15,10 @@
~ limitations under the License
-->
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent" >
- <com.android.car.view.PagedListView
- android:id="@+id/list"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
-</FrameLayout>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <translate
+ android:fromXDelta="0"
+ android:toXDelta="100%p"
+ android:interpolator="@android:interpolator/linear_out_slow_in"
+ android:duration="@android:integer/config_mediumAnimTime" />
+</set>
\ No newline at end of file
diff --git a/res/drawable/ic_bt_imaging.xml b/res/drawable/ic_bt_imaging.xml
index 0f33c04..c65a7c2 100644
--- a/res/drawable/ic_bt_imaging.xml
+++ b/res/drawable/ic_bt_imaging.xml
@@ -18,7 +18,7 @@
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
- android:tint="?android:attr/colorAccent">
+ android:tint="@color/car_tint">
<path
android:fillColor="#FF000000"
android:pathData="M19,8L5,8c-1.66,0 -3,1.34 -3,3v6h4v4h12v-4h4v-6c0,-1.66 -1.34,-3
diff --git a/res/drawable/ic_bt_laptop.xml b/res/drawable/ic_bt_laptop.xml
index e7848cb..a9c70ff 100644
--- a/res/drawable/ic_bt_laptop.xml
+++ b/res/drawable/ic_bt_laptop.xml
@@ -18,7 +18,7 @@
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
- android:tint="?android:attr/colorControlNormal">
+ android:tint="@color/car_tint">
<path
android:fillColor="#FF000000"
android:pathData="M20,18c1.1,0 2,-0.9 2,-2V6c0,-1.1 -0.9,-2 -2,-2H4c-1.1,0
diff --git a/res/layout/paged_list.xml b/res/drawable/ic_chevron_right.xml
similarity index 62%
copy from res/layout/paged_list.xml
copy to res/drawable/ic_chevron_right.xml
index 527c86f..a2e3745 100644
--- a/res/layout/paged_list.xml
+++ b/res/drawable/ic_chevron_right.xml
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2017 The Android Open Source Project
~
@@ -15,12 +14,13 @@
~ limitations under the License
-->
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent" >
- <com.android.car.view.PagedListView
- android:id="@+id/list"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
-</FrameLayout>
+<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="@color/car_tint">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M10,6L8.59,7.41 13.17,12l-4.58,4.59L10,18l6,-6z"/>
+</vector>
diff --git a/res/drawable/ic_close.xml b/res/drawable/ic_close.xml
deleted file mode 100644
index e013a3b..0000000
--- a/res/drawable/ic_close.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
- Copyright (C) 2017 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0">
- <path
- android:fillColor="#FF000000"
- android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
-</vector>
diff --git a/res/drawable/ic_settings_about.xml b/res/drawable/ic_settings_about.xml
index ae3d78c..57631a5 100644
--- a/res/drawable/ic_settings_about.xml
+++ b/res/drawable/ic_settings_about.xml
@@ -18,7 +18,7 @@
android:height="24.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
- android:tint="?android:attr/colorControlNormal">
+ android:tint="@color/car_tint">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M11.0,17.0l2.0,0.0l0.0,-6.0l-2.0,0.0l0.0,6.0zm1.0,-15.0C6.48,2.0 2.0,6.48 2.0,12.0s4.48,10.0 10.0,10.0 10.0,-4.48 10.0,-10.0S17.52,2.0 12.0,2.0zm0.0,18.0c-4.41,0.0 -8.0,-3.59 -8.0,-8.0s3.59,-8.0 8.0,-8.0 8.0,3.59 8.0,8.0 -3.59,8.0 -8.0,8.0zM11.0,9.0l2.0,0.0L13.0,7.0l-2.0,0.0l0.0,2.0z"/>
diff --git a/res/drawable/ic_settings_applications.xml b/res/drawable/ic_settings_applications.xml
index 7fdca29..f9c306b 100644
--- a/res/drawable/ic_settings_applications.xml
+++ b/res/drawable/ic_settings_applications.xml
@@ -18,7 +18,7 @@
android:height="24.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
- android:tint="?android:attr/colorControlNormal">
+ android:tint="@color/car_tint">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M5.0,16.0c0.0,3.87 3.13,7.0 7.0,7.0s7.0,-3.13 7.0,-7.0l0.0,-4.0L5.0,12.0l0.0,4.0zM16.12,4.37l2.1,-2.1 -0.82,-0.83 -2.3,2.31C14.16,3.28 13.12,3.0 12.0,3.0s-2.1,0.28 -3.0,0.75L6.6,1.44l-0.8,0.83 2.1,2.1C6.14,5.64 5.0,7.68 5.0,10.0l0.0,1.0l14.0,0.0l0.0,-1.0c0.0,-2.32 -1.14,-4.36 -2.88,-5.63zM9.0,9.0c-0.55,0.0 -1.0,-0.45 -1.0,-1.0s0.45,-1.0 1.0,-1.0 1.0,0.45 1.0,1.0 -0.45,1.0 -1.0,1.0zm6.0,0.0c-0.55,0.0 -1.0,-0.45 -1.0,-1.0s0.45,-1.0 1.0,-1.0 1.0,0.45 1.0,1.0 -0.45,1.0 -1.0,1.0z"/>
diff --git a/res/drawable/ic_settings_bluetooth.xml b/res/drawable/ic_settings_bluetooth.xml
index de39143..6b8623d 100644
--- a/res/drawable/ic_settings_bluetooth.xml
+++ b/res/drawable/ic_settings_bluetooth.xml
@@ -18,7 +18,7 @@
android:height="24.0dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0"
- android:tint="?android:attr/colorControlNormal">
+ android:tint="@color/car_tint">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M35.41,15.41L24.0,4.0l-2.0,0.0l0.0,15.17L12.83,10.0 10.0,12.83 21.17,24.0 10.0,35.17 12.83,38.0 22.0,28.83L22.0,44.0l2.0,0.0l11.41,-11.41L26.83,24.0l8.58,-8.59zM26.0,11.66l3.76,3.76L26.0,19.17l0.0,-7.51zm3.76,20.93L26.0,36.34l0.0,-7.52l3.76,3.77z"/>
diff --git a/res/drawable/ic_settings_bluetooth_disabled.xml b/res/drawable/ic_settings_bluetooth_disabled.xml
index 20ec624..0fbe506 100644
--- a/res/drawable/ic_settings_bluetooth_disabled.xml
+++ b/res/drawable/ic_settings_bluetooth_disabled.xml
@@ -19,7 +19,7 @@
android:height="24.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
- android:tint="?android:attr/colorControlNormal">
+ android:tint="@color/car_tint">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M13,5.83l1.88,1.88 -1.6,1.6 1.41,1.41 3.02,-3.02L12,2h-1v5.03l2,2v-3.2zM5.41,4L4,5.41 10.59,12 5,17.59 6.41,19 11,14.41V22h1l4.29,-4.29 2.3,2.29L20,18.59 5.41,4zM13,18.17v-3.76l1.88,1.88L13,18.17z"/>
diff --git a/res/drawable/ic_settings_date_time.xml b/res/drawable/ic_settings_date_time.xml
index c03d76b..2202f8d 100644
--- a/res/drawable/ic_settings_date_time.xml
+++ b/res/drawable/ic_settings_date_time.xml
@@ -18,7 +18,7 @@
android:height="24.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
- android:tint="?android:attr/colorControlNormal">
+ android:tint="@color/car_tint">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M11.99,2.0C6.47,2.0 2.0,6.48 2.0,12.0s4.47,10.0 9.99,10.0C17.52,22.0 22.0,17.52 22.0,12.0S17.52,2.0 11.99,2.0zM12.0,20.0c-4.42,0.0 -8.0,-3.58 -8.0,-8.0s3.58,-8.0 8.0,-8.0 8.0,3.58 8.0,8.0 -3.58,8.0 -8.0,8.0z"/>
diff --git a/res/drawable/ic_settings_display.xml b/res/drawable/ic_settings_display.xml
index 171c5e3..f5f766e 100644
--- a/res/drawable/ic_settings_display.xml
+++ b/res/drawable/ic_settings_display.xml
@@ -18,7 +18,7 @@
android:height="24.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
- android:tint="?android:attr/colorControlNormal">
+ android:tint="@color/car_tint">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M20.0,15.31L23.31,12.0 20.0,8.69L20.0,4.0l-4.69,0.0L12.0,0.69 8.69,4.0L4.0,4.0l0.0,4.69L0.69,12.0 4.0,15.31L4.0,20.0l4.69,0.0L12.0,23.31 15.31,20.0L20.0,20.0l0.0,-4.69zM12.0,18.0L12.0,6.0c3.31,0.0 6.0,2.69 6.0,6.0s-2.69,6.0 -6.0,6.0z"/>
diff --git a/res/drawable/ic_settings_gear.xml b/res/drawable/ic_settings_gear.xml
index 5e6f758..1a7db1e 100644
--- a/res/drawable/ic_settings_gear.xml
+++ b/res/drawable/ic_settings_gear.xml
@@ -13,7 +13,12 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<vector android:height="24dp" android:viewportHeight="48.0"
- android:viewportWidth="48.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+<vector
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:height="24dp"
+ android:width="24dp"
+ android:viewportHeight="48.0"
+ android:viewportWidth="48.0"
+ android:tint="@color/car_tint" >
<path android:fillColor="#000000" android:pathData="M38.86,25.95c0.08,-0.64 0.14,-1.29 0.14,-1.95s-0.06,-1.31 -0.14,-1.95l4.23,-3.31c0.38,-0.3 0.49,-0.84 0.24,-1.28l-4,-6.93c-0.25,-0.43 -0.77,-0.61 -1.22,-0.43l-4.98,2.01c-1.03,-0.79 -2.16,-1.46 -3.38,-1.97L29,4.84c-0.09,-0.47 -0.5,-0.84 -1,-0.84h-8c-0.5,0 -0.91,0.37 -0.99,0.84l-0.75,5.3c-1.22,0.51 -2.35,1.17 -3.38,1.97L9.9,10.1c-0.45,-0.17 -0.97,0 -1.22,0.43l-4,6.93c-0.25,0.43 -0.14,0.97 0.24,1.28l4.22,3.31C9.06,22.69 9,23.34 9,24s0.06,1.31 0.14,1.95l-4.22,3.31c-0.38,0.3 -0.49,0.84 -0.24,1.28l4,6.93c0.25,0.43 0.77,0.61 1.22,0.43l4.98,-2.01c1.03,0.79 2.16,1.46 3.38,1.97l0.75,5.3c0.08,0.47 0.49,0.84 0.99,0.84h8c0.5,0 0.91,-0.37 0.99,-0.84l0.75,-5.3c1.22,-0.51 2.35,-1.17 3.38,-1.97l4.98,2.01c0.45,0.17 0.97,0 1.22,-0.43l4,-6.93c0.25,-0.43 0.14,-0.97 -0.24,-1.28l-4.22,-3.31zM24,31c-3.87,0 -7,-3.13 -7,-7s3.13,-7 7,-7 7,3.13 7,7 -3.13,7 -7,7z"/>
</vector>
diff --git a/res/drawable/ic_settings_sound.xml b/res/drawable/ic_settings_sound.xml
index 18c6aa1..ca9a84d 100644
--- a/res/drawable/ic_settings_sound.xml
+++ b/res/drawable/ic_settings_sound.xml
@@ -18,7 +18,7 @@
android:height="24.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
- android:tint="?android:attr/colorControlNormal">
+ android:tint="@color/car_tint">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M3.0,9.0l0.0,6.0l4.0,0.0l5.0,5.0L12.0,4.0L7.0,9.0L3.0,9.0zm13.5,3.0c0.0,-1.77 -1.02,-3.29 -2.5,-4.03l0.0,8.05c1.48,-0.73 2.5,-2.25 2.5,-4.02zM14.0,3.23l0.0,2.06c2.8,0.86 5.0,3.54 5.0,6.71s-2.11,5.85 -5.0,6.71l0.0,2.06c4.01,-0.91 7.0,-4.49 7.0,-8.77s-2.99,-7.86 -7.0,-8.77z"/>
diff --git a/res/drawable/ic_settings_wifi.xml b/res/drawable/ic_settings_wifi.xml
index fe08eae..eed2eff 100644
--- a/res/drawable/ic_settings_wifi.xml
+++ b/res/drawable/ic_settings_wifi.xml
@@ -18,7 +18,7 @@
android:height="24.0dp"
android:viewportWidth="18.0"
android:viewportHeight="18.0"
- android:tint="?android:attr/colorControlNormal">
+ android:tint="@color/car_tint">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M9.01,15.99l8.8,-10.96C17.47,4.77 14.08,2.0 9.0,2.0S0.53,4.7 0.19,5.03l8.8,10.96l0.02,0.0z"/>
diff --git a/res/drawable/ic_settings_wifi_disabled.xml b/res/drawable/ic_settings_wifi_disabled.xml
index 30550ea..1b2ac4e 100644
--- a/res/drawable/ic_settings_wifi_disabled.xml
+++ b/res/drawable/ic_settings_wifi_disabled.xml
@@ -19,7 +19,7 @@
android:height="24.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
- android:tint="?android:attr/colorControlNormal">
+ android:tint="@color/car_tint">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M23.64,7c-0.45,-0.34 -4.93,-4 -11.64,-4 -1.5,0 -2.89,0.19 -4.15,0.48L18.18,13.8 23.64,7zM17.04,15.22L3.27,1.44 2,2.72l2.05,2.06C1.91,5.76 0.59,6.82 0.36,7l11.63,14.49 0.01,0.01 0.01,-0.01 3.9,-4.86 3.32,3.32 1.27,-1.27 -3.46,-3.46z"/>
diff --git a/res/drawable/ic_system_update.xml b/res/drawable/ic_system_update.xml
index ef8f991..ead6ff0 100644
--- a/res/drawable/ic_system_update.xml
+++ b/res/drawable/ic_system_update.xml
@@ -18,7 +18,7 @@
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
- android:tint="?android:attr/colorControlNormal">
+ android:tint="@color/car_tint">
<path
android:pathData="M17,1.01L7,1c-1.1,0 -2,0.9 -2,2v18c0,1.1 0.9,2 2,2h10c1.1,0 2,-0.9 2,-2L19,3c0,-1.1 -0.9,-1.99 -2,-1.99zM17,19L7,19L7,5h10v14zM16,13h-3L13,8h-2v5L8,13l4,4 4,-4z"
android:fillColor="#FFFFFFFF"/>
diff --git a/res/drawable/ic_wifi_signal_0.xml b/res/drawable/ic_wifi_signal_0.xml
index cf06b4f..9f37b04 100644
--- a/res/drawable/ic_wifi_signal_0.xml
+++ b/res/drawable/ic_wifi_signal_0.xml
@@ -21,6 +21,6 @@
android:viewportHeight="24">
<path
android:fillAlpha="0.3"
- android:fillColor="?attr/wifi_signal_color"
+ android:fillColor="?attr/WifiSignalColor"
android:pathData="M13.0,22.0L25.6,6.5C25.1,6.1 20.3,2.1 13.0,2.1S0.9,6.1 0.4,6.5L13.0,22.0L13.0,22.0L13.0,22.0L13.0,22.0L13.0,22.0z"/>
</vector>
\ No newline at end of file
diff --git a/res/drawable/ic_wifi_signal_1.xml b/res/drawable/ic_wifi_signal_1.xml
index 149d1ac..4b9139e 100644
--- a/res/drawable/ic_wifi_signal_1.xml
+++ b/res/drawable/ic_wifi_signal_1.xml
@@ -21,9 +21,9 @@
android:viewportHeight="24">
<path
android:fillAlpha="0.3"
- android:fillColor="?attr/wifi_signal_color"
+ android:fillColor="?attr/WifiSignalColor"
android:pathData="M13.1,22.0L25.6,6.5C25.1,6.1 20.3,2.1 13.0,2.1S0.9,6.1 0.5,6.5L13.1,22.0L13.1,22.0L13.1,22.0L13.1,22.0L13.1,22.0z"/>
<path
- android:fillColor="?attr/wifi_signal_color"
+ android:fillColor="?attr/WifiSignalColor"
android:pathData="M13.1,22.0l5.5,-6.8c-0.2,-0.2 -2.3,-1.9 -5.5,-1.9s-5.3,1.8 -5.5,1.9L13.1,22.0L13.1,22.0L13.1,22.0L13.1,22.0L13.1,22.0z"/>
</vector>
diff --git a/res/drawable/ic_wifi_signal_2.xml b/res/drawable/ic_wifi_signal_2.xml
index 0fcd805..66e1d7c 100644
--- a/res/drawable/ic_wifi_signal_2.xml
+++ b/res/drawable/ic_wifi_signal_2.xml
@@ -21,9 +21,9 @@
android:viewportHeight="24">
<path
android:fillAlpha="0.3"
- android:fillColor="?attr/wifi_signal_color"
+ android:fillColor="?attr/WifiSignalColor"
android:pathData="M13.0,22.0L25.6,6.5C25.1,6.1 20.3,2.1 13.0,2.1S0.9,6.1 0.4,6.5L13.0,22.0L13.0,22.0L13.0,22.0L13.0,22.0L13.0,22.0z"/>
<path
- android:fillColor="?attr/wifi_signal_color"
+ android:fillColor="?attr/WifiSignalColor"
android:pathData="M13.0,22.0l7.6,-9.4C20.3,12.4 17.4,10.0 13.0,10.0s-7.3,2.4 -7.6,2.7L13.0,22.0L13.0,22.0L13.0,22.0L13.0,22.0L13.0,22.0z"/>
</vector>
diff --git a/res/drawable/ic_wifi_signal_3.xml b/res/drawable/ic_wifi_signal_3.xml
index 7db5db0..f37fa59 100644
--- a/res/drawable/ic_wifi_signal_3.xml
+++ b/res/drawable/ic_wifi_signal_3.xml
@@ -21,9 +21,9 @@
android:viewportHeight="24">
<path
android:fillAlpha="0.3"
- android:fillColor="?attr/wifi_signal_color"
+ android:fillColor="?attr/WifiSignalColor"
android:pathData="M13.0,22.0L25.6,6.5C25.1,6.1 20.3,2.1 13.0,2.1S0.9,6.1 0.4,6.5L13.0,22.0L13.0,22.0L13.0,22.0L13.0,22.0L13.0,22.0z"/>
<path
- android:fillColor="?attr/wifi_signal_color"
+ android:fillColor="?attr/WifiSignalColor"
android:pathData="M13.0,22.0l9.2,-11.4c-0.4,-0.3 -3.9,-3.2 -9.2,-3.2s-8.9,3.0 -9.2,3.2L13.0,22.0L13.0,22.0L13.0,22.0L13.0,22.0L13.0,22.0z"/>
</vector>
diff --git a/res/drawable/ic_wifi_signal_4.xml b/res/drawable/ic_wifi_signal_4.xml
index a490be3..1cc86b6 100644
--- a/res/drawable/ic_wifi_signal_4.xml
+++ b/res/drawable/ic_wifi_signal_4.xml
@@ -20,6 +20,6 @@
android:viewportWidth="26"
android:viewportHeight="24">
<path
- android:fillColor="?attr/wifi_signal_color"
+ android:fillColor="?attr/WifiSignalColor"
android:pathData="M13.0,22.0L25.6,6.5C25.1,6.1 20.3,2.1 13.0,2.1S0.9,6.1 0.4,6.5L13.0,22.0L13.0,22.0L13.0,22.0L13.0,22.0L13.0,22.0z"/>
</vector>
diff --git a/res/drawable/ic_wifi_signal_lock.xml b/res/drawable/ic_wifi_signal_lock.xml
index 5449e76..cf420d4 100644
--- a/res/drawable/ic_wifi_signal_lock.xml
+++ b/res/drawable/ic_wifi_signal_lock.xml
@@ -23,7 +23,7 @@
android:translateX="52.0"
android:translateY="42.0">
<path
- android:fillColor="?attr/wifi_signal_color"
+ android:fillColor="?attr/WifiSignalColor"
android:pathData="M18.0,8.0l-1.0,0.0L17.0,6.0c0.0,-2.76 -2.24,-5.0 -5.0,-5.0S7.0,3.24 7.0,6.0l0.0,2.0L6.0,8.0c-1.1,0.0 -2.0,0.9 -2.0,2.0l0.0,10.0c0.0,1.0 0.9,2.0 2.0,2.0l12.0,0.0c1.1,0.0 2.0,-0.9 2.0,-2.0L20.0,10.0c0.0,-1.1 -0.9,-2.0 -2.0,-2.0zm-6.0,9.0c-1.1,0.0 -2.0,-0.9 -2.0,-2.0s0.9,-2.0 2.0,-2.0 2.0,0.9 2.0,2.0 -0.9,2.0 -2.0,2.0zm3.1,-9.0L8.9,8.0L8.9,6.0c0.0,-1.71 1.39,-3.1 3.1,-3.1 1.71,0.0 3.1,1.39 3.1,3.1l0.0,2.0z"/>
</group>
</vector>
\ No newline at end of file
diff --git a/res/layout/action_bar_with_button.xml b/res/layout/action_bar_with_button.xml
index 175b688..d716608 100644
--- a/res/layout/action_bar_with_button.xml
+++ b/res/layout/action_bar_with_button.xml
@@ -18,9 +18,8 @@
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="end|center_vertical"
- android:minHeight="@dimen/lens_header_height">
+ android:layout_height="@dimen/action_bar_height"
+ android:gravity="end|center_vertical" >
<TextView
android:id="@+id/title"
@@ -53,6 +52,6 @@
android:layout_gravity="center_vertical"
android:background="@null"
android:textSize="@dimen/medium_text_size"
- android:layout_marginEnd="@dimen/stream_content_keyline_1" />
+ android:layout_marginEnd="@dimen/action_bar_end_widget_margin_end" />
</LinearLayout>
</RelativeLayout>
diff --git a/res/layout/action_bar_with_toggle.xml b/res/layout/action_bar_with_toggle.xml
index ea98dd1..d69a49c 100644
--- a/res/layout/action_bar_with_toggle.xml
+++ b/res/layout/action_bar_with_toggle.xml
@@ -17,26 +17,26 @@
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="end|center_vertical"
- android:minHeight="@dimen/lens_header_height">
+ android:layout_height="@dimen/action_bar_height"
+ android:gravity="center_vertical" >
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/CarTitle"
- android:gravity="center_vertical"
+ android:layout_gravity="center_vertical"
+ android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:maxLines="1"/>
<Switch
android:id="@+id/toggle_switch"
- android:layout_width="@dimen/stream_button_icon_size"
- android:layout_height="@dimen/stream_button_icon_size"
- android:layout_gravity="center_vertical"
android:background="@null"
+ android:layout_width="@dimen/icon_size"
+ android:layout_height="@dimen/icon_size"
+ android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
- android:layout_marginEnd="@dimen/stream_content_keyline_1" />
+ android:layout_marginEnd="@dimen/action_bar_end_widget_margin_end" />
</RelativeLayout>
diff --git a/res/layout/application_details.xml b/res/layout/application_details.xml
index 0ac28b8..ec0ee4c 100644
--- a/res/layout/application_details.xml
+++ b/res/layout/application_details.xml
@@ -19,17 +19,19 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_marginStart="@dimen/stream_content_keyline_1"
- android:layout_marginEnd="@dimen/stream_content_keyline_1"
+ android:layout_marginStart="@dimen/stream_card_keyline_1"
+ android:layout_marginEnd="@dimen/stream_card_keyline_1"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/icon"
- android:layout_width="@dimen/dashboard_tile_image_size"
- android:layout_height="@dimen/dashboard_tile_image_size"
+ android:layout_width="@dimen/icon_size"
+ android:layout_height="@dimen/icon_size"
android:layout_centerVertical="true"
+ android:layout_marginStart="@dimen/stream_card_keyline_1"
+ android:layout_alignParentStart="true"
style="@style/SettingIcon"/>
<LinearLayout
android:layout_width="match_parent"
diff --git a/res/layout/bluetooth_list.xml b/res/layout/bluetooth_list.xml
index 8d389ed..1f04c86 100644
--- a/res/layout/bluetooth_list.xml
+++ b/res/layout/bluetooth_list.xml
@@ -33,7 +33,8 @@
<com.android.car.view.PagedListView
android:id="@+id/list"
android:layout_width="match_parent"
- android:layout_height="match_parent" />
+ android:layout_height="match_parent"
+ android:layout_marginEnd="@dimen/side_margin" />
<TextView
android:id="@+id/bt_message"
android:layout_gravity="center"
diff --git a/res/layout/date_time_toggle_line_item.xml b/res/layout/date_time_toggle_line_item.xml
deleted file mode 100644
index 424c329..0000000
--- a/res/layout/date_time_toggle_line_item.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2017 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
-
-<RelativeLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingTop="@dimen/tile_top_bottom_padding"
- android:paddingBottom="@dimen/tile_top_bottom_padding" >
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:layout_alignParentStart="true">
- <TextView
- android:id="@+id/title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="@dimen/medium_text_size"/>
- <TextView
- android:id="@+id/desc"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="@dimen/small_text_size"/>
- </LinearLayout>
- <Switch
- android:id="@+id/toggle_switch"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerVertical="true"
- android:layout_alignParentEnd="true"/>
-</RelativeLayout>
\ No newline at end of file
diff --git a/res/layout/icon_text_line_item.xml b/res/layout/icon_text_line_item.xml
index 0b83caf..31d606e 100644
--- a/res/layout/icon_text_line_item.xml
+++ b/res/layout/icon_text_line_item.xml
@@ -17,32 +17,38 @@
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
+ style="@style/LineItem" >
<ImageView
android:id="@+id/icon"
- android:layout_width="@dimen/tile_icon_size"
- android:layout_height="@dimen/tile_icon_size"
- android:layout_centerVertical="true"
+ android:layout_marginStart="@dimen/stream_card_keyline_1"
android:layout_alignParentStart="true"
- android:layout_marginEnd="@dimen/car_list_item_icon_right_margin" />
+ style="@style/SettingIcon" />
<LinearLayout
- android:layout_width="match_parent"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
- android:layout_toEndOf="@+id/icon"
- android:paddingTop="@dimen/tile_top_bottom_padding"
- android:paddingBottom="@dimen/tile_top_bottom_padding" >
+ android:layout_centerVertical="true"
+ android:gravity="center_vertical"
+ android:layout_alignParentStart="true"
+ android:layout_marginStart="@dimen/stream_card_keyline_3" >
<TextView
android:id="@+id/title"
- android:layout_width="match_parent"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textSize="@dimen/medium_text_size" />
+ style="@style/CarBody1" />
<TextView
android:id="@+id/desc"
- android:layout_width="match_parent"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textSize="@dimen/small_text_size"
+ style="@style/CarBody2"
+ android:layout_marginTop="@dimen/double_line_text_margin"
android:visibility="gone" />
</LinearLayout>
+ <ImageView
+ android:id="@+id/right_chevron"
+ style="@style/SettingIcon"
+ android:layout_marginEnd="@dimen/stream_card_keyline_1"
+ android:layout_alignParentEnd="true"
+ android:src="@drawable/ic_chevron_right"
+ android:visibility="gone"/>
</RelativeLayout>
diff --git a/res/layout/tile_item.xml b/res/layout/icon_toggle_line_item.xml
similarity index 61%
rename from res/layout/tile_item.xml
rename to res/layout/icon_toggle_line_item.xml
index adbfddc..44b01c4 100644
--- a/res/layout/tile_item.xml
+++ b/res/layout/icon_toggle_line_item.xml
@@ -17,30 +17,26 @@
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dashboard_tile"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center_vertical"
- android:minHeight="@dimen/lens_header_height">
+ style="@style/LineItem" >
<ImageView
android:id="@+id/icon"
- android:layout_width="@dimen/car_list_item_small_icon_size"
- android:layout_height="@dimen/car_list_item_small_icon_size"
- android:scaleType="fitCenter"
+ android:layout_marginStart="@dimen/stream_card_keyline_1"
android:layout_alignParentStart="true"
- android:layout_marginStart="@dimen/car_list_item_icon_right_margin"
- android:layout_marginEnd="@dimen/car_list_item_icon_right_margin" />
+ style="@style/SettingIcon" />
<LinearLayout
- android:layout_width="match_parent"
- android:layout_height="@dimen/drawer_1_line_item_height"
- android:layout_toEndOf="@id/icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentStart="true"
+ android:layout_centerVertical="true"
+ android:layout_marginStart="@dimen/stream_card_keyline_3"
android:orientation="vertical">
<TextView android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textAppearance="@style/TextAppearance.TileTitle"
+ style="@style/CarBody1"
android:ellipsize="marquee"
android:maxLines="1"
android:gravity="center_vertical"
@@ -49,18 +45,17 @@
<TextView android:id="@+id/desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textAppearance="@style/TextAppearance.Small"
- android:textColor="?android:attr/textColorSecondary"
+ android:layout_marginTop="@dimen/double_line_text_margin"
+ style="@style/CarBody2"
android:gravity="center_vertical"
android:maxLines="1"
android:ellipsize="end" />
</LinearLayout>
<Switch
android:id="@+id/toggle_switch"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerVertical="true"
+ style="@style/SettingIcon"
+ android:layout_marginEnd="@dimen/stream_card_keyline_1"
android:layout_alignParentEnd="true"
- android:paddingEnd="@dimen/car_list_item_right_icon_margin"
+ android:switchMinWidth="@dimen/icon_size"
android:visibility="gone"/>
</RelativeLayout>
diff --git a/res/layout/list_item.xml b/res/layout/icon_widget_line_item.xml
similarity index 68%
rename from res/layout/list_item.xml
rename to res/layout/icon_widget_line_item.xml
index c705cb5..e386bc4 100644
--- a/res/layout/list_item.xml
+++ b/res/layout/icon_widget_line_item.xml
@@ -16,38 +16,37 @@
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
+ style="@style/LineItem" >
<ImageView
android:id="@+id/icon"
+ android:layout_marginStart="@dimen/stream_card_keyline_1"
+ android:layout_alignParentStart="true"
style="@style/SettingIcon"/>
<LinearLayout
- android:layout_width="match_parent"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
- android:layout_toEndOf="@+id/icon"
- android:paddingTop="@dimen/tile_top_bottom_padding"
- android:paddingBottom="@dimen/tile_top_bottom_padding" >
+ android:layout_alignParentStart="true"
+ android:layout_centerVertical="true"
+ android:layout_marginStart="@dimen/stream_card_keyline_3" >
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:textSize="@dimen/medium_text_size" />
+ style="@style/CarBody1" />
<TextView
android:id="@+id/desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:textSize="@dimen/small_text_size"
- android:visibility="gone"/>
+ style="@style/CarBody2"
+ android:visibility="gone" />
</LinearLayout>
<ImageButton
android:id="@+id/action"
- android:layout_width="@dimen/car_list_item_right_icon_size"
- android:layout_height="@dimen/car_list_item_right_icon_size"
+ style="@style/SettingIcon"
+ android:layout_marginEnd="@dimen/stream_card_keyline_1"
android:layout_alignParentEnd="true"
- android:layout_centerVertical="true"
android:src="@drawable/ic_settings_gear"
android:background="@null"
- android:visibility="gone"
- android:layout_marginEnd="@dimen/car_list_item_right_icon_margin" />
+ android:visibility="gone" />
</RelativeLayout>
diff --git a/res/layout/list.xml b/res/layout/list.xml
index 4bce086..b35ee36 100644
--- a/res/layout/list.xml
+++ b/res/layout/list.xml
@@ -18,5 +18,6 @@
<com.android.car.view.PagedListView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/list"
+ android:layout_marginEnd="@dimen/side_margin"
android:layout_width="match_parent"
android:layout_height="match_parent" />
diff --git a/res/layout/seekbar_line_item.xml b/res/layout/seekbar_line_item.xml
index 8ce6f41..f374cc6 100644
--- a/res/layout/seekbar_line_item.xml
+++ b/res/layout/seekbar_line_item.xml
@@ -17,14 +17,13 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ style="@style/LineItem"
android:orientation="vertical" >
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:textSize="@dimen/medium_text_size" />
+ style="@style/CarBody2" />
<SeekBar
android:id="@+id/seekbar"
android:layout_width="match_parent"
diff --git a/res/layout/text_line_item.xml b/res/layout/text_line_item.xml
index ca99995..4c71da1 100644
--- a/res/layout/text_line_item.xml
+++ b/res/layout/text_line_item.xml
@@ -17,17 +17,18 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ style="@style/LineItem"
+ android:layout_marginStart="@dimen/stream_card_keyline_1"
android:orientation="vertical" >
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textSize="@dimen/medium_text_size"/>
+ style="@style/CarBody1" />
<TextView
android:id="@+id/desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textSize="@dimen/small_text_size"/>
+ android:layout_marginTop="@dimen/double_line_text_margin"
+ style="@style/CarBody2" />
</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/time_zone_list_item.xml b/res/layout/time_zone_list_item.xml
deleted file mode 100644
index 9912be1..0000000
--- a/res/layout/time_zone_list_item.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2017 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
-
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:layout_toEndOf="@+id/icon"
- android:paddingTop="@dimen/tile_top_bottom_padding"
- android:paddingBottom="@dimen/tile_top_bottom_padding" >
- <TextView
- android:id="@+id/title"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textSize="@dimen/medium_text_size" />
- <TextView
- android:id="@+id/desc"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textSize="@dimen/small_text_size"
- android:visibility="gone"/>
-</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/toggle_line_item.xml b/res/layout/toggle_line_item.xml
index 2d29a2f..e454e0c 100644
--- a/res/layout/toggle_line_item.xml
+++ b/res/layout/toggle_line_item.xml
@@ -20,28 +20,30 @@
that widget -->
<com.android.car.settings.common.InterceptTouchRelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
+ style="@style/LineItem" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
+ android:layout_centerVertical="true"
+ android:layout_marginStart="@dimen/stream_card_keyline_1"
android:layout_alignParentStart="true">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textSize="@dimen/medium_text_size"/>
+ style="@style/CarBody1" />
<TextView
android:id="@+id/desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textSize="@dimen/small_text_size"/>
+ android:layout_marginTop="@dimen/double_line_text_margin"
+ style="@style/CarBody2" />
</LinearLayout>
<Switch
android:id="@+id/toggle_switch"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerVertical="true"
- android:layout_alignParentEnd="true" />
+ style="@style/SettingIcon"
+ android:layout_alignParentEnd="true"
+ android:layout_marginEnd="@dimen/stream_card_keyline_1"
+ android:switchMinWidth="@dimen/icon_size"/>
</com.android.car.settings.common.InterceptTouchRelativeLayout>
\ No newline at end of file
diff --git a/res/layout/volume_controller_view.xml b/res/layout/volume_controller_view.xml
index 3b9b5d8..c384f95 100644
--- a/res/layout/volume_controller_view.xml
+++ b/res/layout/volume_controller_view.xml
@@ -21,8 +21,8 @@
android:layout_height="wrap_content">
<ImageView
android:id="@+id/icon"
- android:layout_width="@dimen/car_list_item_small_icon_size"
- android:layout_height="@dimen/car_list_item_small_icon_size"
+ android:layout_width="@dimen/icon_size"
+ android:layout_height="@dimen/icon_size"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/car_list_item_icon_right_margin"
diff --git a/res/layout/wifi_list.xml b/res/layout/wifi_list.xml
index 7421ceb..6ed1d9e 100644
--- a/res/layout/wifi_list.xml
+++ b/res/layout/wifi_list.xml
@@ -42,7 +42,7 @@
android:gravity="center_vertical"
android:text="@string/wifi_setup_add_network"
android:textSize="@dimen/medium_text_size"
- android:layout_marginStart="@dimen/stream_content_keyline_1" />
+ android:layout_marginStart="@dimen/stream_card_keyline_1" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/car_divider_height"
@@ -50,7 +50,8 @@
<com.android.car.view.PagedListView
android:id="@+id/list"
android:layout_width="match_parent"
- android:layout_height="match_parent" />
+ android:layout_height="match_parent"
+ android:layout_marginEnd="@dimen/side_margin" />
</LinearLayout>
<TextView
android:id="@+id/message"
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 99649d9..a6fda80 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -16,18 +16,21 @@
<resources>
- <!-- Dashboard image tile size -->
- <dimen name="dashboard_tile_image_size">54dp</dimen>
- <!-- Dashboard tile image margin start / end -->
+ <dimen name="icon_size">56dp</dimen>
+ <dimen name="action_bar_height">112dp</dimen>
+ <dimen name="line_item_height">128dp</dimen>
+ <dimen name="side_margin">148dp</dimen>
+ <dimen name="double_line_text_margin">10dp</dimen>
+ <dimen name="action_bar_end_widget_margin_end">46dp</dimen>
+
<dimen name="small_text_size">14sp</dimen>
<dimen name="medium_text_size">18sp</dimen>
- <dimen name="tile_icon_size">44dp</dimen>
<dimen name="drawer_1_line_item_height">72dp</dimen>
<dimen name="drawer_2_line_item_height">96dp</dimen>
<dimen name="tile_top_bottom_padding">15dp</dimen>
- <dimen name="button_margin">15dp</dimen>
+ <dimen name="button_margin">64dp</dimen>
</resources>
\ No newline at end of file
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 34221e9..d63b730 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -15,12 +15,21 @@
-->
<resources>
- <attr name="wifi_signal_color" format="reference" />
+ <style name="LineItem">
+ <item name="android:layout_width">match_parent</item>
+ <item name="android:layout_height">@dimen/line_item_height</item>
+ <item name="android:layout_gravity">center_vertical</item>
+ <item name="android:gravity">center_vertical</item>
+ </style>
+
+ <attr name="WifiSignalColor" format="reference" />
<style name="TextAppearance.Medium" parent="@android:style/TextAppearance.Material.Medium" >
<item name="android:textSize">@dimen/medium_text_size</item>
+ <item name="android:textColor">?android:attr/textColorPrimary</item>
</style>
<style name="TextAppearance.Small" parent="@android:style/TextAppearance.Material.Small" >
<item name="android:textSize">@dimen/small_text_size</item>
+ <item name="android:textColor">?android:attr/textColorSecondary</item>
</style>
<style name="TextAppearance.Switch" parent="@android:style/TextAppearance.Material.Title" />
@@ -30,6 +39,7 @@
<style name="TextAppearance.TileTitle" parent="@android:style/TextAppearance.Material.Subhead" >
<item name="android:textSize">@dimen/medium_text_size</item>
+ <item name="android:textColor">?android:attr/textColorPrimary</item>
</style>
<style name="TextAppearance.TileSubTitle" parent="@android:style/TextAppearance.Material.Body1" />
<style name="TextAppearance.RecentsTitle" parent="TextAppearance.CategoryTitle" />
@@ -39,8 +49,11 @@
<style name="CarSettingTheme" parent="Theme.SettingsBase">
<item name="wifi_signal">@drawable/wifi_signal</item>
- <item name="wifi_signal_color">?android:attr/colorAccent</item>
+ <item name="WifiSignalColor">?android:attr/colorAccent</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
+ <item name="android:actionBarSize">@dimen/action_bar_height</item>
+ <item name="actionBarSize">@dimen/action_bar_height</item>
+ <item name="android:background">@color/car_card</item>
</style>
<style name="TrimmedHorizontalProgressBar" parent="android:Widget.Material.ProgressBar.Horizontal">
@@ -49,11 +62,10 @@
<item name="android:maxHeight">3dp</item>
</style>
<style name="SettingIcon">
- <item name="android:layout_width">@dimen/tile_icon_size</item>
- <item name="android:layout_height">@dimen/tile_icon_size</item>
- <item name="android:layout_alignParentStart">true</item>
+ <item name="android:layout_width">@dimen/icon_size</item>
+ <item name="android:layout_height">@dimen/icon_size</item>
<item name="android:layout_centerVertical">true</item>
- <item name="android:layout_marginStart">@dimen/stream_content_keyline_1</item>
- <item name="android:layout_marginEnd">@dimen/stream_content_keyline_1</item>
+ <item name="android:gravity">center_vertical</item>
+ <item name="android:scaleType">fitCenter</item>
</style>
</resources>
diff --git a/src/com/android/car/settings/applications/ApplicationDetailActivity.java b/src/com/android/car/settings/applications/ApplicationDetailActivity.java
index ac071f0..a5bc882 100644
--- a/src/com/android/car/settings/applications/ApplicationDetailActivity.java
+++ b/src/com/android/car/settings/applications/ApplicationDetailActivity.java
@@ -38,6 +38,7 @@
import android.widget.ImageView;
import android.widget.TextView;
+import com.android.car.settings.common.AnimationUtil;
import com.android.car.settings.common.CarSettingActivity;
import com.android.car.settings.R;
@@ -55,6 +56,9 @@
*/
public class ApplicationDetailActivity extends CarSettingActivity {
private static final String TAG = "AppDetailActivity";
+ /**
+ * Key for ResolvedInfo in bundle passed in.
+ */
public static final String APPLICATION_INFO_KEY = "APPLICATION_INFO_KEY";
private ResolveInfo mResolveInfo;
@@ -246,17 +250,15 @@
}
};
- private OnClickListener mPermissionClickedListener = new OnClickListener() {
- @Override
- public void onClick(View v) {
- // start new activity to manage app permissions
- Intent intent = new Intent(Intent.ACTION_MANAGE_APP_PERMISSIONS);
- intent.putExtra(Intent.EXTRA_PACKAGE_NAME, mResolveInfo.activityInfo.packageName);
- try {
- startActivity(intent);
- } catch (ActivityNotFoundException e) {
- Log.w(TAG, "No app can handle android.intent.action.MANAGE_APP_PERMISSIONS");
- }
+ private OnClickListener mPermissionClickedListener = (v) -> {
+ // start new activity to manage app permissions
+ Intent intent = new Intent(Intent.ACTION_MANAGE_APP_PERMISSIONS);
+ intent.putExtra(Intent.EXTRA_PACKAGE_NAME, mResolveInfo.activityInfo.packageName);
+ try {
+ startActivity(intent, AnimationUtil.slideInFromRightOption(
+ ApplicationDetailActivity.this).toBundle());
+ } catch (ActivityNotFoundException e) {
+ Log.w(TAG, "No app can handle android.intent.action.MANAGE_APP_PERMISSIONS");
}
};
}
diff --git a/src/com/android/car/settings/applications/ApplicationLineItem.java b/src/com/android/car/settings/applications/ApplicationLineItem.java
new file mode 100644
index 0000000..48625c6
--- /dev/null
+++ b/src/com/android/car/settings/applications/ApplicationLineItem.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package com.android.car.settings.applications;
+
+import android.annotation.NonNull;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.widget.ImageView;
+
+import com.android.car.settings.common.AnimationUtil;
+import com.android.car.settings.common.IconTextLineItem;
+
+/**
+ * Represents an application in application settings page.
+ */
+public class ApplicationLineItem extends IconTextLineItem {
+ private final ResolveInfo mResolveInfo;
+ private final Context mContext;
+ private final PackageManager mPm;
+
+ public ApplicationLineItem(
+ @NonNull Context context, PackageManager pm, ResolveInfo resolveInfo) {
+ super(resolveInfo.loadLabel(pm));
+ mContext = context;
+ mPm = pm;
+ mResolveInfo = resolveInfo;
+ }
+
+
+ @Override
+ public void onClick() {
+ Intent intent = new Intent(mContext, ApplicationDetailActivity.class);
+ intent.putExtra(
+ ApplicationDetailActivity.APPLICATION_INFO_KEY, mResolveInfo);
+ mContext.startActivity(
+ intent, AnimationUtil.slideInFromRightOption(mContext).toBundle());
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return true;
+ }
+
+ @Override
+ public CharSequence getDesc() {
+ return null;
+ }
+
+ @Override
+ public void setIcon(ImageView iconView) {
+ iconView.setImageDrawable(mResolveInfo.loadIcon(mPm));
+ }
+}
diff --git a/src/com/android/car/settings/applications/ApplicationListAdapter.java b/src/com/android/car/settings/applications/ApplicationListAdapter.java
index 0076d4c..625cf73 100644
--- a/src/com/android/car/settings/applications/ApplicationListAdapter.java
+++ b/src/com/android/car/settings/applications/ApplicationListAdapter.java
@@ -27,8 +27,11 @@
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
+
import com.android.car.settings.R;
import com.android.car.view.PagedListView;
+import com.android.car.settings.common.AnimationUtil;
+
import java.util.Collections;
import java.util.List;
@@ -85,7 +88,8 @@
Intent intent = new Intent(mContext, ApplicationDetailActivity.class);
intent.putExtra(
ApplicationDetailActivity.APPLICATION_INFO_KEY, resolveInfo);
- mContext.startActivity(intent);
+ mContext.startActivity(
+ intent, AnimationUtil.slideInFromRightOption(mContext).toBundle());
}
};
@@ -93,7 +97,7 @@
public ApplicationListAdapter.ViewHolder onCreateViewHolder(ViewGroup parent,
int viewType) {
View v = LayoutInflater.from(parent.getContext())
- .inflate(R.layout.list_item, parent, false);
+ .inflate(R.layout.icon_widget_line_item, parent, false);
return new ViewHolder(v);
}
diff --git a/src/com/android/car/settings/applications/ApplicationSettingsActivity.java b/src/com/android/car/settings/applications/ApplicationSettingsActivity.java
index bd6ca2a..ed0b19a 100644
--- a/src/com/android/car/settings/applications/ApplicationSettingsActivity.java
+++ b/src/com/android/car/settings/applications/ApplicationSettingsActivity.java
@@ -15,32 +15,39 @@
*/
package com.android.car.settings.applications;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
import android.os.Bundle;
-import android.support.v7.widget.RecyclerView;
-import com.android.car.settings.common.CarSettingActivity;
-import com.android.car.settings.R;
-import com.android.car.settings.common.NoDividerItemDecoration;
-import com.android.car.view.PagedListView;
+
+import com.android.car.settings.common.ListSettingsActivity;
+import com.android.car.settings.common.TypedPagedListAdapter;
+
+import java.util.ArrayList;
+import java.util.List;
/**
* Lists all installed applications and their summary.
*/
-public class ApplicationSettingsActivity extends CarSettingActivity {
- private static final String TAG = "ApplicationSettingsActivity";
-
- private PagedListView mListView;
- private ApplicationListAdapter mAdapter;
+public class ApplicationSettingsActivity extends ListSettingsActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.paged_list);
-
- mListView = (PagedListView) findViewById(R.id.list);
- mListView.setDefaultItemDecoration(new NoDividerItemDecoration(this));
- mListView.setDarkMode();
- mAdapter = new ApplicationListAdapter(this /* context */, getPackageManager());
- mListView.setAdapter(mAdapter);
}
+ @Override
+ public ArrayList<TypedPagedListAdapter.LineItem> getLineItems() {
+ PackageManager pm = getPackageManager();
+ Intent intent= new Intent(Intent.ACTION_MAIN);
+ intent.addCategory(Intent.CATEGORY_LAUNCHER);
+ List<ResolveInfo> resolveInfos = pm.queryIntentActivities(intent,
+ PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS
+ | PackageManager.MATCH_DISABLED_COMPONENTS);
+ ArrayList<TypedPagedListAdapter.LineItem> items = new ArrayList<>();
+ for (ResolveInfo resolveInfo : resolveInfos) {
+ items.add(new ApplicationLineItem(this, pm, resolveInfo));
+ }
+ return items;
+ }
}
diff --git a/src/com/android/car/settings/bluetooth/BluetoothDeviceListAdapter.java b/src/com/android/car/settings/bluetooth/BluetoothDeviceListAdapter.java
index 2449746..c472c85 100644
--- a/src/com/android/car/settings/bluetooth/BluetoothDeviceListAdapter.java
+++ b/src/com/android/car/settings/bluetooth/BluetoothDeviceListAdapter.java
@@ -39,6 +39,7 @@
import com.android.car.settings.R;
import com.android.car.view.PagedListView;
+import com.android.car.settings.common.AnimationUtil;
import com.android.settingslib.bluetooth.BluetoothCallback;
import com.android.settingslib.bluetooth.BluetoothDeviceFilter;
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
@@ -160,7 +161,7 @@
((TextView) v).setText(R.string.bluetooth_preference_found_devices);
break;
default:
- v = layoutInflater.inflate(R.layout.list_item, parent, false);
+ v = layoutInflater.inflate(R.layout.icon_widget_line_item, parent, false);
}
return new ViewHolder(v);
}
@@ -202,7 +203,8 @@
Intent intent = new Intent(mContext, BluetoothDetailActivity.class);
intent.putExtra(
BluetoothDetailActivity.BT_DEVICE_KEY, bluetoothDevice.getDevice());
- mContext.startActivity(intent);
+ mContext.startActivity(
+ intent, AnimationUtil.slideInFromRightOption(mContext).toBundle());
});
} else {
holder.mActionButton.setVisibility(View.GONE);
diff --git a/src/com/android/car/settings/bluetooth/BluetoothSettingsActivity.java b/src/com/android/car/settings/bluetooth/BluetoothSettingsActivity.java
index ed09b4d..15ca09e 100644
--- a/src/com/android/car/settings/bluetooth/BluetoothSettingsActivity.java
+++ b/src/com/android/car/settings/bluetooth/BluetoothSettingsActivity.java
@@ -16,8 +16,6 @@
package com.android.car.settings.bluetooth;
import android.bluetooth.BluetoothAdapter;
-import android.content.Context;
-import android.graphics.Canvas;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
@@ -81,7 +79,7 @@
}
mLocalAdapter = mLocalManager.getBluetoothAdapter();
- mDeviceListView.setDefaultItemDecoration(new ItemDecoration(this));
+ mDeviceListView.setDefaultItemDecoration(new PagedListView.Decoration(this));
// Set this to light mode, since the scroll bar buttons always appear
// on top of a dark scrim.
mDeviceListView.setDarkMode();
@@ -188,17 +186,4 @@
mProgressBar.setVisibility(visible ? View.VISIBLE : View.GONE);
}
}
-
- /**
- * Default {@link com.android.car.view.PagedListView.Decoration} for the {@link PagedListView}
- * that removes the dividing lines between items.
- */
- private static class ItemDecoration extends PagedListView.Decoration {
- public ItemDecoration(Context context) {
- super(context);
- }
-
- @Override
- public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) {}
- }
}
diff --git a/src/com/android/car/settings/common/AnimationUtil.java b/src/com/android/car/settings/common/AnimationUtil.java
new file mode 100644
index 0000000..4966c67
--- /dev/null
+++ b/src/com/android/car/settings/common/AnimationUtil.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package com.android.car.settings.common;
+
+import android.app.ActivityOptions;
+import android.content.Context;
+
+import com.android.car.settings.R;
+
+/**
+ * Contains util function for animations.
+ */
+public class AnimationUtil {
+ private AnimationUtil() {
+ }
+
+ /**
+ * Animation that slide the new activity in from right.
+ */
+ public static ActivityOptions slideInFromRightOption(Context context) {
+ return ActivityOptions.makeCustomAnimation(
+ context, R.anim.trans_right_in , R.anim.trans_fade_out);
+ }
+}
diff --git a/src/com/android/car/settings/common/CarSettingActivity.java b/src/com/android/car/settings/common/CarSettingActivity.java
index b680e43..642ea30 100644
--- a/src/com/android/car/settings/common/CarSettingActivity.java
+++ b/src/com/android/car/settings/common/CarSettingActivity.java
@@ -17,9 +17,9 @@
import android.app.Activity;
import android.os.Bundle;
-import android.support.v4.app.NavUtils;
import android.view.MenuItem;
+import com.android.car.settings.R;
/**
* Base activity class for car settings, provides a action bar with a back button that goes to
@@ -47,6 +47,7 @@
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
onBackPressed();
+ overridePendingTransition(R.anim.trans_fade_in, R.anim.trans_right_out);
return true;
}
return super.onOptionsItemSelected(item);
diff --git a/src/com/android/car/settings/common/IconTextLineItem.java b/src/com/android/car/settings/common/IconTextLineItem.java
index 62e8650..2c0f7c3 100644
--- a/src/com/android/car/settings/common/IconTextLineItem.java
+++ b/src/com/android/car/settings/common/IconTextLineItem.java
@@ -16,7 +16,6 @@
package com.android.car.settings.common;
-import android.annotation.DrawableRes;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.LayoutInflater;
@@ -33,14 +32,11 @@
public abstract class IconTextLineItem
extends TypedPagedListAdapter.LineItem<IconTextLineItem.ViewHolder> {
private final CharSequence mTitle;
- @DrawableRes
- private final int mIconRes;
private View.OnClickListener mOnClickListener = (v) -> onClick();
- public IconTextLineItem(CharSequence title, @DrawableRes int iconRes) {
+ public IconTextLineItem(CharSequence title) {
mTitle = title;
- mIconRes = iconRes;
}
@Override
@@ -51,7 +47,7 @@
@Override
public void bindViewHolder(ViewHolder viewHolder) {
viewHolder.titleView.setText(mTitle);
- viewHolder.iconView.setImageResource(mIconRes);
+ setIcon(viewHolder.iconView);
CharSequence desc = getDesc();
if (TextUtils.isEmpty(desc)) {
viewHolder.descView.setVisibility(View.GONE);
@@ -60,19 +56,27 @@
viewHolder.descView.setText(desc);
}
viewHolder.itemView.setOnClickListener(mOnClickListener);
- viewHolder.itemView.setEnabled(isEnabled());
+ if (isEnabled()) {
+ viewHolder.itemView.setEnabled(true);
+ viewHolder.rightArrow.setVisibility(View.VISIBLE);
+ } else {
+ viewHolder.itemView.setEnabled(false);
+ viewHolder.rightArrow.setVisibility(View.GONE);
+ }
}
static class ViewHolder extends RecyclerView.ViewHolder {
final TextView titleView;
final TextView descView;
final ImageView iconView;
+ final ImageView rightArrow;
public ViewHolder(View view) {
super(view);
iconView = (ImageView) view.findViewById(R.id.icon);
titleView = (TextView) view.findViewById(R.id.title);
descView = (TextView) view.findViewById(R.id.desc);
+ rightArrow = (ImageView) view.findViewById(R.id.right_chevron);
}
}
@@ -82,6 +86,8 @@
return new ViewHolder(v);
}
+ public abstract void setIcon(ImageView iconView);
+
public abstract void onClick();
public abstract boolean isEnabled();
diff --git a/src/com/android/car/settings/common/IconToggleLineItem.java b/src/com/android/car/settings/common/IconToggleLineItem.java
index ba56ab9..83b82cd 100644
--- a/src/com/android/car/settings/common/IconToggleLineItem.java
+++ b/src/com/android/car/settings/common/IconToggleLineItem.java
@@ -33,7 +33,7 @@
*/
public abstract class IconToggleLineItem
extends TypedPagedListAdapter.LineItem<IconToggleLineItem.ViewHolder> {
- private final Context mContext;
+ protected final Context mContext;
private final CharSequence mTitle;
protected IconUpdateListener mIconUpdateListener;
@@ -88,7 +88,7 @@
public static RecyclerView.ViewHolder createViewHolder(ViewGroup parent) {
View v = LayoutInflater.from(parent.getContext())
- .inflate(R.layout.tile_item, parent, false);
+ .inflate(R.layout.icon_toggle_line_item, parent, false);
return new ViewHolder(v);
}
diff --git a/src/com/android/car/settings/common/ListSettingsActivity.java b/src/com/android/car/settings/common/ListSettingsActivity.java
index f9c5745..9088c3a 100644
--- a/src/com/android/car/settings/common/ListSettingsActivity.java
+++ b/src/com/android/car/settings/common/ListSettingsActivity.java
@@ -34,10 +34,10 @@
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.paged_list);
+ setContentView(R.layout.list);
mListView = (PagedListView) findViewById(R.id.list);
- mListView.setDefaultItemDecoration(new NoDividerItemDecoration(this));
+ mListView.setDefaultItemDecoration(getDecoration());
mListView.setDarkMode();
mPagedListAdapter = new TypedPagedListAdapter(this /* context */, getLineItems());
mListView.setAdapter(mPagedListAdapter);
@@ -47,4 +47,11 @@
* Gets a List of LineItems to show up in this activity.
*/
public abstract ArrayList<TypedPagedListAdapter.LineItem> getLineItems();
+
+ /**
+ * Gets decoration for the list view.
+ */
+ protected PagedListView.Decoration getDecoration() {
+ return new PagedListView.Decoration(this);
+ }
}
diff --git a/src/com/android/car/settings/common/SeekbarLineItem.java b/src/com/android/car/settings/common/SeekbarLineItem.java
index 294a248..1140f02 100644
--- a/src/com/android/car/settings/common/SeekbarLineItem.java
+++ b/src/com/android/car/settings/common/SeekbarLineItem.java
@@ -64,7 +64,7 @@
public void bindViewHolder(ViewHolder viewHolder) {
viewHolder.titleView.setText(mTitle);
viewHolder.seekBar.setMax(getMaxSeekbarValue());
- viewHolder.seekBar.setProgress(getInitialSeekbarValue());
+ viewHolder.seekBar.setProgress(getSeekbarValue());
viewHolder.seekBar.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
}
@@ -91,7 +91,7 @@
return null;
}
- public abstract int getInitialSeekbarValue();
+ public abstract int getSeekbarValue();
public abstract int getMaxSeekbarValue();
diff --git a/src/com/android/car/settings/common/SimpleIconLineItem.java b/src/com/android/car/settings/common/SimpleIconLineItem.java
index 9830f2e..967464e 100644
--- a/src/com/android/car/settings/common/SimpleIconLineItem.java
+++ b/src/com/android/car/settings/common/SimpleIconLineItem.java
@@ -16,6 +16,7 @@
package com.android.car.settings.common;
+import android.app.ActivityOptions;
import android.content.Context;
import android.content.Intent;
@@ -25,6 +26,7 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.ImageView;
import com.android.car.settings.R;
@@ -35,6 +37,7 @@
private final CharSequence mDesc;
private final Context mContext;
private final Class mActivityClass;
+ private final @DrawableRes int mIconRes;
public SimpleIconLineItem(
@StringRes int title,
@@ -42,21 +45,22 @@
Context context,
CharSequence desc,
Class activityClass) {
- super(context.getText(title), iconRes);
+ super(context.getText(title));
mDesc = desc;
mContext = context;
mActivityClass = activityClass;
+ mIconRes = iconRes;
}
@Override
- public int getType() {
- return SIMPLE_ICON_TEXT_TYPE;
+ public void setIcon(ImageView iconView) {
+ iconView.setImageResource(mIconRes);
}
@Override
public void onClick() {
Intent intent = new Intent(mContext, mActivityClass);
- mContext.startActivity(intent);
+ mContext.startActivity(intent, AnimationUtil.slideInFromRightOption(mContext).toBundle());
}
@Override
@@ -68,10 +72,4 @@
public CharSequence getDesc() {
return mDesc;
}
-
- public static RecyclerView.ViewHolder createViewHolder(ViewGroup parent) {
- View v = LayoutInflater.from(parent.getContext())
- .inflate(R.layout.tile_item, parent, false);
- return new ViewHolder(v);
- }
}
diff --git a/src/com/android/car/settings/common/TypedPagedListAdapter.java b/src/com/android/car/settings/common/TypedPagedListAdapter.java
index a12afc4..69188aa 100644
--- a/src/com/android/car/settings/common/TypedPagedListAdapter.java
+++ b/src/com/android/car/settings/common/TypedPagedListAdapter.java
@@ -40,9 +40,9 @@
private static final String TAG = "TypedPagedListAdapter";
private final Context mContext;
- private final ArrayList<LineItem> mContentList;
+ private final ArrayList<? extends LineItem> mContentList;
- public TypedPagedListAdapter(@NonNull Context context, ArrayList<LineItem> contentList) {
+ public TypedPagedListAdapter(@NonNull Context context, ArrayList<? extends LineItem> contentList) {
mContext = context;
mContentList = contentList;
}
@@ -57,8 +57,7 @@
TOGGLE_TYPE,
ICON_TEXT_TYPE,
SEEKBAR_TYPE,
- ICON_TOGGLE_TYPE,
- SIMPLE_ICON_TEXT_TYPE})
+ ICON_TOGGLE_TYPE})
public @interface LineItemType {}
// with one title and one description
@@ -76,9 +75,6 @@
// with one icon, title, description and a toggle.
static final int ICON_TOGGLE_TYPE = 5;
- // similar to ICON_TEXT_TYPE, but with a different layout.
- static final int SIMPLE_ICON_TEXT_TYPE = 6;
-
@LineItemType
abstract int getType();
@@ -100,8 +96,6 @@
return SeekbarLineItem.createViewHolder(parent);
case LineItem.ICON_TOGGLE_TYPE:
return IconToggleLineItem.createViewHolder(parent);
- case LineItem.SIMPLE_ICON_TEXT_TYPE:
- return SimpleIconLineItem.createViewHolder(parent);
default:
throw new IllegalStateException("ViewType not supported: " + viewType);
}
diff --git a/src/com/android/car/settings/datetime/SetDateLineItem.java b/src/com/android/car/settings/datetime/SetDateLineItem.java
index fe86955..2f77044 100644
--- a/src/com/android/car/settings/datetime/SetDateLineItem.java
+++ b/src/com/android/car/settings/datetime/SetDateLineItem.java
@@ -22,6 +22,7 @@
import android.text.format.DateFormat;
import com.android.car.settings.R;
+import com.android.car.settings.common.AnimationUtil;
import com.android.car.settings.common.TextLineItem;
import com.android.settingslib.datetime.ZoneGetter;
@@ -53,6 +54,6 @@
@Override
public void onClick() {
Intent intent = new Intent(mContext /* context */, DatePickerActivity.class);
- mContext.startActivity(intent);
+ mContext.startActivity(intent, AnimationUtil.slideInFromRightOption(mContext).toBundle());
}
}
diff --git a/src/com/android/car/settings/datetime/SetTimeLineItem.java b/src/com/android/car/settings/datetime/SetTimeLineItem.java
index 958f526..25b3944 100644
--- a/src/com/android/car/settings/datetime/SetTimeLineItem.java
+++ b/src/com/android/car/settings/datetime/SetTimeLineItem.java
@@ -22,6 +22,7 @@
import android.text.format.DateFormat;
import com.android.car.settings.R;
+import com.android.car.settings.common.AnimationUtil;
import com.android.car.settings.common.TextLineItem;
import com.android.settingslib.datetime.ZoneGetter;
@@ -53,6 +54,6 @@
@Override
public void onClick() {
Intent intent = new Intent(mContext, TimePickerActivity.class);
- mContext.startActivity(intent);
+ mContext.startActivity(intent, AnimationUtil.slideInFromRightOption(mContext).toBundle());
}
}
diff --git a/src/com/android/car/settings/datetime/SetTimeZoneLineItem.java b/src/com/android/car/settings/datetime/SetTimeZoneLineItem.java
index 789f5d9..c67b2a6 100644
--- a/src/com/android/car/settings/datetime/SetTimeZoneLineItem.java
+++ b/src/com/android/car/settings/datetime/SetTimeZoneLineItem.java
@@ -21,6 +21,7 @@
import android.provider.Settings;
import com.android.car.settings.R;
+import com.android.car.settings.common.AnimationUtil;
import com.android.car.settings.common.TextLineItem;
import com.android.settingslib.datetime.ZoneGetter;
@@ -53,6 +54,6 @@
@Override
public void onClick() {
Intent intent = new Intent(mContext, TimeZonePickerActivity.class);
- mContext.startActivity(intent);
+ mContext.startActivity(intent, AnimationUtil.slideInFromRightOption(mContext).toBundle());
}
}
diff --git a/src/com/android/car/settings/datetime/TimeZoneListAdapter.java b/src/com/android/car/settings/datetime/TimeZoneListAdapter.java
index 80eb3f3..db3b009 100644
--- a/src/com/android/car/settings/datetime/TimeZoneListAdapter.java
+++ b/src/com/android/car/settings/datetime/TimeZoneListAdapter.java
@@ -91,7 +91,7 @@
public TimeZoneListAdapter.ViewHolder onCreateViewHolder(ViewGroup parent,
int viewType) {
View v = LayoutInflater.from(parent.getContext())
- .inflate(R.layout.time_zone_list_item, parent, false);
+ .inflate(R.layout.text_line_item, parent, false);
return new ViewHolder(v);
}
diff --git a/src/com/android/car/settings/datetime/TimeZonePickerActivity.java b/src/com/android/car/settings/datetime/TimeZonePickerActivity.java
index b97bca2..e94b200 100644
--- a/src/com/android/car/settings/datetime/TimeZonePickerActivity.java
+++ b/src/com/android/car/settings/datetime/TimeZonePickerActivity.java
@@ -22,7 +22,6 @@
import com.android.car.settings.common.CarSettingActivity;
import com.android.car.settings.R;
import com.android.car.view.PagedListView;
-import com.android.car.settings.common.NoDividerItemDecoration;
/**
* Lists all time zone and its offset from GMT.
@@ -37,7 +36,7 @@
setContentView(R.layout.list);
PagedListView listView = (PagedListView) findViewById(android.R.id.list);
- listView.setDefaultItemDecoration(new NoDividerItemDecoration(this /* context */));
+ listView.setDefaultItemDecoration(new PagedListView.Decoration(this /* context */));
listView.setDarkMode();
TimeZoneListAdapter adapter = new TimeZoneListAdapter(
this /* context */, this /* TimeZoneChangeListener */);
diff --git a/src/com/android/car/settings/display/BrightnessLineItem.java b/src/com/android/car/settings/display/BrightnessLineItem.java
index c6ee785..27cf350 100644
--- a/src/com/android/car/settings/display/BrightnessLineItem.java
+++ b/src/com/android/car/settings/display/BrightnessLineItem.java
@@ -40,7 +40,7 @@
}
@Override
- public int getInitialSeekbarValue() {
+ public int getSeekbarValue() {
int currentBrightness = 0;
try {
currentBrightness = Settings.System.getInt(mContext.getContentResolver(),
diff --git a/src/com/android/car/settings/home/BluetoothLineItem.java b/src/com/android/car/settings/home/BluetoothLineItem.java
index 9de21b9..d5026f4 100644
--- a/src/com/android/car/settings/home/BluetoothLineItem.java
+++ b/src/com/android/car/settings/home/BluetoothLineItem.java
@@ -24,6 +24,7 @@
import com.android.car.settings.R;
import com.android.car.settings.bluetooth.BluetoothSettingsActivity;
+import com.android.car.settings.common.AnimationUtil;
import com.android.car.settings.common.IconToggleLineItem;
@@ -31,14 +32,13 @@
* Represents the Bluetooth line item on settings home page.
*/
public class BluetoothLineItem extends IconToggleLineItem {
- private final Context mContext;
private BluetoothAdapter mBluetoothAdapter;
public BluetoothLineItem(Context context) {
super(context.getText(R.string.bluetooth_settings), context);
- mContext = context;
- mBluetoothAdapter = ((BluetoothManager) mContext.getSystemService(Context.BLUETOOTH_SERVICE))
- .getAdapter();
+ mBluetoothAdapter =
+ ((BluetoothManager) mContext.getSystemService(Context.BLUETOOTH_SERVICE))
+ .getAdapter();
}
@Override
@@ -53,7 +53,7 @@
@Override
public void onClicked() {
Intent intent = new Intent(mContext, BluetoothSettingsActivity.class);
- mContext.startActivity(intent);
+ mContext.startActivity(intent, AnimationUtil.slideInFromRightOption(mContext).toBundle());
}
@Override
diff --git a/src/com/android/car/settings/home/HomepageActivity.java b/src/com/android/car/settings/home/HomepageActivity.java
index ce59b73..7891c9a 100644
--- a/src/com/android/car/settings/home/HomepageActivity.java
+++ b/src/com/android/car/settings/home/HomepageActivity.java
@@ -110,7 +110,7 @@
R.drawable.ic_settings_display,
this,
null,
- DatetimeSettingsActivity.class));
+ DisplaySettingsActivity.class));
lineItems.add(new SimpleIconLineItem(
R.string.sound_settings,
R.drawable.ic_settings_sound,
@@ -126,11 +126,11 @@
null,
ApplicationSettingsActivity.class));
lineItems.add(new SimpleIconLineItem(
- R.string.display_settings,
- R.drawable.ic_settings_display,
+ R.string.date_and_time_settings_title,
+ R.drawable.ic_settings_date_time,
this,
null,
- DisplaySettingsActivity.class));
+ DatetimeSettingsActivity.class));
lineItems.add(new SimpleIconLineItem(
R.string.system_setting_title,
R.drawable.ic_settings_about,
diff --git a/src/com/android/car/settings/home/WifiLineItem.java b/src/com/android/car/settings/home/WifiLineItem.java
index 39c2616..b6a1c82 100644
--- a/src/com/android/car/settings/home/WifiLineItem.java
+++ b/src/com/android/car/settings/home/WifiLineItem.java
@@ -23,6 +23,7 @@
import android.net.wifi.WifiManager;
import com.android.car.settings.R;
+import com.android.car.settings.common.AnimationUtil;
import com.android.car.settings.common.IconToggleLineItem;
import com.android.car.settings.wifi.CarWifiManager;
import com.android.car.settings.wifi.WifiSettingsActivity;
@@ -49,7 +50,7 @@
@Override
public void onClicked() {
Intent intent = new Intent(mContext, WifiSettingsActivity.class);
- mContext.startActivity(intent);
+ mContext.startActivity(intent, AnimationUtil.slideInFromRightOption(mContext).toBundle());
}
@Override
diff --git a/src/com/android/car/settings/sound/SoundSettingsActivity.java b/src/com/android/car/settings/sound/SoundSettingsActivity.java
index 07c9d97..37551bd 100644
--- a/src/com/android/car/settings/sound/SoundSettingsActivity.java
+++ b/src/com/android/car/settings/sound/SoundSettingsActivity.java
@@ -16,15 +16,23 @@
package com.android.car.settings.sound;
import android.car.Car;
+import android.car.CarNotConnectedException;
+import android.car.media.CarAudioManager;
import android.content.ComponentName;
import android.content.ServiceConnection;
import android.media.AudioManager;
+import android.media.IVolumeController;
import android.os.Bundle;
import android.os.IBinder;
-import android.view.View;
+import android.os.RemoteException;
+import android.util.Log;
import com.android.car.settings.common.CarSettingActivity;
+import com.android.car.settings.common.TypedPagedListAdapter;
import com.android.car.settings.R;
+import com.android.car.view.PagedListView;
+
+import java.util.ArrayList;
/**
* Activity hosts sound related settings.
@@ -32,51 +40,59 @@
public class SoundSettingsActivity extends CarSettingActivity {
private static final String TAG = "SoundSettingsActivity";
private Car mCar;
+ private CarAudioManager mCarAudioManager;
+ private PagedListView mListView;
+ private TypedPagedListAdapter mPagedListAdapter;
- private VolumeControllerPresenter mMediaVolumeControllerPresenter;
- private VolumeControllerPresenter mRingVolumeControllerPresenter;
+ private final ArrayList<VolumeLineItem> mVolumeLineItems = new ArrayList<>();
+ private final SoundSettingsActivity.VolumnCallback
+ mVolumeCallback = new SoundSettingsActivity.VolumnCallback();
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.volume_list);
-
- View mediaVolumeControllerView = findViewById(
- R.id.media_volume);
- View ringVolumeControllerView = findViewById(
- R.id.ring_volume);
- mMediaVolumeControllerPresenter = new VolumeControllerPresenter(
- this /* context*/,
- mediaVolumeControllerView,
- AudioManager.STREAM_MUSIC,
- null /* Uri sampleUri */,
- R.string.media_volume_title,
- com.android.internal.R.drawable.ic_audio_media);
- mRingVolumeControllerPresenter = new VolumeControllerPresenter(
- this /* context*/,
- ringVolumeControllerView,
- AudioManager.STREAM_RING,
- null /* Uri sampleUri */,
- R.string.ring_volume_title,
- com.android.internal.R.drawable.ic_audio_ring_notif);
- mCar = Car.createCar(this /* context */, mServiceConnection);
- }
-
- ServiceConnection mServiceConnection = new ServiceConnection() {
+ private final ServiceConnection mServiceConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
- mMediaVolumeControllerPresenter.onServiceConnected(mCar);
- mRingVolumeControllerPresenter.onServiceConnected(mCar);
+ try {
+ mCarAudioManager = (CarAudioManager) mCar.getCarManager(Car.AUDIO_SERVICE);
+ mCarAudioManager.setVolumeController(mVolumeCallback);
+ } catch (CarNotConnectedException e) {
+ Log.e(TAG, "Car is not connected!", e);
+ }
+ for (VolumeLineItem item : mVolumeLineItems) {
+ item.setCarAudioManager(mCarAudioManager);
+ }
+ mListView = (PagedListView) findViewById(R.id.list);
+ mListView.setDefaultItemDecoration(
+ new PagedListView.Decoration(SoundSettingsActivity.this));
+ mListView.setDarkMode();
+ mPagedListAdapter = new TypedPagedListAdapter(
+ SoundSettingsActivity.this /* context */, mVolumeLineItems);
+ mListView.setAdapter(mPagedListAdapter);
}
@Override
public void onServiceDisconnected(ComponentName name) {
- mMediaVolumeControllerPresenter.onServiceDisconnected();
- mRingVolumeControllerPresenter.onServiceDisconnected();
+ mCarAudioManager = null;
}
};
@Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.list);
+ mVolumeLineItems.add(new VolumeLineItem(
+ SoundSettingsActivity.this,
+ AudioManager.STREAM_MUSIC,
+ R.string.media_volume_title,
+ com.android.internal.R.drawable.ic_audio_media));
+ mVolumeLineItems.add(new VolumeLineItem(
+ SoundSettingsActivity.this,
+ AudioManager.STREAM_RING,
+ R.string.ring_volume_title,
+ com.android.internal.R.drawable.ic_audio_ring_notif));
+ mCar = Car.createCar(this /* context */, mServiceConnection);
+ }
+
+ @Override
public void onStart() {
super.onStart();
mCar.connect();
@@ -85,8 +101,46 @@
@Override
public void onStop() {
super.onStop();
- mMediaVolumeControllerPresenter.stop();
- mRingVolumeControllerPresenter.stop();
+ for (VolumeLineItem item : mVolumeLineItems) {
+ item.stop();
+ }
mCar.disconnect();
}
+
+ /**
+ * The interface has a terrible name, it is actually a callback, so here name it accordingly.
+ */
+ private final class VolumnCallback extends IVolumeController.Stub {
+ @Override
+ public void displaySafeVolumeWarning(int flags) throws RemoteException {
+ }
+
+ @Override
+ public void volumeChanged(int streamType, int flags) throws RemoteException {
+ for (VolumeLineItem item : mVolumeLineItems) {
+ if (streamType == item.getStreamType()) {
+ break;
+ }
+ return;
+ }
+ mPagedListAdapter.notifyDataSetChanged();
+ }
+
+ // this is not mute of this stream
+ @Override
+ public void masterMuteChanged(int flags) throws RemoteException {
+ }
+
+ @Override
+ public void setLayoutDirection(int layoutDirection) throws RemoteException {
+ }
+
+ @Override
+ public void dismiss() throws RemoteException {
+ }
+
+ @Override
+ public void setA11yMode(int mode) {
+ }
+ }
}
diff --git a/src/com/android/car/settings/sound/VolumeControllerPresenter.java b/src/com/android/car/settings/sound/VolumeControllerPresenter.java
deleted file mode 100644
index cd7a2a5..0000000
--- a/src/com/android/car/settings/sound/VolumeControllerPresenter.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.car.settings.sound;
-
-import android.car.Car;
-import android.car.CarNotConnectedException;
-import android.car.media.CarAudioManager;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.ServiceConnection;
-import android.media.AudioManager;
-import android.media.IVolumeController;
-import android.media.Ringtone;
-import android.media.RingtoneManager;
-import android.net.Uri;
-import android.os.Handler;
-import android.os.IBinder;
-import android.os.Looper;
-import android.os.RemoteException;
-import android.provider.Settings;
-import android.util.Log;
-import android.view.View;
-import android.widget.ImageView;
-import android.widget.SeekBar;
-import android.widget.SeekBar.OnSeekBarChangeListener;
-import android.widget.TextView;
-
-import com.android.car.settings.R;
-
-/**
- * Contains logic about volume controller UI.
- */
-public class VolumeControllerPresenter implements OnSeekBarChangeListener {
-
- private static final String TAG = "SeekBarVolumizer";
- private static final int AUDIO_FEEDBACK_DELAY_MS = 1500;
-
- private final Handler mHandler = new Handler(Looper.getMainLooper());
- private final SeekBar mSeekBar;
- private final int mStreamType;
- private final Ringtone mRingtone;
- private final VolumnCallback mVolumeCallback = new VolumnCallback();
-
- private CarAudioManager mCarAudioManager;
-
- public void onServiceConnected(Car car) {
- try {
- mCarAudioManager = (CarAudioManager) car.getCarManager(Car.AUDIO_SERVICE);
- mCarAudioManager.setVolumeController(mVolumeCallback);
- mSeekBar.setMax(mCarAudioManager.getStreamMaxVolume(mStreamType));
- mSeekBar.setProgress(mCarAudioManager.getStreamVolume(mStreamType));
- mSeekBar.setOnSeekBarChangeListener(VolumeControllerPresenter.this);
- } catch (CarNotConnectedException e) {
- Log.e(TAG, "Car is not connected!", e);
- }
- }
-
- public void onServiceDisconnected() {
- mSeekBar.setOnSeekBarChangeListener(null);
- mCarAudioManager = null;
- }
-
- public VolumeControllerPresenter(Context context, View volumeControllerView,
- int streamType, Uri sampleUri, int titleStringResId, int iconResId) {
- mSeekBar = (SeekBar) volumeControllerView.findViewById(R.id.seekbar);
- mStreamType = streamType;
- Uri ringtoneUri;
-
- if (sampleUri == null) {
- switch (mStreamType) {
- case AudioManager.STREAM_RING:
- ringtoneUri = Settings.System.DEFAULT_RINGTONE_URI;
- break;
- case AudioManager.STREAM_NOTIFICATION:
- ringtoneUri = Settings.System.DEFAULT_NOTIFICATION_URI;
- break;
- default:
- ringtoneUri = Settings.System.DEFAULT_ALARM_ALERT_URI;
- }
- } else {
- ringtoneUri = sampleUri;
- }
- mRingtone = RingtoneManager.getRingtone(context, ringtoneUri);
- if (mRingtone != null) {
- mRingtone.setStreamType(mStreamType);
- }
- ((ImageView) volumeControllerView.findViewById(R.id.icon)).setImageResource(iconResId);
- ((TextView) volumeControllerView.findViewById(R.id.stream_name)).setText(titleStringResId);
- }
-
- public void stop() {
- mHandler.removeCallbacksAndMessages(null);
- mRingtone.stop();
- }
-
- @Override
- public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
- try {
- if (mCarAudioManager == null) {
- Log.w(TAG, "CarAudiomanager not available, Car is not connected!");
- return;
- }
- mCarAudioManager.setStreamVolume(mStreamType, progress, AudioManager.FLAG_PLAY_SOUND);
- playAudioFeedback();
- } catch (CarNotConnectedException e) {
- Log.e(TAG, "Car is not connected!", e);
- }
- }
-
- @Override
- public void onStartTrackingTouch(SeekBar seekBar) {
-
- }
-
- @Override
- public void onStopTrackingTouch(SeekBar seekBar) {
- playAudioFeedback();
- }
-
- private void playAudioFeedback() {
- mHandler.removeCallbacksAndMessages(null);
- mRingtone.play();
- mHandler.postDelayed(() -> {
- if (mRingtone.isPlaying()) {
- mRingtone.stop();
- }
- }, AUDIO_FEEDBACK_DELAY_MS);
- }
-
- /**
- * The interface has a terrible name, it is actually a callback, so here name it accordingly.
- */
- private final class VolumnCallback extends IVolumeController.Stub {
-
- private final String TAG = VolumeControllerPresenter.TAG + ".cb";
-
- @Override
- public void displaySafeVolumeWarning(int flags) throws RemoteException {
- }
-
- @Override
- public void volumeChanged(int streamType, int flags) throws RemoteException {
- if (streamType != mStreamType) {
- return;
- }
- try {
- if (mCarAudioManager == null) {
- Log.w(TAG, "CarAudiomanager not available, Car is not connected!");
- return;
- }
- int volume = mCarAudioManager.getStreamVolume(mStreamType);
- if (mSeekBar.getProgress() == volume) {
- return;
- }
- mSeekBar.setProgress(volume);
- } catch (CarNotConnectedException e) {
- Log.e(TAG, "Car is not connected!", e);
- }
- }
-
- // this is not mute of this stream
- @Override
- public void masterMuteChanged(int flags) throws RemoteException {
- }
-
- @Override
- public void setLayoutDirection(int layoutDirection) throws RemoteException {
- }
-
- @Override
- public void dismiss() throws RemoteException {
- }
-
- @Override
- public void setA11yMode(int mode) {
- }
- }
-}
diff --git a/src/com/android/car/settings/sound/VolumeLineItem.java b/src/com/android/car/settings/sound/VolumeLineItem.java
new file mode 100644
index 0000000..66e5c92
--- /dev/null
+++ b/src/com/android/car/settings/sound/VolumeLineItem.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package com.android.car.settings.sound;
+
+import android.car.CarNotConnectedException;
+import android.car.media.CarAudioManager;
+import android.content.Context;
+import android.media.AudioManager;
+import android.media.Ringtone;
+import android.media.RingtoneManager;
+import android.net.Uri;
+import android.os.Handler;
+import android.os.Looper;
+import android.provider.Settings;
+import android.util.Log;
+
+import com.android.car.settings.common.SeekbarLineItem;
+
+/**
+ * Contains logic about volume controller UI.
+ */
+public class VolumeLineItem extends SeekbarLineItem {
+ private static final String TAG = "VolumeLineItem";
+ private static final int AUDIO_FEEDBACK_DELAY_MS = 1500;
+
+ private final Handler mHandler = new Handler(Looper.getMainLooper());
+ private final int streamType;
+ private final Ringtone mRingtone;
+
+ private CarAudioManager mCarAudioManager;
+
+ public VolumeLineItem(
+ Context context, int streamType, int titleStringResId, int iconResId) {
+ super(context.getText(titleStringResId));
+ this.streamType = streamType;
+ Uri ringtoneUri;
+
+ switch (this.streamType) {
+ case AudioManager.STREAM_RING:
+ ringtoneUri = Settings.System.DEFAULT_RINGTONE_URI;
+ break;
+ case AudioManager.STREAM_NOTIFICATION:
+ ringtoneUri = Settings.System.DEFAULT_NOTIFICATION_URI;
+ break;
+ default:
+ ringtoneUri = Settings.System.DEFAULT_ALARM_ALERT_URI;
+ }
+ mRingtone = RingtoneManager.getRingtone(context, ringtoneUri);
+ if (mRingtone != null) {
+ mRingtone.setStreamType(this.streamType);
+ }
+ }
+
+ public int getStreamType() {
+ return streamType;
+ }
+
+ public void setCarAudioManager(CarAudioManager carAudioManager) {
+ mCarAudioManager = carAudioManager;
+ }
+
+ public void stop() {
+ mHandler.removeCallbacksAndMessages(null);
+ if (mRingtone != null) {
+ mRingtone.stop();
+ }
+ }
+
+ @Override
+ public int getSeekbarValue() {
+ try {
+ return mCarAudioManager.getStreamVolume(streamType);
+ } catch (CarNotConnectedException e) {
+ Log.e(TAG, "Car is not connected!", e);
+ }
+ return 0;
+ }
+
+ @Override
+ public int getMaxSeekbarValue() {
+ try {
+ return mCarAudioManager.getStreamMaxVolume(streamType);
+ } catch (CarNotConnectedException e) {
+ Log.e(TAG, "Car is not connected!", e);
+ }
+ return 0;
+ }
+
+ @Override
+ public void onSeekbarChanged(int progress) {
+ try {
+ if (mCarAudioManager == null) {
+ Log.w(TAG, "CarAudiomanager not available, Car is not connected!");
+ return;
+ }
+ mCarAudioManager.setStreamVolume(streamType, progress, AudioManager.FLAG_PLAY_SOUND);
+ playAudioFeedback();
+ } catch (CarNotConnectedException e) {
+ Log.e(TAG, "Car is not connected!", e);
+ }
+ }
+
+ private void playAudioFeedback() {
+ mHandler.removeCallbacksAndMessages(null);
+ if (mRingtone != null) {
+ mRingtone.play();
+ mHandler.postDelayed(() -> {
+ if (mRingtone.isPlaying()) {
+ mRingtone.stop();
+ }
+ }, AUDIO_FEEDBACK_DELAY_MS);
+ }
+ }
+}
diff --git a/src/com/android/car/settings/system/AboutSettingsActivity.java b/src/com/android/car/settings/system/AboutSettingsActivity.java
index a2ea9ba..8f630f7 100644
--- a/src/com/android/car/settings/system/AboutSettingsActivity.java
+++ b/src/com/android/car/settings/system/AboutSettingsActivity.java
@@ -19,9 +19,11 @@
import android.os.Build;
import com.android.car.settings.common.ListSettingsActivity;
+import com.android.car.settings.common.NoDividerItemDecoration;
import com.android.car.settings.common.SimpleTextLineItem;
import com.android.car.settings.common.TypedPagedListAdapter;
import com.android.car.settings.R;
+import com.android.car.view.PagedListView;
import com.android.settingslib.DeviceInfoUtils;
import java.util.ArrayList;
@@ -47,4 +49,9 @@
getText(R.string.build_number), Build.DISPLAY));
return lineItems;
}
+
+ @Override
+ public PagedListView.Decoration getDecoration() {
+ return new NoDividerItemDecoration(this);
+ }
}
diff --git a/src/com/android/car/settings/system/AboutSystemLineItem.java b/src/com/android/car/settings/system/AboutSystemLineItem.java
index 0334540..2d240de 100644
--- a/src/com/android/car/settings/system/AboutSystemLineItem.java
+++ b/src/com/android/car/settings/system/AboutSystemLineItem.java
@@ -19,8 +19,10 @@
import android.content.Context;
import android.content.Intent;
import android.os.Build;
+import android.widget.ImageView;
import com.android.car.settings.R;
+import com.android.car.settings.common.AnimationUtil;
import com.android.car.settings.common.IconTextLineItem;
@@ -32,7 +34,7 @@
private final Context mContext;
public AboutSystemLineItem(Context context) {
- super(context.getString(R.string.about_settings), R.drawable.ic_settings_about);
+ super(context.getString(R.string.about_settings));
mContext = context;
}
@@ -49,6 +51,11 @@
@Override
public void onClick() {
Intent intent = new Intent(mContext, AboutSettingsActivity.class);
- mContext.startActivity(intent);
+ mContext.startActivity(intent, AnimationUtil.slideInFromRightOption(mContext).toBundle());
+ }
+
+ @Override
+ public void setIcon(ImageView iconView) {
+ iconView.setImageResource(R.drawable.ic_settings_about);
}
}
diff --git a/src/com/android/car/settings/system/LegalInfoLineItem.java b/src/com/android/car/settings/system/LegalInfoLineItem.java
index 663d16b..d5cb484 100644
--- a/src/com/android/car/settings/system/LegalInfoLineItem.java
+++ b/src/com/android/car/settings/system/LegalInfoLineItem.java
@@ -17,6 +17,7 @@
package com.android.car.settings.system;
import android.content.Context;
+import android.widget.ImageView;
import com.android.car.settings.R;
import com.android.car.settings.common.IconTextLineItem;
@@ -30,7 +31,7 @@
private final Context mContext;
public LegalInfoLineItem(Context context) {
- super(context.getString(R.string.legal_information), R.drawable.ic_settings_about);
+ super(context.getString(R.string.legal_information));
mContext = context;
}
@@ -48,4 +49,9 @@
public void onClick() {
// TODO: link to a legal info page.
}
+
+ @Override
+ public void setIcon(ImageView iconView) {
+ iconView.setImageResource(R.drawable.ic_settings_about);
+ }
}
diff --git a/src/com/android/car/settings/system/SystemUpdatesLineItem.java b/src/com/android/car/settings/system/SystemUpdatesLineItem.java
index 034b9df..f97dc24 100644
--- a/src/com/android/car/settings/system/SystemUpdatesLineItem.java
+++ b/src/com/android/car/settings/system/SystemUpdatesLineItem.java
@@ -17,6 +17,7 @@
package com.android.car.settings.system;
import android.content.Context;
+import android.widget.ImageView;
import com.android.car.settings.R;
import com.android.car.settings.common.IconTextLineItem;
@@ -31,8 +32,7 @@
private final Context mContext;
public SystemUpdatesLineItem(Context context) {
- super(context.getString(
- R.string.system_update_settings_list_item_title), R.drawable.ic_system_update);
+ super(context.getString(R.string.system_update_settings_list_item_title));
mContext = context;
}
@@ -50,4 +50,9 @@
public void onClick() {
// TODO: trigger system OTA flow
}
+
+ @Override
+ public void setIcon(ImageView iconView) {
+ iconView.setImageResource(R.drawable.ic_system_update);
+ }
}
diff --git a/src/com/android/car/settings/wifi/AccessPointListAdapter.java b/src/com/android/car/settings/wifi/AccessPointListAdapter.java
index 8a72b73..c4f7ec5 100644
--- a/src/com/android/car/settings/wifi/AccessPointListAdapter.java
+++ b/src/com/android/car/settings/wifi/AccessPointListAdapter.java
@@ -34,6 +34,7 @@
import android.widget.Toast;
import com.android.car.settings.R;
+import com.android.car.settings.common.AnimationUtil;
import com.android.car.settings.wifi.AccessPointListAdapter.ViewHolder;
import com.android.car.view.PagedListView;
import com.android.settingslib.wifi.AccessPoint;
@@ -123,7 +124,8 @@
Bundle accessPointState = new Bundle();
mAccessPoint.saveWifiState(accessPointState);
intent.putExtras(accessPointState);
- mContext.startActivity(intent);
+ mContext.startActivity(
+ intent, AnimationUtil.slideInFromRightOption(mContext).toBundle());
}
}
};
@@ -132,7 +134,7 @@
public AccessPointListAdapter.ViewHolder onCreateViewHolder(ViewGroup parent,
int viewType) {
View v = LayoutInflater.from(parent.getContext())
- .inflate(R.layout.list_item, parent, false);
+ .inflate(R.layout.icon_widget_line_item, parent, false);
ViewHolder vh = new ViewHolder(v);
return vh;
}
diff --git a/src/com/android/car/settings/wifi/WifiSettingsActivity.java b/src/com/android/car/settings/wifi/WifiSettingsActivity.java
index 5f87784..9e80e3d 100644
--- a/src/com/android/car/settings/wifi/WifiSettingsActivity.java
+++ b/src/com/android/car/settings/wifi/WifiSettingsActivity.java
@@ -30,6 +30,7 @@
import android.annotation.StringRes;
+import com.android.car.settings.common.AnimationUtil;
import com.android.car.settings.common.CarSettingActivity;
import com.android.car.settings.R;
import com.android.car.view.PagedListView;
@@ -59,7 +60,7 @@
mCarWifiManager = new CarWifiManager(this /* context */ , this /* listener */);
setContentView(R.layout.wifi_list);
- ((TextView) findViewById(R.id.action_bar_title)).setText(R.string.wifi_settings);
+ ((TextView) findViewById(R.id.title)).setText(R.string.wifi_settings);
mProgressBar = (ProgressBar) findViewById(R.id.wifi_search_progress);
mListView = (PagedListView) findViewById(R.id.list);
mMessageView = (TextView) findViewById(R.id.message);
@@ -69,7 +70,8 @@
mAddWifiTextView.setOnClickListener(v -> {
Intent intent = new Intent(this /* context */, AddWifiActivity.class);
intent.putExtra(AddWifiActivity.ADD_NETWORK_MODE, true);
- startActivity(intent);
+ startActivity(intent, AnimationUtil.slideInFromRightOption(
+ WifiSettingsActivity.this).toBundle());
});
setupWifiSwitch();
if (mCarWifiManager.isWifiEnabled()) {
@@ -77,7 +79,7 @@
} else {
showMessage(R.string.wifi_disabled);
}
- mListView.setDefaultItemDecoration(new ItemDecoration(this));
+ mListView.setDefaultItemDecoration(new PagedListView.Decoration(this));
// Set this to light mode, since the scroll bar buttons always appear
// on top of a dark scrim.
mListView.setDarkMode();
@@ -146,19 +148,6 @@
mWifiSwitch.setChecked(mCarWifiManager.isWifiEnabled());
}
- /**
- * Default {@link com.android.car.view.PagedListView.Decoration} for the {@link PagedListView}
- * that removes the dividing lines between items.
- */
- private static class ItemDecoration extends PagedListView.Decoration {
- public ItemDecoration(Context context) {
- super(context);
- }
-
- @Override
- public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) {}
- }
-
private void showMessage(@StringRes int resId) {
if (mViewSwitcher.getCurrentView() != mMessageView) {
mViewSwitcher.showNext();
diff --git a/tests/robotests/src/com/android/car/settings/display/BrightnessLineItemTest.java b/tests/robotests/src/com/android/car/settings/display/BrightnessLineItemTest.java
index 7946612..872db52 100644
--- a/tests/robotests/src/com/android/car/settings/display/BrightnessLineItemTest.java
+++ b/tests/robotests/src/com/android/car/settings/display/BrightnessLineItemTest.java
@@ -50,7 +50,7 @@
// for some reason in robolectric test, I can't set this value over 100
for (int brightness = 0; brightness < 100; ++brightness) {
Settings.System.putInt(mContext.getContentResolver(), SCREEN_BRIGHTNESS, brightness);
- assertThat(mBrightnessLineItem.getInitialSeekbarValue()).isEqualTo(brightness);
+ assertThat(mBrightnessLineItem.getSeekbarValue()).isEqualTo(brightness);
}
}