Commit 4f9e310f authored by Robert Ogden's avatar Robert Ogden Committed by Commit Bot

Add the "Lite" string to the Previews UI in CCT

This adds the string in the URLBar display text. See mock linked in the
bug.

Also changes the string name in the grd file since it's now used in
more than just the verbose status.

Bug: 886947
Change-Id: I41df81c607a5641e8c663b192423559ba5e84ba8
Reviewed-on: https://chromium-review.googlesource.com/1234533
Commit-Queue: Robert Ogden <robertogden@chromium.org>
Reviewed-by: default avatarTheresa <twellington@chromium.org>
Reviewed-by: default avatarDoug Arnett <dougarnett@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592922}
parent f1310529
...@@ -46,18 +46,46 @@ ...@@ -46,18 +46,46 @@
android:inputType="none" android:inputType="none"
android:maxLines="1" android:maxLines="1"
android:paddingEnd="@dimen/toolbar_edge_padding" android:paddingEnd="@dimen/toolbar_edge_padding"
android:textSize="@dimen/custom_tabs_title_text_size" style="@style/BlackTitle1"
android:visibility="gone" /> android:visibility="gone" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom" >
<TextView
android:id="@+id/url_bar_lite_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@null"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/location_bar_preview_lite_page_status"
style="@style/BlackCaptionDefault"
android:visibility="gone" />
<!-- This separator is in line with text and is used in lieu
of a | character. Therefore, use the text size for its
height and not a dp value. -->
<View
android:id="@+id/url_bar_lite_status_separator"
android:layout_height="@dimen/custom_tabs_url_text_size"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/custom_tabs_url_lite_separator_margin"
android:layout_marginEnd="@dimen/custom_tabs_url_lite_separator_margin"
style="@style/VerticalDivider"
android:visibility="gone" />
<org.chromium.chrome.browser.omnibox.UrlBar <org.chromium.chrome.browser.omnibox.UrlBar
android:id="@+id/url_bar" android:id="@+id/url_bar"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@null" android:background="@null"
android:inputType="none" android:inputType="none"
android:singleLine="true" android:singleLine="true"
android:paddingEnd="@dimen/toolbar_edge_padding" android:paddingEnd="@dimen/toolbar_edge_padding"
android:textSize="@dimen/location_bar_url_text_size" /> style="@style/BlackCaptionDefault" />
</LinearLayout>
</view> </view>
</FrameLayout> </FrameLayout>
<LinearLayout <LinearLayout
......
...@@ -390,6 +390,7 @@ ...@@ -390,6 +390,7 @@
<dimen name="custom_tabs_toolbar_horizontal_margin_no_close">8dp</dimen> <dimen name="custom_tabs_toolbar_horizontal_margin_no_close">8dp</dimen>
<dimen name="toolbar_icon_height">24dp</dimen> <dimen name="toolbar_icon_height">24dp</dimen>
<dimen name="min_toolbar_icon_side_padding">6dp</dimen> <dimen name="min_toolbar_icon_side_padding">6dp</dimen>
<dimen name="custom_tabs_url_lite_separator_margin">3dp</dimen>
<dimen name="custom_tabs_url_text_size">12sp</dimen> <dimen name="custom_tabs_url_text_size">12sp</dimen>
<dimen name="custom_tabs_title_text_size">16sp</dimen> <dimen name="custom_tabs_title_text_size">16sp</dimen>
<dimen name="custom_tabs_bottom_bar_max_height">120dp</dimen> <dimen name="custom_tabs_bottom_bar_max_height">120dp</dimen>
......
...@@ -127,6 +127,8 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar, ...@@ -127,6 +127,8 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
private View mLocationBarFrameLayout; private View mLocationBarFrameLayout;
private View mTitleUrlContainer; private View mTitleUrlContainer;
private TextView mUrlBar; private TextView mUrlBar;
private View mLiteStatusView;
private View mLiteStatusSeparatorView;
private UrlBarCoordinator mUrlCoordinator; private UrlBarCoordinator mUrlCoordinator;
private TextView mTitleBar; private TextView mTitleBar;
private TintedImageButton mSecurityButton; private TintedImageButton mSecurityButton;
...@@ -166,6 +168,8 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar, ...@@ -166,6 +168,8 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
mUrlBar = (TextView) findViewById(R.id.url_bar); mUrlBar = (TextView) findViewById(R.id.url_bar);
mUrlBar.setHint(""); mUrlBar.setHint("");
mUrlBar.setEnabled(false); mUrlBar.setEnabled(false);
mLiteStatusView = findViewById(R.id.url_bar_lite_status);
mLiteStatusSeparatorView = findViewById(R.id.url_bar_lite_status_separator);
mUrlCoordinator = new UrlBarCoordinator((UrlBar) mUrlBar); mUrlCoordinator = new UrlBarCoordinator((UrlBar) mUrlBar);
mUrlCoordinator.setDelegate(this); mUrlCoordinator.setDelegate(this);
mUrlCoordinator.setAllowFocus(false); mUrlCoordinator.setAllowFocus(false);
...@@ -441,6 +445,13 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar, ...@@ -441,6 +445,13 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
originEnd = displayText.length(); originEnd = displayText.length();
} }
// The Lite Status view visibility should be updated on every new URL and only be displayed
// along with the URL bar.
final boolean liteStatusIsVisible =
getToolbarDataProvider().isPreview() && mUrlBar.getVisibility() == View.VISIBLE;
mLiteStatusView.setVisibility(liteStatusIsVisible ? View.VISIBLE : View.GONE);
mLiteStatusSeparatorView.setVisibility(liteStatusIsVisible ? View.VISIBLE : View.GONE);
mUrlCoordinator.setUrlBarData( mUrlCoordinator.setUrlBarData(
UrlBarData.create(url, displayText, originStart, originEnd, url), UrlBarData.create(url, displayText, originStart, originEnd, url),
UrlBar.ScrollType.SCROLL_TO_TLD, SelectionState.SELECT_ALL); UrlBar.ScrollType.SCROLL_TO_TLD, SelectionState.SELECT_ALL);
......
...@@ -141,7 +141,7 @@ public interface ToolbarDataProvider { ...@@ -141,7 +141,7 @@ public interface ToolbarDataProvider {
@StringRes @StringRes
default int getVerboseStatusString() { default int getVerboseStatusString() {
if (isPreview()) { if (isPreview()) {
return R.string.location_bar_verbose_status_preview; return R.string.location_bar_preview_lite_page_status;
} }
if (isOfflinePage()) { if (isOfflinePage()) {
return R.string.location_bar_verbose_status_offline; return R.string.location_bar_verbose_status_offline;
......
...@@ -3081,7 +3081,7 @@ To obtain new licenses, connect to the internet and play your downloaded content ...@@ -3081,7 +3081,7 @@ To obtain new licenses, connect to the internet and play your downloaded content
<message name="IDS_LOCATION_BAR_VERBOSE_STATUS_OFFLINE" desc="Verbose indication of offline status in the location bar. [CHAR-LIMIT=20]"> <message name="IDS_LOCATION_BAR_VERBOSE_STATUS_OFFLINE" desc="Verbose indication of offline status in the location bar. [CHAR-LIMIT=20]">
Offline Offline
</message> </message>
<message name="IDS_LOCATION_BAR_VERBOSE_STATUS_PREVIEW" desc="An indication in the location bar that the page the user is viewing has been modified in order to speed up the page load or decrease the amount of data used to load the page. [CHAR-LIMIT=10]"> <message name="IDS_LOCATION_BAR_PREVIEW_LITE_PAGE_STATUS" desc="An indication in the location bar that the page the user is viewing has been modified in order to speed up the page load or decrease the amount of data used to load the page. [CHAR-LIMIT=10]">
Lite Lite
</message> </message>
......
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