[Android] Account for status bar offset when position paste popup
The paste PopupMenu was getting clipped by the status bar when the insertion handle was brought close to the status bar. Update the position of the PopupMenu using the height of the status bar. BUG=397915 Review URL: https://codereview.chromium.org/421173002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287467 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
1
AUTHORS
1
AUTHORS
@ -225,6 +225,7 @@ Kevin Lee Helpingstine <sig11@reprehensible.net>
|
||||
Kevin M. McCormick <mckev@amazon.com>
|
||||
Kihong Kwon <kihong.kwon@samsung.com>
|
||||
Kim Christensen <kimworking@gmail.com>
|
||||
Kingshuk Jana <kingshuk.j@samsung.com>
|
||||
Klemen Forstnerič <klemen.forstneric@gmail.com>
|
||||
Krzysztof Wolanski <k.wolanski@samsung.com>
|
||||
Kunal Thakar <kunalt@gmail.com>
|
||||
|
@ -27,6 +27,7 @@ public class PastePopupMenu implements OnClickListener {
|
||||
private int mRawPositionY;
|
||||
private int mPositionX;
|
||||
private int mPositionY;
|
||||
private int mStatusBarHeight;
|
||||
private final View[] mPasteViews;
|
||||
private final int[] mPasteViewLayouts;
|
||||
private final int mLineOffsetY;
|
||||
@ -81,6 +82,13 @@ public class PastePopupMenu implements OnClickListener {
|
||||
5.0f, mContext.getResources().getDisplayMetrics());
|
||||
mWidthOffsetX = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
|
||||
30.0f, mContext.getResources().getDisplayMetrics());
|
||||
|
||||
final int statusBarHeightResourceId =
|
||||
mContext.getResources().getIdentifier("status_bar_height", "dimen", "android");
|
||||
if (statusBarHeightResourceId > 0) {
|
||||
mStatusBarHeight =
|
||||
mContext.getResources().getDimensionPixelSize(statusBarHeightResourceId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -131,8 +139,13 @@ public class PastePopupMenu implements OnClickListener {
|
||||
coords[0] += mPositionX;
|
||||
coords[1] += mPositionY;
|
||||
|
||||
int minOffsetY = 0;
|
||||
if (mParent.getSystemUiVisibility() == View.SYSTEM_UI_FLAG_VISIBLE) {
|
||||
minOffsetY = mStatusBarHeight;
|
||||
}
|
||||
|
||||
final int screenWidth = mContext.getResources().getDisplayMetrics().widthPixels;
|
||||
if (coords[1] < 0) {
|
||||
if (coords[1] < minOffsetY) {
|
||||
updateContent(false);
|
||||
// Update dimensions from new view
|
||||
contentView = mContainer.getContentView();
|
||||
|
Reference in New Issue
Block a user