Commit c82a9e4e authored by Bo Liu's avatar Bo Liu Committed by Commit Bot

android: Use DisplayAndroid in appmenu

Bug: 1042063
Change-Id: Icd092cbaa08951d90813e97ed869e91ac2af2672
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2016850Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Commit-Queue: Bo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#734621}
parent d9cfda8a
...@@ -12,10 +12,10 @@ import android.graphics.Point; ...@@ -12,10 +12,10 @@ import android.graphics.Point;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.view.ContextThemeWrapper; import android.view.ContextThemeWrapper;
import android.view.Display;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.WindowManager;
import android.widget.PopupMenu; import android.widget.PopupMenu;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
...@@ -27,6 +27,7 @@ import org.chromium.chrome.browser.lifecycle.ConfigurationChangedObserver; ...@@ -27,6 +27,7 @@ import org.chromium.chrome.browser.lifecycle.ConfigurationChangedObserver;
import org.chromium.chrome.browser.lifecycle.StartStopWithNativeObserver; import org.chromium.chrome.browser.lifecycle.StartStopWithNativeObserver;
import org.chromium.chrome.browser.ui.appmenu.internal.R; import org.chromium.chrome.browser.ui.appmenu.internal.R;
import org.chromium.chrome.browser.ui.widget.textbubble.TextBubble; import org.chromium.chrome.browser.ui.widget.textbubble.TextBubble;
import org.chromium.ui.display.DisplayAndroidManager;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -149,8 +150,8 @@ class AppMenuHandlerImpl ...@@ -149,8 +150,8 @@ class AppMenuHandlerImpl
boolean isByPermanentButton = false; boolean isByPermanentButton = false;
Context context = mDecorView.getContext(); Context context = mDecorView.getContext();
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = DisplayAndroidManager.getDefaultDisplayForContext(context);
int rotation = wm.getDefaultDisplay().getRotation(); int rotation = display.getRotation();
if (anchorView == null) { if (anchorView == null) {
// This fixes the bug where the bottom of the menu starts at the top of // This fixes the bug where the bottom of the menu starts at the top of
// the keyboard, instead of overlapping the keyboard as it should. // the keyboard, instead of overlapping the keyboard as it should.
...@@ -202,7 +203,7 @@ class AppMenuHandlerImpl ...@@ -202,7 +203,7 @@ class AppMenuHandlerImpl
appRect.bottom = mDecorView.getHeight(); appRect.bottom = mDecorView.getHeight();
} }
Point pt = new Point(); Point pt = new Point();
wm.getDefaultDisplay().getSize(pt); display.getSize(pt);
int footerResourceId = 0; int footerResourceId = 0;
if (mDelegate.shouldShowFooter(appRect.height())) { if (mDelegate.shouldShowFooter(appRect.height())) {
......
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