Moving all apps code into sub package.

- Renaming resources, dimens, etc to be more consistent
- Removing old AppsCustomize resources and other unused code

Change-Id: I15ce35e7cb7a9b9344fc7103963e4e4c9e45d89a
This commit is contained in:
Winson Chung
2015-05-22 11:12:27 -07:00
parent c6205603ef
commit 5f4e0fdd2e
43 changed files with 292 additions and 322 deletions
@@ -16,7 +16,7 @@
--> -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"> android:shape="rectangle">
<solid android:color="@color/apps_view_scrollbar_thumb_color" /> <solid android:color="@color/all_apps_scrollbar_thumb_color" />
<size <size
android:width="64dp" android:width="64dp"
android:height="64dp" /> android:height="64dp" />
@@ -16,7 +16,7 @@
--> -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"> android:shape="rectangle">
<solid android:color="@color/apps_view_scrollbar_thumb_color" /> <solid android:color="@color/all_apps_scrollbar_thumb_color" />
<size <size
android:width="64dp" android:width="64dp"
android:height="64dp" /> android:height="64dp" />
@@ -16,6 +16,6 @@
--> -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"> android:shape="rectangle">
<solid android:color="@color/apps_view_scrollbar_thumb_color" /> <solid android:color="@color/all_apps_scrollbar_thumb_color" />
<size android:width="@dimen/apps_view_fast_scroll_bar_width" /> <size android:width="@dimen/all_apps_fast_scroll_bar_width" />
</shape> </shape>
-23
View File
@@ -1,23 +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.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/quantum_panel_bg_color" />
<corners
android:bottomLeftRadius="2dp"
android:bottomRightRadius="2dp" />
</shape>
+1 -1
View File
@@ -61,7 +61,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:visibility="invisible" /> android:visibility="invisible" />
<include layout="@layout/apps_view" <include layout="@layout/all_apps"
android:id="@+id/apps_view" android:id="@+id/apps_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
+1 -1
View File
@@ -71,7 +71,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:visibility="invisible" /> android:visibility="invisible" />
<include layout="@layout/apps_view" <include layout="@layout/all_apps"
android:id="@+id/apps_view" android:id="@+id/apps_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@@ -13,21 +13,21 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<com.android.launcher3.AppsContainerView <com.android.launcher3.allapps.AllAppsContainerView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/apps_view" android:id="@+id/apps_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:padding="@dimen/apps_container_inset" android:padding="@dimen/all_apps_container_inset"
android:descendantFocusability="afterDescendants"> android:descendantFocusability="afterDescendants">
<include <include
layout="@layout/apps_reveal_view" layout="@layout/all_apps_reveal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center" /> android:layout_gravity="center" />
<include <include
layout="@layout/apps_list_view" layout="@layout/all_apps_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center" /> android:layout_gravity="center" />
</com.android.launcher3.AppsContainerView> </com.android.launcher3.allapps.AllAppsContainerView>
+1 -1
View File
@@ -71,7 +71,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:visibility="invisible" /> android:visibility="invisible" />
<include layout="@layout/apps_view" <include layout="@layout/all_apps"
android:id="@+id/apps_view" android:id="@+id/apps_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@@ -16,20 +16,20 @@
<!-- The top and bottom paddings are defined in this container, but since we want <!-- The top and bottom paddings are defined in this container, but since we want
the list view to span the full width (for touch interception purposes), we the list view to span the full width (for touch interception purposes), we
will bake the left/right padding into that view's background itself. --> will bake the left/right padding into that view's background itself. -->
<com.android.launcher3.AppsContainerView <com.android.launcher3.allapps.AllAppsContainerView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/apps_view" android:id="@+id/apps_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:descendantFocusability="afterDescendants"> android:descendantFocusability="afterDescendants">
<include <include
layout="@layout/apps_reveal_view" layout="@layout/all_apps_reveal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center" /> android:layout_gravity="center" />
<include <include
layout="@layout/apps_list_view" layout="@layout/all_apps_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center" /> android:layout_gravity="center" />
</com.android.launcher3.AppsContainerView> </com.android.launcher3.allapps.AllAppsContainerView>
@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<com.android.launcher3.AppsRecyclerViewContainer <com.android.launcher3.allapps.AllAppsRecyclerViewContainerView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/apps_list" android:id="@+id/apps_list"
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -23,12 +23,12 @@
android:focusableInTouchMode="true" android:focusableInTouchMode="true"
android:visibility="gone" > android:visibility="gone" >
<com.android.launcher3.AppsContainerRecyclerView <com.android.launcher3.allapps.AllAppsRecyclerView
android:id="@+id/apps_list_view" android:id="@+id/apps_list_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center_horizontal|top" android:layout_gravity="center_horizontal|top"
android:layout_marginTop="@dimen/apps_search_bar_height" android:layout_marginTop="@dimen/all_apps_search_bar_height"
android:clipToPadding="false" android:clipToPadding="false"
android:descendantFocusability="afterDescendants" android:descendantFocusability="afterDescendants"
android:focusable="true" /> android:focusable="true" />
@@ -37,7 +37,7 @@
android:id="@+id/prediction_bar" android:id="@+id/prediction_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/apps_search_bar_height" android:layout_marginTop="@dimen/all_apps_search_bar_height"
android:orientation="horizontal" android:orientation="horizontal"
android:descendantFocusability="afterDescendants" android:descendantFocusability="afterDescendants"
android:focusable="true" android:focusable="true"
@@ -49,8 +49,8 @@
<FrameLayout <FrameLayout
android:id="@+id/header" android:id="@+id/header"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/apps_search_bar_height" android:layout_height="@dimen/all_apps_search_bar_height"
android:background="@drawable/apps_search_bg" > android:background="@drawable/all_apps_search_bg" >
<LinearLayout <LinearLayout
android:id="@+id/app_search_container" android:id="@+id/app_search_container"
@@ -71,14 +71,14 @@
android:paddingTop="13dp" android:paddingTop="13dp"
android:src="@drawable/ic_arrow_back_grey" /> android:src="@drawable/ic_arrow_back_grey" />
<com.android.launcher3.AppsContainerSearchEditTextView <com.android.launcher3.allapps.AllAppsSearchEditView
android:id="@+id/app_search_box" android:id="@+id/apps_search_box"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:focusableInTouchMode="true" android:focusableInTouchMode="true"
android:gravity="fill_horizontal" android:gravity="fill_horizontal"
android:hint="@string/apps_view_search_bar_hint" android:hint="@string/all_apps_search_bar_hint"
android:imeOptions="actionDone|flagNoExtractUi" android:imeOptions="actionDone|flagNoExtractUi"
android:maxLines="1" android:maxLines="1"
android:paddingBottom="16dp" android:paddingBottom="16dp"
@@ -98,10 +98,10 @@
android:layout_gravity="end|center_vertical" android:layout_gravity="end|center_vertical"
android:layout_marginEnd="6dp" android:layout_marginEnd="6dp"
android:layout_marginRight="6dp" android:layout_marginRight="6dp"
android:contentDescription="@string/apps_view_search_bar_hint" android:contentDescription="@string/all_apps_search_bar_hint"
android:paddingBottom="13dp" android:paddingBottom="13dp"
android:paddingTop="13dp" android:paddingTop="13dp"
android:src="@drawable/ic_search_grey" /> android:src="@drawable/ic_search_grey" />
</FrameLayout> </FrameLayout>
</com.android.launcher3.AppsRecyclerViewContainer> </com.android.launcher3.allapps.AllAppsRecyclerViewContainerView>
@@ -21,7 +21,7 @@
android:gravity="center" android:gravity="center"
android:paddingTop="24dp" android:paddingTop="24dp"
android:paddingBottom="24dp" android:paddingBottom="24dp"
android:paddingRight="@dimen/apps_grid_view_start_margin" android:paddingRight="@dimen/all_apps_grid_view_start_margin"
android:textSize="16sp" android:textSize="16sp"
android:textColor="#4c4c4c" android:textColor="#4c4c4c"
android:focusable="false" /> android:focusable="false" />
@@ -21,8 +21,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="left|center_vertical" android:layout_gravity="left|center_vertical"
android:paddingTop="@dimen/apps_icon_top_bottom_padding" android:paddingTop="@dimen/all_apps_icon_top_bottom_padding"
android:paddingBottom="@dimen/apps_icon_top_bottom_padding" android:paddingBottom="@dimen/all_apps_icon_top_bottom_padding"
android:focusable="true" android:focusable="true"
android:background="@drawable/focusable_view_bg" android:background="@drawable/focusable_view_bg"
launcher:iconDisplay="all_apps" /> launcher:iconDisplay="all_apps" />
+1 -1
View File
@@ -34,7 +34,7 @@
android:focusable="false" android:focusable="false"
android:visibility="invisible" /> android:visibility="invisible" />
<com.android.launcher3.widget.WidgetsContainerRecyclerView <com.android.launcher3.widget.WidgetsRecyclerView
android:id="@+id/widgets_list_view" android:id="@+id/widgets_list_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
-18
View File
@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 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.
-->
<resources>
</resources>
+5 -5
View File
@@ -17,11 +17,11 @@
<resources> <resources>
<dimen name="app_icon_size">64dp</dimen> <dimen name="app_icon_size">64dp</dimen>
<!-- Apps view --> <!-- All Apps -->
<dimen name="apps_container_inset">18dp</dimen> <dimen name="all_apps_container_inset">18dp</dimen>
<dimen name="apps_grid_view_start_margin">0dp</dimen> <dimen name="all_apps_grid_view_start_margin">0dp</dimen>
<dimen name="apps_view_section_text_size">26sp</dimen> <dimen name="all_apps_grid_section_text_size">26sp</dimen>
<dimen name="apps_icon_top_bottom_padding">12dp</dimen> <dimen name="all_apps_icon_top_bottom_padding">12dp</dimen>
<!-- Cling --> <!-- Cling -->
<dimen name="cling_migration_logo_height">400dp</dimen> <dimen name="cling_migration_logo_height">400dp</dimen>
-21
View File
@@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
* Copyright (C) 2012 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.
*/
-->
<resources>
</resources>
-4
View File
@@ -15,10 +15,6 @@
--> -->
<resources> <resources>
<!-- AppsCustomize -->
<integer name="apps_customize_widget_cell_count_x">4</integer>
<integer name="apps_customize_widget_cell_count_y">2</integer>
<!-- the area at the edge of the screen that makes the workspace go left <!-- the area at the edge of the screen that makes the workspace go left
or right while you're dragging. --> or right while you're dragging. -->
<dimen name="scroll_zone">100dip</dimen> <dimen name="scroll_zone">100dip</dimen>
+1 -1
View File
@@ -2,7 +2,7 @@
<bool name="config_largeHeap">true</bool> <bool name="config_largeHeap">true</bool>
<bool name="is_large_tablet">true</bool> <bool name="is_large_tablet">true</bool>
<!-- AllApps/Customize/AppsCustomize --> <!-- All Apps & Widgets -->
<!-- Out of 100, the percent to shrink the workspace during spring loaded mode. --> <!-- Out of 100, the percent to shrink the workspace during spring loaded mode. -->
<integer name="config_workspaceSpringLoadShrinkPercentage">90</integer> <integer name="config_workspaceSpringLoadShrinkPercentage">90</integer>
+4 -2
View File
@@ -16,8 +16,10 @@
<resources> <resources>
<dimen name="app_icon_size">72dp</dimen> <dimen name="app_icon_size">72dp</dimen>
<dimen name="apps_search_bar_height">54dp</dimen>
<dimen name="apps_icon_top_bottom_padding">16dp</dimen> <!-- All Apps -->
<dimen name="all_apps_search_bar_height">54dp</dimen>
<dimen name="all_apps_icon_top_bottom_padding">16dp</dimen>
<!-- QSB --> <!-- QSB -->
<dimen name="toolbar_button_vertical_padding">8dip</dimen> <dimen name="toolbar_button_vertical_padding">8dip</dimen>
-27
View File
@@ -72,16 +72,6 @@
<attr name="maxGap" format="dimension" /> <attr name="maxGap" format="dimension" />
</declare-styleable> </declare-styleable>
<!-- StrokedTextView specific attributes. -->
<declare-styleable name="StrokedTextView">
<!-- The color of the stroke outline -->
<attr name="strokeColor" format="color" />
<!-- The color of the text -->
<attr name="strokeTextColor" format="color" />
<!-- The width of the stroke -->
<attr name="strokeWidth" format="float" />
</declare-styleable>
<!-- PagedView specific attributes. These attributes are used to customize <!-- PagedView specific attributes. These attributes are used to customize
a PagedView view in XML files. --> a PagedView view in XML files. -->
<declare-styleable name="PagedView"> <declare-styleable name="PagedView">
@@ -93,23 +83,6 @@
<attr name="pageIndicator" format="reference" /> <attr name="pageIndicator" format="reference" />
</declare-styleable> </declare-styleable>
<!-- AppsCustomizePagedView specific attributes. These attributes are used to
customize an AppsCustomizePagedView in xml files. -->
<declare-styleable name="AppsCustomizePagedView">
<!-- Max number of cells of applications horizontally -->
<attr name="maxAppCellCountX" format="integer" />
<!-- Max number of cells of applications vertically -->
<attr name="maxAppCellCountY" format="integer" />
<!-- Horizontal spacing between widgets and wallpapers -->
<attr name="widgetCellWidthGap" format="dimension" />
<!-- Vertical spacing between widgets -->
<attr name="widgetCellHeightGap" format="dimension" />
<!-- Number of widgets horizontally -->
<attr name="widgetCountX" format="integer" />
<!-- Number of widgets vertically -->
<attr name="widgetCountY" format="integer" />
</declare-styleable>
<!-- XML attributes used by default_workspace.xml --> <!-- XML attributes used by default_workspace.xml -->
<declare-styleable name="Favorite"> <declare-styleable name="Favorite">
<attr name="className" format="string" /> <attr name="className" format="string" />
+3 -3
View File
@@ -36,9 +36,9 @@
<color name="outline_color">#FFFFFFFF</color> <color name="outline_color">#FFFFFFFF</color>
<color name="widget_text_panel">#FF374248</color> <color name="widget_text_panel">#FF374248</color>
<!-- Apps view --> <!-- All Apps -->
<color name="apps_view_scrollbar_thumb_color">#009688</color> <color name="all_apps_scrollbar_thumb_color">#009688</color>
<color name="apps_view_section_text_color">#009688</color> <color name="all_apps_grid_section_text_color">#009688</color>
<!-- Widgets view --> <!-- Widgets view -->
<color name="widgets_view_section_text_color">#FFFFFF</color> <color name="widgets_view_section_text_color">#FFFFFF</color>
+7 -11
View File
@@ -1,8 +1,5 @@
<resources> <resources>
<!-- Dynamic Grid --> <!-- Dynamic Grid -->
<integer name="config_dynamic_grid_max_long_edge_cell_count">6</integer>
<integer name="config_dynamic_grid_max_short_edge_cell_count">5</integer>
<integer name="config_dynamic_grid_min_edge_cell_count">3</integer>
<!-- Out of 100, the percent of space the overview bar should try and take vertically. --> <!-- Out of 100, the percent of space the overview bar should try and take vertically. -->
<integer name="config_dynamic_grid_overview_icon_zone_percentage">20</integer> <integer name="config_dynamic_grid_overview_icon_zone_percentage">20</integer>
<!-- Out of 100, the percent to shrink the workspace during overview mode. --> <!-- Out of 100, the percent to shrink the workspace during overview mode. -->
@@ -24,21 +21,20 @@
<!-- DragController --> <!-- DragController -->
<integer name="config_flingToDeleteMinVelocity">-1500</integer> <integer name="config_flingToDeleteMinVelocity">-1500</integer>
<!-- AllApps/Customize/AppsCustomize --> <!-- AllApps & Launcher transitions -->
<!-- The alpha of the AppsCustomize bg in spring loaded mode --> <!-- The alpha of the AppsCustomize bg in spring loaded mode -->
<integer name="config_workspaceScrimAlpha">55</integer> <integer name="config_workspaceScrimAlpha">55</integer>
<integer name="config_workspaceUnshrinkTime">100</integer> <integer name="config_allAppsTransitionTime">100</integer>
<integer name="config_overviewTransitionTime">250</integer> <integer name="config_overviewTransitionTime">250</integer>
<!-- Out of 100, the percent to shrink the workspace during spring loaded mode. --> <!-- Out of 100, the percent to shrink the workspace during spring loaded mode. -->
<integer name="config_workspaceSpringLoadShrinkPercentage">80</integer> <integer name="config_workspaceSpringLoadShrinkPercentage">80</integer>
<!-- Fade/zoom in/out duration & scale in the AllApps transition. <!-- Fade/zoom in/out duration & scale in a Launcher overlay transition.
Note: This should be less than the workspaceShrinkTime as they happen together. --> Note: This should be less than the config_overlayTransitionTime as they happen together. -->
<integer name="config_appsCustomizeRevealTime">220</integer> <integer name="config_overlayRevealTime">220</integer>
<integer name="config_appsCustomizeWorkspaceShrinkTime">300</integer> <integer name="config_overlayTransitionTime">300</integer>
<integer name="config_overlayItemsAlphaStagger">60</integer>
<integer name="config_appsCustomizeItemsAlphaStagger">60</integer>
<!-- This constant stores the ratio of the all apps button drawable which <!-- This constant stores the ratio of the all apps button drawable which
is used for internal (baked-in) padding --> is used for internal (baked-in) padding -->
+33 -34
View File
@@ -15,13 +15,14 @@
--> -->
<resources> <resources>
<dimen name="app_icon_size">48dp</dimen>
<!-- Dynamic Grid --> <!-- Dynamic Grid -->
<dimen name="dynamic_grid_edge_margin">6dp</dimen> <dimen name="dynamic_grid_edge_margin">6dp</dimen>
<dimen name="dynamic_grid_search_bar_max_width">500dp</dimen> <dimen name="dynamic_grid_search_bar_max_width">500dp</dimen>
<dimen name="dynamic_grid_search_bar_height">56dp</dimen> <dimen name="dynamic_grid_search_bar_height">56dp</dimen>
<dimen name="dynamic_grid_page_indicator_height">20dp</dimen> <dimen name="dynamic_grid_page_indicator_height">20dp</dimen>
<dimen name="dynamic_grid_icon_drawable_padding">4dp</dimen> <dimen name="dynamic_grid_icon_drawable_padding">4dp</dimen>
<dimen name="dynamic_grid_all_apps_cell_padding">18dp</dimen>
<dimen name="dynamic_grid_workspace_page_spacing">8dp</dimen> <dimen name="dynamic_grid_workspace_page_spacing">8dp</dimen>
<dimen name="dynamic_grid_overview_min_icon_zone_height">80dp</dimen> <dimen name="dynamic_grid_overview_min_icon_zone_height">80dp</dimen>
<dimen name="dynamic_grid_overview_max_icon_zone_height">120dp</dimen> <dimen name="dynamic_grid_overview_max_icon_zone_height">120dp</dimen>
@@ -48,48 +49,29 @@
<dimen name="toolbar_button_vertical_padding">4dip</dimen> <dimen name="toolbar_button_vertical_padding">4dip</dimen>
<dimen name="toolbar_button_horizontal_padding">12dip</dimen> <dimen name="toolbar_button_horizontal_padding">12dip</dimen>
<!-- Apps view --> <!-- All Apps -->
<dimen name="apps_container_width">0dp</dimen>
<dimen name="apps_container_inset">8dp</dimen>
<dimen name="apps_grid_view_start_margin">56dp</dimen>
<dimen name="apps_grid_section_y_offset">8dp</dimen>
<dimen name="apps_view_section_text_size">24sp</dimen>
<dimen name="apps_view_fast_scroll_bar_width">4dp</dimen>
<dimen name="apps_view_fast_scroll_bar_min_height">64dp</dimen>
<dimen name="apps_view_fast_scroll_scrubber_touch_inset">-16dp</dimen>
<dimen name="apps_view_fast_scroll_popup_size">72dp</dimen>
<dimen name="apps_view_fast_scroll_text_size">48dp</dimen>
<dimen name="apps_search_bar_height">52dp</dimen>
<dimen name="apps_icon_top_bottom_padding">8dp</dimen>
<dimen name="apps_prediction_icon_top_bottom_padding">12dp</dimen>
<!-- Note: This needs to match the fixed insets for the search box. --> <!-- Note: This needs to match the fixed insets for the search box. -->
<dimen name="container_fixed_bounds_inset">8dp</dimen> <dimen name="container_fixed_bounds_inset">8dp</dimen>
<!-- AllApps/Customize/AppsCustomize --> <dimen name="all_apps_container_inset">8dp</dimen>
<dimen name="app_icon_size">48dp</dimen> <dimen name="all_apps_grid_view_start_margin">56dp</dimen>
<dimen name="all_apps_grid_section_y_offset">8dp</dimen>
<dimen name="all_apps_grid_section_text_size">24sp</dimen>
<dimen name="all_apps_search_bar_height">52dp</dimen>
<dimen name="all_apps_icon_top_bottom_padding">8dp</dimen>
<dimen name="all_apps_icon_left_right_padding">18dp</dimen>
<dimen name="all_apps_prediction_icon_top_bottom_padding">12dp</dimen>
<!-- Drag padding to add to the bottom of drop targets --> <dimen name="all_apps_fast_scroll_bar_width">4dp</dimen>
<dimen name="drop_target_drag_padding">14dp</dimen> <dimen name="all_apps_fast_scroll_bar_min_height">64dp</dimen>
<dimen name="drop_target_text_size">14sp</dimen> <dimen name="all_apps_fast_scroll_scrubber_touch_inset">-16dp</dimen>
<dimen name="all_apps_fast_scroll_popup_size">72dp</dimen>
<dimen name="all_apps_fast_scroll_text_size">48dp</dimen>
<dimen name="all_apps_header_max_elevation">4dp</dimen> <dimen name="all_apps_header_max_elevation">4dp</dimen>
<dimen name="all_apps_header_scroll_to_elevation">16dp</dimen> <dimen name="all_apps_header_scroll_to_elevation">16dp</dimen>
<dimen name="all_apps_header_shadow_height">6dp</dimen> <dimen name="all_apps_header_shadow_height">6dp</dimen>
<!-- Dragging -->
<!-- the area at the edge of the screen that makes the workspace go left
or right while you're dragging. -->
<dimen name="scroll_zone">20dp</dimen>
<!-- When dragging an item, how much bigger (fixed dps) the dragged view
should be. If 0, it will not be scaled at all. -->
<dimen name="dragViewScale">12dp</dimen>
<!-- Elevation for the drag view. It should be larger than elevation of all other drag sources
and drop targets like all-apps and folders -->
<dimen name="drag_elevation">30dp</dimen>
<!-- Widget tray --> <!-- Widget tray -->
<dimen name="widget_container_inset">8dp</dimen> <dimen name="widget_container_inset">8dp</dimen>
<dimen name="widget_preview_label_vertical_padding">8dp</dimen> <dimen name="widget_preview_label_vertical_padding">8dp</dimen>
@@ -109,6 +91,23 @@
<dimen name="shortcut_preview_padding_right">0dp</dimen> <dimen name="shortcut_preview_padding_right">0dp</dimen>
<dimen name="shortcut_preview_padding_top">0dp</dimen> <dimen name="shortcut_preview_padding_top">0dp</dimen>
<!-- Dragging -->
<!-- Drag padding to add to the bottom of drop targets -->
<dimen name="drop_target_drag_padding">14dp</dimen>
<dimen name="drop_target_text_size">14sp</dimen>
<!-- the area at the edge of the screen that makes the workspace go left
or right while you're dragging. -->
<dimen name="scroll_zone">20dp</dimen>
<!-- When dragging an item, how much bigger (fixed dps) the dragged view
should be. If 0, it will not be scaled at all. -->
<dimen name="dragViewScale">12dp</dimen>
<!-- Elevation for the drag view. It should be larger than elevation of all other drag sources
and drop targets like all-apps and folders -->
<dimen name="drag_elevation">30dp</dimen>
<!-- Theme --> <!-- Theme -->
<dimen name="quantum_panel_outer_padding">4dp</dimen> <dimen name="quantum_panel_outer_padding">4dp</dimen>
+5 -5
View File
@@ -47,20 +47,20 @@
<string name="toggle_weight_watcher">Show Mem</string> <string name="toggle_weight_watcher">Show Mem</string>
<!-- AppsCustomize pane --> <!-- Widgets -->
<!-- Message to tell the user to press and hold on a widget to add it [CHAR_LIMIT=50] --> <!-- Message to tell the user to press and hold on a widget to add it [CHAR_LIMIT=50] -->
<string name="long_press_widget_to_add">Touch &amp; hold to pick up a widget.</string> <string name="long_press_widget_to_add">Touch &amp; hold to pick up a widget.</string>
<!-- The format string for the dimensions of a widget in the drawer --> <!-- The format string for the dimensions of a widget in the drawer -->
<!-- There is a special version of this format string for Farsi --> <!-- There is a special version of this format string for Farsi -->
<string name="widget_dims_format">%1$d \u00d7 %2$d</string> <string name="widget_dims_format">%1$d \u00d7 %2$d</string>
<!-- Apps view --> <!-- All Apps -->
<!-- Search bar text in the apps view. [CHAR_LIMIT=50] --> <!-- Search bar text in the apps view. [CHAR_LIMIT=50] -->
<string name="apps_view_search_bar_hint">Search Apps</string> <string name="all_apps_search_bar_hint">Search Apps</string>
<!-- Loading apps text. [CHAR_LIMIT=50] --> <!-- Loading apps text. [CHAR_LIMIT=50] -->
<string name="loading_apps_message">Loading Apps&#8230;</string> <string name="all_apps_loading_message">Loading Apps&#8230;</string>
<!-- No-search-results text. [CHAR_LIMIT=50] --> <!-- No-search-results text. [CHAR_LIMIT=50] -->
<string name="apps_view_no_search_results">No Apps found matching \"<xliff:g id="query" example="Android">%1$s</xliff:g>\"</string> <string name="all_apps_no_search_results">No Apps found matching \"<xliff:g id="query" example="Android">%1$s</xliff:g>\"</string>
<!-- Drag and drop --> <!-- Drag and drop -->
<skip /> <skip />
+1 -1
View File
@@ -38,7 +38,7 @@ public class AppInfo extends ItemInfo {
/** /**
* The intent used to start the application. * The intent used to start the application.
*/ */
Intent intent; public Intent intent;
/** /**
* A bitmap version of the application icon. * A bitmap version of the application icon.
@@ -26,7 +26,7 @@ import com.android.launcher3.util.Thunk;
* A base {@link RecyclerView}, which will NOT intercept a touch sequence unless the scrolling * A base {@link RecyclerView}, which will NOT intercept a touch sequence unless the scrolling
* velocity is below a predefined threshold. * velocity is below a predefined threshold.
*/ */
public class BaseContainerRecyclerView extends RecyclerView public class BaseRecyclerView extends RecyclerView
implements RecyclerView.OnItemTouchListener { implements RecyclerView.OnItemTouchListener {
private static final int SCROLL_DELTA_THRESHOLD_DP = 4; private static final int SCROLL_DELTA_THRESHOLD_DP = 4;
@@ -35,15 +35,15 @@ public class BaseContainerRecyclerView extends RecyclerView
@Thunk int mDy = 0; @Thunk int mDy = 0;
private float mDeltaThreshold; private float mDeltaThreshold;
public BaseContainerRecyclerView(Context context) { public BaseRecyclerView(Context context) {
this(context, null); this(context, null);
} }
public BaseContainerRecyclerView(Context context, AttributeSet attrs) { public BaseRecyclerView(Context context, AttributeSet attrs) {
this(context, attrs, 0); this(context, attrs, 0);
} }
public BaseContainerRecyclerView(Context context, AttributeSet attrs, int defStyleAttr) { public BaseRecyclerView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
mDeltaThreshold = getResources().getDisplayMetrics().density * SCROLL_DELTA_THRESHOLD_DP; mDeltaThreshold = getResources().getDisplayMetrics().density * SCROLL_DELTA_THRESHOLD_DP;
+12 -21
View File
@@ -70,7 +70,7 @@ public class DeviceProfile {
public int iconSizePx; public int iconSizePx;
public int iconTextSizePx; public int iconTextSizePx;
public int iconDrawablePaddingPx; public int iconDrawablePaddingPx;
private final int iconDrawablePaddingOriginalPx; public int iconDrawablePaddingOriginalPx;
public int cellWidthPx; public int cellWidthPx;
public int cellHeightPx; public int cellHeightPx;
@@ -88,11 +88,8 @@ public class DeviceProfile {
private int hotseatBarHeightPx; private int hotseatBarHeightPx;
// All apps // All apps
private int allAppsCellWidthPx; public int allAppsNumCols;
public int allAppsCellHeightPx; public int allAppsNumPredictiveCols;
private final int allAppsCellPaddingPx;
public int appsViewNumCols;
public int appsViewNumPredictiveCols;
public int allAppsButtonVisualSize; public int allAppsButtonVisualSize;
public final int allAppsIconSizePx; public final int allAppsIconSizePx;
public final int allAppsIconTextSizePx; public final int allAppsIconTextSizePx;
@@ -129,8 +126,6 @@ public class DeviceProfile {
res.getDimensionPixelSize(R.dimen.dynamic_grid_page_indicator_height); res.getDimensionPixelSize(R.dimen.dynamic_grid_page_indicator_height);
defaultPageSpacingPx = defaultPageSpacingPx =
res.getDimensionPixelSize(R.dimen.dynamic_grid_workspace_page_spacing); res.getDimensionPixelSize(R.dimen.dynamic_grid_workspace_page_spacing);
allAppsCellPaddingPx =
res.getDimensionPixelSize(R.dimen.dynamic_grid_all_apps_cell_padding);
overviewModeMinIconZoneHeightPx = overviewModeMinIconZoneHeightPx =
res.getDimensionPixelSize(R.dimen.dynamic_grid_overview_min_icon_zone_height); res.getDimensionPixelSize(R.dimen.dynamic_grid_overview_min_icon_zone_height);
overviewModeMaxIconZoneHeightPx = overviewModeMaxIconZoneHeightPx =
@@ -143,7 +138,6 @@ public class DeviceProfile {
res.getInteger(R.integer.config_dynamic_grid_overview_icon_zone_percentage) / 100f; res.getInteger(R.integer.config_dynamic_grid_overview_icon_zone_percentage) / 100f;
overviewModeScaleFactor = overviewModeScaleFactor =
res.getInteger(R.integer.config_dynamic_grid_overview_scale_percentage) / 100f; res.getInteger(R.integer.config_dynamic_grid_overview_scale_percentage) / 100f;
iconDrawablePaddingOriginalPx = iconDrawablePaddingOriginalPx =
res.getDimensionPixelSize(R.dimen.dynamic_grid_icon_drawable_padding); res.getDimensionPixelSize(R.dimen.dynamic_grid_icon_drawable_padding);
@@ -230,25 +224,22 @@ public class DeviceProfile {
folderBackgroundOffset = -edgeMarginPx; folderBackgroundOffset = -edgeMarginPx;
folderIconSizePx = iconSizePx + 2 * -folderBackgroundOffset; folderIconSizePx = iconSizePx + 2 * -folderBackgroundOffset;
// All Apps updateAppsViewNumCols(res, 0);
allAppsCellWidthPx = allAppsIconSizePx;
allAppsCellHeightPx = allAppsIconSizePx + drawablePadding + allAppsIconTextSizePx;
int appsContainerViewWidthPx = res.getDimensionPixelSize(R.dimen.apps_container_width);
updateAppsViewNumCols(res, appsContainerViewWidthPx);
} }
public boolean updateAppsViewNumCols(Resources res, int containerWidth) { public boolean updateAppsViewNumCols(Resources res, int containerWidth) {
int appsViewLeftMarginPx = int appsViewLeftMarginPx =
res.getDimensionPixelSize(R.dimen.apps_grid_view_start_margin); res.getDimensionPixelSize(R.dimen.all_apps_grid_view_start_margin);
int allAppsCellPaddingPx =
res.getDimensionPixelSize(R.dimen.all_apps_icon_left_right_padding);
int availableAppsWidthPx = (containerWidth > 0) ? containerWidth : availableWidthPx; int availableAppsWidthPx = (containerWidth > 0) ? containerWidth : availableWidthPx;
int numAppsCols = (availableAppsWidthPx - appsViewLeftMarginPx) / int numAppsCols = (availableAppsWidthPx - appsViewLeftMarginPx) /
(allAppsCellWidthPx + 2 * allAppsCellPaddingPx); (allAppsIconSizePx + 2 * allAppsCellPaddingPx);
int numPredictiveAppCols = isPhone ? 4 : numAppsCols; int numPredictiveAppCols = isPhone ? 4 : numAppsCols;
if ((numAppsCols != appsViewNumCols) || if ((numAppsCols != allAppsNumCols) ||
(numPredictiveAppCols != appsViewNumPredictiveCols)) { (numPredictiveAppCols != allAppsNumPredictiveCols)) {
appsViewNumCols = numAppsCols; allAppsNumCols = numAppsCols;
appsViewNumPredictiveCols = numPredictiveAppCols; allAppsNumPredictiveCols = numPredictiveAppCols;
return true; return true;
} }
return false; return false;
+6 -15
View File
@@ -98,6 +98,7 @@ import android.widget.Toast;
import com.android.launcher3.DropTarget.DragObject; import com.android.launcher3.DropTarget.DragObject;
import com.android.launcher3.PagedView.PageSwitchListener; import com.android.launcher3.PagedView.PageSwitchListener;
import com.android.launcher3.accessibility.LauncherAccessibilityDelegate; import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
import com.android.launcher3.allapps.AllAppsContainerView;
import com.android.launcher3.compat.AppWidgetManagerCompat; import com.android.launcher3.compat.AppWidgetManagerCompat;
import com.android.launcher3.compat.LauncherActivityInfoCompat; import com.android.launcher3.compat.LauncherActivityInfoCompat;
import com.android.launcher3.compat.LauncherAppsCompat; import com.android.launcher3.compat.LauncherAppsCompat;
@@ -272,7 +273,7 @@ public class Launcher extends Activity
private SearchDropTargetBar mSearchDropTargetBar; private SearchDropTargetBar mSearchDropTargetBar;
// Main container view for the all apps screen. // Main container view for the all apps screen.
@Thunk AppsContainerView mAppsView; @Thunk AllAppsContainerView mAppsView;
// Main container view and the model for the widget tray screen. // Main container view and the model for the widget tray screen.
@Thunk WidgetsContainerView mWidgetsView; @Thunk WidgetsContainerView mWidgetsView;
@@ -1475,7 +1476,7 @@ public class Launcher extends Activity
mDragLayer.findViewById(R.id.search_drop_target_bar); mDragLayer.findViewById(R.id.search_drop_target_bar);
// Setup Apps // Setup Apps
mAppsView = (AppsContainerView) findViewById(R.id.apps_view); mAppsView = (AllAppsContainerView) findViewById(R.id.apps_view);
if (isAllAppsSearchOverridden()) { if (isAllAppsSearchOverridden()) {
mAppsView.hideHeaderBar(); mAppsView.hideHeaderBar();
} }
@@ -1524,8 +1525,6 @@ public class Launcher extends Activity
* Creates a view representing a shortcut. * Creates a view representing a shortcut.
* *
* @param info The data structure describing the shortcut. * @param info The data structure describing the shortcut.
*
* @return A View inflated from R.layout.application.
*/ */
View createShortcut(ShortcutInfo info) { View createShortcut(ShortcutInfo info) {
return createShortcut((ViewGroup) mWorkspace.getChildAt(mWorkspace.getCurrentPage()), info); return createShortcut((ViewGroup) mWorkspace.getChildAt(mWorkspace.getCurrentPage()), info);
@@ -1540,7 +1539,7 @@ public class Launcher extends Activity
* @return A View inflated from layoutResId. * @return A View inflated from layoutResId.
*/ */
public View createShortcut(ViewGroup parent, ShortcutInfo info) { public View createShortcut(ViewGroup parent, ShortcutInfo info) {
BubbleTextView favorite = (BubbleTextView) mInflater.inflate(R.layout.application, BubbleTextView favorite = (BubbleTextView) mInflater.inflate(R.layout.app_icon,
parent, false); parent, false);
favorite.applyFromShortcutInfo(info, mIconCache); favorite.applyFromShortcutInfo(info, mIconCache);
favorite.setCompoundDrawablePadding(mDeviceProfile.iconDrawablePaddingPx); favorite.setCompoundDrawablePadding(mDeviceProfile.iconDrawablePaddingPx);
@@ -1875,7 +1874,7 @@ public class Launcher extends Activity
return mDragLayer; return mDragLayer;
} }
public AppsContainerView getAppsView() { public AllAppsContainerView getAppsView() {
return mAppsView; return mAppsView;
} }
@@ -3347,7 +3346,7 @@ public class Launcher extends Activity
} }
} }
protected void showWorkspace(boolean animated) { public void showWorkspace(boolean animated) {
showWorkspace(WorkspaceStateTransitionAnimation.SCROLL_TO_CURRENT_PAGE, animated, null, showWorkspace(WorkspaceStateTransitionAnimation.SCROLL_TO_CURRENT_PAGE, animated, null,
true); true);
} }
@@ -4813,14 +4812,6 @@ public class Launcher extends Activity
} }
} }
interface LauncherTransitionable {
View getContent();
void onLauncherTransitionPrepare(Launcher l, boolean animated, boolean toWorkspace);
void onLauncherTransitionStart(Launcher l, boolean animated, boolean toWorkspace);
void onLauncherTransitionStep(Launcher l, float t);
void onLauncherTransitionEnd(Launcher l, boolean animated, boolean toWorkspace);
}
interface DebugIntents { interface DebugIntents {
static final String DELETE_DATABASE = "com.android.launcher3.action.DELETE_DATABASE"; static final String DELETE_DATABASE = "com.android.launcher3.action.DELETE_DATABASE";
static final String MIGRATE_DATABASE = "com.android.launcher3.action.MIGRATE_DATABASE"; static final String MIGRATE_DATABASE = "com.android.launcher3.action.MIGRATE_DATABASE";
@@ -23,14 +23,13 @@ import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder; import android.animation.PropertyValuesHolder;
import android.animation.TimeInterpolator; import android.animation.TimeInterpolator;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.res.Resources; import android.content.res.Resources;
import android.os.Build;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.view.ViewAnimationUtils; import android.view.ViewAnimationUtils;
import android.view.animation.AccelerateInterpolator; import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator; import android.view.animation.DecelerateInterpolator;
import com.android.launcher3.allapps.AllAppsContainerView;
import com.android.launcher3.util.Thunk; import com.android.launcher3.util.Thunk;
import com.android.launcher3.widget.WidgetsContainerView; import com.android.launcher3.widget.WidgetsContainerView;
import java.util.HashMap; import java.util.HashMap;
@@ -129,7 +128,7 @@ public class LauncherStateTransitionAnimation {
* Starts an animation to the apps view. * Starts an animation to the apps view.
*/ */
public void startAnimationToAllApps(final boolean animated) { public void startAnimationToAllApps(final boolean animated) {
final AppsContainerView toView = mLauncher.getAppsView(); final AllAppsContainerView toView = mLauncher.getAppsView();
PrivateTransitionCallbacks cb = new PrivateTransitionCallbacks() { PrivateTransitionCallbacks cb = new PrivateTransitionCallbacks() {
private int[] mAllAppsToPanelDelta; private int[] mAllAppsToPanelDelta;
@@ -233,9 +232,9 @@ public class LauncherStateTransitionAnimation {
final boolean hideSearchBar, final PrivateTransitionCallbacks pCb) { final boolean hideSearchBar, final PrivateTransitionCallbacks pCb) {
final Resources res = mLauncher.getResources(); final Resources res = mLauncher.getResources();
final boolean material = Utilities.isLmpOrAbove(); final boolean material = Utilities.isLmpOrAbove();
final int revealDuration = res.getInteger(R.integer.config_appsCustomizeRevealTime); final int revealDuration = res.getInteger(R.integer.config_overlayRevealTime);
final int itemsAlphaStagger = final int itemsAlphaStagger =
res.getInteger(R.integer.config_appsCustomizeItemsAlphaStagger); res.getInteger(R.integer.config_overlayItemsAlphaStagger);
final View allAppsButtonView = mLauncher.getAllAppsButton(); final View allAppsButtonView = mLauncher.getAllAppsButton();
final View fromView = mLauncher.getWorkspace(); final View fromView = mLauncher.getWorkspace();
@@ -428,7 +427,7 @@ public class LauncherStateTransitionAnimation {
private void startAnimationToWorkspaceFromAllApps(final Launcher.State fromState, private void startAnimationToWorkspaceFromAllApps(final Launcher.State fromState,
final Workspace.State toWorkspaceState, final int toWorkspacePage, final Workspace.State toWorkspaceState, final int toWorkspacePage,
final boolean animated, final Runnable onCompleteRunnable) { final boolean animated, final Runnable onCompleteRunnable) {
AppsContainerView appsView = mLauncher.getAppsView(); AllAppsContainerView appsView = mLauncher.getAppsView();
PrivateTransitionCallbacks cb = new PrivateTransitionCallbacks() { PrivateTransitionCallbacks cb = new PrivateTransitionCallbacks() {
int[] mAllAppsToPanelDelta; int[] mAllAppsToPanelDelta;
@@ -530,9 +529,9 @@ public class LauncherStateTransitionAnimation {
final PrivateTransitionCallbacks pCb) { final PrivateTransitionCallbacks pCb) {
final Resources res = mLauncher.getResources(); final Resources res = mLauncher.getResources();
final boolean material = Utilities.isLmpOrAbove(); final boolean material = Utilities.isLmpOrAbove();
final int revealDuration = res.getInteger(R.integer.config_appsCustomizeRevealTime); final int revealDuration = res.getInteger(R.integer.config_overlayRevealTime);
final int itemsAlphaStagger = final int itemsAlphaStagger =
res.getInteger(R.integer.config_appsCustomizeItemsAlphaStagger); res.getInteger(R.integer.config_overlayItemsAlphaStagger);
final View allAppsButtonView = mLauncher.getAllAppsButton(); final View allAppsButtonView = mLauncher.getAllAppsButton();
final View toView = mLauncher.getWorkspace(); final View toView = mLauncher.getWorkspace();
@@ -0,0 +1,30 @@
/*
* 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.
*/
package com.android.launcher3;
import android.view.View;
/**
* An interface to get callbacks during a launcher transition.
*/
public interface LauncherTransitionable {
View getContent();
void onLauncherTransitionPrepare(Launcher l, boolean animated, boolean toWorkspace);
void onLauncherTransitionStart(Launcher l, boolean animated, boolean toWorkspace);
void onLauncherTransitionStep(Launcher l, float t);
void onLauncherTransitionEnd(Launcher l, boolean animated, boolean toWorkspace);
}
@@ -25,7 +25,6 @@ import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Handler; import android.os.Handler;
import android.os.Process;
import android.util.Log; import android.util.Log;
import android.util.LongSparseArray; import android.util.LongSparseArray;
import com.android.launcher3.compat.AppWidgetManagerCompat; import com.android.launcher3.compat.AppWidgetManagerCompat;
@@ -34,7 +33,6 @@ import com.android.launcher3.compat.UserManagerCompat;
import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.Thunk; import com.android.launcher3.util.Thunk;
import com.android.launcher3.widget.WidgetCell; import com.android.launcher3.widget.WidgetCell;
import junit.framework.Assert;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@@ -163,9 +163,9 @@ public class WorkspaceStateTransitionAnimation {
DeviceProfile grid = mLauncher.getDeviceProfile(); DeviceProfile grid = mLauncher.getDeviceProfile();
Resources res = launcher.getResources(); Resources res = launcher.getResources();
mAllAppsTransitionTime = res.getInteger(R.integer.config_workspaceUnshrinkTime); mAllAppsTransitionTime = res.getInteger(R.integer.config_allAppsTransitionTime);
mOverviewTransitionTime = res.getInteger(R.integer.config_overviewTransitionTime); mOverviewTransitionTime = res.getInteger(R.integer.config_overviewTransitionTime);
mOverlayTransitionTime = res.getInteger(R.integer.config_appsCustomizeWorkspaceShrinkTime); mOverlayTransitionTime = res.getInteger(R.integer.config_overlayTransitionTime);
mSpringLoadedShrinkFactor = mSpringLoadedShrinkFactor =
res.getInteger(R.integer.config_workspaceSpringLoadShrinkPercentage) / 100f; res.getInteger(R.integer.config_workspaceSpringLoadShrinkPercentage) / 100f;
mWorkspaceScrimAlpha = res.getInteger(R.integer.config_workspaceScrimAlpha) / 100f; mWorkspaceScrimAlpha = res.getInteger(R.integer.config_workspaceScrimAlpha) / 100f;
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.android.launcher3; package com.android.launcher3.allapps;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.annotation.TargetApi; import android.annotation.TargetApi;
@@ -22,6 +22,7 @@ import android.content.Context;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.Point; import android.graphics.Point;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable; import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.InsetDrawable; import android.graphics.drawable.InsetDrawable;
import android.os.Build; import android.os.Build;
@@ -40,7 +41,24 @@ import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.TextView; import android.widget.TextView;
import com.android.launcher3.AppInfo;
import com.android.launcher3.BaseContainerView;
import com.android.launcher3.BubbleTextView;
import com.android.launcher3.CellLayout;
import com.android.launcher3.CheckLongPressHelper;
import com.android.launcher3.DeleteDropTarget;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.DragSource;
import com.android.launcher3.DropTarget;
import com.android.launcher3.Folder;
import com.android.launcher3.Insettable;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherTransitionable;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace;
import com.android.launcher3.util.Thunk; import com.android.launcher3.util.Thunk;
import java.util.List; import java.util.List;
@@ -52,6 +70,7 @@ import java.util.regex.Pattern;
*/ */
interface HeaderElevationController { interface HeaderElevationController {
void onScroll(int scrollY); void onScroll(int scrollY);
void updateBackgroundPadding(Drawable bg);
void disable(); void disable();
} }
@@ -62,8 +81,8 @@ interface HeaderElevationController {
final class HeaderElevationControllerV16 implements HeaderElevationController { final class HeaderElevationControllerV16 implements HeaderElevationController {
private final View mShadow; private final View mShadow;
private final float mScrollToElevation; private final float mScrollToElevation;
private final Rect mTmpRect = new Rect();
public HeaderElevationControllerV16(View header) { public HeaderElevationControllerV16(View header) {
Resources res = header.getContext().getResources(); Resources res = header.getContext().getResources();
@@ -89,6 +108,15 @@ final class HeaderElevationControllerV16 implements HeaderElevationController {
mShadow.setAlpha(elevationPct); mShadow.setAlpha(elevationPct);
} }
@Override
public void updateBackgroundPadding(Drawable bg) {
bg.getPadding(mTmpRect);
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mShadow.getLayoutParams();
lp.leftMargin = mTmpRect.left;
lp.rightMargin = mTmpRect.right;
mShadow.requestLayout();
}
@Override @Override
public void disable() { public void disable() {
ViewGroup parent = (ViewGroup) mShadow.getParent(); ViewGroup parent = (ViewGroup) mShadow.getParent();
@@ -127,6 +155,11 @@ final class HeaderElevationControllerVL implements HeaderElevationController {
} }
} }
@Override
public void updateBackgroundPadding(Drawable bg) {
// Do nothing, the background padding on the header view is already applied
}
@Override @Override
public void disable() { } public void disable() { }
} }
@@ -134,9 +167,9 @@ final class HeaderElevationControllerVL implements HeaderElevationController {
/** /**
* The all apps view container. * The all apps view container.
*/ */
public class AppsContainerView extends BaseContainerView implements DragSource, Insettable, public class AllAppsContainerView extends BaseContainerView implements DragSource, Insettable,
TextWatcher, TextView.OnEditorActionListener, LauncherTransitionable, TextWatcher, TextView.OnEditorActionListener, LauncherTransitionable,
AlphabeticalAppsList.AdapterChangedCallback, AppsGridAdapter.PredictionBarSpacerCallbacks, AlphabeticalAppsList.AdapterChangedCallback, AllAppsGridAdapter.PredictionBarSpacerCallbacks,
View.OnTouchListener, View.OnClickListener, View.OnLongClickListener, View.OnTouchListener, View.OnClickListener, View.OnLongClickListener,
ViewTreeObserver.OnPreDrawListener { ViewTreeObserver.OnPreDrawListener {
@@ -155,18 +188,18 @@ public class AppsContainerView extends BaseContainerView implements DragSource,
@Thunk Launcher mLauncher; @Thunk Launcher mLauncher;
@Thunk AlphabeticalAppsList mApps; @Thunk AlphabeticalAppsList mApps;
private LayoutInflater mLayoutInflater; private LayoutInflater mLayoutInflater;
private AppsGridAdapter mAdapter; private AllAppsGridAdapter mAdapter;
private RecyclerView.LayoutManager mLayoutManager; private RecyclerView.LayoutManager mLayoutManager;
private RecyclerView.ItemDecoration mItemDecoration; private RecyclerView.ItemDecoration mItemDecoration;
private FrameLayout mContentView; private FrameLayout mContentView;
@Thunk AppsContainerRecyclerView mAppsRecyclerView; @Thunk AllAppsRecyclerView mAppsRecyclerView;
private ViewGroup mPredictionBarView; private ViewGroup mPredictionBarView;
private View mHeaderView; private View mHeaderView;
private View mSearchBarContainerView; private View mSearchBarContainerView;
private View mSearchButtonView; private View mSearchButtonView;
private View mDismissSearchButtonView; private View mDismissSearchButtonView;
private AppsContainerSearchEditTextView mSearchBarEditView; private AllAppsSearchEditView mSearchBarEditView;
private HeaderElevationController mElevationController; private HeaderElevationController mElevationController;
@@ -188,15 +221,15 @@ public class AppsContainerView extends BaseContainerView implements DragSource,
private CheckLongPressHelper mPredictionIconCheckForLongPress; private CheckLongPressHelper mPredictionIconCheckForLongPress;
private View mPredictionIconUnderTouch; private View mPredictionIconUnderTouch;
public AppsContainerView(Context context) { public AllAppsContainerView(Context context) {
this(context, null); this(context, null);
} }
public AppsContainerView(Context context, AttributeSet attrs) { public AllAppsContainerView(Context context, AttributeSet attrs) {
this(context, attrs, 0); this(context, attrs, 0);
} }
public AppsContainerView(Context context, AttributeSet attrs, int defStyleAttr) { public AllAppsContainerView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
LauncherAppState app = LauncherAppState.getInstance(); LauncherAppState app = LauncherAppState.getInstance();
Resources res = context.getResources(); Resources res = context.getResources();
@@ -205,18 +238,19 @@ public class AppsContainerView extends BaseContainerView implements DragSource,
DeviceProfile grid = mLauncher.getDeviceProfile(); DeviceProfile grid = mLauncher.getDeviceProfile();
mContainerInset = context.getResources().getDimensionPixelSize( mContainerInset = context.getResources().getDimensionPixelSize(
R.dimen.apps_container_inset); R.dimen.all_apps_container_inset);
mPredictionBarHeight = grid.allAppsCellHeightPx + mPredictionBarHeight = grid.allAppsIconSizePx + grid.iconDrawablePaddingOriginalPx +
2 * res.getDimensionPixelSize(R.dimen.apps_prediction_icon_top_bottom_padding); grid.allAppsIconTextSizePx +
2 * res.getDimensionPixelSize(R.dimen.all_apps_prediction_icon_top_bottom_padding);
mLayoutInflater = LayoutInflater.from(context); mLayoutInflater = LayoutInflater.from(context);
mNumAppsPerRow = grid.appsViewNumCols; mNumAppsPerRow = grid.allAppsNumCols;
mNumPredictedAppsPerRow = grid.appsViewNumPredictiveCols; mNumPredictedAppsPerRow = grid.allAppsNumPredictiveCols;
mApps = new AlphabeticalAppsList(context, mNumAppsPerRow, mNumPredictedAppsPerRow); mApps = new AlphabeticalAppsList(context, mNumAppsPerRow, mNumPredictedAppsPerRow);
mApps.setAdapterChangedCallback(this); mApps.setAdapterChangedCallback(this);
mAdapter = new AppsGridAdapter(context, mApps, mNumAppsPerRow, this, this, mLauncher, this); mAdapter = new AllAppsGridAdapter(context, mApps, mNumAppsPerRow, this, this, mLauncher, this);
mAdapter.setEmptySearchText(res.getString(R.string.loading_apps_message)); mAdapter.setEmptySearchText(res.getString(R.string.all_apps_loading_message));
mAdapter.setNumAppsPerRow(mNumAppsPerRow); mAdapter.setNumAppsPerRow(mNumAppsPerRow);
mAdapter.setPredictionRowHeight(mPredictionBarHeight); mAdapter.setPredictionRowHeight(mPredictionBarHeight);
mLayoutManager = mAdapter.getLayoutManager(); mLayoutManager = mAdapter.getLayoutManager();
@@ -340,13 +374,13 @@ public class AppsContainerView extends BaseContainerView implements DragSource,
mSearchBarContainerView = findViewById(R.id.app_search_container); mSearchBarContainerView = findViewById(R.id.app_search_container);
mDismissSearchButtonView = mSearchBarContainerView.findViewById(R.id.dismiss_search_button); mDismissSearchButtonView = mSearchBarContainerView.findViewById(R.id.dismiss_search_button);
mDismissSearchButtonView.setOnClickListener(this); mDismissSearchButtonView.setOnClickListener(this);
mSearchBarEditView = (AppsContainerSearchEditTextView) findViewById(R.id.app_search_box); mSearchBarEditView = (AllAppsSearchEditView) findViewById(R.id.apps_search_box);
if (mSearchBarEditView != null) { if (mSearchBarEditView != null) {
mSearchBarEditView.addTextChangedListener(this); mSearchBarEditView.addTextChangedListener(this);
mSearchBarEditView.setOnEditorActionListener(this); mSearchBarEditView.setOnEditorActionListener(this);
if (DISMISS_SEARCH_ON_BACK) { if (DISMISS_SEARCH_ON_BACK) {
mSearchBarEditView.setOnBackKeyListener( mSearchBarEditView.setOnBackKeyListener(
new AppsContainerSearchEditTextView.OnBackKeyListener() { new AllAppsSearchEditView.OnBackKeyListener() {
@Override @Override
public void onBackKey() { public void onBackKey() {
// Only hide the search field if there is no query, or if there // Only hide the search field if there is no query, or if there
@@ -360,7 +394,7 @@ public class AppsContainerView extends BaseContainerView implements DragSource,
}); });
} }
} }
mAppsRecyclerView = (AppsContainerRecyclerView) findViewById(R.id.apps_list_view); mAppsRecyclerView = (AllAppsRecyclerView) findViewById(R.id.apps_list_view);
mAppsRecyclerView.setApps(mApps); mAppsRecyclerView.setApps(mApps);
mAppsRecyclerView.setNumAppsPerRow(mNumAppsPerRow, mNumPredictedAppsPerRow); mAppsRecyclerView.setNumAppsPerRow(mNumAppsPerRow, mNumPredictedAppsPerRow);
mAppsRecyclerView.setPredictionBarHeight(mPredictionBarHeight); mAppsRecyclerView.setPredictionBarHeight(mPredictionBarHeight);
@@ -388,7 +422,7 @@ public class AppsContainerView extends BaseContainerView implements DragSource,
} else { } else {
// Otherwise, inflate a new icon // Otherwise, inflate a new icon
icon = (BubbleTextView) mLayoutInflater.inflate( icon = (BubbleTextView) mLayoutInflater.inflate(
R.layout.apps_prediction_bar_icon_view, mPredictionBarView, false); R.layout.all_apps_prediction_bar_icon, mPredictionBarView, false);
icon.setFocusable(true); icon.setFocusable(true);
mPredictionBarView.addView(icon); mPredictionBarView.addView(icon);
} }
@@ -416,8 +450,8 @@ public class AppsContainerView extends BaseContainerView implements DragSource,
LauncherAppState app = LauncherAppState.getInstance(); LauncherAppState app = LauncherAppState.getInstance();
DeviceProfile grid = mLauncher.getDeviceProfile(); DeviceProfile grid = mLauncher.getDeviceProfile();
if (grid.updateAppsViewNumCols(getContext().getResources(), mFixedBounds.width())) { if (grid.updateAppsViewNumCols(getContext().getResources(), mFixedBounds.width())) {
mNumAppsPerRow = grid.appsViewNumCols; mNumAppsPerRow = grid.allAppsNumCols;
mNumPredictedAppsPerRow = grid.appsViewNumPredictiveCols; mNumPredictedAppsPerRow = grid.allAppsNumPredictiveCols;
mAppsRecyclerView.setNumAppsPerRow(mNumAppsPerRow, mNumPredictedAppsPerRow); mAppsRecyclerView.setNumAppsPerRow(mNumAppsPerRow, mNumPredictedAppsPerRow);
mAdapter.setNumAppsPerRow(mNumAppsPerRow); mAdapter.setNumAppsPerRow(mNumAppsPerRow);
mApps.setNumAppsPerRow(mNumAppsPerRow, mNumPredictedAppsPerRow); mApps.setNumAppsPerRow(mNumAppsPerRow, mNumPredictedAppsPerRow);
@@ -493,6 +527,7 @@ public class AppsContainerView extends BaseContainerView implements DragSource,
mContentView.setBackground(background); mContentView.setBackground(background);
mAppsRecyclerView.updateBackgroundPadding(background); mAppsRecyclerView.updateBackgroundPadding(background);
mAdapter.updateBackgroundPadding(background); mAdapter.updateBackgroundPadding(background);
mElevationController.updateBackgroundPadding(background);
getRevealView().setBackground(background.getConstantState().newDrawable()); getRevealView().setBackground(background.getConstantState().newDrawable());
} }
@@ -632,7 +667,7 @@ public class AppsContainerView extends BaseContainerView implements DragSource,
if (queryText.isEmpty()) { if (queryText.isEmpty()) {
mApps.setFilter(null); mApps.setFilter(null);
} else { } else {
String formatStr = getResources().getString(R.string.apps_view_no_search_results); String formatStr = getResources().getString(R.string.all_apps_no_search_results);
mAdapter.setEmptySearchText(String.format(formatStr, queryText)); mAdapter.setEmptySearchText(String.format(formatStr, queryText));
// Do an intersection of the words in the query and each title, and filter out all the // Do an intersection of the words in the query and each title, and filter out all the
@@ -679,7 +714,7 @@ public class AppsContainerView extends BaseContainerView implements DragSource,
List<AlphabeticalAppsList.AdapterItem> items = mApps.getAdapterItems(); List<AlphabeticalAppsList.AdapterItem> items = mApps.getAdapterItems();
for (int i = 0; i < items.size(); i++) { for (int i = 0; i < items.size(); i++) {
AlphabeticalAppsList.AdapterItem item = items.get(i); AlphabeticalAppsList.AdapterItem item = items.get(i);
if (item.viewType == AppsGridAdapter.ICON_VIEW_TYPE) { if (item.viewType == AllAppsGridAdapter.ICON_VIEW_TYPE) {
mAppsRecyclerView.getChildAt(i).performClick(); mAppsRecyclerView.getChildAt(i).performClick();
getInputMethodManager().hideSoftInputFromWindow(getWindowToken(), 0); getInputMethodManager().hideSoftInputFromWindow(getWindowToken(), 0);
return true; return true;
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.android.launcher3; package com.android.launcher3.allapps;
import android.content.Context; import android.content.Context;
import android.content.res.Resources; import android.content.res.Resources;
@@ -29,6 +29,12 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import com.android.launcher3.AppInfo;
import com.android.launcher3.BubbleTextView;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.util.Thunk; import com.android.launcher3.util.Thunk;
import java.util.HashMap; import java.util.HashMap;
@@ -38,7 +44,7 @@ import java.util.List;
/** /**
* The grid view adapter of all the apps. * The grid view adapter of all the apps.
*/ */
class AppsGridAdapter extends RecyclerView.Adapter<AppsGridAdapter.ViewHolder> { class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter.ViewHolder> {
public static final String TAG = "AppsGridAdapter"; public static final String TAG = "AppsGridAdapter";
private static final boolean DEBUG = false; private static final boolean DEBUG = false;
@@ -48,7 +54,7 @@ class AppsGridAdapter extends RecyclerView.Adapter<AppsGridAdapter.ViewHolder> {
// A normal icon // A normal icon
public static final int ICON_VIEW_TYPE = 1; public static final int ICON_VIEW_TYPE = 1;
// The message shown when there are no filtered results // The message shown when there are no filtered results
public static final int EMPTY_VIEW_TYPE = 2; public static final int EMPTY_SEARCH_VIEW_TYPE = 2;
// The spacer used for the prediction bar // The spacer used for the prediction bar
public static final int PREDICTION_BAR_SPACER_TYPE = 3; public static final int PREDICTION_BAR_SPACER_TYPE = 3;
@@ -88,7 +94,7 @@ class AppsGridAdapter extends RecyclerView.Adapter<AppsGridAdapter.ViewHolder> {
return mAppsPerRow; return mAppsPerRow;
} }
if (mApps.getAdapterItems().get(position).viewType != AppsGridAdapter.ICON_VIEW_TYPE) { if (mApps.getAdapterItems().get(position).viewType != AllAppsGridAdapter.ICON_VIEW_TYPE) {
// Both the section breaks and predictive bar span the full width // Both the section breaks and predictive bar span the full width
return mAppsPerRow; return mAppsPerRow;
} else { } else {
@@ -255,7 +261,7 @@ class AppsGridAdapter extends RecyclerView.Adapter<AppsGridAdapter.ViewHolder> {
private boolean shouldDrawItemDivider(ViewHolder holder, private boolean shouldDrawItemDivider(ViewHolder holder,
List<AlphabeticalAppsList.AdapterItem> items) { List<AlphabeticalAppsList.AdapterItem> items) {
int pos = holder.getPosition(); int pos = holder.getPosition();
return items.get(pos).viewType == AppsGridAdapter.PREDICTION_BAR_SPACER_TYPE; return items.get(pos).viewType == AllAppsGridAdapter.PREDICTION_BAR_SPACER_TYPE;
} }
/** /**
@@ -267,12 +273,12 @@ class AppsGridAdapter extends RecyclerView.Adapter<AppsGridAdapter.ViewHolder> {
AlphabeticalAppsList.AdapterItem item = items.get(pos); AlphabeticalAppsList.AdapterItem item = items.get(pos);
// Ensure it's an icon // Ensure it's an icon
if (item.viewType != AppsGridAdapter.ICON_VIEW_TYPE) { if (item.viewType != AllAppsGridAdapter.ICON_VIEW_TYPE) {
return false; return false;
} }
// Draw the section header for the first item in each section // Draw the section header for the first item in each section
return (childIndex == 0) || return (childIndex == 0) ||
(items.get(pos - 1).viewType == AppsGridAdapter.SECTION_BREAK_VIEW_TYPE); (items.get(pos - 1).viewType == AllAppsGridAdapter.SECTION_BREAK_VIEW_TYPE);
} }
} }
@@ -299,7 +305,7 @@ class AppsGridAdapter extends RecyclerView.Adapter<AppsGridAdapter.ViewHolder> {
@Thunk Paint mSectionTextPaint; @Thunk Paint mSectionTextPaint;
@Thunk Paint mPredictedAppsDividerPaint; @Thunk Paint mPredictedAppsDividerPaint;
public AppsGridAdapter(Context context, AlphabeticalAppsList apps, int appsPerRow, public AllAppsGridAdapter(Context context, AlphabeticalAppsList apps, int appsPerRow,
PredictionBarSpacerCallbacks pbCb, View.OnTouchListener touchListener, PredictionBarSpacerCallbacks pbCb, View.OnTouchListener touchListener,
View.OnClickListener iconClickListener, View.OnLongClickListener iconLongClickListener) { View.OnClickListener iconClickListener, View.OnLongClickListener iconLongClickListener) {
Resources res = context.getResources(); Resources res = context.getResources();
@@ -316,14 +322,14 @@ class AppsGridAdapter extends RecyclerView.Adapter<AppsGridAdapter.ViewHolder> {
mTouchListener = touchListener; mTouchListener = touchListener;
mIconClickListener = iconClickListener; mIconClickListener = iconClickListener;
mIconLongClickListener = iconLongClickListener; mIconLongClickListener = iconLongClickListener;
mStartMargin = res.getDimensionPixelSize(R.dimen.apps_grid_view_start_margin); mStartMargin = res.getDimensionPixelSize(R.dimen.all_apps_grid_view_start_margin);
mSectionHeaderOffset = res.getDimensionPixelSize(R.dimen.apps_grid_section_y_offset); mSectionHeaderOffset = res.getDimensionPixelSize(R.dimen.all_apps_grid_section_y_offset);
mPaddingStart = res.getDimensionPixelSize(R.dimen.apps_container_inset); mPaddingStart = res.getDimensionPixelSize(R.dimen.all_apps_container_inset);
mSectionTextPaint = new Paint(); mSectionTextPaint = new Paint();
mSectionTextPaint.setTextSize(res.getDimensionPixelSize( mSectionTextPaint.setTextSize(res.getDimensionPixelSize(
R.dimen.apps_view_section_text_size)); R.dimen.all_apps_grid_section_text_size));
mSectionTextPaint.setColor(res.getColor(R.color.apps_view_section_text_color)); mSectionTextPaint.setColor(res.getColor(R.color.all_apps_grid_section_text_color));
mSectionTextPaint.setAntiAlias(true); mSectionTextPaint.setAntiAlias(true);
mPredictedAppsDividerPaint = new Paint(); mPredictedAppsDividerPaint = new Paint();
@@ -394,8 +400,8 @@ class AppsGridAdapter extends RecyclerView.Adapter<AppsGridAdapter.ViewHolder> {
@Override @Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
switch (viewType) { switch (viewType) {
case EMPTY_VIEW_TYPE: case EMPTY_SEARCH_VIEW_TYPE:
return new ViewHolder(mLayoutInflater.inflate(R.layout.apps_empty_view, parent, return new ViewHolder(mLayoutInflater.inflate(R.layout.all_apps_empty_search, parent,
false)); false));
case SECTION_BREAK_VIEW_TYPE: case SECTION_BREAK_VIEW_TYPE:
return new ViewHolder(new View(parent.getContext())); return new ViewHolder(new View(parent.getContext()));
@@ -408,7 +414,7 @@ class AppsGridAdapter extends RecyclerView.Adapter<AppsGridAdapter.ViewHolder> {
return new ViewHolder(v); return new ViewHolder(v);
case ICON_VIEW_TYPE: case ICON_VIEW_TYPE:
BubbleTextView icon = (BubbleTextView) mLayoutInflater.inflate( BubbleTextView icon = (BubbleTextView) mLayoutInflater.inflate(
R.layout.apps_grid_icon_view, parent, false); R.layout.all_apps_icon, parent, false);
icon.setOnTouchListener(mTouchListener); icon.setOnTouchListener(mTouchListener);
icon.setOnClickListener(mIconClickListener); icon.setOnClickListener(mIconClickListener);
icon.setOnLongClickListener(mIconLongClickListener); icon.setOnLongClickListener(mIconLongClickListener);
@@ -437,7 +443,7 @@ class AppsGridAdapter extends RecyclerView.Adapter<AppsGridAdapter.ViewHolder> {
} }
}); });
break; break;
case EMPTY_VIEW_TYPE: case EMPTY_SEARCH_VIEW_TYPE:
TextView emptyViewText = (TextView) holder.mContent.findViewById(R.id.empty_text); TextView emptyViewText = (TextView) holder.mContent.findViewById(R.id.empty_text);
emptyViewText.setText(mEmptySearchText); emptyViewText.setText(mEmptySearchText);
break; break;
@@ -456,7 +462,7 @@ class AppsGridAdapter extends RecyclerView.Adapter<AppsGridAdapter.ViewHolder> {
@Override @Override
public int getItemViewType(int position) { public int getItemViewType(int position) {
if (mApps.hasNoFilteredResults()) { if (mApps.hasNoFilteredResults()) {
return EMPTY_VIEW_TYPE; return EMPTY_SEARCH_VIEW_TYPE;
} }
AlphabeticalAppsList.AdapterItem item = mApps.getAdapterItems().get(position); AlphabeticalAppsList.AdapterItem item = mApps.getAdapterItems().get(position);
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.android.launcher3; package com.android.launcher3.allapps;
import android.animation.ObjectAnimator; import android.animation.ObjectAnimator;
import android.content.Context; import android.content.Context;
@@ -29,6 +29,11 @@ import android.util.AttributeSet;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewConfiguration; import android.view.ViewConfiguration;
import com.android.launcher3.BaseRecyclerView;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import java.util.List; import java.util.List;
@@ -36,7 +41,7 @@ import java.util.List;
* A RecyclerView with custom fastscroll support. This is the main container for the all apps * A RecyclerView with custom fastscroll support. This is the main container for the all apps
* icons. * icons.
*/ */
public class AppsContainerRecyclerView extends BaseContainerRecyclerView { public class AllAppsRecyclerView extends BaseRecyclerView {
/** /**
* The current scroll state of the recycler view. We use this in updateVerticalScrollbarBounds() * The current scroll state of the recycler view. We use this in updateVerticalScrollbarBounds()
@@ -82,38 +87,38 @@ public class AppsContainerRecyclerView extends BaseContainerRecyclerView {
private Launcher mLauncher; private Launcher mLauncher;
public AppsContainerRecyclerView(Context context) { public AllAppsRecyclerView(Context context) {
this(context, null); this(context, null);
} }
public AppsContainerRecyclerView(Context context, AttributeSet attrs) { public AllAppsRecyclerView(Context context, AttributeSet attrs) {
this(context, attrs, 0); this(context, attrs, 0);
} }
public AppsContainerRecyclerView(Context context, AttributeSet attrs, int defStyleAttr) { public AllAppsRecyclerView(Context context, AttributeSet attrs, int defStyleAttr) {
this(context, attrs, defStyleAttr, 0); this(context, attrs, defStyleAttr, 0);
} }
public AppsContainerRecyclerView(Context context, AttributeSet attrs, int defStyleAttr, public AllAppsRecyclerView(Context context, AttributeSet attrs, int defStyleAttr,
int defStyleRes) { int defStyleRes) {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
mLauncher = (Launcher) context; mLauncher = (Launcher) context;
Resources res = context.getResources(); Resources res = context.getResources();
int fastScrollerSize = res.getDimensionPixelSize(R.dimen.apps_view_fast_scroll_popup_size); int fastScrollerSize = res.getDimensionPixelSize(R.dimen.all_apps_fast_scroll_popup_size);
mScrollbar = res.getDrawable(R.drawable.apps_list_scrollbar_thumb); mScrollbar = res.getDrawable(R.drawable.all_apps_scrollbar_thumb);
mFastScrollerBg = res.getDrawable(R.drawable.apps_list_fastscroll_bg); mFastScrollerBg = res.getDrawable(R.drawable.all_apps_fastscroll_bg);
mFastScrollerBg.setBounds(0, 0, fastScrollerSize, fastScrollerSize); mFastScrollerBg.setBounds(0, 0, fastScrollerSize, fastScrollerSize);
mFastScrollTextPaint = new Paint(); mFastScrollTextPaint = new Paint();
mFastScrollTextPaint.setColor(Color.WHITE); mFastScrollTextPaint.setColor(Color.WHITE);
mFastScrollTextPaint.setAntiAlias(true); mFastScrollTextPaint.setAntiAlias(true);
mFastScrollTextPaint.setTextSize(res.getDimensionPixelSize( mFastScrollTextPaint.setTextSize(res.getDimensionPixelSize(
R.dimen.apps_view_fast_scroll_text_size)); R.dimen.all_apps_fast_scroll_text_size));
mScrollbarWidth = res.getDimensionPixelSize(R.dimen.apps_view_fast_scroll_bar_width); mScrollbarWidth = res.getDimensionPixelSize(R.dimen.all_apps_fast_scroll_bar_width);
mScrollbarMinHeight = mScrollbarMinHeight =
res.getDimensionPixelSize(R.dimen.apps_view_fast_scroll_bar_min_height); res.getDimensionPixelSize(R.dimen.all_apps_fast_scroll_bar_min_height);
mScrollbarInset = mScrollbarInset =
res.getDimensionPixelSize(R.dimen.apps_view_fast_scroll_scrubber_touch_inset); res.getDimensionPixelSize(R.dimen.all_apps_fast_scroll_scrubber_touch_inset);
setFastScrollerAlpha(getFastScrollerAlpha()); setFastScrollerAlpha(getFastScrollerAlpha());
setOverScrollMode(View.OVER_SCROLL_NEVER); setOverScrollMode(View.OVER_SCROLL_NEVER);
} }
@@ -135,10 +140,10 @@ public class AppsContainerRecyclerView extends BaseContainerRecyclerView {
DeviceProfile grid = mLauncher.getDeviceProfile(); DeviceProfile grid = mLauncher.getDeviceProfile();
RecyclerView.RecycledViewPool pool = getRecycledViewPool(); RecyclerView.RecycledViewPool pool = getRecycledViewPool();
int approxRows = (int) Math.ceil(grid.availableHeightPx / grid.allAppsIconSizePx); int approxRows = (int) Math.ceil(grid.availableHeightPx / grid.allAppsIconSizePx);
pool.setMaxRecycledViews(AppsGridAdapter.PREDICTION_BAR_SPACER_TYPE, 1); pool.setMaxRecycledViews(AllAppsGridAdapter.PREDICTION_BAR_SPACER_TYPE, 1);
pool.setMaxRecycledViews(AppsGridAdapter.EMPTY_VIEW_TYPE, 1); pool.setMaxRecycledViews(AllAppsGridAdapter.EMPTY_SEARCH_VIEW_TYPE, 1);
pool.setMaxRecycledViews(AppsGridAdapter.ICON_VIEW_TYPE, approxRows * mNumAppsPerRow); pool.setMaxRecycledViews(AllAppsGridAdapter.ICON_VIEW_TYPE, approxRows * mNumAppsPerRow);
pool.setMaxRecycledViews(AppsGridAdapter.SECTION_BREAK_VIEW_TYPE, approxRows); pool.setMaxRecycledViews(AllAppsGridAdapter.SECTION_BREAK_VIEW_TYPE, approxRows);
} }
public void updateBackgroundPadding(Drawable background) { public void updateBackgroundPadding(Drawable background) {
@@ -511,7 +516,7 @@ public class AppsContainerRecyclerView extends BaseContainerRecyclerView {
int position = getChildPosition(child); int position = getChildPosition(child);
if (position != NO_POSITION) { if (position != NO_POSITION) {
AlphabeticalAppsList.AdapterItem item = items.get(position); AlphabeticalAppsList.AdapterItem item = items.get(position);
if (item.viewType == AppsGridAdapter.ICON_VIEW_TYPE) { if (item.viewType == AllAppsGridAdapter.ICON_VIEW_TYPE) {
stateOut.rowIndex = findRowForAppIndex(item.appIndex); stateOut.rowIndex = findRowForAppIndex(item.appIndex);
stateOut.rowTopOffset = getLayoutManager().getDecoratedTop(child); stateOut.rowTopOffset = getLayoutManager().getDecoratedTop(child);
stateOut.rowHeight = child.getHeight(); stateOut.rowHeight = child.getHeight();
@@ -13,29 +13,37 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.android.launcher3; package com.android.launcher3.allapps;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import com.android.launcher3.BubbleTextView;
import com.android.launcher3.BubbleTextView.BubbleTextShadowHandler; import com.android.launcher3.BubbleTextView.BubbleTextShadowHandler;
import com.android.launcher3.ClickShadowView;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
public class AppsRecyclerViewContainer extends FrameLayout implements BubbleTextShadowHandler { /**
* A container for RecyclerView to allow for the click shadow view to be shown behind an icon that
* is launching.
*/
public class AllAppsRecyclerViewContainerView extends FrameLayout
implements BubbleTextShadowHandler {
private final ClickShadowView mTouchFeedbackView; private final ClickShadowView mTouchFeedbackView;
public AppsRecyclerViewContainer(Context context) { public AllAppsRecyclerViewContainerView(Context context) {
this(context, null); this(context, null);
} }
public AppsRecyclerViewContainer(Context context, AttributeSet attrs) { public AllAppsRecyclerViewContainerView(Context context, AttributeSet attrs) {
this(context, attrs, 0); this(context, attrs, 0);
} }
public AppsRecyclerViewContainer(Context context, AttributeSet attrs, int defStyleAttr) { public AllAppsRecyclerViewContainerView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
Launcher launcher = (Launcher) context; Launcher launcher = (Launcher) context;
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.android.launcher3; package com.android.launcher3.allapps;
import android.content.Context; import android.content.Context;
import android.util.AttributeSet; import android.util.AttributeSet;
@@ -24,7 +24,7 @@ import android.widget.EditText;
/** /**
* The edit text for the search container * The edit text for the search container
*/ */
public class AppsContainerSearchEditTextView extends EditText { public class AllAppsSearchEditView extends EditText {
/** /**
* Implemented by listeners of the back key. * Implemented by listeners of the back key.
@@ -35,15 +35,15 @@ public class AppsContainerSearchEditTextView extends EditText {
private OnBackKeyListener mBackKeyListener; private OnBackKeyListener mBackKeyListener;
public AppsContainerSearchEditTextView(Context context) { public AllAppsSearchEditView(Context context) {
this(context, null); this(context, null);
} }
public AppsContainerSearchEditTextView(Context context, AttributeSet attrs) { public AllAppsSearchEditView(Context context, AttributeSet attrs) {
this(context, attrs, 0); this(context, attrs, 0);
} }
public AppsContainerSearchEditTextView(Context context, AttributeSet attrs, int defStyleAttr) { public AllAppsSearchEditView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
} }
@@ -1,9 +1,12 @@
package com.android.launcher3; package com.android.launcher3.allapps;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.util.Log; import android.util.Log;
import com.android.launcher3.AppInfo;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.compat.AlphabeticIndexCompat; import com.android.launcher3.compat.AlphabeticIndexCompat;
import com.android.launcher3.model.AppNameComparator; import com.android.launcher3.model.AppNameComparator;
@@ -81,7 +84,7 @@ public class AlphabeticalAppsList {
public static AdapterItem asSectionBreak(int pos, SectionInfo section) { public static AdapterItem asSectionBreak(int pos, SectionInfo section) {
AdapterItem item = new AdapterItem(); AdapterItem item = new AdapterItem();
item.viewType = AppsGridAdapter.SECTION_BREAK_VIEW_TYPE; item.viewType = AllAppsGridAdapter.SECTION_BREAK_VIEW_TYPE;
item.position = pos; item.position = pos;
item.sectionInfo = section; item.sectionInfo = section;
section.sectionBreakItem = item; section.sectionBreakItem = item;
@@ -90,7 +93,7 @@ public class AlphabeticalAppsList {
public static AdapterItem asPredictionBarSpacer(int pos) { public static AdapterItem asPredictionBarSpacer(int pos) {
AdapterItem item = new AdapterItem(); AdapterItem item = new AdapterItem();
item.viewType = AppsGridAdapter.PREDICTION_BAR_SPACER_TYPE; item.viewType = AllAppsGridAdapter.PREDICTION_BAR_SPACER_TYPE;
item.position = pos; item.position = pos;
return item; return item;
} }
@@ -98,7 +101,7 @@ public class AlphabeticalAppsList {
public static AdapterItem asApp(int pos, SectionInfo section, String sectionName, public static AdapterItem asApp(int pos, SectionInfo section, String sectionName,
int sectionAppIndex, AppInfo appInfo, int appIndex) { int sectionAppIndex, AppInfo appInfo, int appIndex) {
AdapterItem item = new AdapterItem(); AdapterItem item = new AdapterItem();
item.viewType = AppsGridAdapter.ICON_VIEW_TYPE; item.viewType = AllAppsGridAdapter.ICON_VIEW_TYPE;
item.position = pos; item.position = pos;
item.sectionInfo = section; item.sectionInfo = section;
item.sectionName = sectionName; item.sectionName = sectionName;
@@ -516,7 +519,7 @@ public class AlphabeticalAppsList {
*/ */
private void mergeSections() { private void mergeSections() {
// Go through each section and try and merge some of the sections // Go through each section and try and merge some of the sections
if (AppsContainerView.GRID_MERGE_SECTIONS && !hasFilter()) { if (AllAppsContainerView.GRID_MERGE_SECTIONS && !hasFilter()) {
int sectionAppCount = 0; int sectionAppCount = 0;
for (int i = 0; i < mSections.size(); i++) { for (int i = 0; i < mSections.size(); i++) {
SectionInfo section = mSections.get(i); SectionInfo section = mSections.get(i);
@@ -18,22 +18,22 @@ package com.android.launcher3.widget;
import android.content.Context; import android.content.Context;
import android.util.AttributeSet; import android.util.AttributeSet;
import com.android.launcher3.BaseContainerRecyclerView; import com.android.launcher3.BaseRecyclerView;
/** /**
* The widgets recycler view container. * The widgets recycler view.
*/ */
public class WidgetsContainerRecyclerView extends BaseContainerRecyclerView { public class WidgetsRecyclerView extends BaseRecyclerView {
public WidgetsContainerRecyclerView(Context context) { public WidgetsRecyclerView(Context context) {
this(context, null); this(context, null);
} }
public WidgetsContainerRecyclerView(Context context, AttributeSet attrs) { public WidgetsRecyclerView(Context context, AttributeSet attrs) {
this(context, attrs, 0); this(context, attrs, 0);
} }
public WidgetsContainerRecyclerView(Context context, AttributeSet attrs, int defStyleAttr) { public WidgetsRecyclerView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
} }