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.java24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 43510c226..02a55a814 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -1709,6 +1709,8 @@ public final class Launcher extends Activity
* @param v The view that was clicked.
*/
public void onClickSearchButton(View v) {
+ v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
+
onSearchRequested();
}
@@ -1718,10 +1720,8 @@ public final class Launcher extends Activity
* @param v The view that was clicked.
*/
public void onClickVoiceButton(View v) {
- startVoiceSearch();
- }
+ v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
- private void startVoiceSearch() {
Intent intent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
startActivity(intent);
@@ -2661,6 +2661,16 @@ public final class Launcher extends Activity
button.setImageDrawable(d.newDrawable(getResources()));
}
+ private void invalidatePressedFocusedStates(View container, View button) {
+ if (container instanceof HolographicLinearLayout) {
+ HolographicLinearLayout layout = (HolographicLinearLayout) container;
+ layout.invalidatePressedFocusedStates();
+ } else if (button instanceof HolographicImageView) {
+ HolographicImageView view = (HolographicImageView) button;
+ view.invalidatePressedFocusedStates();
+ }
+ }
+
private boolean updateGlobalSearchIcon() {
final View searchButtonContainer = findViewById(R.id.search_button_container);
final ImageView searchButton = (ImageView) findViewById(R.id.search_button);
@@ -2678,6 +2688,7 @@ public final class Launcher extends Activity
if (searchDivider != null) searchDivider.setVisibility(View.VISIBLE);
if (searchButtonContainer != null) searchButtonContainer.setVisibility(View.VISIBLE);
searchButton.setVisibility(View.VISIBLE);
+ invalidatePressedFocusedStates(searchButtonContainer, searchButton);
return true;
} else {
// We disable both search and voice search when there is no global search provider
@@ -2691,7 +2702,10 @@ public final class Launcher extends Activity
}
private void updateGlobalSearchIcon(Drawable.ConstantState d) {
+ final View searchButtonContainer = findViewById(R.id.search_button_container);
+ final View searchButton = (ImageView) findViewById(R.id.search_button);
updateButtonWithDrawable(R.id.search_button, d);
+ invalidatePressedFocusedStates(searchButtonContainer, searchButton);
}
private boolean updateVoiceSearchIcon(boolean searchVisible) {
@@ -2709,6 +2723,7 @@ public final class Launcher extends Activity
if (searchDivider != null) searchDivider.setVisibility(View.VISIBLE);
if (voiceButtonContainer != null) voiceButtonContainer.setVisibility(View.VISIBLE);
voiceButton.setVisibility(View.VISIBLE);
+ invalidatePressedFocusedStates(voiceButtonContainer, voiceButton);
return true;
} else {
if (searchDivider != null) searchDivider.setVisibility(View.GONE);
@@ -2719,7 +2734,10 @@ public final class Launcher extends Activity
}
private void updateVoiceSearchIcon(Drawable.ConstantState d) {
+ final View voiceButtonContainer = findViewById(R.id.voice_button_container);
+ final View voiceButton = findViewById(R.id.voice_button);
updateButtonWithDrawable(R.id.voice_button, d);
+ invalidatePressedFocusedStates(voiceButtonContainer, voiceButton);
}
/**