Bug 961749 - Disable tab count animation in editing mode. r=lucasr

This commit is contained in:
Brian Nicholson 2014-01-28 15:19:42 -08:00
parent 7956f180ed
commit 371536ac3a
2 changed files with 15 additions and 1 deletions

View File

@ -638,7 +638,7 @@ public class BrowserToolbar extends GeckoRelativeLayout
} }
// Set TabCounter based on visibility // Set TabCounter based on visibility
if (isVisible() && ViewHelper.getAlpha(mTabsCounter) != 0) { if (isVisible() && ViewHelper.getAlpha(mTabsCounter) != 0 && !isEditing()) {
mTabsCounter.setCountWithAnimation(count); mTabsCounter.setCountWithAnimation(count);
} else { } else {
mTabsCounter.setCount(count); mTabsCounter.setCount(count);
@ -863,6 +863,10 @@ public class BrowserToolbar extends GeckoRelativeLayout
// in setButtonEnabled(). // in setButtonEnabled().
final float alpha = (enabled ? 1.0f : 0.24f); final float alpha = (enabled ? 1.0f : 0.24f);
if (!enabled) {
mTabsCounter.onEnterEditingMode();
}
mTabs.setEnabled(enabled); mTabs.setEnabled(enabled);
ViewHelper.setAlpha(mTabsCounter, alpha); ViewHelper.setAlpha(mTabsCounter, alpha);
mMenu.setEnabled(enabled); mMenu.setEnabled(enabled);

View File

@ -102,6 +102,16 @@ public class TabCounter extends GeckoTextSwitcher
mCount = count; mCount = count;
} }
// Alpha animations in editing mode cause action bar corruption on the
// Nexus 7 (bug 961749). As a workaround, skip these animations in editing
// mode.
void onEnterEditingMode() {
final int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
getChildAt(i).clearAnimation();
}
}
private AnimationSet createAnimation(float startAngle, float endAngle, private AnimationSet createAnimation(float startAngle, float endAngle,
FadeMode fadeMode, FadeMode fadeMode,
float zEnd, boolean reverse) { float zEnd, boolean reverse) {