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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarLayout.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/infobar/InfoBarLayout.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarLayout.java
index 312102d0c74ba6bdaa6dc9db44156bf6d2aa8107..35596e96f1bffa9ff87d7684e4985ce659d9517c 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarLayout.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarLayout.java
@@ -9,12 +9,14 @@ import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
+import android.os.Build;
import android.support.annotation.Nullable;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextUtils;
import android.util.TypedValue;
+import android.view.PointerIcon;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
@@ -244,7 +246,15 @@ public final class InfoBarLayout extends ViewGroup implements View.OnClickListen
R.dimen.infobar_margin_between_stacked_buttons));
mButtonRowLayout.addView(primaryButton);
- if (secondaryView != null) mButtonRowLayout.addView(secondaryView);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Jinsuk Kim 2017/07/17 04:45:18 Version check is repeated more often than necessar
jaebaek 2017/07/18 07:48:21 This is for PointerIcon.TYPE_HAND, but I will move
+ setPointerIcon(primaryButton, PointerIcon.TYPE_HAND);
+ }
+ if (secondaryView != null) {
+ mButtonRowLayout.addView(secondaryView);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ setPointerIcon(secondaryView, PointerIcon.TYPE_HAND);
+ }
+ }
}
/**
@@ -550,6 +560,17 @@ public final class InfoBarLayout extends ViewGroup implements View.OnClickListen
closeButton.setContentDescription(context.getString(R.string.infobar_close));
closeButton.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ setPointerIcon(closeButton, PointerIcon.TYPE_HAND);
+ }
+
return closeButton;
}
+
+ private static void setPointerIcon(View view, int type) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ PointerIcon icon = PointerIcon.getSystemIcon(view.getContext(), type);
+ view.setPointerIcon(icon);
+ }
+ }
}

Powered by Google App Engine
This is Rietveld 408576698