Commit 3b260329 authored by Boris Sazonov's avatar Boris Sazonov Committed by Commit Bot

[Android] Fix highlight for toolbar buttons

This CL fixes the button highlight when toolbar buttons are focused
using a keyboard. There are two unrelated fixes:
1. ToggleTabStackButton now inherits ChromeImageButton instead of
   generic ImageButton.
2. ToolbarMenuButtonPhone style no longer forces the background to be
   null, keeping selectableItemBackground set by ToolbarButton style.

Bug: 955037
Change-Id: Idc20378c9660dc0d95189af5efc417dd861512da
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1725909
Commit-Queue: Theresa <twellington@chromium.org>
Auto-Submit: Boris Sazonov <bsazonov@chromium.org>
Reviewed-by: default avatarTheresa <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682259}
parent 80aa9a66
...@@ -701,7 +701,6 @@ ...@@ -701,7 +701,6 @@
<style name="ToolbarMenuButtonPhone" parent="ToolbarButton"> <style name="ToolbarMenuButtonPhone" parent="ToolbarButton">
<item name="android:layout_gravity">top</item> <item name="android:layout_gravity">top</item>
<item name="android:paddingEnd">8dp</item> <item name="android:paddingEnd">8dp</item>
<item name="android:background">@null</item>
</style> </style>
<style name="ToolbarMenuButtonTablet" parent="ToolbarButton"> <style name="ToolbarMenuButtonTablet" parent="ToolbarButton">
<item name="android:layout_width">43dp</item> <item name="android:layout_width">43dp</item>
......
...@@ -8,21 +8,21 @@ import android.content.Context; ...@@ -8,21 +8,21 @@ import android.content.Context;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View; import android.view.View;
import android.widget.ImageButton;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.toolbar.TabCountProvider; import org.chromium.chrome.browser.toolbar.TabCountProvider;
import org.chromium.chrome.browser.toolbar.TabSwitcherDrawable; import org.chromium.chrome.browser.toolbar.TabSwitcherDrawable;
import org.chromium.chrome.browser.util.AccessibilityUtil; import org.chromium.chrome.browser.util.AccessibilityUtil;
import org.chromium.ui.widget.ChromeImageButton;
/** /**
* A button displaying the number of open tabs. Clicking the button toggles the tab switcher view. * A button displaying the number of open tabs. Clicking the button toggles the tab switcher view.
* TODO(twellington): Replace with TabSwitcherButtonCoordinator so code can be shared with bottom * TODO(twellington): Replace with TabSwitcherButtonCoordinator so code can be shared with bottom
* toolbar. * toolbar.
*/ */
public class ToggleTabStackButton extends ImageButton implements TabCountProvider.TabCountObserver, public class ToggleTabStackButton
View.OnClickListener, extends ChromeImageButton implements TabCountProvider.TabCountObserver,
View.OnLongClickListener { View.OnClickListener, View.OnLongClickListener {
private TabSwitcherDrawable mTabSwitcherButtonDrawable; private TabSwitcherDrawable mTabSwitcherButtonDrawable;
private TabSwitcherDrawable mTabSwitcherButtonDrawableLight; private TabSwitcherDrawable mTabSwitcherButtonDrawableLight;
private TabCountProvider mTabCountProvider; private TabCountProvider mTabCountProvider;
......
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