diff options
author | Winson Chung <winsonc@google.com> | 2011-06-19 12:41:22 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2011-06-22 17:26:02 -0700 |
commit | 4b825dcd5f64a5ebb60271844fbc5257374422bc (patch) | |
tree | bc3889079d484952e71bce46f3c47e78d8f40282 | |
parent | 547eeb3b3e99b79fdab3b74d4e536dc014d0fb0e (diff) | |
download | packages_apps_trebuchet-4b825dcd5f64a5ebb60271844fbc5257374422bc.zip packages_apps_trebuchet-4b825dcd5f64a5ebb60271844fbc5257374422bc.tar.gz packages_apps_trebuchet-4b825dcd5f64a5ebb60271844fbc5257374422bc.tar.bz2 |
Tweaking launcher grid and spacing.
Change-Id: I369a87f473d1e870b2f819221f6383aab340b067
23 files changed, 212 insertions, 251 deletions
diff --git a/res/layout-land/folder_icon.xml b/res/layout-land/folder_icon.xml index 60569c5..e9d2b96 100644 --- a/res/layout-land/folder_icon.xml +++ b/res/layout-land/folder_icon.xml @@ -28,5 +28,5 @@ android:src="@drawable/portal_ring_inner_holo"/> <com.android.launcher2.BubbleTextView android:id="@+id/folder_name" - style="@style/WorkspaceIcon.Landscape"/> + style="@style/WorkspaceIcon.Landscape.Folder"/> </com.android.launcher2.FolderIcon> diff --git a/res/layout-large-port/workspace_screen.xml b/res/layout-large-port/workspace_screen.xml deleted file mode 100644 index e33c612..0000000 --- a/res/layout-large-port/workspace_screen.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.launcher2.CellLayout - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher" - - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:hapticFeedbackEnabled="false" - - launcher:cellWidth="@dimen/workspace_cell_width" - launcher:cellHeight="@dimen/workspace_cell_height" - launcher:widthGap="@dimen/workspace_width_gap_port" - launcher:heightGap="@dimen/workspace_height_gap_port" - - launcher:xAxisStartPadding="@dimen/workspace_x_axis_start_padding_port" - launcher:xAxisEndPadding="@dimen/workspace_x_axis_end_padding_port" - launcher:yAxisStartPadding="@dimen/workspace_y_axis_start_padding_port" - launcher:yAxisEndPadding="@dimen/workspace_y_axis_end_padding_port" /> diff --git a/res/layout-large/all_apps_paged_view_application.xml b/res/layout-large/all_apps_paged_view_application.xml index 16e5d82..019f75f 100644 --- a/res/layout-large/all_apps_paged_view_application.xml +++ b/res/layout-large/all_apps_paged_view_application.xml @@ -21,7 +21,7 @@ launcher:blurColor="#FF6B8CF0" launcher:outlineColor="#FF8CD2FF" - style="@style/WorkspaceIcon.AllApps" + style="@style/WorkspaceIcon.AppsCustomize" android:id="@+id/application_icon" android:layout_width="match_parent" diff --git a/res/layout-large-land/workspace_screen.xml b/res/layout-large/workspace_screen.xml index 25b05e9..52f9def 100644 --- a/res/layout-large-land/workspace_screen.xml +++ b/res/layout-large/workspace_screen.xml @@ -20,14 +20,14 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" + android:paddingLeft="@dimen/workspace_left_padding" + android:paddingRight="@dimen/workspace_right_padding" + android:paddingTop="@dimen/workspace_top_padding" + android:paddingBottom="@dimen/workspace_bottom_padding" android:hapticFeedbackEnabled="false" launcher:cellWidth="@dimen/workspace_cell_width" launcher:cellHeight="@dimen/workspace_cell_height" - launcher:widthGap="@dimen/workspace_width_gap_land" - launcher:heightGap="@dimen/workspace_height_gap_land" - - launcher:xAxisStartPadding="@dimen/workspace_x_axis_start_padding_land" - launcher:xAxisEndPadding="@dimen/workspace_x_axis_end_padding_land" - launcher:yAxisStartPadding="@dimen/workspace_y_axis_start_padding_land" - launcher:yAxisEndPadding="@dimen/workspace_y_axis_end_padding_land" /> + launcher:widthGap="@dimen/workspace_width_gap" + launcher:heightGap="@dimen/workspace_height_gap" + launcher:maxGap="@dimen/workspace_max_gap" /> diff --git a/res/layout-port/folder_icon.xml b/res/layout-port/folder_icon.xml index 3f776de..adc0e6a 100644 --- a/res/layout-port/folder_icon.xml +++ b/res/layout-port/folder_icon.xml @@ -28,5 +28,5 @@ android:src="@drawable/portal_ring_inner_holo"/> <com.android.launcher2.BubbleTextView android:id="@+id/folder_name" - style="@style/WorkspaceIcon.Portrait"/> + style="@style/WorkspaceIcon.Portrait.Folder"/> </com.android.launcher2.FolderIcon> diff --git a/res/layout-port/workspace_screen.xml b/res/layout-port/workspace_screen.xml deleted file mode 100644 index 7a6714f..0000000 --- a/res/layout-port/workspace_screen.xml +++ /dev/null @@ -1,30 +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.launcher2.CellLayout - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher" - - android:layout_width="match_parent" - android:layout_height="match_parent" - android:hapticFeedbackEnabled="false" - - launcher:cellWidth="@dimen/workspace_cell_width" - launcher:cellHeight="@dimen/workspace_cell_height" - launcher:yAxisStartPadding="@dimen/qsb_bar_height" - launcher:yAxisEndPadding="@dimen/button_bar_height" - launcher:xAxisStartPadding="0dip" - launcher:xAxisEndPadding="0dip" /> diff --git a/res/layout/apps_customize_application.xml b/res/layout/apps_customize_application.xml index 4f36326..37a8df7 100644 --- a/res/layout/apps_customize_application.xml +++ b/res/layout/apps_customize_application.xml @@ -18,7 +18,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher" - style="@style/WorkspaceIcon.AllApps" + style="@style/WorkspaceIcon.AppsCustomize" android:id="@+id/application_icon" android:layout_width="match_parent" diff --git a/res/layout/user_folder.xml b/res/layout/user_folder.xml index 06d79ef..299095d 100644 --- a/res/layout/user_folder.xml +++ b/res/layout/user_folder.xml @@ -30,16 +30,16 @@ android:id="@+id/folder_content" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:paddingLeft="0dip" + android:paddingRight="0dip" + android:paddingTop="8dip" + android:paddingBottom="8dip" android:cacheColorHint="#ff333333" android:hapticFeedbackEnabled="false" launcher:widthGap="@dimen/folder_width_gap" launcher:heightGap="@dimen/folder_height_gap" launcher:cellWidth="@dimen/workspace_cell_width" - launcher:cellHeight="@dimen/workspace_cell_height" - launcher:xAxisStartPadding="0dip" - launcher:xAxisEndPadding="0dip" - launcher:yAxisStartPadding="8dip" - launcher:yAxisEndPadding="8dip"/> + launcher:cellHeight="@dimen/workspace_cell_height" /> <EditText android:id="@+id/folder_name" @@ -54,4 +54,4 @@ android:textColor="#FFF" android:gravity="center_horizontal" android:singleLine="true"/> -</com.android.launcher2.Folder>
\ No newline at end of file +</com.android.launcher2.Folder> diff --git a/res/layout-land/workspace_screen.xml b/res/layout/workspace_screen.xml index a9faf89..ede0d99 100644 --- a/res/layout-land/workspace_screen.xml +++ b/res/layout/workspace_screen.xml @@ -4,9 +4,9 @@ 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. @@ -20,11 +20,14 @@ android:layout_width="match_parent" android:layout_height="match_parent" + android:paddingLeft="@dimen/workspace_left_padding" + android:paddingRight="@dimen/workspace_right_padding" + android:paddingTop="@dimen/workspace_top_padding" + android:paddingBottom="@dimen/workspace_bottom_padding" android:hapticFeedbackEnabled="false" launcher:cellWidth="@dimen/workspace_cell_width" launcher:cellHeight="@dimen/workspace_cell_height" - launcher:xAxisStartPadding="@dimen/qsb_bar_height" - launcher:xAxisEndPadding="0dip" - launcher:yAxisStartPadding="0dip" - launcher:yAxisEndPadding="0dip"/> + launcher:widthGap="-1dp" + launcher:heightGap="-1dp" + launcher:maxGap="@dimen/workspace_max_gap" /> diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml index 13519e5..6ba7f7d 100644 --- a/res/values-land/dimens.xml +++ b/res/values-land/dimens.xml @@ -19,8 +19,12 @@ <dimen name="toolbar_button_vertical_padding">12dip</dimen> <dimen name="toolbar_button_horizontal_padding">12dip</dimen> - <dimen name="workspace_cell_width">106dip</dimen> - <dimen name="workspace_cell_height">74dip</dimen> +<!-- Workspace --> + <dimen name="workspace_left_padding">@dimen/qsb_bar_height</dimen> + <dimen name="workspace_right_padding">@dimen/button_bar_height</dimen> + <dimen name="workspace_top_padding">0dp</dimen> + <dimen name="workspace_bottom_padding">0dp</dimen> + <dimen name="folder_cell_width">100dip</dimen> <dimen name="folder_cell_height">74dip</dimen> <dimen name="button_bar_height">62dip</dimen> @@ -29,11 +33,12 @@ <integer name="all_apps_view_cellCountY">3</integer> <dimen name="all_apps_view_pageLayoutWidthGap">10dp</dimen> <dimen name="all_apps_view_pageLayoutHeightGap">5dp</dimen> - <dimen name="all_apps_view_pageLayoutPaddingTop">10dp</dimen> - <dimen name="all_apps_view_pageLayoutPaddingBottom">10dp</dimen> + <dimen name="all_apps_view_pageLayoutPaddingTop">4dp</dimen> + <dimen name="all_apps_view_pageLayoutPaddingBottom">4dp</dimen> <dimen name="all_apps_view_pageLayoutPaddingLeft">2dp</dimen> <dimen name="all_apps_view_pageLayoutPaddingRight">2dp</dimen> +<!-- AppsCustomize --> <dimen name="apps_customize_widget_cell_width_gap">30dp</dimen> <dimen name="apps_customize_widget_cell_height_gap">0dp</dimen> <integer name="apps_customize_widget_cell_count_x">3</integer> diff --git a/res/values-large-land/dimens.xml b/res/values-large-land/dimens.xml index eeb16f4..8a5dfd3 100644 --- a/res/values-large-land/dimens.xml +++ b/res/values-large-land/dimens.xml @@ -15,12 +15,20 @@ --> <resources> +<!-- Workspace --> + <dimen name="workspace_left_padding">25dip</dimen> + <dimen name="workspace_right_padding">25dip</dimen> + <dimen name="workspace_top_padding">15dip</dimen> + <dimen name="workspace_bottom_padding">15dip</dimen> + <dimen name="workspace_width_gap">32dp</dimen> + <dimen name="workspace_height_gap">2dp</dimen> + <!-- the area at the edge of the screen that makes the workspace go left or right while you're dragging. --> <dimen name="scroll_zone">100dip</dimen> - <dimen name="all_apps_view_pageLayoutWidthGap">36dp</dimen> - <dimen name="all_apps_view_pageLayoutHeightGap">6dp</dimen> + <dimen name="all_apps_view_pageLayoutWidthGap">28dp</dimen> + <dimen name="all_apps_view_pageLayoutHeightGap">8dp</dimen> <dimen name="all_apps_view_pageLayoutPaddingTop">20dp</dimen> <dimen name="all_apps_view_pageLayoutPaddingBottom">14dp</dimen> <dimen name="all_apps_view_pageLayoutPaddingLeft">40dp</dimen> diff --git a/res/values-large-port/dimens.xml b/res/values-large-port/dimens.xml index 86bd03d..ba60e73 100644 --- a/res/values-large-port/dimens.xml +++ b/res/values-large-port/dimens.xml @@ -15,6 +15,7 @@ --> <resources> +<!-- AppsCustomize --> <dimen name="apps_customize_cell_width">96dp</dimen> <dimen name="apps_customize_cell_height">96dp</dimen> <!-- The amount of space to account for the next/prev pages when @@ -22,10 +23,18 @@ In portrait/large we use apps_customize_cell_width / 8. --> <dimen name="apps_customize_peek_width">12dp</dimen> +<!-- Workspace --> <!-- the area at the edge of the screen that makes the workspace go left or right while you're dragging. --> <dimen name="scroll_zone">40dp</dimen> + <dimen name="workspace_left_padding">15dip</dimen> + <dimen name="workspace_right_padding">15dip</dimen> + <dimen name="workspace_top_padding">25dip</dimen> + <dimen name="workspace_bottom_padding">25dip</dimen> + <dimen name="workspace_width_gap">0dp</dimen> + <dimen name="workspace_height_gap">32dp</dimen> + <dimen name="all_apps_view_pageLayoutWidthGap">24dp</dimen> <dimen name="all_apps_view_pageLayoutHeightGap">36dp</dimen> <dimen name="all_apps_view_pageLayoutPaddingTop">25dp</dimen> diff --git a/res/values-large/dimens.xml b/res/values-large/dimens.xml index eb48859..9d4b3d9 100644 --- a/res/values-large/dimens.xml +++ b/res/values-large/dimens.xml @@ -18,6 +18,13 @@ <!-- Workspace --> <dimen name="qsb_bar_height">56dp</dimen> + <dimen name="workspace_cell_width">96dip</dimen> + <dimen name="workspace_cell_height">96dip</dimen> + + <dimen name="workspace_page_spacing_land">50dp</dimen> + <dimen name="workspace_page_spacing_port">64dp</dimen> + +<!-- AppsCustomize --> <dimen name="apps_customize_cell_width">96dp</dimen> <dimen name="apps_customize_cell_height">96dp</dimen> <!-- The amount of space to account for the next/prev pages when @@ -27,27 +34,6 @@ <dimen name="apps_customize_widget_cell_width_gap">36dp</dimen> <dimen name="apps_customize_widget_cell_height_gap">36dp</dimen> - <dimen name="workspace_cell_width">96dip</dimen> - <dimen name="workspace_cell_height">96dip</dimen> - - <dimen name="workspace_x_axis_start_padding_land">25dip</dimen> - <dimen name="workspace_x_axis_end_padding_land">25dip</dimen> - <dimen name="workspace_y_axis_start_padding_land">15dip</dimen> - <dimen name="workspace_y_axis_end_padding_land">15dip</dimen> - <dimen name="workspace_x_axis_start_padding_port">15dip</dimen> - <dimen name="workspace_x_axis_end_padding_port">15dip</dimen> - <dimen name="workspace_y_axis_start_padding_port">25dip</dimen> - <dimen name="workspace_y_axis_end_padding_port">25dip</dimen> - - <!-- Width/height gap overrides for the workspace --> - <dimen name="workspace_width_gap_land">32dp</dimen> - <dimen name="workspace_height_gap_land">2dp</dimen> - <dimen name="workspace_width_gap_port">0dp</dimen> - <dimen name="workspace_height_gap_port">32dp</dimen> - - <dimen name="workspace_page_spacing_land">50dp</dimen> - <dimen name="workspace_page_spacing_port">64dp</dimen> - <!-- The corner radius to draw the external drop icon rounded rect --> <dimen name="external_drop_icon_rect_radius">10dp</dimen> diff --git a/res/values-large/styles.xml b/res/values-large/styles.xml index f44bfa5..386e9ca 100644 --- a/res/values-large/styles.xml +++ b/res/values-large/styles.xml @@ -18,6 +18,42 @@ --> <resources> +<!-- Workspace --> + <style name="WorkspaceIcon.Portrait"> + <item name="android:drawablePadding">4dp</item> + <item name="android:paddingLeft">4dp</item> + <item name="android:paddingRight">4dp</item> + <item name="android:paddingTop">4dp</item> + <item name="android:paddingBottom">4dp</item> + <item name="android:textSize">13dip</item> + </style> + <style name="WorkspaceIcon.Portrait.Folder"> + <item name="android:paddingLeft">4dp</item> + <item name="android:paddingRight">4dp</item> + <item name="android:paddingTop">0dp</item> + <item name="android:paddingBottom">0dp</item> + <item name="android:textSize">13dip</item> + </style> + <style name="WorkspaceIcon.Landscape"> + <item name="android:drawablePadding">4dp</item> + <item name="android:paddingLeft">4dp</item> + <item name="android:paddingRight">4dp</item> + <item name="android:paddingTop">4dp</item> + <item name="android:paddingBottom">4dp</item> + <item name="android:textSize">13dip</item> + </style> + <style name="WorkspaceIcon.Landscape.Folder"> + <item name="android:paddingLeft">4dp</item> + <item name="android:paddingRight">4dp</item> + <item name="android:paddingTop">0dp</item> + <item name="android:paddingBottom">0dp</item> + <item name="android:textSize">13dip</item> + </style> + <style name="WorkspaceIcon.AppsCustomize"> + <item name="android:drawablePadding">2dp</item> + <item name="android:textSize">13dip</item> + </style> + <style name="Theme" parent="android:Theme.Holo"> <item name="android:windowNoTitle">true</item> <item name="android:windowActionModeOverlay">true</item> @@ -31,18 +67,6 @@ <item name="android:screenOrientation">unspecified</item> </style> - <style name="WorkspaceIcon.Portrait"> - <item name="android:drawablePadding">2dip</item> - <item name="android:paddingTop">0dip</item> - <item name="android:includeFontPadding">false</item> - </style> - - <style name="WorkspaceIcon.Landscape"> - <item name="android:drawablePadding">2dip</item> - <item name="android:paddingTop">0dip</item> - <item name="android:includeFontPadding">false</item> - </style> - <style name="TabIndicator.Wide"> <item name="android:paddingLeft">40dp</item> <item name="android:paddingRight">40dp</item> diff --git a/res/values-port/dimens.xml b/res/values-port/dimens.xml index 7d50c1a..58b81b8 100644 --- a/res/values-port/dimens.xml +++ b/res/values-port/dimens.xml @@ -15,15 +15,22 @@ --> <resources> - <dimen name="workspace_cell_width">80dip</dimen> - <dimen name="workspace_cell_height">100dip</dimen> +<!-- Workspace --> + <dimen name="workspace_left_padding">0dp</dimen> + <dimen name="workspace_right_padding">0dp</dimen> + <!-- NOTE: This padding is the @dimen/qsb_bar_height + some padding --> + <dimen name="workspace_top_padding">60dp</dimen> + <!-- NOTE: This padding is the @dimen/button_bar_height + some padding + for signposting --> + <dimen name="workspace_bottom_padding">64dp</dimen> + <dimen name="folder_cell_width">74dip</dimen> <dimen name="folder_cell_height">86dip</dimen> <integer name="all_apps_view_cellCountX">4</integer> <integer name="all_apps_view_cellCountY">5</integer> - <dimen name="all_apps_view_pageLayoutWidthGap">3dp</dimen> - <dimen name="all_apps_view_pageLayoutHeightGap">12dp</dimen> + <dimen name="all_apps_view_pageLayoutWidthGap">0dp</dimen> + <dimen name="all_apps_view_pageLayoutHeightGap">8dp</dimen> <dimen name="all_apps_view_pageLayoutPaddingTop">15dp</dimen> <dimen name="all_apps_view_pageLayoutPaddingBottom">15dp</dimen> <dimen name="all_apps_view_pageLayoutPaddingLeft">0dp</dimen> diff --git a/res/values/attrs.xml b/res/values/attrs.xml index ee48aa7..284f574 100644 --- a/res/values/attrs.xml +++ b/res/values/attrs.xml @@ -45,20 +45,13 @@ <attr name="cellWidth" format="dimension" /> <!-- The height of a single cell --> <attr name="cellHeight" format="dimension" /> - <!-- Padding to apply at the start of the long axis --> - <attr name="xAxisStartPadding" format="dimension" /> - <!-- Padding to apply at the end of the long axis --> - <attr name="xAxisEndPadding" format="dimension" /> - <!-- Padding to apply at the start of the short axis --> - <attr name="yAxisStartPadding" format="dimension" /> - <!-- Padding to apply at the end of the short axis --> - <attr name="yAxisEndPadding" format="dimension" /> <!-- An override for the width and height gap to allow users to specify a specific size for the page using spacing instead of resolving the spacing from the width of the page --> <attr name="widthGap" format="dimension" /> <attr name="heightGap" format="dimension" /> - + <!-- The max gap size for each dimension --> + <attr name="maxGap" format="dimension" /> </declare-styleable> <!-- StrokedTextView specific attributes. --> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 763ed19..36e3994 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -17,6 +17,11 @@ <resources> <!-- Workspace --> <dimen name="qsb_bar_height">56dp</dimen> + <dimen name="workspace_cell_width">80dp</dimen> + <dimen name="workspace_cell_height">80dp</dimen> + <dimen name="workspace_width_gap">-1dp</dimen> + <dimen name="workspace_height_gap">-1dp</dimen> + <dimen name="workspace_max_gap">8dp</dimen> <!-- QSB --> <dimen name="toolbar_button_vertical_padding">12dip</dimen> @@ -24,9 +29,9 @@ <!-- AllApps/Customize/AppsCustomize --> <!-- Size of icons in Workspace/AppsCustomize --> - <dimen name="app_icon_size">50dp</dimen> - <dimen name="apps_customize_cell_width">68dp</dimen> - <dimen name="apps_customize_cell_height">68dp</dimen> + <dimen name="app_icon_size">56dp</dimen> + <dimen name="apps_customize_cell_width">72dp</dimen> + <dimen name="apps_customize_cell_height">72dp</dimen> <!-- In portrat/normal, we peek only 1/8th the app cell width --> <dimen name="apps_customize_peek_width">9dp</dimen> <dimen name="apps_customize_widget_cell_width_gap">10dp</dimen> @@ -79,11 +84,6 @@ <dimen name="dragViewOffsetX">0dp</dimen> <dimen name="dragViewOffsetY">-8dp</dimen> - <!-- Width/height gap overrides for the workspace --> - <dimen name="workspace_width_gap">-1dp</dimen> - <dimen name="workspace_height_gap">-1dp</dimen> - -<!-- Workspace grid --> <!-- Padding applied to AppWidgets --> <dimen name="app_widget_padding_left">0dp</dimen> <dimen name="app_widget_padding_right">0dp</dimen> @@ -92,7 +92,7 @@ <!-- Folders --> <!-- The size of the image which sits behind the preview of the folder contents --> - <dimen name="folder_preview_size">56dp</dimen> + <dimen name="folder_preview_size">64dp</dimen> <!-- The amount that the preview contents are inset from the preview background --> <dimen name="folder_preview_padding">4dp</dimen> <dimen name="folder_padding">18dp</dimen> diff --git a/res/values/styles.xml b/res/values/styles.xml index 0449b93..4e498a6 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -37,35 +37,45 @@ <style name="WorkspaceIcon"> <item name="android:layout_width">match_parent</item> <item name="android:layout_height">match_parent</item> - <item name="android:paddingLeft">5dip</item> - <item name="android:paddingRight">5dip</item> + <item name="android:layout_gravity">center</item> <item name="android:gravity">center_horizontal</item> <item name="android:singleLine">true</item> <item name="android:ellipsize">marquee</item> - <item name="android:textSize">13dip</item> + <item name="android:textSize">12dip</item> <item name="android:textColor">#FFF</item> <item name="android:shadowRadius">2.0</item> <item name="android:shadowColor">#B0000000</item> </style> - <style name="WorkspaceIcon.AllApps"> + <style name="WorkspaceIcon.AppsCustomize"> <item name="android:background">@null</item> + <item name="android:drawablePadding">0dp</item> + <item name="android:includeFontPadding">false</item> </style> <style name="WorkspaceIcon.Portrait"> - <item name="android:drawablePadding">5dip</item> - <item name="android:paddingTop">0dip</item> - <item name="android:layout_marginLeft">3dip</item> - <item name="android:layout_marginRight">3dip</item> - <item name="android:layout_marginTop">13dip</item> - <item name="android:layout_marginBottom">8dip</item> + <item name="android:drawablePadding">4dp</item> + <item name="android:paddingLeft">4dp</item> + <item name="android:paddingRight">4dp</item> + <item name="android:paddingTop">4dp</item> + <item name="android:paddingBottom">4dp</item> </style> <style name="WorkspaceIcon.Landscape"> - <item name="android:drawablePadding">3dip</item> - <item name="android:paddingTop">2dip</item> - <item name="android:layout_marginLeft">10dip</item> - <item name="android:layout_marginRight">10dip</item> + <item name="android:drawablePadding">0dp</item> + <item name="android:paddingLeft">4dp</item> + <item name="android:paddingRight">4dp</item> + <item name="android:paddingTop">2dp</item> + <item name="android:paddingBottom">4dp</item> + </style> + <style name="WorkspaceIcon.Portrait.Folder"> + <item name="android:drawablePadding">0dp</item> + <item name="android:paddingTop">0dp</item> + </style> + + <style name="WorkspaceIcon.Landscape.Folder"> + <item name="android:drawablePadding">0dp</item> + <item name="android:paddingTop">0dp</item> </style> <style name="SearchDropTargetBar"> diff --git a/src/com/android/launcher2/AppWidgetResizeFrame.java b/src/com/android/launcher2/AppWidgetResizeFrame.java index eca5ad7..22bd6e6 100644 --- a/src/com/android/launcher2/AppWidgetResizeFrame.java +++ b/src/com/android/launcher2/AppWidgetResizeFrame.java @@ -303,8 +303,8 @@ public class AppWidgetResizeFrame extends FrameLayout { public void snapToWidget(boolean animate) { final DragLayer.LayoutParams lp = (DragLayer.LayoutParams) getLayoutParams(); - int xOffset = mCellLayout.getLeft() + mCellLayout.getLeftPadding() - mWorkspace.getScrollX(); - int yOffset = mCellLayout.getTop() + mCellLayout.getTopPadding() - mWorkspace.getScrollY(); + int xOffset = mCellLayout.getLeft() + mCellLayout.getPaddingLeft() - mWorkspace.getScrollX(); + int yOffset = mCellLayout.getTop() + mCellLayout.getPaddingTop() - mWorkspace.getScrollY(); int newWidth = mWidgetView.getWidth() + 2 * mBackgroundPadding - mWidgetPaddingLeft - mWidgetPaddingRight; diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java index c1aa2d5..8182b82 100644 --- a/src/com/android/launcher2/CellLayout.java +++ b/src/com/android/launcher2/CellLayout.java @@ -54,19 +54,17 @@ import java.util.HashMap; public class CellLayout extends ViewGroup { static final String TAG = "CellLayout"; + private int mOriginalCellWidth; + private int mOriginalCellHeight; private int mCellWidth; private int mCellHeight; - private int mLeftPadding; - private int mRightPadding; - private int mTopPadding; - private int mBottomPadding; - private int mCountX; private int mCountY; private int mWidthGap; private int mHeightGap; + private int mMaxGap; private final Rect mRect = new Rect(); private final CellInfo mCellInfo = new CellInfo(); @@ -148,19 +146,13 @@ 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 = a.getDimensionPixelSize(R.styleable.CellLayout_widthGap, -1); - mHeightGap = a.getDimensionPixelSize(R.styleable.CellLayout_heightGap, -1); - - mLeftPadding = - a.getDimensionPixelSize(R.styleable.CellLayout_xAxisStartPadding, 10); - mRightPadding = - a.getDimensionPixelSize(R.styleable.CellLayout_xAxisEndPadding, 10); - mTopPadding = - a.getDimensionPixelSize(R.styleable.CellLayout_yAxisStartPadding, 10); - mBottomPadding = - a.getDimensionPixelSize(R.styleable.CellLayout_yAxisEndPadding, 10); + mOriginalCellWidth = + mCellWidth = a.getDimensionPixelSize(R.styleable.CellLayout_cellWidth, 10); + mOriginalCellHeight = + mCellHeight = a.getDimensionPixelSize(R.styleable.CellLayout_cellHeight, 10); + mWidthGap = a.getDimensionPixelSize(R.styleable.CellLayout_widthGap, 0); + mHeightGap = a.getDimensionPixelSize(R.styleable.CellLayout_heightGap, 0); + mMaxGap = a.getDimensionPixelSize(R.styleable.CellLayout_maxGap, 0); mCountX = LauncherModel.getCellCountX(); mCountY = LauncherModel.getCellCountY(); @@ -275,9 +267,10 @@ public class CellLayout extends ViewGroup { // 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 widthGap = r.getDimensionPixelSize(R.dimen.workspace_width_gap_port); + int minGap = Math.min(r.getDimensionPixelSize(R.dimen.workspace_width_gap), + r.getDimensionPixelSize(R.dimen.workspace_height_gap)); - return widthGap * (numCells - 1) + cellWidth * numCells; + return minGap * (numCells - 1) + cellWidth * numCells; } static int heightInLandscape(Resources r, int numCells) { @@ -285,9 +278,10 @@ public class CellLayout extends ViewGroup { // 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 heightGap = r.getDimensionPixelSize(R.dimen.workspace_height_gap_land); + int minGap = Math.min(r.getDimensionPixelSize(R.dimen.workspace_width_gap), + r.getDimensionPixelSize(R.dimen.workspace_height_gap)); - return heightGap * (numCells - 1) + cellHeight * numCells; + return minGap * (numCells - 1) + cellHeight * numCells; } public void enableHardwareLayers() { @@ -303,10 +297,10 @@ public class CellLayout extends ViewGroup { private void invalidateBubbleTextView(BubbleTextView icon) { final int padding = icon.getPressedOrFocusedBackgroundPadding(); - invalidate(icon.getLeft() + getLeftPadding() - padding, - icon.getTop() + getTopPadding() - padding, - icon.getRight() + getLeftPadding() + padding, - icon.getBottom() + getTopPadding() + padding); + invalidate(icon.getLeft() + getPaddingLeft() - padding, + icon.getTop() + getPaddingTop() - padding, + icon.getRight() + getPaddingLeft() + padding, + icon.getBottom() + getPaddingTop() + padding); } void setPressedOrFocusedIcon(BubbleTextView icon) { @@ -480,9 +474,9 @@ public class CellLayout extends ViewGroup { final int width = d.getIntrinsicWidth(); final int height = d.getIntrinsicHeight(); - int x = getLeftPadding() - (mWidthGap / 2) - (width / 2); + int x = getPaddingLeft() - (mWidthGap / 2) - (width / 2); for (int col = 0; col <= countX; col++) { - int y = getTopPadding() - (mHeightGap / 2) - (height / 2); + int y = getPaddingTop() - (mHeightGap / 2) - (height / 2); for (int row = 0; row <= countY; row++) { mTmpPointF.set(x - mDragCenter.x, y - mDragCenter.y); float dist = mTmpPointF.length(); @@ -518,8 +512,8 @@ public class CellLayout extends ViewGroup { final Bitmap b = mPressedOrFocusedIcon.getPressedOrFocusedBackground(); if (b != null) { canvas.drawBitmap(b, - mPressedOrFocusedIcon.getLeft() + getLeftPadding() - padding, - mPressedOrFocusedIcon.getTop() + getTopPadding() - padding, + mPressedOrFocusedIcon.getLeft() + getPaddingLeft() - padding, + mPressedOrFocusedIcon.getTop() + getPaddingTop() - padding, null); } } @@ -668,7 +662,7 @@ public class CellLayout extends ViewGroup { // to this view. final int tmpXY[] = mTmpXY; child.getLocationOnScreen(tmpXY); - frame.offset(mLeftPadding, mTopPadding); + frame.offset(mPaddingLeft, mPaddingTop); if (frame.contains(x, y)) { cellInfo.cell = child; @@ -733,8 +727,8 @@ public class CellLayout extends ViewGroup { * @param result Array of 2 ints to hold the x and y coordinate of the cell */ void pointToCellExact(int x, int y, int[] result) { - final int hStartPadding = getLeftPadding(); - final int vStartPadding = getTopPadding(); + final int hStartPadding = getPaddingLeft(); + final int vStartPadding = getPaddingTop(); result[0] = (x - hStartPadding) / (mCellWidth + mWidthGap); result[1] = (y - vStartPadding) / (mCellHeight + mHeightGap); @@ -767,8 +761,8 @@ public class CellLayout extends ViewGroup { * @param result Array of 2 ints to hold the x and y coordinate of the point */ void cellToPoint(int cellX, int cellY, int[] result) { - final int hStartPadding = getLeftPadding(); - final int vStartPadding = getTopPadding(); + final int hStartPadding = getPaddingLeft(); + final int vStartPadding = getPaddingTop(); result[0] = hStartPadding + cellX * (mCellWidth + mWidthGap); result[1] = vStartPadding + cellY * (mCellHeight + mHeightGap); @@ -783,8 +777,8 @@ public class CellLayout extends ViewGroup { * @param result Array of 2 ints to hold the x and y coordinate of the point */ void cellToCenterPoint(int cellX, int cellY, int[] result) { - final int hStartPadding = getLeftPadding(); - final int vStartPadding = getTopPadding(); + final int hStartPadding = getPaddingLeft(); + final int vStartPadding = getPaddingTop(); result[0] = hStartPadding + cellX * (mCellWidth + mWidthGap) + mCellWidth / 2; result[1] = vStartPadding + cellY * (mCellHeight + mHeightGap) + mCellHeight / 2; @@ -806,30 +800,14 @@ public class CellLayout extends ViewGroup { return mHeightGap; } - int getLeftPadding() { - return mLeftPadding; - } - - int getTopPadding() { - return mTopPadding; - } - - int getRightPadding() { - return mRightPadding; - } - - int getBottomPadding() { - return mBottomPadding; - } - Rect getContentRect(Rect r) { if (r == null) { r = new Rect(); } int left = getPaddingLeft(); int top = getPaddingTop(); - int right = left + getWidth() - mLeftPadding - mRightPadding; - int bottom = top + getHeight() - mTopPadding - mBottomPadding; + int right = left + getWidth() - mPaddingLeft - mPaddingRight; + int bottom = top + getHeight() - mPaddingTop - mPaddingBottom; r.set(left, top, right, bottom); return r; } @@ -848,31 +826,31 @@ public class CellLayout extends ViewGroup { throw new RuntimeException("CellLayout cannot have UNSPECIFIED dimensions"); } - final int cellWidth = mCellWidth; - final int cellHeight = mCellHeight; - int numWidthGaps = mCountX - 1; int numHeightGaps = mCountY - 1; if (mWidthGap < 0 || mHeightGap < 0) { - int vSpaceLeft = heightSpecSize - mTopPadding - mBottomPadding - (cellHeight * mCountY); - mHeightGap = numHeightGaps > 0 ? vSpaceLeft / numHeightGaps : 0; - - int hSpaceLeft = widthSpecSize - mLeftPadding - mRightPadding - (cellWidth * mCountX); - mWidthGap = numWidthGaps > 0 ? hSpaceLeft / numWidthGaps : 0; + int hSpace = widthSpecSize - mPaddingLeft - mPaddingRight; + int vSpace = heightSpecSize - mPaddingTop - mPaddingBottom; + int hFreeSpace = hSpace - (mCountX * mOriginalCellWidth); + int vFreeSpace = vSpace - (mCountY * mOriginalCellHeight); + mWidthGap = Math.min(mMaxGap, numWidthGaps > 0 ? (hFreeSpace / numWidthGaps) : 0); + mHeightGap = Math.min(mMaxGap,numHeightGaps > 0 ? (vFreeSpace / numHeightGaps) : 0); + int remainingHSpace = hFreeSpace - (numWidthGaps * mWidthGap); + int remainingVSpace = vFreeSpace - (numHeightGaps * mHeightGap); + mCellWidth = mOriginalCellWidth + remainingHSpace / mCountX; + mCellHeight = mOriginalCellHeight + remainingVSpace / mCountY; - // center it around the min gaps - int minGap = Math.min(mWidthGap, mHeightGap); - mWidthGap = mHeightGap = minGap; + mChildren.setCellDimensions(mCellWidth, mCellHeight, mWidthGap, mHeightGap); } // Initial values correspond to widthSpecMode == MeasureSpec.EXACTLY int newWidth = widthSpecSize; int newHeight = heightSpecSize; if (widthSpecMode == MeasureSpec.AT_MOST) { - newWidth = mLeftPadding + mRightPadding + (mCountX * cellWidth) + + newWidth = mPaddingLeft + mPaddingRight + (mCountX * mCellWidth) + ((mCountX - 1) * mWidthGap); - newHeight = mTopPadding + mBottomPadding + (mCountY * cellHeight) + + newHeight = mPaddingTop + mPaddingBottom + (mCountY * mCellHeight) + ((mCountY - 1) * mHeightGap); setMeasuredDimension(newWidth, newHeight); } @@ -880,10 +858,10 @@ public class CellLayout extends ViewGroup { int count = getChildCount(); for (int i = 0; i < count; i++) { View child = getChildAt(i); - int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(newWidth - mLeftPadding - - mRightPadding, MeasureSpec.EXACTLY); - int childheightMeasureSpec = MeasureSpec.makeMeasureSpec(newHeight - mTopPadding - - mBottomPadding, MeasureSpec.EXACTLY); + int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(newWidth - mPaddingLeft - + mPaddingRight, MeasureSpec.EXACTLY); + int childheightMeasureSpec = MeasureSpec.makeMeasureSpec(newHeight - mPaddingTop - + mPaddingBottom, MeasureSpec.EXACTLY); child.measure(childWidthMeasureSpec, childheightMeasureSpec); } setMeasuredDimension(newWidth, newHeight); @@ -894,7 +872,8 @@ public class CellLayout extends ViewGroup { int count = getChildCount(); for (int i = 0; i < count; i++) { View child = getChildAt(i); - child.layout(mLeftPadding, mTopPadding, r - l - mRightPadding , b - t - mBottomPadding); + child.layout(mPaddingLeft, mPaddingTop, + r - l - mPaddingRight, b - t - mPaddingBottom); } } @@ -1460,8 +1439,8 @@ public class CellLayout extends ViewGroup { final int widthGap = mWidthGap; final int heightGap = mHeightGap; - final int hStartPadding = getLeftPadding(); - final int vStartPadding = getTopPadding(); + final int hStartPadding = getPaddingLeft(); + final int vStartPadding = getPaddingTop(); int width = cellHSpan * cellWidth + ((cellHSpan - 1) * widthGap); int height = cellVSpan * cellHeight + ((cellVSpan - 1) * heightGap); @@ -1656,12 +1635,12 @@ out: for (int i = x; i < x + spanX - 1 && x < xCount; i++) { } public int getDesiredWidth() { - return mLeftPadding + mRightPadding + (mCountX * mCellWidth) + + return mPaddingLeft + mPaddingRight + (mCountX * mCellWidth) + (Math.max((mCountX - 1), 0) * mWidthGap); } public int getDesiredHeight() { - return mTopPadding + mBottomPadding + (mCountY * mCellHeight) + + return mPaddingTop + mPaddingBottom + (mCountY * mCellHeight) + (Math.max((mCountY - 1), 0) * mHeightGap); } diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 5d85957..2dfce62 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -2109,10 +2109,10 @@ public final class Launcher extends Activity int width = cell.getWidth(); int height = cell.getHeight(); - int x = cell.getLeftPadding(); - int y = cell.getTopPadding(); - width -= (x + cell.getRightPadding()); - height -= (y + cell.getBottomPadding()); + int x = cell.getPaddingLeft(); + int y = cell.getPaddingTop(); + width -= (x + cell.getPaddingRight()); + height -= (y + cell.getPaddingBottom()); float scale = w / width; @@ -2135,7 +2135,7 @@ public final class Launcher extends Activity final Canvas c = new Canvas(bitmap); c.scale(scale, scale); - c.translate(-cell.getLeftPadding(), -cell.getTopPadding()); + c.translate(-cell.getPaddingLeft(), -cell.getPaddingTop()); cell.drawChildren(c); image.setBackgroundDrawable(resources.getDrawable(R.drawable.preview_background)); diff --git a/src/com/android/launcher2/Utilities.java b/src/com/android/launcher2/Utilities.java index 04abd77..7758333 100644 --- a/src/com/android/launcher2/Utilities.java +++ b/src/com/android/launcher2/Utilities.java @@ -114,7 +114,7 @@ final class Utilities { width = (int) (height * ratio); } } else if (sourceWidth < width && sourceHeight < height) { - // It's small, use the size they gave us. + // Don't scale up the icon width = sourceWidth; height = sourceHeight; } @@ -224,7 +224,7 @@ final class Utilities { if (LauncherApplication.isScreenLarge()) { sIconContentSize = (int) resources.getDimension(R.dimen.app_icon_content_size); } - sIconTextureWidth = sIconTextureHeight = sIconWidth + 2; + sIconTextureWidth = sIconTextureHeight = sIconWidth; sBlurPaint.setMaskFilter(new BlurMaskFilter(5 * density, BlurMaskFilter.Blur.NORMAL)); sGlowColorPressedPaint.setColor(0xffffc300); diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 7818ef4..005bd27 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -2238,8 +2238,8 @@ public class Workspace extends SmoothPagedView // Set its old pos (in the new parent's coordinates); it will be animated // in animateViewIntoPosition after the next layout pass - lp.oldX = viewX - (layout.getLeft() + layout.getLeftPadding() - mScrollX); - lp.oldY = viewY - (layout.getTop() + layout.getTopPadding() - mScrollY); + lp.oldX = viewX - (layout.getLeft() + layout.getPaddingLeft() - mScrollX); + lp.oldY = viewY - (layout.getTop() + layout.getPaddingTop() - mScrollY); } public void animateViewIntoPosition(final View view, final int fromX, final int fromY, @@ -2301,8 +2301,8 @@ public class Workspace extends SmoothPagedView final CellLayout.LayoutParams lp = (CellLayout.LayoutParams) view.getLayoutParams(); // Convert the animation params to be relative to the Workspace, not the CellLayout - final int fromX = lp.oldX + parent.getLeft() + parent.getLeftPadding(); - final int fromY = lp.oldY + parent.getTop() + parent.getTopPadding(); + final int fromX = lp.oldX + parent.getLeft() + parent.getPaddingLeft(); + final int fromY = lp.oldY + parent.getTop() + parent.getPaddingTop(); final int dx = lp.x - lp.oldX; final int dy = lp.y - lp.oldY; |