merge in ics-release history after reset to master
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index d9404a7..feba679 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -85,10 +85,9 @@
<activity
android:name="com.android.launcher2.WallpaperChooser"
- style="@style/config_orientation"
+ style="@style/Theme.WallpaperPicker"
android:label="@string/pick_wallpaper"
android:icon="@drawable/ic_launcher_wallpaper"
- android:theme="@style/Theme.WallpaperPicker"
android:finishOnCloseSystemDialogs="true">
<intent-filter>
<action android:name="android.intent.action.SET_WALLPAPER" />
diff --git a/res/drawable/wallpaper_gallery_background.xml b/res/drawable/wallpaper_gallery_background.xml
new file mode 100644
index 0000000..271c1df
--- /dev/null
+++ b/res/drawable/wallpaper_gallery_background.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <gradient android:startColor="#0000" android:endColor="#D0000000"
+ android:angle="270"/>
+</shape>
\ No newline at end of file
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/wallpaper_chooser.xml b/res/layout-large/wallpaper_chooser.xml
deleted file mode 100644
index b48dbd9..0000000
--- a/res/layout-large/wallpaper_chooser.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2010, 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.
-*/
--->
-
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/wallpaper_list"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:paddingLeft="24dp"
- android:paddingRight="24dp"
- android:paddingTop="24dp"
- android:paddingBottom="24dp"
- android:gravity="center">
- <GridView
- android:id="@+id/gallery"
- android:layout_width="636dp"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:numColumns="3"
- android:stretchMode="none"
- android:columnWidth="@dimen/live_wallpaper_column_width"
- android:verticalSpacing="0dp"
- android:horizontalSpacing="0dp"
- android:drawSelectorOnTop="false" />
- <TextView
- android:id="@android:id/empty"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
-
- android:gravity="center"
- android:visibility="gone"
-
- android:text="@string/wallpaper_chooser_empty"
- android:textAppearance="?android:attr/textAppearanceMedium" />
-</FrameLayout>
\ No newline at end of file
diff --git a/res/layout-large/wallpaper_chooser_base.xml b/res/layout-large/wallpaper_chooser_base.xml
deleted file mode 100644
index ba5ac53..0000000
--- a/res/layout-large/wallpaper_chooser_base.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2010, 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.
-*/
--->
-
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
diff --git a/res/layout-large-land/workspace_screen.xml b/res/layout-large/workspace_screen.xml
similarity index 72%
rename from res/layout-large-land/workspace_screen.xml
rename to 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/wallpaper_chooser.xml b/res/layout/wallpaper_chooser.xml
index 92a6596..c0a5fdf 100644
--- a/res/layout/wallpaper_chooser.xml
+++ b/res/layout/wallpaper_chooser.xml
@@ -18,26 +18,26 @@
*/
-->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
- <ImageView android:id="@+id/wallpaper"
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1.0"
- android:scaleType="fitCenter" />
+ <LinearLayout
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ android:background="@drawable/wallpaper_gallery_background">
- <Gallery android:id="@+id/gallery"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
- <Button android:id="@+id/set"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/wallpaper_instructions"
- android:layout_gravity="center_horizontal" />
-
-</LinearLayout>
+ <Gallery android:id="@+id/gallery"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ <Button android:id="@+id/set"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/wallpaper_instructions"
+ android:layout_gravity="center_horizontal" />
+ </LinearLayout>
+</RelativeLayout>
diff --git a/res/layout-land/workspace_screen.xml b/res/layout/workspace_screen.xml
similarity index 75%
rename from res/layout-land/workspace_screen.xml
rename to 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 7e19e89..386e9ca 100644
--- a/res/values-large/styles.xml
+++ b/res/values-large/styles.xml
@@ -18,7 +18,40 @@
-->
<resources>
- <style name="Theme.WallpaperPicker" parent="@*android:Theme.Holo.Dialog.NoFrame">
+<!-- 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">
@@ -30,16 +63,8 @@
<item name="android:windowShowWallpaper">true</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 name="Theme.WallpaperPicker">
+ <item name="android:screenOrientation">unspecified</item>
</style>
<style name="TabIndicator.Wide">
@@ -83,8 +108,4 @@
<item name="android:textColor">#FFFFFFFF</item>
<item name="android:textSize">16sp</item>
</style>
-
- <style name="config_orientation">
- <item name="@android:screenOrientation">unspecified</item>
- </style>
</resources>
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 3c0ae8d..4e498a6 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -18,8 +18,8 @@
-->
<resources>
- <style name="Theme.WallpaperPicker" parent="android:Theme">
- <item name="android:windowNoTitle">true</item>
+ <style name="Theme.WallpaperPicker">
+ <item name="android:screenOrientation">nosensor</item>
</style>
<style name="Theme.Base" parent="android:Theme.Wallpaper">
@@ -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">
@@ -155,8 +165,4 @@
<item name="android:layout_marginRight">4dip</item>
<item name="android:background">@drawable/hotseat_bg_right</item>
</style>
-
- <style name="config_orientation">
- <item name="@android:screenOrientation">nosensor</item>
- </style>
</resources>
diff --git a/res/xml/default_workspace.xml b/res/xml/default_workspace.xml
index 0d4212c..722731c 100644
--- a/res/xml/default_workspace.xml
+++ b/res/xml/default_workspace.xml
@@ -18,14 +18,6 @@
<!-- Far-left screen [0] -->
<!-- Left screen [1] -->
- <appwidget
- launcher:packageName="com.google.android.apps.genie.geniewidget"
- launcher:className="com.google.android.apps.genie.geniewidget.miniwidget.MiniWidgetProvider"
- launcher:screen="1"
- launcher:x="0"
- launcher:y="0"
- launcher:spanX="4"
- launcher:spanY="1" />
<!-- Middle screen [2] -->
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 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 @@
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 @@
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 @@
// 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 @@
// 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 @@
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 @@
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 @@
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 @@
// 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 @@
* @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 @@
* @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 @@
* @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 @@
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 @@
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 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;
- int hSpaceLeft = widthSpecSize - mLeftPadding - mRightPadding - (cellWidth * mCountX);
- mWidthGap = numWidthGaps > 0 ? hSpaceLeft / numWidthGaps : 0;
-
- // 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 @@
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 @@
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 @@
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 @@
}
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/DragLayer.java b/src/com/android/launcher2/DragLayer.java
index c4d75d6..101ed5d 100644
--- a/src/com/android/launcher2/DragLayer.java
+++ b/src/com/android/launcher2/DragLayer.java
@@ -16,8 +16,6 @@
package com.android.launcher2;
-import java.util.ArrayList;
-
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Rect;
@@ -29,7 +27,7 @@
import android.widget.FrameLayout;
import android.widget.ImageView;
-import com.android.launcher.R;
+import java.util.ArrayList;
/**
* A ViewGroup that coordinates dragging across its descendants
@@ -43,7 +41,6 @@
new ArrayList<AppWidgetResizeFrame>();
private AppWidgetResizeFrame mCurrentResizeFrame;
private int mXDown, mYDown;
- private Folder mCurrentFolder = null;
private Launcher mLauncher;
/**
@@ -87,16 +84,17 @@
}
}
- if (mCurrentFolder != null && intercept) {
- if (mCurrentFolder.isEditingName()) {
- getDescendantRectRelativeToSelf(mCurrentFolder.getEditTextRegion(), hitRect);
+ Folder currentFolder = mLauncher.getWorkspace().getOpenFolder();
+ if (currentFolder != null && intercept) {
+ if (currentFolder.isEditingName()) {
+ getDescendantRectRelativeToSelf(currentFolder.getEditTextRegion(), hitRect);
if (!hitRect.contains(x, y)) {
- mCurrentFolder.dismissEditingName();
+ currentFolder.dismissEditingName();
return true;
}
}
- getDescendantRectRelativeToSelf(mCurrentFolder, hitRect);
+ getDescendantRectRelativeToSelf(currentFolder, hitRect);
if (!hitRect.contains(x, y)) {
mLauncher.closeFolder();
return true;
@@ -269,8 +267,4 @@
resizeFrame.snapToWidget(false);
}
-
- public void setCurrentFolder(Folder f) {
- mCurrentFolder = f;
- }
}
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java
index 90d2090..029b89f 100644
--- a/src/com/android/launcher2/Folder.java
+++ b/src/com/android/launcher2/Folder.java
@@ -615,7 +615,7 @@
OnAlarmListener mOnExitAlarmListener = new OnAlarmListener() {
public void onAlarm(Alarm alarm) {
- mLauncher.closeFolder(Folder.this);
+ mLauncher.closeFolder();
mCurrentDragInfo = null;
mCurrentDragView = null;
mSuppressOnAdd = false;
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 323c527..2dfce62 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -1749,7 +1749,6 @@
Folder folder = mWorkspace.getOpenFolder();
if (folder != null) {
closeFolder(folder);
- mDragLayer.setCurrentFolder(null);
}
}
@@ -1763,7 +1762,6 @@
shrinkAndFadeInFolderIcon(fi);
mDragController.removeDropTarget((DropTarget)folder);
}
-
folder.animateClosed();
}
@@ -1993,7 +1991,6 @@
info.opened = true;
mWorkspace.addInFullScreen(folder, info.screen);
- mDragLayer.setCurrentFolder(folder);
folder.animateOpen();
folder.onOpen();
}
@@ -2112,10 +2109,10 @@
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;
@@ -2138,7 +2135,7 @@
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 @@
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 @@
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/WallpaperChooser.java b/src/com/android/launcher2/WallpaperChooser.java
index 2311d1e..8a9d92f 100644
--- a/src/com/android/launcher2/WallpaperChooser.java
+++ b/src/com/android/launcher2/WallpaperChooser.java
@@ -33,6 +33,8 @@
Fragment fragmentView =
getFragmentManager().findFragmentById(R.id.wallpaper_chooser_fragment);
+ // TODO: The following code is currently not exercised. Leaving it here in case it
+ // needs to be revived again.
if (fragmentView == null) {
/* When the screen is XLarge, the fragment is not included in the layout, so show it
* as a dialog
diff --git a/src/com/android/launcher2/WallpaperChooserDialogFragment.java b/src/com/android/launcher2/WallpaperChooserDialogFragment.java
index 4f13332..c9e21f2 100644
--- a/src/com/android/launcher2/WallpaperChooserDialogFragment.java
+++ b/src/com/android/launcher2/WallpaperChooserDialogFragment.java
@@ -15,8 +15,6 @@
*/
package com.android.launcher2;
-import com.android.launcher.R;
-
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
@@ -27,14 +25,17 @@
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
+import android.graphics.Canvas;
+import android.graphics.ColorFilter;
+import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
-import android.view.View.OnClickListener;
import android.view.ViewGroup;
+import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.FrameLayout;
@@ -44,6 +45,8 @@
import android.widget.ListAdapter;
import android.widget.SpinnerAdapter;
+import com.android.launcher.R;
+
import java.io.IOException;
import java.util.ArrayList;
@@ -55,12 +58,12 @@
+ "WallpaperChooserDialogFragment.EMBEDDED_KEY";
private boolean mEmbedded;
- private ImageView mImageView = null;
private Bitmap mBitmap = null;
private ArrayList<Integer> mThumbs;
private ArrayList<Integer> mImages;
private WallpaperLoader mLoader;
+ private WallpaperDrawable mWallpaperDrawable = new WallpaperDrawable();
public static WallpaperChooserDialogFragment newInstance() {
WallpaperChooserDialogFragment fragment = new WallpaperChooserDialogFragment();
@@ -113,6 +116,9 @@
public Dialog onCreateDialog(Bundle savedInstanceState) {
findWallpapers();
+ // TODO: The following code is not exercised right now and may be removed
+ // if the dialog version is not needed.
+ /*
final View v = getActivity().getLayoutInflater().inflate(
R.layout.wallpaper_chooser, null, false);
@@ -122,13 +128,15 @@
final int viewInset =
getResources().getDimensionPixelSize(R.dimen.alert_dialog_content_inset);
-
+
FrameLayout wallPaperList = (FrameLayout) v.findViewById(R.id.wallpaper_list);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setNegativeButton(R.string.wallpaper_cancel, null);
builder.setTitle(R.string.wallpaper_dialog_title);
- builder.setView(wallPaperList, viewInset, viewInset, viewInset, viewInset);
- return builder.create();
+ builder.setView(wallPaperList,
+ viewInset, viewInset, viewInset, viewInset); return builder.create();
+ */
+ return null;
}
@Override
@@ -142,6 +150,7 @@
*/
if (mEmbedded) {
View view = inflater.inflate(R.layout.wallpaper_chooser, container, false);
+ view.setBackgroundDrawable(mWallpaperDrawable);
final Gallery gallery = (Gallery) view.findViewById(R.id.gallery);
gallery.setCallbackDuringFling(false);
@@ -155,7 +164,6 @@
selectWallpaper(gallery.getSelectedItemPosition());
}
});
- mImageView = (ImageView) view.findViewById(R.id.wallpaper);
return view;
}
return null;
@@ -299,20 +307,9 @@
mBitmap.recycle();
}
- // This should always be the case, but check anyways
- final ImageView view = mImageView;
- if (view != null) {
- view.setImageBitmap(b);
-
- mBitmap = b;
-
- final Drawable drawable = view.getDrawable();
- drawable.setFilterBitmap(true);
- drawable.setDither(true);
-
- view.postInvalidate();
- }
-
+ mBitmap = b;
+ mWallpaperDrawable.setBitmap(b);
+ getView().postInvalidate();
mLoader = null;
} else {
b.recycle();
@@ -324,4 +321,47 @@
super.cancel(true);
}
}
+
+ /**
+ * Custom drawable that centers the bitmap fed to it.
+ */
+ static class WallpaperDrawable extends Drawable {
+
+ Bitmap mBitmap;
+ int mIntrinsicWidth;
+ int mIntrinsicHeight;
+
+ /* package */void setBitmap(Bitmap bitmap) {
+ mBitmap = bitmap;
+ if (mBitmap == null)
+ return;
+ mIntrinsicWidth = mBitmap.getWidth();
+ mIntrinsicHeight = mBitmap.getHeight();
+ }
+
+ @Override
+ public void draw(Canvas canvas) {
+ if (mBitmap == null) return;
+ int width = canvas.getWidth();
+ int height = canvas.getHeight();
+ int x = (width - mIntrinsicWidth) / 2;
+ int y = (height - mIntrinsicHeight) / 2;
+ canvas.drawBitmap(mBitmap, x, y, null);
+ }
+
+ @Override
+ public int getOpacity() {
+ return android.graphics.PixelFormat.OPAQUE;
+ }
+
+ @Override
+ public void setAlpha(int alpha) {
+ // Ignore
+ }
+
+ @Override
+ public void setColorFilter(ColorFilter cf) {
+ // Ignore
+ }
+ }
}
\ No newline at end of file
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 @@
// 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 @@
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;