Adding app grid layout with fastscroller.

- Adding filtering and using alphabetic index for app grouping.

Change-Id: I745b644fa8f90f5ff24a8642ac377ef1c65d8aff
diff --git a/res/drawable/apps_list_fastscroll_bg.xml b/res/drawable/apps_list_fastscroll_bg.xml
new file mode 100644
index 0000000..4ec1848
--- /dev/null
+++ b/res/drawable/apps_list_fastscroll_bg.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2015 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.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+       android:shape="rectangle">
+    <solid android:color="@color/apps_view_scrollbar_thumb_color" />
+    <size
+        android:width="48dp"
+        android:height="48dp" />
+    <corners android:radius="4dp" />
+</shape>
\ No newline at end of file
diff --git a/res/drawable/apps_list_scrollbar_thumb.xml b/res/drawable/apps_list_scrollbar_thumb.xml
new file mode 100644
index 0000000..ddd65b2
--- /dev/null
+++ b/res/drawable/apps_list_scrollbar_thumb.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2015 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.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+       android:shape="rectangle">
+    <solid android:color="@color/apps_view_scrollbar_thumb_color" />
+    <size android:width="4dp"/>
+</shape>
\ No newline at end of file
diff --git a/res/drawable/apps_list_search_bg.xml b/res/drawable/apps_list_search_bg.xml
new file mode 100644
index 0000000..eda33a9
--- /dev/null
+++ b/res/drawable/apps_list_search_bg.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2015 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.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+       android:shape="rectangle">
+    <solid android:color="#ffffff" />
+    <corners
+        android:topLeftRadius="3dp"
+        android:topRightRadius="3dp" />
+</shape>
\ No newline at end of file
diff --git a/res/layout-sw600dp/apps_view.xml b/res/layout-sw600dp/apps_view.xml
index 1f773b3..3bb6ec5 100644
--- a/res/layout-sw600dp/apps_view.xml
+++ b/res/layout-sw600dp/apps_view.xml
@@ -23,12 +23,12 @@
     android:descendantFocusability="afterDescendants">
     <include
         layout="@layout/apps_list_reveal_view"
-        android:layout_width="420dp"
-        android:layout_height="match_parent"
+        android:layout_width="@dimen/apps_container_width"
+        android:layout_height="540dp"
         android:layout_gravity="center" />
     <include
         layout="@layout/apps_list_view"
-        android:layout_width="420dp"
-        android:layout_height="match_parent"
+        android:layout_width="@dimen/apps_container_width"
+        android:layout_height="540dp"
         android:layout_gravity="center" />
 </com.android.launcher3.AppsContainerView>
\ No newline at end of file
diff --git a/res/layout/apps_grid_row_icon_view.xml b/res/layout/apps_grid_row_icon_view.xml
index 11c8eeb..81e74b9 100644
--- a/res/layout/apps_grid_row_icon_view.xml
+++ b/res/layout/apps_grid_row_icon_view.xml
@@ -13,10 +13,17 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-
 <com.android.launcher3.BubbleTextView
     xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:launcher="http://schemas.android.com/apk/res-auto"
     style="@style/WorkspaceIcon.AppsCustomize"
-    android:id="@+id/application_icon"
+    android:id="@+id/icon"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_gravity="left|center_vertical"
+    android:paddingTop="8dp"
+    android:paddingBottom="8dp"
     android:focusable="true"
-    android:background="@drawable/focusable_view_bg" />
+    android:background="@drawable/focusable_view_bg"
+    launcher:deferShadowGeneration="true" />
+
diff --git a/res/layout/apps_grid_row_view.xml b/res/layout/apps_grid_row_view.xml
deleted file mode 100644
index bce43bc..0000000
--- a/res/layout/apps_grid_row_view.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 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.
--->
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="@dimen/apps_view_row_height"
-    android:paddingTop="12dp"
-    android:paddingBottom="12dp"
-    android:orientation="horizontal"
-    android:focusable="true"
-    android:background="@drawable/focusable_view_bg"
-    android:descendantFocusability="afterDescendants">
-    <TextView
-        android:id="@+id/section"
-        android:layout_width="48dp"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center_vertical"
-        android:paddingRight="8dp"
-        android:paddingBottom="12dp"
-        android:gravity="right"
-        android:textColor="#1ca195"
-        android:textSize="16sp"
-        android:textAllCaps="true"
-        android:focusable="false" />
-</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/apps_list_reveal_view.xml b/res/layout/apps_list_reveal_view.xml
index 4a26787..19e462b 100644
--- a/res/layout/apps_list_reveal_view.xml
+++ b/res/layout/apps_list_reveal_view.xml
@@ -15,7 +15,7 @@
 -->
 <FrameLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/all_apps_transition_overlay"
+    android:id="@+id/apps_view_transition_overlay"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:layout_gravity="center"
diff --git a/res/layout/apps_list_row_icon_view.xml b/res/layout/apps_list_row_icon_view.xml
index 607af9b..867dbdc 100644
--- a/res/layout/apps_list_row_icon_view.xml
+++ b/res/layout/apps_list_row_icon_view.xml
@@ -20,9 +20,10 @@
     style="@style/WorkspaceIcon.AppsCustomize"
     android:id="@+id/application_icon"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content"
+    android:layout_height="match_parent"
     android:focusable="true"
     android:background="@drawable/focusable_view_bg"
     launcher:iconPaddingOverride="24dp"
     launcher:textSizeOverride="16dp"
