Merge "Add source bounds of QSB bar to global search intents."
This commit is contained in:
committed by
Android (Google) Code Review
commit
07b3b2f11f
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user