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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/widget/FadingBackgroundView.java

Issue 2878403002: Support setting mouse cursor icon in Android N. (Closed)
Patch Set: Support setting mouse cursor icon in Android N Created 3 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/widget/FadingBackgroundView.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/FadingBackgroundView.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/FadingBackgroundView.java
index a65240b57bf636cfd12cb3f2da2e1f536c90982c..4d98e4d19f726f6a48364795db825afcd425d047 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/widget/FadingBackgroundView.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/FadingBackgroundView.java
@@ -9,6 +9,7 @@ import android.animation.ObjectAnimator;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
+import android.view.ViewGroup.LayoutParams;
import org.chromium.base.ObserverList;
import org.chromium.chrome.browser.util.MathUtils;
@@ -98,7 +99,11 @@ public class FadingBackgroundView extends View implements View.OnClickListener {
@Override
public void setVisibility(int visibility) {
- if (getAlpha() <= 0f && visibility == View.VISIBLE) return;
+ if (getAlpha() <= 0f && visibility == View.VISIBLE) {
+ changeHeight(0);
Ted C 2017/07/18 16:41:18 changing the layout height in this case seems wron
mdjones 2017/07/19 18:40:50 For this view, alpha is tied to visibility (see se
+ return;
+ }
+ changeHeight(visibility == View.VISIBLE ? LayoutParams.MATCH_PARENT : 0);
super.setVisibility(visibility);
}
@@ -164,6 +169,18 @@ public class FadingBackgroundView extends View implements View.OnClickListener {
mOverlayAnimator.start();
}
+ /**
+ * Change height of this view.
+ * @param height The height that it should be.
+ */
+ private void changeHeight(int height) {
+ LayoutParams params = getLayoutParams();
+ if (params != null && params.height != height) {
+ params.height = height;
+ setLayoutParams(params);
+ }
+ }
+
/**
* Adds an observer to this fading view.
* @param observer The observer to be added.

Powered by Google App Engine
This is Rietveld 408576698