anthony restaino
8 years ago
24 changed files with 174 additions and 233 deletions
@ -1,15 +0,0 @@
@@ -1,15 +0,0 @@
|
||||
package acr.browser.lightning.search.engine; |
||||
|
||||
import acr.browser.lightning.R; |
||||
import acr.browser.lightning.constant.Constants; |
||||
|
||||
/** |
||||
* The Ask search engine. |
||||
*/ |
||||
public class AskSearch extends BaseSearchEngine { |
||||
|
||||
public AskSearch() { |
||||
super("file:///android_asset/ask.png", Constants.ASK_SEARCH, R.string.search_engine_ask); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
package acr.browser.lightning.search.engine |
||||
|
||||
import acr.browser.lightning.R |
||||
import acr.browser.lightning.constant.Constants |
||||
|
||||
/** |
||||
* The Ask search engine. |
||||
*/ |
||||
class AskSearch : BaseSearchEngine( |
||||
"file:///android_asset/ask.png", |
||||
Constants.ASK_SEARCH, |
||||
R.string.search_engine_ask |
||||
) |
@ -1,17 +0,0 @@
@@ -1,17 +0,0 @@
|
||||
package acr.browser.lightning.search.engine; |
||||
|
||||
import acr.browser.lightning.R; |
||||
import acr.browser.lightning.constant.Constants; |
||||
|
||||
/** |
||||
* The Baidu search engine. |
||||
* <p> |
||||
* See http://www.baidu.com/img/bdlogo.gif for the icon.
|
||||
*/ |
||||
public class BaiduSearch extends BaseSearchEngine { |
||||
|
||||
public BaiduSearch() { |
||||
super("file:///android_asset/baidu.png", Constants.BAIDU_SEARCH, R.string.search_engine_baidu); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
package acr.browser.lightning.search.engine |
||||
|
||||
import acr.browser.lightning.R |
||||
import acr.browser.lightning.constant.Constants |
||||
|
||||
/** |
||||
* The Baidu search engine. |
||||
* |
||||
* See http://www.baidu.com/img/bdlogo.gif for the icon. |
||||
*/ |
||||
class BaiduSearch : BaseSearchEngine( |
||||
"file:///android_asset/baidu.png", |
||||
Constants.BAIDU_SEARCH, |
||||
R.string.search_engine_baidu |
||||
) |
@ -1,51 +0,0 @@
@@ -1,51 +0,0 @@
|
||||
package acr.browser.lightning.search.engine; |
||||
|
||||
import android.support.annotation.NonNull; |
||||
import android.support.annotation.StringRes; |
||||
|
||||
import acr.browser.lightning.utils.Preconditions; |
||||
|
||||
/** |
||||
* A class representative of a search engine. |
||||
* <p> |
||||
* Contains three key pieces of information: |
||||
* <ul> |
||||
* <li>The icon shown for the search engine, should point to a local assets URL.</li> |
||||
* <li>The query URL for the search engine, the query will be appended to the end.</li> |
||||
* <li>The title string resource for the search engine.</li> |
||||
* </ul> |
||||
*/ |
||||
public class BaseSearchEngine { |
||||
|
||||
@NonNull private final String mIconUrl; |
||||
@NonNull private final String mQueryUrl; |
||||
@StringRes private final int mTitleRes; |
||||
|
||||
BaseSearchEngine(@NonNull String iconUrl, |
||||
@NonNull String queryUrl, |
||||
@StringRes int titleRes) { |
||||
|
||||
Preconditions.checkNonNull(iconUrl); |
||||
Preconditions.checkNonNull(queryUrl); |
||||
|
||||
mIconUrl = iconUrl; |
||||
mQueryUrl = queryUrl; |
||||
mTitleRes = titleRes; |
||||
} |
||||
|
||||
@NonNull |
||||
public final String getIconUrl() { |
||||
return mIconUrl; |
||||
} |
||||
|
||||
@NonNull |
||||
public final String getQueryUrl() { |
||||
return mQueryUrl; |
||||
} |
||||
|
||||
@StringRes |
||||
public final int getTitleRes() { |
||||
return mTitleRes; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
package acr.browser.lightning.search.engine |
||||
|
||||
import android.support.annotation.StringRes |
||||
|
||||
/** |
||||
* A class representative of a search engine. |
||||
* |
||||
* Contains three key pieces of information: |
||||
* * The icon shown for the search engine, should point to a local assets URL. |
||||
* * The query URL for the search engine, the query will be appended to the end. |
||||
* * The title string resource for the search engine. |
||||
*/ |
||||
open class BaseSearchEngine internal constructor(val iconUrl: String, |
||||
val queryUrl: String, |
||||
@StringRes val titleRes: Int) |
@ -1,18 +0,0 @@
@@ -1,18 +0,0 @@
|
||||
package acr.browser.lightning.search.engine; |
||||
|
||||
import acr.browser.lightning.R; |
||||
import acr.browser.lightning.constant.Constants; |
||||
|
||||
/** |
||||
* The Bing search engine. |
||||
* <p> |
||||
* See http://upload.wikimedia.org/wikipedia/commons/thumb/b/b1/Bing_logo_%282013%29.svg/500px-Bing_logo_%282013%29.svg.png
|
||||
* for the icon. |
||||
*/ |
||||
public class BingSearch extends BaseSearchEngine { |
||||
|
||||
public BingSearch() { |
||||
super("file:///android_asset/bing.png", Constants.BING_SEARCH, R.string.search_engine_bing); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
package acr.browser.lightning.search.engine |
||||
|
||||
import acr.browser.lightning.R |
||||
import acr.browser.lightning.constant.Constants |
||||
|
||||
/** |
||||
* The Bing search engine. |
||||
* |
||||
* See http://upload.wikimedia.org/wikipedia/commons/thumb/b/b1/Bing_logo_%282013%29.svg/500px-Bing_logo_%282013%29.svg.png |
||||
* for the icon. |
||||
*/ |
||||
class BingSearch : BaseSearchEngine( |
||||
"file:///android_asset/bing.png", |
||||
Constants.BING_SEARCH, |
||||
R.string.search_engine_bing |
||||
) |
@ -1,16 +0,0 @@
@@ -1,16 +0,0 @@
|
||||
package acr.browser.lightning.search.engine; |
||||
|
||||
import android.support.annotation.NonNull; |
||||
|
||||
import acr.browser.lightning.R; |
||||
|
||||
/** |
||||
* A custom search engine. |
||||
*/ |
||||
public class CustomSearch extends BaseSearchEngine { |
||||
|
||||
public CustomSearch(@NonNull String queryUrl) { |
||||
super("file:///android_asset/lightning.png", queryUrl, R.string.search_engine_custom); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,12 @@
@@ -0,0 +1,12 @@
|
||||
package acr.browser.lightning.search.engine |
||||
|
||||
import acr.browser.lightning.R |
||||
|
||||
/** |
||||
* A custom search engine. |
||||
*/ |
||||
class CustomSearch(queryUrl: String) : BaseSearchEngine( |
||||
"file:///android_asset/lightning.png", |
||||
queryUrl, |
||||
R.string.search_engine_custom |
||||
) |
@ -1,17 +0,0 @@
@@ -1,17 +0,0 @@
|
||||
package acr.browser.lightning.search.engine; |
||||
|
||||
import acr.browser.lightning.R; |
||||
import acr.browser.lightning.constant.Constants; |
||||
|
||||
/** |
||||
* The DuckDuckGo Lite search engine. |
||||
* <p> |
||||
* See https://duckduckgo.com/assets/logo_homepage.normal.v101.png for the icon.
|
||||
*/ |
||||
public class DuckLiteSearch extends BaseSearchEngine { |
||||
|
||||
public DuckLiteSearch() { |
||||
super("file:///android_asset/duckduckgo.png", Constants.DUCK_LITE_SEARCH, R.string.search_engine_duckduckgo_lite); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
package acr.browser.lightning.search.engine |
||||
|
||||
import acr.browser.lightning.R |
||||
import acr.browser.lightning.constant.Constants |
||||
|
||||
/** |
||||
* The DuckDuckGo Lite search engine. |
||||
* |
||||
* See https://duckduckgo.com/assets/logo_homepage.normal.v101.png for the icon. |
||||
*/ |
||||
class DuckLiteSearch : BaseSearchEngine( |
||||
"file:///android_asset/duckduckgo.png", |
||||
Constants.DUCK_LITE_SEARCH, |
||||
R.string.search_engine_duckduckgo_lite |
||||
) |
@ -1,17 +0,0 @@
@@ -1,17 +0,0 @@
|
||||
package acr.browser.lightning.search.engine; |
||||
|
||||
import acr.browser.lightning.R; |
||||
import acr.browser.lightning.constant.Constants; |
||||
|
||||
/** |
||||
* The DuckDuckGo search engine. |
||||
* <p> |
||||
* See https://duckduckgo.com/assets/logo_homepage.normal.v101.png for the icon.
|
||||
*/ |
||||
public class DuckSearch extends BaseSearchEngine { |
||||
|
||||
public DuckSearch() { |
||||
super("file:///android_asset/duckduckgo.png", Constants.DUCK_SEARCH, R.string.search_engine_duckduckgo); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
package acr.browser.lightning.search.engine |
||||
|
||||
import acr.browser.lightning.R |
||||
import acr.browser.lightning.constant.Constants |
||||
|
||||
/** |
||||
* The DuckDuckGo search engine. |
||||
* |
||||
* See https://duckduckgo.com/assets/logo_homepage.normal.v101.png for the icon. |
||||
*/ |
||||
class DuckSearch : BaseSearchEngine( |
||||
"file:///android_asset/duckduckgo.png", |
||||
Constants.DUCK_SEARCH, |
||||
R.string.search_engine_duckduckgo |
||||
) |
@ -1,16 +0,0 @@
@@ -1,16 +0,0 @@
|
||||
package acr.browser.lightning.search.engine; |
||||
|
||||
import acr.browser.lightning.R; |
||||
import acr.browser.lightning.constant.Constants; |
||||
|
||||
/** |
||||
* The Google search engine. |
||||
* <p> |
||||
* See https://www.google.com/images/srpr/logo11w.png for the icon.
|
||||
*/ |
||||
public class GoogleSearch extends BaseSearchEngine { |
||||
|
||||
public GoogleSearch() { |
||||
super("file:///android_asset/google.png", Constants.GOOGLE_SEARCH, R.string.search_engine_google); |
||||
} |
||||
} |
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
package acr.browser.lightning.search.engine |
||||
|
||||
import acr.browser.lightning.R |
||||
import acr.browser.lightning.constant.Constants |
||||
|
||||
/** |
||||
* The Google search engine. |
||||
* |
||||
* See https://www.google.com/images/srpr/logo11w.png for the icon. |
||||
*/ |
||||
class GoogleSearch : BaseSearchEngine( |
||||
"file:///android_asset/google.png", |
||||
Constants.GOOGLE_SEARCH, |
||||
R.string.search_engine_google |
||||
) |
@ -1,15 +0,0 @@
@@ -1,15 +0,0 @@
|
||||
package acr.browser.lightning.search.engine; |
||||
|
||||
import acr.browser.lightning.R; |
||||
import acr.browser.lightning.constant.Constants; |
||||
|
||||
/** |
||||
* The StartPage mobile search engine. |
||||
*/ |
||||
public class StartPageMobileSearch extends BaseSearchEngine { |
||||
|
||||
public StartPageMobileSearch() { |
||||
super("file:///android_asset/startpage.png", Constants.STARTPAGE_MOBILE_SEARCH, R.string.search_engine_startpage_mobile); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
package acr.browser.lightning.search.engine |
||||
|
||||
import acr.browser.lightning.R |
||||
import acr.browser.lightning.constant.Constants |
||||
|
||||
/** |
||||
* The StartPage mobile search engine. |
||||
*/ |
||||
class StartPageMobileSearch : BaseSearchEngine( |
||||
"file:///android_asset/startpage.png", |
||||
Constants.STARTPAGE_MOBILE_SEARCH, |
||||
R.string.search_engine_startpage_mobile |
||||
) |
@ -1,15 +0,0 @@
@@ -1,15 +0,0 @@
|
||||
package acr.browser.lightning.search.engine; |
||||
|
||||
import acr.browser.lightning.R; |
||||
import acr.browser.lightning.constant.Constants; |
||||
|
||||
/** |
||||
* The StartPage search engine. |
||||
*/ |
||||
public class StartPageSearch extends BaseSearchEngine { |
||||
|
||||
public StartPageSearch() { |
||||
super("file:///android_asset/startpage.png", Constants.STARTPAGE_SEARCH, R.string.search_engine_startpage); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
package acr.browser.lightning.search.engine |
||||
|
||||
import acr.browser.lightning.R |
||||
import acr.browser.lightning.constant.Constants |
||||
|
||||
/** |
||||
* The StartPage search engine. |
||||
*/ |
||||
class StartPageSearch : BaseSearchEngine( |
||||
"file:///android_asset/startpage.png", |
||||
Constants.STARTPAGE_SEARCH, |
||||
R.string.search_engine_startpage |
||||
) |
@ -1,18 +0,0 @@
@@ -1,18 +0,0 @@
|
||||
package acr.browser.lightning.search.engine; |
||||
|
||||
import acr.browser.lightning.R; |
||||
import acr.browser.lightning.constant.Constants; |
||||
|
||||
/** |
||||
* The Yahoo search engine. |
||||
* <p> |
||||
* See http://upload.wikimedia.org/wikipedia/commons/thumb/2/24/Yahoo%21_logo.svg/799px-Yahoo%21_logo.svg.png
|
||||
* for the icon. |
||||
*/ |
||||
public class YahooSearch extends BaseSearchEngine { |
||||
|
||||
public YahooSearch() { |
||||
super("file:///android_asset/yahoo.png", Constants.YAHOO_SEARCH, R.string.search_engine_yahoo); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
package acr.browser.lightning.search.engine |
||||
|
||||
import acr.browser.lightning.R |
||||
import acr.browser.lightning.constant.Constants |
||||
|
||||
/** |
||||
* The Yahoo search engine. |
||||
* |
||||
* See http://upload.wikimedia.org/wikipedia/commons/thumb/2/24/Yahoo%21_logo.svg/799px-Yahoo%21_logo.svg.png |
||||
* for the icon. |
||||
*/ |
||||
class YahooSearch : BaseSearchEngine( |
||||
"file:///android_asset/yahoo.png", |
||||
Constants.YAHOO_SEARCH, |
||||
R.string.search_engine_yahoo |
||||
) |
@ -1,18 +0,0 @@
@@ -1,18 +0,0 @@
|
||||
package acr.browser.lightning.search.engine; |
||||
|
||||
import acr.browser.lightning.R; |
||||
import acr.browser.lightning.constant.Constants; |
||||
|
||||
/** |
||||
* The Yandex search engine. |
||||
* <p> |
||||
* See http://upload.wikimedia.org/wikipedia/commons/thumb/9/91/Yandex.svg/600px-Yandex.svg.png
|
||||
* for the icon. |
||||
*/ |
||||
public class YandexSearch extends BaseSearchEngine { |
||||
|
||||
public YandexSearch() { |
||||
super("file:///android_asset/yandex.png", Constants.YANDEX_SEARCH, R.string.search_engine_yandex); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
package acr.browser.lightning.search.engine |
||||
|
||||
import acr.browser.lightning.R |
||||
import acr.browser.lightning.constant.Constants |
||||
|
||||
/** |
||||
* The Yandex search engine. |
||||
* |
||||
* See http://upload.wikimedia.org/wikipedia/commons/thumb/9/91/Yandex.svg/600px-Yandex.svg.png |
||||
* for the icon. |
||||
*/ |
||||
class YandexSearch : BaseSearchEngine( |
||||
"file:///android_asset/yandex.png", |
||||
Constants.YANDEX_SEARCH, |
||||
R.string.search_engine_yandex |
||||
) |
Loading…
Reference in new issue