mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-27 10:50:35 +00:00
Bug 825176 - Use margin to hide forward button. r=sriram
This commit is contained in:
parent
de0f6a8bf2
commit
3b55ea9fe1
@ -100,6 +100,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
|
||||
private int mAddressBarViewOffset;
|
||||
private int mAddressBarViewOffsetNoForward;
|
||||
private int mDefaultForwardMargin;
|
||||
private PropertyAnimator mForwardAnim = null;
|
||||
|
||||
private int mCount;
|
||||
@ -134,6 +135,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
mAddressBarView = mLayout.findViewById(R.id.addressbar);
|
||||
mAddressBarViewOffset = mActivity.getResources().getDimensionPixelSize(R.dimen.addressbar_offset_left);
|
||||
mAddressBarViewOffsetNoForward = mActivity.getResources().getDimensionPixelSize(R.dimen.addressbar_offset_left_noforward);
|
||||
mDefaultForwardMargin = mActivity.getResources().getDimensionPixelSize(R.dimen.forward_default_offset);
|
||||
mAwesomeBarRightEdge = (GeckoFrameLayout) mLayout.findViewById(R.id.awesome_bar_right_edge);
|
||||
mAwesomeBarEntry = mLayout.findViewById(R.id.awesome_bar_entry);
|
||||
|
||||
@ -1004,7 +1006,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
return;
|
||||
|
||||
mForwardAnim = new PropertyAnimator(FORWARD_ANIMATION_DURATION);
|
||||
final int width = enabled ? mForward.getWidth()/2 : 0;
|
||||
final int width = mForward.getWidth()/2;
|
||||
|
||||
mForwardAnim.setPropertyAnimationListener(new PropertyAnimator.PropertyAnimationListener() {
|
||||
@Override
|
||||
@ -1036,20 +1038,27 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
proxy = AnimatorProxy.create(mSiteSecurity);
|
||||
proxy.setTranslationX(0);
|
||||
|
||||
mAddressBarView.requestLayout();
|
||||
}
|
||||
|
||||
ViewGroup.MarginLayoutParams layoutParams =
|
||||
(ViewGroup.MarginLayoutParams)mForward.getLayoutParams();
|
||||
layoutParams.leftMargin = mDefaultForwardMargin + (mForward.isEnabled() ? mForward.getWidth()/2 : 0);
|
||||
AnimatorProxy proxy = AnimatorProxy.create(mForward);
|
||||
proxy.setTranslationX(0);
|
||||
|
||||
mAddressBarView.requestLayout();
|
||||
mForwardAnim = null;
|
||||
}
|
||||
});
|
||||
prepareForwardAnimation(mForwardAnim, width);
|
||||
prepareForwardAnimation(mForwardAnim, enabled, width);
|
||||
mForwardAnim.start();
|
||||
}
|
||||
|
||||
private void prepareForwardAnimation(PropertyAnimator anim, int width) {
|
||||
if (width == 0) {
|
||||
private void prepareForwardAnimation(PropertyAnimator anim, boolean enabled, int width) {
|
||||
if (!enabled) {
|
||||
anim.attach(mForward,
|
||||
PropertyAnimator.Property.TRANSLATION_X,
|
||||
0);
|
||||
-1*width);
|
||||
anim.attach(mForward,
|
||||
PropertyAnimator.Property.ALPHA,
|
||||
0);
|
||||
|
@ -42,7 +42,7 @@
|
||||
<item name="android:background">@drawable/address_bar_nav_button</item>
|
||||
<!-- Start with the button hidden -->
|
||||
<item name="android:alpha">0</item>
|
||||
<item name="android:layout_marginLeft">-11dp</item>
|
||||
<item name="android:layout_marginLeft">@dimen/forward_default_offset</item>
|
||||
</style>
|
||||
|
||||
<style name="AddressBar.Button.Container">
|
||||
|
@ -54,6 +54,7 @@
|
||||
<dimen name="validation_message_height">50dp</dimen>
|
||||
<dimen name="validation_message_margin_top">6dp</dimen>
|
||||
<dimen name="widget_padding">8dp</dimen>
|
||||
<dimen name="forward_default_offset">-11dip</dimen>
|
||||
|
||||
<dimen name="addressbar_offset_left">90dp</dimen>
|
||||
<dimen name="addressbar_offset_left_noforward">50dip</dimen>
|
||||
|
Loading…
Reference in New Issue
Block a user