Add Duckduckgo web search provider

This commit is contained in:
Till Kottmann
2019-07-04 13:43:05 +02:00
parent e23acb1bb4
commit 74eb36ebc3
3 changed files with 35 additions and 0 deletions

View File

@@ -694,4 +694,5 @@
<string name="onboarding_swipe_up">Swipe up to see all your apps</string>
<string name="web_search_google">Google (web)</string>
<string name="web_search_ddg">DuckDuckGo (web)</string>
</resources>

View File

@@ -5,6 +5,7 @@ import android.support.v7.view.ContextThemeWrapper
import ch.deletescape.lawnchair.colors.ColorEngine
import ch.deletescape.lawnchair.ensureOnMainThread
import ch.deletescape.lawnchair.globalsearch.providers.*
import ch.deletescape.lawnchair.globalsearch.providers.web.DDGWebSearchProvider
import ch.deletescape.lawnchair.globalsearch.providers.web.GoogleWebSearchProvider
import ch.deletescape.lawnchair.theme.ThemeManager
import ch.deletescape.lawnchair.theme.ThemeOverride
@@ -109,6 +110,7 @@ class SearchProviderController(private val context: Context) : ColorEngine.OnCol
GoogleGoSearchProvider(context),
FirefoxSearchProvider(context),
DuckDuckGoSearchProvider(context),
DDGWebSearchProvider(context),
BingSearchProvider(context),
BaiduSearchProvider(context),
YandexSearchProvider(context),

View File

@@ -0,0 +1,32 @@
/*
* Copyright (C) 2019 Lawnchair Team.
*
* This file is part of Lawnchair Launcher.
*
* Lawnchair Launcher is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Lawnchair Launcher is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Lawnchair Launcher. If not, see <https://www.gnu.org/licenses/>.
*/
package ch.deletescape.lawnchair.globalsearch.providers.web
import android.content.Context
import ch.deletescape.lawnchair.locale
import com.android.launcher3.R
class DDGWebSearchProvider(context: Context) : WebSearchProvider(context) {
override val searchUrl = "https://duckduckgo.com/?q=%s"
override val suggestionsUrl = "https://ac.duckduckgo.com/ac/?q=%s&type=list"
override val name = context.getString(R.string.web_search_ddg)
override fun getIcon() = context.getDrawable(R.drawable.ic_ddg)!!
}