Bug 899550 - Disable editing mode animations on pre-Honeycomb devices (r=sriram)
authorLucas Rocha <lucasr@mozilla.com>
Thu, 15 Aug 2013 20:24:05 +0100
changeset 143543 5b87508c0148f4757207521d5ab9a41392618af8
parent 143542 ed952cface7e8dc9ce4547086344889f9c2e6468
child 143544 1b57558f86194acb700792ecfde7ab8035302139
push id25130
push userlrocha@mozilla.com
push dateWed, 21 Aug 2013 09:41:27 +0000
treeherdermozilla-central@b2486721572e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssriram
bugs899550
milestone26.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 899550 - Disable editing mode animations on pre-Honeycomb devices (r=sriram)
mobile/android/base/BrowserToolbar.java
mobile/android/base/home/HomePager.java
--- a/mobile/android/base/BrowserToolbar.java
+++ b/mobile/android/base/BrowserToolbar.java
@@ -1274,28 +1274,44 @@ public class BrowserToolbar extends Geck
     public void startEditing(String url, PropertyAnimator animator) {
         if (isEditing()) {
             return;
         }
 
         mUrlEditText.setText(url != null ? url : "");
         mIsEditing = true;
 
+        final int entryTranslation = getUrlBarEntryTranslation();
+        final int curveTranslation = getUrlBarCurveTranslation();
+
         // This animation doesn't make much sense in a sidebar UI
-        if (HardwareUtils.isTablet()) {
+        if (HardwareUtils.isTablet() || Build.VERSION.SDK_INT < 11) {
             showUrlEditContainer();
+
+            if (!HardwareUtils.isTablet()) {
+                if (mUrlBarRightEdge != null) {
+                    ViewHelper.setTranslationX(mUrlBarRightEdge, entryTranslation);
+                }
+
+                ViewHelper.setTranslationX(mTabs, curveTranslation);
+                ViewHelper.setTranslationX(mTabsCounter, curveTranslation);
+                ViewHelper.setTranslationX(mActionItemBar, curveTranslation);
+
+                if (mHasSoftMenuButton) {
+                    ViewHelper.setTranslationX(mMenu, curveTranslation);
+                    ViewHelper.setTranslationX(mMenuIcon, curveTranslation);
+                }
+            }
+
             return;
         }
 
         if (mAnimatingEntry)
             return;
 
-        final int entryTranslation = getUrlBarEntryTranslation();
-        final int curveTranslation = getUrlBarCurveTranslation();
-
         // Highlight the toolbar from the start of the animation.
         setSelected(true);
 
         // Hide page actions/stop buttons immediately
         ViewHelper.setAlpha(mPageActionLayout, 0);
         ViewHelper.setAlpha(mStop, 0);
 
         // Slide the right side elements of the toolbar
@@ -1366,19 +1382,35 @@ public class BrowserToolbar extends Geck
 
     private String stopEditing() {
         final String url = mUrlEditText.getText().toString();
         if (!isEditing()) {
             return url;
         }
         mIsEditing = false;
 
-        if (HardwareUtils.isTablet()) {
+        if (HardwareUtils.isTablet() || Build.VERSION.SDK_INT < 11) {
             hideUrlEditContainer();
             updateTabCountAndAnimate(Tabs.getInstance().getDisplayCount());
+
+            if (!HardwareUtils.isTablet()) {
+                if (mUrlBarRightEdge != null) {
+                    ViewHelper.setTranslationX(mUrlBarRightEdge, 0);
+                }
+
+                ViewHelper.setTranslationX(mTabs, 0);
+                ViewHelper.setTranslationX(mTabsCounter, 0);
+                ViewHelper.setTranslationX(mActionItemBar, 0);
+
+                if (mHasSoftMenuButton) {
+                    ViewHelper.setTranslationX(mMenu, 0);
+                    ViewHelper.setTranslationX(mMenuIcon, 0);
+                }
+            }
+
             return url;
         }
 
         final PropertyAnimator contentAnimator = new PropertyAnimator(250);
         contentAnimator.setUseHardwareLayer(false);
 
         // Shrink the urlbar entry back to its original size
 
--- a/mobile/android/base/home/HomePager.java
+++ b/mobile/android/base/home/HomePager.java
@@ -5,16 +5,17 @@
 
 package org.mozilla.gecko.home;
 
 import org.mozilla.gecko.R;
 import org.mozilla.gecko.animation.PropertyAnimator;
 import org.mozilla.gecko.animation.ViewHelper;
 
 import android.content.Context;
+import android.os.Build;
 import android.os.Bundle;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentManager;
 import android.support.v4.app.FragmentStatePagerAdapter;
 import android.support.v4.view.PagerAdapter;
 import android.support.v4.view.ViewPager;
 import android.view.ViewGroup.LayoutParams;
 import android.util.AttributeSet;
@@ -121,17 +122,17 @@ public class HomePager extends ViewPager
         adapter.addTab(Page.BOOKMARKS, BookmarksPage.class, null, getContext().getString(R.string.bookmarks_title));
         adapter.addTab(Page.READING_LIST, ReadingListPage.class, null, getContext().getString(R.string.reading_list));
 
         setAdapter(adapter);
 
         setCurrentItem(adapter.getItemPosition(page), false);
         setVisibility(VISIBLE);
 
-        if (animator != null) {
+        if (animator != null && Build.VERSION.SDK_INT >= 11) {
             ViewHelper.setAlpha(this, 0.0f);
 
             animator.attach(this,
                             PropertyAnimator.Property.ALPHA,
                             1.0f);
         }
     }