Merge "Update spacing in suggestion/condition header and footer." into oc-dr1-dev
diff --git a/res/layout/suggestion_condition_footer.xml b/res/layout/suggestion_condition_footer.xml
index f9d30e6..3eea6a5 100644
--- a/res/layout/suggestion_condition_footer.xml
+++ b/res/layout/suggestion_condition_footer.xml
@@ -20,8 +20,8 @@
     style="@style/SuggestionConditionStyle"
     android:layout_width="match_parent"
     android:layout_height="44dp"
-    android:paddingTop="4dp"
-    android:paddingEnd="16dp"
+    android:paddingTop="10dp"
+    android:paddingEnd="10dp"
     android:orientation="horizontal"
     android:gravity="end">
 
diff --git a/res/layout/suggestion_condition_header.xml b/res/layout/suggestion_condition_header.xml
index 4519a46..2551b65 100644
--- a/res/layout/suggestion_condition_header.xml
+++ b/res/layout/suggestion_condition_header.xml
@@ -20,16 +20,13 @@
     style="@style/SuggestionConditionStyle"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
+    android:paddingTop="10dp"
+    android:paddingBottom="10dp"
     android:orientation="vertical">
 
-    <Space
-        android:id="@+id/top_space"
-        android:layout_width="match_parent"
-        android:layout_height="9dp"/>
-
     <RelativeLayout
         android:layout_width="match_parent"
-        android:layout_height="35dp"
+        android:layout_height="36dp"
         android:layout_centerHorizontal="true">
 
         <FrameLayout
@@ -87,8 +84,4 @@
 
     </RelativeLayout>
 
-    <Space
-        android:layout_width="match_parent"
-        android:layout_height="12dp"/>
-
 </LinearLayout>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 70417e5..af20217 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -329,4 +329,8 @@
     <dimen name="battery_meter_width">66dp</dimen>
     <dimen name="battery_meter_height">100dp</dimen>
 
+    <!-- Suggestion/condition header padding -->
+    <dimen name="suggestion_condition_header_padding_collapsed">10dp</dimen>
+    <dimen name="suggestion_condition_header_padding_expanded">5dp</dimen>
+
 </resources>
diff --git a/src/com/android/settings/dashboard/DashboardAdapter.java b/src/com/android/settings/dashboard/DashboardAdapter.java
index bbef8d7..da9e8a7 100644
--- a/src/com/android/settings/dashboard/DashboardAdapter.java
+++ b/src/com/android/settings/dashboard/DashboardAdapter.java
@@ -17,6 +17,7 @@
 
 import android.app.Activity;
 import android.content.Context;
+import android.content.res.Resources;
 import android.content.res.TypedArray;
 import android.graphics.Color;
 import android.graphics.drawable.Drawable;
@@ -34,7 +35,6 @@
 import android.view.ViewGroup;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
-import android.widget.Space;
 import android.widget.TextView;
 
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
@@ -418,11 +418,12 @@
             holder.summary.setText(null);
         }
 
-        if (curMode == DashboardData.HEADER_MODE_COLLAPSED) {
-            holder.topSpace.setVisibility(View.VISIBLE);
-        } else {
-            holder.topSpace.setVisibility(View.GONE);
-        }
+        final Resources res = mContext.getResources();
+        final int padding = res.getDimensionPixelOffset(
+                curMode == DashboardData.HEADER_MODE_COLLAPSED
+                        ? R.dimen.suggestion_condition_header_padding_collapsed
+                        : R.dimen.suggestion_condition_header_padding_expanded);
+        holder.itemView.setPadding(0, padding, 0, padding);
 
         holder.itemView.setOnClickListener(v -> {
             if (moreSuggestions ) {
@@ -550,13 +551,11 @@
     public static class SuggestionAndConditionHeaderHolder extends DashboardItemHolder {
         public final LinearLayout icons;
         public final ImageView expandIndicator;
-        public final Space topSpace;
 
         public SuggestionAndConditionHeaderHolder(View itemView) {
             super(itemView);
             icons = itemView.findViewById(id.additional_icons);
             expandIndicator = itemView.findViewById(id.expand_indicator);
-            topSpace = itemView.findViewById(id.top_space);
         }
     }