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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/snackbar/SnackbarView.java

Issue 2878403002: Support setting mouse cursor icon in Android N. (Closed)
Patch Set: Override onResolvePointerIcon 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.snackbar; 5 package org.chromium.chrome.browser.snackbar;
6 6
7 import android.animation.Animator; 7 import android.animation.Animator;
8 import android.animation.AnimatorListenerAdapter; 8 import android.animation.AnimatorListenerAdapter;
9 import android.animation.AnimatorSet; 9 import android.animation.AnimatorSet;
10 import android.animation.ObjectAnimator; 10 import android.animation.ObjectAnimator;
11 import android.app.Activity; 11 import android.app.Activity;
12 import android.graphics.Rect; 12 import android.graphics.Rect;
13 import android.graphics.drawable.Drawable; 13 import android.graphics.drawable.Drawable;
14 import android.graphics.drawable.GradientDrawable; 14 import android.graphics.drawable.GradientDrawable;
15 import android.os.Build;
15 import android.support.annotation.Nullable; 16 import android.support.annotation.Nullable;
16 import android.view.Gravity; 17 import android.view.Gravity;
17 import android.view.LayoutInflater; 18 import android.view.LayoutInflater;
19 import android.view.PointerIcon;
18 import android.view.SurfaceView; 20 import android.view.SurfaceView;
19 import android.view.View; 21 import android.view.View;
20 import android.view.View.OnClickListener; 22 import android.view.View.OnClickListener;
21 import android.view.View.OnLayoutChangeListener; 23 import android.view.View.OnLayoutChangeListener;
22 import android.view.ViewGroup; 24 import android.view.ViewGroup;
23 import android.view.animation.DecelerateInterpolator; 25 import android.view.animation.DecelerateInterpolator;
24 import android.widget.FrameLayout; 26 import android.widget.FrameLayout;
25 import android.widget.ImageView; 27 import android.widget.ImageView;
26 import android.widget.TextView; 28 import android.widget.TextView;
27 29
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 mParent = mOriginalParent; 88 mParent = mOriginalParent;
87 mView = (ViewGroup) LayoutInflater.from(activity).inflate( 89 mView = (ViewGroup) LayoutInflater.from(activity).inflate(
88 R.layout.snackbar, mParent, false); 90 R.layout.snackbar, mParent, false);
89 mAnimationDuration = mView.getResources() 91 mAnimationDuration = mView.getResources()
90 .getInteger(android.R.integer.config_mediumAnimTime); 92 .getInteger(android.R.integer.config_mediumAnimTime);
91 mMessageView = (TemplatePreservingTextView) mView.findViewById(R.id.snac kbar_message); 93 mMessageView = (TemplatePreservingTextView) mView.findViewById(R.id.snac kbar_message);
92 mActionButtonView = (TextView) mView.findViewById(R.id.snackbar_button); 94 mActionButtonView = (TextView) mView.findViewById(R.id.snackbar_button);
93 mActionButtonView.setOnClickListener(listener); 95 mActionButtonView.setOnClickListener(listener);
94 mProfileImageView = (ImageView) mView.findViewById(R.id.snackbar_profile _image); 96 mProfileImageView = (ImageView) mView.findViewById(R.id.snackbar_profile _image);
95 97
98 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
99 PointerIcon icon =
100 PointerIcon.getSystemIcon(mView.getContext(), PointerIcon.TY PE_ARROW);
101 mView.setPointerIcon(icon);
102 }
103
96 updateInternal(snackbar, false); 104 updateInternal(snackbar, false);
97 } 105 }
98 106
99 void show() { 107 void show() {
100 addToParent(); 108 addToParent();
101 mView.addOnLayoutChangeListener(new OnLayoutChangeListener() { 109 mView.addOnLayoutChangeListener(new OnLayoutChangeListener() {
102 @Override 110 @Override
103 public void onLayoutChange(View v, int left, int top, int right, int bottom, 111 public void onLayoutChange(View v, int left, int top, int right, int bottom,
104 int oldLeft, int oldTop, int oldRight, int oldBottom) { 112 int oldLeft, int oldTop, int oldRight, int oldBottom) {
105 mView.removeOnLayoutChangeListener(this); 113 mView.removeOnLayoutChangeListener(this);
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 view.animate().cancel(); 288 view.animate().cancel();
281 if (animate) { 289 if (animate) {
282 view.setAlpha(0.0f); 290 view.setAlpha(0.0f);
283 view.setText(text); 291 view.setText(text);
284 view.animate().alpha(1.f).setDuration(mAnimationDuration).setListene r(null); 292 view.animate().alpha(1.f).setDuration(mAnimationDuration).setListene r(null);
285 } else { 293 } else {
286 view.setText(text); 294 view.setText(text);
287 } 295 }
288 } 296 }
289 } 297 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698