mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1209967 - Remove HardwareUtils.hasMenuButton. r=sebastian
This commit is contained in:
parent
4cc62f6205
commit
907df163ee
@ -367,13 +367,9 @@ public class TabsPanel extends LinearLayout
|
||||
|
||||
mAddTab.setVisibility(View.VISIBLE);
|
||||
|
||||
if (!HardwareUtils.hasMenuButton()) {
|
||||
mMenuButton.setVisibility(View.VISIBLE);
|
||||
mMenuButton.setEnabled(true);
|
||||
mPopupMenu.setAnchor(mMenuButton);
|
||||
} else {
|
||||
mPopupMenu.setAnchor(mAddTab);
|
||||
}
|
||||
mMenuButton.setVisibility(View.VISIBLE);
|
||||
mMenuButton.setEnabled(true);
|
||||
mPopupMenu.setAnchor(mMenuButton);
|
||||
}
|
||||
|
||||
public int getVerticalPanelHeight() {
|
||||
|
@ -129,7 +129,6 @@ public abstract class BrowserToolbar extends ThemedRelativeLayout
|
||||
private OnStopEditingListener stopEditingListener;
|
||||
|
||||
protected final BrowserApp activity;
|
||||
protected boolean hasSoftMenuButton;
|
||||
|
||||
protected UIMode uiMode;
|
||||
protected TabHistoryController tabHistoryController;
|
||||
@ -194,7 +193,6 @@ public abstract class BrowserToolbar extends ThemedRelativeLayout
|
||||
|
||||
menuButton = (ThemedFrameLayout) findViewById(R.id.menu);
|
||||
menuIcon = (ThemedImageView) findViewById(R.id.menu_icon);
|
||||
hasSoftMenuButton = !HardwareUtils.hasMenuButton();
|
||||
|
||||
// The focusOrder List should be filled by sub-classes.
|
||||
focusOrder = new ArrayList<View>();
|
||||
@ -321,17 +319,15 @@ public abstract class BrowserToolbar extends ThemedRelativeLayout
|
||||
});
|
||||
tabsButton.setImageLevel(0);
|
||||
|
||||
if (hasSoftMenuButton) {
|
||||
menuButton.setVisibility(View.VISIBLE);
|
||||
menuButton.setOnClickListener(new Button.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
// Drop the soft keyboard.
|
||||
urlEditLayout.clearFocus();
|
||||
activity.openOptionsMenu();
|
||||
}
|
||||
});
|
||||
}
|
||||
menuButton.setVisibility(View.VISIBLE);
|
||||
menuButton.setOnClickListener(new Button.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
// Drop the soft keyboard.
|
||||
urlEditLayout.clearFocus();
|
||||
activity.openOptionsMenu();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -660,7 +656,7 @@ public abstract class BrowserToolbar extends ThemedRelativeLayout
|
||||
|
||||
public void setToolBarButtonsAlpha(float alpha) {
|
||||
ViewHelper.setAlpha(tabsCounter, alpha);
|
||||
if (hasSoftMenuButton && !HardwareUtils.isTablet()) {
|
||||
if (!HardwareUtils.isTablet()) {
|
||||
ViewHelper.setAlpha(menuIcon, alpha);
|
||||
}
|
||||
}
|
||||
@ -855,10 +851,6 @@ public abstract class BrowserToolbar extends ThemedRelativeLayout
|
||||
}
|
||||
|
||||
public boolean openOptionsMenu() {
|
||||
if (!hasSoftMenuButton) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Initialize the popup.
|
||||
if (menuPopup == null) {
|
||||
View panel = activity.getMenuPanel();
|
||||
@ -882,10 +874,6 @@ public abstract class BrowserToolbar extends ThemedRelativeLayout
|
||||
}
|
||||
|
||||
public boolean closeOptionsMenu() {
|
||||
if (!hasSoftMenuButton) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (menuPopup != null && menuPopup.isShowing()) {
|
||||
menuPopup.dismiss();
|
||||
}
|
||||
|
@ -118,15 +118,11 @@ class BrowserToolbarPhone extends BrowserToolbarPhoneBase {
|
||||
animator.attach(tabsCounter,
|
||||
PropertyAnimator.Property.TRANSLATION_X,
|
||||
curveTranslation);
|
||||
|
||||
if (!HardwareUtils.hasMenuButton()) {
|
||||
animator.attach(menuButton,
|
||||
PropertyAnimator.Property.TRANSLATION_X,
|
||||
curveTranslation);
|
||||
|
||||
animator.attach(menuIcon,
|
||||
PropertyAnimator.Property.TRANSLATION_X,
|
||||
curveTranslation);
|
||||
}
|
||||
animator.attach(menuButton,
|
||||
PropertyAnimator.Property.TRANSLATION_X,
|
||||
curveTranslation);
|
||||
animator.attach(menuIcon,
|
||||
PropertyAnimator.Property.TRANSLATION_X,
|
||||
curveTranslation);
|
||||
}
|
||||
}
|
||||
|
@ -127,24 +127,18 @@ abstract class BrowserToolbarPhoneBase extends BrowserToolbar {
|
||||
public void triggerTabsPanelTransition(final PropertyAnimator animator, final boolean areTabsShown) {
|
||||
if (areTabsShown) {
|
||||
ViewHelper.setAlpha(tabsCounter, 0.0f);
|
||||
if (hasSoftMenuButton) {
|
||||
ViewHelper.setAlpha(menuIcon, 0.0f);
|
||||
}
|
||||
ViewHelper.setAlpha(menuIcon, 0.0f);
|
||||
return;
|
||||
}
|
||||
|
||||
final PropertyAnimator buttonsAnimator =
|
||||
new PropertyAnimator(animator.getDuration(), buttonsInterpolator);
|
||||
|
||||
buttonsAnimator.attach(tabsCounter,
|
||||
PropertyAnimator.Property.ALPHA,
|
||||
1.0f);
|
||||
if (hasSoftMenuButton) {
|
||||
buttonsAnimator.attach(menuIcon,
|
||||
PropertyAnimator.Property.ALPHA,
|
||||
1.0f);
|
||||
}
|
||||
|
||||
buttonsAnimator.attach(menuIcon,
|
||||
PropertyAnimator.Property.ALPHA,
|
||||
1.0f);
|
||||
buttonsAnimator.start();
|
||||
}
|
||||
|
||||
|
@ -54,17 +54,12 @@ class BrowserToolbarPreHC extends BrowserToolbarPhoneBase {
|
||||
|
||||
// Prevent taps through the editing mode cancel button (bug 1001243).
|
||||
tabsButton.setEnabled(!isEditing);
|
||||
menuButton.setEnabled(!isEditing);
|
||||
|
||||
ViewHelper.setTranslationX(urlBarTranslatingEdge, entryTranslation);
|
||||
ViewHelper.setTranslationX(tabsButton, curveTranslation);
|
||||
ViewHelper.setTranslationX(tabsCounter, curveTranslation);
|
||||
|
||||
if (!HardwareUtils.hasMenuButton()) {
|
||||
// Prevent tabs through the editing mode cancel button (bug 1001243).
|
||||
menuButton.setEnabled(!isEditing);
|
||||
|
||||
ViewHelper.setTranslationX(menuButton, curveTranslation);
|
||||
ViewHelper.setTranslationX(menuIcon, curveTranslation);
|
||||
}
|
||||
ViewHelper.setTranslationX(menuButton, curveTranslation);
|
||||
ViewHelper.setTranslationX(menuIcon, curveTranslation);
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ abstract class BrowserToolbarTabletBase extends BrowserToolbar {
|
||||
ColorUtils.getColor(context, R.color.tabs_tray_icon_grey), PorterDuff.Mode.SRC_IN);
|
||||
|
||||
menuButtonMarginView = findViewById(R.id.menu_margin);
|
||||
if (menuButtonMarginView != null && !HardwareUtils.hasMenuButton()) {
|
||||
if (menuButtonMarginView != null) {
|
||||
menuButtonMarginView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,6 @@ public final class HardwareUtils {
|
||||
private static volatile boolean sIsLargeTablet;
|
||||
private static volatile boolean sIsSmallTablet;
|
||||
private static volatile boolean sIsTelevision;
|
||||
private static volatile boolean sHasMenuButton;
|
||||
|
||||
private HardwareUtils() {
|
||||
}
|
||||
@ -51,23 +50,16 @@ public final class HardwareUtils {
|
||||
// Pre-populate common flags from the context.
|
||||
final int screenLayoutSize = context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
|
||||
if (Build.VERSION.SDK_INT >= 11) {
|
||||
sHasMenuButton = false;
|
||||
if (screenLayoutSize == Configuration.SCREENLAYOUT_SIZE_XLARGE) {
|
||||
sIsLargeTablet = true;
|
||||
} else if (screenLayoutSize == Configuration.SCREENLAYOUT_SIZE_LARGE) {
|
||||
sIsSmallTablet = true;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 14) {
|
||||
sHasMenuButton = ViewConfiguration.get(context).hasPermanentMenuKey();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 16) {
|
||||
if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEVISION)) {
|
||||
sIsTelevision = true;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 16) {
|
||||
if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEVISION)) {
|
||||
sIsTelevision = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sHasMenuButton = true;
|
||||
}
|
||||
|
||||
sInited = true;
|
||||
@ -89,11 +81,6 @@ public final class HardwareUtils {
|
||||
return sIsTelevision;
|
||||
}
|
||||
|
||||
public static boolean hasMenuButton() {
|
||||
// TODO: Remove these calls.
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int getMemSize() {
|
||||
return SysInfo.getMemSize();
|
||||
}
|
||||
|
@ -217,10 +217,6 @@ public class FxAccountStatusFragment
|
||||
syncNowPreference = ensureFindPreference("sync_now");
|
||||
syncNowPreference.setEnabled(true);
|
||||
syncNowPreference.setOnPreferenceClickListener(this);
|
||||
|
||||
if (HardwareUtils.hasMenuButton()) {
|
||||
syncCategory.removePreference(morePreference);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -245,7 +245,7 @@ public class AppMenuComponent extends BaseComponent {
|
||||
|
||||
// This is a hack needed for tablets where the OverflowMenuButton is always in the GONE state,
|
||||
// so we press the menu key instead.
|
||||
if (HardwareUtils.hasMenuButton() || DeviceHelper.isTablet()) {
|
||||
if (DeviceHelper.isTablet()) {
|
||||
mSolo.sendKey(Solo.MENU);
|
||||
} else {
|
||||
pressOverflowMenuButton();
|
||||
|
Loading…
Reference in New Issue
Block a user