Bug 855471 - Rename OnInterceptTouchListener to TouchEventInterceptor. r=mfinkle
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 28 Mar 2013 12:40:06 -0400
changeset 126577 8d6834c316fe40a289645f89c69a026c97677f81
parent 126576 70896d62e7d3f3779f49e0b6ff115716cb988a52
child 126578 c69d74aecb032cdcc87d82f442a1c3189650ce2f
push id24488
push userryanvm@gmail.com
push dateFri, 29 Mar 2013 00:54:52 +0000
treeherdermozilla-central@8aeabe064932 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs855471
milestone22.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 855471 - Rename OnInterceptTouchListener to TouchEventInterceptor. r=mfinkle
mobile/android/base/BrowserApp.java
mobile/android/base/GeckoApp.java
mobile/android/base/Makefile.in
mobile/android/base/OnInterceptTouchListener.java
mobile/android/base/TouchEventInterceptor.java
mobile/android/base/gfx/LayerView.java
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -433,17 +433,17 @@ abstract public class BrowserApp extends
     public void onCreate(Bundle savedInstanceState) {
         mAboutHomeStartupTimer = new Telemetry.Timer("FENNEC_STARTUP_TIME_ABOUTHOME");
 
         super.onCreate(savedInstanceState);
 
         LinearLayout actionBar = (LinearLayout) getActionBarLayout();
         mMainLayout.addView(actionBar, 2);
 
-        ((GeckoApp.MainLayout) mMainLayout).setOnInterceptTouchListener(new HideTabsTouchListener());
+        ((GeckoApp.MainLayout) mMainLayout).setTouchEventInterceptor(new HideTabsTouchListener());
 
         mBrowserToolbar = new BrowserToolbar(this);
         mBrowserToolbar.from(actionBar);
 
         // Intercept key events for gamepad shortcuts
         actionBar.setOnKeyListener(this);
 
         if (mTabsPanel != null) {
@@ -1166,17 +1166,17 @@ abstract public class BrowserApp extends
                 findViewById(R.id.abouthome_content).setVisibility(View.GONE);
             }
 
             // Refresh margins to possibly restore the toolbar padding
             ((BrowserToolbarLayout)mBrowserToolbar.getLayout()).refreshMargins();
         }
     }
 
