Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions app/src/main/java/com/duckduckgo/app/home/HomeActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class HomeActivity : DuckDuckGoActivity() {
searchInputBox.setOnClickListener { showSearchActivity() }

if (savedInstanceState == null) {
consumeSharedQuery(intent)
consumeIntentAction(intent)
}
}

Expand All @@ -76,14 +76,14 @@ class HomeActivity : DuckDuckGoActivity() {

override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
consumeSharedQuery(intent)
consumeIntentAction(intent)
}

private fun consumeSharedQuery(intent: Intent?) {
private fun consumeIntentAction(intent: Intent?) {

if (intent == null) return

if (intent.hasExtra(KEY_SKIP_HOME)) {
if (shouldSkipHomeActivity(intent)) {
startActivity(BrowserActivity.intent(this))
return
}
Expand All @@ -92,6 +92,10 @@ class HomeActivity : DuckDuckGoActivity() {
startActivity(BrowserActivity.intent(this, query))
}

private fun shouldSkipHomeActivity(intent: Intent) : Boolean {
return intent.hasExtra(KEY_SKIP_HOME) || intent.action == Intent.ACTION_ASSIST
}

private fun showSearchActivity() {
val intent = BrowserActivity.intent(this)
val options = ActivityOptionsCompat.makeSceneTransitionAnimation(this, searchInputBox, getString(R.string.transition_url_input))
Expand Down