-    launcher:layoutHorizontal="true" />
+    launcher:layoutHorizontal="true"
+    launcher:deferShadowGeneration="true" />
diff --git a/res/layout/apps_list_row_view.xml b/res/layout/apps_list_row_view.xml
index c4dcd00..83c175b 100644
--- a/res/layout/apps_list_row_view.xml
+++ b/res/layout/apps_list_row_view.xml
@@ -26,9 +26,8 @@
         android:layout_width="64dp"
         android:layout_height="match_parent"
         android:paddingLeft="16dp"
-        android:gravity="left|center_vertical"
-        android:textColor="#009688"
-        android:textSize="24sp"
-        android:textAllCaps="true"
+        android:gravity="start|center_vertical"
+        android:textColor="@color/apps_view_section_text_color"
+        android:textSize="@dimen/apps_view_section_text_size"
         android:focusable="false" />
 </LinearLayout>
\ No newline at end of file
diff --git a/res/layout/apps_list_view.xml b/res/layout/apps_list_view.xml
index b1b0f31..dfb2fc4 100644
--- a/res/layout/apps_list_view.xml
+++ b/res/layout/apps_list_view.xml
@@ -13,18 +13,41 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-<ListView
+<LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/apps_list"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:layout_gravity="center"
-    android:paddingTop="12dp"
-    android:paddingBottom="12dp"
-    android:clipToPadding="false"
-    android:scrollbars="vertical"
+    android:orientation="vertical"
     android:elevation="15dp"
     android:background="@drawable/apps_list_bg"
-    android:visibility="gone"
-    android:focusable="true"
-    android:descendantFocusability="afterDescendants" />
\ No newline at end of file
+    android:visibility="gone">
+    <EditText
+        android:id="@+id/app_search_box"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:padding="16dp"
+        android:hint="@string/apps_view_search_bar_hint"
+        android:maxLines="1"
+        android:singleLine="true"
+        android:scrollHorizontally="true"
+        android:gravity="fill_horizontal"
+        android:textSize="16sp"
+        android:textColor="#4c4c4c"
+        android:textColorHint="#9c9c9c"
+        android:imeOptions="flagNoExtractUi"
+        android:background="@drawable/apps_list_search_bg"
+        android:elevation="4dp" />
+    <com.android.launcher3.AppsContainerRecyclerView
+        android:id="@+id/apps_list_view"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_gravity="center"
+        android:paddingTop="12dp"
+        android:paddingBottom="12dp"
+        android:clipToPadding="false"
+        android:scrollbars="vertical"
+        android:scrollbarThumbVertical="@drawable/apps_list_scrollbar_thumb"
+        android:focusable="true"
+        android:descendantFocusability="afterDescendants" />
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/apps_view.xml b/res/layout/apps_view.xml
index 19ad3d2..c1bae63 100644
--- a/res/layout/apps_view.xml
+++ b/res/layout/apps_view.xml
@@ -19,7 +19,7 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:padding="8dp"
-    android:background="#22000000"
+    android:background="@drawable/apps_customize_bg"
     android:descendantFocusability="afterDescendants">
     <include
         layout="@layout/apps_list_reveal_view" />
diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml
index f7ad0c4..d907587 100644
--- a/res/values-sw600dp/dimens.xml
+++ b/res/values-sw600dp/dimens.xml
@@ -18,6 +18,7 @@
     <dimen name="app_icon_size">64dp</dimen>
 
 <!-- Apps view -->
+    <dimen name="apps_container_width">480dp</dimen>
     <dimen name="apps_view_row_height">76dp</dimen>
 
 <!-- AppsCustomize -->
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 4e7c592..845b182 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -24,6 +24,7 @@
         <attr name="iconSizeOverride" format="dimension" />
         <attr name="iconPaddingOverride" format="dimension" />
         <attr name="textSizeOverride" format="dimension" />
+        <attr name="deferShadowGeneration" format="boolean" />
     </declare-styleable>
 
     <!-- Page Indicator specific attributes. -->
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 2daf9fe..590a887 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -36,4 +36,8 @@
     <color name="outline_color">#FFFFFFFF</color>
     <color name="widget_text_panel">#FF374248</color>
 
+<!-- Apps view -->
+    <color name="apps_view_scrollbar_thumb_color">#009688</color>
+    <color name="apps_view_section_text_color">#009688</color>
+
 </resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 013bd92..9b4c560 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -47,7 +47,13 @@
     <dimen name="toolbar_button_horizontal_padding">12dip</dimen>
 
 <!-- Apps view -->
+    <dimen name="apps_container_width">0dp</dimen>
+    <dimen name="apps_grid_view_start_margin">52dp</dimen>
     <dimen name="apps_view_row_height">64dp</dimen>
+    <dimen name="apps_view_section_text_size">24sp</dimen>
+    <dimen name="apps_view_fast_scroll_gutter_size">48dp</dimen>
+    <dimen name="apps_view_fast_scroll_popup_size">64dp</dimen>
+    <dimen name="apps_view_fast_scroll_text_size">48dp</dimen>
 
 <!-- AllApps/Customize/AppsCustomize -->
     <!-- The height of the tab bar - if this changes, we should update the
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 74b8814..0d113db 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -71,6 +71,10 @@
          drop if there are multiple choices. [CHAR_LIMIT=35] -->
     <string name="external_drop_widget_pick_title">Choose widget to create</string>
 
+    <!-- Apps view -->
+    <!-- Search bar text in the apps view. [CHAR_LIMIT=50] -->
+    <string name="apps_view_search_bar_hint">Search Apps</string>
+
     <!-- Folders -->
     <skip />
     <!-- Label of Folder name field in Rename folder dialog box -->