Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1383)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java

Issue 1229223002: Add a footer at the bottom of the menu for custom tabs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java
index cd053376aa7b04180022795783a9e6661c2ec460..4a7a4b1e5639bbe8a25579a36a4edffe0f7fad3c 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java
@@ -133,13 +133,24 @@ public class AppMenu implements OnItemClickListener, OnKeyListener {
* @param screenRotation Current device screen rotation.
* @param visibleDisplayFrame The display area rect in which AppMenu is supposed to fit in.
* @param screenHeight Current device screen height.
+ * @param promptViewResourceId The resource id for a view to add to the end of the menu list.
+ * Can be 0 if no such view is required.
*/
void show(Context context, View anchorView, boolean isByHardwareButton, int screenRotation,
- Rect visibleDisplayFrame, int screenHeight) {
+ Rect visibleDisplayFrame, int screenHeight, int promptViewResourceId) {
newt (away) 2015/07/10 16:08:38 The name "promptView" doesn't make any sense to me
Yusuf 2015/07/10 18:43:47 Done.
mPopup = new ListPopupWindow(context, null, android.R.attr.popupMenuStyle);
mPopup.setModal(true);
mPopup.setAnchorView(anchorView);
mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
+
+ int footerHeight = 0;
+ if (promptViewResourceId != 0) {
+ mPopup.setPromptPosition(ListPopupWindow.POSITION_PROMPT_BELOW);
+ mPopup.setPromptView(
newt (away) 2015/07/10 16:08:38 What happens if the list scrolls? Does the footer
Yusuf 2015/07/10 18:43:47 It stays in a fixed position at the bottom and tha
+ LayoutInflater.from(context).inflate(promptViewResourceId, null));
+ footerHeight = context.getResources().getDimensionPixelSize(
+ R.dimen.chrome_branding_footer_height);
+ }
mPopup.setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss() {
@@ -207,7 +218,8 @@ public class AppMenu implements OnItemClickListener, OnKeyListener {
mAdapter = new AppMenuAdapter(this, menuItems, LayoutInflater.from(context));
mPopup.setAdapter(mAdapter);
- setMenuHeight(menuItems.size(), visibleDisplayFrame, screenHeight, sizingPadding);
+ setMenuHeight(
+ menuItems.size(), visibleDisplayFrame, screenHeight, sizingPadding, footerHeight);
setPopupOffset(mPopup, mCurrentScreenRotation, visibleDisplayFrame, sizingPadding);
mPopup.setOnItemClickListener(this);
mPopup.show();
@@ -339,8 +351,8 @@ public class AppMenu implements OnItemClickListener, OnKeyListener {
return mMenu;
}
- private void setMenuHeight(
- int numMenuItems, Rect appDimensions, int screenHeight, Rect padding) {
+ private void setMenuHeight(int numMenuItems, Rect appDimensions,
+ int screenHeight, Rect padding, int footerHeight) {
assert mPopup.getAnchorView() != null;
View anchorView = mPopup.getAnchorView();
int[] anchorViewLocation = new int[2];
@@ -355,7 +367,7 @@ public class AppMenu implements OnItemClickListener, OnKeyListener {
int availableScreenSpace = Math.max(anchorViewLocation[1],
appDimensions.height() - anchorViewLocation[1] - anchorViewImpactHeight);
- availableScreenSpace -= padding.bottom;
+ availableScreenSpace -= padding.bottom + footerHeight;
if (mIsByHardwareButton) availableScreenSpace -= padding.top;
int numCanFit = availableScreenSpace / (mItemRowHeight + mItemDividerHeight);

Powered by Google App Engine
This is Rietveld 408576698