Backout 6ee620315ad4 for causing test timeouts on a CLOSED TREE

This commit is contained in:
Brian Nicholson 2013-05-08 15:47:23 -07:00
parent 7c1561533a
commit 6f7101afa2
4 changed files with 2 additions and 95 deletions

View File

@ -354,9 +354,9 @@ abstract public class BrowserApp extends GeckoApp
// put the focus on the layerview and carry on
if (mLayerView != null && !mLayerView.hasFocus() && GamepadUtils.isPanningControl(event)) {
if (mAboutHome.getUserVisibleHint()) {
mAboutHome.requestFocus();
} else {
mLayerView.requestFocus();
} else {
mAboutHome.requestFocus();
}
}
return false;

View File

@ -146,7 +146,6 @@ FENNEC_JAVA_FILES = \
RemoteTabs.java \
RobocopAPI.java \
ServiceNotificationClient.java \
ScrollAnimator.java \
SessionParser.java \
SetupScreen.java \
ShapedButton.java \

View File

@ -1,87 +0,0 @@
/* -*- 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;
import java.util.Timer;
import java.util.TimerTask;
import org.mozilla.gecko.util.GamepadUtils;
import android.os.Build;
import android.view.InputDevice;
import android.view.MotionEvent;
import android.view.View;
public class ScrollAnimator implements View.OnGenericMotionListener {
private Timer mScrollTimer;
private int mX;
private int mY;
// Assuming 60fps, this will make the view scroll once per frame
static final long MS_PER_FRAME = 1000 / 60;
// Maximum number of pixels that can be scrolled per frame
static final float MAX_SCROLL = 0.075f * GeckoAppShell.getDpi();
private class ScrollRunnable extends TimerTask {
private View mView;
public ScrollRunnable(View view) {
mView = view;
}
@Override
public final void run() {
mView.scrollBy(mX, mY);
}
}
@Override
public boolean onGenericMotion(View view, MotionEvent event) {
// Joystick support was added in API level 12
if (Build.VERSION.SDK_INT >= 12 &&
(event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
switch (event.getAction()) {
case MotionEvent.ACTION_MOVE:
// Cancel the animation if the joystick is in a neutral position
if (GamepadUtils.isValueInDeadZone(event, MotionEvent.AXIS_X) &&
GamepadUtils.isValueInDeadZone(event, MotionEvent.AXIS_Y)) {
if (mScrollTimer != null) {
mScrollTimer.cancel();
mScrollTimer = null;
}
return true;
}
// Scroll with a velocity relative to the screen DPI
mX = (int) (event.getAxisValue(MotionEvent.AXIS_X) * MAX_SCROLL);
mY = (int) (event.getAxisValue(MotionEvent.AXIS_Y) * MAX_SCROLL);
// Start the timer; the view will continue to scroll as long as
// the joystick is not in the deadzone.
if (mScrollTimer == null) {
mScrollTimer = new Timer();
ScrollRunnable task = new ScrollRunnable(view);
mScrollTimer.scheduleAtFixedRate(task, 0, MS_PER_FRAME);
}
return true;
}
}
return false;
}
/**
* Cancels the running scroll animation if it is in progress.
*/
public void cancel() {
if (mScrollTimer != null) {
mScrollTimer.cancel();
mScrollTimer = null;
}
}
}

View File

@ -10,7 +10,6 @@ import java.util.EnumSet;
import org.mozilla.gecko.GeckoApplication;
import org.mozilla.gecko.LightweightTheme;
import org.mozilla.gecko.R;
import org.mozilla.gecko.ScrollAnimator;
import org.mozilla.gecko.db.BrowserContract;
import android.app.Activity;
@ -47,7 +46,6 @@ public class AboutHome extends Fragment {
private LastTabsSection mLastTabsSection;
private RemoteTabsSection mRemoteTabsSection;
private TopSitesView mTopSitesView;
private ScrollAnimator mScrollAnimator;
public interface UriLoadListener {
public void onAboutHomeUriLoad(String uriSpec);
@ -66,7 +64,6 @@ public class AboutHome extends Fragment {
super.onCreate(savedInstanceState);
mLightweightTheme = ((GeckoApplication) getActivity().getApplication()).getLightweightTheme();
mScrollAnimator = new ScrollAnimator();
}
@Override
@ -108,7 +105,6 @@ public class AboutHome extends Fragment {
mAboutHomeView.setLightweightTheme(mLightweightTheme);
mLightweightTheme.addListener(mAboutHomeView);
mAboutHomeView.setOnGenericMotionListener(mScrollAnimator);
return mAboutHomeView;
}
@ -143,7 +139,6 @@ public class AboutHome extends Fragment {
mLightweightTheme.removeListener(mAboutHomeView);
getActivity().getContentResolver().unregisterContentObserver(mTabsContentObserver);
mTopSitesView.onDestroy();
mScrollAnimator.cancel();
mAboutHomeView = null;
mAddonsSection = null;