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

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

Issue 1339433003: [Android] Use the right visibility type for PopupWindow handles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review Created 5 years, 3 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/PopupTouchHandleDrawable.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/PopupTouchHandleDrawable.java b/content/public/android/java/src/org/chromium/content/browser/input/PopupTouchHandleDrawable.java
index 8d68dec508e005f667ccb4a217df24a9d35b9e3a..820f38e1603d6b0e777da42bd395dd1efdbcd4d4 100644
--- a/content/public/android/java/src/org/chromium/content/browser/input/PopupTouchHandleDrawable.java
+++ b/content/public/android/java/src/org/chromium/content/browser/input/PopupTouchHandleDrawable.java
@@ -8,8 +8,11 @@ import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
+import android.os.Build;
import android.view.MotionEvent;
import android.view.View;
+import android.view.ViewGroup;
+import android.view.WindowManager;
import android.view.animation.AnimationUtils;
import android.widget.PopupWindow;
@@ -19,6 +22,8 @@ import org.chromium.content.browser.PositionObserver;
import org.chromium.ui.touch_selection.TouchHandleOrientation;
import java.lang.ref.WeakReference;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
/**
* View that displays a selection or insertion handle for text editing.
@@ -116,6 +121,9 @@ public class PopupTouchHandleDrawable extends View {
mContainer.setSplitTouchEnabled(true);
mContainer.setClippingEnabled(false);
mContainer.setAnimationStyle(0);
+ mContainer.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
+ mContainer.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
+ setWindowLayoutType(mContainer, WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL);
mAlpha = 1.f;
mVisible = getVisibility() == VISIBLE;
mParentPositionListener = new PositionObserver.Listener() {
@@ -126,6 +134,21 @@ public class PopupTouchHandleDrawable extends View {
};
}
+ private static void setWindowLayoutType(PopupWindow window, int layoutType) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ window.setWindowLayoutType(layoutType);
+ return;
+ }
+
+ try {
+ Method setWindowLayoutTypeMethod =
+ PopupWindow.class.getMethod("setWindowLayoutType", int.class);
+ setWindowLayoutTypeMethod.invoke(window, layoutType);
+ } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException
+ | RuntimeException e) {
+ }
+ }
+
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouchEvent(MotionEvent event) {
« 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