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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/input/PastePopupMenu.java

Issue 441973002: PastePopup Menu icon is different for separate scenarios (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unused attribute *onTop* Created 6 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/input/PastePopupMenu.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/PastePopupMenu.java b/content/public/android/java/src/org/chromium/content/browser/input/PastePopupMenu.java
index b2127709b32de3fe024bd79f46e2eb7e17280e3f..b8bd747fee25cee82b1a4b201652987b788aba24 100644
--- a/content/public/android/java/src/org/chromium/content/browser/input/PastePopupMenu.java
+++ b/content/public/android/java/src/org/chromium/content/browser/input/PastePopupMenu.java
@@ -61,12 +61,7 @@ public class PastePopupMenu implements OnClickListener {
mContainer.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
mContainer.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
- final int[] POPUP_LAYOUT_ATTRS = {
- android.R.attr.textEditPasteWindowLayout,
- android.R.attr.textEditNoPasteWindowLayout,
- android.R.attr.textEditSidePasteWindowLayout,
- android.R.attr.textEditSideNoPasteWindowLayout,
- };
+ final int[] POPUP_LAYOUT_ATTRS = { android.R.attr.textEditPasteWindowLayout, };
mPasteViews = new View[POPUP_LAYOUT_ATTRS.length];
mPasteViewLayouts = new int[POPUP_LAYOUT_ATTRS.length];
@@ -96,7 +91,7 @@ public class PastePopupMenu implements OnClickListener {
*/
public void showAt(int x, int y) {
if (!canPaste()) return;
- updateContent(true);
+ updateContent();
positionAt(x, y);
}
@@ -146,7 +141,7 @@ public class PastePopupMenu implements OnClickListener {
final int screenWidth = mContext.getResources().getDisplayMetrics().widthPixels;
if (coords[1] < minOffsetY) {
- updateContent(false);
+ updateContent();
// Update dimensions from new view
contentView = mContainer.getContentView();
width = contentView.getMeasuredWidth();
@@ -174,37 +169,29 @@ public class PastePopupMenu implements OnClickListener {
mContainer.showAtLocation(mParent, Gravity.NO_GRAVITY, coords[0], coords[1]);
}
- private int viewIndex(boolean onTop) {
- return (onTop ? 0 : 1 << 1) + (canPaste() ? 0 : 1 << 0);
- }
-
- private void updateContent(boolean onTop) {
- final int viewIndex = viewIndex(onTop);
- View view = mPasteViews[viewIndex];
+ private void updateContent() {
+ final int viewIndex = 0;
- if (view == null) {
+ if (mPasteViews[viewIndex] == null) {
final int layout = mPasteViewLayouts[viewIndex];
LayoutInflater inflater = (LayoutInflater) mContext.
getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (inflater != null) {
- view = inflater.inflate(layout, null);
- }
-
- if (view == null) {
- throw new IllegalArgumentException("Unable to inflate TextEdit paste window");
+ mPasteViews[viewIndex] = inflater.inflate(layout, null);
+ if (mPasteViews[viewIndex] == null) {
+ throw new IllegalArgumentException("Unable to inflate TextEdit paste window");
+ }
}
final int size = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
- view.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
- ViewGroup.LayoutParams.WRAP_CONTENT));
- view.measure(size, size);
-
- view.setOnClickListener(this);
+ mPasteViews[viewIndex].setLayoutParams(
+ new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
+ mPasteViews[viewIndex].measure(size, size);
- mPasteViews[viewIndex] = view;
+ mPasteViews[viewIndex].setOnClickListener(this);
}
- mContainer.setContentView(view);
+ mContainer.setContentView(mPasteViews[viewIndex]);
}
private boolean canPaste() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698