Skip to content

Commit

Permalink
[APS] Add tooltip text and circular highlight for StatusView
Browse files Browse the repository at this point in the history
Demo: https://drive.google.com/file/d/19ZWK0emmShyTWOjdl52mvHrtz-6U1zxT/view?usp=sharing
Additional demo to verify long-click: https://drive.google.com/file/d/1AVdyEHtcRnJkVkexk8fjgN7Rmb6dklAF/view?usp=sharing

Bug: 1473109
Change-Id: Icd9c1d252c80a1b05ef040547923e26129d546d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4799113
Reviewed-by: Aishwarya Rajesh <aishwaryarj@google.com>
Reviewed-by: Theresa Sullivan <twellington@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Commit-Queue: Zhe Li <zheliooo@google.com>
Reviewed-by: Sirisha Kavuluru <skavuluru@google.com>
Cr-Commit-Position: refs/heads/main@{#1188104}
  • Loading branch information
Zhe Li authored and Chromium LUCI CQ committed Aug 25, 2023
1 parent cf2f5f6 commit bc4d3e8
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 1 deletion.
2 changes: 2 additions & 0 deletions chrome/browser/ui/android/omnibox/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ android_resources("java_resources") {
"java/res/drawable/logo_translate_round.xml",
"java/res/drawable/omnibox_button_highlight_layer_list.xml",
"java/res/drawable/omnibox_button_ripple.xml",
"java/res/drawable/status_view_highlight_layer_list.xml",
"java/res/drawable/status_view_ripple.xml",
"java/res/drawable/switch_to_tab.xml",
"java/res/drawable/trending_up_black_24dp.xml",
"java/res/layout-sw600dp/location_bar.xml",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2023 The Chromium Authors
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Background for the hovered and pressed state -->
<item
android:width="@dimen/status_view_highlight_size"
android:height="@dimen/status_view_highlight_size"
android:gravity="center">

<shape android:shape="oval">
<solid android:color="@color/toolbar_button_highlight_color" />
</shape>
</item>
</layer-list>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2023 The Chromium Authors
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:attr/colorControlHighlight">
<item
android:id="@android:id/content"
android:drawable="@drawable/status_view_highlight_layer_list">
</item>
</ripple>
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ found in the LICENSE file.
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:focusable="true"
android:screenReaderFocusable="true">
android:screenReaderFocusable="true"
android:background="@drawable/status_view_ripple">

<!-- End padding is adjusted programmatically. -->
<ViewStub
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,6 @@ found in the LICENSE file.
<dimen name="toolbar_button_highlight_size">40dp</dimen>
<dimen name="omnibox_button_highlight_width">40dp</dimen>
<dimen name="omnibox_button_highlight_height">32dp</dimen>
<dimen name="status_view_highlight_size">32dp</dimen>
<dimen name="location_bar_url_action_padding_small">3dp</dimen>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.RotateDrawable;
import android.os.Build;
import android.os.Build.VERSION;
import android.util.AttributeSet;
import android.view.TouchDelegate;
import android.view.View;
Expand All @@ -24,6 +26,7 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.appcompat.widget.TooltipCompat;

import org.chromium.chrome.browser.browser_controls.BrowserStateBrowserControlsVisibilityDelegate;
import org.chromium.chrome.browser.omnibox.OmniboxFeatures;
Expand Down Expand Up @@ -100,6 +103,12 @@ protected void onFinishInflate() {
mStatusExtraSpace = findViewById(R.id.location_bar_verbose_status_extra_space);

configureAccessibilityDescriptions();

// Set tooltip text in StatusView.
if (VERSION.SDK_INT >= Build.VERSION_CODES.O) {
TooltipCompat.setTooltipText((View) this,
mStatusIconView.getContext().getString(R.string.accessibility_menu_info));
}
}

/**
Expand Down

0 comments on commit bc4d3e8

Please sign in to comment.