diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2016-06-22 21:34:06 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2016-06-22 21:34:06 +0000 |
commit | 653bfcc7433b10ea2d5dc8cde612d6143af766b8 (patch) | |
tree | ac50fe5bfbdf8d4946d653bc7f46988902715db8 /src/com/android/launcher3/Workspace.java | |
parent | 0c1e7280e270ea0c86a6617499ab411e6199529d (diff) | |
parent | d0a6ae7f645e6ba564aebb50316c53fa2e119459 (diff) | |
download | android_packages_apps_Trebuchet-653bfcc7433b10ea2d5dc8cde612d6143af766b8.tar.gz android_packages_apps_Trebuchet-653bfcc7433b10ea2d5dc8cde612d6143af766b8.tar.bz2 android_packages_apps_Trebuchet-653bfcc7433b10ea2d5dc8cde612d6143af766b8.zip |
Merge "Accessibility fixes and updates" into ub-launcher3-calgary
Diffstat (limited to 'src/com/android/launcher3/Workspace.java')
-rw-r--r-- | src/com/android/launcher3/Workspace.java | 61 |
1 files changed, 21 insertions, 40 deletions
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 1e28785b8..416da3abb 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -60,6 +60,7 @@ import com.android.launcher3.Launcher.CustomContentCallbacks; import com.android.launcher3.Launcher.LauncherOverlay; import com.android.launcher3.UninstallDropTarget.DropTargetSource; import com.android.launcher3.accessibility.LauncherAccessibilityDelegate.AccessibilityDragSource; +import com.android.launcher3.accessibility.OverviewAccessibilityDelegate; import com.android.launcher3.accessibility.OverviewScreenAccessibilityDelegate; import com.android.launcher3.accessibility.WorkspaceAccessibilityHelper; import com.android.launcher3.compat.AppWidgetManagerCompat; @@ -457,6 +458,12 @@ public class Workspace extends PagedView setEdgeGlowColor(getResources().getColor(R.color.workspace_edge_effect_color)); } + @Override + public void initParentViews(View parent) { + super.initParentViews(parent); + mPageIndicator.setAccessibilityDelegate(new OverviewAccessibilityDelegate()); + } + private int getDefaultPage() { return numCustomPages(); } @@ -1444,10 +1451,9 @@ public class Workspace extends PagedView mHotseatAlpha[direction.ordinal()] = alpha; float finalAlpha = mHotseatAlpha[0] * mHotseatAlpha[1]; - View pageIndicator = getPageIndicator(); - if (pageIndicator != null) { - property.set(pageIndicator, translation); - pageIndicator.setAlpha(finalAlpha); + if (mPageIndicator != null) { + property.set(mPageIndicator, translation); + mPageIndicator.setAlpha(alpha); } property.set(mLauncher.getHotseat(), translation); @@ -1646,8 +1652,8 @@ public class Workspace extends PagedView mLauncher.getHotseat().setTranslationX(translationX); } - if (getPageIndicator() != null) { - getPageIndicator().setTranslationX(translationX); + if (mPageIndicator != null) { + mPageIndicator.setTranslationX(translationX); } if (mCustomContentCallbacks != null) { @@ -1656,21 +1662,6 @@ public class Workspace extends PagedView } @Override - protected OnClickListener getPageIndicatorClickListener() { - AccessibilityManager am = (AccessibilityManager) - getContext().getSystemService(Context.ACCESSIBILITY_SERVICE); - if (!am.isTouchExplorationEnabled()) { - return null; - } - return new OnClickListener() { - @Override - public void onClick(View arg0) { - mLauncher.showOverviewMode(true); - } - }; - } - - @Override protected void screenScrolled(int screenCenter) { updatePageAlphaValues(screenCenter); updateStateForCustomContent(screenCenter); @@ -1691,15 +1682,6 @@ public class Workspace extends PagedView } protected void onResume() { - if (getPageIndicator() != null) { - // In case accessibility state has changed, we need to perform this on every - // attach to window - OnClickListener listener = getPageIndicatorClickListener(); - if (listener != null) { - getPageIndicator().setOnClickListener(listener); - } - } - // Update wallpaper dimensions if they were changed since last onResume // (we also always set the wallpaper dimensions in the constructor) if (LauncherAppState.getInstance().hasWallpaperChangedSinceLastCheck()) { @@ -2085,10 +2067,13 @@ public class Workspace extends PagedView IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS); page.setContentDescription(getPageDescription(pageNo)); - if (mPagesAccessibilityDelegate == null) { - mPagesAccessibilityDelegate = new OverviewScreenAccessibilityDelegate(this); + // No custom action for the first page. + if (!FeatureFlags.QSB_ON_FIRST_SCREEN || pageNo > 0) { + if (mPagesAccessibilityDelegate == null) { + mPagesAccessibilityDelegate = new OverviewScreenAccessibilityDelegate(this); + } + page.setAccessibilityDelegate(mPagesAccessibilityDelegate); } - page.setAccessibilityDelegate(mPagesAccessibilityDelegate); } else { int accessible = mState == State.NORMAL ? IMPORTANT_FOR_ACCESSIBILITY_AUTO : @@ -2117,7 +2102,7 @@ public class Workspace extends PagedView @Override public void onLauncherTransitionStart(Launcher l, boolean animated, boolean toWorkspace) { - if (mPageIndicator instanceof PageIndicator) { + if (mPageIndicator != null) { boolean isNewStateSpringLoaded = mState == State.SPRING_LOADED; mPageIndicator.setShouldAutoHide(!isNewStateSpringLoaded); if (isNewStateSpringLoaded) { @@ -4196,7 +4181,7 @@ public class Workspace extends PagedView public interface ItemOperator { /** - * Process the next itemInfo, possibly with side-effect on {@link ItemOperator#value}. + * Process the next itemInfo, possibly with side-effect on the next item. * * @param info info for the shortcut * @param view view for the shortcut @@ -4380,11 +4365,7 @@ public class Workspace extends PagedView exitWidgetResizeMode(); } - protected String getPageIndicatorDescription() { - String settings = getResources().getString(R.string.settings_button_text); - return getCurrentPageDescription() + ", " + settings; - } - + @Override protected String getCurrentPageDescription() { if (hasCustomContent() && getNextPage() == 0) { return mCustomContentDescription; |