Skip to content

Commit 1606212

Browse files
adampAndroid (Google) Code Review
authored andcommitted
Merge "Allow more scaling values to be tuned in resource overlays" into jb-mr1-dev
2 parents c0c0c0e + 3307958 commit 1606212

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

core/java/android/view/ScaleGestureDetector.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package android.view;
1818

1919
import android.content.Context;
20+
import android.content.res.Resources;
2021
import android.os.SystemClock;
2122
import android.util.FloatMath;
2223

@@ -162,9 +163,11 @@ public ScaleGestureDetector(Context context, OnScaleGestureListener listener) {
162163
mContext = context;
163164
mListener = listener;
164165
mSpanSlop = ViewConfiguration.get(context).getScaledTouchSlop() * 2;
165-
mTouchMinMajor =
166-
(int) (context.getResources().getDisplayMetrics().density * TOUCH_MIN_MAJOR + 0.5f);
167-
mMinSpan = context.getResources().getDimensionPixelSize(
166+
167+
final Resources res = context.getResources();
168+
mTouchMinMajor = res.getDimensionPixelSize(
169+
com.android.internal.R.dimen.config_minScalingTouchMajor);
170+
mMinSpan = res.getDimensionPixelSize(
168171
com.android.internal.R.dimen.config_minScalingSpan);
169172
}
170173

core/res/res/values/config.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -941,6 +941,10 @@
941941
reported by the hardware. -->
942942
<dimen name="config_minScalingSpan">27mm</dimen>
943943

944+
<!-- Minimum accepted value for touchMajor while scaling. This may be tuned
945+
per-device in overlays. -->
946+
<dimen name="config_minScalingTouchMajor">48dp</dimen>
947+
944948
<!-- Safe headphone volume index. When music stream volume is below this index
945949
the SPL on headphone output is compliant to EN 60950 requirements for portable music
946950
players. -->

core/res/res/values/symbols.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,6 +1150,7 @@
11501150
<java-symbol type="string" name="bluetooth_a2dp_audio_route_name" />
11511151

11521152
<java-symbol type="dimen" name="config_minScalingSpan" />
1153+
<java-symbol type="dimen" name="config_minScalingTouchMajor" />
11531154

11541155
<!-- From android.policy -->
11551156
<java-symbol type="anim" name="app_starting_exit" />

0 commit comments

Comments
 (0)