Bug 877140 - Fade in toolbar buttons while hiding tabs tray (r=mfinkle)

This commit is contained in:
Lucas Rocha 2013-05-30 19:47:44 +01:00
Родитель e5aca3f6c7
Коммит 9610fd4fab
2 изменённых файлов: 20 добавлений и 23 удалений

Просмотреть файл

@ -1098,7 +1098,7 @@ abstract public class BrowserApp extends GeckoApp
}
mTabsPanel.prepareTabsAnimation(mMainLayoutAnimator);
mBrowserToolbar.prepareTabsAnimation(areTabsShown());
mBrowserToolbar.prepareTabsAnimation(mMainLayoutAnimator, areTabsShown());
// If the tabs layout is animating onto the screen, pin the dynamic
// toolbar.
@ -1126,7 +1126,6 @@ abstract public class BrowserApp extends GeckoApp
}
mTabsPanel.finishTabsAnimation();
mBrowserToolbar.finishTabsAnimation(areTabsShown());
mMainLayoutAnimator = null;
}

Просмотреть файл

@ -44,8 +44,10 @@ import android.view.ViewGroup;
import android.view.ViewGroup.MarginLayoutParams;
import android.view.Window;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.AlphaAnimation;
import android.view.animation.Interpolator;
import android.view.animation.TranslateAnimation;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
@ -114,6 +116,7 @@ public class BrowserToolbar implements Tabs.OnTabsChangedListener,
private int mFaviconSize;
private PropertyAnimator mVisibilityAnimator;
private static final Interpolator sButtonsInterpolator = new AccelerateInterpolator();
private static final int TABS_CONTRACTED = 1;
private static final int TABS_EXPANDED = 2;
@ -961,8 +964,23 @@ public class BrowserToolbar implements Tabs.OnTabsChangedListener,
mLayout.requestFocusFromTouch();
}
public void prepareTabsAnimation(boolean tabsAreShown) {
public void prepareTabsAnimation(PropertyAnimator animator, boolean tabsAreShown) {
if (!tabsAreShown) {
PropertyAnimator buttonsAnimator =
new PropertyAnimator(animator.getDuration(), sButtonsInterpolator);
buttonsAnimator.attach(mTabsCounter,
PropertyAnimator.Property.ALPHA,
1.0f);
if (mHasSoftMenuButton && !HardwareUtils.isTablet()) {
buttonsAnimator.attach(mMenuIcon,
PropertyAnimator.Property.ALPHA,
1.0f);
}
buttonsAnimator.start();
return;
}
@ -973,26 +991,6 @@ public class BrowserToolbar implements Tabs.OnTabsChangedListener,
}
}
public void finishTabsAnimation(boolean tabsAreShown) {
if (tabsAreShown) {
return;
}
PropertyAnimator animator = new PropertyAnimator(150);
animator.attach(mTabsCounter,
PropertyAnimator.Property.ALPHA,
1.0f);
if (mHasSoftMenuButton && !HardwareUtils.isTablet()) {
animator.attach(mMenuIcon,
PropertyAnimator.Property.ALPHA,
1.0f);
}
animator.start();
}
public void updateBackButton(boolean enabled) {
Drawable drawable = mBack.getDrawable();
if (drawable != null)