summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/Launcher.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/launcher2/Launcher.java')
-rw-r--r--src/com/android/launcher2/Launcher.java67
1 files changed, 53 insertions, 14 deletions
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 123155876..3e8c7aa71 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -65,6 +65,7 @@ import android.provider.Settings;
import android.speech.RecognizerIntent;
import android.text.Selection;
import android.text.SpannableStringBuilder;
+import android.text.TextUtils;
import android.text.method.TextKeyListener;
import android.util.Log;
import android.view.Display;
@@ -1465,7 +1466,7 @@ public final class Launcher extends Activity
mWorkspace = null;
mDragController = null;
- ValueAnimator.clearAllAnimations();
+ LauncherAnimUtils.onDestroyActivity();
}
public DragController getDragController() {
@@ -1498,10 +1499,48 @@ public final class Launcher extends Activity
}
Rect sourceBounds = mSearchDropTargetBar.getSearchBarBounds();
+ startGlobalSearch(initialQuery, selectInitialQuery,
+ appSearchData, sourceBounds);
+ }
+
+ /**
+ * Starts the global search activity. This code is a copied from SearchManager
+ */
+ public void startGlobalSearch(String initialQuery,
+ boolean selectInitialQuery, Bundle appSearchData, Rect sourceBounds) {
final SearchManager searchManager =
- (SearchManager) getSystemService(Context.SEARCH_SERVICE);
- searchManager.startSearch(initialQuery, selectInitialQuery, getComponentName(),
- appSearchData, globalSearch, sourceBounds);
+ (SearchManager) getSystemService(Context.SEARCH_SERVICE);
+ ComponentName globalSearchActivity = searchManager.getGlobalSearchActivity();
+ if (globalSearchActivity == null) {
+ Log.w(TAG, "No global search activity found.");
+ return;
+ }
+ Intent intent = new Intent(SearchManager.INTENT_ACTION_GLOBAL_SEARCH);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ intent.setComponent(globalSearchActivity);
+ // Make sure that we have a Bundle to put source in
+ if (appSearchData == null) {
+ appSearchData = new Bundle();
+ } else {
+ appSearchData = new Bundle(appSearchData);
+ }
+ // Set source to package name of app that starts global search, if not set already.
+ if (!appSearchData.containsKey("source")) {
+ appSearchData.putString("source", getPackageName());
+ }
+ intent.putExtra(SearchManager.APP_DATA, appSearchData);
+ if (!TextUtils.isEmpty(initialQuery)) {
+ intent.putExtra(SearchManager.QUERY, initialQuery);
+ }
+ if (selectInitialQuery) {
+ intent.putExtra(SearchManager.EXTRA_SELECT_QUERY, selectInitialQuery);
+ }
+ intent.setSourceBounds(sourceBounds);
+ try {
+ startActivity(intent);
+ } catch (ActivityNotFoundException ex) {
+ Log.e(TAG, "Global search activity not found: " + globalSearchActivity);
+ }
}
@Override
@@ -2102,7 +2141,7 @@ public final class Launcher extends Activity
copyFolderIconToImage(fi);
fi.setVisibility(View.INVISIBLE);
- ObjectAnimator oa = ObjectAnimator.ofPropertyValuesHolder(mFolderIconImageView, alpha,
+ ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(mFolderIconImageView, alpha,
scaleX, scaleY);
oa.setDuration(getResources().getInteger(R.integer.config_folderAnimDuration));
oa.start();
@@ -2119,7 +2158,7 @@ public final class Launcher extends Activity
// We remove and re-draw the FolderIcon in-case it has changed
mDragLayer.removeView(mFolderIconImageView);
copyFolderIconToImage(fi);
- ObjectAnimator oa = ObjectAnimator.ofPropertyValuesHolder(mFolderIconImageView, alpha,
+ ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(mFolderIconImageView, alpha,
scaleX, scaleY);
oa.setDuration(getResources().getInteger(R.integer.config_folderAnimDuration));
oa.addListener(new AnimatorListenerAdapter() {
@@ -2413,7 +2452,7 @@ public final class Launcher extends Activity
// toView should appear right at the end of the workspace shrink
// animation
- mStateAnimation = new AnimatorSet();
+ mStateAnimation = LauncherAnimUtils.createAnimatorSet();
mStateAnimation.play(scaleAnim).after(startDelay);
mStateAnimation.play(alphaAnim).after(startDelay);
@@ -2588,7 +2627,7 @@ public final class Launcher extends Activity
}
});
- mStateAnimation = new AnimatorSet();
+ mStateAnimation = LauncherAnimUtils.createAnimatorSet();
dispatchOnLauncherTransitionPrepare(fromView, animated, true);
dispatchOnLauncherTransitionPrepare(toView, animated, true);
@@ -2772,9 +2811,9 @@ public final class Launcher extends Activity
mDividerAnimator = null;
}
if (animated) {
- mDividerAnimator = new AnimatorSet();
- mDividerAnimator.playTogether(ObjectAnimator.ofFloat(mQsbDivider, "alpha", 1f),
- ObjectAnimator.ofFloat(mDockDivider, "alpha", 1f));
+ mDividerAnimator = LauncherAnimUtils.createAnimatorSet();
+ mDividerAnimator.playTogether(LauncherAnimUtils.ofFloat(mQsbDivider, "alpha", 1f),
+ LauncherAnimUtils.ofFloat(mDockDivider, "alpha", 1f));
mDividerAnimator.setDuration(mSearchDropTargetBar.getTransitionInDuration());
mDividerAnimator.start();
}
@@ -3352,7 +3391,7 @@ public final class Launcher extends Activity
* @param immediate whether to run the animation or show the results immediately
*/
private void runNewAppsAnimation(boolean immediate) {
- AnimatorSet anim = new AnimatorSet();
+ AnimatorSet anim = LauncherAnimUtils.createAnimatorSet();
Collection<Animator> bounceAnims = new ArrayList<Animator>();
// Order these new views spatially so that they animate in order
@@ -3376,7 +3415,7 @@ public final class Launcher extends Activity
} else {
for (int i = 0; i < mNewShortcutAnimateViews.size(); ++i) {
View v = mNewShortcutAnimateViews.get(i);
- ValueAnimator bounceAnim = ObjectAnimator.ofPropertyValuesHolder(v,
+ ValueAnimator bounceAnim = LauncherAnimUtils.ofPropertyValuesHolder(v,
PropertyValuesHolder.ofFloat("alpha", 1f),
PropertyValuesHolder.ofFloat("scaleX", 1f),
PropertyValuesHolder.ofFloat("scaleY", 1f));
@@ -3584,7 +3623,7 @@ public final class Launcher extends Activity
}
private void dismissCling(final Cling cling, final String flag, int duration) {
if (cling != null) {
- ObjectAnimator anim = ObjectAnimator.ofFloat(cling, "alpha", 0f);
+ ObjectAnimator anim = LauncherAnimUtils.ofFloat(cling, "alpha", 0f);
anim.setDuration(duration);
anim.addListener(new AnimatorListenerAdapter() {
public void onAnimationEnd(Animator animation) {