Bug 1102836 - Only grow close button hit area in new tablet UI (r=mhaigh)
authorLucas Rocha <lucasr@lucasr.org>
Mon, 24 Nov 2014 13:59:56 +0000
changeset 241510 b088ca59509d41376b95100f7b19fdcc6ef86986
parent 241509 22f4453a4f9803ba6db9afdc7cf9ad275f01fcd6
child 241511 18426b83a5f79f311aae17d5931917579c3b4e86
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmhaigh
bugs1102836
milestone36.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 1102836 - Only grow close button hit area in new tablet UI (r=mhaigh)
mobile/android/base/tabs/TabsLayoutItemView.java
--- a/mobile/android/base/tabs/TabsLayoutItemView.java
+++ b/mobile/android/base/tabs/TabsLayoutItemView.java
@@ -1,14 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.tabs;
 
+import org.mozilla.gecko.NewTabletUI;
 import org.mozilla.gecko.R;
 import org.mozilla.gecko.Tab;
 import org.mozilla.gecko.widget.TabThumbnailWrapper;
 
 import android.content.Context;
 import android.graphics.Rect;
 import android.graphics.drawable.Drawable;
 import android.util.AttributeSet;
@@ -84,16 +85,22 @@ public class TabsLayoutItemView extends 
     @Override
     protected void onFinishInflate() {
         super.onFinishInflate();
         mTitle = (TextView) findViewById(R.id.title);
         mThumbnail = (ImageView) findViewById(R.id.thumbnail);
         mCloseButton = (ImageButton) findViewById(R.id.close);
         mThumbnailWrapper = (TabThumbnailWrapper) findViewById(R.id.wrapper);
 
+        if (NewTabletUI.isEnabled(getContext())) {
+            growCloseButtonHitArea();
+        }
+    }
+
+    private void growCloseButtonHitArea() {
         getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
             @Override
             public boolean onPreDraw() {
                 getViewTreeObserver().removeOnPreDrawListener(this);
 
                 final Rect hitRect = new Rect();
                 mCloseButton.getHitRect(hitRect);