summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2010-11-16 09:05:07 -0800
committerAmith Yamasani <yamasani@google.com>2010-11-17 16:46:14 -0800
commit6d7fe506fcfbc7bd6810ec8dd48c214e856aa87a (patch)
tree0d3d3027cfcbcbe03810480304ccca228aefa7fc /src/com
parentf74a4ecf9453c84f46543ed8528916029501d13e (diff)
downloadandroid_packages_apps_Trebuchet-6d7fe506fcfbc7bd6810ec8dd48c214e856aa87a.tar.gz
android_packages_apps_Trebuchet-6d7fe506fcfbc7bd6810ec8dd48c214e856aa87a.tar.bz2
android_packages_apps_Trebuchet-6d7fe506fcfbc7bd6810ec8dd48c214e856aa87a.zip
Separate QSB and Voice buttons, aligned with QSB app.
Add EditText style underscores for the icons. Get VoiceSearch icon from the activity that handles the RecognizerIntent.ACTION_WEB_SEARCH
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/launcher2/Launcher.java55
1 files changed, 46 insertions, 9 deletions
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 9954f39d5..55a617678 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -73,6 +73,7 @@ import android.os.SystemClock;
import android.os.SystemProperties;
import android.provider.LiveFolders;
import android.provider.Settings;
+import android.speech.RecognizerIntent;
import android.text.Selection;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
@@ -1925,6 +1926,21 @@ public final class Launcher extends Activity
}
/**
+ * Event handler for the voice button
+ *
+ * @param v The view that was clicked.
+ */
+ public void onClickVoiceButton(View v) {
+ startVoiceSearch();
+ }
+
+ private void startVoiceSearch() {
+ Intent intent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ startActivity(intent);
+ }
+
+ /**
* Event handler for the "gear" button that appears on the home screen, which
* enters home screen customization mode.
*
@@ -2477,7 +2493,7 @@ public final class Launcher extends Activity
* @param hideSeq AnimatorSet in which to put "hide" animations, or null.
*/
private void hideAndShowToolbarButtons(State newState, AnimatorSet showSeq, AnimatorSet hideSeq) {
- final View searchButton = findViewById(R.id.search_button);
+ final View searchButton = findViewById(R.id.search_button_cluster);
final View allAppsButton = findViewById(R.id.all_apps_button);
final View configureButton = findViewById(R.id.configure_button);
@@ -2898,6 +2914,21 @@ public final class Launcher extends Activity
if (activityName != null) {
updateButtonWithIconFromExternalActivity(
R.id.search_button, activityName, R.drawable.search_button_generic);
+ } else {
+ findViewById(R.id.search_button).setVisibility(View.GONE);
+ }
+ }
+ }
+
+ private void updateVoiceSearchIcon() {
+ if (LauncherApplication.isScreenXLarge()) {
+ Intent intent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
+ ComponentName activityName = intent.resolveActivity(getPackageManager());
+ if (activityName != null) {
+ updateButtonWithIconFromExternalActivity(
+ R.id.voice_button, activityName, R.drawable.ic_voice_search);
+ } else {
+ findViewById(R.id.voice_button).setVisibility(View.GONE);
}
}
}
@@ -3249,6 +3280,16 @@ public final class Launcher extends Activity
}
/**
+ * Updates the icons on the launcher that are affected by changes to the package list
+ * on the device.
+ */
+ private void updateIconsAffectedByPackageManagerChanges() {
+ updateAppMarketIcon();
+ updateGlobalSearchIcon();
+ updateVoiceSearchIcon();
+ }
+
+ /**
* Add the icons for all apps.
*
* Implementation of the method from LauncherModel.Callbacks.
@@ -3258,8 +3299,7 @@ public final class Launcher extends Activity
if (mCustomizePagedView != null) {
mCustomizePagedView.setApps(apps);
}
- updateAppMarketIcon();
- updateGlobalSearchIcon();
+ updateIconsAffectedByPackageManagerChanges();
}
/**
@@ -3274,8 +3314,7 @@ public final class Launcher extends Activity
if (mCustomizePagedView != null) {
mCustomizePagedView.addApps(apps);
}
- updateAppMarketIcon();
- updateGlobalSearchIcon();
+ updateIconsAffectedByPackageManagerChanges();
}
/**
@@ -3291,8 +3330,7 @@ public final class Launcher extends Activity
if (mCustomizePagedView != null) {
mCustomizePagedView.updateApps(apps);
}
- updateAppMarketIcon();
- updateGlobalSearchIcon();
+ updateIconsAffectedByPackageManagerChanges();
}
/**
@@ -3309,8 +3347,7 @@ public final class Launcher extends Activity
if (mCustomizePagedView != null) {
mCustomizePagedView.removeApps(apps);
}
- updateAppMarketIcon();
- updateGlobalSearchIcon();
+ updateIconsAffectedByPackageManagerChanges();
}
/**