diff options
31 files changed, 376 insertions, 103 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index c72d1063e..47278bb83 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -24,6 +24,10 @@ <original-package android:name="com.android.launcher2" /> <permission + android:name="com.android.launcher.permission.PRELOAD_WORKSPACE" + android:permissionGroup="android.permission-group.SYSTEM_TOOLS" + android:protectionLevel="system|signature" /> + <permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" android:permissionGroup="android.permission-group.SYSTEM_TOOLS" android:protectionLevel="normal" @@ -103,6 +107,15 @@ </intent-filter> </activity> + <!-- Intent received used to prepopulate the default workspace. --> + <receiver + android:name="com.android.launcher2.PreloadReceiver" + android:permission="com.android.launcher.permission.PRELOAD_WORKSPACE"> + <intent-filter> + <action android:name="com.android.launcher.action.PRELOAD_WORKSPACE" /> + </intent-filter> + </receiver> + <!-- Intent received used to install shortcuts from other applications --> <receiver android:name="com.android.launcher2.InstallShortcutReceiver" diff --git a/res/drawable-hdpi/search_frame.9.png b/res/drawable-hdpi/search_frame.9.png Binary files differindex d0c78c461..7fbf24ff6 100644 --- a/res/drawable-hdpi/search_frame.9.png +++ b/res/drawable-hdpi/search_frame.9.png diff --git a/res/drawable-mdpi/search_frame.9.png b/res/drawable-mdpi/search_frame.9.png Binary files differindex 7a0e46c7f..e6e048a52 100644 --- a/res/drawable-mdpi/search_frame.9.png +++ b/res/drawable-mdpi/search_frame.9.png diff --git a/res/drawable-xhdpi/search_frame.9.png b/res/drawable-xhdpi/search_frame.9.png Binary files differindex cb6f2947f..706b1d8ee 100644 --- a/res/drawable-xhdpi/search_frame.9.png +++ b/res/drawable-xhdpi/search_frame.9.png diff --git a/res/layout-land/drop_target_bar.xml b/res/layout-land/drop_target_bar.xml new file mode 100644 index 000000000..55d94218e --- /dev/null +++ b/res/layout-land/drop_target_bar.xml @@ -0,0 +1,37 @@ +<?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. +--> +<merge xmlns:android="http://schemas.android.com/apk/res/android"> + <FrameLayout + xmlns:android="http://schemas.android.com/apk/res/android" + style="@style/DropTargetButtonContainer" + android:layout_weight="1"> + <!-- Delete target --> + <com.android.launcher2.DeleteDropTarget + style="@style/DropTargetButton" + android:id="@+id/delete_target_text" + android:drawableTop="@drawable/info_target_selector" /> + </FrameLayout> + <FrameLayout + xmlns:android="http://schemas.android.com/apk/res/android" + style="@style/DropTargetButtonContainer" + android:layout_weight="1"> + <!-- Info target --> + <com.android.launcher2.InfoDropTarget + style="@style/DropTargetButton" + android:id="@+id/info_target_text" + android:drawableTop="@drawable/info_target_selector" /> + </FrameLayout> +</merge>
\ No newline at end of file diff --git a/res/layout-land/workspace_cling.xml b/res/layout-land/workspace_cling.xml index dca393727..b66f1bd8a 100644 --- a/res/layout-land/workspace_cling.xml +++ b/res/layout-land/workspace_cling.xml @@ -28,11 +28,9 @@ android:orientation="vertical"> <TextView style="@style/ClingTitleText" - android:id="@+id/workspace_cling_title" android:text="@string/workspace_cling_title" /> <TextView style="@style/ClingText" - android:id="@+id/workspace_cling_move_item" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/workspace_cling_move_item" /> @@ -40,7 +38,6 @@ </FrameLayout> <TextView style="@style/ClingText" - android:id="@+id/workspace_cling_open_all_apps" android:layout_width="180dp" android:layout_height="wrap_content" android:layout_marginRight="130dp" @@ -49,9 +46,8 @@ android:text="@string/workspace_cling_open_all_apps" /> <Button style="@style/ClingButton" - android:id="@+id/cling_dismiss" android:layout_marginBottom="15dp" android:layout_marginRight="10dp" android:layout_gravity="bottom|right" android:onClick="dismissWorkspaceCling" /> -</com.android.launcher2.Cling>
\ No newline at end of file +</com.android.launcher2.Cling> diff --git a/res/layout-port/drop_target_bar.xml b/res/layout-port/drop_target_bar.xml new file mode 100644 index 000000000..5fcddc9a0 --- /dev/null +++ b/res/layout-port/drop_target_bar.xml @@ -0,0 +1,39 @@ +<?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. +--> +<merge xmlns:android="http://schemas.android.com/apk/res/android"> + <FrameLayout + xmlns:android="http://schemas.android.com/apk/res/android" + style="@style/DropTargetButtonContainer" + android:layout_weight="1"> + <!-- Delete target --> + <com.android.launcher2.DeleteDropTarget + style="@style/DropTargetButton" + android:id="@+id/delete_target_text" + android:text="@string/delete_zone_label_workspace" + android:drawableLeft="@drawable/remove_target_selector" /> + </FrameLayout> + <FrameLayout + xmlns:android="http://schemas.android.com/apk/res/android" + style="@style/DropTargetButtonContainer" + android:layout_weight="1"> + <!-- Info target --> + <com.android.launcher2.InfoDropTarget + style="@style/DropTargetButton" + android:id="@+id/info_target_text" + android:text="@string/info_target_label" + android:drawableLeft="@drawable/info_target_selector" /> + </FrameLayout> +</merge>
\ No newline at end of file diff --git a/res/layout-port/workspace_cling.xml b/res/layout-port/workspace_cling.xml index 6b05c2705..10e697620 100644 --- a/res/layout-port/workspace_cling.xml +++ b/res/layout-port/workspace_cling.xml @@ -29,11 +29,9 @@ android:orientation="vertical"> <TextView style="@style/ClingTitleText" - android:id="@+id/workspace_cling_title" android:text="@string/workspace_cling_title" /> <TextView style="@style/ClingText" - android:id="@+id/workspace_cling_move_item" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/workspace_cling_move_item" /> @@ -41,7 +39,6 @@ </FrameLayout> <TextView style="@style/ClingText" - android:id="@+id/workspace_cling_open_all_apps" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="20dp" @@ -52,9 +49,8 @@ android:text="@string/workspace_cling_open_all_apps" /> <Button style="@style/ClingButton" - android:id="@+id/cling_dismiss" android:layout_marginBottom="15dp" android:layout_marginRight="10dp" android:layout_gravity="bottom|right" android:onClick="dismissWorkspaceCling" /> -</com.android.launcher2.Cling>
\ No newline at end of file +</com.android.launcher2.Cling> diff --git a/res/layout-sw720dp-port/workspace_cling.xml b/res/layout-sw720dp-port/workspace_cling.xml index 2eae0fc93..29bea810d 100644 --- a/res/layout-sw720dp-port/workspace_cling.xml +++ b/res/layout-sw720dp-port/workspace_cling.xml @@ -28,24 +28,20 @@ android:orientation="vertical"> <TextView style="@style/ClingTitleText" - android:id="@+id/workspace_cling_title" android:text="@string/workspace_cling_title" /> <TextView style="@style/ClingText" - android:id="@+id/workspace_cling_move_item" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/workspace_cling_move_item" /> <Button style="@style/ClingButton" - android:id="@+id/cling_dismiss" android:layout_marginTop="15dp" android:onClick="dismissWorkspaceCling" /> </LinearLayout> </FrameLayout> <TextView style="@style/ClingText" - android:id="@+id/workspace_cling_open_all_apps" android:layout_width="180dp" android:layout_height="wrap_content" android:layout_marginTop="15dp" @@ -53,4 +49,4 @@ android:layout_gravity="right" android:gravity="right" android:text="@string/workspace_cling_open_all_apps" /> -</com.android.launcher2.Cling>
\ No newline at end of file +</com.android.launcher2.Cling> diff --git a/res/layout-sw720dp/workspace_cling.xml b/res/layout-sw720dp/workspace_cling.xml index 264b1e000..fd7d4f8b5 100644 --- a/res/layout-sw720dp/workspace_cling.xml +++ b/res/layout-sw720dp/workspace_cling.xml @@ -28,24 +28,20 @@ android:orientation="vertical"> <TextView style="@style/ClingTitleText" - android:id="@+id/workspace_cling_title" android:text="@string/workspace_cling_title" /> <TextView style="@style/ClingText" - android:id="@+id/workspace_cling_move_item" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/workspace_cling_move_item" /> <Button style="@style/ClingButton" - android:id="@+id/cling_dismiss" android:layout_marginTop="15dp" android:onClick="dismissWorkspaceCling" /> </LinearLayout> </FrameLayout> <TextView style="@style/ClingText" - android:id="@+id/workspace_cling_open_all_apps" android:layout_width="180dp" android:layout_height="wrap_content" android:layout_marginTop="90dp" @@ -53,4 +49,4 @@ android:layout_gravity="right" android:gravity="right" android:text="@string/workspace_cling_open_all_apps" /> -</com.android.launcher2.Cling>
\ No newline at end of file +</com.android.launcher2.Cling> diff --git a/res/layout/qsb_bar.xml b/res/layout/qsb_bar.xml index ad9027f9d..322dc006f 100644 --- a/res/layout/qsb_bar.xml +++ b/res/layout/qsb_bar.xml @@ -25,29 +25,9 @@ <!-- Drag specific targets container --> <LinearLayout style="@style/SearchDropTargetBar" - android:id="@+id/drag_target_bar" - android:visibility="gone"> + android:id="@+id/drag_target_bar"> - <FrameLayout - style="@style/DropTargetButtonContainer" - android:layout_weight="1"> - <!-- Delete target --> - <com.android.launcher2.DeleteDropTarget - style="@style/DropTargetButton" - android:id="@+id/delete_target_text" - android:text="@string/delete_zone_label_workspace" - android:drawableLeft="@drawable/remove_target_selector" /> - </FrameLayout> - - <FrameLayout - style="@style/DropTargetButtonContainer" - android:layout_weight="1"> - <!-- Info target --> - <com.android.launcher2.InfoDropTarget - style="@style/DropTargetButton" - android:id="@+id/info_target_text" - android:text="@string/info_target_label" - android:drawableLeft="@drawable/info_target_selector" /> - </FrameLayout> + <include + layout="@layout/drop_target_bar" /> </LinearLayout> </com.android.launcher2.SearchDropTargetBar> diff --git a/res/values-land/styles.xml b/res/values-land/styles.xml index f4519ab34..df3356ee2 100644 --- a/res/values-land/styles.xml +++ b/res/values-land/styles.xml @@ -47,10 +47,10 @@ <item name="android:layout_height">0dp</item> </style> <style name="DropTargetButton"> - <item name="android:layout_width">match_parent</item> + <item name="android:layout_width">wrap_content</item> <item name="android:layout_height">wrap_content</item> - <item name="android:layout_gravity">center_vertical</item> - <item name="android:gravity">center_horizontal</item> + <item name="android:layout_gravity">center</item> + <item name="android:gravity">center</item> <item name="android:paddingTop">@dimen/toolbar_button_vertical_padding</item> <item name="android:paddingBottom">@dimen/toolbar_button_vertical_padding</item> <item name="android:paddingLeft">@dimen/toolbar_button_horizontal_padding</item> diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml index 41af3385e..64972ba32 100644 --- a/res/values-pl/strings.xml +++ b/res/values-pl/strings.xml @@ -96,7 +96,7 @@ <string name="workspace_cling_move_item" msgid="791013895761065070">"Dodaj tu swoje ulubione aplikacje."</string> <string name="workspace_cling_open_all_apps" msgid="2459977609848572588">"Aby zobaczyć wszystkie aplikacje, dotknij okręgu."</string> <string name="all_apps_cling_title" msgid="2559734712581447107">"Wybierz kilka aplikacji"</string> - <string name="all_apps_cling_add_item" msgid="5665035103260318891">"Aby dodać aplikację na ekran główny, dotknij jej i przytrzymaj."</string> + <string name="all_apps_cling_add_item" msgid="5665035103260318891">"By dodać aplikację na ekran główny, dotknij i przytrzymaj jej ikonę."</string> <string name="folder_cling_title" msgid="4308949882377840953">"Uporządkuj swoje aplikacje za pomocą folderów"</string> <string name="folder_cling_move_item" msgid="270598675060435169">"Dotknij i przytrzymaj, aby przenieść aplikację."</string> <string name="folder_cling_create_folder" msgid="8352867485656129478">"Aby utworzyć nowy folder na ekranie głównym, ułóż aplikacje jedna na drugiej."</string> diff --git a/res/values-sw600dp-port/dimens.xml b/res/values-sw600dp-port/dimens.xml index 1a254092b..8ad6d2e98 100644 --- a/res/values-sw600dp-port/dimens.xml +++ b/res/values-sw600dp-port/dimens.xml @@ -17,9 +17,9 @@ <resources> <!-- AppsCustomize --> <dimen name="apps_customize_cell_width">96dp</dimen> - <dimen name="apps_customize_cell_height">96dp</dimen> + <dimen name="apps_customize_cell_height">108dp</dimen> <dimen name="apps_customize_pageLayoutWidthGap">24dp</dimen> - <dimen name="apps_customize_pageLayoutHeightGap">36dp</dimen> + <dimen name="apps_customize_pageLayoutHeightGap">24dp</dimen> <dimen name="apps_customize_pageLayoutPaddingTop">25dp</dimen> <dimen name="apps_customize_pageLayoutPaddingBottom">10dp</dimen> diff --git a/res/values-sw600dp/config.xml b/res/values-sw600dp/config.xml index 00b2e15fc..a701e69d1 100644 --- a/res/values-sw600dp/config.xml +++ b/res/values-sw600dp/config.xml @@ -1,6 +1,4 @@ <resources> - <bool name="allow_rotation">true</bool> - <integer name="cell_count_x">6</integer> <integer name="cell_count_y">6</integer> <integer name="hotseat_cell_count">7</integer> diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml index 1ab495f75..99e890966 100644 --- a/res/values-sw600dp/dimens.xml +++ b/res/values-sw600dp/dimens.xml @@ -16,6 +16,7 @@ <resources> <dimen name="app_icon_size">64dp</dimen> + <dimen name="reveal_radius">64dp</dimen> <dimen name="app_icon_drawable_padding">3dp</dimen> <dimen name="app_icon_padding_top">4dp</dimen> @@ -23,8 +24,9 @@ that we put on each page for allowing folders to draw out of bounds --> <dimen name="qsb_bar_height_inset">34dp</dimen> <dimen name="qsb_bar_height">48dp</dimen> - <dimen name="qsb_padding_left">12dp</dimen> - <dimen name="qsb_padding_right">12dp</dimen> + <dimen name="qsb_padding_left">16dp</dimen> + <dimen name="qsb_padding_right">16dp</dimen> + <dimen name="search_bar_height">48dp</dimen> <!-- Hotseat --> @@ -35,8 +37,8 @@ <dimen name="button_bar_height">94dip</dimen> <dimen name="button_bar_height_bottom_padding">14dp</dimen> <dimen name="button_bar_height_top_padding">20dp</dimen> - <dimen name="button_bar_width_left_padding">33dp</dimen> - <dimen name="button_bar_width_right_padding">33dp</dimen> + <dimen name="button_bar_width_left_padding">25dp</dimen> + <dimen name="button_bar_width_right_padding">25dp</dimen> <dimen name="button_bar_height_plus_padding">104dp</dimen> <!-- Folders --> @@ -45,9 +47,14 @@ <dimen name="folder_cell_width">86dp</dimen> <dimen name="folder_cell_height">90dp</dimen> + <dimen name="cell_layout_left_padding_port">12dp</dimen> + <dimen name="cell_layout_right_padding_port">12dp</dimen> + <dimen name="workspace_divider_padding_left">19dp</dimen> + <dimen name="workspace_divider_padding_right">19dp</dimen> + <!-- AppsCustomize --> <dimen name="apps_customize_cell_width">96dp</dimen> - <dimen name="apps_customize_cell_height">98dp</dimen> + <dimen name="apps_customize_cell_height">96dp</dimen> <dimen name="apps_customize_pageLayoutPaddingLeft">12dp</dimen> <dimen name="apps_customize_pageLayoutPaddingRight">12dp</dimen> <dimen name="apps_customize_tab_bar_height">60dp</dimen> @@ -57,12 +64,11 @@ <!-- Workspace cell size --> <dimen name="workspace_cell_width_land">88dp</dimen> - <dimen name="workspace_cell_width_port">88dp</dimen> + <dimen name="workspace_cell_width_port">96dp</dimen> <dimen name="workspace_cell_height_land">88dp</dimen> - <dimen name="workspace_cell_height_port">88dp</dimen> + <dimen name="workspace_cell_height_port">96dp</dimen> <dimen name="workspace_width_gap_land">32dp</dimen> - <dimen name="workspace_width_gap_port">6dp</dimen> + <dimen name="workspace_width_gap_port">0dp</dimen> <dimen name="workspace_height_gap_land">0dp</dimen> <dimen name="workspace_height_gap_port">24dp</dimen> - </resources> diff --git a/res/values-sw600dp/styles.xml b/res/values-sw600dp/styles.xml new file mode 100644 index 000000000..200c0a0bd --- /dev/null +++ b/res/values-sw600dp/styles.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +* Copyright (C) 2012 The Android Open Source Project +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +--> + +<resources> + <style name="ClingButton"> + <item name="android:layout_width">wrap_content</item> + <item name="android:layout_height">wrap_content</item> + <item name="android:paddingTop">10dp</item> + <item name="android:paddingBottom">15dp</item> + <item name="android:paddingLeft">35dp</item> + <item name="android:paddingRight">35dp</item> + <item name="android:text">@string/cling_dismiss</item> + <item name="android:textStyle">bold</item> + <item name="android:background">@drawable/cling_button_bg</item> + </style> + <style name="ClingTitleText"> + <item name="android:layout_width">wrap_content</item> + <item name="android:layout_height">wrap_content</item> + <item name="android:layout_marginBottom">5dp</item> + <item name="android:textSize">30sp</item> + <item name="android:textColor">#33B5E5</item> + <item name="android:shadowColor">#000000</item> + <item name="android:shadowDy">2</item> + <item name="android:shadowRadius">2.0</item> + </style> + <style name="ClingText"> + <item name="android:textSize">22sp</item> + <item name="android:textColor">#FFFFFF</item> + <item name="android:shadowColor">#000000</item> + <item name="android:shadowDy">2</item> + <item name="android:shadowRadius">2.0</item> + <item name="android:lineSpacingMultiplier">1.1</item> + </style> +</resources> diff --git a/res/values-sw720dp/config.xml b/res/values-sw720dp/config.xml index c52328f33..7a6f6d82d 100644 --- a/res/values-sw720dp/config.xml +++ b/res/values-sw720dp/config.xml @@ -1,6 +1,7 @@ <resources> <bool name="config_largeHeap">true</bool> <bool name="is_large_screen">true</bool> + <bool name="allow_rotation">true</bool> <!-- AllApps/Customize/AppsCustomize --> <!-- Out of 100, the percent to shrink the workspace during spring loaded mode. --> diff --git a/res/values-sw720dp/dimens.xml b/res/values-sw720dp/dimens.xml index 48c729d69..cfd76dce0 100644 --- a/res/values-sw720dp/dimens.xml +++ b/res/values-sw720dp/dimens.xml @@ -16,6 +16,7 @@ <resources> <dimen name="app_icon_size">72dp</dimen> + <dimen name="reveal_radius">72dp</dimen> <!-- QSB --> <dimen name="toolbar_button_vertical_padding">12dip</dimen> <dimen name="toolbar_button_horizontal_padding">12dip</dimen> @@ -35,6 +36,8 @@ <dimen name="folder_preview_size">75dp</dimen> <!-- AppsCustomize --> + <dimen name="apps_customize_cell_width">96dp</dimen> + <dimen name="apps_customize_cell_height">96dp</dimen> <integer name="apps_customize_maxCellCountX">-1</integer> <integer name="apps_customize_maxCellCountY">-1</integer> <dimen name="app_widget_preview_padding_left">0dp</dimen> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index d468762e9..fa85a1b16 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -21,6 +21,9 @@ <!-- The offset for the text in the cling --> <dimen name="cling_text_block_offset_x">0dp</dimen> <dimen name="cling_text_block_offset_y">0dp</dimen> + <dimen name="reveal_radius">48dp</dimen> + <!-- A list of custom punch through x,y coordinates. x and y alternate. default to empty. --> + <array name="punch_through_coords"></array> <!-- Workspace --> <!-- qsb_bar_height_inset represents qsb_bar_height minus the padding @@ -46,6 +49,7 @@ <dimen name="hotseat_height_gap">-1dp</dimen> <dimen name="workspace_overscroll_drawable_padding">0dp</dimen> <dimen name="workspace_icon_text_size">12sp</dimen> + <dimen name="workspace_spring_loaded_page_spacing">15dp</dimen> <dimen name="app_icon_drawable_padding">6dp</dimen> <dimen name="app_icon_drawable_padding_land">2dp</dimen> diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java index f2c50a47b..a3d8f8d40 100644 --- a/src/com/android/launcher2/AppsCustomizePagedView.java +++ b/src/com/android/launcher2/AppsCustomizePagedView.java @@ -279,6 +279,11 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen mWidgetPreviewIconPaddedDimension = (int) (mAppIconSize * (1 + (2 * sWidgetPreviewIconPaddingPercentage))); mFadeInAdjacentScreens = false; + + // Unless otherwise specified this view is important for accessibility. + if (getImportantForAccessibility() == View.IMPORTANT_FOR_ACCESSIBILITY_AUTO) { + setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES); + } } @Override @@ -702,6 +707,8 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen mWidgetPreviewIconPaddedDimension, Bitmap.Config.ARGB_8888); Drawable d = image.getDrawable(); mCanvas.setBitmap(preview); + mCanvas.translate((mWidgetPreviewIconPaddedDimension - d.getIntrinsicWidth()) / 2, + (mWidgetPreviewIconPaddedDimension - d.getIntrinsicHeight()) / 2); d.draw(mCanvas); mCanvas.setBitmap(null); createItemInfo.spanX = createItemInfo.spanY = 1; @@ -809,6 +816,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen onSyncWidgetPageItems(d); } mDeferredSyncWidgetPageItems.clear(); + mForceDrawAllChildrenNextFrame = !toWorkspace; } @Override @@ -1512,7 +1520,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen @Override protected void onPageEndMoving() { super.onPageEndMoving(); - + mForceDrawAllChildrenNextFrame = true; // We reset the save index when we change pages so that it will be recalculated on next // rotation mSaveInstanceStateItemIndex = -1; diff --git a/src/com/android/launcher2/ButtonDropTarget.java b/src/com/android/launcher2/ButtonDropTarget.java index e9f8ce8b5..1c9fa5f95 100644 --- a/src/com/android/launcher2/ButtonDropTarget.java +++ b/src/com/android/launcher2/ButtonDropTarget.java @@ -20,6 +20,7 @@ import android.content.Context; import android.content.res.Resources; import android.graphics.PointF; import android.graphics.Rect; +import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.widget.TextView; @@ -68,6 +69,16 @@ public class ButtonDropTarget extends TextView implements DropTarget, DragContro mSearchDropTargetBar = searchDropTargetBar; } + protected Drawable getCurrentDrawable() { + Drawable[] drawables = getCompoundDrawables(); + for (int i = 0; i < drawables.length; ++i) { + if (drawables[i] != null) { + return drawables[i]; + } + } + return null; + } + public void onDrop(DragObject d) { } diff --git a/src/com/android/launcher2/Cling.java b/src/com/android/launcher2/Cling.java index f9a0681f6..6f2d02116 100644 --- a/src/com/android/launcher2/Cling.java +++ b/src/com/android/launcher2/Cling.java @@ -40,13 +40,16 @@ public class Cling extends FrameLayout { private static String WORKSPACE_PORTRAIT = "workspace_portrait"; private static String WORKSPACE_LANDSCAPE = "workspace_landscape"; + private static String WORKSPACE_LARGE = "workspace_large"; + private static String WORKSPACE_CUSTOM = "workspace_custom"; + private static String ALLAPPS_PORTRAIT = "all_apps_portrait"; private static String ALLAPPS_LANDSCAPE = "all_apps_landscape"; + private static String ALLAPPS_LARGE = "all_apps_large"; + private static String FOLDER_PORTRAIT = "folder_portrait"; private static String FOLDER_LANDSCAPE = "folder_landscape"; - private static String WORKSPACE_LARGE = "workspace_large"; private static String FOLDER_LARGE = "folder_large"; - private static String ALLAPPS_LARGE = "all_apps_large"; private Launcher mLauncher; private boolean mIsInitialized; @@ -59,6 +62,7 @@ public class Cling extends FrameLayout { private int mButtonBarHeight; private float mRevealRadius; private int[] mPositionData; + private int[] mCustomPositionData; private Paint mErasePaint; @@ -84,11 +88,23 @@ public class Cling extends FrameLayout { mPositionData = positionData; Resources r = getContext().getResources(); + + // If we have custom punch through data from resources + TypedArray punchThroughCoords = r.obtainTypedArray(R.array.punch_through_coords); + + if (punchThroughCoords != null) { + int len = punchThroughCoords.length(); + mCustomPositionData = new int[len]; + for (int i = 0; i < len; i++) { + mCustomPositionData[i] = punchThroughCoords.getDimensionPixelSize(i, 0); + } + } + mPunchThroughGraphic = r.getDrawable(R.drawable.cling); mPunchThroughGraphicCenterRadius = r.getDimensionPixelSize(R.dimen.clingPunchThroughGraphicCenterRadius); mAppIconSize = r.getDimensionPixelSize(R.dimen.app_icon_size); - mRevealRadius = mAppIconSize * 1f; + mRevealRadius = r.getDimensionPixelSize(R.dimen.reveal_radius) * 1f; mButtonBarHeight = r.getDimensionPixelSize(R.dimen.button_bar_height); mErasePaint = new Paint(); @@ -107,7 +123,7 @@ public class Cling extends FrameLayout { mIsInitialized = false; } - private int[] getPunchThroughPosition() { + private int[] getPunchThroughPositions() { if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT)) { return new int[]{getMeasuredWidth() / 2, getMeasuredHeight() - (mButtonBarHeight / 2)}; } else if (mDrawIdentifier.equals(WORKSPACE_LANDSCAPE)) { @@ -117,6 +133,8 @@ public class Cling extends FrameLayout { final int cornerXOffset = (int) (scale * 15); final int cornerYOffset = (int) (scale * 10); return new int[]{getMeasuredWidth() - cornerXOffset, cornerYOffset}; + } else if (mDrawIdentifier.equals(WORKSPACE_CUSTOM)) { + return mCustomPositionData; } else if (mDrawIdentifier.equals(ALLAPPS_PORTRAIT) || mDrawIdentifier.equals(ALLAPPS_LANDSCAPE) || mDrawIdentifier.equals(ALLAPPS_LARGE)) { @@ -130,14 +148,18 @@ public class Cling extends FrameLayout { if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT) || mDrawIdentifier.equals(WORKSPACE_LANDSCAPE) || mDrawIdentifier.equals(WORKSPACE_LARGE) || + mDrawIdentifier.equals(WORKSPACE_CUSTOM) || mDrawIdentifier.equals(ALLAPPS_PORTRAIT) || mDrawIdentifier.equals(ALLAPPS_LANDSCAPE) || mDrawIdentifier.equals(ALLAPPS_LARGE)) { - int[] pos = getPunchThroughPosition(); - double diff = Math.sqrt(Math.pow(event.getX() - pos[0], 2) + - Math.pow(event.getY() - pos[1], 2)); - if (diff < mRevealRadius) { - return false; + + int[] positions = getPunchThroughPositions(); + for (int i = 0; i < positions.length; i += 2) { + double diff = Math.sqrt(Math.pow(event.getX() - positions[i], 2) + + Math.pow(event.getY() - positions[i + 1], 2)); + if (diff < mRevealRadius) { + return false; + } } } else if (mDrawIdentifier.equals(FOLDER_PORTRAIT) || mDrawIdentifier.equals(FOLDER_LANDSCAPE) || @@ -168,8 +190,9 @@ public class Cling extends FrameLayout { // Draw the background if (mBackground == null) { if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT) || - mDrawIdentifier.equals(WORKSPACE_LANDSCAPE) || - mDrawIdentifier.equals(WORKSPACE_LARGE)) { + mDrawIdentifier.equals(WORKSPACE_LANDSCAPE) || + mDrawIdentifier.equals(WORKSPACE_LARGE) || + mDrawIdentifier.equals(WORKSPACE_CUSTOM)) { mBackground = getResources().getDrawable(R.drawable.bg_cling1); } else if (mDrawIdentifier.equals(ALLAPPS_PORTRAIT) || mDrawIdentifier.equals(ALLAPPS_LANDSCAPE) || @@ -196,13 +219,15 @@ public class Cling extends FrameLayout { int dh = (int) (scale * mPunchThroughGraphic.getIntrinsicHeight()); // Determine where to draw the punch through graphic - int[] pos = getPunchThroughPosition(); - cx = pos[0]; - cy = pos[1]; - if (cx > -1 && cy > -1) { - c.drawCircle(cx, cy, mRevealRadius, mErasePaint); - mPunchThroughGraphic.setBounds(cx - dw/2, cy - dh/2, cx + dw/2, cy + dh/2); - mPunchThroughGraphic.draw(c); + int[] positions = getPunchThroughPositions(); + for (int i = 0; i < positions.length; i += 2) { + cx = positions[i]; + cy = positions[i + 1]; + if (cx > -1 && cy > -1) { + c.drawCircle(cx, cy, mRevealRadius, mErasePaint); + mPunchThroughGraphic.setBounds(cx - dw/2, cy - dh/2, cx + dw/2, cy + dh/2); + mPunchThroughGraphic.draw(c); + } } // Draw the hand graphic in All Apps diff --git a/src/com/android/launcher2/DeleteDropTarget.java b/src/com/android/launcher2/DeleteDropTarget.java index eb831f6e9..1edc2abe9 100644 --- a/src/com/android/launcher2/DeleteDropTarget.java +++ b/src/com/android/launcher2/DeleteDropTarget.java @@ -25,6 +25,7 @@ import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.PointF; import android.graphics.Rect; +import android.graphics.drawable.Drawable; import android.graphics.drawable.TransitionDrawable; import android.util.AttributeSet; import android.view.View; @@ -76,7 +77,7 @@ public class DeleteDropTarget extends ButtonDropTarget { // The current drawable is set to either the remove drawable or the uninstall drawable // and is initially set to the remove drawable, as set in the layout xml. - mCurrentDrawable = (TransitionDrawable) getCompoundDrawables()[0]; + mCurrentDrawable = (TransitionDrawable) getCurrentDrawable(); // Remove the text in the Phone UI in landscape int orientation = getResources().getConfiguration().orientation; @@ -157,7 +158,7 @@ public class DeleteDropTarget extends ButtonDropTarget { } else { setCompoundDrawablesWithIntrinsicBounds(mRemoveDrawable, null, null, null); } - mCurrentDrawable = (TransitionDrawable) getCompoundDrawables()[0]; + mCurrentDrawable = (TransitionDrawable) getCurrentDrawable(); mActive = isVisible; resetHoverColor(); diff --git a/src/com/android/launcher2/InfoDropTarget.java b/src/com/android/launcher2/InfoDropTarget.java index 134f4cb56..d6bf5f2cc 100644 --- a/src/com/android/launcher2/InfoDropTarget.java +++ b/src/com/android/launcher2/InfoDropTarget.java @@ -16,7 +16,6 @@ package com.android.launcher2; -import android.appwidget.AppWidgetProviderInfo; import android.content.ComponentName; import android.content.Context; import android.content.res.ColorStateList; @@ -51,7 +50,7 @@ public class InfoDropTarget extends ButtonDropTarget { // Get the hover color Resources r = getResources(); mHoverColor = r.getColor(R.color.info_target_hover_tint); - mDrawable = (TransitionDrawable) getCompoundDrawables()[0]; + mDrawable = (TransitionDrawable) getCurrentDrawable(); mDrawable.setCrossFadeEnabled(true); // Remove the text in the Phone UI in landscape diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java index bc88a987d..fc1a26d4b 100644 --- a/src/com/android/launcher2/LauncherModel.java +++ b/src/com/android/launcher2/LauncherModel.java @@ -1089,7 +1089,9 @@ public class LauncherModel extends BroadcastReceiver { // App shortcuts that used to be automatically added to Launcher // didn't always have the correct intent flags set, so do that here - if (intent.getAction().equals(Intent.ACTION_MAIN) && + if (intent.getAction() != null && + intent.getCategories() != null && + intent.getAction().equals(Intent.ACTION_MAIN) && intent.getCategories().contains(Intent.CATEGORY_LAUNCHER)) { intent.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK | diff --git a/src/com/android/launcher2/LauncherProvider.java b/src/com/android/launcher2/LauncherProvider.java index 4cf87d2b4..0720259f4 100644 --- a/src/com/android/launcher2/LauncherProvider.java +++ b/src/com/android/launcher2/LauncherProvider.java @@ -66,7 +66,7 @@ public class LauncherProvider extends ContentProvider { private static final String DATABASE_NAME = "launcher.db"; - private static final int DATABASE_VERSION = 11; + private static final int DATABASE_VERSION = 12; static final String AUTHORITY = "com.android.launcher2.settings"; @@ -203,7 +203,7 @@ public class LauncherProvider extends ContentProvider { return mOpenHelper.generateNewId(); } - public void loadDefaultFavoritesIfNecessary() { + synchronized public void loadDefaultFavoritesIfNecessary() { String spKey = LauncherApplication.getSharedPreferencesKey(); SharedPreferences sp = getContext().getSharedPreferences(spKey, Context.MODE_PRIVATE); if (sp.getBoolean(DB_CREATED_BUT_DEFAULT_WORKSPACE_NOT_LOADED, false)) { @@ -477,14 +477,15 @@ public class LauncherProvider extends ContentProvider { version = 9; } - // We bumped the version twice during JB, once to update the launch flags, and once to - // update the override for the default launch animation. - if (version < 11) { + // We bumped the version three time during JB, once to update the launch flags, once to + // update the override for the default launch animation and once to set the mimetype + // to improve startup performance + if (version < 12) { // Contact shortcuts need a different set of flags to be launched now // The updateContactsShortcuts change is idempotent, so we can keep using it like // back in the Donut days updateContactsShortcuts(db); - version = 11; + version = 12; } if (version != DATABASE_VERSION) { @@ -540,6 +541,9 @@ public class LauncherProvider extends ContentProvider { newIntent.putExtra( Launcher.INTENT_EXTRA_IGNORE_LAUNCH_ANIMATION, true); newIntent.setData(uri); + // Determine the type and also put that in the shortcut + // (that can speed up launch a bit) + newIntent.setDataAndType(uri, newIntent.resolveType(mContext)); final ContentValues values = new ContentValues(); values.put(LauncherSettings.Favorites.INTENT, diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java index a3080a846..93725ce54 100644 --- a/src/com/android/launcher2/PagedView.java +++ b/src/com/android/launcher2/PagedView.java @@ -24,6 +24,7 @@ import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Rect; +import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; import android.util.AttributeSet; @@ -75,6 +76,8 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc private static final int MIN_SNAP_VELOCITY = 1500; private static final int MIN_FLING_VELOCITY = 250; + static final int AUTOMATIC_PAGE_SPACING = -1; + protected int mFlingThresholdVelocity; protected int mMinFlingVelocity; protected int mMinSnapVelocity; @@ -131,6 +134,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc protected boolean mAllowOverScroll = true; protected int mUnboundedScrollX; protected int[] mTempVisiblePagesRange = new int[2]; + protected boolean mForceDrawAllChildrenNextFrame; // mOverScrollX is equal to getScrollX() when we're within the normal scroll range. Otherwise // it is equal to the scaled overscroll position. We use a separate value so as to prevent @@ -450,17 +454,23 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc final int widthMode = MeasureSpec.getMode(widthMeasureSpec); final int widthSize = MeasureSpec.getSize(widthMeasureSpec); + final int heightMode = MeasureSpec.getMode(heightMeasureSpec); + int heightSize = MeasureSpec.getSize(heightMeasureSpec); if (widthMode != MeasureSpec.EXACTLY) { throw new IllegalStateException("Workspace can only be used in EXACTLY mode."); } + // Return early if we aren't given a proper dimension + if (widthSize <= 0 || heightSize <= 0) { + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + return; + } + /* Allow the height to be set as WRAP_CONTENT. This allows the particular case * of the All apps view on XLarge displays to not take up more space then it needs. Width * is still not allowed to be set as WRAP_CONTENT since many parts of the code expect * each page to have the same width. */ - final int heightMode = MeasureSpec.getMode(heightMeasureSpec); - int heightSize = MeasureSpec.getSize(heightMeasureSpec); int maxChildHeight = 0; final int verticalPadding = getPaddingTop() + getPaddingBottom(); @@ -507,12 +517,17 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc setMeasuredDimension(widthSize, heightSize); + // We can't call getChildOffset/getRelativeChildOffset until we set the measured dimensions. + // We also wait until we set the measured dimensions before flushing the cache as well, to + // ensure that the cache is filled with good values. + invalidateCachedOffsets(); + if (childCount > 0) { if (DEBUG) Log.d(TAG, "getRelativeChildOffset(): " + getMeasuredWidth() + ", " + getChildWidth(0)); // Calculate the variable page spacing if necessary - if (mPageSpacing < 0) { + if (mPageSpacing == AUTOMATIC_PAGE_SPACING) { // The gap between pages in the PagedView should be equal to the gap from the page // to the edge of the screen (so it is not visible in the current screen). To // account for unequal padding on each side of the paged view, we take the maximum @@ -524,10 +539,6 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc } } - // We can't call getChildOffset/getRelativeChildOffset until we set the measured dimensions. - // We also wait until we set the measured dimensions before flushing the cache as well, to - // ensure that the cache is filled with good values. - invalidateCachedOffsets(); updateScrollingIndicatorPosition(); if (childCount > 0) { @@ -747,6 +758,10 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc } } + protected boolean shouldDrawChild(View child) { + return child.getAlpha() > 0; + } + @Override protected void dispatchDraw(Canvas canvas) { int halfScreenSize = getMeasuredWidth() / 2; @@ -783,13 +798,15 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc // View.INVISIBLE, preventing re-drawing of their hardware layer for (int i = getChildCount() - 1; i >= 0; i--) { final View v = getPageAt(i); - if (leftScreen <= i && i <= rightScreen && v.getAlpha() > 0) { + if (mForceDrawAllChildrenNextFrame || + (leftScreen <= i && i <= rightScreen && shouldDrawChild(v))) { v.setVisibility(VISIBLE); drawChild(canvas, v, drawingTime); } else { v.setVisibility(INVISIBLE); } } + mForceDrawAllChildrenNextFrame = false; canvas.restore(); } } @@ -1841,7 +1858,13 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc @Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); - info.setScrollable(true); + info.setScrollable(getPageCount() > 1); + if (getCurrentPage() < getPageCount() - 1) { + info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); + } + if (getCurrentPage() > 0) { + info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD); + } } @Override @@ -1855,6 +1878,28 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc } } + @Override + public boolean performAccessibilityAction(int action, Bundle arguments) { + if (super.performAccessibilityAction(action, arguments)) { + return true; + } + switch (action) { + case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: { + if (getCurrentPage() < getPageCount() - 1) { + scrollRight(); + return true; + } + } break; + case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: { + if (getCurrentPage() > 0) { + scrollLeft(); + return true; + } + } break; + } + return false; + } + protected String getCurrentPageDescription() { return String.format(getContext().getString(R.string.default_scroll_format), getNextPage() + 1, getChildCount()); diff --git a/src/com/android/launcher2/PreloadReceiver.java b/src/com/android/launcher2/PreloadReceiver.java new file mode 100644 index 000000000..d1bc6393d --- /dev/null +++ b/src/com/android/launcher2/PreloadReceiver.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.launcher2; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class PreloadReceiver extends BroadcastReceiver { + @Override + public void onReceive(Context context, Intent intent) { + final LauncherApplication app = (LauncherApplication) context.getApplicationContext(); + final LauncherProvider provider = app.getLauncherProvider(); + if (provider != null) { + new Thread(new Runnable() { + public void run() { + provider.loadDefaultFavoritesIfNecessary(); + } + }).start(); + } + } +} diff --git a/src/com/android/launcher2/SearchDropTargetBar.java b/src/com/android/launcher2/SearchDropTargetBar.java index 5a1ba6904..03512b2f1 100644 --- a/src/com/android/launcher2/SearchDropTargetBar.java +++ b/src/com/android/launcher2/SearchDropTargetBar.java @@ -54,6 +54,7 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D private boolean mDeferOnDragEnd = false; private Drawable mPreviousBackground; + private boolean mEnableDropDownDropTargets; public SearchDropTargetBar(Context context, AttributeSet attrs) { this(context, attrs, 0); @@ -108,11 +109,11 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D mInfoDropTarget.setSearchDropTargetBar(this); mDeleteDropTarget.setSearchDropTargetBar(this); - boolean enableDropDownDropTargets = + mEnableDropDownDropTargets = getResources().getBoolean(R.bool.config_useDropTargetDownTransition); // Create the various fade animations - if (enableDropDownDropTargets) { + if (mEnableDropDownDropTargets) { mDropTargetBar.setTranslationY(-mBarHeight); mDropTargetBarFadeInAnim = ObjectAnimator.ofFloat(mDropTargetBar, "translationY", 0f); mDropTargetBarFadeOutAnim = ObjectAnimator.ofFloat(mDropTargetBar, "translationY", @@ -154,7 +155,11 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D mQSBSearchBarFadeInAnim.start(); } else { mQSBSearchBar.setVisibility(View.VISIBLE); - mQSBSearchBar.setAlpha(1f); + if (mEnableDropDownDropTargets) { + mQSBSearchBar.setTranslationY(0); + } else { + mQSBSearchBar.setAlpha(1f); + } } mIsSearchBarHidden = false; } @@ -164,7 +169,11 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D mQSBSearchBarFadeOutAnim.start(); } else { mQSBSearchBar.setVisibility(View.INVISIBLE); - mQSBSearchBar.setAlpha(0f); + if (mEnableDropDownDropTargets) { + mQSBSearchBar.setTranslationY(0); + } else { + mQSBSearchBar.setAlpha(0f); + } } mIsSearchBarHidden = true; } diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 3910c45cf..00684bdfc 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -199,6 +199,7 @@ public class Workspace extends SmoothPagedView private Point mDisplaySize = new Point(); private boolean mIsStaticWallpaper; private int mWallpaperTravelWidth; + private int mSpringLoadedPageSpacing; // Variables relating to the creation of user folders by hovering shortcuts over shortcuts private static final int FOLDER_CREATION_TIMEOUT = 0; @@ -322,6 +323,8 @@ public class Workspace extends SmoothPagedView mSpringLoadedShrinkFactor = res.getInteger(R.integer.config_workspaceSpringLoadShrinkPercentage) / 100.0f; + mSpringLoadedPageSpacing = + res.getDimensionPixelSize(R.dimen.workspace_spring_loaded_page_spacing); // if the value is manually specified, use that instead cellCountX = a.getInt(R.styleable.Workspace_cellCountX, cellCountX); @@ -339,6 +342,11 @@ public class Workspace extends SmoothPagedView // Disable multitouch across the workspace/all apps/customize tray setMotionEventSplittingEnabled(true); + + // Unless otherwise specified this view is important for accessibility. + if (getImportantForAccessibility() == View.IMPORTANT_FOR_ACCESSIBILITY_AUTO) { + setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES); + } } // estimate the size of a widget with spans hSpan, vSpan. return MAX_VALUE for each @@ -450,6 +458,13 @@ public class Workspace extends SmoothPagedView public void onChildViewRemoved(View parent, View child) { } + protected boolean shouldDrawChild(View child) { + final CellLayout cl = (CellLayout) child; + return super.shouldDrawChild(child) && + (cl.getShortcutsAndWidgets().getAlpha() > 0 || + cl.getBackgroundAlpha() > 0); + } + /** * @return The open folder on the current screen, or null if there is none */ @@ -1536,6 +1551,7 @@ public class Workspace extends SmoothPagedView if (state != State.NORMAL) { finalScaleFactor = mSpringLoadedShrinkFactor - (stateIsSmall ? 0.1f : 0); + setPageSpacing(mSpringLoadedPageSpacing); if (oldStateIsNormal && stateIsSmall) { zoomIn = false; setLayoutScale(finalScaleFactor); @@ -1545,6 +1561,7 @@ public class Workspace extends SmoothPagedView setLayoutScale(finalScaleFactor); } } else { + setPageSpacing(PagedView.AUTOMATIC_PAGE_SPACING); setLayoutScale(1.0f); } |