diff options
author | Mathew Inwood <mathewi@google.com> | 2011-10-13 11:31:38 +0100 |
---|---|---|
committer | Mathew Inwood <mathewi@google.com> | 2011-10-14 14:14:32 +0100 |
commit | cf7f63bb4dcc152ba7977fc7499081d651a4313a (patch) | |
tree | 02a81d7e549ee109fe4235c5975cf5ded691976b /src/com/android/launcher2/SearchDropTargetBar.java | |
parent | 8193f690c2b7115ec8441f7374d4e10ec8d9be09 (diff) | |
download | android_packages_apps_Trebuchet-cf7f63bb4dcc152ba7977fc7499081d651a4313a.tar.gz android_packages_apps_Trebuchet-cf7f63bb4dcc152ba7977fc7499081d651a4313a.tar.bz2 android_packages_apps_Trebuchet-cf7f63bb4dcc152ba7977fc7499081d651a4313a.zip |
Add source bounds of QSB bar to global search intents.
Bug: 5235747
Change-Id: I4baae02923da89826559bd133024453cd4cec661
Diffstat (limited to 'src/com/android/launcher2/SearchDropTargetBar.java')
-rw-r--r-- | src/com/android/launcher2/SearchDropTargetBar.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/com/android/launcher2/SearchDropTargetBar.java b/src/com/android/launcher2/SearchDropTargetBar.java index b4a9fc9c0..e90406e48 100644 --- a/src/com/android/launcher2/SearchDropTargetBar.java +++ b/src/com/android/launcher2/SearchDropTargetBar.java @@ -21,6 +21,7 @@ import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.content.Context; +import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.View; @@ -229,4 +230,22 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D } } } + + public Rect getSearchBarBounds() { + if (mQSBSearchBar != null) { + final float appScale = mQSBSearchBar.getContext().getResources() + .getCompatibilityInfo().applicationScale; + final int[] pos = new int[2]; + mQSBSearchBar.getLocationOnScreen(pos); + + final Rect rect = new Rect(); + rect.left = (int) (pos[0] * appScale + 0.5f); + rect.top = (int) (pos[1] * appScale + 0.5f); + rect.right = (int) ((pos[0] + mQSBSearchBar.getWidth()) * appScale + 0.5f); + rect.bottom = (int) ((pos[1] + mQSBSearchBar.getHeight()) * appScale + 0.5f); + return rect; + } else { + return null; + } + } } |