Skip to content

Commit

Permalink
[Start] Change the search box text size back to 16sp.
Browse files Browse the repository at this point in the history
Before:
https://screenshot.googleplex.com/5kFZwgirfg4iyA2

After:
https://screenshot.googleplex.com/AusDFdUnnynAAEL

(cherry picked from commit 0652823)

Bug: 1326202
Change-Id: I0068ce235dcb0a7e7d17f1a0426dcff7e45285f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3645686
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Commit-Queue: Hao Dong <spdonghao@chromium.org>
Reviewed-by: Xi Han <hanxi@chromium.org>
Reviewed-by: Brandon Wylie <wylieb@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1004433}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3652403
Cr-Commit-Position: refs/branch-heads/5060@{#110}
Cr-Branched-From: b83393d-refs/heads/main@{#1002911}
  • Loading branch information
spdonghao authored and Chromium LUCI CQ committed May 19, 2022
1 parent 4788d70 commit 747c1fe
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
android:gravity="center_vertical">
<EditText
android:id="@+id/search_box_text"
style="@style/TextAppearance.TasksSurfaceSearchBoxText"
style="@style/TextAppearance.SearchBoxText.NewTabPage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@null"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -715,11 +715,6 @@ private void initializeOffsetChangedListener() {
+ (getPixelSize(R.dimen.fake_search_box_lateral_padding)
- getPixelSize(R.dimen.search_box_start_padding));

float fakeTextSize = mActivity.getResources().getDimension(
R.dimen.tasks_surface_location_bar_url_text_size);
float realTextSize =
mActivity.getResources().getDimension(R.dimen.location_bar_url_text_size);

int fakeButtonSize = getPixelSize(R.dimen.tasks_surface_location_bar_url_button_size);
int realButtonSize = getPixelSize(R.dimen.location_bar_action_icon_width);

Expand All @@ -744,7 +739,6 @@ private void initializeOffsetChangedListener() {

mTasksSurface.updateFakeSearchBox(fakeHeight - reducedHeight, reducedHeight,
(int) (fakeEndPadding * (1 - expansionFraction)),
fakeTextSize + (realTextSize - fakeTextSize) * expansionFraction,
SearchEngineLogoUtils.getInstance().shouldShowSearchEngineLogo(false)
? realTranslationX * expansionFraction
: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,12 @@ void removeHeaderOffsetChangeListener(
* @param height Current height of the fake search box layout.
* @param topMargin Current top margin of the fake search box layout.
* @param endPadding Current end padding of the fake search box layout.
* @param textSize Current text size of text view in fake search box layout.
* @param translationX Current translationX of text view in fake search box layout.
* @param buttonSize Current height and width of the buttons in fake search box layout.
* @param lensButtonLeftMargin Current left margin of the lens button in fake search box layout.
*/
void updateFakeSearchBox(int height, int topMargin, int endPadding, float textSize,
float translationX, int buttonSize, int lensButtonLeftMargin);
void updateFakeSearchBox(int height, int topMargin, int endPadding, float translationX,
int buttonSize, int lensButtonLeftMargin);

/**
* Called when the Tasks surface is hidden.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,10 @@ public void removeHeaderOffsetChangeListener(
}

@Override
public void updateFakeSearchBox(int height, int topMargin, int endPadding, float textSize,
float translationX, int buttonSize, int lensButtonLeftMargin) {
mView.updateFakeSearchBox(height, topMargin, endPadding, textSize, translationX, buttonSize,
lensButtonLeftMargin);
public void updateFakeSearchBox(int height, int topMargin, int endPadding, float translationX,
int buttonSize, int lensButtonLeftMargin) {
mView.updateFakeSearchBox(
height, topMargin, endPadding, translationX, buttonSize, lensButtonLeftMargin);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,18 +387,16 @@ void removeHeaderOffsetChangeListener(
* @param height Current height of the fake search box layout.
* @param topMargin Current top margin of the fake search box layout.
* @param endPadding Current end padding of the fake search box layout.
* @param textSize Current text size of text view in fake search box layout.
* @param translationX Current translationX of text view in fake search box layout.
* @param buttonSize Current height and width of the buttons in fake search box layout.
* @param lensButtonLeftMargin Current left margin of the lens button in fake search box layout.
*/
void updateFakeSearchBox(int height, int topMargin, int endPadding, float textSize,
float translationX, int buttonSize, int lensButtonLeftMargin) {
void updateFakeSearchBox(int height, int topMargin, int endPadding, float translationX,
int buttonSize, int lensButtonLeftMargin) {
if (mSearchBoxCoordinator.getView().getVisibility() != View.VISIBLE) return;
mSearchBoxCoordinator.setHeight(height);
mSearchBoxCoordinator.setTopMargin(topMargin);
mSearchBoxCoordinator.setEndPadding(endPadding);
mSearchBoxCoordinator.setTextSize(textSize);
mSearchBoxCoordinator.setTextViewTranslationX(translationX);
mSearchBoxCoordinator.setButtonsHeight(buttonSize);
mSearchBoxCoordinator.setButtonsWidth(buttonSize);
Expand Down
1 change: 0 additions & 1 deletion chrome/android/features/tab_ui/java/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
<integer name="tab_grid_hovered_card_background_selected_color_alpha">26</integer>

<!-- Dimens for tasks view layout -->
<dimen name="tasks_surface_location_bar_url_text_size">18sp</dimen>
<dimen name="search_box_start_padding">16dp</dimen>
<dimen name="search_box_end_padding">10dp</dimen>
<dimen name="tasks_surface_location_bar_url_button_size"> 20dp</dimen>
Expand Down
5 changes: 0 additions & 5 deletions chrome/android/features/tab_ui/java/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,4 @@
<item name="chipColor">@color/chip_background_color</item>
</style>

<style name="TextAppearance.TasksSurfaceSearchBoxText">
<item name="android:textSize">@dimen/tasks_surface_location_bar_url_text_size</item>
<item name="android:textColorHint">@macro/search_box_hint</item>
</style>

</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,6 @@ public void setEndPadding(int endPadding) {
mMediator.setEndPadding(endPadding);
}

public void setTextSize(float textSize) {
mMediator.setTextSize(textSize);
}

public void setTextViewTranslationX(float translationX) {
mMediator.setTextViewTranslationX(translationX);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,6 @@ void setEndPadding(int endPadding) {
mModel.set(SearchBoxProperties.SEARCH_BOX_END_PADDING, endPadding);
}

void setTextSize(float textSize) {
mModel.set(SearchBoxProperties.SEARCH_TEXT_SIZE, textSize);
}

void setTextViewTranslationX(float translationX) {
mModel.set(SearchBoxProperties.SEARCH_TEXT_TRANSLATION_X, translationX);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ interface SearchBoxProperties {
WritableIntPropertyKey SEARCH_BOX_HEIGHT = new WritableIntPropertyKey();
WritableIntPropertyKey SEARCH_BOX_TOP_MARGIN = new WritableIntPropertyKey();
WritableIntPropertyKey SEARCH_BOX_END_PADDING = new WritableIntPropertyKey();
WritableFloatPropertyKey SEARCH_TEXT_SIZE = new WritableFloatPropertyKey();
WritableFloatPropertyKey SEARCH_TEXT_TRANSLATION_X = new WritableFloatPropertyKey();
WritableIntPropertyKey BUTTONS_HEIGHT = new WritableIntPropertyKey();
WritableIntPropertyKey BUTTONS_WIDTH = new WritableIntPropertyKey();
Expand All @@ -52,6 +51,5 @@ interface SearchBoxProperties {
VOICE_SEARCH_CLICK_CALLBACK, LENS_VISIBILITY, LENS_CLICK_CALLBACK, SEARCH_TEXT,
SEARCH_HINT_VISIBILITY, SEARCH_BOX_CLICK_CALLBACK, SEARCH_BOX_TEXT_WATCHER,
SEARCH_BOX_HINT_COLOR, SEARCH_BOX_HEIGHT, SEARCH_BOX_TOP_MARGIN, SEARCH_BOX_END_PADDING,
SEARCH_TEXT_SIZE, SEARCH_TEXT_TRANSLATION_X, BUTTONS_HEIGHT, BUTTONS_WIDTH,
LENS_BUTTON_LEFT_MARGIN};
SEARCH_TEXT_TRANSLATION_X, BUTTONS_HEIGHT, BUTTONS_WIDTH, LENS_BUTTON_LEFT_MARGIN};
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

package org.chromium.chrome.browser.ntp.search;

import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.MarginLayoutParams;
Expand Down Expand Up @@ -91,9 +90,6 @@ public final void bind(PropertyModel model, View view, PropertyKey propertyKey)
searchBoxContainer.getPaddingTop(),
model.get(SearchBoxProperties.SEARCH_BOX_END_PADDING),
searchBoxContainer.getPaddingBottom());
} else if (SearchBoxProperties.SEARCH_TEXT_SIZE == propertyKey) {
searchBoxTextView.setTextSize(
TypedValue.COMPLEX_UNIT_PX, model.get(SearchBoxProperties.SEARCH_TEXT_SIZE));
} else if (SearchBoxProperties.SEARCH_TEXT_TRANSLATION_X == propertyKey) {
searchBoxTextView.setTranslationX(
model.get(SearchBoxProperties.SEARCH_TEXT_TRANSLATION_X));
Expand Down

0 comments on commit 747c1fe

Please sign in to comment.