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

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/PopupZoomer.java

Issue 2548013002: Remove redundant field initialization in Java code. (Closed)
Patch Set: rebase Created 4 years 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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.content.browser; 5 package org.chromium.content.browser;
6 6
7 import android.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.res.Resources; 9 import android.content.res.Resources;
10 import android.graphics.Bitmap; 10 import android.graphics.Bitmap;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 /** 49 /**
50 * Interface to be implemented to listen for touch events inside the zoomed area. 50 * Interface to be implemented to listen for touch events inside the zoomed area.
51 * The MotionEvent coordinates correspond to original unzoomed view. 51 * The MotionEvent coordinates correspond to original unzoomed view.
52 */ 52 */
53 public static interface OnTapListener { 53 public static interface OnTapListener {
54 public boolean onSingleTap(View v, MotionEvent event); 54 public boolean onSingleTap(View v, MotionEvent event);
55 public boolean onLongPress(View v, MotionEvent event); 55 public boolean onLongPress(View v, MotionEvent event);
56 } 56 }
57 57
58 private OnTapListener mOnTapListener = null; 58 private OnTapListener mOnTapListener;
59 59
60 /** 60 /**
61 * Interface to be implemented to add and remove PopupZoomer to/from the vie w hierarchy. 61 * Interface to be implemented to add and remove PopupZoomer to/from the vie w hierarchy.
62 */ 62 */
63 public static interface OnVisibilityChangedListener { 63 public static interface OnVisibilityChangedListener {
64 public void onPopupZoomerShown(PopupZoomer zoomer); 64 public void onPopupZoomerShown(PopupZoomer zoomer);
65 public void onPopupZoomerHidden(PopupZoomer zoomer); 65 public void onPopupZoomerHidden(PopupZoomer zoomer);
66 } 66 }
67 67
68 private OnVisibilityChangedListener mOnVisibilityChangedListener = null; 68 private OnVisibilityChangedListener mOnVisibilityChangedListener;
69 69
70 // Cached drawable used to frame the zooming popup. 70 // Cached drawable used to frame the zooming popup.
71 // TODO(tonyg): This should be marked purgeable so that if the system wants to recover this 71 // TODO(tonyg): This should be marked purgeable so that if the system wants to recover this
72 // memory, we can just reload it from the resource ID next time it is needed . 72 // memory, we can just reload it from the resource ID next time it is needed .
73 // See android.graphics.BitmapFactory.Options#inPurgeable 73 // See android.graphics.BitmapFactory.Options#inPurgeable
74 private static Drawable sOverlayDrawable; 74 private static Drawable sOverlayDrawable;
75 // The padding used for drawing the overlay around the content, instead of d irectly above it. 75 // The padding used for drawing the overlay around the content, instead of d irectly above it.
76 private static Rect sOverlayPadding; 76 private static Rect sOverlayPadding;
77 // The radius of the overlay bubble, used for rounding the bitmap to draw un derneath it. 77 // The radius of the overlay bubble, used for rounding the bitmap to draw un derneath it.
78 private static float sOverlayCornerRadius; 78 private static float sOverlayCornerRadius;
79 79
80 private final Interpolator mShowInterpolator = new OvershootInterpolator(); 80 private final Interpolator mShowInterpolator = new OvershootInterpolator();
81 private final Interpolator mHideInterpolator = new ReverseInterpolator(mShow Interpolator); 81 private final Interpolator mHideInterpolator = new ReverseInterpolator(mShow Interpolator);
82 82
83 private boolean mAnimating = false; 83 private boolean mAnimating;
84 private boolean mShowing = false; 84 private boolean mShowing;
85 private long mAnimationStartTime = 0; 85 private long mAnimationStartTime;
86 86
87 // The time that was left for the outwards animation to finish. 87 // The time that was left for the outwards animation to finish.
88 // This is used in the case that the zoomer is cancelled while it is still a nimating outwards, 88 // This is used in the case that the zoomer is cancelled while it is still a nimating outwards,
89 // to avoid having it jump to full size then animate closed. 89 // to avoid having it jump to full size then animate closed.
90 private long mTimeLeft = 0; 90 private long mTimeLeft;
91 91
92 // initDimensions() needs to be called in onDraw(). 92 // initDimensions() needs to be called in onDraw().
93 private boolean mNeedsToInitDimensions; 93 private boolean mNeedsToInitDimensions;
94 94
95 // Available view area after accounting for ZOOM_BOUNDS_MARGIN. 95 // Available view area after accounting for ZOOM_BOUNDS_MARGIN.
96 private RectF mViewClipRect; 96 private RectF mViewClipRect;
97 97
98 // The target rect to be zoomed. 98 // The target rect to be zoomed.
99 private Rect mTargetBounds; 99 private Rect mTargetBounds;
100 100
101 // The bitmap to hold the zoomed view. 101 // The bitmap to hold the zoomed view.
102 private Bitmap mZoomedBitmap; 102 private Bitmap mZoomedBitmap;
103 103
104 // How far to shift the canvas after all zooming is done, to keep it inside the bounds of the 104 // How far to shift the canvas after all zooming is done, to keep it inside the bounds of the
105 // view (including margin). 105 // view (including margin).
106 private float mShiftX = 0, mShiftY = 0; 106 private float mShiftX, mShiftY;
107 // The magnification factor of the popup. It is recomputed once we have mTar getBounds and 107 // The magnification factor of the popup. It is recomputed once we have mTar getBounds and
108 // mZoomedBitmap. 108 // mZoomedBitmap.
109 private float mScale = 1.0f; 109 private float mScale = 1.0f;
110 // The bounds representing the actual zoomed popup. 110 // The bounds representing the actual zoomed popup.
111 private RectF mClipRect; 111 private RectF mClipRect;
112 // The extrusion values are how far the zoomed area (mClipRect) extends from the touch point. 112 // The extrusion values are how far the zoomed area (mClipRect) extends from the touch point.
113 // These values to used to animate the popup. 113 // These values to used to animate the popup.
114 private float mLeftExtrusion, mTopExtrusion, mRightExtrusion, mBottomExtrusi on; 114 private float mLeftExtrusion, mTopExtrusion, mRightExtrusion, mBottomExtrusi on;
115 // The last touch point, where the animation will start from. 115 // The last touch point, where the animation will start from.
116 private final PointF mTouch = new PointF(); 116 private final PointF mTouch = new PointF();
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 } 555 }
556 556
557 @Override 557 @Override
558 public float getInterpolation(float input) { 558 public float getInterpolation(float input) {
559 input = 1.0f - input; 559 input = 1.0f - input;
560 if (mInterpolator == null) return input; 560 if (mInterpolator == null) return input;
561 return mInterpolator.getInterpolation(input); 561 return mInterpolator.getInterpolation(input);
562 } 562 }
563 } 563 }
564 } 564 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698