[TTS] Update Consent dialog space height after it is actually shown
Calling View#getMeasuredHeight() after the Consent dialog is actually
shown.
Consent dialog
portrait:
small font: https://screenshot.googleplex.com/8qjTQewzv2k8qeU
normal font: https://screenshot.googleplex.com/4dyR9oTsvWfN8pZ
large font: https://screenshot.googleplex.com/BqGYVnoiH68eY38
landscape:
small font: https://screenshot.googleplex.com/8tgpjfk92L57fAY
normal font: https://screenshot.googleplex.com/Ats8DjrkdbmqWew
large font: https://screenshot.googleplex.com/3EEi9Rhm5HmZfmF
Bug: 1259900
Change-Id: Id0e185b9d3ec8eb2c44c41bb10444b9f32554699
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3224323
Commit-Queue: Gang Wu <gangwu@chromium.org>
Reviewed-by: Donn Denman <donnd@chromium.org>
Reviewed-by: Theresa <twellington@chromium.org>
Cr-Commit-Position: refs/heads/main@{#933249}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPromoControl.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPromoControl.java
index 4eb76ab..1cf22c42 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPromoControl.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPromoControl.java
@@ -325,7 +325,7 @@
super.invalidate(didViewSizeChange);
if (didViewSizeChange) {
- calculatePromoHeight();
+ onPromoViewSizeChange();
}
}
@@ -360,7 +360,7 @@
new SpanApplier.SpanInfo("<link>", "</link>", settingsLink)));
promoText.setMovementMethod(LinkMovementMethod.getInstance());
- calculatePromoHeight();
+ onPromoViewSizeChange();
}
@Override
@@ -436,6 +436,10 @@
mWasInteractive = true;
ContextualSearchManager.onPromoShown();
+
+ if (ChromeFeatureList.isEnabled(ChromeFeatureList.CONTEXTUAL_SEARCH_NEW_SETTINGS)) {
+ updatePromoHeight();
+ }
}
/**
@@ -455,13 +459,19 @@
}
/**
- * Calculates the content height of the Promo View, and adjusts the height of the Promo while
- * preserving the proportion of the height with the content height. This should be called
- * whenever the the size of the Promo View changes.
+ * This should be called whenever the the size of the Promo View changes or something inside the
+ * promo changes that could affect the overall size.
*/
- private void calculatePromoHeight() {
+ private void onPromoViewSizeChange() {
layout();
+ updatePromoHeight();
+ }
+ /**
+ * Calculates the content height of the Promo View, and adjusts the height of the Promo while
+ * preserving the proportion of the height with the content height.
+ */
+ private void updatePromoHeight() {
final float previousContentHeight = mContentHeightPx;
mContentHeightPx = getMeasuredHeight();