Improving the way search engines are handled
This commit is contained in:
parent
d62cea49e9
commit
e8e73ae488
@ -61,7 +61,6 @@ import android.view.animation.Animation;
|
|||||||
import android.view.animation.Transformation;
|
import android.view.animation.Transformation;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.webkit.URLUtil;
|
|
||||||
import android.webkit.ValueCallback;
|
import android.webkit.ValueCallback;
|
||||||
import android.webkit.WebChromeClient.CustomViewCallback;
|
import android.webkit.WebChromeClient.CustomViewCallback;
|
||||||
import android.webkit.WebIconDatabase;
|
import android.webkit.WebIconDatabase;
|
||||||
@ -110,7 +109,9 @@ import acr.browser.lightning.fragment.BookmarksFragment;
|
|||||||
import acr.browser.lightning.fragment.TabsFragment;
|
import acr.browser.lightning.fragment.TabsFragment;
|
||||||
import acr.browser.lightning.interpolator.BezierDecelerateInterpolator;
|
import acr.browser.lightning.interpolator.BezierDecelerateInterpolator;
|
||||||
import acr.browser.lightning.receiver.NetworkReceiver;
|
import acr.browser.lightning.receiver.NetworkReceiver;
|
||||||
|
import acr.browser.lightning.search.SearchEngineProvider;
|
||||||
import acr.browser.lightning.search.SuggestionsAdapter;
|
import acr.browser.lightning.search.SuggestionsAdapter;
|
||||||
|
import acr.browser.lightning.search.engine.BaseSearchEngine;
|
||||||
import acr.browser.lightning.utils.DrawableUtils;
|
import acr.browser.lightning.utils.DrawableUtils;
|
||||||
import acr.browser.lightning.utils.IntentUtils;
|
import acr.browser.lightning.utils.IntentUtils;
|
||||||
import acr.browser.lightning.utils.Preconditions;
|
import acr.browser.lightning.utils.Preconditions;
|
||||||
@ -192,6 +193,8 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
|||||||
|
|
||||||
@Inject SearchBoxModel mSearchBoxModel;
|
@Inject SearchBoxModel mSearchBoxModel;
|
||||||
|
|
||||||
|
@Inject SearchEngineProvider mSearchEngineProvider;
|
||||||
|
|
||||||
private TabsManager mTabsManager;
|
private TabsManager mTabsManager;
|
||||||
|
|
||||||
// Image
|
// Image
|
||||||
@ -657,44 +660,8 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
|||||||
|
|
||||||
setFullscreen(mPreferences.getHideStatusBarEnabled(), false);
|
setFullscreen(mPreferences.getHideStatusBarEnabled(), false);
|
||||||
|
|
||||||
switch (mPreferences.getSearchChoice()) {
|
BaseSearchEngine currentSearchEngine = mSearchEngineProvider.getCurrentSearchEngine();
|
||||||
case 0:
|
mSearchText = currentSearchEngine.getQueryUrl();
|
||||||
mSearchText = mPreferences.getSearchUrl();
|
|
||||||
if (!URLUtil.isNetworkUrl(mSearchText)) {
|
|
||||||
mSearchText = Constants.GOOGLE_SEARCH;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
mSearchText = Constants.GOOGLE_SEARCH;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
mSearchText = Constants.ASK_SEARCH;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
mSearchText = Constants.BING_SEARCH;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
mSearchText = Constants.YAHOO_SEARCH;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
mSearchText = Constants.STARTPAGE_SEARCH;
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
mSearchText = Constants.STARTPAGE_MOBILE_SEARCH;
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
mSearchText = Constants.DUCK_SEARCH;
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
mSearchText = Constants.DUCK_LITE_SEARCH;
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
mSearchText = Constants.BAIDU_SEARCH;
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
mSearchText = Constants.YANDEX_SEARCH;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
updateCookiePreference().subscribeOn(Schedulers.worker()).subscribe();
|
updateCookiePreference().subscribeOn(Schedulers.worker()).subscribe();
|
||||||
mProxyUtils.updateProxySettings(this);
|
mProxyUtils.updateProxySettings(this);
|
||||||
|
@ -22,6 +22,7 @@ import acr.browser.lightning.fragment.DebugSettingsFragment;
|
|||||||
import acr.browser.lightning.fragment.LightningPreferenceFragment;
|
import acr.browser.lightning.fragment.LightningPreferenceFragment;
|
||||||
import acr.browser.lightning.fragment.PrivacySettingsFragment;
|
import acr.browser.lightning.fragment.PrivacySettingsFragment;
|
||||||
import acr.browser.lightning.fragment.TabsFragment;
|
import acr.browser.lightning.fragment.TabsFragment;
|
||||||
|
import acr.browser.lightning.search.SearchEngineProvider;
|
||||||
import acr.browser.lightning.search.SuggestionsAdapter;
|
import acr.browser.lightning.search.SuggestionsAdapter;
|
||||||
import acr.browser.lightning.utils.ProxyUtils;
|
import acr.browser.lightning.utils.ProxyUtils;
|
||||||
import acr.browser.lightning.view.LightningChromeClient;
|
import acr.browser.lightning.view.LightningChromeClient;
|
||||||
@ -85,4 +86,6 @@ public interface AppComponent {
|
|||||||
|
|
||||||
void inject(SearchBoxModel searchBoxModel);
|
void inject(SearchBoxModel searchBoxModel);
|
||||||
|
|
||||||
|
void inject(SearchEngineProvider searchEngineProvider);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,8 @@ import javax.inject.Inject;
|
|||||||
|
|
||||||
import acr.browser.lightning.R;
|
import acr.browser.lightning.R;
|
||||||
import acr.browser.lightning.app.BrowserApp;
|
import acr.browser.lightning.app.BrowserApp;
|
||||||
import acr.browser.lightning.preference.PreferenceManager;
|
import acr.browser.lightning.search.SearchEngineProvider;
|
||||||
|
import acr.browser.lightning.search.engine.BaseSearchEngine;
|
||||||
import acr.browser.lightning.utils.Utils;
|
import acr.browser.lightning.utils.Utils;
|
||||||
|
|
||||||
public class StartPage {
|
public class StartPage {
|
||||||
@ -26,31 +27,31 @@ public class StartPage {
|
|||||||
public static final String FILENAME = "homepage.html";
|
public static final String FILENAME = "homepage.html";
|
||||||
|
|
||||||
private static final String HEAD_1 = "<!DOCTYPE html><html xmlns=\"http://www.w3.org/1999/xhtml\">"
|
private static final String HEAD_1 = "<!DOCTYPE html><html xmlns=\"http://www.w3.org/1999/xhtml\">"
|
||||||
+ "<head>"
|
+ "<head>"
|
||||||
+ "<meta content=\"en-us\" http-equiv=\"Content-Language\" />"
|
+ "<meta content=\"en-us\" http-equiv=\"Content-Language\" />"
|
||||||
+ "<meta content=\"text/html; charset=utf-8\" http-equiv=\"Content-Type\" />"
|
+ "<meta content=\"text/html; charset=utf-8\" http-equiv=\"Content-Type\" />"
|
||||||
+ "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no\">"
|
+ "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no\">"
|
||||||
+ "<title>";
|
+ "<title>";
|
||||||
|
|
||||||
private static final String HEAD_2 = "</title>"
|
private static final String HEAD_2 = "</title>"
|
||||||
+ "</head>"
|
+ "</head>"
|
||||||
+ "<style>body{background:#f5f5f5;text-align:center;margin:0px;}#search_input{height:35px; "
|
+ "<style>body{background:#f5f5f5;text-align:center;margin:0px;}#search_input{height:35px; "
|
||||||
+ "width:100%;outline:none;border:none;font-size: 16px;background-color:transparent;}"
|
+ "width:100%;outline:none;border:none;font-size: 16px;background-color:transparent;}"
|
||||||
+ "span { display: block; overflow: hidden; padding-left:5px;vertical-align:middle;}"
|
+ "span { display: block; overflow: hidden; padding-left:5px;vertical-align:middle;}"
|
||||||
+ ".search_bar{display:table;vertical-align:middle;width:90%;height:35px;max-width:500px;margin:0 auto;background-color:#fff;box-shadow: 0px 2px 3px rgba( 0, 0, 0, 0.25 );"
|
+ ".search_bar{display:table;vertical-align:middle;width:90%;height:35px;max-width:500px;margin:0 auto;background-color:#fff;box-shadow: 0px 2px 3px rgba( 0, 0, 0, 0.25 );"
|
||||||
+ "font-family: Arial;color: #444;-moz-border-radius: 2px;-webkit-border-radius: 2px;border-radius: 2px;}"
|
+ "font-family: Arial;color: #444;-moz-border-radius: 2px;-webkit-border-radius: 2px;border-radius: 2px;}"
|
||||||
+ "#search_submit{outline:none;height:37px;float:right;color:#404040;font-size:16px;font-weight:bold;border:none;"
|
+ "#search_submit{outline:none;height:37px;float:right;color:#404040;font-size:16px;font-weight:bold;border:none;"
|
||||||
+ "background-color:transparent;}.outer { display: table; position: absolute; height: 100%; width: 100%;}"
|
+ "background-color:transparent;}.outer { display: table; position: absolute; height: 100%; width: 100%;}"
|
||||||
+ ".middle { display: table-cell; vertical-align: middle;}.inner { margin-left: auto; margin-right: auto; "
|
+ ".middle { display: table-cell; vertical-align: middle;}.inner { margin-left: auto; margin-right: auto; "
|
||||||
+ "margin-bottom:10%; width: 100%;}img.smaller{width:50%;max-width:300px;}"
|
+ "margin-bottom:10%; width: 100%;}img.smaller{width:50%;max-width:300px;}"
|
||||||
+ ".box { vertical-align:middle;position:relative; display: block; margin: 10px;padding-left:10px;padding-right:10px;padding-top:5px;padding-bottom:5px;"
|
+ ".box { vertical-align:middle;position:relative; display: block; margin: 10px;padding-left:10px;padding-right:10px;padding-top:5px;padding-bottom:5px;"
|
||||||
+ " background-color:#fff;box-shadow: 0px 3px rgba( 0, 0, 0, 0.1 );font-family: Arial;color: #444;"
|
+ " background-color:#fff;box-shadow: 0px 3px rgba( 0, 0, 0, 0.1 );font-family: Arial;color: #444;"
|
||||||
+ "font-size: 12px;-moz-border-radius: 2px;-webkit-border-radius: 2px;"
|
+ "font-size: 12px;-moz-border-radius: 2px;-webkit-border-radius: 2px;"
|
||||||
+ "border-radius: 2px;}</style><body> <div class=\"outer\"><div class=\"middle\"><div class=\"inner\"><img class=\"smaller\" src=\"";
|
+ "border-radius: 2px;}</style><body> <div class=\"outer\"><div class=\"middle\"><div class=\"inner\"><img class=\"smaller\" src=\"";
|
||||||
|
|
||||||
private static final String MIDDLE = "\" ></br></br><form onsubmit=\"return search()\" class=\"search_bar\" autocomplete=\"off\">"
|
private static final String MIDDLE = "\" ></br></br><form onsubmit=\"return search()\" class=\"search_bar\" autocomplete=\"off\">"
|
||||||
+ "<input type=\"submit\" id=\"search_submit\" value=\"Search\" ><span><input class=\"search\" type=\"text\" value=\"\" id=\"search_input\" >"
|
+ "<input type=\"submit\" id=\"search_submit\" value=\"Search\" ><span><input class=\"search\" type=\"text\" value=\"\" id=\"search_input\" >"
|
||||||
+ "</span></form></br></br></div></div></div><script type=\"text/javascript\">function search(){if(document.getElementById(\"search_input\").value != \"\"){window.location.href = \"";
|
+ "</span></form></br></br></div></div></div><script type=\"text/javascript\">function search(){if(document.getElementById(\"search_input\").value != \"\"){window.location.href = \"";
|
||||||
|
|
||||||
private static final String END = "\" + document.getElementById(\"search_input\").value;document.getElementById(\"search_input\").value = \"\";}return false;}</script></body></html>";
|
private static final String END = "\" + document.getElementById(\"search_input\").value;document.getElementById(\"search_input\").value = \"\";}return false;}</script></body></html>";
|
||||||
|
|
||||||
@ -62,7 +63,7 @@ public class StartPage {
|
|||||||
@NonNull private final String mTitle;
|
@NonNull private final String mTitle;
|
||||||
|
|
||||||
@Inject Application mApp;
|
@Inject Application mApp;
|
||||||
@Inject PreferenceManager mPreferenceManager;
|
@Inject SearchEngineProvider mSearchEngineProvider;
|
||||||
|
|
||||||
public StartPage() {
|
public StartPage() {
|
||||||
BrowserApp.getAppComponent().inject(this);
|
BrowserApp.getAppComponent().inject(this);
|
||||||
@ -76,80 +77,11 @@ public class StartPage {
|
|||||||
public void onSubscribe(@NonNull SingleSubscriber<String> subscriber) {
|
public void onSubscribe(@NonNull SingleSubscriber<String> subscriber) {
|
||||||
|
|
||||||
StringBuilder homepageBuilder = new StringBuilder(HEAD_1 + mTitle + HEAD_2);
|
StringBuilder homepageBuilder = new StringBuilder(HEAD_1 + mTitle + HEAD_2);
|
||||||
String icon;
|
|
||||||
String searchUrl;
|
|
||||||
switch (mPreferenceManager.getSearchChoice()) {
|
|
||||||
case 0:
|
|
||||||
// CUSTOM SEARCH
|
|
||||||
icon = "file:///android_asset/lightning.png";
|
|
||||||
searchUrl = mPreferenceManager.getSearchUrl();
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
// GOOGLE_SEARCH;
|
|
||||||
icon = "file:///android_asset/google.png";
|
|
||||||
// "https://www.google.com/images/srpr/logo11w.png";
|
|
||||||
searchUrl = Constants.GOOGLE_SEARCH;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
// ANDROID SEARCH;
|
|
||||||
icon = "file:///android_asset/ask.png";
|
|
||||||
searchUrl = Constants.ASK_SEARCH;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
// BING_SEARCH;
|
|
||||||
icon = "file:///android_asset/bing.png";
|
|
||||||
// "http://upload.wikimedia.org/wikipedia/commons/thumb/b/b1/Bing_logo_%282013%29.svg/500px-Bing_logo_%282013%29.svg.png";
|
|
||||||
searchUrl = Constants.BING_SEARCH;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
// YAHOO_SEARCH;
|
|
||||||
icon = "file:///android_asset/yahoo.png";
|
|
||||||
// "http://upload.wikimedia.org/wikipedia/commons/thumb/2/24/Yahoo%21_logo.svg/799px-Yahoo%21_logo.svg.png";
|
|
||||||
searchUrl = Constants.YAHOO_SEARCH;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
// STARTPAGE_SEARCH;
|
|
||||||
icon = "file:///android_asset/startpage.png";
|
|
||||||
// "https://com/graphics/startp_logo.gif";
|
|
||||||
searchUrl = Constants.STARTPAGE_SEARCH;
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
// STARTPAGE_MOBILE
|
|
||||||
icon = "file:///android_asset/startpage.png";
|
|
||||||
// "https://com/graphics/startp_logo.gif";
|
|
||||||
searchUrl = Constants.STARTPAGE_MOBILE_SEARCH;
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
// DUCK_SEARCH;
|
|
||||||
icon = "file:///android_asset/duckduckgo.png";
|
|
||||||
// "https://duckduckgo.com/assets/logo_homepage.normal.v101.png";
|
|
||||||
searchUrl = Constants.DUCK_SEARCH;
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
// DUCK_LITE_SEARCH;
|
|
||||||
icon = "file:///android_asset/duckduckgo.png";
|
|
||||||
// "https://duckduckgo.com/assets/logo_homepage.normal.v101.png";
|
|
||||||
searchUrl = Constants.DUCK_LITE_SEARCH;
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
// BAIDU_SEARCH;
|
|
||||||
icon = "file:///android_asset/baidu.png";
|
|
||||||
// "http://www.baidu.com/img/bdlogo.gif";
|
|
||||||
searchUrl = Constants.BAIDU_SEARCH;
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
// YANDEX_SEARCH;
|
|
||||||
icon = "file:///android_asset/yandex.png";
|
|
||||||
// "http://upload.wikimedia.org/wikipedia/commons/thumb/9/91/Yandex.svg/600px-Yandex.svg.png";
|
|
||||||
searchUrl = Constants.YANDEX_SEARCH;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// DEFAULT GOOGLE_SEARCH;
|
|
||||||
icon = "file:///android_asset/google.png";
|
|
||||||
searchUrl = Constants.GOOGLE_SEARCH;
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
BaseSearchEngine currentSearchEngine = mSearchEngineProvider.getCurrentSearchEngine();
|
||||||
|
|
||||||
|
String icon = currentSearchEngine.getIconUrl();
|
||||||
|
String searchUrl = currentSearchEngine.getQueryUrl();
|
||||||
|
|
||||||
homepageBuilder.append(icon);
|
homepageBuilder.append(icon);
|
||||||
homepageBuilder.append(MIDDLE);
|
homepageBuilder.append(MIDDLE);
|
||||||
|
@ -0,0 +1,64 @@
|
|||||||
|
package acr.browser.lightning.search;
|
||||||
|
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import acr.browser.lightning.app.BrowserApp;
|
||||||
|
import acr.browser.lightning.preference.PreferenceManager;
|
||||||
|
import acr.browser.lightning.search.engine.AskSearch;
|
||||||
|
import acr.browser.lightning.search.engine.BaiduSearch;
|
||||||
|
import acr.browser.lightning.search.engine.BaseSearchEngine;
|
||||||
|
import acr.browser.lightning.search.engine.BingSearch;
|
||||||
|
import acr.browser.lightning.search.engine.CustomSearch;
|
||||||
|
import acr.browser.lightning.search.engine.DuckLiteSearch;
|
||||||
|
import acr.browser.lightning.search.engine.DuckSearch;
|
||||||
|
import acr.browser.lightning.search.engine.GoogleSearch;
|
||||||
|
import acr.browser.lightning.search.engine.StartPageMobileSearch;
|
||||||
|
import acr.browser.lightning.search.engine.StartPageSearch;
|
||||||
|
import acr.browser.lightning.search.engine.YahooSearch;
|
||||||
|
import acr.browser.lightning.search.engine.YandexSearch;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The model that provides the search engine based
|
||||||
|
* on the user's preference.
|
||||||
|
*/
|
||||||
|
public class SearchEngineProvider {
|
||||||
|
|
||||||
|
@Inject PreferenceManager mPreferenceManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public SearchEngineProvider() {
|
||||||
|
BrowserApp.getAppComponent().inject(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public BaseSearchEngine getCurrentSearchEngine() {
|
||||||
|
switch (mPreferenceManager.getSearchChoice()) {
|
||||||
|
case 0:
|
||||||
|
return new CustomSearch(mPreferenceManager.getSearchUrl());
|
||||||
|
case 1:
|
||||||
|
default:
|
||||||
|
return new GoogleSearch();
|
||||||
|
case 2:
|
||||||
|
return new AskSearch();
|
||||||
|
case 3:
|
||||||
|
return new BingSearch();
|
||||||
|
case 4:
|
||||||
|
return new YahooSearch();
|
||||||
|
case 5:
|
||||||
|
return new StartPageSearch();
|
||||||
|
case 6:
|
||||||
|
return new StartPageMobileSearch();
|
||||||
|
case 7:
|
||||||
|
return new DuckSearch();
|
||||||
|
case 8:
|
||||||
|
return new DuckLiteSearch();
|
||||||
|
case 9:
|
||||||
|
return new BaiduSearch();
|
||||||
|
case 10:
|
||||||
|
return new YandexSearch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package acr.browser.lightning.search.engine;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package acr.browser.lightning.search.engine;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package acr.browser.lightning.search.engine;
|
||||||
|
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
|
import acr.browser.lightning.utils.Preconditions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class representative of a search engine.
|
||||||
|
*/
|
||||||
|
public class BaseSearchEngine {
|
||||||
|
|
||||||
|
@NonNull private final String mIconUrl;
|
||||||
|
@NonNull private final String mQueryUrl;
|
||||||
|
|
||||||
|
public BaseSearchEngine(@NonNull String iconUrl, @NonNull String queryUrl) {
|
||||||
|
Preconditions.checkNonNull(iconUrl);
|
||||||
|
Preconditions.checkNonNull(queryUrl);
|
||||||
|
|
||||||
|
mIconUrl = iconUrl;
|
||||||
|
mQueryUrl = queryUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public final String getIconUrl() {
|
||||||
|
return mIconUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public final String getQueryUrl() {
|
||||||
|
return mQueryUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package acr.browser.lightning.search.engine;
|
||||||
|
|
||||||
|
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);
|
||||||
|
// "http://upload.wikimedia.org/wikipedia/commons/thumb/b/b1/Bing_logo_%282013%29.svg/500px-Bing_logo_%282013%29.svg.png";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package acr.browser.lightning.search.engine;
|
||||||
|
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A custom search engine.
|
||||||
|
*/
|
||||||
|
public class CustomSearch extends BaseSearchEngine {
|
||||||
|
|
||||||
|
public CustomSearch(@NonNull String queryUrl) {
|
||||||
|
super("file:///android_asset/lightning.png", queryUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package acr.browser.lightning.search.engine;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package acr.browser.lightning.search.engine;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package acr.browser.lightning.search.engine;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package acr.browser.lightning.search.engine;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package acr.browser.lightning.search.engine;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package acr.browser.lightning.search.engine;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package acr.browser.lightning.search.engine;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user