summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/drawable-hdpi/custom_content_page.png (renamed from res/drawable-hdpi/now_page.png)bin1353 -> 1353 bytes
-rw-r--r--res/drawable-mdpi/custom_content_page.png (renamed from res/drawable-mdpi/now_page.png)bin1227 -> 1227 bytes
-rw-r--r--res/drawable-xhdpi/custom_content_page.png (renamed from res/drawable-xhdpi/now_page.png)bin1297 -> 1297 bytes
-rw-r--r--res/layout-land/application.xml20
-rw-r--r--res/layout-land/folder_icon.xml33
-rw-r--r--res/layout-land/hotseat.xml36
-rw-r--r--res/layout-land/launcher.xml25
-rw-r--r--res/layout-land/search_bar.xml2
-rw-r--r--res/layout-port/hotseat.xml36
-rw-r--r--res/layout-port/launcher.xml21
-rw-r--r--res/layout-port/search_bar.xml18
-rw-r--r--res/layout-sw600dp-land/launcher.xml108
-rw-r--r--res/layout-sw720dp/hotseat.xml36
-rw-r--r--res/layout-sw720dp/launcher.xml22
-rw-r--r--res/layout-sw720dp/search_bar.xml16
-rw-r--r--res/layout-sw720dp/workspace.xml33
-rw-r--r--res/layout/application.xml (renamed from res/layout-port/application.xml)2
-rw-r--r--res/layout/custom_content_page_indicator_marker.xml (renamed from res/layout/now_page_indicator_marker.xml)7
-rw-r--r--res/layout/folder_icon.xml (renamed from res/layout-port/folder_icon.xml)6
-rw-r--r--res/layout/hotseat.xml (renamed from res/layout/workspace_divider.xml)15
-rw-r--r--res/layout/page_indicator_marker.xml3
-rw-r--r--res/layout/qsb_bar.xml14
-rw-r--r--res/layout/user_folder.xml10
-rw-r--r--res/layout/workspace_screen.xml8
-rw-r--r--res/values-land/config.xml7
-rw-r--r--res/values-land/dimens.xml40
-rw-r--r--res/values-land/styles.xml13
-rw-r--r--res/values-port/dimens.xml24
-rw-r--r--res/values-sw340dp-land/dimens.xml6
-rw-r--r--res/values-sw340dp-land/styles.xml28
-rw-r--r--res/values-sw340dp-port/dimens.xml12
-rw-r--r--res/values-sw340dp/dimens.xml22
-rw-r--r--res/values-sw380dp-port/dimens.xml35
-rw-r--r--res/values-sw600dp-land/config.xml8
-rw-r--r--res/values-sw600dp-land/dimens.xml15
-rw-r--r--res/values-sw600dp-port/dimens.xml3
-rw-r--r--res/values-sw600dp/config.xml16
-rw-r--r--res/values-sw600dp/dimens.xml47
-rw-r--r--res/values-sw720dp-port/dimens.xml17
-rw-r--r--res/values-sw720dp/config.xml15
-rw-r--r--res/values-sw720dp/dimens.xml69
-rw-r--r--res/values-sw720dp/styles.xml50
-rw-r--r--res/values/attrs.xml3
-rw-r--r--res/values/config.xml19
-rw-r--r--res/values/dimens.xml75
-rw-r--r--res/values/styles.xml36
-rw-r--r--src/com/android/launcher3/AppsCustomizePagedView.java10
-rw-r--r--src/com/android/launcher3/BubbleTextView.java27
-rw-r--r--src/com/android/launcher3/CellLayout.java185
-rw-r--r--src/com/android/launcher3/Cling.java8
-rw-r--r--src/com/android/launcher3/DragLayer.java7
-rw-r--r--src/com/android/launcher3/DynamicGrid.java478
-rw-r--r--src/com/android/launcher3/Folder.java50
-rw-r--r--src/com/android/launcher3/FolderIcon.java28
-rw-r--r--src/com/android/launcher3/Hotseat.java19
-rw-r--r--src/com/android/launcher3/Launcher.java62
-rw-r--r--src/com/android/launcher3/LauncherAppState.java28
-rw-r--r--src/com/android/launcher3/LauncherAppWidgetHostView.java1
-rw-r--r--src/com/android/launcher3/LauncherModel.java35
-rw-r--r--src/com/android/launcher3/LauncherProvider.java10
-rw-r--r--src/com/android/launcher3/PagedViewCellLayout.java8
-rw-r--r--src/com/android/launcher3/SearchDropTargetBar.java4
-rw-r--r--src/com/android/launcher3/ShortcutAndWidgetContainer.java25
-rw-r--r--src/com/android/launcher3/Utilities.java87
-rw-r--r--src/com/android/launcher3/WidgetPreviewLoader.java6
-rw-r--r--src/com/android/launcher3/Workspace.java95
66 files changed, 848 insertions, 1356 deletions
diff --git a/res/drawable-hdpi/now_page.png b/res/drawable-hdpi/custom_content_page.png
index 9eef50c..9eef50c 100644
--- a/res/drawable-hdpi/now_page.png
+++ b/res/drawable-hdpi/custom_content_page.png
Binary files differ
diff --git a/res/drawable-mdpi/now_page.png b/res/drawable-mdpi/custom_content_page.png
index cc4005d..cc4005d 100644
--- a/res/drawable-mdpi/now_page.png
+++ b/res/drawable-mdpi/custom_content_page.png
Binary files differ
diff --git a/res/drawable-xhdpi/now_page.png b/res/drawable-xhdpi/custom_content_page.png
index e1da91c..e1da91c 100644
--- a/res/drawable-xhdpi/now_page.png
+++ b/res/drawable-xhdpi/custom_content_page.png
Binary files differ
diff --git a/res/layout-land/application.xml b/res/layout-land/application.xml
deleted file mode 100644
index d20e1be..0000000
--- a/res/layout-land/application.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 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.
--->
-
-<com.android.launcher3.BubbleTextView xmlns:android="http://schemas.android.com/apk/res/android"
- style="@style/WorkspaceIcon.Landscape"
- android:focusable="true"
- android:background="@drawable/focusable_view_bg" />
diff --git a/res/layout-land/folder_icon.xml b/res/layout-land/folder_icon.xml
deleted file mode 100644
index 32d7298..0000000
--- a/res/layout-land/folder_icon.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 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.
--->
-
-<com.android.launcher3.FolderIcon
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:focusable="true"
- android:background="@drawable/focusable_view_bg">
- <ImageView
- android:id="@+id/preview_background"
- android:layout_gravity="center_horizontal"
- android:layout_width="@dimen/folder_preview_size"
- android:layout_height="@dimen/folder_preview_size"
- android:src="@drawable/portal_ring_inner_holo"/>
- <com.android.launcher3.BubbleTextView
- android:id="@+id/folder_icon_name"
- style="@style/WorkspaceIcon.Landscape.Folder"/>
-</com.android.launcher3.FolderIcon>
diff --git a/res/layout-land/hotseat.xml b/res/layout-land/hotseat.xml
deleted file mode 100644
index f2d2b00..0000000
--- a/res/layout-land/hotseat.xml
+++ /dev/null
@@ -1,36 +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.
--->
-<com.android.launcher3.Hotseat
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3"
- launcher:cellCountX="1"
- launcher:cellCountY="@integer/hotseat_cell_count">
- <com.android.launcher3.CellLayout
- android:id="@+id/layout"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:paddingTop="@dimen/button_bar_width_left_padding"
- android:paddingBottom="@dimen/button_bar_width_right_padding"
- android:paddingStart="@dimen/button_bar_height_top_padding"
- android:paddingEnd="@dimen/button_bar_height_bottom_padding"
-
- launcher:cellWidth="@dimen/hotseat_cell_width"
- launcher:cellHeight="@dimen/hotseat_cell_height"
- launcher:widthGap="@dimen/hotseat_width_gap"
- launcher:heightGap="@dimen/hotseat_height_gap"
- launcher:maxGap="@dimen/workspace_max_gap" />
-</com.android.launcher3.Hotseat>
diff --git a/res/layout-land/launcher.xml b/res/layout-land/launcher.xml
index 3454ad4..faf410b 100644
--- a/res/layout-land/launcher.xml
+++ b/res/layout-land/launcher.xml
@@ -36,28 +36,13 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
- android:paddingStart="@dimen/workspace_left_padding"
- android:paddingEnd="@dimen/workspace_right_padding"
- android:paddingTop="@dimen/workspace_top_padding"
- android:paddingBottom="@dimen/workspace_bottom_padding"
launcher:defaultScreen="@integer/config_workspaceDefaultScreen"
- launcher:cellCountX="@integer/cell_count_x"
- launcher:cellCountY="@integer/cell_count_y"
launcher:pageSpacing="@dimen/workspace_page_spacing"
- launcher:scrollIndicatorPaddingLeft="@dimen/qsb_bar_height"
- launcher:scrollIndicatorPaddingRight="@dimen/button_bar_height" />
-
- <include
- android:id="@+id/qsb_divider"
- layout="@layout/workspace_divider"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_marginStart="@dimen/qsb_bar_height"
- android:layout_gravity="start" />
+ launcher:pageIndicator="@id/page_indicator" />
<include layout="@layout/hotseat"
android:id="@+id/hotseat"
- android:layout_width="@dimen/button_bar_height_plus_padding"
+ android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="end" />
@@ -84,16 +69,18 @@
android:layout_height="match_parent"
android:visibility="gone" />
+ <!-- TODO: Fix
<com.android.launcher3.DrawableStateProxyView
android:id="@+id/voice_button_proxy"
- android:layout_width="@dimen/qsb_bar_height"
- android:layout_height="@dimen/app_icon_size"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
android:layout_gravity="top|start"
android:layout_marginTop="64dp"
android:clickable="true"
android:onClick="onClickVoiceButton"
android:importantForAccessibility="no"
launcher:sourceViewId="@+id/voice_button" />
+ -->
<include layout="@layout/apps_customize_pane"
android:id="@+id/apps_customize_pane"
diff --git a/res/layout-land/search_bar.xml b/res/layout-land/search_bar.xml
index ab36361..d56e380 100644
--- a/res/layout-land/search_bar.xml
+++ b/res/layout-land/search_bar.xml
@@ -15,7 +15,7 @@
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="@dimen/qsb_bar_height"
+ android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- Global search icon -->
diff --git a/res/layout-port/hotseat.xml b/res/layout-port/hotseat.xml
deleted file mode 100644
index cab20b2..0000000
--- a/res/layout-port/hotseat.xml
+++ /dev/null
@@ -1,36 +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.
--->
-<com.android.launcher3.Hotseat
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3"
- launcher:cellCountX="@integer/hotseat_cell_count"
- launcher:cellCountY="1">
- <com.android.launcher3.CellLayout
- android:id="@+id/layout"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_gravity="center"
- android:paddingTop="@dimen/button_bar_height_top_padding"
- android:paddingBottom="@dimen/button_bar_height_bottom_padding"
- android:paddingStart="@dimen/button_bar_width_left_padding"
- android:paddingEnd="@dimen/button_bar_width_right_padding"
-
- launcher:cellWidth="@dimen/hotseat_cell_width"
- launcher:cellHeight="@dimen/hotseat_cell_height"
- launcher:widthGap="@dimen/hotseat_width_gap"
- launcher:heightGap="@dimen/hotseat_height_gap"
- launcher:maxGap="@dimen/workspace_max_gap" />
-</com.android.launcher3.Hotseat>
diff --git a/res/layout-port/launcher.xml b/res/layout-port/launcher.xml
index a2e8298..dd3ad47 100644
--- a/res/layout-port/launcher.xml
+++ b/res/layout-port/launcher.xml
@@ -35,25 +35,15 @@
android:id="@+id/workspace"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_gravity="center"
- android:paddingStart="@dimen/workspace_left_padding"
- android:paddingEnd="@dimen/workspace_right_padding"
- android:paddingTop="@dimen/workspace_top_padding"
- android:paddingBottom="@dimen/workspace_bottom_padding"
launcher:defaultScreen="@integer/config_workspaceDefaultScreen"
- launcher:cellCountX="@integer/cell_count_x"
- launcher:cellCountY="@integer/cell_count_y"
launcher:pageSpacing="@dimen/workspace_page_spacing"
- launcher:pageIndicator="@id/page_indicator"
- launcher:scrollIndicatorPaddingLeft="@dimen/workspace_divider_padding_left"
- launcher:scrollIndicatorPaddingRight="@dimen/workspace_divider_padding_right">
+ launcher:pageIndicator="@id/page_indicator">
</com.android.launcher3.Workspace>
<include layout="@layout/hotseat"
android:id="@+id/hotseat"
android:layout_width="match_parent"
- android:layout_height="@dimen/button_bar_height_plus_padding"
- android:layout_gravity="bottom" />
+ android:layout_height="match_parent" />
<include layout="@layout/overview_panel"
android:id="@+id/overview_panel"
@@ -66,8 +56,7 @@
layout="@layout/page_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="bottom|center_horizontal"
- android:layout_marginBottom="@dimen/button_bar_height_plus_padding" />
+ android:layout_gravity="center_horizontal" />
<include
android:id="@+id/qsb_bar"
@@ -90,8 +79,8 @@
<com.android.launcher3.DrawableStateProxyView
android:id="@+id/voice_button_proxy"
- android:layout_width="80dp"
- android:layout_height="@dimen/qsb_bar_height"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
android:layout_gravity="top|end"
android:clickable="true"
android:onClick="onClickVoiceButton"
diff --git a/res/layout-port/search_bar.xml b/res/layout-port/search_bar.xml
index 1e12e9e..69dd61a 100644
--- a/res/layout-port/search_bar.xml
+++ b/res/layout-port/search_bar.xml
@@ -17,9 +17,6 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3"
style="@style/SearchDropTargetBar"
- android:layout_width="match_parent"
- android:layout_height="@dimen/search_bar_height"
- android:layout_gravity="bottom|center_horizontal"
android:background="@drawable/search_frame">
<!-- Global search icon -->
<com.android.launcher3.HolographicLinearLayout
@@ -29,8 +26,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
+ android:layout_centerVertical="true"
android:layout_alignParentStart="true"
- android:layout_alignParentTop="true"
android:layout_toStartOf="@+id/voice_button_container"
android:paddingStart="8dp"
android:onClick="onClickSearchButton"
@@ -41,7 +38,8 @@
android:id="@+id/search_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
- android:scaleType="fitStart"
+ android:layout_gravity="start"
+ android:scaleType="fitCenter"
android:src="@drawable/ic_home_search_normal_holo"
android:adjustViewBounds="true" />
</com.android.launcher3.HolographicLinearLayout>
@@ -51,22 +49,22 @@
style="@style/SearchButton"
launcher:sourceImageViewId="@+id/voice_button"
android:id="@+id/voice_button_container"
- android:layout_width="@dimen/search_bar_height"
+ android:layout_width="@dimen/app_icon_size"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
+ android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
- android:layout_alignParentTop="true"
android:paddingEnd="8dp"
- android:gravity="end"
android:onClick="onClickVoiceButton"
android:focusable="true"
android:clickable="true"
android:contentDescription="@string/accessibility_voice_search_button">
<ImageView
android:id="@+id/voice_button"
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="match_parent"
- android:scaleType="fitEnd"
+ android:layout_gravity="end"
+ android:scaleType="fitCenter"
android:src="@drawable/ic_home_voice_search_holo"
android:adjustViewBounds="true" />
</com.android.launcher3.HolographicLinearLayout>
diff --git a/res/layout-sw600dp-land/launcher.xml b/res/layout-sw600dp-land/launcher.xml
deleted file mode 100644
index 8e45028..0000000
--- a/res/layout-sw600dp-land/launcher.xml
+++ /dev/null
@@ -1,108 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 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.
--->
-
-<!-- Full screen view projects under the status bar and contains the background -->
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3"
-
- android:id="@+id/launcher"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@drawable/workspace_bg">
-
- <com.android.launcher3.DragLayer
- android:id="@+id/drag_layer"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:fitsSystemWindows="true">
-
- <include
- android:id="@+id/page_indicator"
- layout="@layout/page_indicator"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom|center_horizontal" />
-
- <!-- The workspace contains 5 screens of cells -->
- <com.android.launcher3.Workspace
- android:id="@+id/workspace"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="center"
- android:paddingStart="@dimen/workspace_left_padding"
- android:paddingEnd="@dimen/workspace_right_padding"
- android:paddingTop="@dimen/workspace_top_padding"
- android:paddingBottom="@dimen/workspace_bottom_padding"
- launcher:defaultScreen="@integer/config_workspaceDefaultScreen"
- launcher:cellCountX="@integer/cell_count_x"
- launcher:cellCountY="@integer/cell_count_y"
- launcher:pageSpacing="@dimen/workspace_page_spacing"
- launcher:pageIndicator="@id/page_indicator"
- launcher:scrollIndicatorPaddingLeft="@dimen/qsb_bar_height"
- launcher:scrollIndicatorPaddingRight="@dimen/button_bar_height" />
-
- <include
- android:id="@+id/qsb_divider"
- layout="@layout/workspace_divider"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_marginStart="@dimen/qsb_bar_height"
- android:layout_gravity="start" />
-
- <include layout="@layout/hotseat"
- android:id="@+id/hotseat"
- android:layout_width="@dimen/button_bar_height_plus_padding"
- android:layout_height="match_parent"
- android:layout_gravity="end" />
-
- <include
- android:id="@+id/qsb_bar"
- layout="@layout/qsb_bar" />
-
- <!-- The Workspace cling must appear under the AppsCustomizePagedView below to ensure
- that it is still visible during the transition to AllApps and doesn't overlay on
- top of that view. -->
- <include layout="@layout/workspace_cling"
- android:id="@+id/workspace_cling"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:visibility="gone" />
-
- <include layout="@layout/folder_cling"
- android:id="@+id/folder_cling"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:visibility="gone" />
-
- <com.android.launcher3.DrawableStateProxyView
- android:id="@+id/voice_button_proxy"
- android:layout_width="@dimen/qsb_bar_height"
- android:layout_height="@dimen/app_icon_size"
- android:layout_gravity="top|start"
- android:layout_marginTop="64dp"
- android:clickable="true"
- android:onClick="onClickVoiceButton"
- android:importantForAccessibility="no"
- launcher:sourceViewId="@+id/voice_button" />
-
- <include layout="@layout/apps_customize_pane"
- android:id="@+id/apps_customize_pane"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:visibility="invisible" />
- </com.android.launcher3.DragLayer>
-</FrameLayout>
diff --git a/res/layout-sw720dp/hotseat.xml b/res/layout-sw720dp/hotseat.xml
deleted file mode 100644
index f69f68d..0000000
--- a/res/layout-sw720dp/hotseat.xml
+++ /dev/null
@@ -1,36 +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.
--->
-<com.android.launcher3.Hotseat
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3"
- launcher:cellCountX="@integer/hotseat_cell_count"
- launcher:cellCountY="1">
- <com.android.launcher3.CellLayout
- android:id="@+id/layout"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_gravity="center"
- android:paddingTop="@dimen/button_bar_height_top_padding"
- android:paddingBottom="@dimen/button_bar_height_bottom_padding"
- android:paddingStart="@dimen/button_bar_width_left_padding"
- android:paddingEnd="@dimen/button_bar_width_right_padding"
-
- launcher:cellWidth="@dimen/hotseat_cell_width"
- launcher:cellHeight="@dimen/hotseat_cell_height"
- launcher:widthGap="@dimen/hotseat_width_gap"
- launcher:heightGap="@dimen/hotseat_height_gap"
- launcher:maxGap="@dimen/hotseat_width_gap" />
-</com.android.launcher3.Hotseat>
diff --git a/res/layout-sw720dp/launcher.xml b/res/layout-sw720dp/launcher.xml
index 82f0178..fee0198 100644
--- a/res/layout-sw720dp/launcher.xml
+++ b/res/layout-sw720dp/launcher.xml
@@ -35,25 +35,15 @@
android:id="@+id/workspace"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:paddingStart="@dimen/workspace_left_padding"
- android:paddingEnd="@dimen/workspace_right_padding"
- android:paddingTop="@dimen/workspace_top_padding"
- android:paddingBottom="@dimen/workspace_bottom_padding"
- android:layout_gravity="center"
launcher:defaultScreen="@integer/config_workspaceDefaultScreen"
- launcher:cellCountX="@integer/cell_count_x"
- launcher:cellCountY="@integer/cell_count_y"
launcher:pageSpacing="@dimen/workspace_page_spacing"
- launcher:pageIndicator="@id/page_indicator"
- launcher:scrollIndicatorPaddingLeft="@dimen/workspace_divider_padding_left"
- launcher:scrollIndicatorPaddingRight="@dimen/workspace_divider_padding_right">
+ launcher:pageIndicator="@id/page_indicator">
</com.android.launcher3.Workspace>
<include layout="@layout/hotseat"
android:id="@+id/hotseat"
android:layout_width="match_parent"
- android:layout_height="@dimen/button_bar_height_plus_padding"
- android:layout_gravity="bottom" />
+ android:layout_height="match_parent" />
<include
android:id="@+id/qsb_bar"
@@ -70,8 +60,7 @@
layout="@layout/page_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="bottom|center_horizontal"
- android:layout_marginBottom="@dimen/button_bar_height_plus_padding" />
+ android:layout_gravity="center_horizontal" />
<!-- The Workspace cling must appear under the AppsCustomizePagedView below to ensure
that it is still visible during the transition to AllApps and doesn't overlay on
@@ -90,9 +79,8 @@
<com.android.launcher3.DrawableStateProxyView
android:id="@+id/voice_button_proxy"
- android:layout_width="80dp"
- android:layout_height="@dimen/qsb_bar_height"
- android:layout_marginEnd="@dimen/qsb_voice_proxy_padding_right"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
android:layout_gravity="top|end"
android:clickable="true"
android:onClick="onClickVoiceButton"
diff --git a/res/layout-sw720dp/search_bar.xml b/res/layout-sw720dp/search_bar.xml
index 44c969b..69dd61a 100644
--- a/res/layout-sw720dp/search_bar.xml
+++ b/res/layout-sw720dp/search_bar.xml
@@ -17,9 +17,6 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3"
style="@style/SearchDropTargetBar"
- android:layout_width="match_parent"
- android:layout_height="@dimen/search_bar_height"
- android:layout_gravity="bottom|center_horizontal"
android:background="@drawable/search_frame">
<!-- Global search icon -->
<com.android.launcher3.HolographicLinearLayout
@@ -29,8 +26,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
+ android:layout_centerVertical="true"
android:layout_alignParentStart="true"
- android:layout_alignParentTop="true"
android:layout_toStartOf="@+id/voice_button_container"
android:paddingStart="8dp"
android:onClick="onClickSearchButton"
@@ -41,6 +38,8 @@
android:id="@+id/search_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
+ android:layout_gravity="start"
+ android:scaleType="fitCenter"
android:src="@drawable/ic_home_search_normal_holo"
android:adjustViewBounds="true" />
</com.android.launcher3.HolographicLinearLayout>
@@ -50,21 +49,22 @@
style="@style/SearchButton"
launcher:sourceImageViewId="@+id/voice_button"
android:id="@+id/voice_button_container"
- android:layout_width="@dimen/search_bar_height"
+ android:layout_width="@dimen/app_icon_size"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
+ android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
- android:layout_alignParentTop="true"
android:paddingEnd="8dp"
- android:gravity="end"
android:onClick="onClickVoiceButton"
android:focusable="true"
android:clickable="true"
android:contentDescription="@string/accessibility_voice_search_button">
<ImageView
android:id="@+id/voice_button"
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:layout_gravity="end"
+ android:scaleType="fitCenter"
android:src="@drawable/ic_home_voice_search_holo"
android:adjustViewBounds="true" />
</com.android.launcher3.HolographicLinearLayout>
diff --git a/res/layout-sw720dp/workspace.xml b/res/layout-sw720dp/workspace.xml
deleted file mode 100644
index 00ed529..0000000
--- a/res/layout-sw720dp/workspace.xml
+++ /dev/null
@@ -1,33 +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.
--->
-
-<!-- The workspace contains 5 screens of cells -->
-
-<com.android.launcher3.Workspace
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3"
- android:paddingStart="@dimen/workspace_left_padding"
- android:paddingEnd="@dimen/workspace_right_padding"
- android:paddingTop="@dimen/workspace_top_padding"
- android:paddingBottom="@dimen/workspace_bottom_padding"
- launcher:defaultScreen="2"
- launcher:pageSpacing="@dimen/workspace_page_spacing">
- <include android:id="@+id/cell1" layout="@layout/workspace_screen" />
- <include android:id="@+id/cell2" layout="@layout/workspace_screen" />
- <include android:id="@+id/cell3" layout="@layout/workspace_screen" />
- <include android:id="@+id/cell4" layout="@layout/workspace_screen" />
- <include android:id="@+id/cell5" layout="@layout/workspace_screen" />
-</com.android.launcher3.Workspace>
diff --git a/res/layout-port/application.xml b/res/layout/application.xml
index 4dcc774..e4909dd 100644
--- a/res/layout-port/application.xml
+++ b/res/layout/application.xml
@@ -15,6 +15,6 @@
-->
<com.android.launcher3.BubbleTextView xmlns:android="http://schemas.android.com/apk/res/android"
- style="@style/WorkspaceIcon.Portrait"
+ style="@style/WorkspaceIcon"
android:focusable="true"
android:background="@drawable/focusable_view_bg" />
diff --git a/res/layout/now_page_indicator_marker.xml b/res/layout/custom_content_page_indicator_marker.xml
index 7d05627..1685992 100644
--- a/res/layout/now_page_indicator_marker.xml
+++ b/res/layout/custom_content_page_indicator_marker.xml
@@ -17,18 +17,19 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3"
android:layout_width="wrap_content"
- android:layout_height="wrap_content">
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical">
<ImageView
android:id="@+id/inactive"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:src="@drawable/now_page"
+ android:src="@drawable/custom_content_page"
/>
<ImageView
android:id="@+id/active"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:src="@drawable/now_page"
+ android:src="@drawable/custom_content_page"
android:alpha="0"
/>
</com.android.launcher3.PageIndicatorMarker>
diff --git a/res/layout-port/folder_icon.xml b/res/layout/folder_icon.xml
index 686fb17..5a9a834 100644
--- a/res/layout-port/folder_icon.xml
+++ b/res/layout/folder_icon.xml
@@ -24,10 +24,10 @@
<ImageView
android:id="@+id/preview_background"
android:layout_gravity="center_horizontal"
- android:layout_width="@dimen/folder_preview_size"
- android:layout_height="@dimen/folder_preview_size"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
android:src="@drawable/portal_ring_inner_holo"/>
<com.android.launcher3.BubbleTextView
android:id="@+id/folder_icon_name"
- style="@style/WorkspaceIcon.Portrait.Folder"/>
+ style="@style/WorkspaceIcon"/>
</com.android.launcher3.FolderIcon>
diff --git a/res/layout/workspace_divider.xml b/res/layout/hotseat.xml
index 304e532..dc9ed2a 100644
--- a/res/layout/workspace_divider.xml
+++ b/res/layout/hotseat.xml
@@ -13,11 +13,12 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<ImageView
+<com.android.launcher3.Hotseat
xmlns:android="http://schemas.android.com/apk/res/android"
- android:paddingStart="@dimen/workspace_divider_padding_left"
- android:paddingEnd="@dimen/workspace_divider_padding_right"
- android:paddingTop="@dimen/workspace_divider_padding_top"
- android:paddingBottom="@dimen/workspace_divider_padding_bottom"
- android:scaleType="fitXY"
- android:src="@drawable/hotseat_track_holo" />
+ xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3">
+ <com.android.launcher3.CellLayout
+ android:id="@+id/layout"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_gravity="center" />
+</com.android.launcher3.Hotseat>
diff --git a/res/layout/page_indicator_marker.xml b/res/layout/page_indicator_marker.xml
index 0260e7e..496f3bd 100644
--- a/res/layout/page_indicator_marker.xml
+++ b/res/layout/page_indicator_marker.xml
@@ -17,7 +17,8 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3"
android:layout_width="wrap_content"
- android:layout_height="wrap_content">
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical">
<ImageView
android:id="@+id/inactive"
android:layout_width="wrap_content"
diff --git a/res/layout/qsb_bar.xml b/res/layout/qsb_bar.xml
index 56e0523..f0e3bbf 100644
--- a/res/layout/qsb_bar.xml
+++ b/res/layout/qsb_bar.xml
@@ -16,16 +16,24 @@
<com.android.launcher3.SearchDropTargetBar
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/QSBBar"
- android:focusable="false">
+ android:focusable="false"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
<!-- Search buttons container -->
<include android:id="@+id/qsb_search_bar"
- layout="@layout/search_bar" />
+ layout="@layout/search_bar"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center" />
<!-- Drag specific targets container -->
<LinearLayout
style="@style/SearchDropTargetBar"
- android:id="@+id/drag_target_bar">
+ android:id="@+id/drag_target_bar"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center">
<include
layout="@layout/drop_target_bar" />
diff --git a/res/layout/user_folder.xml b/res/layout/user_folder.xml
index 3eeec35..d790c53 100644
--- a/res/layout/user_folder.xml
+++ b/res/layout/user_folder.xml
@@ -30,16 +30,8 @@
android:id="@+id/folder_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:paddingStart="@dimen/folder_padding"
- android:paddingEnd="@dimen/folder_padding"
- android:paddingTop="@dimen/folder_padding"
- android:paddingBottom="@dimen/folder_padding"
android:cacheColorHint="#ff333333"
- android:hapticFeedbackEnabled="false"
- launcher:widthGap="@dimen/folder_width_gap"
- launcher:heightGap="@dimen/folder_height_gap"
- launcher:cellWidth="@dimen/folder_cell_width"
- launcher:cellHeight="@dimen/folder_cell_height" />
+ android:hapticFeedbackEnabled="false" />
</ScrollView>
<com.android.launcher3.FolderEditText
diff --git a/res/layout/workspace_screen.xml b/res/layout/workspace_screen.xml
index acc9f66..855cf39 100644
--- a/res/layout/workspace_screen.xml
+++ b/res/layout/workspace_screen.xml
@@ -20,14 +20,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:paddingStart="@dimen/cell_layout_left_padding"
- android:paddingEnd="@dimen/cell_layout_right_padding"
- android:paddingTop="@dimen/cell_layout_top_padding"
- android:paddingBottom="@dimen/cell_layout_bottom_padding"
android:hapticFeedbackEnabled="false"
- launcher:cellWidth="@dimen/workspace_cell_width"
- launcher:cellHeight="@dimen/workspace_cell_height"
- launcher:widthGap="@dimen/workspace_width_gap"
- launcher:heightGap="@dimen/workspace_height_gap"
launcher:maxGap="@dimen/workspace_max_gap" />
diff --git a/res/values-land/config.xml b/res/values-land/config.xml
index da9f9f9..121bb0c 100644
--- a/res/values-land/config.xml
+++ b/res/values-land/config.xml
@@ -20,11 +20,4 @@
<bool name="config_useDropTargetDownTransition">false</bool>
<!-- Whether or not to fade the side pages -->
<bool name="config_workspaceFadeAdjacentScreens">false</bool>
-
- <!-- Folder max bounds and max number of items. Note: folder_max_count_x * folder_max_count_y
- >= folder_max_num_items. If any values are set to 0, the values will be determined automatically.
- A value of -1 indicates unbounded -->
- <integer name="folder_max_count_x">6</integer>
- <integer name="folder_max_count_y">-1</integer>
- <integer name="folder_max_num_items">-1</integer>
</resources>
diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml
index 5edd143..4d94d7e 100644
--- a/res/values-land/dimens.xml
+++ b/res/values-land/dimens.xml
@@ -20,39 +20,9 @@
<dimen name="toolbar_button_horizontal_padding">0dip</dimen>
<!-- Workspace -->
- <dimen name="hotseat_cell_width">64dp</dimen>
- <dimen name="hotseat_cell_height">58dp</dimen>
<!-- We really want the page spacing to be the max of either the button bar
height or the qsb bar height -->
<dimen name="workspace_page_spacing">-1dp</dimen>
- <dimen name="workspace_divider_padding_left">0dp</dimen>
- <dimen name="workspace_divider_padding_right">0dp</dimen>
- <dimen name="workspace_divider_padding_top">12dp</dimen>
- <dimen name="workspace_divider_padding_bottom">12dp</dimen>
-
- <!-- Block spacing on each side of the screen. And also padding
- for the portals to look right. -->
- <dimen name="cell_layout_left_padding">@dimen/cell_layout_left_padding_land</dimen>
- <dimen name="cell_layout_right_padding">@dimen/cell_layout_right_padding_land</dimen>
- <dimen name="cell_layout_top_padding">@dimen/cell_layout_top_padding_land</dimen>
- <dimen name="cell_layout_bottom_padding">@dimen/cell_layout_bottom_padding_land</dimen>
- <!-- Workspace padding -->
- <dimen name="workspace_left_padding">@dimen/workspace_left_padding_land</dimen>
- <dimen name="workspace_right_padding">@dimen/workspace_right_padding_land</dimen>
- <dimen name="workspace_top_padding">@dimen/workspace_top_padding_land</dimen>
- <dimen name="workspace_bottom_padding">@dimen/workspace_bottom_padding_land</dimen>
-
- <dimen name="app_icon_padding_top">6dp</dimen>
-
- <!-- height of the bottom row of controls -->
- <dimen name="button_bar_height">68dip</dimen>
- <!-- Because portal animations go beyond the bounds of an icon, we need
- to make the dock layout slightly larger than the button_bar_height -->
- <dimen name="button_bar_height_top_padding">8dp</dimen>
- <dimen name="button_bar_height_bottom_padding">0dp</dimen>
- <dimen name="button_bar_width_left_padding">0dp</dimen>
- <dimen name="button_bar_width_right_padding">0dp</dimen>
- <dimen name="button_bar_height_plus_padding">76dp</dimen>
<!-- AppsCustomize -->
<dimen name="apps_customize_cell_width">80dp</dimen>
@@ -71,14 +41,4 @@
<integer name="apps_customize_widget_cell_count_y">2</integer>
<integer name="apps_customize_cling_focused_x">2</integer>
<integer name="apps_customize_cling_focused_y">1</integer>
-
-<!-- Folders -->
- <!-- The size of the image which sits behind the preview of the folder contents -->
- <dimen name="folder_preview_size">58dp</dimen>
-
-<!-- Workspace cell size -->
- <dimen name="workspace_cell_width">@dimen/workspace_cell_width_land</dimen>
- <dimen name="workspace_cell_height">@dimen/workspace_cell_height_land</dimen>
- <dimen name="workspace_width_gap">@dimen/workspace_width_gap_land</dimen>
- <dimen name="workspace_height_gap">@dimen/workspace_height_gap_land</dimen>
</resources>
diff --git a/res/values-land/styles.xml b/res/values-land/styles.xml
index 6c9fd50..ccb5fcb 100644
--- a/res/values-land/styles.xml
+++ b/res/values-land/styles.xml
@@ -20,23 +20,10 @@
<resources>
<!-- Search Bar -->
<style name="QSBBar">
- <item name="android:orientation">vertical</item>
- <item name="android:layout_width">@dimen/qsb_bar_height</item>
- <item name="android:layout_height">match_parent</item>
- <item name="android:layout_gravity">start</item>
</style>
<style name="SearchDropTargetBar">
- <item name="android:orientation">vertical</item>
- <item name="android:layout_width">match_parent</item>
- <item name="android:layout_height">wrap_content</item>
- <item name="android:layout_gravity">center_horizontal</item>
</style>
<style name="SearchButton">
- <item name="android:layout_gravity">center_horizontal</item>
- <item name="android:paddingTop">@dimen/toolbar_button_vertical_padding</item>
- <item name="android:paddingBottom">@dimen/toolbar_button_vertical_padding</item>
- <item name="android:paddingStart">@dimen/toolbar_button_horizontal_padding</item>
- <item name="android:paddingEnd">@dimen/toolbar_button_horizontal_padding</item>
</style>
<style name="DropTargetButtonContainer">
<item name="android:layout_width">match_parent</item>
diff --git a/res/values-port/dimens.xml b/res/values-port/dimens.xml
index 969d335..bee2dd5 100644
--- a/res/values-port/dimens.xml
+++ b/res/values-port/dimens.xml
@@ -15,25 +15,7 @@
-->
<resources>
-<!-- QSB -->
- <dimen name="qsb_bar_height_inset">37dp</dimen>
- <dimen name="qsb_bar_height">43dp</dimen>
- <dimen name="qsb_padding_left">3dp</dimen>
- <dimen name="qsb_padding_right">3dp</dimen>
-
<!-- Workspace -->
- <!-- Block spacing on each side of the screen. And also padding
- for the portals to look right. -->
- <dimen name="cell_layout_left_padding">@dimen/cell_layout_left_padding_port</dimen>
- <dimen name="cell_layout_right_padding">@dimen/cell_layout_right_padding_port</dimen>
- <dimen name="cell_layout_top_padding">@dimen/cell_layout_top_padding_port</dimen>
- <dimen name="cell_layout_bottom_padding">@dimen/cell_layout_bottom_padding_port</dimen>
- <!-- Workspace padding -->
- <dimen name="workspace_left_padding">@dimen/workspace_left_padding_port</dimen>
- <dimen name="workspace_right_padding">@dimen/workspace_right_padding_port</dimen>
- <dimen name="workspace_top_padding">@dimen/workspace_top_padding_port</dimen>
- <dimen name="workspace_bottom_padding">@dimen/workspace_bottom_padding_port</dimen>
-
<dimen name="workspace_page_spacing">-1dp</dimen>
<!-- AppsCustomize -->
@@ -50,10 +32,4 @@
<dimen name="apps_customize_widget_cell_height_gap">10dp</dimen>
<integer name="apps_customize_widget_cell_count_x">2</integer>
<integer name="apps_customize_widget_cell_count_y">3</integer>
-
-<!-- Workspace cell size -->
- <dimen name="workspace_cell_width">@dimen/workspace_cell_width_port</dimen>
- <dimen name="workspace_cell_height">@dimen/workspace_cell_height_port</dimen>
- <dimen name="workspace_width_gap">@dimen/workspace_width_gap_port</dimen>
- <dimen name="workspace_height_gap">@dimen/workspace_height_gap_port</dimen>
</resources>
diff --git a/res/values-sw340dp-land/dimens.xml b/res/values-sw340dp-land/dimens.xml
index facbf56..7901dc4 100644
--- a/res/values-sw340dp-land/dimens.xml
+++ b/res/values-sw340dp-land/dimens.xml
@@ -17,10 +17,4 @@
<resources>
<!-- Clings -->
<dimen name="folderClingMarginTop">50dp</dimen>
-
-<!-- Workspace -->
- <dimen name="workspace_divider_padding_top">6dp</dimen>
- <dimen name="workspace_divider_padding_bottom">6dp</dimen>
-
- <dimen name="qsb_bar_height">48dp</dimen>
</resources>
diff --git a/res/values-sw340dp-land/styles.xml b/res/values-sw340dp-land/styles.xml
deleted file mode 100644
index 203827d..0000000
--- a/res/values-sw340dp-land/styles.xml
+++ /dev/null
@@ -1,28 +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>
-<!-- Workspace -->
- <style name="QSBBar">
- <item name="android:orientation">vertical</item>
- <item name="android:layout_width">@dimen/qsb_bar_height</item>
- <item name="android:layout_height">match_parent</item>
- <item name="android:layout_gravity">start|center_vertical</item>
- </style>
-</resources>
diff --git a/res/values-sw340dp-port/dimens.xml b/res/values-sw340dp-port/dimens.xml
index 18f2831..2dbcb45 100644
--- a/res/values-sw340dp-port/dimens.xml
+++ b/res/values-sw340dp-port/dimens.xml
@@ -18,18 +18,6 @@
<!-- Clings -->
<dimen name="folderClingMarginTop">70dp</dimen>
-<!-- Workspace -->
- <dimen name="workspace_divider_padding_left">6dp</dimen>
- <dimen name="workspace_divider_padding_right">6dp</dimen>
-
- <!-- qsb_bar_height_inset represents qsb_bar_height minus the padding
- that we put on each page for allowing folders to draw out of bounds -->
- <dimen name="qsb_bar_height_inset">48dp</dimen>
- <dimen name="qsb_bar_height">54dp</dimen>
- <dimen name="qsb_padding_left">6dp</dimen>
- <dimen name="qsb_padding_right">6dp</dimen>
- <dimen name="search_bar_height">48dp</dimen>
-
<!-- AppsCustomize -->
<dimen name="apps_customize_pageLayoutPaddingTop">16dp</dimen>
<dimen name="apps_customize_pageLayoutPaddingBottom">20dp</dimen>
diff --git a/res/values-sw340dp/dimens.xml b/res/values-sw340dp/dimens.xml
index 93de009..69d6e58 100644
--- a/res/values-sw340dp/dimens.xml
+++ b/res/values-sw340dp/dimens.xml
@@ -17,26 +17,4 @@
<resources>
<!-- Drag padding to add to the bottom of drop targets -->
<dimen name="drop_target_drag_padding">20dp</dimen>
-
-<!-- Hotseat -->
- <dimen name="hotseat_width_gap">0dp</dimen>
- <dimen name="hotseat_height_gap">0dp</dimen>
- <!-- height of the bottom row of controls -->
- <dimen name="button_bar_height">80dip</dimen>
- <!-- Because portal animations go beyond the bounds of an icon, we need
- to make the dock layout slightly larger than the button_bar_height -->
- <dimen name="button_bar_height_bottom_padding">8dp</dimen>
- <dimen name="button_bar_width_left_padding">8dp</dimen>
- <dimen name="button_bar_width_right_padding">8dp</dimen>
- <dimen name="button_bar_height_plus_padding">80dp</dimen>
-
-<!-- CellLayout padding land / port-->
- <dimen name="cell_layout_left_padding_port">8dp</dimen>
- <dimen name="cell_layout_left_padding_land">8dp</dimen>
- <dimen name="cell_layout_right_padding_port">8dp</dimen>
- <dimen name="cell_layout_right_padding_land">8dp</dimen>
- <dimen name="cell_layout_top_padding_port">8dp</dimen>
- <dimen name="cell_layout_top_padding_land">8dp</dimen>
- <dimen name="cell_layout_bottom_padding_port">8dp</dimen>
- <dimen name="cell_layout_bottom_padding_land">8dp</dimen>
</resources>
diff --git a/res/values-sw380dp-port/dimens.xml b/res/values-sw380dp-port/dimens.xml
deleted file mode 100644
index eef6eb2..0000000
--- a/res/values-sw380dp-port/dimens.xml
+++ /dev/null
@@ -1,35 +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>
-<!-- Workspace -->
- <!-- qsb_bar_height_inset represents qsb_bar_height minus the padding
- that we put on each page for allowing folders to draw out of bounds -->
- <dimen name="qsb_bar_height_inset">48dp</dimen>
- <dimen name="qsb_bar_height">56dp</dimen>
- <dimen name="qsb_padding_left">8dp</dimen>
- <dimen name="qsb_padding_right">8dp</dimen>
- <dimen name="search_bar_height">48dp</dimen>
-
- <dimen name="workspace_divider_padding_left">8dp</dimen>
- <dimen name="workspace_divider_padding_right">8dp</dimen>
- <dimen name="workspace_width_gap_land">0dp</dimen>
- <dimen name="workspace_width_gap_port">8dp</dimen>
- <dimen name="workspace_height_gap_land">0dp</dimen>
- <dimen name="workspace_height_gap_port">0dp</dimen>
-
- <dimen name="hotseat_width_gap">2dp</dimen>
-</resources>
diff --git a/res/values-sw600dp-land/config.xml b/res/values-sw600dp-land/config.xml
deleted file mode 100644
index 3e8a92b..0000000
--- a/res/values-sw600dp-land/config.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<resources>
-<!-- Folder max bounds and max number of items. Note: folder_max_count_x * folder_max_count_y
- >= folder_max_num_items. If any values are set to 0, the values will be determined automatically.
- A value of -1 indicates unbounded -->
- <integer name="folder_max_count_x">8</integer>
- <integer name="folder_max_count_y">-1</integer>
- <integer name="folder_max_num_items">-1</integer>
-</resources>
diff --git a/res/values-sw600dp-land/dimens.xml b/res/values-sw600dp-land/dimens.xml
index 3d4ba1c..7f5594d 100644
--- a/res/values-sw600dp-land/dimens.xml
+++ b/res/values-sw600dp-land/dimens.xml
@@ -15,14 +15,6 @@
-->
<resources>
- <dimen name="app_icon_padding_top">0dp</dimen>
- <dimen name="app_icon_drawable_padding_land">0dp</dimen>
- <dimen name="workspace_icon_text_size">11sp</dimen>
-
-<!-- Hotseat -->
- <dimen name="button_bar_width_left_padding">14dp</dimen>
- <dimen name="button_bar_width_right_padding">14dp</dimen>
-
<!-- AppsCustomize -->
<dimen name="apps_customize_pageLayoutWidthGap">36dp</dimen>
<dimen name="apps_customize_pageLayoutHeightGap">8dp</dimen>
@@ -30,13 +22,6 @@
<dimen name="apps_customize_pageLayoutPaddingBottom">14dp</dimen>
<!-- QSB -->
- <dimen name="qsb_bar_height">82dp</dimen>
<dimen name="toolbar_button_vertical_padding">12dip</dimen>
<dimen name="toolbar_button_horizontal_padding">20dip</dimen>
-
-<!-- Workspace -->
- <dimen name="workspace_divider_padding_top">12dp</dimen>
- <dimen name="workspace_divider_padding_bottom">12dp</dimen>
- <dimen name="workspace_divider_padding_left">0dp</dimen>
- <dimen name="workspace_divider_padding_right">0dp</dimen>
</resources>
diff --git a/res/values-sw600dp-port/dimens.xml b/res/values-sw600dp-port/dimens.xml
index 8ad6d2e..7cc3c79 100644
--- a/res/values-sw600dp-port/dimens.xml
+++ b/res/values-sw600dp-port/dimens.xml
@@ -22,7 +22,4 @@
<dimen name="apps_customize_pageLayoutHeightGap">24dp</dimen>
<dimen name="apps_customize_pageLayoutPaddingTop">25dp</dimen>
<dimen name="apps_customize_pageLayoutPaddingBottom">10dp</dimen>
-
-<!-- QSB -->
- <dimen name="qsb_bar_height">54dp</dimen>
</resources>
diff --git a/res/values-sw600dp/config.xml b/res/values-sw600dp/config.xml
index d657d43..2ec2f14 100644
--- a/res/values-sw600dp/config.xml
+++ b/res/values-sw600dp/config.xml
@@ -1,8 +1,5 @@
<resources>
- <integer name="cell_count_x">6</integer>
- <integer name="cell_count_y">6</integer>
- <integer name="hotseat_cell_count">7</integer>
- <integer name="hotseat_all_apps_index">3</integer>
+ <bool name="is_tablet">true</bool>
<bool name="allow_rotation">true</bool>
<!-- Whether or not to use custom clings if a custom workspace layout is passed in -->
@@ -11,18 +8,7 @@
<!-- DragController -->
<integer name="config_flingToDeleteMinVelocity">-1000</integer>
-<!-- Folder max bounds and max number of items. Note: folder_max_count_x * folder_max_count_y
- >= folder_max_num_items. If any values are set to 0, the values will be determined automatically.
- A value of -1 indicates unbounded -->
- <integer name="folder_max_count_x">6</integer>
- <integer name="folder_max_count_y">-1</integer>
- <integer name="folder_max_num_items">-1</integer>
-
<!-- Camera distance for the overscroll effect. We use a higher value here because the
workspace screens run nearly flush to the edge of the screen-->
<integer name="config_cameraDistance">14000</integer>
-
-<!-- Hotseat -->
- <!-- must be between 0 and 100 -->
- <integer name="hotseat_item_scale_percentage">80</integer>
</resources>
diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml
index bf19e5c..c261c00 100644
--- a/res/values-sw600dp/dimens.xml
+++ b/res/values-sw600dp/dimens.xml
@@ -16,44 +16,6 @@
<resources>
<dimen name="app_icon_size">64dp</dimen>
- <dimen name="reveal_radius">64dp</dimen>
- <dimen name="app_icon_drawable_padding">3dp</dimen>
- <dimen name="app_icon_padding_top">4dp</dimen>
-
-<!-- qsb_bar_height_inset represents qsb_bar_height minus the padding
- that we put on each page for allowing folders to draw out of bounds -->
- <dimen name="qsb_bar_height_inset">34dp</dimen>
- <dimen name="qsb_bar_height">48dp</dimen>
- <dimen name="qsb_padding_left">16dp</dimen>
- <dimen name="qsb_padding_right">16dp</dimen>
-
- <dimen name="search_bar_height">48dp</dimen>
-
-<!-- Hotseat -->
- <dimen name="hotseat_cell_width">70dp</dimen>
- <dimen name="hotseat_cell_height">70dp</dimen>
- <dimen name="hotseat_width_gap">-1dp</dimen>
- <dimen name="hotseat_height_gap">-1dp</dimen>
- <dimen name="button_bar_height">94dip</dimen>
- <dimen name="button_bar_height_bottom_padding">14dp</dimen>
- <dimen name="button_bar_height_top_padding">20dp</dimen>
- <dimen name="button_bar_width_left_padding">25dp</dimen>
- <dimen name="button_bar_width_right_padding">25dp</dimen>
- <dimen name="button_bar_height_plus_padding">104dp</dimen>
-
-<!-- Folders -->
- <!-- The size of the image which sits behind the preview of the folder contents -->
- <dimen name="folder_preview_size">68dp</dimen>
- <dimen name="folder_cell_width">86dp</dimen>
- <dimen name="folder_cell_height">90dp</dimen>
- <dimen name="folder_width_gap">3dp</dimen>
- <dimen name="folder_height_gap">3dp</dimen>
- <dimen name="folder_padding">6dp</dimen>
-
- <dimen name="cell_layout_left_padding_port">12dp</dimen>
- <dimen name="cell_layout_right_padding_port">12dp</dimen>
- <dimen name="workspace_divider_padding_left">19dp</dimen>
- <dimen name="workspace_divider_padding_right">19dp</dimen>
<!-- AppsCustomize -->
<dimen name="apps_customize_cell_width">96dp</dimen>
@@ -67,13 +29,4 @@
<dimen name="app_widget_preview_label_margin_top">8dp</dimen>
<dimen name="app_widget_preview_label_margin_left">@dimen/app_widget_preview_padding_left</dimen>
<dimen name="app_widget_preview_label_margin_right">@dimen/app_widget_preview_padding_right</dimen>
-<!-- Workspace cell size -->
- <dimen name="workspace_cell_width_land">88dp</dimen>
- <dimen name="workspace_cell_width_port">96dp</dimen>
- <dimen name="workspace_cell_height_land">88dp</dimen>
- <dimen name="workspace_cell_height_port">96dp</dimen>
- <dimen name="workspace_width_gap_land">32dp</dimen>
- <dimen name="workspace_width_gap_port">0dp</dimen>
- <dimen name="workspace_height_gap_land">0dp</dimen>
- <dimen name="workspace_height_gap_port">24dp</dimen>
</resources>
diff --git a/res/values-sw720dp-port/dimens.xml b/res/values-sw720dp-port/dimens.xml
index fbc0799..9cf37ff 100644
--- a/res/values-sw720dp-port/dimens.xml
+++ b/res/values-sw720dp-port/dimens.xml
@@ -33,26 +33,9 @@
<dimen name="scroll_zone">40dp</dimen>
<dimen name="workspace_page_spacing">24dp</dimen>
- <dimen name="qsb_bar_height">102dp</dimen>
- <dimen name="qsb_bar_height_inset">102dp</dimen>
- <dimen name="qsb_padding_left">72dp</dimen>
- <dimen name="qsb_padding_right">72dp</dimen>
- <!-- We offset the proxy to overlap with the voice icon -->
- <dimen name="qsb_voice_proxy_padding_right">100dp</dimen>
-
<integer name="apps_customize_cling_focused_x">2</integer>
<integer name="apps_customize_cling_focused_y">2</integer>
- <!-- Divider width set to match the qsb width -->
- <dimen name="workspace_divider_padding_left">72dp</dimen>
- <dimen name="workspace_divider_padding_right">72dp</dimen>
-
-<!-- Hotseat -->
- <dimen name="hotseat_width_gap">14dp</dimen>
- <dimen name="button_bar_height">126dp</dimen>
- <dimen name="button_bar_height_plus_padding">126dp</dimen>
- <dimen name="button_bar_height_bottom_padding">32dp</dimen>
-
<!-- Cling -->
<!-- The offset for the text in the cling -->
<dimen name="cling_text_block_offset_x">80dp</dimen>
diff --git a/res/values-sw720dp/config.xml b/res/values-sw720dp/config.xml
index 03e5f9c..4f537a9 100644
--- a/res/values-sw720dp/config.xml
+++ b/res/values-sw720dp/config.xml
@@ -1,25 +1,14 @@
<resources>
- <integer name="cell_count_x">8</integer>
- <integer name="cell_count_y">5</integer>
- <integer name="hotseat_cell_count">9</integer>
- <integer name="hotseat_all_apps_index">4</integer>
<bool name="config_largeHeap">true</bool>
- <bool name="is_large_screen">true</bool>
+ <bool name="is_large_tablet">true</bool>
<!-- AllApps/Customize/AppsCustomize -->
<!-- Out of 100, the percent to shrink the workspace during spring loaded mode. -->
<integer name="config_workspaceSpringLoadShrinkPercentage">90</integer>
-<!-- Folder max bounds and max number of items. Note: folder_max_count_x * folder_max_count_y
- >= folder_max_num_items. If any values are set to 0, the values will be determined automatically.
- A value of -1 indicates unbounded -->
- <integer name="folder_max_count_x">0</integer>
- <integer name="folder_max_count_y">-1</integer>
- <integer name="folder_max_num_items">-1</integer>
-
<!-- Workspace -->
<!-- Whether or not the drop targets drop down as opposed to fade in -->
- <bool name="config_useDropTargetDownTransition">true</bool>
+ <bool name="config_useDropTargetDownTransition">false</bool>
<!-- Whether or not to fade the side pages -->
<bool name="config_workspaceFadeAdjacentScreens">true</bool>
diff --git a/res/values-sw720dp/dimens.xml b/res/values-sw720dp/dimens.xml
index 439709a..c9639dd 100644
--- a/res/values-sw720dp/dimens.xml
+++ b/res/values-sw720dp/dimens.xml
@@ -16,38 +16,16 @@
<resources>
<dimen name="app_icon_size">72dp</dimen>
- <dimen name="app_icon_padding_top">0dp</dimen>
- <dimen name="reveal_radius">72dp</dimen>
-
-<!-- Hotseat -->
- <dimen name="button_bar_height">82dp</dimen>
- <dimen name="button_bar_height_top_padding">12dp</dimen>
- <dimen name="button_bar_height_bottom_padding">12dp</dimen>
- <dimen name="button_bar_width_left_padding">12dp</dimen>
- <dimen name="button_bar_width_right_padding">12dp</dimen>
- <dimen name="button_bar_height_plus_padding">82dp</dimen>
- <dimen name="hotseat_width_gap">58dp</dimen>
<!-- QSB -->
<dimen name="toolbar_button_vertical_padding">8dip</dimen>
<dimen name="toolbar_button_horizontal_padding">8dip</dimen>
-<!-- Workspace -->
- <dimen name="qsb_bar_height">60dp</dimen>
- <dimen name="qsb_bar_height_inset">60dp</dimen>
- <dimen name="qsb_padding_left">177dp</dimen>
- <dimen name="qsb_padding_right">177dp</dimen>
- <!-- We offset the proxy to overlap with the voice icon -->
- <dimen name="qsb_voice_proxy_padding_right">230dp</dimen>
- <!-- 44dp high for the optical bounds -->
- <dimen name="search_bar_height">52dp</dimen>
-
<!-- AppsCustomize -->
<dimen name="apps_customize_cell_width">96dp</dimen>
<dimen name="apps_customize_cell_height">96dp</dimen>
<integer name="apps_customize_maxCellCountX">-1</integer>
<integer name="apps_customize_maxCellCountY">-1</integer>
- <dimen name="all_apps_button_vertical_padding">4dip</dimen>
<!-- dimensions for the wallpaper picker wallpaper thumbnail width -->
<dimen name="wallpaper_chooser_grid_width">196dp</dimen>
@@ -57,51 +35,4 @@
the drag view should be offset from the position of the original view. -->
<dimen name="dragViewOffsetX">0dp</dimen>
<dimen name="dragViewOffsetY">0dp</dimen>
-
-<!-- CellLayout padding land / port-->
- <dimen name="cell_layout_left_padding_port">4dp</dimen>
- <dimen name="cell_layout_left_padding_land">4dp</dimen>
- <dimen name="cell_layout_right_padding_port">4dp</dimen>
- <dimen name="cell_layout_right_padding_land">4dp</dimen>
- <dimen name="cell_layout_top_padding_port">12dp</dimen>
- <dimen name="cell_layout_top_padding_land">12dp</dimen>
- <dimen name="cell_layout_bottom_padding_port">8dp</dimen>
- <dimen name="cell_layout_bottom_padding_land">8dp</dimen>
-
-<!-- Folders -->
- <!-- The size of the image which sits behind the preview of the folder contents -->
- <dimen name="folder_cell_width">96dp</dimen>
- <dimen name="folder_cell_height">96dp</dimen>
- <dimen name="folder_preview_size">70dp</dimen>
- <dimen name="folder_width_gap">2dp</dimen>
- <dimen name="folder_height_gap">2dp</dimen>
- <dimen name="folder_padding">4dp</dimen>
-
-<!-- Workspace padding -->
- <dimen name="workspace_left_padding_port">0dp</dimen>
- <dimen name="workspace_left_padding_land">0dp</dimen>
- <dimen name="workspace_right_padding_port">0dp</dimen>
- <dimen name="workspace_right_padding_land">0dp</dimen>
-
- <dimen name="workspace_top_padding_port">@dimen/qsb_bar_height_inset</dimen>
- <dimen name="workspace_top_padding_land">@dimen/qsb_bar_height_inset</dimen>
- <dimen name="workspace_bottom_padding_port">@dimen/button_bar_height_plus_padding</dimen>
- <dimen name="workspace_bottom_padding_land">@dimen/button_bar_height_plus_padding</dimen>
-
- <!-- Divider width set to match the qsb width -->
- <dimen name="workspace_divider_width">0dp</dimen>
- <dimen name="workspace_divider_padding_left">177dp</dimen>
- <dimen name="workspace_divider_padding_right">177dp</dimen>
- <dimen name="workspace_divider_padding_top">0dp</dimen>
- <dimen name="workspace_divider_padding_bottom">0dp</dimen>
-
-<!-- Workspace cell size -->
- <dimen name="workspace_cell_width_land">96dp</dimen>
- <dimen name="workspace_cell_width_port">96dp</dimen>
- <dimen name="workspace_cell_height_land">96dp</dimen>
- <dimen name="workspace_cell_height_port">96dp</dimen>
- <dimen name="workspace_width_gap_land">50dp</dimen>
- <dimen name="workspace_width_gap_port">0dp</dimen>
- <dimen name="workspace_height_gap_land">16dp</dimen>
- <dimen name="workspace_height_gap_port">70dp</dimen>
</resources>
diff --git a/res/values-sw720dp/styles.xml b/res/values-sw720dp/styles.xml
index 5b24bdf..77898d1 100644
--- a/res/values-sw720dp/styles.xml
+++ b/res/values-sw720dp/styles.xml
@@ -51,43 +51,6 @@
</style>
<!-- Workspace -->
- <style name="WorkspaceIcon.Portrait">
- <item name="android:drawablePadding">0dp</item>
- <item name="android:paddingStart">4dp</item>
- <item name="android:paddingEnd">4dp</item>
- <item name="android:paddingTop">@dimen/app_icon_padding_top</item>
- <item name="android:paddingBottom">4dp</item>
- <item name="android:textSize">13sp</item>
- </style>
- <style name="WorkspaceIcon.Portrait.Folder">
- <item name="android:shadowRadius">0.0</item> <!-- Don't use text shadow -->
- <item name="android:drawablePadding">0dp</item>
- <item name="android:paddingStart">4dp</item>
- <item name="android:paddingEnd">4dp</item>
- <item name="android:paddingTop">0dp</item>
- <item name="android:paddingBottom">0dp</item>
- <item name="android:textSize">13sp</item>
- <item name="android:layout_marginTop">-2dp</item>
- </style>
- <style name="WorkspaceIcon.Landscape">
- <item name="android:drawablePadding">0dp</item>
- <item name="android:paddingStart">4dp</item>
- <item name="android:paddingEnd">4dp</item>
- <item name="android:paddingTop">@dimen/app_icon_padding_top</item>
- <item name="android:paddingBottom">4dp</item>
- <item name="android:textSize">13sp</item>
- </style>
- <style name="WorkspaceIcon.Landscape.Folder">
- <item name="android:shadowRadius">0.0</item> <!-- Don't use text shadow -->
- <item name="android:drawablePadding">0dp</item>
- <item name="android:paddingStart">4dp</item>
- <item name="android:paddingEnd">4dp</item>
- <item name="android:paddingTop">0dp</item>
- <item name="android:paddingBottom">0dp</item>
- <item name="android:textSize">13sp</item>
- <item name="android:layout_marginTop">-2dp</item>
- </style>
-
<style name="Theme" parent="android:Theme.Holo.Wallpaper.NoTitleBar">
<item name="android:windowActionModeOverlay">true</item>
</style>
@@ -123,23 +86,10 @@
<!-- QSB Search / Drop Target bar -->
<style name="QSBBar">
- <item name="android:orientation">horizontal</item>
- <item name="android:layout_width">match_parent</item>
- <item name="android:layout_height">@dimen/qsb_bar_height</item>
- <item name="android:layout_gravity">top|center_horizontal</item>
- <item name="android:paddingStart">@dimen/qsb_padding_left</item>
- <item name="android:paddingEnd">@dimen/qsb_padding_right</item>
</style>
<style name="SearchDropTargetBar">
- <item name="android:orientation">horizontal</item>
- <item name="android:layout_width">match_parent</item>
- <item name="android:layout_height">match_parent</item>
- <item name="android:layout_gravity">bottom|center_horizontal</item>
</style>
<style name="SearchButton">
- <item name="android:layout_gravity">center_vertical</item>
- <item name="android:paddingTop">@dimen/toolbar_button_vertical_padding</item>
- <item name="android:paddingBottom">@dimen/toolbar_button_vertical_padding</item>
</style>
<style name="DropTargetButtonContainer">
<item name="android:layout_width">0dp</item>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 09b8804..bf4748c 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -106,9 +106,6 @@
<attr name="pageSpacing" format="dimension" />
<!-- The page indicator for this workspace -->
<attr name="pageIndicator" format="reference" />
- <!-- The padding for the scroll indicator area -->
- <attr name="scrollIndicatorPaddingLeft" format="dimension" />
- <attr name="scrollIndicatorPaddingRight" format="dimension" />
</declare-styleable>
<!-- AppsCustomizePagedView specific attributes. These attributes are used to
diff --git a/res/values/config.xml b/res/values/config.xml
index 2fc3473..14e5a56 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -1,6 +1,7 @@
<resources>
<bool name="config_largeHeap">false</bool>
- <bool name="is_large_screen">false</bool>
+ <bool name="is_tablet">false</bool>
+ <bool name="is_large_tablet">false</bool>
<bool name="allow_rotation">false</bool>
<!-- Max number of page indicators to show -->
@@ -40,7 +41,7 @@
<!-- Workspace -->
<!-- Whether or not the drop targets drop down as opposed to fade in -->
- <bool name="config_useDropTargetDownTransition">true</bool>
+ <bool name="config_useDropTargetDownTransition">false</bool>
<!-- Whether or not to fade the side pages -->
<bool name="config_workspaceFadeAdjacentScreens">false</bool>
@@ -72,25 +73,11 @@
<!-- Camera distance for the overscroll effect -->
<integer name="config_cameraDistance">6500</integer>
- <!-- Folder max bounds and max number of items. Note: folder_max_count_x * folder_max_count_y
- >= folder_max_num_items. If any values are set to 0, the values will be determined automatically.
- A value of -1 indicates unbounded -->
- <integer name="folder_max_count_x">4</integer>
- <integer name="folder_max_count_y">-1</integer>
- <integer name="folder_max_num_items">-1</integer>
-
- <integer name="cell_count_x">4</integer>
- <integer name="cell_count_y">4</integer>
-
<!-- Whether or not to use custom clings if a custom workspace layout is passed in -->
<bool name="config_useCustomClings">false</bool>
<!-- Hotseat -->
<bool name="hotseat_transpose_layout_with_orientation">true</bool>
- <integer name="hotseat_cell_count">5</integer>
- <integer name="hotseat_all_apps_index">2</integer>
- <!-- must be between 0 and 100 -->
- <integer name="hotseat_item_scale_percentage">100</integer>
<!-- Memory debugging, including a memory dump icon -->
<bool name="debug_memory_enabled">true</bool>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 13a15e3..6e24481 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -15,48 +15,30 @@
-->
<resources>
+<!-- Dynamic Grid -->
+ <dimen name="dynamic_grid_edge_margin">6dp</dimen>
+ <dimen name="dynamic_grid_search_bar_max_width">500dp</dimen>
+ <dimen name="dynamic_grid_search_bar_height">48dp</dimen>
+ <dimen name="dynamic_grid_page_indicator_height">24dp</dimen>
+
<!-- Cling -->
<dimen name="clingPunchThroughGraphicCenterRadius">94dp</dimen>
<dimen name="folderClingMarginTop">20dp</dimen>
<!-- The offset for the text in the cling -->
<dimen name="cling_text_block_offset_x">0dp</dimen>
<dimen name="cling_text_block_offset_y">0dp</dimen>
- <dimen name="reveal_radius">48dp</dimen>
<!-- entries for custom clings, will be set in overlays -->
<add-resource type="dimen" name="custom_cling_margin_top" />
<add-resource type="dimen" name="custom_cling_margin_right" />
<add-resource type="dimen" name="custom_cling_margin_left" />
<!-- Workspace -->
- <!-- qsb_bar_height_inset represents qsb_bar_height minus the padding
- that we put on each page for allowing folders to draw out of bounds -->
- <dimen name="qsb_bar_height_inset">34dp</dimen>
- <dimen name="qsb_bar_height">40dp</dimen>
- <dimen name="qsb_padding_left">0dp</dimen>
- <dimen name="qsb_padding_right">0dp</dimen>
- <dimen name="search_bar_height">40dp</dimen>
<dimen name="workspace_max_gap">16dp</dimen>
- <dimen name="folder_cell_width">74dp</dimen>
- <dimen name="folder_cell_height">82dp</dimen>
- <dimen name="folder_icon_padding_top">2dp</dimen>
- <dimen name="workspace_divider_padding_left">3dp</dimen>
- <dimen name="workspace_divider_padding_right">3dp</dimen>
- <dimen name="workspace_divider_padding_top">0dp</dimen>
- <dimen name="workspace_divider_padding_bottom">0dp</dimen>
- <dimen name="hotseat_cell_width">64dp</dimen>
- <dimen name="hotseat_cell_height">64dp</dimen>
- <dimen name="hotseat_width_gap">-1dp</dimen>
- <dimen name="hotseat_height_gap">-1dp</dimen>
<dimen name="workspace_overscroll_drawable_padding">0dp</dimen>
- <dimen name="workspace_icon_text_size">12sp</dimen>
<dimen name="workspace_spring_loaded_page_spacing">15dp</dimen>
<dimen name="overview_panel_bottom_padding">50dp</dimen>
<dimen name="overview_panel_buttonSpacing">40dp</dimen>
- <dimen name="app_icon_drawable_padding">6dp</dimen>
- <dimen name="app_icon_drawable_padding_land">2dp</dimen>
- <dimen name="app_icon_padding_top">8dp</dimen>
-
<!-- QSB -->
<dimen name="toolbar_button_vertical_padding">4dip</dimen>
<dimen name="toolbar_button_horizontal_padding">12dip</dimen>
@@ -83,16 +65,6 @@
<dimen name="apps_customize_page_indicator_height">12dp</dimen>
<dimen name="apps_customize_page_indicator_margin">4dp</dimen>
- <!-- height of the bottom row of controls -->
- <dimen name="button_bar_height">62dip</dimen>
- <!-- Because portal animations go beyond the bounds of an icon, we need
- to make the dock layout slightly larger than the button_bar_height -->
- <dimen name="button_bar_height_top_padding">8dp</dimen>
- <dimen name="button_bar_height_bottom_padding">0dp</dimen>
- <dimen name="button_bar_width_left_padding">0dp</dimen>
- <dimen name="button_bar_width_right_padding">0dp</dimen>
- <dimen name="button_bar_height_plus_padding">70dp</dimen>
-
<!-- Drag padding to add to the bottom of drop targets -->
<dimen name="drop_target_drag_padding">14dp</dimen>
@@ -123,42 +95,7 @@
<dimen name="shortcut_preview_padding_top">0dp</dimen>
<!-- Folders -->
- <!-- The size of the image which sits behind the preview of the folder contents -->
- <dimen name="folder_preview_size">62dp</dimen>
<!-- The amount that the preview contents are inset from the preview background -->
<dimen name="folder_preview_padding">4dp</dimen>
<dimen name="folder_name_padding">10dp</dimen>
- <dimen name="folder_width_gap">0dp</dimen>
- <dimen name="folder_height_gap">0dp</dimen>
- <dimen name="folder_padding">0dp</dimen>
-
-<!-- CellLayout padding -->
- <dimen name="cell_layout_left_padding_port">0dp</dimen>
- <dimen name="cell_layout_left_padding_land">0dp</dimen>
- <dimen name="cell_layout_right_padding_port">0dp</dimen>
- <dimen name="cell_layout_right_padding_land">0dp</dimen>
- <dimen name="cell_layout_top_padding_port">6dp</dimen>
- <dimen name="cell_layout_top_padding_land">0dp</dimen>
- <dimen name="cell_layout_bottom_padding_port">0dp</dimen>
- <dimen name="cell_layout_bottom_padding_land">0dp</dimen>
-
-<!-- Workspace padding -->
- <dimen name="workspace_left_padding_port">0dp</dimen>
- <dimen name="workspace_left_padding_land">@dimen/qsb_bar_height</dimen>
- <dimen name="workspace_right_padding_port">0dp</dimen>
- <dimen name="workspace_right_padding_land">@dimen/button_bar_height</dimen>
- <dimen name="workspace_top_padding_port">@dimen/qsb_bar_height_inset</dimen>
- <dimen name="workspace_top_padding_land">0dp</dimen>
- <dimen name="workspace_bottom_padding_port">@dimen/button_bar_height</dimen>
- <dimen name="workspace_bottom_padding_land">0dp</dimen>
-
-<!-- Workspace cell size -->
- <dimen name="workspace_cell_width_land">106dp</dimen>
- <dimen name="workspace_cell_width_port">80dp</dimen>
- <dimen name="workspace_cell_height_land">74dp</dimen>
- <dimen name="workspace_cell_height_port">100dp</dimen>
- <dimen name="workspace_width_gap_land">0dp</dimen>
- <dimen name="workspace_width_gap_port">0dp</dimen>
- <dimen name="workspace_height_gap_land">0dp</dimen>
- <dimen name="workspace_height_gap_port">0dp</dimen>
</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 872244c..9f5ade4 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -63,38 +63,14 @@
<item name="android:gravity">center_horizontal</item>
<item name="android:singleLine">true</item>
<item name="android:ellipsize">marquee</item>
- <item name="android:textSize">@dimen/workspace_icon_text_size</item>
<item name="android:textColor">@color/workspace_icon_text_color</item>
<item name="android:shadowRadius">2.0</item>
<item name="android:shadowColor">#B0000000</item>
</style>
<style name="WorkspaceIcon.Portrait">
- <item name="android:drawablePadding">@dimen/app_icon_drawable_padding</item>
- <item name="android:paddingStart">4dp</item>
- <item name="android:paddingEnd">4dp</item>
- <item name="android:paddingTop">@dimen/app_icon_padding_top</item>
- <item name="android:paddingBottom">4dp</item>
</style>
-
<style name="WorkspaceIcon.Landscape">
- <item name="android:drawablePadding">@dimen/app_icon_drawable_padding_land</item>
- <item name="android:paddingStart">4dp</item>
- <item name="android:paddingEnd">4dp</item>
- <item name="android:paddingTop">@dimen/app_icon_padding_top</item>
- <item name="android:paddingBottom">4dp</item>
- </style>
-
- <style name="WorkspaceIcon.Portrait.Folder">
- <item name="android:shadowRadius">0.0</item> <!-- Don't use text shadow -->
- <item name="android:drawablePadding">0dp</item>
- <item name="android:paddingTop">@dimen/folder_icon_padding_top</item>
- </style>
- <style name="WorkspaceIcon.Landscape.Folder">
- <item name="android:shadowRadius">0.0</item> <!-- Don't use text shadow -->
- <item name="android:drawablePadding">0dp</item>
- <item name="android:paddingTop">0dp</item>
- <item name="android:layout_marginTop">-2dp</item>
</style>
<style name="WorkspaceIcon.Portrait.AppsCustomize">
@@ -118,22 +94,10 @@
<style name="QSBBar">
<item name="android:orientation">horizontal</item>
- <item name="android:layout_width">match_parent</item>
- <item name="android:layout_height">@dimen/qsb_bar_height</item>
- <item name="android:layout_gravity">top|center_horizontal</item>
- <item name="android:paddingStart">@dimen/qsb_padding_left</item>
- <item name="android:paddingEnd">@dimen/qsb_padding_right</item>
</style>
<style name="SearchDropTargetBar">
- <item name="android:orientation">horizontal</item>
- <item name="android:layout_width">match_parent</item>
- <item name="android:layout_height">match_parent</item>
- <item name="android:layout_gravity">bottom|center_horizontal</item>
</style>
<style name="SearchButton">
- <item name="android:layout_gravity">center_vertical</item>
- <item name="android:paddingTop">@dimen/toolbar_button_vertical_padding</item>
- <item name="android:paddingBottom">@dimen/toolbar_button_vertical_padding</item>
</style>
<style name="DropTargetButtonContainer">
<item name="android:layout_width">0dp</item>
diff --git a/src/com/android/launcher3/AppsCustomizePagedView.java b/src/com/android/launcher3/AppsCustomizePagedView.java
index dafa9b4..245d7ea 100644
--- a/src/com/android/launcher3/AppsCustomizePagedView.java
+++ b/src/com/android/launcher3/AppsCustomizePagedView.java
@@ -360,12 +360,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
Configuration.ORIENTATION_LANDSCAPE;
int maxCellCountX = Integer.MAX_VALUE;
int maxCellCountY = Integer.MAX_VALUE;
- if (LauncherAppState.getInstance().isScreenLarge()) {
- maxCellCountX = (isLandscape ? LauncherModel.getCellCountX() :
- LauncherModel.getCellCountY());
- maxCellCountY = (isLandscape ? LauncherModel.getCellCountY() :
- LauncherModel.getCellCountX());
- }
if (mMaxAppCellCountX > -1) {
maxCellCountX = Math.min(maxCellCountX, mMaxAppCellCountX);
}
@@ -1162,7 +1156,9 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
// Note: We force a measure here to get around the fact that when we do layout calculations
// immediately after syncing, we don't have a proper width.
- int widthSpec = MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.AT_MOST);
+ int workspaceWidth = mLauncher.getWorkspace().getMeasuredWidth();
+ int widthSpec = MeasureSpec.makeMeasureSpec(Math.min(getMeasuredWidth(), workspaceWidth),
+ MeasureSpec.AT_MOST);
int heightSpec = MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.AT_MOST);
layout.setMinimumWidth(getPageContentWidth());
layout.measure(widthSpec, heightSpec);
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 868e3ac..bb6903d 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -25,6 +25,7 @@ import android.graphics.Region;
import android.graphics.Region.Op;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
+import android.util.TypedValue;
import android.view.MotionEvent;
import android.widget.TextView;
@@ -34,7 +35,6 @@ import android.widget.TextView;
* too aggressive.
*/
public class BubbleTextView extends TextView {
- static final float CORNER_RADIUS = 4.0f;
static final float SHADOW_LARGE_RADIUS = 4.0f;
static final float SHADOW_SMALL_RADIUS = 1.75f;
static final float SHADOW_Y_OFFSET = 2.0f;
@@ -55,6 +55,8 @@ public class BubbleTextView extends TextView {
private int mPressedOutlineColor;
private int mPressedGlowColor;
+ private boolean mIsTextVisible;
+
private boolean mBackgroundSizeChanged;
private Drawable mBackground;
@@ -76,6 +78,15 @@ public class BubbleTextView extends TextView {
init();
}
+ public void onFinishInflate() {
+ super.onFinishInflate();
+
+ // Ensure we are using the right text size
+ LauncherAppState app = LauncherAppState.getInstance();
+ DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
+ setTextSize(TypedValue.COMPLEX_UNIT_SP, grid.iconTextSize);
+ }
+
private void init() {
mLongPressHelper = new CheckLongPressHelper(this);
mBackground = getBackground();
@@ -326,6 +337,20 @@ public class BubbleTextView extends TextView {
if (mBackground != null) mBackground.setCallback(null);
}
+ public void setTextVisibility(boolean visible) {
+ Resources res = getResources();
+ if (visible) {
+ setTextColor(res.getColor(R.color.workspace_icon_text_color));
+ } else {
+ setTextColor(res.getColor(android.R.color.transparent));
+ }
+ mIsTextVisible = visible;
+ }
+
+ public boolean isTextVisible() {
+ return mIsTextVisible;
+ }
+
@Override
protected boolean onSetAlpha(int alpha) {
if (mPrevAlpha != alpha) {
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index 86bc1b0..abc057c 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -191,11 +191,11 @@ public class CellLayout extends ViewGroup {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CellLayout, defStyle, 0);
- mCellWidth = a.getDimensionPixelSize(R.styleable.CellLayout_cellWidth, 10);
- mCellHeight = a.getDimensionPixelSize(R.styleable.CellLayout_cellHeight, 10);
- mWidthGap = mOriginalWidthGap = a.getDimensionPixelSize(R.styleable.CellLayout_widthGap, 0);
- mHeightGap = mOriginalHeightGap = a.getDimensionPixelSize(R.styleable.CellLayout_heightGap, 0);
- mMaxGap = a.getDimensionPixelSize(R.styleable.CellLayout_maxGap, 0);
+ mCellWidth = -1;
+ mCellHeight = -1;
+ mWidthGap = mOriginalWidthGap = 0;
+ mHeightGap = mOriginalHeightGap = 0;
+ mMaxGap = Integer.MAX_VALUE;
mCountX = LauncherModel.getCellCountX();
mCountY = LauncherModel.getCellCountY();
mOccupied = new boolean[mCountX][mCountY];
@@ -208,7 +208,9 @@ public class CellLayout extends ViewGroup {
setAlwaysDrawnWithCacheEnabled(false);
final Resources res = getResources();
- mHotseatScale = (res.getInteger(R.integer.hotseat_item_scale_percentage) / 100f);
+ LauncherAppState app = LauncherAppState.getInstance();
+ DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
+ mHotseatScale = (float) grid.hotseatIconSize / grid.iconSize;
mNormalBackground = res.getDrawable(R.drawable.homescreen_blue_normal_holo);
mActiveGlowBackground = res.getDrawable(R.drawable.homescreen_blue_strong_holo);
@@ -219,16 +221,13 @@ public class CellLayout extends ViewGroup {
res.getDimensionPixelSize(R.dimen.workspace_overscroll_drawable_padding);
mReorderHintAnimationMagnitude = (REORDER_HINT_MAGNITUDE *
- res.getDimensionPixelSize(R.dimen.app_icon_size));
+ grid.iconSizePx);
mNormalBackground.setFilterBitmap(true);
mActiveGlowBackground.setFilterBitmap(true);
// Initialize the data structures used for the drag visualization.
-
mEaseOutInterpolator = new DecelerateInterpolator(2.5f); // Quint ease out
-
-
mDragCell[0] = mDragCell[1] = -1;
for (int i = 0; i < mDragOutlines.length; i++) {
mDragOutlines[i] = new Rect(-1, -1, -1, -1);
@@ -289,33 +288,11 @@ public class CellLayout extends ViewGroup {
mShortcutsAndWidgets = new ShortcutAndWidgetContainer(context);
mShortcutsAndWidgets.setCellDimensions(mCellWidth, mCellHeight, mWidthGap, mHeightGap,
- mCountX);
+ mCountX, mCountY);
addView(mShortcutsAndWidgets);
}
- static int widthInPortrait(Resources r, int numCells) {
- // We use this method from Workspace to figure out how many rows/columns Launcher should
- // have. We ignore the left/right padding on CellLayout because it turns out in our design
- // the padding extends outside the visible screen size, but it looked fine anyway.
- int cellWidth = r.getDimensionPixelSize(R.dimen.workspace_cell_width);
- int minGap = Math.min(r.getDimensionPixelSize(R.dimen.workspace_width_gap),
- r.getDimensionPixelSize(R.dimen.workspace_height_gap));
-
- return minGap * (numCells - 1) + cellWidth * numCells;
- }
-
- static int heightInLandscape(Resources r, int numCells) {
- // We use this method from Workspace to figure out how many rows/columns Launcher should
- // have. We ignore the left/right padding on CellLayout because it turns out in our design
- // the padding extends outside the visible screen size, but it looked fine anyway.
- int cellHeight = r.getDimensionPixelSize(R.dimen.workspace_cell_height);
- int minGap = Math.min(r.getDimensionPixelSize(R.dimen.workspace_width_gap),
- r.getDimensionPixelSize(R.dimen.workspace_height_gap));
-
- return minGap * (numCells - 1) + cellHeight * numCells;
- }
-
public void enableHardwareLayers() {
mShortcutsAndWidgets.setLayerType(LAYER_TYPE_HARDWARE, sPaint);
}
@@ -332,6 +309,13 @@ public class CellLayout extends ViewGroup {
return mIsHotseat ? mHotseatScale : 1.0f;
}
+ public void setCellDimensions(int width, int height) {
+ mCellWidth = width;
+ mCellHeight = height;
+ mShortcutsAndWidgets.setCellDimensions(mCellWidth, mCellHeight, mWidthGap, mHeightGap,
+ mCountX, mCountY);
+ }
+
public void setGridSize(int x, int y) {
mCountX = x;
mCountY = y;
@@ -339,7 +323,7 @@ public class CellLayout extends ViewGroup {
mTmpOccupied = new boolean[mCountX][mCountY];
mTempRectStack.clear();
mShortcutsAndWidgets.setCellDimensions(mCellWidth, mCellHeight, mWidthGap, mHeightGap,
- mCountX);
+ mCountX, mCountY);
requestLayout();
}
@@ -500,17 +484,21 @@ public class CellLayout extends ViewGroup {
int previewOffset = FolderRingAnimator.sPreviewSize;
// The folder outer / inner ring image(s)
+ LauncherAppState app = LauncherAppState.getInstance();
+ DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
for (int i = 0; i < mFolderOuterRings.size(); i++) {
FolderRingAnimator fra = mFolderOuterRings.get(i);
// Draw outer ring
Drawable d = FolderRingAnimator.sSharedOuterRingDrawable;
- int width = (int) fra.getOuterRingSize();
+ int width = (int) (fra.getOuterRingSize() * getChildrenScale());
int height = width;
cellToPoint(fra.mCellX, fra.mCellY, mTempLocation);
+ View child = getChildAt(fra.mCellX, fra.mCellY);
int centerX = mTempLocation[0] + mCellWidth / 2;
- int centerY = mTempLocation[1] + previewOffset / 2;
+ int centerY = mTempLocation[1] + previewOffset / 2 +
+ child.getPaddingTop() + grid.folderBackgroundOffset;
canvas.save();
canvas.translate(centerX - width / 2, centerY - height / 2);
@@ -520,12 +508,14 @@ public class CellLayout extends ViewGroup {
// Draw inner ring
d = FolderRingAnimator.sSharedInnerRingDrawable;
- width = (int) fra.getInnerRingSize();
+ width = (int) (fra.getInnerRingSize() * getChildrenScale());
height = width;
cellToPoint(fra.mCellX, fra.mCellY, mTempLocation);
+ child = getChildAt(fra.mCellX, fra.mCellY);
centerX = mTempLocation[0] + mCellWidth / 2;
- centerY = mTempLocation[1] + previewOffset / 2;
+ centerY = mTempLocation[1] + previewOffset / 2 +
+ child.getPaddingTop() + grid.folderBackgroundOffset;
canvas.save();
canvas.translate(centerX - width / 2, centerY - width / 2);
d.setBounds(0, 0, width, height);
@@ -539,8 +529,10 @@ public class CellLayout extends ViewGroup {
int height = d.getIntrinsicHeight();
cellToPoint(mFolderLeaveBehindCell[0], mFolderLeaveBehindCell[1], mTempLocation);
+ View child = getChildAt(mFolderLeaveBehindCell[0], mFolderLeaveBehindCell[1]);
int centerX = mTempLocation[0] + mCellWidth / 2;
- int centerY = mTempLocation[1] + previewOffset / 2;
+ int centerY = mTempLocation[1] + previewOffset / 2 +
+ child.getPaddingTop() + grid.folderBackgroundOffset;
canvas.save();
canvas.translate(centerX - width / 2, centerY - width / 2);
@@ -620,6 +612,7 @@ public class CellLayout extends ViewGroup {
public void setIsHotseat(boolean isHotseat) {
mIsHotseat = isHotseat;
+ mShortcutsAndWidgets.setIsHotseat(isHotseat);
}
public boolean addViewToCellLayout(View child, int index, int childId, LayoutParams params,
@@ -631,11 +624,7 @@ public class CellLayout extends ViewGroup {
BubbleTextView bubbleChild = (BubbleTextView) child;
Resources res = getResources();
- if (mIsHotseat) {
- bubbleChild.setTextColor(res.getColor(android.R.color.transparent));
- } else {
- bubbleChild.setTextColor(res.getColor(R.color.workspace_icon_text_color));
- }
+ bubbleChild.setTextVisibility(!mIsHotseat);
}
child.setScaleX(getChildrenScale());
@@ -940,49 +929,10 @@ public class CellLayout extends ViewGroup {
static void getMetrics(Rect metrics, Resources res, int measureWidth, int measureHeight,
int countX, int countY, int orientation) {
- int numWidthGaps = countX - 1;
- int numHeightGaps = countY - 1;
-
- int widthGap;
- int heightGap;
- int cellWidth;
- int cellHeight;
- int paddingLeft;
- int paddingRight;
- int paddingTop;
- int paddingBottom;
-
- int maxGap = res.getDimensionPixelSize(R.dimen.workspace_max_gap);
- if (orientation == LANDSCAPE) {
- cellWidth = res.getDimensionPixelSize(R.dimen.workspace_cell_width_land);
- cellHeight = res.getDimensionPixelSize(R.dimen.workspace_cell_height_land);
- widthGap = res.getDimensionPixelSize(R.dimen.workspace_width_gap_land);
- heightGap = res.getDimensionPixelSize(R.dimen.workspace_height_gap_land);
- paddingLeft = res.getDimensionPixelSize(R.dimen.cell_layout_left_padding_land);
- paddingRight = res.getDimensionPixelSize(R.dimen.cell_layout_right_padding_land);
- paddingTop = res.getDimensionPixelSize(R.dimen.cell_layout_top_padding_land);
- paddingBottom = res.getDimensionPixelSize(R.dimen.cell_layout_bottom_padding_land);
- } else {
- // PORTRAIT
- cellWidth = res.getDimensionPixelSize(R.dimen.workspace_cell_width_port);
- cellHeight = res.getDimensionPixelSize(R.dimen.workspace_cell_height_port);
- widthGap = res.getDimensionPixelSize(R.dimen.workspace_width_gap_port);
- heightGap = res.getDimensionPixelSize(R.dimen.workspace_height_gap_port);
- paddingLeft = res.getDimensionPixelSize(R.dimen.cell_layout_left_padding_port);
- paddingRight = res.getDimensionPixelSize(R.dimen.cell_layout_right_padding_port);
- paddingTop = res.getDimensionPixelSize(R.dimen.cell_layout_top_padding_port);
- paddingBottom = res.getDimensionPixelSize(R.dimen.cell_layout_bottom_padding_port);
- }
-
- if (widthGap < 0 || heightGap < 0) {
- int hSpace = measureWidth - paddingLeft - paddingRight;
- int vSpace = measureHeight - paddingTop - paddingBottom;
- int hFreeSpace = hSpace - (countX * cellWidth);
- int vFreeSpace = vSpace - (countY * cellHeight);
- widthGap = Math.min(maxGap, numWidthGaps > 0 ? (hFreeSpace / numWidthGaps) : 0);
- heightGap = Math.min(maxGap, numHeightGaps > 0 ? (vFreeSpace / numHeightGaps) : 0);
- }
- metrics.set(cellWidth, cellHeight, widthGap, heightGap);
+ LauncherAppState app = LauncherAppState.getInstance();
+ DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
+ metrics.set(grid.calculateCellWidth(measureWidth, countX),
+ grid.calculateCellHeight(measureHeight, countY), 0, 0);
}
public void setFixedSize(int width, int height) {
@@ -992,14 +942,22 @@ public class CellLayout extends ViewGroup {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- int widthSpecMode = MeasureSpec.getMode(widthMeasureSpec);
- int widthSpecSize = MeasureSpec.getSize(widthMeasureSpec);
+ LauncherAppState app = LauncherAppState.getInstance();
+ DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
+ int widthSpecMode = MeasureSpec.getMode(widthMeasureSpec);
int heightSpecMode = MeasureSpec.getMode(heightMeasureSpec);
- int heightSpecSize = MeasureSpec.getSize(heightMeasureSpec);
+ int widthSize = MeasureSpec.getSize(widthMeasureSpec);
+ int heightSize = MeasureSpec.getSize(heightMeasureSpec);
+ if (mCellWidth < 0 || mCellHeight < 0) {
+ mCellWidth = grid.calculateCellWidth(widthSize, mCountX);
+ mCellHeight = grid.calculateCellHeight(heightSize, mCountY);
+ mShortcutsAndWidgets.setCellDimensions(mCellWidth, mCellHeight, mWidthGap,
+ mHeightGap, mCountX, mCountY);
+ }
- int newWidth = widthSpecSize;
- int newHeight = heightSpecSize;
+ int newWidth = widthSize;
+ int newHeight = heightSize;
if (mFixedWidth > 0 && mFixedHeight > 0) {
newWidth = mFixedWidth;
newHeight = mFixedHeight;
@@ -1011,29 +969,21 @@ public class CellLayout extends ViewGroup {
int numHeightGaps = mCountY - 1;
if (mOriginalWidthGap < 0 || mOriginalHeightGap < 0) {
- int hSpace = widthSpecSize - getPaddingLeft() - getPaddingRight();
- int vSpace = heightSpecSize - getPaddingTop() - getPaddingBottom();
+ int hSpace = widthSize - getPaddingLeft() - getPaddingRight();
+ int vSpace = heightSize - getPaddingTop() - getPaddingBottom();
int hFreeSpace = hSpace - (mCountX * mCellWidth);
int vFreeSpace = vSpace - (mCountY * mCellHeight);
mWidthGap = Math.min(mMaxGap, numWidthGaps > 0 ? (hFreeSpace / numWidthGaps) : 0);
mHeightGap = Math.min(mMaxGap,numHeightGaps > 0 ? (vFreeSpace / numHeightGaps) : 0);
- mShortcutsAndWidgets.setCellDimensions(mCellWidth, mCellHeight, mWidthGap, mHeightGap,
- mCountX);
+ mShortcutsAndWidgets.setCellDimensions(mCellWidth, mCellHeight, mWidthGap,
+ mHeightGap, mCountX, mCountY);
} else {
mWidthGap = mOriginalWidthGap;
mHeightGap = mOriginalHeightGap;
}
-
- // Initial values correspond to widthSpecMode == MeasureSpec.EXACTLY
- if (widthSpecMode == MeasureSpec.AT_MOST) {
- newWidth = getPaddingLeft() + getPaddingRight() + (mCountX * mCellWidth) +
- ((mCountX - 1) * mWidthGap);
- newHeight = getPaddingTop() + getPaddingBottom() + (mCountY * mCellHeight) +
- ((mCountY - 1) * mHeightGap);
- setMeasuredDimension(newWidth, newHeight);
- }
-
int count = getChildCount();
+ int maxWidth = 0;
+ int maxHeight = 0;
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(newWidth - getPaddingLeft() -
@@ -1041,8 +991,10 @@ public class CellLayout extends ViewGroup {
int childheightMeasureSpec = MeasureSpec.makeMeasureSpec(newHeight - getPaddingTop() -
getPaddingBottom(), MeasureSpec.EXACTLY);
child.measure(childWidthMeasureSpec, childheightMeasureSpec);
+ maxWidth = Math.max(maxWidth, child.getMeasuredWidth());
+ maxHeight = Math.max(maxHeight, child.getMeasuredHeight());
}
- setMeasuredDimension(newWidth, newHeight);
+ setMeasuredDimension(maxWidth, maxHeight);
}
@Override
@@ -1530,7 +1482,7 @@ public class CellLayout extends ViewGroup {
* matches exactly. Otherwise we find the best matching direction.
* @param occoupied The array which represents which cells in the CellLayout are occupied
* @param blockOccupied The array which represents which cells in the specified block (cellX,
- * cellY, spanX, spanY) are occupied. This is used when try to move a group of views.
+ * cellY, spanX, spanY) are occupied. This is used when try to move a group of views.
* @param result Array in which to place the result, or null (in which case a new array will
* be allocated)
* @return The X, Y cell of a vacant area that can contain this object,
@@ -2003,7 +1955,7 @@ public class CellLayout extends ViewGroup {
private boolean attemptPushInDirection(ArrayList<View> intersectingViews, Rect occupied,
int[] direction, View ignoreView, ItemConfiguration solution) {
if ((Math.abs(direction[0]) + Math.abs(direction[1])) > 1) {
- // If the direction vector has two non-zero components, we try pushing
+ // If the direction vector has two non-zero components, we try pushing
// separately in each of the components.
int temp = direction[1];
direction[1] = 0;
@@ -2044,7 +1996,7 @@ public class CellLayout extends ViewGroup {
direction[0] = temp;
direction[0] *= -1;
direction[1] *= -1;
-
+
} else {
// If the direction vector has a single non-zero component, we push first in the
// direction of the vector
@@ -2062,8 +2014,8 @@ public class CellLayout extends ViewGroup {
// Switch the direction back
direction[0] *= -1;
direction[1] *= -1;
-
- // If we have failed to find a push solution with the above, then we try
+
+ // If we have failed to find a push solution with the above, then we try
// to find a solution by pushing along the perpendicular axis.
// Swap the components
@@ -2125,7 +2077,7 @@ public class CellLayout extends ViewGroup {
}
}
- // First we try to find a solution which respects the push mechanic. That is,
+ // First we try to find a solution which respects the push mechanic. That is,
// we try to find a solution such that no displaced item travels through another item
// without also displacing that item.
if (attemptPushInDirection(mIntersectingViews, mOccupiedRect, direction, ignoreView,
@@ -3013,10 +2965,13 @@ public class CellLayout extends ViewGroup {
}
public static int[] rectToCell(Resources resources, int width, int height, int[] result) {
+ LauncherAppState app = LauncherAppState.getInstance();
+ DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
+
// Always assume we're working with the smallest span to make sure we
// reserve enough space in both orientations.
- int actualWidth = resources.getDimensionPixelSize(R.dimen.workspace_cell_width);
- int actualHeight = resources.getDimensionPixelSize(R.dimen.workspace_cell_height);
+ int actualWidth = grid.cellWidthPx;
+ int actualHeight = grid.cellHeightPx;
int smallerSize = Math.min(actualWidth, actualHeight);
// Always round up to next largest cell
diff --git a/src/com/android/launcher3/Cling.java b/src/com/android/launcher3/Cling.java
index 77c41b7..add6da5 100644
--- a/src/com/android/launcher3/Cling.java
+++ b/src/com/android/launcher3/Cling.java
@@ -90,13 +90,15 @@ public class Cling extends FrameLayout {
mPositionData = positionData;
Resources r = getContext().getResources();
+ LauncherAppState app = LauncherAppState.getInstance();
+ DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
mPunchThroughGraphic = r.getDrawable(R.drawable.cling);
mPunchThroughGraphicCenterRadius =
r.getDimensionPixelSize(R.dimen.clingPunchThroughGraphicCenterRadius);
- mAppIconSize = r.getDimensionPixelSize(R.dimen.app_icon_size);
- mRevealRadius = r.getDimensionPixelSize(R.dimen.reveal_radius) * 1f;
- mButtonBarHeight = r.getDimensionPixelSize(R.dimen.button_bar_height);
+ mAppIconSize = grid.iconSizePx;
+ mRevealRadius = grid.iconSizePx * 1f;
+ mButtonBarHeight = grid.hotseatBarHeightPx;
mErasePaint = new Paint();
mErasePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY));
diff --git a/src/com/android/launcher3/DragLayer.java b/src/com/android/launcher3/DragLayer.java
index 94316df..be0d47b 100644
--- a/src/com/android/launcher3/DragLayer.java
+++ b/src/com/android/launcher3/DragLayer.java
@@ -28,11 +28,7 @@ import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.ViewParent;
+import android.view.*;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.animation.DecelerateInterpolator;
@@ -503,6 +499,7 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang
toX -= (dragView.getMeasuredWidth() - Math.round(scale * child.getMeasuredWidth())) / 2;
} else if (child instanceof FolderIcon) {
// Account for holographic blur padding on the drag view
+ toY += Math.round(scale * (child.getPaddingTop() - dragView.getDragRegionTop()));
toY -= scale * Workspace.DRAG_BITMAP_PADDING / 2;
toY -= (1 - scale) * dragView.getMeasuredHeight() / 2;
// Center in the x coordinate about the target's drawable
diff --git a/src/com/android/launcher3/DynamicGrid.java b/src/com/android/launcher3/DynamicGrid.java
new file mode 100644
index 0000000..37cccfb
--- /dev/null
+++ b/src/com/android/launcher3/DynamicGrid.java
@@ -0,0 +1,478 @@
+/*
+ * Copyright (C) 2008 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.content.res.Configuration;
+import android.content.res.Resources;
+import android.graphics.Paint;
+import android.graphics.PointF;
+import android.graphics.Paint.FontMetrics;
+import android.graphics.Rect;
+import android.util.DisplayMetrics;
+import android.util.TypedValue;
+import android.view.Gravity;
+import android.view.View;
+import android.view.ViewGroup.LayoutParams;
+import android.widget.FrameLayout;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+
+
+class DeviceProfileQuery {
+ float widthDps;
+ float heightDps;
+ float value;
+ PointF dimens;
+
+ DeviceProfileQuery(float w, float h, float v) {
+ widthDps = w;
+ heightDps = h;
+ value = v;
+ dimens = new PointF(w, h);
+ }
+}
+
+class DeviceProfile {
+ String name;
+ float minWidthDps;
+ float minHeightDps;
+ float numRows;
+ float numColumns;
+ float iconSize;
+ float iconTextSize;
+ float numHotseatIcons;
+ float hotseatIconSize;
+
+ boolean isLandscape;
+ boolean isTablet;
+ boolean isLargeTablet;
+ boolean transposeLayoutWithOrientation;
+
+ int edgeMarginPx;
+
+ int widthPx;
+ int heightPx;
+ int iconSizePx;
+ int iconTextSizePx;
+ int cellWidthPx;
+ int cellHeightPx;
+ int folderBackgroundOffset;
+ int folderIconSizePx;
+ int folderCellWidthPx;
+ int folderCellHeightPx;
+ int hotseatCellWidthPx;
+ int hotseatCellHeightPx;
+ int hotseatIconSizePx;
+ int hotseatBarHeightPx;
+ int searchBarSpaceWidthPx;
+ int searchBarSpaceMaxWidthPx;
+ int searchBarSpaceHeightPx;
+ int searchBarHeightPx;
+ int pageIndicatorHeightPx;
+
+ DeviceProfile(String n, float w, float h, float r, float c,
+ float is, float its, float hs, float his) {
+ name = n;
+ minWidthDps = w;
+ minHeightDps = h;
+ numRows = r;
+ numColumns = c;
+ iconSize = is;
+ iconTextSize = its;
+ numHotseatIcons = hs;
+ hotseatIconSize = his;
+ }
+
+ DeviceProfile(ArrayList<DeviceProfile> profiles,
+ float minWidth, int minWidthPx,
+ float minHeight, int minHeightPx,
+ int wPx, int hPx,
+ Resources resources) {
+ DisplayMetrics dm = resources.getDisplayMetrics();
+ ArrayList<DeviceProfileQuery> points =
+ new ArrayList<DeviceProfileQuery>();
+ transposeLayoutWithOrientation =
+ resources.getBoolean(R.bool.hotseat_transpose_layout_with_orientation);
+ updateFromConfiguration(resources, wPx, hPx);
+ minWidthDps = minWidth;
+ minHeightDps = minHeight;
+
+ edgeMarginPx = resources.getDimensionPixelSize(R.dimen.dynamic_grid_edge_margin);
+ pageIndicatorHeightPx = resources.getDimensionPixelSize(R.dimen.dynamic_grid_page_indicator_height);
+
+ // Interpolate the rows
+ for (DeviceProfile p : profiles) {
+ points.add(new DeviceProfileQuery(p.minWidthDps, p.minHeightDps, p.numRows));
+ }
+ numRows = Math.round(invDistWeightedInterpolate(minWidth, minHeight, points));
+ // Interpolate the columns
+ points.clear();
+ for (DeviceProfile p : profiles) {
+ points.add(new DeviceProfileQuery(p.minWidthDps, p.minHeightDps, p.numColumns));
+ }
+ numColumns = Math.round(invDistWeightedInterpolate(minWidth, minHeight, points));
+ // Interpolate the icon size
+ points.clear();
+ for (DeviceProfile p : profiles) {
+ points.add(new DeviceProfileQuery(p.minWidthDps, p.minHeightDps, p.iconSize));
+ }
+ iconSize = invDistWeightedInterpolate(minWidth, minHeight, points);
+ iconSizePx = (int) Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
+ iconSize, dm));
+ // Interpolate the icon text size
+ points.clear();
+ for (DeviceProfile p : profiles) {
+ points.add(new DeviceProfileQuery(p.minWidthDps, p.minHeightDps, p.iconTextSize));
+ }
+ iconTextSize = invDistWeightedInterpolate(minWidth, minHeight, points);
+ iconTextSizePx = (int) Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,
+ iconTextSize, dm));
+ // Interpolate the hotseat size
+ points.clear();
+ for (DeviceProfile p : profiles) {
+ points.add(new DeviceProfileQuery(p.minWidthDps, p.minHeightDps, p.numHotseatIcons));
+ }
+ numHotseatIcons = Math.round(invDistWeightedInterpolate(minWidth, minHeight, points));
+ // Interpolate the hotseat icon size
+ points.clear();
+ for (DeviceProfile p : profiles) {
+ points.add(new DeviceProfileQuery(p.minWidthDps, p.minHeightDps, p.hotseatIconSize));
+ }
+
+ // Hotseat
+ hotseatIconSize = invDistWeightedInterpolate(minWidth, minHeight, points);
+ hotseatIconSizePx = (int) Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
+ hotseatIconSize, dm));
+ hotseatBarHeightPx = iconSizePx + 4 * edgeMarginPx;
+ hotseatCellWidthPx = iconSizePx;
+ hotseatCellHeightPx = iconSizePx;
+
+ // Search Bar
+ searchBarSpaceMaxWidthPx = resources.getDimensionPixelSize(R.dimen.dynamic_grid_search_bar_max_width);
+ searchBarHeightPx = resources.getDimensionPixelSize(R.dimen.dynamic_grid_search_bar_height);
+ searchBarSpaceWidthPx = Math.min(searchBarSpaceMaxWidthPx, widthPx);
+ searchBarSpaceHeightPx = searchBarHeightPx + 2 * edgeMarginPx;
+
+ // Calculate the actual text height
+ Paint textPaint = new Paint();
+ textPaint.setTextSize(iconTextSizePx);
+ FontMetrics fm = textPaint.getFontMetrics();
+ cellWidthPx = iconSizePx;
+ cellHeightPx = iconSizePx + (int) Math.ceil(fm.bottom - fm.top);
+
+ // Folder
+ folderCellWidthPx = cellWidthPx + 3 * edgeMarginPx;
+ folderCellHeightPx = cellHeightPx + edgeMarginPx;
+ folderBackgroundOffset = -edgeMarginPx;
+ folderIconSizePx = iconSizePx + 2 * -folderBackgroundOffset;
+ }
+
+ void updateFromConfiguration(Resources resources, int wPx, int hPx) {
+ isLandscape = (resources.getConfiguration().orientation ==
+ Configuration.ORIENTATION_LANDSCAPE);
+ isTablet = resources.getBoolean(R.bool.is_tablet);
+ isLargeTablet = resources.getBoolean(R.bool.is_large_tablet);
+ widthPx = wPx;
+ heightPx = hPx;
+ }
+
+ private float dist(PointF p0, PointF p1) {
+ return (float) Math.sqrt((p1.x - p0.x)*(p1.x-p0.x) +
+ (p1.y-p0.y)*(p1.y-p0.y));
+ }
+
+ private float weight(PointF a, PointF b,
+ float pow) {
+ float d = dist(a, b);
+ if (d == 0f) {
+ return Float.POSITIVE_INFINITY;
+ }
+ return (float) (1f / Math.pow(d, pow));
+ }
+
+ private float invDistWeightedInterpolate(float width, float height,
+ ArrayList<DeviceProfileQuery> points) {
+ float sum = 0;
+ float weights = 0;
+ float pow = 5;
+ float kNearestNeighbors = 3;
+ final PointF xy = new PointF(width, height);
+
+ ArrayList<DeviceProfileQuery> pointsByNearness = points;
+ Collections.sort(pointsByNearness, new Comparator<DeviceProfileQuery>() {
+ public int compare(DeviceProfileQuery a, DeviceProfileQuery b) {
+ return (int) (dist(xy, a.dimens) - dist(xy, b.dimens));
+ }
+ });
+
+ for (int i = 0; i < pointsByNearness.size(); ++i) {
+ DeviceProfileQuery p = pointsByNearness.get(i);
+ if (i < kNearestNeighbors) {
+ float w = weight(xy, p.dimens, pow);
+ if (w == Float.POSITIVE_INFINITY) {
+ return p.value;
+ }
+ weights += w;
+ }
+ }
+
+ for (int i = 0; i < pointsByNearness.size(); ++i) {
+ DeviceProfileQuery p = pointsByNearness.get(i);
+ if (i < kNearestNeighbors) {
+ float w = weight(xy, p.dimens, pow);
+ sum += w * p.value / weights;
+ }
+ }
+
+ return sum;
+ }
+
+ Rect getWorkspacePadding(int orientation) {
+ Rect padding = new Rect();
+ if (orientation == CellLayout.LANDSCAPE &&
+ transposeLayoutWithOrientation) {
+ // Pad the left and right of the workspace with search/hotseat bar sizes
+ padding.set(searchBarSpaceHeightPx, edgeMarginPx,
+ hotseatBarHeightPx, edgeMarginPx);
+ } else {
+ if (isTablet()) {
+ // Pad the left and right of the workspace to ensure consistent spacing
+ // between all icons
+ int width = (orientation == CellLayout.LANDSCAPE)
+ ? Math.max(widthPx, heightPx)
+ : Math.min(widthPx, heightPx);
+ // XXX: If the icon size changes across orientations, we will have to take
+ // that into account here too.
+ int gap = (int) ((width - 2 * edgeMarginPx -
+ (numColumns * cellWidthPx)) / (2 * (numColumns + 1)));
+ padding.set(edgeMarginPx + gap,
+ searchBarSpaceHeightPx,
+ edgeMarginPx + gap,
+ hotseatBarHeightPx + pageIndicatorHeightPx);
+ } else {
+ // Pad the top and bottom of the workspace with search/hotseat bar sizes
+ padding.set(edgeMarginPx,
+ searchBarSpaceHeightPx,
+ edgeMarginPx,
+ hotseatBarHeightPx + pageIndicatorHeightPx);
+ }
+ }
+ return padding;
+ }
+
+ int calculateCellWidth(int width, int countX) {
+ return width / countX;
+ }
+ int calculateCellHeight(int height, int countY) {
+ return height / countY;
+ }
+
+ boolean isTablet() {
+ return isTablet;
+ }
+
+ boolean isLargeTablet() {
+ return isLargeTablet;
+ }
+
+ public void layout(Launcher launcher) {
+ FrameLayout.LayoutParams lp;
+ Resources res = launcher.getResources();
+ boolean hasVerticalBarLayout = isLandscape &&
+ res.getBoolean(R.bool.hotseat_transpose_layout_with_orientation);
+
+ // Layout the search bar space
+ View searchBarSpace = launcher.findViewById(R.id.qsb_bar);
+ lp = (FrameLayout.LayoutParams) searchBarSpace.getLayoutParams();
+ if (hasVerticalBarLayout) {
+ // Vertical search bar
+ lp.gravity = Gravity.TOP | Gravity.LEFT;
+ lp.width = searchBarSpaceHeightPx;
+ lp.height = LayoutParams.MATCH_PARENT;
+ searchBarSpace.setPadding(
+ 0, 2 * edgeMarginPx, 0,
+ 2 * edgeMarginPx);
+ } else {
+ // Horizontal search bar
+ lp.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL;
+ lp.width = searchBarSpaceWidthPx;
+ lp.height = searchBarSpaceHeightPx;
+ searchBarSpace.setPadding(
+ 2 * edgeMarginPx,
+ 2 * edgeMarginPx,
+ 2 * edgeMarginPx, 0);
+ }
+ searchBarSpace.setLayoutParams(lp);
+
+ // Layout the search bar
+ View searchBar = searchBarSpace.findViewById(R.id.qsb_search_bar);
+ lp = (FrameLayout.LayoutParams) searchBar.getLayoutParams();
+ lp.width = LayoutParams.MATCH_PARENT;
+ lp.height = LayoutParams.MATCH_PARENT;
+ searchBar.setLayoutParams(lp);
+
+ // Layout the voice proxy
+ View voiceButtonProxy = launcher.findViewById(R.id.voice_button_proxy);
+ if (voiceButtonProxy != null) {
+ if (hasVerticalBarLayout) {
+ // TODO: MOVE THIS INTO SEARCH BAR MEASURE
+ } else {
+ lp = (FrameLayout.LayoutParams) voiceButtonProxy.getLayoutParams();
+ lp.gravity = Gravity.TOP | Gravity.END;
+ lp.width = (widthPx - searchBarSpaceWidthPx) / 2 +
+ 2 * iconSizePx;
+ lp.height = searchBarSpaceHeightPx;
+ }
+ }
+
+ // Layout the workspace
+ View workspace = launcher.findViewById(R.id.workspace);
+ lp = (FrameLayout.LayoutParams) workspace.getLayoutParams();
+ lp.gravity = Gravity.CENTER;
+ Rect padding = getWorkspacePadding(isLandscape
+ ? CellLayout.LANDSCAPE
+ : CellLayout.PORTRAIT);
+ workspace.setPadding(padding.left, padding.top,
+ padding.right, padding.bottom);
+ workspace.setLayoutParams(lp);
+
+ // Layout the hotseat
+ View hotseat = launcher.findViewById(R.id.hotseat);
+ lp = (FrameLayout.LayoutParams) hotseat.getLayoutParams();
+ if (hasVerticalBarLayout) {
+ // Vertical hotseat
+ lp.gravity = Gravity.RIGHT;
+ lp.width = hotseatBarHeightPx;
+ lp.height = LayoutParams.MATCH_PARENT;
+ hotseat.setPadding(0, 2 * edgeMarginPx,
+ 2 * edgeMarginPx, 2 * edgeMarginPx);
+ } else if (isTablet()) {
+ // Pad the hotseat with the grid gap calculated above
+ int gridGap = (int) ((widthPx - 2 * edgeMarginPx -
+ (numColumns * cellWidthPx)) / (2 * (numColumns + 1)));
+ int gridWidth = (int) ((numColumns * cellWidthPx) +
+ ((numColumns - 1) * gridGap));
+ int hotseatGap = (int) Math.max(0,
+ (gridWidth - (numHotseatIcons * hotseatCellWidthPx))
+ / (numHotseatIcons - 1));
+ lp.gravity = Gravity.BOTTOM;
+ lp.width = LayoutParams.MATCH_PARENT;
+ lp.height = hotseatBarHeightPx;
+ hotseat.setPadding(2 * edgeMarginPx + gridGap + hotseatGap, 0,
+ 2 * edgeMarginPx + gridGap + hotseatGap,
+ 2 * edgeMarginPx);
+ } else {
+ // For phones, layout the hotseat without any bottom margin
+ // to ensure that we have space for the folders
+ lp.gravity = Gravity.BOTTOM;
+ lp.width = LayoutParams.MATCH_PARENT;
+ lp.height = hotseatBarHeightPx;
+ hotseat.setPadding(2 * edgeMarginPx, 0,
+ 2 * edgeMarginPx, 0);
+ }
+ hotseat.setLayoutParams(lp);
+
+ // Layout the page indicators
+ View pageIndicator = launcher.findViewById(R.id.page_indicator);
+ if (pageIndicator != null) {
+ if (hasVerticalBarLayout) {
+ // Hide the page indicators when we have vertical search/hotseat
+ pageIndicator.setVisibility(View.GONE);
+ } else {
+ // Put the page indicators above the hotseat
+ lp = (FrameLayout.LayoutParams) pageIndicator.getLayoutParams();
+ lp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
+ lp.width = LayoutParams.WRAP_CONTENT;
+ lp.height = pageIndicatorHeightPx;
+ lp.bottomMargin = hotseatBarHeightPx;
+ pageIndicator.setLayoutParams(lp);
+ }
+ }
+ }
+}
+
+public class DynamicGrid {
+ @SuppressWarnings("unused")
+ private static final String TAG = "DynamicGrid";
+
+ private DeviceProfile mProfile;
+ private float mMinWidth;
+ private float mMinHeight;
+
+ public static int dpiFromPx(int size, DisplayMetrics metrics){
+ float densityRatio = (float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT;
+ return (int) Math.round(size / densityRatio);
+ }
+
+ public DynamicGrid(Resources resources, int minWidthPx, int minHeightPx,
+ int widthPx, int heightPx) {
+ DisplayMetrics dm = resources.getDisplayMetrics();
+ ArrayList<DeviceProfile> deviceProfiles =
+ new ArrayList<DeviceProfile>();
+ // Our phone profiles include the bar sizes in each orientation
+ deviceProfiles.add(new DeviceProfile("Super Short Stubby",
+ 255, 300, 2, 3, 48, 12, 4, 48));
+ deviceProfiles.add(new DeviceProfile("Shorter Stubby",
+ 255, 400, 3, 3, 48, 12, 4, 48));
+ deviceProfiles.add(new DeviceProfile("Short Stubby",
+ 275, 420, 3, 4, 48, 12, 4, 48));
+ deviceProfiles.add(new DeviceProfile("Stubby",
+ 255, 450, 3, 4, 48, 12, 4, 48));
+ deviceProfiles.add(new DeviceProfile("Nexus S",
+ 296, 491.33f, 4, 4, 48, 12, 4, 48));
+ deviceProfiles.add(new DeviceProfile("Nexus 4",
+ 359, 518, 4, 4, 60, 12, 5, 56));
+ // The tablet profile is odd in that the landscape orientation
+ // also includes the nav bar on the side
+ deviceProfiles.add(new DeviceProfile("Nexus 7",
+ 575, 904, 6, 6, 72, 14.4f, 7, 60));
+ // Larger tablet profiles always have system bars on the top & bottom
+ deviceProfiles.add(new DeviceProfile("Nexus 10",
+ 727, 1207, 5, 8, 80, 14.4f, 9, 64));
+ /*
+ deviceProfiles.add(new DeviceProfile("Nexus 7",
+ 600, 960, 5, 5, 72, 14.4f, 5, 60));
+ deviceProfiles.add(new DeviceProfile("Nexus 10",
+ 800, 1280, 5, 5, 80, 14.4f, 6, 64));
+ */
+ deviceProfiles.add(new DeviceProfile("20-inch Tablet",
+ 1527, 2527, 7, 7, 100, 20, 7, 72));
+ mMinWidth = dpiFromPx(minWidthPx, dm);
+ mMinHeight = dpiFromPx(minHeightPx, dm);
+ mProfile = new DeviceProfile(deviceProfiles,
+ mMinWidth, minWidthPx,
+ mMinHeight, minHeightPx,
+ widthPx, heightPx,
+ resources);
+ }
+
+ DeviceProfile getDeviceProfile() {
+ return mProfile;
+ }
+
+ public String toString() {
+ return "-------- DYNAMIC GRID ------- \n" +
+ "Wd: " + mProfile.minWidthDps + ", Hd: " + mProfile.minHeightDps +
+ ", W: " + mProfile.widthPx + ", H: " + mProfile.heightPx +
+ " [r: " + mProfile.numRows + ", c: " + mProfile.numColumns +
+ ", is: " + mProfile.iconSizePx + ", its: " + mProfile.iconTextSize +
+ ", cw: " + mProfile.cellWidthPx + ", ch: " + mProfile.cellHeightPx +
+ ", hc: " + mProfile.numHotseatIcons + ", his: " + mProfile.hotseatIconSizePx + "]";
+ }
+}
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java
index 3ff4fa3..f23e1bb 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -138,39 +138,16 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
*/
public Folder(Context context, AttributeSet attrs) {
super(context, attrs);
+
+ LauncherAppState app = LauncherAppState.getInstance();
+ DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
setAlwaysDrawnWithCacheEnabled(false);
mInflater = LayoutInflater.from(context);
- mIconCache = (LauncherAppState.getInstance()).getIconCache();
+ mIconCache = app.getIconCache();
Resources res = getResources();
- mMaxCountX = mMaxVisibleX = res.getInteger(R.integer.folder_max_count_x);
- mMaxCountY = mMaxVisibleY = res.getInteger(R.integer.folder_max_count_y);
- mMaxNumItems = res.getInteger(R.integer.folder_max_num_items);
-
- if (mMaxCountY == -1) {
- // -2 indicates unlimited
- mMaxCountY = Integer.MAX_VALUE;
- mMaxVisibleX = LauncherModel.getCellCountX() + 1;
- }
- if (mMaxNumItems == -1) {
- // -2 indicates unlimited
- mMaxNumItems = Integer.MAX_VALUE;
- mMaxVisibleY = LauncherModel.getCellCountY() + 1;
- }
- if (mMaxCountX == 0) {
- mMaxCountX = mMaxVisibleX = LauncherModel.getCellCountX();
- mMaxVisibleX++;
- }
- if (mMaxCountY == 0) {
- mMaxCountY = mMaxVisibleY = LauncherModel.getCellCountY();
- mMaxVisibleY++;
- }
- if (mMaxNumItems == 0) {
- mMaxNumItems = mMaxCountX * mMaxCountY;
- if (mMaxNumItems < 0) {
- mMaxNumItems = Integer.MAX_VALUE;
- }
- }
+ mMaxCountX = mMaxVisibleX = mMaxVisibleY = (int) (grid.numColumns);
+ mMaxCountY = mMaxNumItems = Integer.MAX_VALUE;
mInputMethodManager = (InputMethodManager)
getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
@@ -196,10 +173,13 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
mScrollView = (ScrollView) findViewById(R.id.scroll_view);
mContent = (CellLayout) findViewById(R.id.folder_content);
+ LauncherAppState app = LauncherAppState.getInstance();
+ DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
+
// Beyond this height, the area scrolls
+ mContent.setCellDimensions(grid.folderCellWidthPx, grid.folderCellHeightPx);
mContent.setGridSize(mMaxVisibleX, mMaxVisibleY);
mMaxContentAreaHeight = mContent.getDesiredHeight() - SCROLL_CUT_OFF_AMOUNT;
-
mContent.setGridSize(0, 0);
mContent.getShortcutsAndWidgets().setMotionEventSplittingEnabled(false);
mContent.setInvertIfRtl(true);
@@ -535,13 +515,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
oa.start();
}
- void notifyDataSetChanged() {
- // recreate all the children if the data set changes under us. We may want to do this more
- // intelligently (ie just removing the views that should no longer exist)
- mContent.removeAllViewsInLayout();
- bind(mInfo);
- }
-
public boolean acceptDrop(DragObject d) {
final ItemInfo item = (ItemInfo) d.dragInfo;
final int itemType = item.itemType;
@@ -764,6 +737,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
boolean beingCalledAfterUninstall = mDeferredAction != null;
boolean successfulDrop =
success && (!beingCalledAfterUninstall || mUninstallSuccessful);
+
if (successfulDrop) {
if (mDeleteFolderOnDropCompleted && !mItemAddedBackToSelfViaIcon) {
replaceFolderWithFinalItem();
@@ -783,6 +757,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
completeDragExit();
}
}
+
mDeleteFolderOnDropCompleted = false;
mDragInProgress = false;
mItemAddedBackToSelfViaIcon = false;
@@ -981,7 +956,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
}
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
-
int contentAreaHeight = mContent.getDesiredHeight();
if (contentAreaHeight >= mMaxContentAreaHeight) {
// Subtract a bit so the user can see that it's scrollable.
diff --git a/src/com/android/launcher3/FolderIcon.java b/src/com/android/launcher3/FolderIcon.java
index fa713a4..fd83370 100644
--- a/src/com/android/launcher3/FolderIcon.java
+++ b/src/com/android/launcher3/FolderIcon.java
@@ -132,10 +132,18 @@ public class FolderIcon extends LinearLayout implements FolderListener {
}
FolderIcon icon = (FolderIcon) LayoutInflater.from(launcher).inflate(resId, group, false);
-
+ icon.setClipToPadding(false);
icon.mFolderName = (BubbleTextView) icon.findViewById(R.id.folder_icon_name);
icon.mFolderName.setText(folderInfo.title);
icon.mPreviewBackground = (ImageView) icon.findViewById(R.id.preview_background);
+ LauncherAppState app = LauncherAppState.getInstance();
+ DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
+ // Offset the preview background to center this view accordingly
+ LinearLayout.LayoutParams lp =
+ (LinearLayout.LayoutParams) icon.mPreviewBackground.getLayoutParams();
+ lp.topMargin = grid.folderBackgroundOffset;
+ lp.width = grid.folderIconSizePx;
+ lp.height = grid.folderIconSizePx;
icon.setTag(folderInfo);
icon.setOnClickListener(launcher);
@@ -187,7 +195,10 @@ public class FolderIcon extends LinearLayout implements FolderListener {
throw new RuntimeException("FolderRingAnimator loading drawables on non-UI thread "
+ Thread.currentThread());
}
- sPreviewSize = res.getDimensionPixelSize(R.dimen.folder_preview_size);
+
+ LauncherAppState app = LauncherAppState.getInstance();
+ DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
+ sPreviewSize = grid.folderIconSizePx;
sPreviewPadding = res.getDimensionPixelSize(R.dimen.folder_preview_padding);
sSharedOuterRingDrawable = res.getDrawable(R.drawable.portal_ring_outer_holo);
sSharedInnerRingDrawable = res.getDrawable(R.drawable.portal_ring_inner_holo);
@@ -392,7 +403,7 @@ public class FolderIcon extends LinearLayout implements FolderListener {
center[1] = (int) Math.round(scaleRelativeToDragLayer * center[1]);
to.offset(center[0] - animateView.getMeasuredWidth() / 2,
- center[1] - animateView.getMeasuredHeight() / 2);
+ center[1] - animateView.getMeasuredHeight() / 2);
float finalAlpha = index < NUM_ITEMS_IN_PREVIEW ? 0.5f : 0f;
@@ -430,10 +441,13 @@ public class FolderIcon extends LinearLayout implements FolderListener {
private void computePreviewDrawingParams(int drawableSize, int totalSize) {
if (mIntrinsicIconSize != drawableSize || mTotalWidth != totalSize) {
+ LauncherAppState app = LauncherAppState.getInstance();
+ DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
+
mIntrinsicIconSize = drawableSize;
mTotalWidth = totalSize;
- final int previewSize = FolderRingAnimator.sPreviewSize;
+ final int previewSize = mPreviewBackground.getLayoutParams().height;
final int previewPadding = FolderRingAnimator.sPreviewPadding;
mAvailableSpaceInPreview = (previewSize - 2 * previewPadding);
@@ -447,7 +461,7 @@ public class FolderIcon extends LinearLayout implements FolderListener {
mMaxPerspectiveShift = mBaselineIconSize * PERSPECTIVE_SHIFT_FACTOR;
mPreviewOffsetX = (mTotalWidth - mAvailableSpaceInPreview) / 2;
- mPreviewOffsetY = previewPadding;
+ mPreviewOffsetY = previewPadding + grid.folderBackgroundOffset;
}
}
@@ -494,7 +508,7 @@ public class FolderIcon extends LinearLayout implements FolderListener {
// We want to imagine our coordinates from the bottom left, growing up and to the
// right. This is natural for the x-axis, but for the y-axis, we have to invert things.
- float transY = mAvailableSpaceInPreview - (offset + scaledSize + scaleOffsetCorrection);
+ float transY = mAvailableSpaceInPreview - (offset + scaledSize + scaleOffsetCorrection) + getPaddingTop();
float transX = offset + scaleOffsetCorrection;
float totalScale = mBaselineIconScale * scale;
final int overlayAlpha = (int) (80 * (1 - r));
@@ -569,7 +583,7 @@ public class FolderIcon extends LinearLayout implements FolderListener {
final float scale0 = 1.0f;
final float transX0 = (mAvailableSpaceInPreview - d.getIntrinsicWidth()) / 2;
- final float transY0 = (mAvailableSpaceInPreview - d.getIntrinsicHeight()) / 2;
+ final float transY0 = (mAvailableSpaceInPreview - d.getIntrinsicHeight()) / 2 + getPaddingTop();
mAnimParams.drawable = d;
ValueAnimator va = LauncherAnimUtils.ofFloat(this, 0f, 1.0f);
diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java
index f94ed78..d28e96f 100644
--- a/src/com/android/launcher3/Hotseat.java
+++ b/src/com/android/launcher3/Hotseat.java
@@ -37,11 +37,8 @@ public class Hotseat extends FrameLayout {
@SuppressWarnings("unused")
private static final String TAG = "Hotseat";
- private Launcher mLauncher;
private CellLayout mContent;
- private int mCellCountX;
- private int mCellCountY;
private int mAllAppsButtonRank;
private boolean mTransposeLayoutWithOrientation;
@@ -61,9 +58,6 @@ public class Hotseat extends FrameLayout {
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.Hotseat, defStyle, 0);
Resources r = context.getResources();
- mCellCountX = a.getInt(R.styleable.Hotseat_cellCountX, -1);
- mCellCountY = a.getInt(R.styleable.Hotseat_cellCountY, -1);
- mAllAppsButtonRank = r.getInteger(R.integer.hotseat_all_apps_index);
mTransposeLayoutWithOrientation =
r.getBoolean(R.bool.hotseat_transpose_layout_with_orientation);
mIsLandscape = context.getResources().getConfiguration().orientation ==
@@ -71,7 +65,6 @@ public class Hotseat extends FrameLayout {
}
public void setup(Launcher launcher) {
- mLauncher = launcher;
setOnKeyListener(new HotseatIconKeyEventListener());
}
@@ -101,10 +94,16 @@ public class Hotseat extends FrameLayout {
@Override
protected void onFinishInflate() {
super.onFinishInflate();
- if (mCellCountX < 0) mCellCountX = LauncherModel.getCellCountX();
- if (mCellCountY < 0) mCellCountY = LauncherModel.getCellCountY();
+ LauncherAppState app = LauncherAppState.getInstance();
+ DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
+
+ mAllAppsButtonRank = (int) (grid.numHotseatIcons / 2);
mContent = (CellLayout) findViewById(R.id.layout);
- mContent.setGridSize(mCellCountX, mCellCountY);
+ if (grid.isLandscape && !grid.isLargeTablet()) {
+ mContent.setGridSize(1, (int) grid.numHotseatIcons);
+ } else {
+ mContent.setGridSize((int) grid.numHotseatIcons, 1);
+ }
mContent.setIsHotseat(true);
resetLayout();
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index ab2bc67..c29e74f 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -51,6 +51,7 @@ import android.database.ContentObserver;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
+import android.graphics.Point;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
@@ -199,7 +200,6 @@ public class Launcher extends Activity
private enum State { NONE, WORKSPACE, APPS_CUSTOMIZE, APPS_CUSTOMIZE_SPRING_LOADED };
private State mState = State.WORKSPACE;
private AnimatorSet mStateAnimation;
- private AnimatorSet mDividerAnimator;
static final int APPWIDGET_HOST_ID = 1024;
private static final int EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT = 300;
@@ -221,7 +221,6 @@ public class Launcher extends Activity
private LayoutInflater mInflater;
private Workspace mWorkspace;
- private View mQsbDivider;
private View mLauncherView;
private DragLayer mDragLayer;
private DragController mDragController;
@@ -372,9 +371,23 @@ public class Launcher extends Activity
super.onCreate(savedInstanceState);
- // the LauncherApplication should call this, but in case of Instrumentation it might not be present yet
LauncherAppState.setApplicationContext(getApplicationContext());
LauncherAppState app = LauncherAppState.getInstance();
+
+ // Determine the dynamic grid properties
+ Point smallestSize = new Point();
+ Point largestSize = new Point();
+ Point realSize = new Point();
+ Display display = getWindowManager().getDefaultDisplay();
+ display.getCurrentSizeRange(smallestSize, largestSize);
+ display.getRealSize(realSize);
+ // Lazy-initialize the dynamic grid
+ DeviceProfile grid = app.initDynamicGrid(this,
+ Math.min(smallestSize.x, smallestSize.y),
+ Math.min(largestSize.x, largestSize.y),
+ realSize.x, realSize.y);
+
+ // the LauncherApplication should call this, but in case of Instrumentation it might not be present yet
mSharedPrefs = getSharedPreferences(LauncherAppState.getSharedPreferencesKey(),
Context.MODE_PRIVATE);
mModel = app.setLauncher(this);
@@ -400,6 +413,7 @@ public class Launcher extends Activity
checkForLocaleChange();
setContentView(R.layout.launcher);
+ grid.layout(this);
setupViews();
showFirstRunWorkspaceCling();
@@ -1061,7 +1075,6 @@ public class Launcher extends Activity
mLauncherView = findViewById(R.id.launcher);
mDragLayer = (DragLayer) findViewById(R.id.drag_layer);
mWorkspace = (Workspace) mDragLayer.findViewById(R.id.workspace);
- mQsbDivider = findViewById(R.id.qsb_divider);
mLauncherView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
mWorkspaceBackgroundDrawable = getResources().getDrawable(R.drawable.workspace_bg);
@@ -2014,6 +2027,9 @@ public class Launcher extends Activity
FolderIcon.fromXml(R.layout.folder_icon, this, layout, folderInfo, mIconCache);
mWorkspace.addInScreen(newFolder, container, screenId, cellX, cellY, 1, 1,
isWorkspaceLocked());
+ // Force measure the new folder icon
+ CellLayout parent = mWorkspace.getParentCellLayoutForView(newFolder);
+ parent.getShortcutsAndWidgets().measureChild(newFolder);
return newFolder;
}
@@ -2784,11 +2800,6 @@ public class Launcher extends Activity
dispatchOnLauncherTransitionEnd(fromView, animated, false);
dispatchOnLauncherTransitionEnd(toView, animated, false);
- if (mWorkspace != null
- && !springLoaded
- && !LauncherAppState.getInstance().isScreenLarge()) {
- hideDockDivider();
- }
if (!animationCancelled) {
updateWallpaperVisibility(false);
}
@@ -2855,8 +2866,6 @@ public class Launcher extends Activity
toView.bringToFront();
if (!springLoaded && !LauncherAppState.getInstance().isScreenLarge()) {
- hideDockDivider();
-
// Hide the search bar
if (mSearchDropTargetBar != null) {
mSearchDropTargetBar.hideSearchBar(false);
@@ -3008,9 +3017,6 @@ public class Launcher extends Activity
mSearchDropTargetBar.showSearchBar(wasInSpringLoadedMode);
}
- // We only need to animate in the dock divider if we're going from spring loaded mode
- showDockDivider(animated && wasInSpringLoadedMode);
-
// Set focus to the AppsCustomize button
if (mAllAppsButton != null) {
mAllAppsButton.requestFocus();
@@ -3056,7 +3062,6 @@ public class Launcher extends Activity
void enterSpringLoadedDragMode() {
if (isAllAppsVisible()) {
hideAppsCustomizeHelper(State.APPS_CUSTOMIZE_SPRING_LOADED, true, true, null);
- hideDockDivider();
mState = State.APPS_CUSTOMIZE_SPRING_LOADED;
}
}
@@ -3093,33 +3098,6 @@ public class Launcher extends Activity
// Otherwise, we are not in spring loaded mode, so don't do anything.
}
- void hideDockDivider() {
- if (mQsbDivider != null) {
- mQsbDivider.setVisibility(View.INVISIBLE);
- }
- }
-
- void showDockDivider(boolean animated) {
- if (mQsbDivider != null) {
- mQsbDivider.setVisibility(View.VISIBLE);
- if (mDividerAnimator != null) {
- mDividerAnimator.cancel();
- mQsbDivider.setAlpha(1f);
- mDividerAnimator = null;
- }
- if (animated) {
- mDividerAnimator = LauncherAnimUtils.createAnimatorSet();
- mDividerAnimator.playTogether(LauncherAnimUtils.ofFloat(mQsbDivider, "alpha", 1f));
- int duration = 0;
- if (mSearchDropTargetBar != null) {
- duration = mSearchDropTargetBar.getTransitionInDuration();
- }
- mDividerAnimator.setDuration(duration);
- mDividerAnimator.start();
- }
- }
- }
-
void lockAllApps() {
// TODO
}
diff --git a/src/com/android/launcher3/LauncherAppState.java b/src/com/android/launcher3/LauncherAppState.java
index 03d2d33..0c577e5 100644
--- a/src/com/android/launcher3/LauncherAppState.java
+++ b/src/com/android/launcher3/LauncherAppState.java
@@ -21,11 +21,14 @@ import android.content.*;
import android.content.res.Configuration;
import android.database.ContentObserver;
import android.os.Handler;
+import android.provider.Settings;
import android.util.Log;
+import android.view.Display;
import java.lang.ref.WeakReference;
public class LauncherAppState {
+ private static final String TAG = "LauncherAppState";
private static final String SHARED_PREFERENCES_KEY = "com.android.launcher3.prefs";
private LauncherModel mModel;
@@ -41,6 +44,8 @@ public class LauncherAppState {
private static Object mLock = new Object();
private static LauncherAppState INSTANCE;
+ private DynamicGrid mDynamicGrid;
+
public static LauncherAppState getInstance() {
if (INSTANCE == null) {
INSTANCE = new LauncherAppState();
@@ -71,7 +76,7 @@ public class LauncherAppState {
}
// set sIsScreenXLarge and mScreenDensity *before* creating icon cache
- mIsScreenLarge = sContext.getResources().getBoolean(R.bool.is_large_screen);
+ mIsScreenLarge = sContext.getResources().getBoolean(R.bool.is_large_tablet);
mScreenDensity = sContext.getResources().getDisplayMetrics().density;
mWidgetPreviewCacheDb = new WidgetPreviewLoader.CacheDb(sContext);
@@ -158,6 +163,27 @@ public class LauncherAppState {
return SHARED_PREFERENCES_KEY;
}
+ DeviceProfile initDynamicGrid(Context context, int minWidth, int minHeight, int width, int height) {
+ boolean created = false;
+ if (mDynamicGrid == null) {
+ mDynamicGrid = new DynamicGrid(context.getResources(),
+ minWidth, minHeight, width, height);
+ created = true;
+ }
+
+ DeviceProfile grid = mDynamicGrid.getDeviceProfile();
+ if (created) {
+ LauncherModel.updateWorkspaceLayoutCells((int) grid.numColumns, (int) grid.numRows);
+ }
+ // Update the icon size
+ Utilities.setIconSize(grid.iconSizePx);
+ grid.updateFromConfiguration(context.getResources(), width, height);
+ return grid;
+ }
+ DynamicGrid getDynamicGrid() {
+ return mDynamicGrid;
+ }
+
public boolean isScreenLarge() {
return mIsScreenLarge;
}
diff --git a/src/com/android/launcher3/LauncherAppWidgetHostView.java b/src/com/android/launcher3/LauncherAppWidgetHostView.java
index faec8b6..90587f9 100644
--- a/src/com/android/launcher3/LauncherAppWidgetHostView.java
+++ b/src/com/android/launcher3/LauncherAppWidgetHostView.java
@@ -18,6 +18,7 @@ package com.android.launcher3;
import android.appwidget.AppWidgetHostView;
import android.content.Context;
+import android.graphics.Canvas;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 2ac9b1b..cd37a16 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -1556,6 +1556,11 @@ public class LauncherModel extends BroadcastReceiver {
}
}
+ private boolean checkItemDimensions(ItemInfo info) {
+ return (info.cellX + info.spanX) > mCellCountX ||
+ (info.cellY + info.spanY) > mCellCountY;
+ }
+
// check & update map of what's occupied; used to discard overlapping/invalid items
private boolean checkItemPlacement(HashMap<Long, ItemInfo[][]> occupied, ItemInfo item) {
long containerIndex = item.screenId;
@@ -1743,6 +1748,16 @@ public class LauncherModel extends BroadcastReceiver {
info.screenId = c.getInt(screenIndex);
info.cellX = c.getInt(cellXIndex);
info.cellY = c.getInt(cellYIndex);
+ info.spanX = 1;
+ info.spanY = 1;
+ // Skip loading items that are out of bounds
+ if (container == LauncherSettings.Favorites.CONTAINER_DESKTOP) {
+ if (checkItemDimensions(info)) {
+ Log.d(TAG, "Skipped loading out of bounds shortcut: "
+ + info.intent);
+ continue;
+ }
+ }
// check & update map of what's occupied
if (!checkItemPlacement(occupied, info)) {
break;
@@ -1781,11 +1796,22 @@ public class LauncherModel extends BroadcastReceiver {
folderInfo.screenId = c.getInt(screenIndex);
folderInfo.cellX = c.getInt(cellXIndex);
folderInfo.cellY = c.getInt(cellYIndex);
-
+ folderInfo.spanX = 1;
+ folderInfo.spanY = 1;
+
+ // Skip loading items that are out of bounds
+ if (container == LauncherSettings.Favorites.CONTAINER_DESKTOP) {
+ int iconSpan = 1;
+ if (checkItemDimensions(folderInfo)) {
+ Log.d(TAG, "Skipped loading out of bounds folder");
+ continue;
+ }
+ }
// check & update map of what's occupied
if (!checkItemPlacement(occupied, folderInfo)) {
break;
}
+
switch (container) {
case LauncherSettings.Favorites.CONTAINER_DESKTOP:
case LauncherSettings.Favorites.CONTAINER_HOTSEAT:
@@ -1834,6 +1860,13 @@ public class LauncherModel extends BroadcastReceiver {
}
appWidgetInfo.container = c.getInt(containerIndex);
+ // Skip loading items that are out of bounds
+ if (container == LauncherSettings.Favorites.CONTAINER_DESKTOP) {
+ if (checkItemDimensions(appWidgetInfo)) {
+ Log.d(TAG, "Skipped loading out of bounds app widget");
+ continue;
+ }
+ }
// check & update map of what's occupied
if (!checkItemPlacement(occupied, appWidgetInfo)) {
break;
diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java
index 7d090e1..5e8a619 100644
--- a/src/com/android/launcher3/LauncherProvider.java
+++ b/src/com/android/launcher3/LauncherProvider.java
@@ -963,8 +963,6 @@ public class LauncherProvider extends ContentProvider {
ContentValues values = new ContentValues();
PackageManager packageManager = mContext.getPackageManager();
- int allAppsButtonRank =
- mContext.getResources().getInteger(R.integer.hotseat_all_apps_index);
int i = 0;
try {
XmlResourceParser parser = mContext.getResources().getXml(workspaceResourceId);
@@ -995,14 +993,6 @@ public class LauncherProvider extends ContentProvider {
String x = a.getString(R.styleable.Favorite_x);
String y = a.getString(R.styleable.Favorite_y);
- // If we are adding to the hotseat, the screen is used as the position in the
- // hotseat. This screen can't be at position 0 because AllApps is in the
- // zeroth position.
- if (container == LauncherSettings.Favorites.CONTAINER_HOTSEAT
- && Integer.valueOf(screen) == allAppsButtonRank) {
- throw new RuntimeException("Invalid screen position for hotseat item");
- }
-
values.clear();
values.put(LauncherSettings.Favorites.CONTAINER, container);
values.put(LauncherSettings.Favorites.SCREEN, screen);
diff --git a/src/com/android/launcher3/PagedViewCellLayout.java b/src/com/android/launcher3/PagedViewCellLayout.java
index 9aa2467..38fd1ed 100644
--- a/src/com/android/launcher3/PagedViewCellLayout.java
+++ b/src/com/android/launcher3/PagedViewCellLayout.java
@@ -59,11 +59,11 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
setAlwaysDrawnWithCacheEnabled(false);
// setup default cell parameters
+ LauncherAppState app = LauncherAppState.getInstance();
+ DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
Resources resources = context.getResources();
- mOriginalCellWidth = mCellWidth =
- resources.getDimensionPixelSize(R.dimen.apps_customize_cell_width);
- mOriginalCellHeight = mCellHeight =
- resources.getDimensionPixelSize(R.dimen.apps_customize_cell_height);
+ mOriginalCellWidth = mCellWidth = grid.cellWidthPx;
+ mOriginalCellHeight = mCellHeight = grid.cellHeightPx;
mCellCountX = LauncherModel.getCellCountX();
mCellCountY = LauncherModel.getCellCountY();
mOriginalWidthGap = mOriginalHeightGap = mWidthGap = mHeightGap = -1;
diff --git a/src/com/android/launcher3/SearchDropTargetBar.java b/src/com/android/launcher3/SearchDropTargetBar.java
index 32d094b..8f1b5d2 100644
--- a/src/com/android/launcher3/SearchDropTargetBar.java
+++ b/src/com/android/launcher3/SearchDropTargetBar.java
@@ -99,7 +99,6 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D
mDropTargetBar = findViewById(R.id.drag_target_bar);
mInfoDropTarget = (ButtonDropTarget) mDropTargetBar.findViewById(R.id.info_target_text);
mDeleteDropTarget = (ButtonDropTarget) mDropTargetBar.findViewById(R.id.delete_target_text);
- mBarHeight = getResources().getDimensionPixelSize(R.dimen.qsb_bar_height);
mInfoDropTarget.setSearchDropTargetBar(this);
mDeleteDropTarget.setSearchDropTargetBar(this);
@@ -109,6 +108,9 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D
// Create the various fade animations
if (mEnableDropDownDropTargets) {
+ LauncherAppState app = LauncherAppState.getInstance();
+ DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
+ mBarHeight = grid.searchBarSpaceHeightPx;
mDropTargetBar.setTranslationY(-mBarHeight);
mDropTargetBarAnim = LauncherAnimUtils.ofFloat(mDropTargetBar, "translationY",
-mBarHeight, 0f);
diff --git a/src/com/android/launcher3/ShortcutAndWidgetContainer.java b/src/com/android/launcher3/ShortcutAndWidgetContainer.java
index 64a87ef..6c33601 100644
--- a/src/com/android/launcher3/ShortcutAndWidgetContainer.java
+++ b/src/com/android/launcher3/ShortcutAndWidgetContainer.java
@@ -33,6 +33,8 @@ public class ShortcutAndWidgetContainer extends ViewGroup {
private final WallpaperManager mWallpaperManager;
+ private boolean mIsHotseatLayout;
+
private int mCellWidth;
private int mCellHeight;
@@ -40,6 +42,7 @@ public class ShortcutAndWidgetContainer extends ViewGroup {
private int mHeightGap;
private int mCountX;
+ private int mCountY;
private boolean mInvertIfRtl = false;
@@ -49,12 +52,13 @@ public class ShortcutAndWidgetContainer extends ViewGroup {
}
public void setCellDimensions(int cellWidth, int cellHeight, int widthGap, int heightGap,
- int countX) {
+ int countX, int countY) {
mCellWidth = cellWidth;
mCellHeight = cellHeight;
mWidthGap = widthGap;
mHeightGap = heightGap;
mCountX = countX;
+ mCountY = countY;
}
public View getChildAt(int x, int y) {
@@ -113,13 +117,28 @@ public class ShortcutAndWidgetContainer extends ViewGroup {
mInvertIfRtl = invert;
}
+ public void setIsHotseat(boolean isHotseat) {
+ mIsHotseatLayout = isHotseat;
+ }
+
public void measureChild(View child) {
+ final LauncherAppState app = LauncherAppState.getInstance();
+ final DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
final int cellWidth = mCellWidth;
final int cellHeight = mCellHeight;
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams();
if (!lp.isFullscreen) {
lp.setup(cellWidth, cellHeight, mWidthGap, mHeightGap, invertLayoutHorizontally(),
mCountX);
+
+ if (child instanceof LauncherAppWidgetHostView) {
+ // Widgets have their own padding, so skip
+ } else {
+ // Otherwise, center the icon
+ int cHeight = mIsHotseatLayout ? grid.hotseatCellHeightPx : Math.min(getMeasuredHeight(), grid.cellHeightPx);
+ int cellPaddingY = (int) Math.max(0, ((lp.height - cHeight) / 2f));
+ child.setPadding(0, cellPaddingY, 0, 0);
+ }
} else {
lp.x = 0;
lp.y = 0;
@@ -142,12 +161,14 @@ public class ShortcutAndWidgetContainer extends ViewGroup {
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
+ LauncherAppState app = LauncherAppState.getInstance();
+ DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
+
int count = getChildCount();
for (int i = 0; i < count; i++) {
final View child = getChildAt(i);
if (child.getVisibility() != GONE) {
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams();
-
int childLeft = lp.x;
int childTop = lp.y;
child.layout(childLeft, childTop, childLeft + lp.width, childTop + lp.height);
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index cc22bb5..0529cfb 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -120,19 +120,12 @@ final class Utilities {
int sourceWidth = icon.getIntrinsicWidth();
int sourceHeight = icon.getIntrinsicHeight();
if (sourceWidth > 0 && sourceHeight > 0) {
- // There are intrinsic sizes.
- if (width < sourceWidth || height < sourceHeight) {
- // It's too big, scale it down.
- final float ratio = (float) sourceWidth / sourceHeight;
- if (sourceWidth > sourceHeight) {
- height = (int) (width / ratio);
- } else if (sourceHeight > sourceWidth) {
- width = (int) (height * ratio);
- }
- } else if (sourceWidth < width && sourceHeight < height) {
- // Don't scale up the icon
- width = sourceWidth;
- height = sourceHeight;
+ // Scale the icon proportionally to the icon dimensions
+ final float ratio = (float) sourceWidth / sourceHeight;
+ if (sourceWidth > sourceHeight) {
+ height = (int) (width / ratio);
+ } else if (sourceHeight > sourceWidth) {
+ width = (int) (height * ratio);
}
}
@@ -169,34 +162,8 @@ final class Utilities {
}
}
- static void drawSelectedAllAppsBitmap(Canvas dest, int destWidth, int destHeight,
- boolean pressed, Bitmap src) {
- synchronized (sCanvas) { // we share the statics :-(
- if (sIconWidth == -1) {
- // We can't have gotten to here without src being initialized, which
- // comes from this file already. So just assert.
- //initStatics(context);
- throw new RuntimeException("Assertion failed: Utilities not initialized");
- }
-
- dest.drawColor(0, PorterDuff.Mode.CLEAR);
-
- int[] xy = new int[2];
- Bitmap mask = src.extractAlpha(sBlurPaint, xy);
-
- float px = (destWidth - src.getWidth()) / 2;
- float py = (destHeight - src.getHeight()) / 2;
- dest.drawBitmap(mask, px + xy[0], py + xy[1],
- pressed ? sGlowColorPressedPaint : sGlowColorFocusedPaint);
-
- mask.recycle();
- }
- }
-
/**
* Returns a Bitmap representing the thumbnail of the specified Bitmap.
- * The size of the thumbnail is defined by the dimension
- * android.R.dimen.launcher_application_icon_size.
*
* @param bitmap The bitmap to get a thumbnail of.
* @param context The application's context.
@@ -219,24 +186,6 @@ final class Utilities {
}
}
- static Bitmap drawDisabledBitmap(Bitmap bitmap, Context context) {
- synchronized (sCanvas) { // we share the statics :-(
- if (sIconWidth == -1) {
- initStatics(context);
- }
- final Bitmap disabled = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(),
- Bitmap.Config.ARGB_8888);
- final Canvas canvas = sCanvas;
- canvas.setBitmap(disabled);
-
- canvas.drawBitmap(bitmap, 0.0f, 0.0f, sDisabledPaint);
-
- canvas.setBitmap(null);
-
- return disabled;
- }
- }
-
/**
* Given a coordinate relative to the descendant, find the coordinate in a parent view's
* coordinates.
@@ -345,26 +294,8 @@ final class Utilities {
sDisabledPaint.setAlpha(0x88);
}
- /** Only works for positive numbers. */
- static int roundToPow2(int n) {
- int orig = n;
- n >>= 1;
- int mask = 0x8000000;
- while (mask != 0 && (n & mask) == 0) {
- mask >>= 1;
- }
- while (mask != 0) {
- n |= mask;
- mask >>= 1;
- }
- n += 1;
- if (n != orig) {
- n <<= 1;
- }
- return n;
- }
-
- static int generateRandomId() {
- return new Random(System.currentTimeMillis()).nextInt(1 << 24);
+ public static void setIconSize(int widthPx) {
+ sIconWidth = sIconHeight = widthPx;
+ sIconTextureWidth = sIconTextureHeight = widthPx;
}
}
diff --git a/src/com/android/launcher3/WidgetPreviewLoader.java b/src/com/android/launcher3/WidgetPreviewLoader.java
index e96981a..11c12f8 100644
--- a/src/com/android/launcher3/WidgetPreviewLoader.java
+++ b/src/com/android/launcher3/WidgetPreviewLoader.java
@@ -138,10 +138,12 @@ public class WidgetPreviewLoader {
}
public WidgetPreviewLoader(Launcher launcher) {
+ LauncherAppState app = LauncherAppState.getInstance();
+ DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
+
mContext = mLauncher = launcher;
mPackageManager = mContext.getPackageManager();
- mAppIconSize = mContext.getResources().getDimensionPixelSize(R.dimen.app_icon_size);
- LauncherAppState app = LauncherAppState.getInstance();
+ mAppIconSize = grid.iconSizePx;
mIconCache = app.getIconCache();
mDb = app.getWidgetPreviewCacheDb();
mLoadedPreviews = new HashMap<String, WeakReference<Bitmap>>();
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 44eeae4..77f726a 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -164,9 +164,6 @@ public class Workspace extends SmoothPagedView
private float mSpringLoadedShrinkFactor;
private float mOverviewModeShrinkFactor;
- private static final int DEFAULT_CELL_COUNT_X = 4;
- private static final int DEFAULT_CELL_COUNT_Y = 4;
-
// State variable that indicates whether the pages are small (ie when you're
// in all apps or customize mode)
@@ -188,7 +185,6 @@ public class Workspace extends SmoothPagedView
private final Rect mTempRect = new Rect();
private final int[] mTempXY = new int[2];
private int[] mTempVisiblePagesRange = new int[2];
- private float mOverscrollFade = 0;
private boolean mOverscrollTransformsSet;
public static final int DRAG_BITMAP_PADDING = 2;
private boolean mWorkspaceFadeInAdjacentScreens;
@@ -301,52 +297,17 @@ public class Workspace extends SmoothPagedView
mFadeInAdjacentScreens = false;
mWallpaperManager = WallpaperManager.getInstance(context);
- int cellCountX = DEFAULT_CELL_COUNT_X;
- int cellCountY = DEFAULT_CELL_COUNT_Y;
-
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.Workspace, defStyle, 0);
-
- if (LauncherAppState.getInstance().isScreenLarge()) {
- // Determine number of rows/columns dynamically
- // TODO: This code currently fails on tablets with an aspect ratio < 1.3.
- // Around that ratio we should make cells the same size in portrait and
- // landscape
- TypedArray actionBarSizeTypedArray =
- context.obtainStyledAttributes(new int[] { android.R.attr.actionBarSize });
- final float actionBarHeight = actionBarSizeTypedArray.getDimension(0, 0f);
-
- Point minDims = new Point();
- Point maxDims = new Point();
- mLauncher.getWindowManager().getDefaultDisplay().getCurrentSizeRange(minDims, maxDims);
-
- cellCountX = 1;
- while (CellLayout.widthInPortrait(res, cellCountX + 1) <= minDims.x) {
- cellCountX++;
- }
-
- cellCountY = 1;
- while (actionBarHeight + CellLayout.heightInLandscape(res, cellCountY + 1)
- <= minDims.y) {
- cellCountY++;
- }
- }
-
mSpringLoadedShrinkFactor =
res.getInteger(R.integer.config_workspaceSpringLoadShrinkPercentage) / 100.0f;
mOverviewModeShrinkFactor =
res.getInteger(R.integer.config_workspaceOverviewShrinkPercentage) / 100.0f;
mCameraDistance = res.getInteger(R.integer.config_cameraDistance);
-
- // if the value is manually specified, use that instead
- cellCountX = a.getInt(R.styleable.Workspace_cellCountX, cellCountX);
- cellCountY = a.getInt(R.styleable.Workspace_cellCountY, cellCountY);
mDefaultPage = a.getInt(R.styleable.Workspace_defaultScreen, 1);
a.recycle();
setOnHierarchyChangeListener(this);
-
- LauncherModel.updateWorkspaceLayoutCells(cellCountX, cellCountY);
setHapticFeedbackEnabled(false);
initWorkspace();
@@ -417,6 +378,7 @@ public class Workspace extends SmoothPagedView
mCurrentPage = mDefaultPage;
Launcher.setScreen(mCurrentPage);
LauncherAppState app = LauncherAppState.getInstance();
+ DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
mIconCache = app.getIconCache();
setWillNotDraw(false);
setClipChildren(false);
@@ -438,7 +400,7 @@ public class Workspace extends SmoothPagedView
mWallpaperTravelWidth = (int) (mDisplaySize.x *
wallpaperTravelToScreenWidthRatio(mDisplaySize.x, mDisplaySize.y));
- mMaxDistanceForFolderCreation = (0.55f * res.getDimensionPixelSize(R.dimen.app_icon_size));
+ mMaxDistanceForFolderCreation = (0.55f * grid.iconSizePx);
mFlingThresholdVelocity = (int) (FLING_THRESHOLD_VELOCITY * mDensity);
}
@@ -615,7 +577,10 @@ public class Workspace extends SmoothPagedView
}
public long getScreenIdForPageIndex(int index) {
- return mScreenOrder.get(index);
+ if (0 <= index && index < mScreenOrder.size()) {
+ return mScreenOrder.get(index);
+ }
+ return -1;
}
ArrayList<Long> getScreenOrder() {
@@ -1401,7 +1366,6 @@ public class Workspace extends SmoothPagedView
cl.setOverScrollAmount(Math.abs(scrollProgress), isLeftPage);
float rotation = -WORKSPACE_OVERSCROLL_ROTATION * scrollProgress;
cl.setRotationY(rotation);
- setFadeForOverScroll(Math.abs(scrollProgress));
if (!mOverscrollTransformsSet) {
mOverscrollTransformsSet = true;
cl.setCameraDistance(mDensity * mCameraDistance);
@@ -1410,9 +1374,6 @@ public class Workspace extends SmoothPagedView
cl.setOverscrollTransformsDirty(true);
}
} else {
- if (mOverscrollFade != 0) {
- setFadeForOverScroll(0);
- }
if (mOverscrollTransformsSet) {
mOverscrollTransformsSet = false;
((CellLayout) getChildAt(0)).resetOverscrollTransforms();
@@ -2165,11 +2126,12 @@ public class Workspace extends SmoothPagedView
Math.round(mTempXY[1] - (bmpHeight - scale * bmpHeight) / 2
- DRAG_BITMAP_PADDING / 2);
+ LauncherAppState app = LauncherAppState.getInstance();
+ DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
Point dragVisualizeOffset = null;
Rect dragRect = null;
if (child instanceof BubbleTextView || child instanceof PagedViewIcon) {
- int iconSize = r.getDimensionPixelSize(R.dimen.app_icon_size);
- int iconPaddingTop = r.getDimensionPixelSize(R.dimen.app_icon_padding_top);
+ int iconSize = grid.iconSizePx;
int top = child.getPaddingTop();
int left = (bmpWidth - iconSize) / 2;
int right = left + iconSize;
@@ -2177,12 +2139,11 @@ public class Workspace extends SmoothPagedView
dragLayerY += top;
// Note: The drag region is used to calculate drag layer offsets, but the
// dragVisualizeOffset in addition to the dragRect (the size) to position the outline.
- dragVisualizeOffset = new Point(-DRAG_BITMAP_PADDING / 2,
- iconPaddingTop - DRAG_BITMAP_PADDING / 2);
+ dragVisualizeOffset = new Point(-DRAG_BITMAP_PADDING / 2, DRAG_BITMAP_PADDING / 2);
dragRect = new Rect(left, top, right, bottom);
} else if (child instanceof FolderIcon) {
- int previewSize = r.getDimensionPixelSize(R.dimen.folder_preview_size);
- dragRect = new Rect(0, 0, child.getWidth(), previewSize);
+ int previewSize = grid.folderIconSizePx;
+ dragRect = new Rect(0, child.getPaddingTop(), child.getWidth(), previewSize);
}
// Clear the pressed state if necessary
@@ -2665,6 +2626,9 @@ public class Workspace extends SmoothPagedView
}
static Rect getCellLayoutMetrics(Launcher launcher, int orientation) {
+ LauncherAppState app = LauncherAppState.getInstance();
+ DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
+
Resources res = launcher.getResources();
Display display = launcher.getWindowManager().getDefaultDisplay();
Point smallestSize = new Point();
@@ -2672,12 +2636,9 @@ public class Workspace extends SmoothPagedView
display.getCurrentSizeRange(smallestSize, largestSize);
if (orientation == CellLayout.LANDSCAPE) {
if (mLandscapeCellLayoutMetrics == null) {
- int paddingLeft = res.getDimensionPixelSize(R.dimen.workspace_left_padding_land);
- int paddingRight = res.getDimensionPixelSize(R.dimen.workspace_right_padding_land);
- int paddingTop = res.getDimensionPixelSize(R.dimen.workspace_top_padding_land);
- int paddingBottom = res.getDimensionPixelSize(R.dimen.workspace_bottom_padding_land);
- int width = largestSize.x - paddingLeft - paddingRight;
- int height = smallestSize.y - paddingTop - paddingBottom;
+ Rect padding = grid.getWorkspacePadding(CellLayout.LANDSCAPE);
+ int width = largestSize.x - padding.left - padding.right;
+ int height = smallestSize.y - padding.top - padding.bottom;
mLandscapeCellLayoutMetrics = new Rect();
CellLayout.getMetrics(mLandscapeCellLayoutMetrics, res,
width, height, LauncherModel.getCellCountX(), LauncherModel.getCellCountY(),
@@ -2686,12 +2647,9 @@ public class Workspace extends SmoothPagedView
return mLandscapeCellLayoutMetrics;
} else if (orientation == CellLayout.PORTRAIT) {
if (mPortraitCellLayoutMetrics == null) {
- int paddingLeft = res.getDimensionPixelSize(R.dimen.workspace_left_padding_land);
- int paddingRight = res.getDimensionPixelSize(R.dimen.workspace_right_padding_land);
- int paddingTop = res.getDimensionPixelSize(R.dimen.workspace_top_padding_land);
- int paddingBottom = res.getDimensionPixelSize(R.dimen.workspace_bottom_padding_land);
- int width = smallestSize.x - paddingLeft - paddingRight;
- int height = largestSize.y - paddingTop - paddingBottom;
+ Rect padding = grid.getWorkspacePadding(CellLayout.PORTRAIT);
+ int width = smallestSize.x - padding.left - padding.right;
+ int height = largestSize.y - padding.top - padding.bottom;
mPortraitCellLayoutMetrics = new Rect();
CellLayout.getMetrics(mPortraitCellLayoutMetrics, res,
width, height, LauncherModel.getCellCountX(), LauncherModel.getCellCountY(),
@@ -4129,7 +4087,7 @@ public class Workspace extends SmoothPagedView
@Override
protected int getPageIndicatorMarker(int pageIndex) {
if (getScreenIdForPageIndex(pageIndex) == CUSTOM_CONTENT_SCREEN_ID) {
- return R.layout.now_page_indicator_marker;
+ return R.layout.custom_content_page_indicator_marker;
}
return super.getPageIndicatorMarker(pageIndex);
}
@@ -4151,13 +4109,4 @@ public class Workspace extends SmoothPagedView
public void getLocationInDragLayer(int[] loc) {
mLauncher.getDragLayer().getLocationInDragLayer(this, loc);
}
-
- void setFadeForOverScroll(float fade) {
- mOverscrollFade = fade;
- float reducedFade = 0.5f + 0.5f * (1 - fade);
- final ViewGroup parent = (ViewGroup) getParent();
- final ImageView qsbDivider = (ImageView) (parent.findViewById(R.id.qsb_divider));
-
- if (qsbDivider != null) qsbDivider.setAlpha(reducedFade);
- }
}