diff options
author | Winson Chung <winsonc@google.com> | 2013-09-30 18:06:44 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2013-09-30 18:12:40 -0700 |
commit | 5841efa6121fb40dd7c1a6a432a899b894fa5c6d (patch) | |
tree | 1adb7133b6b42d6d8e4dc44d86a78e419c10f512 /src/com/android/launcher3/Launcher.java | |
parent | eb0cc542fad264d53f8d31e6421aa0f8833ffd3b (diff) | |
download | android_packages_apps_Trebuchet-5841efa6121fb40dd7c1a6a432a899b894fa5c6d.tar.gz android_packages_apps_Trebuchet-5841efa6121fb40dd7c1a6a432a899b894fa5c6d.tar.bz2 android_packages_apps_Trebuchet-5841efa6121fb40dd7c1a6a432a899b894fa5c6d.zip |
Using state to update voice button proxy visibility instead of view flags. (Bug 10915381)
Change-Id: I72feb506cbc1b03e2b99d36bc4a9d7bda27101be
Diffstat (limited to 'src/com/android/launcher3/Launcher.java')
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index ba34c136c..71b98dd69 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -895,6 +895,9 @@ public class Launcher extends Activity // Process any items that were added while Launcher was away. InstallShortcutReceiver.disableAndFlushInstallQueue(this); + // Update the voice search button proxy + updateVoiceButtonProxyVisible(false); + // Again, as with the above scenario, it's possible that one or more of the global icons // were updated in the wrong orientation. updateGlobalIcons(); @@ -3301,7 +3304,7 @@ public class Launcher extends Activity if (voiceButtonContainer != null) voiceButtonContainer.setVisibility(View.GONE); if (searchButton != null) searchButton.setVisibility(View.GONE); if (voiceButton != null) voiceButton.setVisibility(View.GONE); - setVoiceButtonProxyVisible(false); + updateVoiceButtonProxyVisible(false); return false; } } @@ -3348,13 +3351,13 @@ public class Launcher extends Activity } if (voiceButtonContainer != null) voiceButtonContainer.setVisibility(View.VISIBLE); voiceButton.setVisibility(View.VISIBLE); - setVoiceButtonProxyVisible(true); + updateVoiceButtonProxyVisible(false); invalidatePressedFocusedStates(voiceButtonContainer, voiceButton); return true; } else { if (voiceButtonContainer != null) voiceButtonContainer.setVisibility(View.GONE); if (voiceButton != null) voiceButton.setVisibility(View.GONE); - setVoiceButtonProxyVisible(false); + updateVoiceButtonProxyVisible(false); return false; } } @@ -3366,12 +3369,23 @@ public class Launcher extends Activity invalidatePressedFocusedStates(voiceButtonContainer, voiceButton); } - public void setVoiceButtonProxyVisible(boolean visible) { + public void updateVoiceButtonProxyVisible(boolean forceDisableVoiceButtonProxy) { final View voiceButtonProxy = findViewById(R.id.voice_button_proxy); if (voiceButtonProxy != null) { + boolean visible = !forceDisableVoiceButtonProxy && + mWorkspace.shouldVoiceButtonProxyBeVisible(); voiceButtonProxy.setVisibility(visible ? View.VISIBLE : View.GONE); + voiceButtonProxy.bringToFront(); } } + + /** + * This is an overrid eot disable the voice button proxy. If disabled is true, then the voice button proxy + * will be hidden regardless of what shouldVoiceButtonProxyBeVisible() returns. + */ + public void disableVoiceButtonProxy(boolean disabled) { + updateVoiceButtonProxyVisible(disabled); + } /** * Sets the app market icon */ |