merge in ics-release history after reset to master
diff --git a/res/layout-land/application_boxed.xml b/res/layout-land/application_boxed.xml
deleted file mode 100644
index dc62361..0000000
--- a/res/layout-land/application_boxed.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.
--->
-
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/name"
- android:layout_width="match_parent"
- android:layout_height="88dip"
-
- android:paddingLeft="2dip"
- android:paddingRight="2dip"
- android:paddingTop="5dip"
- android:paddingBottom="2dip"
- android:drawablePadding="0dip"
-
- android:textSize="13dip"
- android:maxLines="2"
- android:ellipsize="marquee"
- android:fadingEdge="horizontal"
- android:textColor="@color/bright_text_dark_focused"
- android:gravity="top|center_horizontal" />
diff --git a/res/layout-land/live_folder_grid.xml b/res/layout-land/live_folder_grid.xml
deleted file mode 100644
index 1796756..0000000
--- a/res/layout-land/live_folder_grid.xml
+++ /dev/null
@@ -1,55 +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.LiveFolder xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical">
-
- <Button
- android:id="@+id/folder_close"
- android:background="@drawable/box_launcher_top"
- android:gravity="left|center_vertical"
- android:textSize="14sp"
- android:textColor="#404040"
- android:textStyle="bold"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
- android:background="@drawable/box_launcher_bottom">
-
- <GridView
- android:id="@+id/folder_content"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
-
- android:cacheColorHint="#ff333333"
-
- android:scrollbarAlwaysDrawVerticalTrack="true"
- android:scrollbarStyle="insideInset"
- android:drawSelectorOnTop="false"
- android:listSelector="@drawable/grid_selector"
-
- android:verticalSpacing="10dip"
- android:numColumns="5" />
- </FrameLayout>
-
-</com.android.launcher2.LiveFolder>
diff --git a/res/layout-land/live_folder_icon.xml b/res/layout-land/live_folder_icon.xml
deleted file mode 100644
index 64c2d44..0000000
--- a/res/layout-land/live_folder_icon.xml
+++ /dev/null
@@ -1,21 +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.LiveFolderIcon xmlns:android="http://schemas.android.com/apk/res/android"
- style="@style/WorkspaceIcon.Landscape" />
diff --git a/res/layout-port/application_boxed.xml b/res/layout-port/application_boxed.xml
deleted file mode 100644
index 5e64cee..0000000
--- a/res/layout-port/application_boxed.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.
--->
-
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/name"
- android:layout_width="match_parent"
- android:layout_height="88dip"
-
- android:paddingLeft="2dip"
- android:paddingRight="2dip"
- android:paddingTop="5dip"
- android:paddingBottom="2dip"
- android:drawablePadding="0dip"
-
- android:textSize="13dip"
- android:maxLines="2"
- android:ellipsize="marquee"
- android:fadingEdge="horizontal"
- android:textColor="@color/bright_text_dark_focused"
- android:gravity="top|center_horizontal" />
diff --git a/res/layout-port/live_folder_grid.xml b/res/layout-port/live_folder_grid.xml
deleted file mode 100644
index 85f74db..0000000
--- a/res/layout-port/live_folder_grid.xml
+++ /dev/null
@@ -1,54 +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.LiveFolder xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical">
-
- <Button
- android:id="@+id/folder_close"
- android:background="@drawable/box_launcher_top"
- android:gravity="left|center_vertical"
- android:textSize="14sp"
- android:textColor="#404040"
- android:textStyle="bold"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
- android:background="@drawable/box_launcher_bottom">
- <GridView
- android:id="@id/folder_content"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
-
- android:cacheColorHint="#ff333333"
-
- android:scrollbarAlwaysDrawVerticalTrack="true"
- android:scrollbarStyle="insideInset"
- android:drawSelectorOnTop="false"
- android:listSelector="@drawable/grid_selector"
-
- android:verticalSpacing="10dip"
- android:numColumns="4" />
- </FrameLayout>
-
-</com.android.launcher2.LiveFolder>
diff --git a/res/layout-port/live_folder_icon.xml b/res/layout-port/live_folder_icon.xml
deleted file mode 100644
index e3cd49e..0000000
--- a/res/layout-port/live_folder_icon.xml
+++ /dev/null
@@ -1,21 +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.LiveFolderIcon xmlns:android="http://schemas.android.com/apk/res/android"
- style="@style/WorkspaceIcon.Portrait" />
diff --git a/res/layout/apps_customize_pane.xml b/res/layout/apps_customize_pane.xml
index 8361d16..8b1bd39 100644
--- a/res/layout/apps_customize_pane.xml
+++ b/res/layout/apps_customize_pane.xml
@@ -43,6 +43,7 @@
android:layout_gravity="right"
android:gravity="center"
android:text="@string/market"
+ android:contentDescription="@string/market"
android:textColor="@color/workspace_all_apps_and_delete_zone_text_color"
android:textSize="18sp"
android:shadowColor="@color/workspace_all_apps_and_delete_zone_text_shadow_color"
diff --git a/res/layout/live_folder_list.xml b/res/layout/live_folder_list.xml
deleted file mode 100644
index 0dc7b7c..0000000
--- a/res/layout/live_folder_list.xml
+++ /dev/null
@@ -1,45 +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.LiveFolder xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical">
-
- <Button
- android:id="@+id/folder_close"
- android:background="@drawable/box_launcher_top"
- android:gravity="left|center_vertical"
- android:textSize="14sp"
- android:textColor="#404040"
- android:textStyle="bold"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
- android:background="@drawable/box_launcher_bottom">
- <ListView
- android:id="@id/folder_content"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:cacheColorHint="#ff333333" />
- </FrameLayout>
-
-</com.android.launcher2.LiveFolder>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 2d41791..e7c18bd 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -245,4 +245,16 @@
<!-- Default folder title -->
<string name="folder_hint_text">Unnamed Folder</string>
+
+ <!-- Accessibility -->
+ <skip />
+
+ <!-- The format string for default page scroll text [CHAR_LIMIT=none] -->
+ <string name="default_scroll_format" translatable="false">Page %1$d of %2$d</string>
+ <!-- The format string for Workspace page scroll text [CHAR_LIMIT=none] -->
+ <string name="workspace_scroll_format" translatable="false">Workspace %1$d of %2$d</string>
+ <!-- The format string for AppsCustomize Apps page scroll text [CHAR_LIMIT=none] -->
+ <string name="apps_customize_apps_scroll_format" translatable="false">Apps page %1$d of %2$d</string>
+ <!-- The format string for AppsCustomize Apps page scroll text [CHAR_LIMIT=none] -->
+ <string name="apps_customize_widgets_scroll_format" translatable="false">Widgets page %1$d of %2$d</string>
</resources>
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index 5696b50..54a2e42 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -1192,4 +1192,19 @@
final int count = getChildCount();
return Math.min(page + 2, count - 1);
}
+
+ @Override
+ protected String getCurrentPageDescription() {
+ int page = (mNextPage != INVALID_PAGE) ? mNextPage : mCurrentPage;
+ int stringId = R.string.default_scroll_format;
+ switch (mContentType) {
+ case Applications:
+ stringId = R.string.apps_customize_apps_scroll_format;
+ break;
+ case Widgets:
+ stringId = R.string.apps_customize_widgets_scroll_format;
+ break;
+ }
+ return String.format(mContext.getString(stringId), page + 1, getChildCount());
+ }
}
diff --git a/src/com/android/launcher2/DragLayer.java b/src/com/android/launcher2/DragLayer.java
index 101ed5d..0cdfd28 100644
--- a/src/com/android/launcher2/DragLayer.java
+++ b/src/com/android/launcher2/DragLayer.java
@@ -146,7 +146,7 @@
return mDragController.onTouchEvent(ev);
}
- private void getDescendantRectRelativeToSelf(View descendant, Rect r) {
+ public void getDescendantRectRelativeToSelf(View descendant, Rect r) {
descendant.getHitRect(r);
ViewParent viewParent = descendant.getParent();
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java
index 80428fa..da859cb 100644
--- a/src/com/android/launcher2/Folder.java
+++ b/src/com/android/launcher2/Folder.java
@@ -100,6 +100,7 @@
private TextView mFolderName;
private int mFolderNameHeight;
private Rect mHitRect = new Rect();
+ private Rect mTempRect = new Rect();
private boolean mIsEditingName = false;
private InputMethodManager mInputMethodManager;
@@ -118,8 +119,8 @@
setAlwaysDrawnWithCacheEnabled(false);
mInflater = LayoutInflater.from(context);
mIconCache = ((LauncherApplication)context.getApplicationContext()).getIconCache();
- mMaxCountX = LauncherModel.getCellCountX() - 1;
- mMaxCountY = LauncherModel.getCellCountY() - 1;
+ mMaxCountX = LauncherModel.getCellCountX();
+ mMaxCountY = LauncherModel.getCellCountY();
mInputMethodManager = (InputMethodManager)
mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
@@ -319,9 +320,8 @@
}
void onClose() {
- CellLayoutChildren clc = (CellLayoutChildren) getParent();
- final CellLayout cellLayout = (CellLayout) clc.getParent();
- cellLayout.removeViewWithoutMarkingCells(Folder.this);
+ DragLayer parent = (DragLayer) getParent();
+ parent.removeView(Folder.this);
clearFocus();
}
@@ -373,8 +373,8 @@
private void positionAndSizeAsIcon() {
if (!(getParent() instanceof CellLayoutChildren)) return;
- CellLayout.LayoutParams iconLp = (CellLayout.LayoutParams) mFolderIcon.getLayoutParams();
- CellLayout.LayoutParams lp = (CellLayout.LayoutParams) getLayoutParams();
+ DragLayer.LayoutParams iconLp = (DragLayer.LayoutParams) mFolderIcon.getLayoutParams();
+ DragLayer.LayoutParams lp = (DragLayer.LayoutParams) getLayoutParams();
if (mMode == PARTIAL_GROW) {
setScaleX(0.8f);
@@ -394,10 +394,10 @@
if (mState != STATE_SMALL) {
positionAndSizeAsIcon();
}
- if (!(getParent() instanceof CellLayoutChildren)) return;
+ if (!(getParent() instanceof DragLayer)) return;
ObjectAnimator oa;
- CellLayout.LayoutParams lp = (CellLayout.LayoutParams) getLayoutParams();
+ DragLayer.LayoutParams lp = (DragLayer.LayoutParams) getLayoutParams();
centerAboutIcon();
if (mMode == PARTIAL_GROW) {
@@ -439,7 +439,7 @@
}
public void animateClosed() {
- if (!(getParent() instanceof CellLayoutChildren)) return;
+ if (!(getParent() instanceof DragLayer)) return;
ObjectAnimator oa;
if (mMode == PARTIAL_GROW) {
@@ -448,8 +448,8 @@
PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 0.9f);
oa = ObjectAnimator.ofPropertyValuesHolder(this, alpha, scaleX, scaleY);
} else {
- CellLayout.LayoutParams iconLp = (CellLayout.LayoutParams) mFolderIcon.getLayoutParams();
- CellLayout.LayoutParams lp = (CellLayout.LayoutParams) getLayoutParams();
+ DragLayer.LayoutParams iconLp = (DragLayer.LayoutParams) mFolderIcon.getLayoutParams();
+ DragLayer.LayoutParams lp = (DragLayer.LayoutParams) getLayoutParams();
PropertyValuesHolder width = PropertyValuesHolder.ofInt("width", iconLp.width);
PropertyValuesHolder height = PropertyValuesHolder.ofInt("height", iconLp.height);
@@ -513,7 +513,7 @@
protected boolean createAndAddShortcut(ShortcutInfo item) {
final TextView textView =
- (TextView) mInflater.inflate(R.layout.application_boxed, this, false);
+ (TextView) mInflater.inflate(R.layout.application, this, false);
textView.setCompoundDrawablesWithIntrinsicBounds(null,
new FastBitmapDrawable(item.getIcon(mIconCache)), null, null);
textView.setText(item.title);
@@ -720,25 +720,26 @@
}
private void centerAboutIcon() {
- CellLayout.LayoutParams iconLp = (CellLayout.LayoutParams) mFolderIcon.getLayoutParams();
- CellLayout.LayoutParams lp = (CellLayout.LayoutParams) getLayoutParams();
+ DragLayer.LayoutParams lp = (DragLayer.LayoutParams) getLayoutParams();
int width = getPaddingLeft() + getPaddingRight() + mContent.getDesiredWidth();
// Technically there is no padding at the bottom, but we add space equal to the padding
// and have to account for that here.
int height = getPaddingTop() + mContent.getDesiredHeight() + mFolderNameHeight;
+ DragLayer parent = (DragLayer) mLauncher.findViewById(R.id.drag_layer);
- int centerX = iconLp.x + iconLp.width / 2;
- int centerY = iconLp.y + iconLp.height / 2;
+ parent.getDescendantRectRelativeToSelf(mFolderIcon, mTempRect);
+
+ int centerX = mTempRect.centerX();
+ int centerY = mTempRect.centerY();
int centeredLeft = centerX - width / 2;
int centeredTop = centerY - height / 2;
- CellLayoutChildren clc = (CellLayoutChildren) getParent();
int parentWidth = 0;
int parentHeight = 0;
- if (clc != null) {
- parentWidth = clc.getMeasuredWidth();
- parentHeight = clc.getMeasuredHeight();
+ if (parent != null) {
+ parentWidth = parent.getMeasuredWidth();
+ parentHeight = parent.getMeasuredHeight();
}
int left = Math.min(Math.max(0, centeredLeft), parentWidth - width);
@@ -768,10 +769,10 @@
private void setupContentForNumItems(int count) {
setupContentDimension(count);
- CellLayout.LayoutParams lp = (CellLayout.LayoutParams) getLayoutParams();
+ DragLayer.LayoutParams lp = (DragLayer.LayoutParams) getLayoutParams();
if (lp == null) {
- lp = new CellLayout.LayoutParams(0, 0, -1, -1);
- lp.isLockedToGrid = false;
+ lp = new DragLayer.LayoutParams(0, 0);
+ lp.customPosition = true;
setLayoutParams(lp);
}
centerAboutIcon();
diff --git a/src/com/android/launcher2/FolderIcon.java b/src/com/android/launcher2/FolderIcon.java
index 0597110..bae2fd7 100644
--- a/src/com/android/launcher2/FolderIcon.java
+++ b/src/com/android/launcher2/FolderIcon.java
@@ -95,6 +95,7 @@
icon.mFolderName = (BubbleTextView) icon.findViewById(R.id.folder_name);
icon.mFolderName.setText(folderInfo.title);
icon.mPreviewBackground = (ImageView) icon.findViewById(R.id.preview_background);
+ icon.mPreviewBackground.setContentDescription(folderInfo.title);
icon.setTag(folderInfo);
icon.setOnClickListener(launcher);
@@ -383,5 +384,6 @@
public void onTitleChanged(CharSequence title) {
mFolderName.setText(title.toString());
+ mPreviewBackground.setContentDescription(title.toString());
}
}
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 3f4a47c..b52a4f7 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -1297,14 +1297,10 @@
protected void onSaveInstanceState(Bundle outState) {
outState.putInt(RUNTIME_STATE_CURRENT_SCREEN, mWorkspace.getCurrentPage());
- final ArrayList<Folder> folders = mWorkspace.getOpenFolders();
- if (folders.size() > 0) {
- final int count = folders.size();
- long[] ids = new long[count];
- for (int i = 0; i < count; i++) {
- final FolderInfo info = folders.get(i).getInfo();
- ids[i] = info.id;
- }
+ final Folder folder = mWorkspace.getOpenFolder();
+ if (folder != null) {
+ long[] ids = new long[1];
+ ids[0] = folder.getInfo().id;
outState.putLongArray(RUNTIME_STATE_FOLDERS, ids);
} else {
super.onSaveInstanceState(outState);
@@ -1712,7 +1708,7 @@
ViewGroup parent = (ViewGroup) folder.getParent().getParent();
if (parent != null) {
- CellLayout cl = (CellLayout) parent;
+ CellLayout cl = (CellLayout) mWorkspace.getChildAt(folder.mInfo.screen);
FolderIcon fi = (FolderIcon) cl.getChildAt(folder.mInfo.cellX, folder.mInfo.cellY);
shrinkAndFadeInFolderIcon(fi);
mDragController.removeDropTarget((DropTarget)folder);
@@ -1945,7 +1941,9 @@
growAndFadeOutFolderIcon(folderIcon);
info.opened = true;
- mWorkspace.addInFullScreen(folder, info.screen);
+ mDragLayer.addView(folder);
+ mDragController.addDropTarget((DropTarget) folder);
+
folder.animateOpen();
folder.onOpen();
}
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index fa6a570..9ca2f90 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -16,8 +16,6 @@
package com.android.launcher2;
-import java.util.ArrayList;
-
import android.animation.Animator;
import android.animation.AnimatorInflater;
import android.animation.AnimatorListenerAdapter;
@@ -39,6 +37,8 @@
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewParent;
+import android.view.accessibility.AccessibilityEvent;
+import android.view.accessibility.AccessibilityNodeInfo;
import android.view.animation.Interpolator;
import android.widget.Checkable;
import android.widget.ImageView;
@@ -46,6 +46,8 @@
import com.android.launcher.R;
+import java.util.ArrayList;
+
/**
* An abstraction of the original Workspace which supports browsing through a
* sequential list of "pages"
@@ -1699,4 +1701,49 @@
int indicatorPos = (int) (offset * pageWidth) + pageOffset + indicatorCenterOffset;
mScrollIndicator.setTranslationX(indicatorPos);
}
+
+ /* Accessibility */
+ @Override
+ public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
+ super.onInitializeAccessibilityNodeInfo(info);
+ info.setScrollable(true);
+ }
+
+ @Override
+ public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
+ super.onInitializeAccessibilityEvent(event);
+ event.setScrollable(true);
+ if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_SCROLLED) {
+ event.setFromIndex(mCurrentPage);
+ event.setToIndex(mCurrentPage);
+ event.setItemCount(getChildCount());
+ }
+ }
+
+ @Override
+ public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
+ // Do not append text content to scroll events they are fired frequently
+ // and the client has already received another event type with the text.
+ if (event.getEventType() != AccessibilityEvent.TYPE_VIEW_SCROLLED) {
+ super.dispatchPopulateAccessibilityEvent(event);
+ }
+
+ onPopulateAccessibilityEvent(event);
+ return false;
+ }
+
+ @Override
+ public void onPopulateAccessibilityEvent(AccessibilityEvent event) {
+ super.onPopulateAccessibilityEvent(event);
+
+ if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_SCROLLED) {
+ event.getText().add(getCurrentPageDescription());
+ }
+ }
+
+ protected String getCurrentPageDescription() {
+ int page = (mNextPage != INVALID_PAGE) ? mNextPage : mCurrentPage;
+ return String.format(mContext.getString(R.string.default_scroll_format),
+ page + 1, getChildCount());
+ }
}
diff --git a/src/com/android/launcher2/PagedViewWidget.java b/src/com/android/launcher2/PagedViewWidget.java
index 365965d..d9c2a84 100644
--- a/src/com/android/launcher2/PagedViewWidget.java
+++ b/src/com/android/launcher2/PagedViewWidget.java
@@ -105,6 +105,7 @@
image.setMaxWidth(maxWidth);
}
image.setImageDrawable(preview);
+ image.setContentDescription(info.label);
mPreviewImageView = image;
final TextView name = (TextView) findViewById(R.id.widget_name);
name.setText(info.label);
@@ -117,11 +118,13 @@
public void applyFromResolveInfo(PackageManager pm, ResolveInfo info,
FastBitmapDrawable preview, HolographicOutlineHelper holoOutlineHelper) {
mHolographicOutlineHelper = holoOutlineHelper;
+ CharSequence label = info.loadLabel(pm);
final ImageView image = (ImageView) findViewById(R.id.widget_preview);
image.setImageDrawable(preview);
+ image.setContentDescription(label);
mPreviewImageView = image;
final TextView name = (TextView) findViewById(R.id.widget_name);
- name.setText(info.loadLabel(pm));
+ name.setText(label);
name.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
final TextView dims = (TextView) findViewById(R.id.widget_dims);
if (dims != null) {
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index a4e162f..e53768d 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -415,10 +415,10 @@
* @return The open folder on the current screen, or null if there is none
*/
Folder getOpenFolder() {
- ViewGroup currentPage = ((CellLayout) getChildAt(mCurrentPage)).getChildrenLayout();
- int count = currentPage.getChildCount();
+ DragLayer dragLayer = (DragLayer) mLauncher.findViewById(R.id.drag_layer);
+ int count = dragLayer.getChildCount();
for (int i = 0; i < count; i++) {
- View child = currentPage.getChildAt(i);
+ View child = dragLayer.getChildAt(i);
if (child instanceof Folder) {
Folder folder = (Folder) child;
if (folder.getInfo().opened)
@@ -428,26 +428,6 @@
return null;
}
- ArrayList<Folder> getOpenFolders() {
- final int screenCount = getChildCount();
- ArrayList<Folder> folders = new ArrayList<Folder>(screenCount);
-
- for (int screen = 0; screen < screenCount; screen++) {
- ViewGroup currentPage = ((CellLayout) getChildAt(screen)).getChildrenLayout();
- int count = currentPage.getChildCount();
- for (int i = 0; i < count; i++) {
- View child = currentPage.getChildAt(i);
- if (child instanceof Folder) {
- Folder folder = (Folder) child;
- if (folder.getInfo().opened)
- folders.add(folder);
- break;
- }
- }
- }
- return folders;
- }
-
boolean isTouchActive() {
return mTouchState != TOUCH_STATE_REST;
}
@@ -3497,4 +3477,11 @@
@Override
public void syncPageItems(int page) {
}
+
+ @Override
+ protected String getCurrentPageDescription() {
+ int page = (mNextPage != INVALID_PAGE) ? mNextPage : mCurrentPage;
+ return String.format(mContext.getString(R.string.workspace_scroll_format),
+ page + 1, getChildCount());
+ }
}