Browse Source

Converting search engines to kotlin

master
anthony restaino 8 years ago
parent
commit
971ffbcb15
  1. 15
      app/src/main/java/acr/browser/lightning/search/engine/AskSearch.java
  2. 13
      app/src/main/java/acr/browser/lightning/search/engine/AskSearch.kt
  3. 17
      app/src/main/java/acr/browser/lightning/search/engine/BaiduSearch.java
  4. 15
      app/src/main/java/acr/browser/lightning/search/engine/BaiduSearch.kt
  5. 51
      app/src/main/java/acr/browser/lightning/search/engine/BaseSearchEngine.java
  6. 15
      app/src/main/java/acr/browser/lightning/search/engine/BaseSearchEngine.kt
  7. 18
      app/src/main/java/acr/browser/lightning/search/engine/BingSearch.java
  8. 16
      app/src/main/java/acr/browser/lightning/search/engine/BingSearch.kt
  9. 16
      app/src/main/java/acr/browser/lightning/search/engine/CustomSearch.java
  10. 12
      app/src/main/java/acr/browser/lightning/search/engine/CustomSearch.kt
  11. 17
      app/src/main/java/acr/browser/lightning/search/engine/DuckLiteSearch.java
  12. 15
      app/src/main/java/acr/browser/lightning/search/engine/DuckLiteSearch.kt
  13. 17
      app/src/main/java/acr/browser/lightning/search/engine/DuckSearch.java
  14. 15
      app/src/main/java/acr/browser/lightning/search/engine/DuckSearch.kt
  15. 16
      app/src/main/java/acr/browser/lightning/search/engine/GoogleSearch.java
  16. 15
      app/src/main/java/acr/browser/lightning/search/engine/GoogleSearch.kt
  17. 15
      app/src/main/java/acr/browser/lightning/search/engine/StartPageMobileSearch.java
  18. 13
      app/src/main/java/acr/browser/lightning/search/engine/StartPageMobileSearch.kt
  19. 15
      app/src/main/java/acr/browser/lightning/search/engine/StartPageSearch.java
  20. 13
      app/src/main/java/acr/browser/lightning/search/engine/StartPageSearch.kt
  21. 18
      app/src/main/java/acr/browser/lightning/search/engine/YahooSearch.java
  22. 16
      app/src/main/java/acr/browser/lightning/search/engine/YahooSearch.kt
  23. 18
      app/src/main/java/acr/browser/lightning/search/engine/YandexSearch.java
  24. 16
      app/src/main/java/acr/browser/lightning/search/engine/YandexSearch.kt

15
app/src/main/java/acr/browser/lightning/search/engine/AskSearch.java

@ -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);
}
}

13
app/src/main/java/acr/browser/lightning/search/engine/AskSearch.kt

@ -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
)

17
app/src/main/java/acr/browser/lightning/search/engine/BaiduSearch.java

@ -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);
}
}

15
app/src/main/java/acr/browser/lightning/search/engine/BaiduSearch.kt

@ -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
)

51
app/src/main/java/acr/browser/lightning/search/engine/BaseSearchEngine.java

@ -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;
}
}

15
app/src/main/java/acr/browser/lightning/search/engine/BaseSearchEngine.kt

@ -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)

18
app/src/main/java/acr/browser/lightning/search/engine/BingSearch.java

@ -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);
}
}

16
app/src/main/java/acr/browser/lightning/search/engine/BingSearch.kt

@ -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
)

16
app/src/main/java/acr/browser/lightning/search/engine/CustomSearch.java

@ -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);
}
}

12
app/src/main/java/acr/browser/lightning/search/engine/CustomSearch.kt

@ -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
)

17
app/src/main/java/acr/browser/lightning/search/engine/DuckLiteSearch.java

@ -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);
}
}

15
app/src/main/java/acr/browser/lightning/search/engine/DuckLiteSearch.kt

@ -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
)

17
app/src/main/java/acr/browser/lightning/search/engine/DuckSearch.java

@ -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);
}
}

15
app/src/main/java/acr/browser/lightning/search/engine/DuckSearch.kt

@ -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
)

16
app/src/main/java/acr/browser/lightning/search/engine/GoogleSearch.java

@ -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);
}
}

15
app/src/main/java/acr/browser/lightning/search/engine/GoogleSearch.kt

@ -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
)

15
app/src/main/java/acr/browser/lightning/search/engine/StartPageMobileSearch.java

@ -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);
}
}

13
app/src/main/java/acr/browser/lightning/search/engine/StartPageMobileSearch.kt

@ -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
)

15
app/src/main/java/acr/browser/lightning/search/engine/StartPageSearch.java

@ -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);
}
}

13
app/src/main/java/acr/browser/lightning/search/engine/StartPageSearch.kt

@ -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
)

18
app/src/main/java/acr/browser/lightning/search/engine/YahooSearch.java

@ -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);
}
}

16
app/src/main/java/acr/browser/lightning/search/engine/YahooSearch.kt

@ -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
)

18
app/src/main/java/acr/browser/lightning/search/engine/YandexSearch.java

@ -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);
}
}

16
app/src/main/java/acr/browser/lightning/search/engine/YandexSearch.kt

@ -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…
Cancel
Save