diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 3 | ||||
-rw-r--r-- | src/com/android/launcher2/LauncherModel.java | 11 | ||||
-rw-r--r-- | src/com/android/launcher2/SearchDropTargetBar.java | 19 |
3 files changed, 27 insertions, 6 deletions
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 02f19ac09..6d2ec3a05 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -1322,11 +1322,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/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java index 3ee273214..c06bc0c31 100644 --- a/src/com/android/launcher2/LauncherModel.java +++ b/src/com/android/launcher2/LauncherModel.java @@ -121,7 +121,7 @@ public class LauncherModel extends BroadcastReceiver { private static int mCellCountX; private static int mCellCountY; - protected Configuration mPreviousConfig; + protected int mPreviousConfigMcc; public interface Callbacks { public boolean setLoadOnResume(); @@ -152,7 +152,8 @@ public class LauncherModel extends BroadcastReceiver { final Resources res = app.getResources(); mAllAppsLoadDelay = res.getInteger(R.integer.config_allAppsBatchLoadDelay); mBatchSize = res.getInteger(R.integer.config_allAppsBatchSize); - mPreviousConfig = res.getConfiguration(); + Configuration config = res.getConfiguration(); + mPreviousConfigMcc = config.mcc; } public Bitmap getFallbackIcon() { @@ -623,13 +624,13 @@ public class LauncherModel extends BroadcastReceiver { // and we would need to clear out the labels in all apps/workspace. Same handling as // above for ACTION_LOCALE_CHANGED Configuration currentConfig = context.getResources().getConfiguration(); - if((mPreviousConfig.diff(currentConfig) & ActivityInfo.CONFIG_MCC) != 0){ + if (mPreviousConfigMcc != currentConfig.mcc) { Log.d(TAG, "Reload apps on config change. curr_mcc:" - + currentConfig.mcc + " prevmcc:" + mPreviousConfig.mcc); + + currentConfig.mcc + " prevmcc:" + mPreviousConfigMcc); forceReload(); } // Update previousConfig - mPreviousConfig = currentConfig; + mPreviousConfigMcc = currentConfig.mcc; } else if (SearchManager.INTENT_GLOBAL_SEARCH_ACTIVITY_CHANGED.equals(action) || SearchManager.INTENT_ACTION_SEARCHABLES_CHANGED.equals(action)) { if (mCallbacks != null) { 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; + } + } } |