Fix group source crash on phone

- The group source button is supposed to be a scrolling header
in the list of group members on the phone portrait view, but
we can't add a header view to a ListView after the adapter is set.
(Setting the adapter had to be moved before setting the header
view otherwise the group detail page would flicker on every
sync).

- Make the header static as a simplification and hide the view
if there's no group source needed.

- Remove fading edge on group members list

Bug: 5195472
Change-Id: Ibedc629ddd85a54ed8beee92650df617a09d2a6c
diff --git a/res/layout-sw580dp-w1000dp/group_detail_fragment.xml b/res/layout-sw580dp-w1000dp/group_detail_fragment.xml
index 31d3ce1..4f2fb9e 100644
--- a/res/layout-sw580dp-w1000dp/group_detail_fragment.xml
+++ b/res/layout-sw580dp-w1000dp/group_detail_fragment.xml
@@ -79,6 +79,7 @@
         android:layout_marginLeft="@dimen/group_detail_border_padding"
         android:layout_marginRight="@dimen/group_detail_border_padding"
         android:cacheColorHint="#00000000"
+        android:fadingEdge="none"
         android:divider="@null" />
 
 </LinearLayout>
\ No newline at end of file
diff --git a/res/layout-sw580dp/group_detail_fragment.xml b/res/layout-sw580dp/group_detail_fragment.xml
index c11337f..99a60f3 100644
--- a/res/layout-sw580dp/group_detail_fragment.xml
+++ b/res/layout-sw580dp/group_detail_fragment.xml
@@ -58,6 +58,7 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:cacheColorHint="#00000000"
+        android:fadingEdge="none"
         android:divider="@null" />
 
 </LinearLayout>
\ No newline at end of file
diff --git a/res/layout-w470dp/group_source_button.xml b/res/layout-w470dp/group_source_button.xml
index b725512..4e8838e 100644
--- a/res/layout-w470dp/group_source_button.xml
+++ b/res/layout-w470dp/group_source_button.xml
@@ -42,7 +42,9 @@
             android:layout_height="wrap_content"
             android:layout_gravity="center_vertical"
             android:textAppearance="?android:attr/textAppearanceMedium"
-            android:text="@string/view_updates_from_group"/>
+            android:textColor="@color/action_bar_button_text_color"
+            android:text="@string/view_updates_from_group"
+            style="@android:style/Widget.Holo.ActionBar.TabText"/>
 
         <ImageView
             android:id="@android:id/icon"
diff --git a/res/layout/group_detail_fragment.xml b/res/layout/group_detail_fragment.xml
index 76f7214..c29355e 100644
--- a/res/layout/group_detail_fragment.xml
+++ b/res/layout/group_detail_fragment.xml
@@ -20,10 +20,18 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
+    <FrameLayout
+        android:id="@+id/group_source_view_container"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_vertical" />
+
     <ListView
         android:id="@android:id/list"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
+        android:layout_height="0dip"
+        android:layout_weight="1"
+        android:fadingEdge="none"
         android:scrollbarStyle="outsideOverlay"/>
 
 </LinearLayout>
diff --git a/src/com/android/contacts/group/GroupDetailFragment.java b/src/com/android/contacts/group/GroupDetailFragment.java
index 1f47510..1164069 100644
--- a/src/com/android/contacts/group/GroupDetailFragment.java
+++ b/src/com/android/contacts/group/GroupDetailFragment.java
@@ -317,9 +317,8 @@
     /**
      * Once the account type, group source action, and group source URI have been determined
      * (based on the result from the {@link Loader}), then we can display this to the user in 1 of
-     * 3 ways depending on screen size and orientation: either as a button in the action bar,
-     * a button in a static header on the page, or as a header that scrolls with the
-     * {@link ListView}.
+     * 2 ways depending on screen size and orientation: either as a button in the action bar or as
+     * a button in a static header on the page.
      */
     private void updateAccountType(final String accountTypeString, final String dataSet) {
 
@@ -345,10 +344,6 @@
                 // the view there.
                 if (mGroupSourceViewContainer != null) {
                     mGroupSourceViewContainer.addView(mGroupSourceView);
-                } else {
-                    // Otherwise, display the group source as a scrolling header within the
-                    // {@link ListView} of group members.
-                    mMemberListView.addHeaderView(mGroupSourceView);
                 }
             }