summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMathew Inwood <mathewi@google.com>2011-10-17 03:09:45 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-10-17 03:09:45 -0700
commit07b3b2f11ff35002f7353551185d8f31df0ed3a4 (patch)
treecf4184a9e67b9d3b9f4136357126aee026f30546 /src
parentd2c1f80aa73bef9d7fb5991ec29ea7a7b2e38f90 (diff)
parentcf7f63bb4dcc152ba7977fc7499081d651a4313a (diff)
downloadandroid_packages_apps_Trebuchet-07b3b2f11ff35002f7353551185d8f31df0ed3a4.tar.gz
android_packages_apps_Trebuchet-07b3b2f11ff35002f7353551185d8f31df0ed3a4.tar.bz2
android_packages_apps_Trebuchet-07b3b2f11ff35002f7353551185d8f31df0ed3a4.zip
Merge "Add source bounds of QSB bar to global search intents."
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/Launcher.java3
-rw-r--r--src/com/android/launcher2/SearchDropTargetBar.java19
2 files changed, 21 insertions, 1 deletions
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 0ed512909..59efc9e4e 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -1319,11 +1319,12 @@ public final class Launcher extends Activity
appSearchData = new Bundle();
appSearchData.putString(Search.SOURCE, "launcher-search");
}
+ Rect sourceBounds = mSearchDropTargetBar.getSearchBarBounds();
final SearchManager searchManager =
(SearchManager) getSystemService(Context.SEARCH_SERVICE);
searchManager.startSearch(initialQuery, selectInitialQuery, getComponentName(),
- appSearchData, globalSearch);
+ appSearchData, globalSearch, sourceBounds);
}
@Override
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;
+ }
+ }
}