Bug 1312467 - Move touch target size definition into resources r=sebastian
authorAndrzej Hunt <ahunt@mozilla.com>
Tue, 25 Oct 2016 10:48:22 -0700
changeset 320222 b8c538f62798ee9dd4acec1974236adcfc19183e
parent 320221 0f50ce32748d61d73887a676d86540e611f5957c
child 320223 330833c71a86b4c60404f8e16e9a5243f1c95fe1
push id33707
push userahunt@mozilla.com
push dateMon, 31 Oct 2016 14:56:14 +0000
treeherderautoland@a9f1a369aa95 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian
bugs1312467
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1312467 - Move touch target size definition into resources r=sebastian MozReview-Commit-ID: IKDfFyhQAdS
mobile/android/base/java/org/mozilla/gecko/home/activitystream/StreamItem.java
mobile/android/base/resources/values/dimens.xml
--- a/mobile/android/base/java/org/mozilla/gecko/home/activitystream/StreamItem.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/activitystream/StreamItem.java
@@ -107,17 +107,17 @@ public abstract class StreamItem extends
                     DrawableUtil.tintDrawable(menuButton.getContext(), R.drawable.menu, Color.LTGRAY));
 
             itemView.post(new Runnable() {
                 @Override
                 public void run() {
                     Rect delegateArea = new Rect();
                     menuButton.getHitRect(delegateArea);
 
-                    final int targetHitArea = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 40, itemView.getContext().getResources().getDisplayMetrics());;
+                    final int targetHitArea = itemView.getContext().getResources().getDimensionPixelSize(R.dimen.touch_target_size);
 
                     final int widthDelta = (targetHitArea - delegateArea.width()) / 2;
                     delegateArea.right += widthDelta;
                     delegateArea.left -= widthDelta;
 
                     final int heightDelta = (targetHitArea - delegateArea.height()) / 2;
                     delegateArea.bottom += heightDelta;
                     delegateArea.top -= heightDelta;
--- a/mobile/android/base/resources/values/dimens.xml
+++ b/mobile/android/base/resources/values/dimens.xml
@@ -221,9 +221,12 @@
     <item name="activity_stream_desired_tile_width" type="dimen">90dp</item>
     <item name="activity_stream_desired_tile_height" type="dimen">70dp</item>
     <item name="activity_stream_top_sites_text_height" type="dimen">30dp</item>
 
     <item name="activity_stream_contextmenu_peek_height" type="dimen">380dp</item>
     <!-- note: max_menu_height only affects the scrolling menu, but doesnt' take into consideration
          the header above it. -->
     <item name="activity_stream_contextmenu_max_menu_height" type="dimen">350dp</item>
+
+    <!-- Default touch target size for buttons/imageviews that might be of small size -->
+    <item name="touch_target_size" type="dimen">40dp</item>
 </resources>