diff options
| author | Jim Miller <jaggies@google.com> | 2012-05-12 14:12:03 -0700 |
|---|---|---|
| committer | Jim Miller <jaggies@google.com> | 2012-05-12 14:23:23 -0700 |
| commit | c6e523ea9bc15f18c9cbf04b05e8d2c90298453f (patch) | |
| tree | c4fdf60dcb485839bd40eb479fab52a7f99703d5 /core/java | |
| parent | d83fdd03a1daaf577d80c8abda86c7c01bf6d3bb (diff) | |
| download | frameworks_base-c6e523ea9bc15f18c9cbf04b05e8d2c90298453f.zip frameworks_base-c6e523ea9bc15f18c9cbf04b05e8d2c90298453f.tar.gz frameworks_base-c6e523ea9bc15f18c9cbf04b05e8d2c90298453f.tar.bz2 | |
Fix 6486099: Fix clipping issues with MultiWaveView on phone/tablet
This fixes a problem where the bounds of the view weren't being
calculated properly when a separate outer radius was specified.
The code now takes the maximum of the ring drawable's width/height
and that specified in the resource files.
This gives it the best default look on all devices while still
allowing minor tweaks.
Change-Id: I5daa40ff4f14653c8cc89b39102816afb976e4f7
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java index d6ffba2..60cd895 100644 --- a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java +++ b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java @@ -258,14 +258,14 @@ public class MultiWaveView extends View { protected int getSuggestedMinimumWidth() { // View should be large enough to contain the background + handle and // target drawable on either edge. - return mOuterRing.getWidth() + mMaxTargetWidth; + return (int) (Math.max(mOuterRing.getWidth(), 2 * mOuterRadius) + mMaxTargetWidth); } @Override protected int getSuggestedMinimumHeight() { // View should be large enough to contain the unlock ring + target and // target drawable on either edge - return mOuterRing.getHeight() + mMaxTargetHeight; + return (int) (Math.max(mOuterRing.getHeight(), 2 * mOuterRadius) + mMaxTargetHeight); } private int resolveMeasured(int measureSpec, int desired) @@ -941,10 +941,14 @@ public class MultiWaveView extends View { super.onLayout(changed, left, top, right, bottom); final int width = right - left; final int height = bottom - top; + // Target placement width/height. This puts the targets on the greater of the ring + // width or the specified outer radius. + final float placementWidth = Math.max(mOuterRing.getWidth(), 2 * mOuterRadius); + final float placementHeight = Math.max(mOuterRing.getHeight(), 2 * mOuterRadius); float newWaveCenterX = mHorizontalOffset + mHorizontalInset - + Math.max(width, mMaxTargetWidth + mOuterRing.getWidth()) / 2; + + Math.max(width, mMaxTargetWidth + placementWidth) / 2; float newWaveCenterY = mVerticalOffset + mVerticalInset - + Math.max(height, + mMaxTargetHeight + mOuterRing.getHeight()) / 2; + + Math.max(height, + mMaxTargetHeight + placementHeight) / 2; assignDefaultsIfNeeded(newWaveCenterX, newWaveCenterY); |
