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/widget/WidgetCell.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/widget/WidgetCell.java')
-rw-r--r-- | src/com/android/launcher3/widget/WidgetCell.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/com/android/launcher3/widget/WidgetCell.java b/src/com/android/launcher3/widget/WidgetCell.java index 3ec164506..2714f5182 100644 --- a/src/com/android/launcher3/widget/WidgetCell.java +++ b/src/com/android/launcher3/widget/WidgetCell.java @@ -23,6 +23,7 @@ import android.content.res.Resources; import android.graphics.Bitmap; import android.util.AttributeSet; import android.util.Log; +import android.view.MotionEvent; import android.view.View; import android.view.View.OnLayoutChangeListener; import android.widget.LinearLayout; @@ -35,6 +36,7 @@ import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherAppWidgetProviderInfo; import com.android.launcher3.R; +import com.android.launcher3.StylusEventHelper; import com.android.launcher3.WidgetPreviewLoader; import com.android.launcher3.WidgetPreviewLoader.PreviewLoadRequest; import com.android.launcher3.compat.AppWidgetManagerCompat; @@ -73,6 +75,7 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener { private WidgetPreviewLoader mWidgetPreviewLoader; private PreviewLoadRequest mActiveRequest; + private StylusEventHelper mStylusEventHelper; private Launcher mLauncher; @@ -89,6 +92,7 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener { final Resources r = context.getResources(); mLauncher = (Launcher) context; + mStylusEventHelper = new StylusEventHelper(this); mDimensionsFormatString = r.getString(R.string.widget_dims_format); setContainerWidth(); @@ -202,6 +206,15 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener { return Math.min(size[0], info.spanX * cellWidth); } + @Override + public boolean onTouchEvent(MotionEvent ev) { + boolean handled = super.onTouchEvent(ev); + if (mStylusEventHelper.checkAndPerformStylusEvent(ev)) { + return true; + } + return handled; + } + /** * Helper method to get the string info of the tag. */ |