Adding RecognitionManager.isRecognitionEnabled() check
This CL adds an aformentioned check to decide whether to show the mic button or not. Change-Id: Idee6978b69777ac3118406219e96340d892c6508
This commit is contained in:
parent
531352325c
commit
960ea65f3f
1 changed files with 8 additions and 11 deletions
|
@ -16,18 +16,19 @@
|
|||
|
||||
package com.android.inputmethod.latin;
|
||||
|
||||
import com.android.inputmethod.voice.EditingUtil;
|
||||
import com.android.inputmethod.voice.FieldContext;
|
||||
import com.android.inputmethod.voice.SettingsUtil;
|
||||
import com.android.inputmethod.voice.VoiceInput;
|
||||
import com.google.android.collect.Lists;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.backup.BackupManager;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.Editor;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.inputmethodservice.InputMethodService;
|
||||
|
@ -40,6 +41,7 @@ import android.os.Message;
|
|||
import android.os.SystemClock;
|
||||
import android.os.Vibrator;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.speech.RecognitionManager;
|
||||
import android.text.AutoText;
|
||||
import android.text.ClipboardManager;
|
||||
import android.text.TextUtils;
|
||||
|
@ -58,11 +60,6 @@ import android.view.inputmethod.ExtractedTextRequest;
|
|||
import android.view.inputmethod.InputConnection;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import com.android.inputmethod.voice.EditingUtil;
|
||||
import com.android.inputmethod.voice.FieldContext;
|
||||
import com.android.inputmethod.voice.SettingsUtil;
|
||||
import com.android.inputmethod.voice.VoiceInput;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
|
@ -1607,10 +1604,10 @@ public class LatinIME extends InputMethodService
|
|||
}
|
||||
|
||||
private boolean shouldShowVoiceButton(FieldContext fieldContext, EditorInfo attribute) {
|
||||
return ENABLE_VOICE_BUTTON
|
||||
&& fieldCanDoVoice(fieldContext)
|
||||
return ENABLE_VOICE_BUTTON && fieldCanDoVoice(fieldContext)
|
||||
&& !(attribute != null && attribute.privateImeOptions != null
|
||||
&& attribute.privateImeOptions.equals(IME_OPTION_NO_MICROPHONE));
|
||||
&& attribute.privateImeOptions.equals(IME_OPTION_NO_MICROPHONE))
|
||||
&& RecognitionManager.isRecognitionAvailable(this);
|
||||
}
|
||||
|
||||
// receive ringer mode changes to detect silent mode
|
||||
|
|
Loading…
Reference in a new issue