diff options
author | Jon Miranda <jonmiranda@google.com> | 2016-11-07 08:37:20 -0800 |
---|---|---|
committer | Jon Miranda <jonmiranda@google.com> | 2016-11-07 10:11:49 -0800 |
commit | 51f037d674d1113d5a0ced862b8d95ba1c3ff1f8 (patch) | |
tree | 4ec6f0299d2a2eb29eea794f4c4237b52b35268d | |
parent | c48a89e59cc1b874b86590b180ef3fd96d26eac2 (diff) | |
download | android_packages_apps_Trebuchet-51f037d674d1113d5a0ced862b8d95ba1c3ff1f8.tar.gz android_packages_apps_Trebuchet-51f037d674d1113d5a0ced862b8d95ba1c3ff1f8.tar.bz2 android_packages_apps_Trebuchet-51f037d674d1113d5a0ced862b8d95ba1c3ff1f8.zip |
Refactor edge of screen detection code.
There were two resources that both defined the edge of the screen.
Change-Id: I82ab553cc3123ef54ff1f0c692d29f3678ad04ac
-rw-r--r-- | res/values/dimens.xml | 3 | ||||
-rw-r--r-- | src/com/android/launcher3/DeviceProfile.java | 6 | ||||
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 8 |
3 files changed, 5 insertions, 12 deletions
diff --git a/res/values/dimens.xml b/res/values/dimens.xml index b07a400df..188f98fa6 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -179,9 +179,6 @@ also happens to equal 19dp--> <dimen name="deep_shortcuts_arrow_horizontal_offset">19dp</dimen> -<!-- Touch handling --> - <dimen name="edge_of_screen_threshold">8dp</dimen> - <!-- Other --> <!-- Approximates the system status bar height. Not guaranteed to be always be correct. --> <dimen name="status_bar_height">24dp</dimen> diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index d92f659d5..cc21920b0 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -612,10 +612,10 @@ public class DeviceProfile { return new int[]{ padding, padding }; } - public boolean shouldIgnoreLongPressToOverview(float touchX, float edgeThreshold) { + public boolean shouldIgnoreLongPressToOverview(float touchX) { boolean inMultiWindowMode = this != inv.landscapeProfile && this != inv.portraitProfile; - boolean touchedLhsEdge = mInsets.left == 0 && touchX < edgeThreshold; - boolean touchedRhsEdge = mInsets.right == 0 && touchX > (widthPx - edgeThreshold); + boolean touchedLhsEdge = mInsets.left == 0 && touchX < edgeMarginPx; + boolean touchedRhsEdge = mInsets.right == 0 && touchX > (widthPx - edgeMarginPx); return !inMultiWindowMode && (touchedLhsEdge || touchedRhsEdge); } } diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 9a42513b4..0540249b6 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -316,7 +316,6 @@ public class Launcher extends Activity private UserEventDispatcher mUserEventDispatcher; private float mLastDispatchTouchEventX = 0.0f; - private float mEdgeOfScreenThresholdPx = 0.0f; public ViewGroupFocusHelper mFocusHandler; private boolean mRotationEnabled = false; @@ -395,9 +394,6 @@ public class Launcher extends Activity setContentView(R.layout.launcher); - mEdgeOfScreenThresholdPx = getResources() - .getDimensionPixelSize(R.dimen.edge_of_screen_threshold); - setupViews(); mDeviceProfile.layout(this, false /* notifyListeners */); mExtractedColors = new ExtractedColors(); @@ -2718,8 +2714,8 @@ public class Launcher extends Activity } - boolean ignoreLongPressToOverview = mDeviceProfile.shouldIgnoreLongPressToOverview( - mLastDispatchTouchEventX, mEdgeOfScreenThresholdPx); + boolean ignoreLongPressToOverview = + mDeviceProfile.shouldIgnoreLongPressToOverview(mLastDispatchTouchEventX); if (v instanceof Workspace) { if (!mWorkspace.isInOverviewMode()) { |