forked from mozilla-mobile/fenix
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For mozilla-mobile#26329 Implement the search widget Fenix part
- Loading branch information
1 parent
1a2b357
commit 1ecfe6d
Showing
21 changed files
with
79 additions
and
835 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
app/src/main/java/org/mozilla/fenix/widget/FenixVoiceSearchActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
package org.mozilla.fenix.widget | ||
|
||
import android.content.Intent | ||
import android.os.StrictMode | ||
import mozilla.components.feature.search.widget.VoiceSearchActivity | ||
import mozilla.components.support.locale.LocaleManager | ||
import mozilla.telemetry.glean.private.NoExtras | ||
import org.mozilla.fenix.GleanMetrics.SearchWidget | ||
import org.mozilla.fenix.HomeActivity | ||
import org.mozilla.fenix.IntentReceiverActivity | ||
import org.mozilla.fenix.ext.components | ||
import java.util.Locale | ||
|
||
/** | ||
* Implementation of voice search that is needed in search widget | ||
*/ | ||
class FenixVoiceSearchActivity : VoiceSearchActivity() { | ||
|
||
override fun getCurrentLocale(): Locale { | ||
val locale = components.strictMode.resetAfter(StrictMode.allowThreadDiskReads()) { | ||
LocaleManager.getCurrentLocale(this@FenixVoiceSearchActivity) | ||
?: LocaleManager.getSystemDefault() | ||
} | ||
return locale | ||
} | ||
|
||
override fun recordVoiceButtonTelemetry() { | ||
SearchWidget.voiceButton.record(NoExtras()) | ||
} | ||
|
||
override fun startIntentAfterVoiceSearch(spokenText: String?) { | ||
val intent = Intent(this, IntentReceiverActivity::class.java) | ||
intent.putExtra(SPEECH_PROCESSING, spokenText) | ||
intent.putExtra(HomeActivity.OPEN_TO_BROWSER_AND_LOAD, true) | ||
startActivity(intent) | ||
} | ||
} |
121 changes: 0 additions & 121 deletions
121
app/src/main/java/org/mozilla/fenix/widget/VoiceSearchActivity.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.