Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3533)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarContainerLayout.java

Issue 1560573002: Reduce infobar lag on KitKat from 1000ms to 100ms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: appease the FindBugs gods Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarContainerLayout.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarContainerLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarContainerLayout.java
index e1e24373a5763dd6d5fd7f5462f0e262fd7b5da8..3dd20bf46d3121aaf6d83826987f453c9efa90a8 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarContainerLayout.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarContainerLayout.java
@@ -9,6 +9,7 @@ import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Context;
+import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
@@ -239,7 +240,7 @@ class InfoBarContainerLayout extends FrameLayout {
void prepareAnimation() {
mFrontView = (ViewGroup) LayoutInflater.from(getContext()).inflate(
R.layout.infobar_wrapper, InfoBarContainerLayout.this, false);
- mFrontView.addView(mFrontInnerView);
+ addInnerView(mFrontView, mFrontInnerView);
addView(mFrontView);
updateLayoutParams();
}
@@ -315,7 +316,7 @@ class InfoBarContainerLayout extends FrameLayout {
void prepareAnimation() {
mOldFrontView = (ViewGroup) getChildAt(0);
mNewFrontView = (ViewGroup) getChildAt(1);
- mNewFrontView.addView(mNewFrontInnerView);
+ addInnerView(mNewFrontView, mNewFrontInnerView);
}
@Override
@@ -414,7 +415,7 @@ class InfoBarContainerLayout extends FrameLayout {
void prepareAnimation() {
mFrontView = (ViewGroup) getChildAt(0);
mOldInnerView = mFrontView.getChildAt(0);
- mFrontView.addView(mNewInnerView);
+ addInnerView(mFrontView, mNewInnerView);
}
@Override
@@ -542,6 +543,14 @@ class InfoBarContainerLayout extends FrameLayout {
}
}
+ /**
+ * Adds an infobar view to a wrapper view, with suitable LayoutParams.
+ */
+ private void addInnerView(ViewGroup wrapperView, View innerView) {
+ wrapperView.addView(innerView, new LayoutParams(
+ LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, Gravity.TOP));
+ }
+
private void updateLayoutParams() {
// Stagger the top margins so the back infobars peek out a bit.
int childCount = getChildCount();

Powered by Google App Engine
This is Rietveld 408576698