Bug 889621 - Fade in homepager while expanding URL bar on tap (r=sriram)

This commit is contained in:
Lucas Rocha 2013-07-26 12:46:28 +01:00
parent b1a1af430e
commit 0ab5a6346c
3 changed files with 41 additions and 35 deletions

View File

@ -1313,8 +1313,13 @@ abstract public class BrowserApp extends GeckoApp
}
}
mBrowserToolbar.startEditing(url);
animateShowHomePager(HomePager.Page.VISITED);
final PropertyAnimator animator = new PropertyAnimator(300);
animator.setUseHardwareLayer(false);
mBrowserToolbar.startEditing(url, animator);
showHomePagerWithAnimator(HomePager.Page.VISITED, animator);
animator.start();
}
void commitEditingMode() {
@ -1352,15 +1357,11 @@ abstract public class BrowserApp extends GeckoApp
}
}
private void animateShowHomePager(HomePager.Page page) {
showHomePagerWithAnimation(true, page);
}
private void showHomePager(HomePager.Page page) {
showHomePagerWithAnimation(false, page);
showHomePagerWithAnimator(page, null);
}
private void showHomePagerWithAnimation(boolean animate, HomePager.Page page) {
private void showHomePagerWithAnimator(HomePager.Page page, PropertyAnimator animator) {
if (mHomePager.isVisible()) {
return;
}
@ -1374,8 +1375,7 @@ abstract public class BrowserApp extends GeckoApp
mLayerView.getLayerMarginsAnimator().showMargins(true);
}
// FIXME: do animation if animate is true
mHomePager.show(getSupportFragmentManager(), page);
mHomePager.show(getSupportFragmentManager(), page, animator);
}
private void animateHideHomePager() {

View File

@ -1204,7 +1204,7 @@ public class BrowserToolbar extends GeckoRelativeLayout
return isSelected();
}
public void startEditing(String url) {
public void startEditing(String url, PropertyAnimator animator) {
if (isEditing()) {
return;
}
@ -1221,9 +1221,6 @@ public class BrowserToolbar extends GeckoRelativeLayout
if (mAnimatingEntry)
return;
final PropertyAnimator contentAnimator = new PropertyAnimator(250);
contentAnimator.setUseHardwareLayer(false);
final int entryTranslation = getUrlBarEntryTranslation();
final int curveTranslation = getUrlBarCurveTranslation();
@ -1237,32 +1234,32 @@ public class BrowserToolbar extends GeckoRelativeLayout
// Slide the right side elements of the toolbar
if (mUrlBarRightEdge != null) {
contentAnimator.attach(mUrlBarRightEdge,
PropertyAnimator.Property.TRANSLATION_X,
entryTranslation);
animator.attach(mUrlBarRightEdge,
PropertyAnimator.Property.TRANSLATION_X,
entryTranslation);
}
contentAnimator.attach(mTabs,
PropertyAnimator.Property.TRANSLATION_X,
curveTranslation);
contentAnimator.attach(mTabsCounter,
PropertyAnimator.Property.TRANSLATION_X,
curveTranslation);
contentAnimator.attach(mActionItemBar,
PropertyAnimator.Property.TRANSLATION_X,
curveTranslation);
animator.attach(mTabs,
PropertyAnimator.Property.TRANSLATION_X,
curveTranslation);
animator.attach(mTabsCounter,
PropertyAnimator.Property.TRANSLATION_X,
curveTranslation);
animator.attach(mActionItemBar,
PropertyAnimator.Property.TRANSLATION_X,
curveTranslation);
if (mHasSoftMenuButton) {
contentAnimator.attach(mMenu,
PropertyAnimator.Property.TRANSLATION_X,
curveTranslation);
animator.attach(mMenu,
PropertyAnimator.Property.TRANSLATION_X,
curveTranslation);
contentAnimator.attach(mMenuIcon,
PropertyAnimator.Property.TRANSLATION_X,
curveTranslation);
animator.attach(mMenuIcon,
PropertyAnimator.Property.TRANSLATION_X,
curveTranslation);
}
contentAnimator.addPropertyAnimationListener(new PropertyAnimator.PropertyAnimationListener() {
animator.addPropertyAnimationListener(new PropertyAnimator.PropertyAnimationListener() {
@Override
public void onPropertyAnimationStart() {
}
@ -1275,7 +1272,6 @@ public class BrowserToolbar extends GeckoRelativeLayout
});
mAnimatingEntry = true;
contentAnimator.start();
}
/**

View File

@ -6,6 +6,8 @@
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.Bundle;
@ -59,7 +61,7 @@ public class HomePager extends ViewPager {
*
* @param fm FragmentManager for the adapter
*/
public void show(FragmentManager fm, Page page) {
public void show(FragmentManager fm, Page page, PropertyAnimator animator) {
mLoaded = true;
TabsAdapter adapter = new TabsAdapter(fm);
@ -72,6 +74,14 @@ public class HomePager extends ViewPager {
setCurrentItem(adapter.getItemPosition(page), false);
setVisibility(VISIBLE);
if (animator != null) {
ViewHelper.setAlpha(this, 0.0f);
animator.attach(this,
PropertyAnimator.Property.ALPHA,
1.0f);
}
}
/**