Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Side by Side Diff: ui/android/java/src/org/chromium/ui/gfx/ViewConfigurationHelper.java

Issue 340343013: Provide max gesture bounds and option to ignore touch size during pinch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/events/gesture_detection/gesture_config_helper_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.ui.gfx; 5 package org.chromium.ui.gfx;
6 6
7 import android.content.ComponentCallbacks; 7 import android.content.ComponentCallbacks;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.res.Configuration; 9 import android.content.res.Configuration;
10 import android.content.res.Resources; 10 import android.content.res.Resources;
11 import android.os.Build;
11 import android.util.TypedValue; 12 import android.util.TypedValue;
12 import android.view.ViewConfiguration; 13 import android.view.ViewConfiguration;
13 14
14 import org.chromium.base.CalledByNative; 15 import org.chromium.base.CalledByNative;
15 import org.chromium.base.JNINamespace; 16 import org.chromium.base.JNINamespace;
16 import org.chromium.ui.R; 17 import org.chromium.ui.R;
17 18
18 /** 19 /**
19 * This class facilitates access to ViewConfiguration-related properties, also 20 * This class facilitates access to ViewConfiguration-related properties, also
20 * providing native-code notifications when such properties have changed. 21 * providing native-code notifications when such properties have changed.
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 try { 130 try {
130 return res.getDimensionPixelSize(id); 131 return res.getDimensionPixelSize(id);
131 } catch (Resources.NotFoundException e) { 132 } catch (Resources.NotFoundException e) {
132 assert false : "MinScalingTouchMajor resource lookup failed."; 133 assert false : "MinScalingTouchMajor resource lookup failed.";
133 return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 134 return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
134 MIN_SCALING_TOUCH_MAJOR_DIP, res.getDisplayMetrics()); 135 MIN_SCALING_TOUCH_MAJOR_DIP, res.getDisplayMetrics());
135 } 136 }
136 } 137 }
137 138
138 @CalledByNative 139 @CalledByNative
140 private static boolean shouldUseTouchMajorInScalingSpan() {
141 // Android's ScaleGestureDetector started using touch major values in
142 // JBMR1. Many devices from versions prior report wildly inconsistent
143 // touch sizes, so disable touch major use in such scenarios.
144 return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1;
145 }
146
147 @CalledByNative
139 private static ViewConfigurationHelper createWithListener(Context context) { 148 private static ViewConfigurationHelper createWithListener(Context context) {
140 ViewConfigurationHelper viewConfigurationHelper = new ViewConfigurationH elper(context); 149 ViewConfigurationHelper viewConfigurationHelper = new ViewConfigurationH elper(context);
141 viewConfigurationHelper.registerListener(); 150 viewConfigurationHelper.registerListener();
142 return viewConfigurationHelper; 151 return viewConfigurationHelper;
143 } 152 }
144 153
145 private native void nativeUpdateSharedViewConfiguration( 154 private native void nativeUpdateSharedViewConfiguration(
146 int scaledMaximumFlingVelocity, int scaledMinimumFlingVelocity, 155 int scaledMaximumFlingVelocity, int scaledMinimumFlingVelocity,
147 int scaledTouchSlop, int scaledDoubleTapSlop, 156 int scaledTouchSlop, int scaledDoubleTapSlop,
148 int scaledMinScalingSpan, int scaledMinScalingTouchMajor); 157 int scaledMinScalingSpan, int scaledMinScalingTouchMajor);
149 } 158 }
OLDNEW
« no previous file with comments | « no previous file | ui/events/gesture_detection/gesture_config_helper_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698