diff options
author | Brian Attwell <brianattwell@google.com> | 2014-12-16 17:24:15 -0800 |
---|---|---|
committer | Brian Attwell <brianattwell@google.com> | 2014-12-16 17:24:15 -0800 |
commit | 2a3bf46d52d50cae159b724ad3d845d8c557a20b (patch) | |
tree | c57af1cdcf9f094fd36dfee7e974cdf9fde80f32 /src/com/android/contacts/widget | |
parent | cae9a73d0d07d0c3628515fd75738f5c169c1b00 (diff) | |
download | Contacts-2a3bf46d52d50cae159b724ad3d845d8c557a20b.tar.gz |
Remove hidden API calls from MultiShrinkScroller
Removed getBoundsOnScreen, DisplayInfo, DisplayManagerGlobal.get
The remaining hidden APIs used in multishrinkscroller require API
changes to fix.
Bug: 18777272
Change-Id: Iefc7d56e8d17db41ddd591658ef1e09925072f61
Diffstat (limited to 'src/com/android/contacts/widget')
-rw-r--r-- | src/com/android/contacts/widget/MultiShrinkScroller.java | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/com/android/contacts/widget/MultiShrinkScroller.java b/src/com/android/contacts/widget/MultiShrinkScroller.java index 50dfa3f3f..7b97643cd 100644 --- a/src/com/android/contacts/widget/MultiShrinkScroller.java +++ b/src/com/android/contacts/widget/MultiShrinkScroller.java @@ -19,12 +19,11 @@ import android.graphics.ColorMatrix; import android.graphics.ColorMatrixColorFilter; import android.graphics.Rect; import android.graphics.drawable.GradientDrawable; -import android.hardware.display.DisplayManagerGlobal; +import android.hardware.display.DisplayManager; import android.os.Trace; import android.util.AttributeSet; import android.util.TypedValue; import android.view.Display; -import android.view.DisplayInfo; import android.view.Gravity; import android.view.MotionEvent; import android.view.VelocityTracker; @@ -1032,14 +1031,14 @@ public class MultiShrinkScroller extends FrameLayout { * finishes moving into its target location/size. */ private void calculateCollapsedLargeTitlePadding() { - final Rect largeTextViewRect = new Rect(); - mToolbar.getBoundsOnScreen(largeTextViewRect); - final Rect invisiblePlaceholderTextViewRect = new Rect(); - mInvisiblePlaceholderTextView.getBoundsOnScreen(invisiblePlaceholderTextViewRect); + int invisiblePlaceHolderLocation[] = new int[2]; + int largeTextViewRectLocation[] = new int[2]; + mInvisiblePlaceholderTextView.getLocationOnScreen(invisiblePlaceHolderLocation); + mToolbar.getLocationOnScreen(largeTextViewRectLocation); // Distance between top of toolbar to the center of the target rectangle. - final int desiredTopToCenter = ( - invisiblePlaceholderTextViewRect.top + invisiblePlaceholderTextViewRect.bottom) - / 2 - largeTextViewRect.top; + final int desiredTopToCenter = invisiblePlaceHolderLocation[1] + + mInvisiblePlaceholderTextView.getHeight() / 2 + - largeTextViewRectLocation[1]; // Padding needed on the mLargeTextView so that it has the same amount of // padding as the target rectangle. mCollapsedTitleBottomMargin = desiredTopToCenter - mLargeTextView.getHeight() / 2; @@ -1239,7 +1238,7 @@ public class MultiShrinkScroller extends FrameLayout { * Similar to a {@link android.view.animation.AccelerateInterpolator} in the sense that * getInterpolation() is a quadratic function. */ - private static class AcceleratingFlingInterpolator implements Interpolator { + private class AcceleratingFlingInterpolator implements Interpolator { private final float mStartingSpeedPixelsPerFrame; private final float mDurationMs; @@ -1271,9 +1270,9 @@ public class MultiShrinkScroller extends FrameLayout { } private float getRefreshRate() { - DisplayInfo di = DisplayManagerGlobal.getInstance().getDisplayInfo( - Display.DEFAULT_DISPLAY); - return di.refreshRate; + final DisplayManager displayManager = (DisplayManager) MultiShrinkScroller + .this.getContext().getSystemService(Context.DISPLAY_SERVICE); + return displayManager.getDisplay(Display.DEFAULT_DISPLAY).getRefreshRate(); } public long getFrameIntervalMs() { |