Commit 969e355c authored by Tommy Nyquist's avatar Tommy Nyquist Committed by Commit Bot

Make unsupported OS menu item disabled.

Whenever a device is running an unsupported version of Android, we
display a menu item telling the user that Chrome is unable to
update. The same menu item is displayed (with different text and
visuals) whenever there is an update available. When the user
taps the menu item in the update available flow, they start
the update flow.

However, when the user is shown that they can not update, nothing
happens when they tap the item. This can lead to confusing
situations when using accessibility mode, since they are informed
that they can double tap to activate.

This CL changes this behavior to disable the menu item in the
unsupported OS case. The item is still possible to tap to inspect
though.

Bug: 852650
Change-Id: I1385bc798ea0324cc5043c390c20c40a45c2727f
Reviewed-on: https://chromium-review.googlesource.com/c/1327567Reviewed-by: default avatarTheresa <twellington@chromium.org>
Commit-Queue: Tommy Nyquist <nyquist@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606671}
parent a0bf7a19
......@@ -198,8 +198,10 @@ class AppMenuAdapter extends BaseAdapter {
holder = (CustomMenuItemViewHolder) convertView.getTag();
}
setupStandardMenuItemViewHolder(holder, convertView, item);
UpdateMenuItemHelper.getInstance().decorateMenuItemViews(
mInflater.getContext(), holder.text, holder.image, holder.summary);
boolean updateItemEnabled =
UpdateMenuItemHelper.getInstance().decorateMenuItemViews(
mInflater.getContext(), holder.text, holder.image, holder.summary);
convertView.setEnabled(updateItemEnabled);
break;
}
case MenuItemType.THREE_BUTTON:
......
......@@ -144,8 +144,9 @@ public class UpdateMenuItemHelper {
* @param title The title view.
* @param image The image view.
* @param summary The summary view.
* @return true if the menu item should be enabled. False otherwise.
*/
public void decorateMenuItemViews(
public boolean decorateMenuItemViews(
Context context, TextView title, AppMenuItemIcon image, TextView summary) {
switch (getUpdateType()) {
case UpdateType.UPDATE_AVAILABLE:
......@@ -163,7 +164,7 @@ public class UpdateMenuItemHelper {
}
image.setImageResource(R.drawable.badge_update_dark);
break;
return true;
case UpdateType.UNSUPPORTED_OS_VERSION:
title.setText(R.string.menu_update_unsupported);
// See crbug.com/899695 for why this line is necessary.
......@@ -174,13 +175,13 @@ public class UpdateMenuItemHelper {
summary.setText(R.string.menu_update_unsupported_summary_default);
image.setImageResource(R.drawable.ic_error_grey800_24dp_filled);
break;
return false;
case UpdateType.NONE:
// Intentional fall through.
case UpdateType.UNKNOWN:
// Intentional fall through.
default:
break;
return false;
}
}
......
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