Commit eeb9d035 authored by Donn Denman's avatar Donn Denman Committed by Commit Bot

[TTS] Auto-adjust Caption and Context text widths.

Automatically adjusts the length of the Context and the Caption
text views as the panel expands open.  This fixes some issues
with Definitions which can have long captions and uses the
Context view to show the pronunciation.

The Caption was supposed to auto-adjust, but was not calling
super when expanding.  The Context just needed to pass the
adjustment parameters.

BUG=1016973

Change-Id: Ie331cde2cc08a059197ea1e7178099c865e4dbc9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1898722
Auto-Submit: Donn Denman <donnd@chromium.org>
Reviewed-by: default avatarJinsuk Kim <jinsukkim@chromium.org>
Commit-Queue: Donn Denman <donnd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712446}
parent 869585f4
...@@ -129,6 +129,7 @@ public class ContextualSearchCaptionControl extends OverlayPanelTextViewInflater ...@@ -129,6 +129,7 @@ public class ContextualSearchCaptionControl extends OverlayPanelTextViewInflater
*/ */
@Override @Override
public void onUpdateFromPeekToExpand(float percentage) { public void onUpdateFromPeekToExpand(float percentage) {
super.onUpdateFromPeekToExpand(percentage);
if (ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT)) { if (ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT)) {
if (mHasPeekingCaption) { if (mHasPeekingCaption) {
if (mTransitionAnimator != null) mTransitionAnimator.cancel(); if (mTransitionAnimator != null) mTransitionAnimator.cancel();
......
...@@ -10,6 +10,7 @@ import android.view.ViewGroup; ...@@ -10,6 +10,7 @@ import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel; import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel;
import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelRepaddingTextView; import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelRepaddingTextView;
import org.chromium.ui.resources.dynamics.DynamicResourceLoader; import org.chromium.ui.resources.dynamics.DynamicResourceLoader;
...@@ -39,7 +40,10 @@ public class ContextualSearchContextControl extends OverlayPanelRepaddingTextVie ...@@ -39,7 +40,10 @@ public class ContextualSearchContextControl extends OverlayPanelRepaddingTextVie
ViewGroup container, ViewGroup container,
DynamicResourceLoader resourceLoader) { DynamicResourceLoader resourceLoader) {
super(panel, R.layout.contextual_search_context_view, R.id.contextual_search_context_view, super(panel, R.layout.contextual_search_context_view, R.id.contextual_search_context_view,
context, container, resourceLoader, R.dimen.contextual_search_padded_button_width, context, container, resourceLoader,
(ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT)
? R.dimen.contextual_search_end_padding
: R.dimen.contextual_search_padded_button_width),
R.dimen.contextual_search_padded_button_width); R.dimen.contextual_search_padded_button_width);
} }
......
...@@ -38,7 +38,7 @@ public class ContextualSearchTermControl extends OverlayPanelTextViewInflater { ...@@ -38,7 +38,7 @@ public class ContextualSearchTermControl extends OverlayPanelTextViewInflater {
context, container, resourceLoader, context, container, resourceLoader,
(ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT) (ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT)
? R.dimen.contextual_search_end_padding ? R.dimen.contextual_search_end_padding
: R.dimen.overlay_panel_padded_button_width), : R.dimen.contextual_search_padded_button_width),
R.dimen.contextual_search_padded_button_width); R.dimen.contextual_search_padded_button_width);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment