diff options
Diffstat (limited to 'java/com/android/dialer/app/widget/SearchEditTextLayout.java')
-rw-r--r-- | java/com/android/dialer/app/widget/SearchEditTextLayout.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/java/com/android/dialer/app/widget/SearchEditTextLayout.java b/java/com/android/dialer/app/widget/SearchEditTextLayout.java index 9da0e245f..e7a707feb 100644 --- a/java/com/android/dialer/app/widget/SearchEditTextLayout.java +++ b/java/com/android/dialer/app/widget/SearchEditTextLayout.java @@ -58,6 +58,8 @@ public class SearchEditTextLayout extends FrameLayout { private Callback mCallback; + private boolean mVoiceSearchEnabled; + public SearchEditTextLayout(Context context, AttributeSet attrs) { super(context, attrs); } @@ -70,6 +72,11 @@ public class SearchEditTextLayout extends FrameLayout { mCallback = listener; } + public void setVoiceSearchEnabled(boolean enabled) { + mVoiceSearchEnabled = enabled; + updateVisibility(mIsExpanded); + } + @Override protected void onFinishInflate() { MarginLayoutParams params = (MarginLayoutParams) getLayoutParams(); @@ -272,7 +279,11 @@ public class SearchEditTextLayout extends FrameLayout { mSearchIcon.setVisibility(collapsedViewVisibility); mCollapsedSearchBox.setVisibility(collapsedViewVisibility); - mVoiceSearchButtonView.setVisibility(collapsedViewVisibility); + if (mVoiceSearchEnabled) { + mVoiceSearchButtonView.setVisibility(collapsedViewVisibility); + } else { + mVoiceSearchButtonView.setVisibility(View.GONE); + } mOverflowButtonView.setVisibility(collapsedViewVisibility); // TODO: Prevents keyboard from jumping up in landscape mode after exiting the // SearchFragment when the query string is empty. More elegant fix? |