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
This commit is contained in:
Amith Yamasani 2010-11-16 09:05:07 -08:00
parent f74a4ecf94
commit 6d7fe506fc
12 changed files with 158 additions and 25 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/home_press" />
<item android:drawable="@android:color/transparent" />
</selector>

View File

@ -54,16 +54,54 @@
android:layout_height="?android:attr/actionBarSize"
android:layout_gravity="top">
<ImageView
android:id="@+id/search_button"
<LinearLayout android:id="@+id/search_button_cluster"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="left"
android:layout_marginLeft="@dimen/toolbar_button_spacing"
android:layout_height="48dp"
android:gravity="bottom"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
android:background="@drawable/textfield_start"
android:orientation="horizontal">
<!-- Global search icon -->
<ImageView
android:id="@+id/search_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="12dp"
android:src="@drawable/search_button_generic"
android:background="@drawable/button_bg"
android:onClick="onClickSearchButton"
android:focusable="true"
android:clickable="true"/>
</LinearLayout>
android:onClick="onClickSearchButton"
android:focusable="true"
android:clickable="true"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/textfield_end"
android:orientation="horizontal">
<!-- Voice search icon -->
<ImageView
android:id="@+id/voice_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="12dp"
android:src="@drawable/ic_voice_search"
android:background="@drawable/button_bg"
android:onClick="onClickVoiceButton"
android:focusable="true"
android:clickable="true"/>
</LinearLayout>
</LinearLayout>
<ImageView
android:id="@+id/configure_button"

View File

@ -54,16 +54,54 @@
android:layout_height="?android:attr/actionBarSize"
android:layout_gravity="top">
<ImageView
android:id="@+id/search_button"
<LinearLayout android:id="@+id/search_button_cluster"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="left"
android:layout_marginLeft="@dimen/toolbar_button_spacing"
android:layout_height="48dp"
android:gravity="bottom"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
android:background="@drawable/textfield_start"
android:orientation="horizontal">
<!-- Global search icon -->
<ImageView
android:id="@+id/search_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="12dp"
android:src="@drawable/search_button_generic"
android:background="@drawable/button_bg"
android:onClick="onClickSearchButton"
android:focusable="true"
android:clickable="true"/>
</LinearLayout>
android:onClick="onClickSearchButton"
android:focusable="true"
android:clickable="true"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/textfield_end"
android:orientation="horizontal">
<!-- Voice search icon -->
<ImageView
android:id="@+id/voice_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="12dp"
android:src="@drawable/ic_voice_search"
android:background="@drawable/button_bg"
android:onClick="onClickVoiceButton"
android:focusable="true"
android:clickable="true"/>
</LinearLayout>
</LinearLayout>
<ImageView
android:id="@+id/configure_button"

View File

@ -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;
@ -1924,6 +1925,21 @@ public final class Launcher extends Activity
startSearch(null, false, null, true);
}
/**
* 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);
}
}
}
@ -3248,6 +3279,16 @@ public final class Launcher extends Activity
mWorkspaceLoading = false;
}
/**
* 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.
*
@ -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();
}
/**