Fix account problems

Set the id to the right value for now to fix the switches.

Make sure we call the super on the PreferenceFragment to set up
the RecyclerView properly.

Bug: 25621599
Change-Id: I7cc1f68a612d04ca1f8d068c272cdc8f85003938
diff --git a/res/layout/manage_accounts_screen.xml b/res/layout/manage_accounts_screen.xml
index 12158b9..57241c1 100644
--- a/res/layout/manage_accounts_screen.xml
+++ b/res/layout/manage_accounts_screen.xml
@@ -22,8 +22,8 @@
     android:layout_height="match_parent"
     android:orientation="vertical">
 
-    <ListView xmlns:android="http://schemas.android.com/apk/res/android"
-        android:id="@android:id/list"
+    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/prefs_container"
         android:layout_width="match_parent"
         android:layout_height="0dip"
         android:layout_weight="1"
diff --git a/res/layout/preference_widget_sync_toggle.xml b/res/layout/preference_widget_sync_toggle.xml
index 22cd4d3..d4faf56 100644
--- a/res/layout/preference_widget_sync_toggle.xml
+++ b/res/layout/preference_widget_sync_toggle.xml
@@ -39,7 +39,7 @@
         android:contentDescription="@string/sync_active" />
 
     <Switch xmlns:android="http://schemas.android.com/apk/res/android"
-        android:id="@*android:id/switchWidget"
+        android:id="@id/switchWidget"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_gravity="center_vertical"
diff --git a/src/com/android/settings/accounts/ManageAccountsSettings.java b/src/com/android/settings/accounts/ManageAccountsSettings.java
index 351ab12..c9124d9 100644
--- a/src/com/android/settings/accounts/ManageAccountsSettings.java
+++ b/src/com/android/settings/accounts/ManageAccountsSettings.java
@@ -44,9 +44,7 @@
 import android.view.MenuItem;
 import android.view.View;
 import android.view.ViewGroup;
-import android.widget.ListView;
 import android.widget.TextView;
-
 import com.android.internal.logging.MetricsLogger;
 import com.android.settings.AccountPreference;
 import com.android.settings.R;
@@ -117,8 +115,10 @@
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
             Bundle savedInstanceState) {
         final View view = inflater.inflate(R.layout.manage_accounts_screen, container, false);
-        final ListView list = (ListView) view.findViewById(android.R.id.list);
-        Utils.prepareCustomPreferencesList(container, view, list, false);
+        final ViewGroup prefs_container = (ViewGroup) view.findViewById(R.id.prefs_container);
+        Utils.prepareCustomPreferencesList(container, view, prefs_container, false);
+        View prefs = super.onCreateView(inflater, prefs_container, savedInstanceState);
+        prefs_container.addView(prefs);
         return view;
     }
 
diff --git a/src/com/android/settings/accounts/SyncStateSwitchPreference.java b/src/com/android/settings/accounts/SyncStateSwitchPreference.java
index 5800fc2..9458908 100644
--- a/src/com/android/settings/accounts/SyncStateSwitchPreference.java
+++ b/src/com/android/settings/accounts/SyncStateSwitchPreference.java
@@ -69,7 +69,7 @@
         final boolean failedVisible = mFailed && !activeVisible;
         syncFailedView.setVisibility(failedVisible ? View.VISIBLE : View.GONE);
 
-        View switchView = view.findViewById(com.android.internal.R.id.switchWidget);
+        View switchView = view.findViewById(R.id.switchWidget);
         if (mOneTimeSyncMode) {
             switchView.setVisibility(View.GONE);