When click conditional's title, expand/collapse content.

Bug: 30200101

It used to lead user to detailed setting for that conditional. This
leaves some confusion about which click target goes to where.

Change-Id: Ic9525ace65ca488f4e709576fb1ec96a1cb99938
(cherry picked from commit a2db2ca8fad50f0fb4cdd060d83c746a857fe92a)
diff --git a/res/layout/condition_card.xml b/res/layout/condition_card.xml
index 9d18abc..7c9e46d 100644
--- a/res/layout/condition_card.xml
+++ b/res/layout/condition_card.xml
@@ -25,7 +25,6 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="vertical"
-        android:paddingStart="16dp"
         android:background="?android:attr/colorAccent"
         android:elevation="2dp"
         android:clickable="true"
@@ -35,6 +34,7 @@
             android:id="@+id/collapsed_group"
             android:layout_width="match_parent"
             android:layout_height="56dp"
+            android:background="?android:attr/selectableItemBackground"
             android:orientation="horizontal"
             android:gravity="center">
 
@@ -42,6 +42,7 @@
                 android:id="@android:id/icon"
                 android:layout_width="24dp"
                 android:layout_height="wrap_content"
+                android:layout_marginStart="16dp"
                 android:layout_marginEnd="32dp"
                 android:tint="?android:attr/textColorPrimaryInverse" />
 
@@ -58,10 +59,7 @@
                 android:layout_width="wrap_content"
                 android:layout_height="match_parent"
                 android:padding="16dp"
-                android:tint="?android:attr/textColorPrimaryInverse"
-                android:clickable="true"
-                android:focusable="true"
-                android:background="?android:attr/selectableItemBackground" />
+                android:tint="?android:attr/textColorPrimaryInverse"/>
 
         </LinearLayout>
 
@@ -69,7 +67,7 @@
             android:id="@+id/detail_group"
             android:layout_width="match_parent"
             android:layout_height="0dp"
-            android:paddingStart="56dp"
+            android:paddingStart="72dp"
             android:visibility="gone"
             android:orientation="vertical">
 
diff --git a/src/com/android/settings/dashboard/conditional/ConditionAdapterUtils.java b/src/com/android/settings/dashboard/conditional/ConditionAdapterUtils.java
index 51fd132..a16de50 100644
--- a/src/com/android/settings/dashboard/conditional/ConditionAdapterUtils.java
+++ b/src/com/android/settings/dashboard/conditional/ConditionAdapterUtils.java
@@ -68,12 +68,13 @@
         card.setOnClickListener(onClickListener);
         view.icon.setImageIcon(condition.getIcon());
         view.title.setText(condition.getTitle());
-        ImageView expand = (ImageView) view.itemView.findViewById(R.id.expand_indicator);
-        expand.setTag(condition);
+        final View collapsedGroup = view.itemView.findViewById(R.id.collapsed_group);
+        collapsedGroup.setTag(condition);
+        final ImageView expand = (ImageView) view.itemView.findViewById(R.id.expand_indicator);
         expand.setImageResource(isExpanded ? R.drawable.ic_expand_less : R.drawable.ic_expand_more);
         expand.setContentDescription(expand.getContext().getString(isExpanded
                 ? R.string.condition_expand_hide : R.string.condition_expand_show));
-        expand.setOnClickListener(onExpandListener);
+        collapsedGroup.setOnClickListener(onExpandListener);
 
         View detailGroup = view.itemView.findViewById(R.id.detail_group);
         CharSequence[] actions = condition.getActions();