summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Kolb <kolby@google.com>2012-05-29 11:15:27 -0700
committerMichael Kolb <kolby@google.com>2012-05-29 11:15:27 -0700
commitbae0cb200f6ad93ce61c5781100f4b6ac0cb6649 (patch)
tree7904c5c9bce82e3986b55f34ee923b6d1a64f54f
parent070a0c79c3c6498c2b05c9ad1f4c93b13c46382c (diff)
downloadBrowser-bae0cb200f6ad93ce61c5781100f4b6ac0cb6649.tar.gz
tighten nav bar layout & fix animation bug
Bug: 6563289 Change-Id: I00fdecf645128bb1fec8e23be94aa2b85fb586f7
-rw-r--r--res/layout-sw600dp/title_bar_nav.xml14
-rw-r--r--src/com/android/browser/BaseUi.java10
-rw-r--r--src/com/android/browser/NavigationBarTablet.java41
-rw-r--r--src/com/android/browser/UI.java2
4 files changed, 45 insertions, 22 deletions
diff --git a/res/layout-sw600dp/title_bar_nav.xml b/res/layout-sw600dp/title_bar_nav.xml
index 300b740f..651474ab 100644
--- a/res/layout-sw600dp/title_bar_nav.xml
+++ b/res/layout-sw600dp/title_bar_nav.xml
@@ -28,7 +28,6 @@
android:src="@drawable/ic_back_holo_dark"
android:layout_width="wrap_content"
android:layout_height="match_parent"
- android:paddingLeft="16dip"
android:contentDescription="@string/accessibility_button_back"
style="@style/HoloButton" />
<ImageButton
@@ -52,22 +51,20 @@
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1.0"
- android:layout_marginLeft="8dip"
- android:layout_marginRight="8dip"
android:orientation="horizontal"
android:background="@drawable/url_background">
<ImageView
android:id="@+id/url_icon"
- android:layout_width="48dip"
+ android:layout_width="32dip"
android:layout_height="20dip"
- android:paddingLeft="14dip"
- android:paddingRight="14dip"
android:src="@drawable/ic_web_holo_dark"
android:layout_gravity="center" />
<ImageView
android:id="@+id/lock"
android:layout_width="wrap_content"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:layout_marginLeft="0dip"
style="@style/HoloIcon"
android:visibility="gone" />
<com.android.browser.UrlInputView
@@ -75,7 +72,7 @@
android:layout_width="0dip"
android:layout_weight="1.0"
android:layout_height="match_parent"
- android:paddingLeft="0dip"
+ android:paddingLeft="4dip"
android:paddingRight="0dip"
android:background="@null"
android:textAppearance="?android:attr/textAppearanceMedium"
@@ -115,7 +112,6 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:scaleType="center"
- android:paddingRight="16dip"
style="@style/HoloButton"
android:contentDescription="@string/accessibility_button_bookmarks"
android:src="@drawable/ic_bookmarks_history_holo_dark" />
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java
index e3f5986e..cfe9a53a 100644
--- a/src/com/android/browser/BaseUi.java
+++ b/src/com/android/browser/BaseUi.java
@@ -113,6 +113,7 @@ public abstract class BaseUi implements UI {
protected TitleBar mTitleBar;
private NavigationBarBase mNavigationBar;
protected PieControl mPieControl;
+ private boolean mBlockFocusAnimations;
public BaseUi(Activity browser, UiController controller) {
mActivity = browser;
@@ -264,6 +265,8 @@ public abstract class BaseUi implements UI {
@Override
public void setActiveTab(final Tab tab) {
if (tab == null) return;
+ // block unnecessary focus change animations during tab switch
+ mBlockFocusAnimations = true;
mHandler.removeMessages(MSG_HIDE_TITLEBAR);
if ((tab != mActiveTab) && (mActiveTab != null)) {
removeTabFromContentView(mActiveTab);
@@ -294,6 +297,7 @@ public abstract class BaseUi implements UI {
onProgressChanged(tab);
mNavigationBar.setIncognitoMode(tab.isPrivateBrowsingEnabled());
updateAutoLogin(tab, false);
+ mBlockFocusAnimations = false;
}
protected void updateUrlBarAutoShowManagerTarget() {
@@ -860,4 +864,10 @@ public abstract class BaseUi implements UI {
mContentView.setLayoutParams(params);
}
}
+
+ @Override
+ public boolean blockFocusAnimations() {
+ return mBlockFocusAnimations;
+ }
+
}
diff --git a/src/com/android/browser/NavigationBarTablet.java b/src/com/android/browser/NavigationBarTablet.java
index b9c86e3f..426174b9 100644
--- a/src/com/android/browser/NavigationBarTablet.java
+++ b/src/com/android/browser/NavigationBarTablet.java
@@ -259,34 +259,49 @@ public class NavigationBarTablet extends NavigationBarBase {
mStopButton.setContentDescription(mRefreshDescription);
}
+ private AnimatorSet mAnimation;
+
private void hideNavButtons() {
+ if (mBaseUi.blockFocusAnimations()) {
+ mNavButtons.setVisibility(View.GONE);
+ return;
+ }
int awidth = mNavButtons.getMeasuredWidth();
Animator anim1 = ObjectAnimator.ofFloat(mNavButtons, View.TRANSLATION_X, 0, - awidth);
Animator anim2 = ObjectAnimator.ofInt(mUrlContainer, "left", mUrlContainer.getLeft(),
mUrlContainer.getPaddingLeft());
Animator anim3 = ObjectAnimator.ofFloat(mNavButtons, View.ALPHA, 1f, 0f);
- AnimatorSet combo = new AnimatorSet();
- combo.playTogether(anim1, anim2, anim3);
- combo.addListener(new AnimatorListenerAdapter() {
+ mAnimation = new AnimatorSet();
+ mAnimation.playTogether(anim1, anim2, anim3);
+ mAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mNavButtons.setVisibility(View.GONE);
+ mAnimation = null;
}
});
- combo.setDuration(150);
- combo.start();
+ mAnimation.setDuration(150);
+ mAnimation.start();
}
private void showNavButtons() {
- int awidth = mNavButtons.getMeasuredWidth();
- Animator anim1 = ObjectAnimator.ofFloat(mNavButtons, View.TRANSLATION_X, -awidth, 0);
- Animator anim2 = ObjectAnimator.ofInt(mUrlContainer, "left", 0, awidth);
- Animator anim3 = ObjectAnimator.ofFloat(mNavButtons, View.ALPHA, 0f, 1f);
- AnimatorSet combo = new AnimatorSet();
- combo.playTogether(anim1, anim2, anim3);
+ if (mAnimation != null) {
+ mAnimation.cancel();
+ }
mNavButtons.setVisibility(View.VISIBLE);
- combo.setDuration(150);
- combo.start();
+ if (!mBaseUi.blockFocusAnimations()) {
+ int awidth = mNavButtons.getMeasuredWidth();
+ Animator anim1 = ObjectAnimator.ofFloat(mNavButtons,
+ View.TRANSLATION_X, -awidth, 0);
+ Animator anim2 = ObjectAnimator.ofInt(mUrlContainer, "left", 0,
+ awidth);
+ Animator anim3 = ObjectAnimator.ofFloat(mNavButtons, View.ALPHA,
+ 0f, 1f);
+ AnimatorSet combo = new AnimatorSet();
+ combo.playTogether(anim1, anim2, anim3);
+ combo.setDuration(150);
+ combo.start();
+ }
}
private void showHideStar(Tab tab) {
diff --git a/src/com/android/browser/UI.java b/src/com/android/browser/UI.java
index aeab7460..96f6640d 100644
--- a/src/com/android/browser/UI.java
+++ b/src/com/android/browser/UI.java
@@ -146,4 +146,6 @@ public interface UI {
public boolean shouldCaptureThumbnails();
+ boolean blockFocusAnimations();
+
}