Bug 869022 - Fade tabs button and menu away when tabs panel is open (r=mfinkle)

This commit is contained in:
Lucas Rocha 2013-05-07 18:19:19 +01:00
parent 778b2d781a
commit a1dc0468c4
4 changed files with 56 additions and 6 deletions

View File

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

View File

@ -86,6 +86,7 @@ public class BrowserToolbar implements Tabs.OnTabsChangedListener,
private TabCounter mTabsCounter;
private ImageView mShadow;
private GeckoImageButton mMenu;
private GeckoImageView mMenuIcon;
private LinearLayout mActionItemBar;
private MenuPopup mMenuPopup;
private List<View> mFocusOrder;
@ -360,11 +361,14 @@ public class BrowserToolbar implements Tabs.OnTabsChangedListener,
mTitleSlideRight.setDuration(lockAnimDuration);
mMenu = (GeckoImageButton) mLayout.findViewById(R.id.menu);
mMenuIcon = (GeckoImageView) mLayout.findViewById(R.id.menu_icon);
mActionItemBar = (LinearLayout) mLayout.findViewById(R.id.menu_items);
mHasSoftMenuButton = !HardwareUtils.hasMenuButton();
if (mHasSoftMenuButton) {
mMenu.setVisibility(View.VISIBLE);
mMenuIcon.setVisibility(View.VISIBLE);
mMenu.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View view) {
@ -954,6 +958,38 @@ public class BrowserToolbar implements Tabs.OnTabsChangedListener,
mLayout.requestFocusFromTouch();
}
public void prepareTabsAnimation(boolean tabsAreShown) {
if (!tabsAreShown) {
return;
}
ViewHelper.setAlpha(mTabsCounter, 0.0f);
if (mHasSoftMenuButton && !HardwareUtils.isTablet()) {
ViewHelper.setAlpha(mMenuIcon, 0.0f);
}
}
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)
@ -1109,6 +1145,7 @@ public class BrowserToolbar implements Tabs.OnTabsChangedListener,
mTabs.setPrivateMode(isPrivate);
mTitle.setPrivateMode(isPrivate);
mMenu.setPrivateMode(isPrivate);
mMenuIcon.setPrivateMode(isPrivate);
if (mBack instanceof BackButton)
((BackButton) mBack).setPrivateMode(isPrivate);

View File

@ -133,14 +133,18 @@
style="@style/AddressBar.ImageButton"
android:layout_width="56dip"
android:layout_alignParentRight="true"
android:gravity="center_vertical"
android:src="@drawable/menu_level"
android:contentDescription="@string/menu"
android:background="@drawable/action_bar_button"
android:paddingLeft="14dip"
android:paddingRight="14dip"
android:visibility="gone"/>
<Gecko.ImageView android:id="@+id/menu_icon"
style="@style/AddressBar.ImageButton"
android:layout_alignLeft="@id/menu"
android:layout_alignRight="@id/menu"
android:gravity="center_vertical"
android:src="@drawable/menu_level"
android:visibility="gone"/>
<ImageView android:id="@+id/shadow"
android:layout_width="fill_parent"
android:layout_height="2dp"

View File

@ -59,12 +59,18 @@
style="@style/AddressBar.ImageButton"
android:layout_width="48dip"
android:layout_alignParentRight="true"
android:gravity="center_vertical"
android:src="@drawable/menu_level"
android:contentDescription="@string/menu"
android:background="@drawable/shaped_button"
android:visibility="gone"/>
<Gecko.ImageView android:id="@+id/menu_icon"
style="@style/AddressBar.ImageButton"
android:layout_alignLeft="@id/menu"
android:layout_alignRight="@id/menu"
android:gravity="center_vertical"
android:src="@drawable/menu_level"
android:visibility="gone"/>
<Gecko.ShapedButton android:id="@+id/tabs"
style="@style/AddressBar.ImageButton"
android:layout_width="72dip"