diff options
author | Mady Mellor <madym@google.com> | 2015-06-03 16:26:34 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-03 16:26:35 +0000 |
commit | 19b1bad23904a899bd9dc56bf9e2e827619164b1 (patch) | |
tree | cccba9465809bafa64bb019177f86b5c7ae2fb20 /src/com/android/launcher3/CellLayout.java | |
parent | ca51aaad671f1999dff135b1253fecf0869a3763 (diff) | |
parent | ef044dd380ac3abf354027750efdc16d5d48ac70 (diff) | |
download | android_packages_apps_Trebuchet-19b1bad23904a899bd9dc56bf9e2e827619164b1.tar.gz android_packages_apps_Trebuchet-19b1bad23904a899bd9dc56bf9e2e827619164b1.tar.bz2 android_packages_apps_Trebuchet-19b1bad23904a899bd9dc56bf9e2e827619164b1.zip |
Merge "Stylus support: creating and setting listeners for stylus button press" into ub-launcher3-burnaby
Diffstat (limited to 'src/com/android/launcher3/CellLayout.java')
-rw-r--r-- | src/com/android/launcher3/CellLayout.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java index ff7bcc43b..b5d0dca24 100644 --- a/src/com/android/launcher3/CellLayout.java +++ b/src/com/android/launcher3/CellLayout.java @@ -95,6 +95,7 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { boolean[][] mTmpOccupied; private OnTouchListener mInterceptTouchListener; + private StylusEventHelper mStylusEventHelper; private ArrayList<FolderRingAnimator> mFolderOuterRings = new ArrayList<FolderRingAnimator>(); private int[] mFolderLeaveBehindCell = {-1, -1}; @@ -284,6 +285,8 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { mShortcutsAndWidgets.setCellDimensions(mCellWidth, mCellHeight, mWidthGap, mHeightGap, mCountX, mCountY); + mStylusEventHelper = new StylusEventHelper(this); + mTouchFeedbackView = new ClickShadowView(context); addView(mTouchFeedbackView); addView(mShortcutsAndWidgets); @@ -336,6 +339,20 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { return false; } + @Override + public boolean onTouchEvent(MotionEvent ev) { + boolean handled = super.onTouchEvent(ev); + // Stylus button press on a home screen should not switch between overview mode and + // the home screen mode, however, once in overview mode stylus button press should be + // enabled to allow rearranging the different home screens. So check what mode + // the workspace is in, and only perform stylus button presses while in overview mode. + if (mLauncher.mWorkspace.isInOverviewMode() + && mStylusEventHelper.checkAndPerformStylusEvent(ev)) { + return true; + } + return handled; + } + public void enableHardwareLayer(boolean hasLayer) { mShortcutsAndWidgets.setLayerType(hasLayer ? LAYER_TYPE_HARDWARE : LAYER_TYPE_NONE, sPaint); } |