summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-11-04 16:17:01 -0500
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-11-04 16:17:01 -0500
commit2d685eaec9cbf3b2f7c52f6c810980a0c1f79375 (patch)
treebcee7ef03cd9aa1677a800d9f9a1a84e520f73b6 /src
parenteebd92496e2fbfbd81ea871862a681929101ba06 (diff)
parent2bbe9af65eb5fe213978a58d5089fe99e341ca4e (diff)
downloadandroid_packages_apps_Trebuchet-2d685eaec9cbf3b2f7c52f6c810980a0c1f79375.tar.gz
android_packages_apps_Trebuchet-2d685eaec9cbf3b2f7c52f6c810980a0c1f79375.tar.bz2
android_packages_apps_Trebuchet-2d685eaec9cbf3b2f7c52f6c810980a0c1f79375.zip
Merge change I2bbe9af6 into eclair
* changes: Update the search widget to be vertically centered within it's footprint.
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/Search.java29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/com/android/launcher2/Search.java b/src/com/android/launcher2/Search.java
index ccf7792de..09646bd59 100644
--- a/src/com/android/launcher2/Search.java
+++ b/src/com/android/launcher2/Search.java
@@ -16,20 +16,15 @@
package com.android.launcher2;
-import android.app.SearchManager;
+import android.app.Activity;
import android.content.ActivityNotFoundException;
-import android.content.BroadcastReceiver;
-import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
-import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Configuration;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
-import android.server.search.SearchableInfo;
-import android.server.search.Searchables;
import android.util.AttributeSet;
import android.util.Log;
import android.view.KeyEvent;
@@ -76,8 +71,6 @@ public class Search extends LinearLayout
// For voice searching
private Intent mVoiceSearchIntent;
- private SearchManager mSearchManager;
-
/**
* Used to inflate the Workspace from XML.
*
@@ -138,8 +131,6 @@ public class Search extends LinearLayout
mVoiceSearchIntent = new Intent(android.speech.RecognizerIntent.ACTION_WEB_SEARCH);
mVoiceSearchIntent.putExtra(android.speech.RecognizerIntent.EXTRA_LANGUAGE_MODEL,
android.speech.RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
-
- mSearchManager = (SearchManager) getContext().getSystemService(Context.SEARCH_SERVICE);
}
/**
@@ -174,7 +165,7 @@ public class Search extends LinearLayout
/**
* Morph the search gadget to the search dialog.
- * See {@link Activity.startSearch()} for the arguments.
+ * See {@link Activity#startSearch()} for the arguments.
*/
public void startSearch(String initialQuery, boolean selectInitialQuery,
Bundle appSearchData, boolean globalSearch) {
@@ -233,11 +224,11 @@ public class Search extends LinearLayout
}
private boolean isAtTop() {
- return getTop() == 0;
+ return getWidgetTop() == 0;
}
private int getAnimationDuration() {
- return (int) (getTop() / ANIMATION_VELOCITY);
+ return (int) (getWidgetTop() / ANIMATION_VELOCITY);
}
/**
@@ -351,7 +342,7 @@ public class Search extends LinearLayout
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
float dx = -getLeft() * interpolatedTime;
- float dy = -getTop() * interpolatedTime;
+ float dy = -getWidgetTop() * interpolatedTime;
t.getMatrix().setTranslate(dx, dy);
}
}
@@ -363,9 +354,17 @@ public class Search extends LinearLayout
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
float dx = -getLeft() * (1.0f - interpolatedTime);
- float dy = -getTop() * (1.0f - interpolatedTime);
+ float dy = -getWidgetTop() * (1.0f - interpolatedTime);
t.getMatrix().setTranslate(dx, dy);
}
}
+ /**
+ * The widget is centered vertically within it's 4x1 slot. This is accomplished by nesting
+ * the actual widget inside another view. For animation purposes, we care about the top of the
+ * actual widget rather than it's container. This method return the top of the actual widget.
+ */
+ private int getWidgetTop() {
+ return getTop() + getChildAt(0).getTop();
+ }
}