1
0
Fork 0

For #11051 - added intent check for voice search

Also made the activity translucent so that it won't flicker when the user pressses the button and Google app is disabled
master
Mihai Branescu 2020-08-18 09:21:08 +03:00 committed by Mugurell
parent ea688cce09
commit 3e1bc524b9
2 changed files with 7 additions and 1 deletions

View File

@ -215,7 +215,8 @@
android:name=".crashes.CrashListActivity"
android:exported="false" />
<activity android:name=".widget.VoiceSearchActivity" />
<activity android:name=".widget.VoiceSearchActivity"
android:theme="@style/Theme.AppCompat.Translucent"/>
<activity
android:name=".settings.account.AuthCustomTabActivity"

View File

@ -34,6 +34,11 @@ class VoiceSearchActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH).resolveActivity(packageManager) == null) {
finish()
return
}
// Retrieve the previous intent from the saved state
previousIntent = savedInstanceState?.get(PREVIOUS_INTENT) as Intent?
if (previousIntent.isForSpeechProcessing()) {