Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Fixed showing microphone icon when there is text in the URL (#521)
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo authored and bluemarvin committed Sep 13, 2018
1 parent c0ee5eb commit e7ea665
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public boolean onEditorAction(TextView aTextView, int actionId, KeyEvent event)
mURL.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean b) {
if (b && mURL.getText().length() > 0) {
showVoiceSearch(false);
if (b) {
showVoiceSearch(mURL.getText().length() == 0);
}

mURL.setSelection(mURL.getText().length(), 0);
Expand Down Expand Up @@ -172,7 +172,7 @@ public void setIsLoading(boolean aIsLoading) {
}

public void showVoiceSearch(boolean enabled) {
if (enabled) {
if (enabled && mURL.getText().length() == 0) {
mMicrophoneButton.setImageResource(R.drawable.ic_icon_microphone);
mMicrophoneButton.setOnClickListener(mMicrophoneListener);

Expand Down Expand Up @@ -236,7 +236,7 @@ protected void handleURLEdit(String text) {
SessionStore.get().loadUri(url);
}

showVoiceSearch(true);
showVoiceSearch(text.isEmpty());
}

public void setPrivateMode(boolean isEnabled) {
Expand Down

0 comments on commit e7ea665

Please sign in to comment.