Backout 0e96545f0894 & 55ae87306b98 (bug 681805) for Android startup crashes on a CLOSED TREE

This commit is contained in:
Ed Morley 2012-12-19 18:25:55 +00:00
parent 90820c1548
commit 21bf9e2a0e
13 changed files with 79 additions and 197 deletions

View File

@ -55,7 +55,6 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
private int mAwesomeBarEntryRightMargin;
private GeckoFrameLayout mAwesomeBarRightEdge;
private BrowserToolbarBackground mAddressBarBg;
private View mAddressBarView;
private BrowserToolbarBackground.CurveTowards mAddressBarBgCurveTowards;
private int mAddressBarBgRightMargin;
private GeckoTextView mTitle;
@ -98,18 +97,12 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
private TranslateAnimation mTitleSlideLeft;
private TranslateAnimation mTitleSlideRight;
private int mAddressBarViewOffset;
private int mAddressBarViewOffsetNoForward;
private PropertyAnimator mForwardAnim = null;
private int mCount;
private int mFaviconSize;
private static final int TABS_CONTRACTED = 1;
private static final int TABS_EXPANDED = 2;
private static final int FORWARD_ANIMATION_DURATION = 450;
public BrowserToolbar(BrowserApp activity) {
// BrowserToolbar is attached to BrowserApp only.
mActivity = activity;
@ -131,9 +124,6 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
mShowReader = false;
mAddressBarBg = (BrowserToolbarBackground) mLayout.findViewById(R.id.address_bar_bg);
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);
mAwesomeBarRightEdge = (GeckoFrameLayout) mLayout.findViewById(R.id.awesome_bar_right_edge);
mAwesomeBarEntry = mLayout.findViewById(R.id.awesome_bar_entry);
@ -214,7 +204,6 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
});
mForward = (ImageButton) mLayout.findViewById(R.id.forward);
mForward.setEnabled(false); // initialize the forward button to not be enabled
mForward.setOnClickListener(new Button.OnClickListener() {
public void onClick(View view) {
Tabs.getInstance().getSelectedTab().doForward();
@ -414,15 +403,6 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
if (animation.equals(mLockFadeIn)) {
if (mSiteSecurityVisible)
mSiteSecurity.setVisibility(View.VISIBLE);
} else if (animation.equals(mTitleSlideLeft)) {
// These two animations may be scheduled to start while the forward
// animation is occurring. If we're showing the site security icon, make
// sure it doesn't take any space during the forward transition.
mSiteSecurity.setVisibility(View.GONE);
} else if (animation.equals(mTitleSlideRight)) {
// If we're hiding the icon, make sure that we keep its padding
// in place during the forward transition
mSiteSecurity.setVisibility(View.INVISIBLE);
}
}
@ -432,7 +412,9 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
@Override
public void onAnimationEnd(Animation animation) {
if (animation.equals(mTitleSlideRight)) {
if (animation.equals(mTitleSlideLeft)) {
mSiteSecurity.setVisibility(View.GONE);
} else if (animation.equals(mTitleSlideRight)) {
mSiteSecurity.startAnimation(mLockFadeIn);
}
}
@ -529,7 +511,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
proxy = AnimatorProxy.create(mTitle);
proxy.setAlpha(1);
proxy = AnimatorProxy.create(mForward);
proxy.setAlpha(mForward.isEnabled() ? 1 : 0);
proxy.setAlpha(1);
proxy = AnimatorProxy.create(mBack);
proxy.setAlpha(1);
@ -884,14 +866,10 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
mTitleSlideLeft.reset();
mTitleSlideRight.reset();
if (mForwardAnim != null) {
long delay = mForwardAnim.getRemainingTime();
mTitleSlideRight.setStartOffset(delay);
mTitleSlideLeft.setStartOffset(delay);
} else {
mTitleSlideRight.setStartOffset(0);
mTitleSlideLeft.setStartOffset(0);
}
if (visible)
mSiteSecurity.setVisibility(View.INVISIBLE);
else
mSiteSecurity.setVisibility(View.GONE);
mTitle.startAnimation(visible ? mTitleSlideRight : mTitleSlideLeft);
}
@ -985,104 +963,9 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
mBack.setEnabled(enabled);
}
public void updateForwardButton(final boolean enabled) {
if (mForward.isEnabled() == enabled)
return;
// Save the state on the forward button so that we can skip animations
// when there's nothing to change
mForward.setEnabled(enabled);
if (mForward.getVisibility() != View.VISIBLE)
return;
mForwardAnim = new PropertyAnimator(FORWARD_ANIMATION_DURATION);
final int width = enabled ? mForward.getWidth()/2 : 0;
mForwardAnim.setPropertyAnimationListener(new PropertyAnimator.PropertyAnimationListener() {
@Override
public void onPropertyAnimationStart() {
if (!enabled) {
// Set the margin before the transition when hiding the forward button. We
// have to do this so that the favicon isn't clipped during the transition
ViewGroup.MarginLayoutParams layoutParams =
(ViewGroup.MarginLayoutParams)mAddressBarView.getLayoutParams();
layoutParams.leftMargin = mAddressBarViewOffsetNoForward;
mAddressBarView.requestLayout();
// Note, we already translated the favicon, site security, and text field
// in prepareForwardAnimation, so they should appear to have not moved at
// all at this point.
}
}
@Override
public void onPropertyAnimationEnd() {
if (enabled) {
ViewGroup.MarginLayoutParams layoutParams =
(ViewGroup.MarginLayoutParams)mAddressBarView.getLayoutParams();
layoutParams.leftMargin = mAddressBarViewOffset;
AnimatorProxy proxy = AnimatorProxy.create(mTitle);
proxy.setTranslationX(0);
proxy = AnimatorProxy.create(mFavicon);
proxy.setTranslationX(0);
proxy = AnimatorProxy.create(mSiteSecurity);
proxy.setTranslationX(0);
mAddressBarView.requestLayout();
}
mForwardAnim = null;
}
});
prepareForwardAnimation(mForwardAnim, width);
mForwardAnim.start();
}
private void prepareForwardAnimation(PropertyAnimator anim, int width) {
if (width == 0) {
anim.attach(mForward,
PropertyAnimator.Property.TRANSLATION_X,
0);
anim.attach(mForward,
PropertyAnimator.Property.ALPHA,
0);
anim.attach(mTitle,
PropertyAnimator.Property.TRANSLATION_X,
0);
anim.attach(mFavicon,
PropertyAnimator.Property.TRANSLATION_X,
0);
anim.attach(mSiteSecurity,
PropertyAnimator.Property.TRANSLATION_X,
0);
// We're hiding the forward button. We're going to reset the margin before
// the animation starts, so we shift these items to the right so that they don't
// appear to move initially.
int startTrans = mAddressBarViewOffset - mAddressBarViewOffsetNoForward;
AnimatorProxy proxy = AnimatorProxy.create(mTitle);
proxy.setTranslationX(startTrans);
proxy = AnimatorProxy.create(mFavicon);
proxy.setTranslationX(startTrans);
proxy = AnimatorProxy.create(mSiteSecurity);
proxy.setTranslationX(startTrans);
} else {
anim.attach(mForward,
PropertyAnimator.Property.TRANSLATION_X,
width);
anim.attach(mForward,
PropertyAnimator.Property.ALPHA,
1);
anim.attach(mTitle,
PropertyAnimator.Property.TRANSLATION_X,
mAddressBarViewOffset - mAddressBarViewOffsetNoForward);
anim.attach(mFavicon,
PropertyAnimator.Property.TRANSLATION_X,
mAddressBarViewOffset - mAddressBarViewOffsetNoForward);
anim.attach(mSiteSecurity,
PropertyAnimator.Property.TRANSLATION_X,
mAddressBarViewOffset - mAddressBarViewOffsetNoForward);
}
public void updateForwardButton(boolean enabled) {
mForward.setColorFilter(enabled ? 0 : 0xFF999999);
mForward.setEnabled(enabled);
}
@Override

View File

@ -84,11 +84,6 @@ public class PropertyAnimator implements Runnable {
mListener = listener;
}
public long getRemainingTime() {
int timePassed = (int) (AnimationUtils.currentAnimationTimeMillis() - mStartTime);
return mDuration - timePassed;
}
@Override
public void run() {
int timePassed = (int) (AnimationUtils.currentAnimationTimeMillis() - mStartTime);

View File

@ -16,8 +16,9 @@
android:contentDescription="@string/back"
style="@style/AddressBar.ImageButton.Unused"/>
<ImageButton style="@style/AddressBar.ImageButton.Forward"
android:id="@+id/forward"/>
<ImageButton android:id="@+id/forward"
android:contentDescription="@string/forward"
style="@style/AddressBar.ImageButton.Unused"/>
<org.mozilla.gecko.BrowserToolbarBackground android:id="@+id/address_bar_bg"
android:layout_width="fill_parent"
@ -27,8 +28,12 @@
android:layout_alignParentRight="true"
android:background="@drawable/address_bar_bg"/>
<FrameLayout style="@style/AddressBar.Button.Container"
android:id="@+id/addressbar">
<FrameLayout style="@style/AddressBar.Button"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_centerVertical="true">
<Gecko.RelativeLayout android:id="@+id/awesome_bar"
style="@style/AddressBar.Button"

View File

@ -16,8 +16,9 @@
android:contentDescription="@string/back"
style="@style/AddressBar.ImageButton.Unused"/>
<ImageButton style="@style/AddressBar.ImageButton.Forward"
android:id="@+id/forward"/>
<ImageButton android:id="@+id/forward"
android:contentDescription="@string/forward"
style="@style/AddressBar.ImageButton.Unused"/>
<org.mozilla.gecko.BrowserToolbarBackground android:id="@+id/address_bar_bg"
android:layout_width="fill_parent"
@ -27,8 +28,12 @@
android:layout_alignParentRight="true"
android:background="@drawable/address_bar_bg"/>
<FrameLayout style="@style/AddressBar.Button.Container"
android:id="@+id/addressbar">
<FrameLayout style="@style/AddressBar.Button"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_centerVertical="true">
<Gecko.RelativeLayout android:id="@+id/awesome_bar"
style="@style/AddressBar.Button"

View File

@ -69,8 +69,16 @@
</Gecko.RelativeLayout>
<org.mozilla.gecko.ForwardButton style="@style/AddressBar.ImageButton.Forward"
android:id="@+id/forward"/>
<org.mozilla.gecko.ForwardButton android:id="@+id/forward"
style="@style/AddressBar.ImageButton"
android:layout_width="64dip"
android:layout_height="42dip"
android:layout_marginLeft="21dp"
android:paddingLeft="21dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_menu_forward"
android:contentDescription="@string/forward"
android:background="@drawable/address_bar_nav_button"/>
<org.mozilla.gecko.BackButton android:id="@+id/back"
style="@style/AddressBar.ImageButton"
@ -82,8 +90,12 @@
android:contentDescription="@string/back"
android:background="@drawable/address_bar_nav_button"/>
<LinearLayout style="@style/AddressBar.Button.Container"
android:id="@+id/addressbar">
<LinearLayout style="@style/AddressBar.Button"
android:layout_marginLeft="90dp"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:layout_marginRight="0dp"
android:orientation="horizontal">
<ImageButton android:id="@+id/favicon"
style="@style/AddressBar.ImageButton"

View File

@ -104,8 +104,16 @@
</Gecko.RelativeLayout>
<org.mozilla.gecko.ForwardButton style="@style/AddressBar.ImageButton.Forward"
android:id="@+id/forward"/>
<org.mozilla.gecko.ForwardButton android:id="@+id/forward"
style="@style/AddressBar.ImageButton"
android:layout_width="64dip"
android:layout_height="42dip"
android:layout_marginLeft="22dp"
android:paddingLeft="22dp"
android:layout_centerVertical="true"
android:src="@drawable/ic_menu_forward"
android:contentDescription="@string/forward"
android:background="@drawable/address_bar_nav_button"/>
<org.mozilla.gecko.BackButton android:id="@+id/back"
style="@style/AddressBar.ImageButton"
@ -116,8 +124,12 @@
android:contentDescription="@string/back"
android:background="@drawable/address_bar_nav_button"/>
<LinearLayout style="@style/AddressBar.Button.Container"
android:id="@+id/addressbar">
<LinearLayout style="@style/AddressBar.Button"
android:layout_marginLeft="84dp"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:layout_marginRight="0dp"
android:orientation="horizontal">
<ImageButton android:id="@+id/favicon"
style="@style/AddressBar.ImageButton"

View File

@ -16,8 +16,9 @@
android:contentDescription="@string/back"
style="@style/AddressBar.ImageButton.Unused"/>
<ImageButton style="@style/AddressBar.ImageButton.Forward"
android:id="@+id/forward"/>
<ImageButton android:id="@+id/forward"
android:contentDescription="@string/forward"
style="@style/AddressBar.ImageButton.Unused"/>
<org.mozilla.gecko.BrowserToolbarBackground android:id="@+id/address_bar_bg"
android:layout_width="fill_parent"
@ -27,8 +28,12 @@
android:layout_alignParentRight="true"
android:background="@drawable/address_bar_bg"/>
<FrameLayout style="@style/AddressBar.Button.Container"
android:id="@+id/addressbar">
<FrameLayout style="@style/AddressBar.Button"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_centerVertical="true">
<Gecko.RelativeLayout android:id="@+id/awesome_bar"
style="@style/AddressBar.Button"

View File

@ -16,8 +16,9 @@
android:contentDescription="@string/back"
style="@style/AddressBar.ImageButton.Unused"/>
<ImageButton style="@style/AddressBar.ImageButton.Forward"
android:id="@+id/forward"/>
<ImageButton android:id="@+id/forward"
android:contentDescription="@string/forward"
style="@style/AddressBar.ImageButton.Unused"/>
<org.mozilla.gecko.BrowserToolbarBackground android:id="@+id/address_bar_bg"
android:layout_width="fill_parent"
@ -27,8 +28,12 @@
android:layout_alignParentRight="true"
android:background="@drawable/address_bar_bg"/>
<FrameLayout style="@style/AddressBar.Button.Container"
android:id="@+id/addressbar">
<FrameLayout style="@style/AddressBar.Button"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_centerVertical="true">
<Gecko.RelativeLayout android:id="@+id/awesome_bar"
style="@style/AddressBar.Button"

View File

@ -9,7 +9,5 @@
<dimen name="browser_toolbar_icon_width">45dp</dimen>
<dimen name="menu_popup_arrow_margin">8dip</dimen>
<dimen name="tabs_counter_size">26sp</dimen>
<dimen name="addressbar_offset_left">90dp</dimen>
<dimen name="addressbar_offset_left_noforward">50dip</dimen>
</resources>

View File

@ -31,27 +31,4 @@
<item name="android:paddingRight">60dip</item>
</style>
<style name="AddressBar.ImageButton.Forward">
<item name="android:contentDescription">@string/forward</item>
<item name="android:layout_width">64dip</item>
<item name="android:layout_height">42dip</item>
<item name="android:paddingLeft">21dp</item>
<item name="android:layout_gravity">center_vertical</item>
<item name="android:layout_centerVertical">true</item>
<item name="android:src">@drawable/ic_menu_forward</item>
<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>
</style>
<style name="AddressBar.Button.Container">
<item name="android:layout_marginTop">6dp</item>
<item name="android:layout_marginBottom">6dp</item>
<item name="android:layout_marginRight">0dp</item>
<!-- Start with forward hidden -->
<item name="android:layout_marginLeft">@dimen/addressbar_offset_left_noforward</item>
<item name="android:orientation">horizontal</item>
</style>
</resources>

View File

@ -16,6 +16,5 @@
<dimen name="remote_tab_child_row_height">48dp</dimen>
<dimen name="remote_tab_group_row_height">28dp</dimen>
<dimen name="tabs_counter_size">26sp</dimen>
<dimen name="addressbar_offset_left">84dip</dimen>
</resources>

View File

@ -53,7 +53,6 @@
<dimen name="validation_message_margin_top">6dp</dimen>
<dimen name="widget_padding">8dp</dimen>
<dimen name="addressbar_offset_left">84dip</dimen>
<dimen name="app_defaultsize_w">632.0dip</dimen>
<dimen name="app_defaultsize_h">598.0dip</dimen>
<dimen name="app_minimumsize_w">632.0dip</dimen>

View File

@ -65,15 +65,6 @@
<item name="android:background">@android:color/transparent</item>
</style>
<style name="AddressBar.Button.Container">
<item name="android:layout_marginLeft">4dp</item>
<item name="android:layout_marginRight">4dp</item>
<item name="android:layout_toLeftOf">@id/menu_items</item>
<item name="android:layout_alignParentLeft">true</item>
<item name="android:layout_alignParentBottom">true</item>
<item name="android:layout_centerVertical">true</item>
</style>
<!-- Address bar - Image Button -->
<style name="AddressBar.ImageButton" parent="AddressBar.Button">
<item name="android:scaleType">center</item>
@ -88,10 +79,6 @@
<item name="android:visibility">gone</item>
</style>
<style name="AddressBar.ImageButton.Forward" parent="AddressBar.ImageButton.Unused">
<item name="android:contentDescription">@string/forward</item>
</style>
<!-- Address bar - Image Button - Icon -->
<style name="AddressBar.ImageButton.Icon">
<item name="android:layout_width">@dimen/browser_toolbar_icon_width</item>