Settings tweaks
Change-Id: I68829fa8e49534d4635a008c94dced3c7ab6f4b1
Fixes: 27834471
Fixes: 27834626
Fixes: 27567838
Fixes: 27834676
diff --git a/res/layout/condition_card.xml b/res/layout/condition_card.xml
index 6a08d55..0e480a5 100644
--- a/res/layout/condition_card.xml
+++ b/res/layout/condition_card.xml
@@ -27,7 +27,7 @@
android:orientation="vertical"
android:paddingStart="16dp"
android:background="?android:attr/colorAccent"
- android:elevation="3dp"
+ android:elevation="2dp"
android:clickable="true">
<LinearLayout
diff --git a/res/layout/dashboard_category.xml b/res/layout/dashboard_category.xml
index 0a7aed9..b3500b2 100644
--- a/res/layout/dashboard_category.xml
+++ b/res/layout/dashboard_category.xml
@@ -23,11 +23,6 @@
android:background="@color/card_background"
android:importantForAccessibility="noHideDescendants">
- <View
- android:layout_width="match_parent"
- android:layout_height="1dp"
- android:background="?android:attr/listDivider" />
-
<TextView android:id="@android:id/title"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/res/layout/dashboard_spacer.xml b/res/layout/dashboard_spacer.xml
index d7d9717..19ef8ff 100644
--- a/res/layout/dashboard_spacer.xml
+++ b/res/layout/dashboard_spacer.xml
@@ -16,4 +16,4 @@
<View xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="10dp" />
+ android:layout_height="6dp" />
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 34ca866..89b2d15 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -125,4 +125,6 @@
<color name="seek_bar_preference_preview_text">#fff</color>
+ <color name="usage_graph_dots">#B0BEC5</color>
+
</resources>
diff --git a/res/xml/location_settings.xml b/res/xml/location_settings.xml
index 9fd0826..1abf9be 100644
--- a/res/xml/location_settings.xml
+++ b/res/xml/location_settings.xml
@@ -34,7 +34,7 @@
android:enabled="false"
android:selectable="true" />
- <PreferenceCategory
+ <com.android.settings.DividedCategory
android:key="recent_location_requests"
android:title="@string/location_category_recent_location_requests" />
diff --git a/res/xml/manage_assist.xml b/res/xml/manage_assist.xml
index 97a06ea..6984f88 100644
--- a/res/xml/manage_assist.xml
+++ b/res/xml/manage_assist.xml
@@ -17,6 +17,7 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res-auto"
android:key="manage_assist">
<com.android.settings.applications.DefaultAssistPreference
@@ -40,8 +41,9 @@
android:title="@string/voice_input_settings_title"
/>
- <Preference
+ <com.android.settings.DividerPreference
android:summary="@string/assist_footer"
- android:selectable="false"/>
+ android:selectable="false"
+ settings:allowDividerAbove="true" />
</PreferenceScreen>
diff --git a/res/xml/wifi_configure_settings.xml b/res/xml/wifi_configure_settings.xml
index 71a81dd..3aeb83e 100644
--- a/res/xml/wifi_configure_settings.xml
+++ b/res/xml/wifi_configure_settings.xml
@@ -15,6 +15,7 @@
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/wifi_configure_titlebar">
<Preference
@@ -40,10 +41,11 @@
android:summary="@string/wifi_automatically_connect_summary"
android:dialogTitle="@string/wifi_select_assistant_dialog_title" />
- <Preference
+ <com.android.settings.DividerPreference
android:key="mac_address"
android:title="@string/wifi_advanced_mac_address_title"
- android:layout="@layout/wifi_advance_layout" />
+ android:layout="@layout/wifi_advance_layout"
+ settings:allowDividerAbove="true" />
<Preference
android:key="current_ip_address"
diff --git a/src/com/android/settings/dashboard/DashboardDecorator.java b/src/com/android/settings/dashboard/DashboardDecorator.java
new file mode 100644
index 0000000..2e7afaf
--- /dev/null
+++ b/src/com/android/settings/dashboard/DashboardDecorator.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package com.android.settings.dashboard;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.drawable.Drawable;
+import android.support.v4.view.ViewCompat;
+import android.support.v7.widget.RecyclerView;
+import android.support.v7.widget.RecyclerView.State;
+import android.support.v7.widget.RecyclerView.ViewHolder;
+import android.util.Log;
+import android.util.TypedValue;
+import android.view.View;
+import com.android.settings.R;
+
+public class DashboardDecorator extends RecyclerView.ItemDecoration {
+
+ private final Context mContext;
+ private final Drawable mDivider;
+
+ public DashboardDecorator(Context context) {
+ mContext = context;
+ TypedValue value = new TypedValue();
+ mContext.getTheme().resolveAttribute(android.R.attr.listDivider, value, true);
+ mDivider = mContext.getDrawable(value.resourceId);
+ }
+
+ @Override
+ public void onDrawOver(Canvas c, RecyclerView parent, State state) {
+ final int childCount = parent.getChildCount();
+ final int width = parent.getWidth();
+ final int bottom = parent.getBottom();
+ for (int i = 1; i < childCount; i++) {
+ final View child = parent.getChildAt(i);
+ final ViewHolder holder = parent.getChildViewHolder(child);
+ if (holder.getItemViewType() == R.layout.dashboard_category) {
+ if (parent.getChildViewHolder(parent.getChildAt(i - 1)).getItemViewType()
+ != R.layout.dashboard_tile) {
+ continue;
+ }
+ } else if (holder.getItemViewType() != R.layout.condition_card) {
+ continue;
+ }
+
+ int top = getChildTop(child);
+ mDivider.setBounds(0, top, width, top + mDivider.getIntrinsicHeight());
+ mDivider.draw(c);
+ }
+ }
+
+ private int getChildTop(View child) {
+ final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
+ .getLayoutParams();
+ return child.getTop() + params.topMargin + Math.round(ViewCompat.getTranslationY(child));
+ }
+}
diff --git a/src/com/android/settings/dashboard/DashboardSummary.java b/src/com/android/settings/dashboard/DashboardSummary.java
index 5d9a79b..12a92bd 100644
--- a/src/com/android/settings/dashboard/DashboardSummary.java
+++ b/src/com/android/settings/dashboard/DashboardSummary.java
@@ -171,6 +171,7 @@
mDashboard.setLayoutManager(mLayoutManager);
mDashboard.setHasFixedSize(true);
mDashboard.setListener(this);
+ mDashboard.addItemDecoration(new DashboardDecorator(getContext()));
mAdapter = new DashboardAdapter(getContext());
mAdapter.setConditions(mConditionManager.getConditions());
mAdapter.setSuggestions(mSuggestionParser);
diff --git a/src/com/android/settings/fuelgauge/BatteryHistoryPreference.java b/src/com/android/settings/fuelgauge/BatteryHistoryPreference.java
index ba93f98..0f36ab1 100644
--- a/src/com/android/settings/fuelgauge/BatteryHistoryPreference.java
+++ b/src/com/android/settings/fuelgauge/BatteryHistoryPreference.java
@@ -76,6 +76,7 @@
((TextView) view.findViewById(R.id.charge)).setText(mBatteryInfo.batteryPercentString);
((TextView) view.findViewById(R.id.estimation)).setText(mBatteryInfo.remainingLabel);
UsageView usageView = (UsageView) view.findViewById(R.id.battery_usage);
+ usageView.findViewById(R.id.label_group).setAlpha(.7f);
mBatteryInfo.bindHistory(usageView);
}
}