-    private class HideTabsTouchListener implements OnInterceptTouchListener {
+    private class HideTabsTouchListener implements TouchEventInterceptor {
         private boolean mIsHidingTabs = false;
 
         @Override
         public boolean onInterceptTouchEvent(View view, MotionEvent event) {
             // We need to account for scroll state for the touched view otherwise
             // tapping on an "empty" part of the view will still be considered a
             // valid touch event.
             if (view.getScrollX() != 0 || view.getScrollY() != 0) {
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -105,17 +105,17 @@ import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 abstract public class GeckoApp
                 extends GeckoActivity 
                 implements GeckoEventListener, SensorEventListener, LocationListener,
                            Tabs.OnTabsChangedListener, GeckoEventResponder,
                            GeckoMenu.Callback, GeckoMenu.MenuPresenter,
-                           OnInterceptTouchListener
+                           TouchEventInterceptor
 {
     private static final String LOGTAG = "GeckoApp";
 
     public static enum StartupMode {
         NORMAL,
         NEW_VERSION,
         NEW_PROFILE
     }
@@ -2463,38 +2463,39 @@ abstract public class GeckoApp
             }
         }
 
         GeckoAppShell.sendEventToGecko(GeckoEvent.createMotionEvent(event));
         return true;
     }
 
     public static class MainLayout extends RelativeLayout {
-        private OnInterceptTouchListener mOnInterceptTouchListener;
+        private TouchEventInterceptor mTouchEventInterceptor;
 
         public MainLayout(Context context, AttributeSet attrs) {
             super(context, attrs);
-            mOnInterceptTouchListener = null;
         }
 
-        public void setOnInterceptTouchListener(OnInterceptTouchListener listener) {
-            mOnInterceptTouchListener = listener;
+        public void setTouchEventInterceptor(TouchEventInterceptor interceptor) {
+            mTouchEventInterceptor = interceptor;
         }
 
         @Override
         public boolean onInterceptTouchEvent(MotionEvent event) {
-            if (mOnInterceptTouchListener != null && mOnInterceptTouchListener.onInterceptTouchEvent(this, event))
+            if (mTouchEventInterceptor != null && mTouchEventInterceptor.onInterceptTouchEvent(this, event)) {
                 return true;
+            }
             return super.onInterceptTouchEvent(event);
         }
 
         @Override
         public boolean onTouchEvent(MotionEvent event) {
-            if (mOnInterceptTouchListener != null && mOnInterceptTouchListener.onTouch(this, event))
+            if (mTouchEventInterceptor != null && mTouchEventInterceptor.onTouch(this, event)) {
                 return true;
+            }
             return super.onTouchEvent(event);
         }
 
         @Override
         public void setDrawingCacheEnabled(boolean enabled) {
             // Instead of setting drawing cache in the view itself, we simply
             // enable drawing caching on its children. This is mainly used in
             // animations (see PropertyAnimator)
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -121,17 +121,16 @@ FENNEC_JAVA_FILES = \
   MenuPanel.java \
   MenuPopup.java \
   MultiChoicePreference.java \
   NotificationClient.java \
   NotificationHandler.java \
   NotificationService.java \
   NSSBridge.java \
   CustomEditText.java \
-  OnInterceptTouchListener.java \
   PrefsHelper.java \
   PrivateDataPreference.java \
   PrivateTab.java \
   PropertyAnimator.java \
   ProfileMigrator.java \
   PromptService.java \
   sqlite/ByteBufferInputStream.java \
   sqlite/MatrixBlobCursor.java \
@@ -153,16 +152,17 @@ FENNEC_JAVA_FILES = \
   TabsPanel.java \
   TabsTray.java \
   TabsAccessor.java \
   TailTouchDelegate.java \
   Telemetry.java \
   TextSelection.java \
   TextSelectionHandle.java \
   ThumbnailHelper.java \
+  TouchEventInterceptor.java \
   VideoPlayer.java \
   WebAppAllocator.java \
   ZoomConstraints.java \
   gfx/Axis.java \
   gfx/BitmapUtils.java \
   gfx/BufferedCairoImage.java \
   gfx/CairoGLInfo.java \
   gfx/CairoImage.java \
rename from mobile/android/base/OnInterceptTouchListener.java
rename to mobile/android/base/TouchEventInterceptor.java
--- a/mobile/android/base/OnInterceptTouchListener.java
+++ b/mobile/android/base/TouchEventInterceptor.java
@@ -3,12 +3,12 @@
  * 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;
 
 import android.view.MotionEvent;
 import android.view.View;
 
-public interface OnInterceptTouchListener extends View.OnTouchListener {
+public interface TouchEventInterceptor extends View.OnTouchListener {
     /** Override this method for a chance to consume events before the view or its children */
     public boolean onInterceptTouchEvent(View view, MotionEvent event);
 }
--- a/mobile/android/base/gfx/LayerView.java
+++ b/mobile/android/base/gfx/LayerView.java
@@ -1,21 +1,21 @@
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
  * 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.gfx;
 
+import org.mozilla.gecko.GeckoAccessibility;
 import org.mozilla.gecko.GeckoApp;
-import org.mozilla.gecko.OnInterceptTouchListener;
 import org.mozilla.gecko.R;
+import org.mozilla.gecko.TouchEventInterceptor;
 import org.mozilla.gecko.ZoomConstraints;
 import org.mozilla.gecko.util.EventDispatcher;
-import org.mozilla.gecko.GeckoAccessibility;
 
 import android.content.Context;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.graphics.Color;
 import android.graphics.PixelFormat;
 import android.graphics.PointF;
 import android.graphics.Rect;
@@ -54,17 +54,17 @@ public class LayerView extends FrameLayo
     private int mPaintState;
     private int mBackgroundColor;
     private boolean mFullScreen;
 
     private SurfaceView mSurfaceView;
     private TextureView mTextureView;
 
     private Listener mListener;
-    private OnInterceptTouchListener mTouchIntercepter;
+    private TouchEventInterceptor mTouchInterceptor;
 
     /* Flags used to determine when to show the painted surface. */
     public static final int PAINT_START = 0;
     public static final int PAINT_BEFORE_FIRST = 1;
     public static final int PAINT_AFTER_FIRST = 2;
 
     public boolean shouldUseTextureView() {
         // Disable TextureView support for now as it causes panning/zooming
@@ -124,48 +124,48 @@ public class LayerView extends FrameLayo
         if (mLayerClient != null) {
             mLayerClient.destroy();
         }
         if (mRenderer != null) {
             mRenderer.destroy();
         }
     }
 
-    public void setTouchIntercepter(final OnInterceptTouchListener touchIntercepter) {
+    public void setTouchIntercepter(final TouchEventInterceptor touchInterceptor) {
         // this gets run on the gecko thread, but for thread safety we want the assignment
         // on the UI thread.
         post(new Runnable() {
             @Override
             public void run() {
-                mTouchIntercepter = touchIntercepter;
+                mTouchInterceptor = touchInterceptor;
             }
         });
     }
 
     @Override
     public boolean onTouchEvent(MotionEvent event) {
         if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
             requestFocus();
         }
 
-        if (mTouchIntercepter != null && mTouchIntercepter.onInterceptTouchEvent(this, event)) {
+        if (mTouchInterceptor != null && mTouchInterceptor.onInterceptTouchEvent(this, event)) {
             return true;
         }
         if (mPanZoomController != null && mPanZoomController.onTouchEvent(event)) {
             return true;
         }
-        if (mTouchIntercepter != null && mTouchIntercepter.onTouch(this, event)) {
+        if (mTouchInterceptor != null && mTouchInterceptor.onTouch(this, event)) {
             return true;
         }
         return false;
     }
 
     @Override
     public boolean onHoverEvent(MotionEvent event) {
-        if (mTouchIntercepter != null && mTouchIntercepter.onTouch(this, event)) {
+        if (mTouchInterceptor != null && mTouchInterceptor.onTouch(this, event)) {
             return true;
         }
         return false;
     }
 
     @Override
     public boolean onGenericMotionEvent(MotionEvent event) {
         if (mPanZoomController != null && mPanZoomController.onMotionEvent(event)) {