summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/BubbleTextView.java
diff options
context:
space:
mode:
authorMady Mellor <madym@google.com>2015-06-03 16:26:34 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-06-03 16:26:35 +0000
commit19b1bad23904a899bd9dc56bf9e2e827619164b1 (patch)
treecccba9465809bafa64bb019177f86b5c7ae2fb20 /src/com/android/launcher3/BubbleTextView.java
parentca51aaad671f1999dff135b1253fecf0869a3763 (diff)
parentef044dd380ac3abf354027750efdc16d5d48ac70 (diff)
downloadandroid_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/BubbleTextView.java')
-rw-r--r--src/com/android/launcher3/BubbleTextView.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 240f7c03f..314c21f64 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -61,6 +61,7 @@ public class BubbleTextView extends TextView {
private final Drawable mBackground;
private final CheckLongPressHelper mLongPressHelper;
private final HolographicOutlineHelper mOutlineHelper;
+ private final StylusEventHelper mStylusEventHelper;
private boolean mBackgroundSizeChanged;
@@ -123,6 +124,7 @@ public class BubbleTextView extends TextView {
}
mLongPressHelper = new CheckLongPressHelper(this);
+ mStylusEventHelper = new StylusEventHelper(this);
mOutlineHelper = HolographicOutlineHelper.obtain(getContext());
if (mCustomShadowsEnabled) {
@@ -234,6 +236,12 @@ public class BubbleTextView extends TextView {
// isPressed() on an ACTION_UP
boolean result = super.onTouchEvent(event);
+ // Check for a stylus button press, if it occurs cancel any long press checks.
+ if (mStylusEventHelper.checkAndPerformStylusEvent(event)) {
+ mLongPressHelper.cancelLongPress();
+ result = true;
+ }
+
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
// So that the pressed outline is visible immediately on setStayPressed(),
@@ -243,7 +251,10 @@ public class BubbleTextView extends TextView {
mPressedBackground = mOutlineHelper.createMediumDropShadow(this);
}
- mLongPressHelper.postCheckForLongPress();
+ // If we're in a stylus button press, don't check for long press.
+ if (!mStylusEventHelper.inStylusButtonPressed()) {
+ mLongPressHelper.postCheckForLongPress();
+ }
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP: