summaryrefslogtreecommitdiff
path: root/InCallUI/src/com/android/incallui/widget
diff options
context:
space:
mode:
authorSantos Cordon <santoscordon@google.com>2013-09-27 15:13:22 -0700
committerSantos Cordon <santoscordon@google.com>2013-09-28 12:14:46 -0700
commit5f3a4778f26d71fddc73dc65b3ab3639abc4771a (patch)
tree1260c4c095f05f1f59014b7f8a22098b38cba69d /InCallUI/src/com/android/incallui/widget
parente15ae4005972b4a1cd864bb4c2b57f3b70f67275 (diff)
Make sure glowpad is centered when gravity is centered.
+----------------+ | ---- | | - - | | - - | | - - | | ---- | +----------------+ | h | from square edge to circle edge | d | diameter of circle | w | width of square Those are the three values involved in the calculation that we are changing. The formula calculated the center of the circle (glowpad). When setting the x position of the glowpad we should always grab the radius of the circle (d/2) then set h to a proper value depending on the gravity setting: left) h = 0 // do not shift at all center) h = (w - d) / 2 // half the diff. between box and circle widths right) h = (w - d) // total diff. between box and circle widths This is what the code does after this change. The flaw that I saw was that instead of using the radius and adding to h, we used the maximum between the radius or w/2 (half the width of the box). The result was that in rare occassion (possibly for the first time in the associated bug) where the circle is smaller than the box, we would shift too far to the right because w/2 is always larger than the more appropriate d/2. I don't know why this was done, but I have added jaggies@ who originally wrote the code. I consulted with christinech@ and both determined that this is the correct mathematical formula. I verified that the old code did not work correctly for left, right, or center and that all three work as expected with the new code. bug:10958942 Change-Id: I781dc25601382d7a43408cbce0badf8a0a90d663
Diffstat (limited to 'InCallUI/src/com/android/incallui/widget')
-rw-r--r--InCallUI/src/com/android/incallui/widget/multiwaveview/GlowPadView.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/InCallUI/src/com/android/incallui/widget/multiwaveview/GlowPadView.java b/InCallUI/src/com/android/incallui/widget/multiwaveview/GlowPadView.java
index 3fc978a10..a346ba593 100644
--- a/InCallUI/src/com/android/incallui/widget/multiwaveview/GlowPadView.java
+++ b/InCallUI/src/com/android/incallui/widget/multiwaveview/GlowPadView.java
@@ -48,7 +48,7 @@ import java.util.ArrayList;
/**
* This is a copy of com.android.internal.widget.multiwaveview.GlowPadView with minor changes
* to remove dependencies on private api's.
- *
+ *
* Incoporated the scaling functionality.
*
* A re-usable widget containing a center, outer ring and wave animation.
@@ -1114,9 +1114,9 @@ public class GlowPadView extends View {
final float placementWidth = getRingWidth();
final float placementHeight = getRingHeight();
float newWaveCenterX = mHorizontalInset
- + Math.max(width, mMaxTargetWidth + placementWidth) / 2;
+ + (mMaxTargetWidth + placementWidth) / 2;
float newWaveCenterY = mVerticalInset
- + Math.max(height, + mMaxTargetHeight + placementHeight) / 2;
+ + (mMaxTargetHeight + placementHeight) / 2;
if (mInitialLayout) {
stopAndHideWaveAnimation();