Commit 70931726 authored by Theresa's avatar Theresa Committed by Commit Bot

Use 48dp bounding box for microphone on the NTP

BUG=594166

Change-Id: Ie5871930e089b8926f31a83854df6e8315d093a9
Reviewed-on: https://chromium-review.googlesource.com/c/1371820
Commit-Queue: Theresa <twellington@chromium.org>
Reviewed-by: default avatarBecky Zhou (OOO Dec 12 - Dec 31) <huayinz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#615759}
parent 4ea7f970
......@@ -39,8 +39,7 @@
android:addStatesFromChildren="true"
android:background="@drawable/ntp_search_box"
android:orientation="horizontal"
android:paddingStart="@dimen/location_bar_lateral_padding"
android:paddingEnd="@dimen/location_bar_lateral_padding" >
android:paddingStart="@dimen/location_bar_lateral_padding" >
<!-- TODO(crbug.com/900912): Fix and remove lint ignore -->
<EditText
tools:ignore="Autofill,LabelFor"
......@@ -57,12 +56,20 @@
android:gravity="center_vertical"
android:inputType="text"
android:singleLine="true" />
<!-- Padding start is applied so that microphone icon appears in the same location as it
does in the main url bar. The microphone button in the url bar is
location_bar_icon_width (28dp) wide with 4dp start padding. It is placed
location_bar_lateral_padding (10dp) from the edge of the omnibox background.
The 4dp start padding effectively leaves 44dp for a 24dp icon, so it will end up
10dp from the edge as well ((44 - 24) / 2). -->
<org.chromium.ui.widget.ChromeImageView
android:id="@+id/voice_search_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="48dp"
android:layout_height="match_parent"
android:paddingStart="4dp"
android:contentDescription="@string/accessibility_toolbar_btn_mic"
android:src="@drawable/btn_mic"
android:scaleType="centerInside"
app:tint="@color/dark_mode_tint" />
</view>
......
......@@ -12,6 +12,7 @@ import android.graphics.drawable.Drawable;
import android.graphics.drawable.RippleDrawable;
import android.os.Build;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewCompat;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.AttributeSet;
......@@ -772,6 +773,12 @@ public class NewTabPageLayout extends LinearLayout implements TileGroup.Observer
*/
void updateVoiceSearchButtonVisibility() {
mVoiceSearchButton.setVisibility(mManager.isVoiceSearchEnabled() ? VISIBLE : GONE);
ViewCompat.setPaddingRelative(mSearchBoxView, ViewCompat.getPaddingStart(mSearchBoxView),
mSearchBoxView.getPaddingTop(),
mManager.isVoiceSearchEnabled() ? 0
: getResources().getDimensionPixelSize(
R.dimen.location_bar_lateral_padding),
mSearchBoxView.getPaddingBottom());
}
@Override
......
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