Commit 053cff75 authored by Mugdha Lakhani's avatar Mugdha Lakhani Committed by Commit Bot

[WebLayer] Cosmetic improvements to the URL bar.

1. The url bar text and security status icon are now center-vertical
   aligned.
2. The size of the security status icon is fixed to 18dp.
3. 8dp of padding has been added to the end of the url text.
4. Default text size of the url bar text is now to 14 dp.
5. WebLayerShellActivity layout is also modified to better align the
   find-in-page button with the URL bar.

Some screenshots:
https://drive.google.com/drive/folders/1QhvEamyxJrcIpWlTQJUzJWQeNHgtWVa0?usp=sharing

Bug: 1025607
Change-Id: Id4dcd79d1f7d13e3b095199cc89b5a468ab3c51d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2106155
Commit-Queue: Mugdha Lakhani <nator@chromium.org>
Reviewed-by: default avatarRichard Coles <torne@chromium.org>
Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Reviewed-by: default avatarEvan Stade <estade@chromium.org>
Auto-Submit: Mugdha Lakhani <nator@chromium.org>
Cr-Commit-Position: refs/heads/master@{#754519}
parent 5cddfb82
...@@ -7,7 +7,10 @@ import("//build/config/android/rules.gni") ...@@ -7,7 +7,10 @@ import("//build/config/android/rules.gni")
import("//weblayer/variables.gni") import("//weblayer/variables.gni")
android_resources("weblayer_resources") { android_resources("weblayer_resources") {
sources = [ "res/layout/weblayer_url_bar.xml" ] sources = [
"res/layout/weblayer_url_bar.xml",
"res/values/dimens.xml",
]
custom_package = "org.chromium.weblayer_private" custom_package = "org.chromium.weblayer_private"
deps = [ deps = [
"//components/browser_ui/strings/android:browser_ui_strings_grd", "//components/browser_ui/strings/android:browser_ui_strings_grd",
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
package org.chromium.weblayer_private; package org.chromium.weblayer_private;
import android.content.Context; import android.content.Context;
import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.View; import android.view.View;
...@@ -81,6 +82,8 @@ public class UrlBarControllerImpl extends IUrlBarController.Stub { ...@@ -81,6 +82,8 @@ public class UrlBarControllerImpl extends IUrlBarController.Stub {
super(context); super(context);
mTextSize = options.getFloat(URL_TEXT_SIZE, DEFAULT_TEXT_SIZE); mTextSize = options.getFloat(URL_TEXT_SIZE, DEFAULT_TEXT_SIZE);
View.inflate(getContext(), R.layout.weblayer_url_bar, this); View.inflate(getContext(), R.layout.weblayer_url_bar, this);
setOrientation(LinearLayout.HORIZONTAL);
setBackgroundColor(Color.TRANSPARENT);
mUrlTextView = findViewById(R.id.url_text); mUrlTextView = findViewById(R.id.url_text);
mSecurityButton = (ImageButton) findViewById(R.id.security_button); mSecurityButton = (ImageButton) findViewById(R.id.security_button);
......
...@@ -3,27 +3,27 @@ ...@@ -3,27 +3,27 @@
Use of this source code is governed by a BSD-style license that can be Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. --> found in the LICENSE file. -->
<LinearLayout <merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" <!-- ContentDescription is set programmatically. -->
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:orientation="horizontal">
<ImageButton <ImageButton
tools:ignore="ContentDescription"
android:id="@+id/security_button" android:id="@+id/security_button"
android:layout_width="15dp" tools:ignore="ContentDescription"
android:layout_height="match_parent" android:background="@android:color/transparent"
android:layout_marginLeft="5dp" android:layout_gravity="center_vertical"
android:layout_marginRight="5dp" android:layout_height="@dimen/security_status_icon_size"
android:background="@android:color/transparent" /> android:layout_width="@dimen/security_status_icon_size"
android:scaleType="center"
android:paddingEnd="@dimen/security_status_icon_padding"/>
<TextView <TextView
android:id="@+id/url_text" android:id="@+id/url_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:layout_width="0dp"
android:layout_marginBottom="5dp" android:layout_weight="1"
android:gravity="center_vertical"/> android:layout_gravity="center_vertical"
</LinearLayout> android:maxLines="1"
android:paddingEnd="@dimen/url_text_edge_padding"/>
</merge>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2020 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<resources>
<dimen name="security_status_icon_size">18dp</dimen>
<dimen name="security_status_icon_padding">5dp</dimen>
<dimen name="url_text_edge_padding">8dp</dimen>
</resources>
\ No newline at end of file
...@@ -37,7 +37,7 @@ public final class UrlBarOptions { ...@@ -37,7 +37,7 @@ public final class UrlBarOptions {
* Sets the text size of the URL bar. * Sets the text size of the URL bar.
* *
* @param textSize The desired size of the URL bar text in scalable pixels. * @param textSize The desired size of the URL bar text in scalable pixels.
* The default is 10.0F and the minimum allowed size is 5.0F. * The default is 14.0F and the minimum allowed size is 5.0F.
*/ */
public Builder setTextSizeSP(float textSize) { public Builder setTextSizeSP(float textSize) {
mOptions.putFloat(URL_TEXT_SIZE, textSize); mOptions.putFloat(URL_TEXT_SIZE, textSize);
......
...@@ -14,13 +14,11 @@ ...@@ -14,13 +14,11 @@
<ViewSwitcher <ViewSwitcher
android:id="@+id/url_view_container" android:id="@+id/url_view_container"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_toStartOf="@+id/menu_button"> android:layout_toStartOf="@+id/menu_button"
android:paddingStart="2dp">
<EditText <EditText
android:id="@+id/editable_url_view" android:id="@+id/editable_url_view"
...@@ -28,13 +26,13 @@ ...@@ -28,13 +26,13 @@
android:selectAllOnFocus="true" android:selectAllOnFocus="true"
android:imeOptions="actionGo" android:imeOptions="actionGo"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:textSize="15sp"/> android:textSize="15sp"/>
<View <View
android:id="@+id/noneditable_url_view_placeholder" android:id="@+id/noneditable_url_view_placeholder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:layout_height="match_parent"/>
</ViewSwitcher> </ViewSwitcher>
...@@ -42,9 +40,10 @@ ...@@ -42,9 +40,10 @@
android:id="@+id/menu_button" android:id="@+id/menu_button"
android:src="@android:drawable/ic_menu_more" android:src="@android:drawable/ic_menu_more"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:layout_width="wrap_content" android:layout_width="25dp"
android:layout_height="wrap_content" android:layout_height="25dp"
android:layout_gravity="end" android:scaleType="fitXY"
android:layout_marginTop="5dp"
android:layout_alignParentEnd="true"/> android:layout_alignParentEnd="true"/>
<ProgressBar <ProgressBar
......
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