Browse Source

initial i2p mod commit

master
R4SAS 6 years ago
parent
commit
3cd9e0d4d2
  1. 16
      app/build.gradle
  2. 8
      app/proguard-project.txt
  3. 2
      app/src/main/AndroidManifest.xml
  4. BIN
      app/src/main/assets/ask.png
  5. BIN
      app/src/main/assets/baidu.png
  6. BIN
      app/src/main/assets/bing.png
  7. BIN
      app/src/main/assets/google.png
  8. BIN
      app/src/main/assets/legwork.png
  9. BIN
      app/src/main/assets/startpage.png
  10. BIN
      app/src/main/assets/yahoo.png
  11. BIN
      app/src/main/assets/yandex.png
  12. 95
      app/src/main/java/acr/browser/lightning/di/AppComponent.java
  13. 112
      app/src/main/java/acr/browser/lightning/search/SearchEngineProvider.java
  14. 13
      app/src/main/java/acr/browser/lightning/search/engine/AskSearch.kt
  15. 15
      app/src/main/java/acr/browser/lightning/search/engine/BaiduSearch.kt
  16. 16
      app/src/main/java/acr/browser/lightning/search/engine/BingSearch.kt
  17. 15
      app/src/main/java/acr/browser/lightning/search/engine/GoogleSearch.kt
  18. 13
      app/src/main/java/acr/browser/lightning/search/engine/StartPageMobileSearch.kt
  19. 13
      app/src/main/java/acr/browser/lightning/search/engine/StartPageSearch.kt
  20. 16
      app/src/main/java/acr/browser/lightning/search/engine/YahooSearch.kt
  21. 16
      app/src/main/java/acr/browser/lightning/search/engine/YandexSearch.kt
  22. 68
      app/src/main/java/acr/browser/lightning/search/suggestions/GoogleSuggestionsModel.java
  23. 24
      app/src/main/java/org/purplei2p/lightning/BrowserApp.java
  24. 4
      app/src/main/java/org/purplei2p/lightning/IncognitoActivity.java
  25. 4
      app/src/main/java/org/purplei2p/lightning/MainActivity.java
  26. 4
      app/src/main/java/org/purplei2p/lightning/activity/AppCompatPreferenceActivity.java
  27. 10
      app/src/main/java/org/purplei2p/lightning/adblock/AdBlock.java
  28. 2
      app/src/main/java/org/purplei2p/lightning/animation/AnimationUtils.java
  29. 4
      app/src/main/java/org/purplei2p/lightning/browser/BookmarksView.java
  30. 24
      app/src/main/java/org/purplei2p/lightning/browser/BrowserPresenter.java
  31. 2
      app/src/main/java/org/purplei2p/lightning/browser/BrowserView.java
  32. 12
      app/src/main/java/org/purplei2p/lightning/browser/SearchBoxModel.java
  33. 26
      app/src/main/java/org/purplei2p/lightning/browser/TabsManager.java
  34. 2
      app/src/main/java/org/purplei2p/lightning/browser/TabsView.java
  35. 78
      app/src/main/java/org/purplei2p/lightning/browser/activity/BrowserActivity.java
  36. 10
      app/src/main/java/org/purplei2p/lightning/browser/activity/ThemableBrowserActivity.java
  37. 4
      app/src/main/java/org/purplei2p/lightning/browser/bookmark/BookmarkUiModel.java
  38. 38
      app/src/main/java/org/purplei2p/lightning/browser/fragment/BookmarksFragment.java
  39. 28
      app/src/main/java/org/purplei2p/lightning/browser/fragment/TabsFragment.java
  40. 4
      app/src/main/java/org/purplei2p/lightning/browser/fragment/anim/HorizontalItemAnimator.java
  41. 4
      app/src/main/java/org/purplei2p/lightning/browser/fragment/anim/VerticalItemAnimator.java
  42. 20
      app/src/main/java/org/purplei2p/lightning/constant/BookmarkPage.java
  43. 11
      app/src/main/java/org/purplei2p/lightning/constant/Constants.java
  44. 16
      app/src/main/java/org/purplei2p/lightning/constant/DownloadsPage.java
  45. 14
      app/src/main/java/org/purplei2p/lightning/constant/HistoryPage.java
  46. 12
      app/src/main/java/org/purplei2p/lightning/constant/StartPage.java
  47. 10
      app/src/main/java/org/purplei2p/lightning/controller/UIController.java
  48. 4
      app/src/main/java/org/purplei2p/lightning/database/HistoryItem.java
  49. 8
      app/src/main/java/org/purplei2p/lightning/database/bookmark/BookmarkDatabase.java
  50. 10
      app/src/main/java/org/purplei2p/lightning/database/bookmark/BookmarkExporter.java
  51. 6
      app/src/main/java/org/purplei2p/lightning/database/bookmark/BookmarkLocalSync.java
  52. 4
      app/src/main/java/org/purplei2p/lightning/database/bookmark/BookmarkModel.java
  53. 8
      app/src/main/java/org/purplei2p/lightning/database/bookmark/legacy/LegacyBookmarkManager.java
  54. 4
      app/src/main/java/org/purplei2p/lightning/database/downloads/DownloadItem.java
  55. 4
      app/src/main/java/org/purplei2p/lightning/database/downloads/DownloadsDatabase.java
  56. 2
      app/src/main/java/org/purplei2p/lightning/database/downloads/DownloadsModel.java
  57. 6
      app/src/main/java/org/purplei2p/lightning/database/history/HistoryDatabase.java
  58. 4
      app/src/main/java/org/purplei2p/lightning/database/history/HistoryModel.java
  59. 95
      app/src/main/java/org/purplei2p/lightning/di/AppComponent.java
  60. 27
      app/src/main/java/org/purplei2p/lightning/di/AppModule.java
  61. 8
      app/src/main/java/org/purplei2p/lightning/dialog/BrowserDialog.java
  62. 32
      app/src/main/java/org/purplei2p/lightning/dialog/LightningDialogBuilder.java
  63. 28
      app/src/main/java/org/purplei2p/lightning/download/DownloadHandler.java
  64. 6
      app/src/main/java/org/purplei2p/lightning/download/FetchUrlMimeType.java
  65. 12
      app/src/main/java/org/purplei2p/lightning/download/LightningDownloadListener.java
  66. 2
      app/src/main/java/org/purplei2p/lightning/download/WebAddress.java
  67. 12
      app/src/main/java/org/purplei2p/lightning/favicon/FaviconModel.java
  68. 2
      app/src/main/java/org/purplei2p/lightning/favicon/FaviconUtils.java
  69. 2
      app/src/main/java/org/purplei2p/lightning/interpolator/BezierDecelerateInterpolator.java
  70. 19
      app/src/main/java/org/purplei2p/lightning/preference/PreferenceManager.java
  71. 2
      app/src/main/java/org/purplei2p/lightning/reading/ArticleTextExtractor.java
  72. 2
      app/src/main/java/org/purplei2p/lightning/reading/Converter.java
  73. 4
      app/src/main/java/org/purplei2p/lightning/reading/HtmlFetcher.java
  74. 2
      app/src/main/java/org/purplei2p/lightning/reading/ImageResult.java
  75. 2
      app/src/main/java/org/purplei2p/lightning/reading/JResult.java
  76. 2
      app/src/main/java/org/purplei2p/lightning/reading/OutputFormatter.java
  77. 2
      app/src/main/java/org/purplei2p/lightning/reading/SCache.java
  78. 2
      app/src/main/java/org/purplei2p/lightning/reading/SHelper.java
  79. 20
      app/src/main/java/org/purplei2p/lightning/reading/activity/ReadingActivity.java
  80. 2
      app/src/main/java/org/purplei2p/lightning/receiver/NetworkReceiver.java
  81. 70
      app/src/main/java/org/purplei2p/lightning/search/SearchEngineProvider.java
  82. 24
      app/src/main/java/org/purplei2p/lightning/search/SuggestionsAdapter.java
  83. 23
      app/src/main/java/org/purplei2p/lightning/search/SuggestionsManager.kt
  84. 2
      app/src/main/java/org/purplei2p/lightning/search/engine/BaseSearchEngine.kt
  85. 4
      app/src/main/java/org/purplei2p/lightning/search/engine/CustomSearch.kt
  86. 6
      app/src/main/java/org/purplei2p/lightning/search/engine/DuckLiteSearch.kt
  87. 6
      app/src/main/java/org/purplei2p/lightning/search/engine/DuckSearch.kt
  88. 15
      app/src/main/java/org/purplei2p/lightning/search/engine/LegworkSearch.kt
  89. 8
      app/src/main/java/org/purplei2p/lightning/search/suggestions/BaseSuggestionsModel.java
  90. 8
      app/src/main/java/org/purplei2p/lightning/search/suggestions/DuckSuggestionsModel.java
  91. 31
      app/src/main/java/org/purplei2p/lightning/search/suggestions/LegworkSuggestionsModel.java
  92. 6
      app/src/main/java/org/purplei2p/lightning/settings/activity/SettingsActivity.java
  93. 12
      app/src/main/java/org/purplei2p/lightning/settings/activity/ThemableSettingsActivity.java
  94. 4
      app/src/main/java/org/purplei2p/lightning/settings/fragment/AboutSettingsFragment.java
  95. 8
      app/src/main/java/org/purplei2p/lightning/settings/fragment/AdvancedSettingsFragment.java
  96. 24
      app/src/main/java/org/purplei2p/lightning/settings/fragment/BookmarkSettingsFragment.java
  97. 10
      app/src/main/java/org/purplei2p/lightning/settings/fragment/DebugSettingsFragment.java
  98. 6
      app/src/main/java/org/purplei2p/lightning/settings/fragment/DisplaySettingsFragment.java
  99. 56
      app/src/main/java/org/purplei2p/lightning/settings/fragment/GeneralSettingsFragment.java
  100. 6
      app/src/main/java/org/purplei2p/lightning/settings/fragment/LightningPreferenceFragment.java
  101. Some files were not shown because too many files have changed in this diff Show More

16
app/build.gradle

@ -13,6 +13,15 @@ android {
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
} }
signingConfigs {
r4sas {
storeFile file("store.jks")
storePassword "storepass"
keyAlias "keyalias"
keyPassword "keypass"
}
}
sourceSets { sourceSets {
lightningPlus.setRoot('src/LightningPlus') lightningPlus.setRoot('src/LightningPlus')
lightningLite.setRoot('src/LightningLite') lightningLite.setRoot('src/LightningLite')
@ -28,6 +37,7 @@ android {
release { release {
minifyEnabled true minifyEnabled true
shrinkResources true shrinkResources true
signingConfig signingConfigs.r4sas
proguardFiles 'proguard-project.txt' proguardFiles 'proguard-project.txt'
} }
} }
@ -35,13 +45,13 @@ android {
productFlavors { productFlavors {
lightningPlus { lightningPlus {
buildConfigField "boolean", "FULL_VERSION", "Boolean.parseBoolean(\"true\")" buildConfigField "boolean", "FULL_VERSION", "Boolean.parseBoolean(\"true\")"
applicationId "acr.browser.lightning" applicationId "org.purplei2p.lightning"
versionCode project.versionCode_plus versionCode project.versionCode_plus
} }
lightningLite { lightningLite {
buildConfigField "boolean", "FULL_VERSION", "Boolean.parseBoolean(\"false\")" buildConfigField "boolean", "FULL_VERSION", "Boolean.parseBoolean(\"false\")"
applicationId "acr.browser.barebones" applicationId "org.purplei2p.barebones"
versionCode project.versionCode_lite versionCode project.versionCode_lite
} }
} }
@ -92,8 +102,6 @@ dependencies {
compile 'com.anthonycr.grant:permissions:1.1.2' compile 'com.anthonycr.grant:permissions:1.1.2'
// proxy support // proxy support
compile 'net.i2p.android:client:0.8'
compile 'com.squareup.okhttp3:okhttp:3.8.0' compile 'com.squareup.okhttp3:okhttp:3.8.0'
// tor proxy // tor proxy

8
app/proguard-project.txt

@ -34,7 +34,7 @@
-keep public class * extends android.app.backup.BackupAgentHelper -keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference -keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService -keep public class com.android.vending.licensing.ILicensingService
-keep public class acr.browser.lightning.reading.* -keep public class org.purplei2p.lightning.reading.*
-keep class org.lucasr.twowayview.** { *; } -keep class org.lucasr.twowayview.** { *; }
-keepattributes *Annotation* -keepattributes *Annotation*
@ -68,7 +68,7 @@
} }
# Without this rule, openFileChooser does not get called on KitKat # Without this rule, openFileChooser does not get called on KitKat
-keep class acr.browser.lightning.view.LightningView$LightningChromeClient { -keep class org.purplei2p.lightning.view.LightningView$LightningChromeClient {
void openFileChooser(android.webkit.ValueCallback); void openFileChooser(android.webkit.ValueCallback);
void openFileChooser(android.webkit.ValueCallback, java.lang.String); void openFileChooser(android.webkit.ValueCallback, java.lang.String);
void openFileChooser(android.webkit.ValueCallback, java.lang.String, java.lang.String); void openFileChooser(android.webkit.ValueCallback, java.lang.String, java.lang.String);
@ -104,10 +104,6 @@
# platform version. We know about them, and they are safe. # platform version. We know about them, and they are safe.
-dontwarn android.support.** -dontwarn android.support.**
# The I2P Java API bundled inside the I2P Android client library contains
# references to javax.naming classes that Android doesn't have. But those
# classes are never used on Android, and it is safe to ignore the warnings.
-dontwarn net.i2p.crypto.CertUtil
-dontwarn org.apache.http.conn.ssl.DefaultHostnameVerifier -dontwarn org.apache.http.conn.ssl.DefaultHostnameVerifier
-dontwarn org.apache.http.HttpHost -dontwarn org.apache.http.HttpHost

2
app/src/main/AndroidManifest.xml

@ -2,7 +2,7 @@
<!-- Copyright 2014 A.C.R. Development --> <!-- Copyright 2014 A.C.R. Development -->
<manifest <manifest
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
package="acr.browser.lightning" package="org.purplei2p.lightning"
android:installLocation="auto"> android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.INTERNET"/>

BIN
app/src/main/assets/ask.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

BIN
app/src/main/assets/baidu.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

BIN
app/src/main/assets/bing.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

BIN
app/src/main/assets/google.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

BIN
app/src/main/assets/legwork.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

BIN
app/src/main/assets/startpage.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

BIN
app/src/main/assets/yahoo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

BIN
app/src/main/assets/yandex.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

95
app/src/main/java/acr/browser/lightning/di/AppComponent.java

@ -1,95 +0,0 @@
package acr.browser.lightning.di;
import javax.inject.Singleton;
import acr.browser.lightning.browser.activity.BrowserActivity;
import acr.browser.lightning.reading.activity.ReadingActivity;
import acr.browser.lightning.browser.TabsManager;
import acr.browser.lightning.browser.activity.ThemableBrowserActivity;
import acr.browser.lightning.settings.activity.ThemableSettingsActivity;
import acr.browser.lightning.BrowserApp;
import acr.browser.lightning.browser.BrowserPresenter;
import acr.browser.lightning.browser.SearchBoxModel;
import acr.browser.lightning.constant.BookmarkPage;
import acr.browser.lightning.constant.DownloadsPage;
import acr.browser.lightning.constant.HistoryPage;
import acr.browser.lightning.constant.StartPage;
import acr.browser.lightning.dialog.LightningDialogBuilder;
import acr.browser.lightning.download.DownloadHandler;
import acr.browser.lightning.download.LightningDownloadListener;
import acr.browser.lightning.settings.fragment.BookmarkSettingsFragment;
import acr.browser.lightning.browser.fragment.BookmarksFragment;
import acr.browser.lightning.settings.fragment.DebugSettingsFragment;
import acr.browser.lightning.settings.fragment.GeneralSettingsFragment;
import acr.browser.lightning.settings.fragment.LightningPreferenceFragment;
import acr.browser.lightning.settings.fragment.PrivacySettingsFragment;
import acr.browser.lightning.browser.fragment.TabsFragment;
import acr.browser.lightning.search.SearchEngineProvider;
import acr.browser.lightning.search.SuggestionsAdapter;
import acr.browser.lightning.utils.ProxyUtils;
import acr.browser.lightning.view.LightningChromeClient;
import acr.browser.lightning.view.LightningView;
import acr.browser.lightning.view.LightningWebClient;
import dagger.Component;
@Singleton
@Component(modules = {AppModule.class})
public interface AppComponent {
void inject(BrowserActivity activity);
void inject(BookmarksFragment fragment);
void inject(BookmarkSettingsFragment fragment);
void inject(LightningDialogBuilder builder);
void inject(TabsFragment fragment);
void inject(LightningView lightningView);
void inject(ThemableBrowserActivity activity);
void inject(LightningPreferenceFragment fragment);
void inject(BrowserApp app);
void inject(ProxyUtils proxyUtils);
void inject(ReadingActivity activity);
void inject(LightningWebClient webClient);
void inject(ThemableSettingsActivity activity);
void inject(LightningDownloadListener listener);
void inject(PrivacySettingsFragment fragment);
void inject(StartPage startPage);
void inject(HistoryPage historyPage);
void inject(BookmarkPage bookmarkPage);
void inject(DownloadsPage downloadsPage);
void inject(BrowserPresenter presenter);
void inject(TabsManager manager);
void inject(DebugSettingsFragment fragment);
void inject(SuggestionsAdapter suggestionsAdapter);
void inject(LightningChromeClient chromeClient);
void inject(DownloadHandler downloadHandler);
void inject(SearchBoxModel searchBoxModel);
void inject(SearchEngineProvider searchEngineProvider);
void inject(GeneralSettingsFragment generalSettingsFragment);
}

112
app/src/main/java/acr/browser/lightning/search/SearchEngineProvider.java

@ -1,112 +0,0 @@
package acr.browser.lightning.search;
import android.support.annotation.NonNull;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import acr.browser.lightning.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();
}
}
public int mapSearchEngineToPreferenceIndex(@NonNull BaseSearchEngine searchEngine) {
if (searchEngine instanceof CustomSearch) {
return 0;
} else if (searchEngine instanceof GoogleSearch) {
return 1;
} else if (searchEngine instanceof AskSearch) {
return 2;
} else if (searchEngine instanceof BingSearch) {
return 3;
} else if (searchEngine instanceof YahooSearch) {
return 4;
} else if (searchEngine instanceof StartPageSearch) {
return 5;
} else if (searchEngine instanceof StartPageMobileSearch) {
return 6;
} else if (searchEngine instanceof DuckSearch) {
return 7;
} else if (searchEngine instanceof DuckLiteSearch) {
return 8;
} else if (searchEngine instanceof BaiduSearch) {
return 9;
} else if (searchEngine instanceof YandexSearch) {
return 10;
} else {
throw new UnsupportedOperationException("Unknown search engine provided: " + searchEngine.getClass());
}
}
@NonNull
public List<BaseSearchEngine> getAllSearchEngines() {
return new ArrayList<BaseSearchEngine>(11) {{
add(new CustomSearch(mPreferenceManager.getSearchUrl()));
add(new GoogleSearch());
add(new AskSearch());
add(new BingSearch());
add(new YahooSearch());
add(new StartPageSearch());
add(new StartPageMobileSearch());
add(new DuckSearch());
add(new DuckLiteSearch());
add(new BaiduSearch());
add(new YandexSearch());
}};
}
}

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

@ -1,13 +0,0 @@
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
)

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

@ -1,15 +0,0 @@
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
)

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

@ -1,16 +0,0 @@
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
)

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

@ -1,15 +0,0 @@
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
)

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

@ -1,13 +0,0 @@
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
)

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

@ -1,13 +0,0 @@
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
)

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

@ -1,16 +0,0 @@
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
)

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

@ -1,16 +0,0 @@
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
)

68
app/src/main/java/acr/browser/lightning/search/suggestions/GoogleSuggestionsModel.java

@ -1,68 +0,0 @@
package acr.browser.lightning.search.suggestions;
import android.app.Application;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
import java.io.BufferedInputStream;
import java.io.InputStream;
import java.util.List;
import acr.browser.lightning.R;
import acr.browser.lightning.database.HistoryItem;
/**
* Search suggestions provider for Google search engine.
*/
public class GoogleSuggestionsModel extends BaseSuggestionsModel {
@NonNull private static final String ENCODING = "UTF-8";
@Nullable private static XmlPullParser sXpp;
@NonNull private final String mSearchSubtitle;
public GoogleSuggestionsModel(@NonNull Application application) {
super(application, ENCODING);
mSearchSubtitle = application.getString(R.string.suggestion);
}
@NonNull
protected String createQueryUrl(@NonNull String query, @NonNull String language) {
return "https://suggestqueries.google.com/complete/search?output=toolbar&hl="
+ language + "&q=" + query;
}
@Override
protected void parseResults(@NonNull InputStream inputStream, @NonNull List<HistoryItem> results) throws Exception {
BufferedInputStream bufferedInput = new BufferedInputStream(inputStream);
XmlPullParser parser = getParser();
parser.setInput(bufferedInput, ENCODING);
int eventType = parser.getEventType();
int counter = 0;
while (eventType != XmlPullParser.END_DOCUMENT) {
if (eventType == XmlPullParser.START_TAG && "suggestion".equals(parser.getName())) {
String suggestion = parser.getAttributeValue(null, "data");
results.add(new HistoryItem(mSearchSubtitle + " \"" + suggestion + '"',
suggestion, R.drawable.ic_search));
counter++;
if (counter >= MAX_RESULTS) {
break;
}
}
eventType = parser.next();
}
}
@NonNull
private static synchronized XmlPullParser getParser() throws XmlPullParserException {
if (sXpp == null) {
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
factory.setNamespaceAware(true);
sXpp = factory.newPullParser();
}
return sXpp;
}
}

24
app/src/main/java/acr/browser/lightning/BrowserApp.java → app/src/main/java/org/purplei2p/lightning/BrowserApp.java

@ -1,4 +1,4 @@
package acr.browser.lightning; package org.purplei2p.lightning;
import android.app.Activity; import android.app.Activity;
import android.app.Application; import android.app.Application;
@ -20,17 +20,17 @@ import java.util.List;
import javax.inject.Inject; import javax.inject.Inject;
import acr.browser.lightning.database.HistoryItem; import org.purplei2p.lightning.database.HistoryItem;
import acr.browser.lightning.database.bookmark.BookmarkExporter; import org.purplei2p.lightning.database.bookmark.BookmarkExporter;
import acr.browser.lightning.database.bookmark.BookmarkModel; import org.purplei2p.lightning.database.bookmark.BookmarkModel;
import acr.browser.lightning.database.bookmark.legacy.LegacyBookmarkManager; import org.purplei2p.lightning.database.bookmark.legacy.LegacyBookmarkManager;
import acr.browser.lightning.di.AppComponent; import org.purplei2p.lightning.di.AppComponent;
import acr.browser.lightning.di.AppModule; import org.purplei2p.lightning.di.AppModule;
import acr.browser.lightning.di.DaggerAppComponent; import org.purplei2p.lightning.di.DaggerAppComponent;
import acr.browser.lightning.preference.PreferenceManager; import org.purplei2p.lightning.preference.PreferenceManager;
import acr.browser.lightning.utils.FileUtils; import org.purplei2p.lightning.utils.FileUtils;
import acr.browser.lightning.utils.MemoryLeakUtils; import org.purplei2p.lightning.utils.MemoryLeakUtils;
import acr.browser.lightning.utils.Preconditions; import org.purplei2p.lightning.utils.Preconditions;
public class BrowserApp extends Application { public class BrowserApp extends Application {

4
app/src/main/java/acr/browser/lightning/IncognitoActivity.java → app/src/main/java/org/purplei2p/lightning/IncognitoActivity.java

@ -1,4 +1,4 @@
package acr.browser.lightning; package org.purplei2p.lightning;
import android.content.Intent; import android.content.Intent;
import android.os.Build; import android.os.Build;
@ -12,7 +12,7 @@ import com.anthonycr.bonsai.Completable;
import com.anthonycr.bonsai.CompletableAction; import com.anthonycr.bonsai.CompletableAction;
import com.anthonycr.bonsai.CompletableSubscriber; import com.anthonycr.bonsai.CompletableSubscriber;
import acr.browser.lightning.browser.activity.BrowserActivity; import org.purplei2p.lightning.browser.activity.BrowserActivity;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class IncognitoActivity extends BrowserActivity { public class IncognitoActivity extends BrowserActivity {

4
app/src/main/java/acr/browser/lightning/MainActivity.java → app/src/main/java/org/purplei2p/lightning/MainActivity.java

@ -1,4 +1,4 @@
package acr.browser.lightning; package org.purplei2p.lightning;
import android.content.Intent; import android.content.Intent;
import android.os.Build; import android.os.Build;
@ -13,7 +13,7 @@ import com.anthonycr.bonsai.Completable;
import com.anthonycr.bonsai.CompletableAction; import com.anthonycr.bonsai.CompletableAction;
import com.anthonycr.bonsai.CompletableSubscriber; import com.anthonycr.bonsai.CompletableSubscriber;
import acr.browser.lightning.browser.activity.BrowserActivity; import org.purplei2p.lightning.browser.activity.BrowserActivity;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class MainActivity extends BrowserActivity { public class MainActivity extends BrowserActivity {

4
app/src/main/java/acr/browser/lightning/activity/AppCompatPreferenceActivity.java → app/src/main/java/org/purplei2p/lightning/activity/AppCompatPreferenceActivity.java

@ -1,4 +1,4 @@
package acr.browser.lightning.activity; package org.purplei2p.lightning.activity;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.os.Bundle; import android.os.Bundle;
@ -13,7 +13,7 @@ import android.view.MenuInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
/** /**
* A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls * A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls

10
app/src/main/java/acr/browser/lightning/adblock/AdBlock.java → app/src/main/java/org/purplei2p/lightning/adblock/AdBlock.java

@ -1,4 +1,4 @@
package acr.browser.lightning.adblock; package org.purplei2p.lightning.adblock;
import android.app.Application; import android.app.Application;
import android.content.res.AssetManager; import android.content.res.AssetManager;
@ -24,10 +24,10 @@ import java.util.Set;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import acr.browser.lightning.BuildConfig; import org.purplei2p.lightning.BuildConfig;
import acr.browser.lightning.preference.PreferenceManager; import org.purplei2p.lightning.preference.PreferenceManager;
import acr.browser.lightning.utils.StringBuilderUtils; import org.purplei2p.lightning.utils.StringBuilderUtils;
import acr.browser.lightning.utils.Utils; import org.purplei2p.lightning.utils.Utils;
@Singleton @Singleton
public class AdBlock { public class AdBlock {

2
app/src/main/java/acr/browser/lightning/animation/AnimationUtils.java → app/src/main/java/org/purplei2p/lightning/animation/AnimationUtils.java

@ -1,4 +1,4 @@
package acr.browser.lightning.animation; package org.purplei2p.lightning.animation;
import android.support.annotation.DrawableRes; import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;

4
app/src/main/java/acr/browser/lightning/browser/BookmarksView.java → app/src/main/java/org/purplei2p/lightning/browser/BookmarksView.java

@ -1,8 +1,8 @@
package acr.browser.lightning.browser; package org.purplei2p.lightning.browser;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import acr.browser.lightning.database.HistoryItem; import org.purplei2p.lightning.database.HistoryItem;
public interface BookmarksView { public interface BookmarksView {

24
app/src/main/java/acr/browser/lightning/browser/BrowserPresenter.java → app/src/main/java/org/purplei2p/lightning/browser/BrowserPresenter.java

@ -1,4 +1,4 @@
package acr.browser.lightning.browser; package org.purplei2p.lightning.browser;
import android.app.Activity; import android.app.Activity;
import android.app.Application; import android.app.Application;
@ -14,17 +14,17 @@ import com.anthonycr.bonsai.Schedulers;
import javax.inject.Inject; import javax.inject.Inject;
import acr.browser.lightning.BuildConfig; import org.purplei2p.lightning.BuildConfig;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.BrowserApp; import org.purplei2p.lightning.BrowserApp;
import acr.browser.lightning.constant.BookmarkPage; import org.purplei2p.lightning.constant.BookmarkPage;
import acr.browser.lightning.constant.Constants; import org.purplei2p.lightning.constant.Constants;
import acr.browser.lightning.constant.StartPage; import org.purplei2p.lightning.constant.StartPage;
import acr.browser.lightning.controller.UIController; import org.purplei2p.lightning.controller.UIController;
import acr.browser.lightning.preference.PreferenceManager; import org.purplei2p.lightning.preference.PreferenceManager;
import acr.browser.lightning.utils.UrlUtils; import org.purplei2p.lightning.utils.UrlUtils;
import acr.browser.lightning.view.LightningView; import org.purplei2p.lightning.view.LightningView;
/** /**
* Presenter in charge of keeping track of * Presenter in charge of keeping track of

2
app/src/main/java/acr/browser/lightning/browser/BrowserView.java → app/src/main/java/org/purplei2p/lightning/browser/BrowserView.java

@ -1,4 +1,4 @@
package acr.browser.lightning.browser; package org.purplei2p.lightning.browser;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;

12
app/src/main/java/acr/browser/lightning/browser/SearchBoxModel.java → app/src/main/java/org/purplei2p/lightning/browser/SearchBoxModel.java

@ -1,4 +1,4 @@
package acr.browser.lightning.browser; package org.purplei2p.lightning.browser;
import android.app.Application; import android.app.Application;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
@ -7,11 +7,11 @@ import android.text.TextUtils;
import javax.inject.Inject; import javax.inject.Inject;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.BrowserApp; import org.purplei2p.lightning.BrowserApp;
import acr.browser.lightning.preference.PreferenceManager; import org.purplei2p.lightning.preference.PreferenceManager;
import acr.browser.lightning.utils.UrlUtils; import org.purplei2p.lightning.utils.UrlUtils;
import acr.browser.lightning.utils.Utils; import org.purplei2p.lightning.utils.Utils;
/** /**
* A UI model for the search box. * A UI model for the search box.

26
app/src/main/java/acr/browser/lightning/browser/TabsManager.java → app/src/main/java/org/purplei2p/lightning/browser/TabsManager.java

@ -1,4 +1,4 @@
package acr.browser.lightning.browser; package org.purplei2p.lightning.browser;
import android.app.Activity; import android.app.Activity;
import android.app.Application; import android.app.Application;
@ -30,18 +30,18 @@ import java.util.List;
import javax.inject.Inject; import javax.inject.Inject;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.BrowserApp; import org.purplei2p.lightning.BrowserApp;
import acr.browser.lightning.constant.BookmarkPage; import org.purplei2p.lightning.constant.BookmarkPage;
import acr.browser.lightning.constant.DownloadsPage; import org.purplei2p.lightning.constant.DownloadsPage;
import acr.browser.lightning.constant.HistoryPage; import org.purplei2p.lightning.constant.HistoryPage;
import acr.browser.lightning.constant.StartPage; import org.purplei2p.lightning.constant.StartPage;
import acr.browser.lightning.dialog.BrowserDialog; import org.purplei2p.lightning.dialog.BrowserDialog;
import acr.browser.lightning.preference.PreferenceManager; import org.purplei2p.lightning.preference.PreferenceManager;
import acr.browser.lightning.utils.FileUtils; import org.purplei2p.lightning.utils.FileUtils;
import acr.browser.lightning.utils.Preconditions; import org.purplei2p.lightning.utils.Preconditions;
import acr.browser.lightning.utils.UrlUtils; import org.purplei2p.lightning.utils.UrlUtils;
import acr.browser.lightning.view.LightningView; import org.purplei2p.lightning.view.LightningView;
/** /**
* A manager singleton that holds all the {@link LightningView} * A manager singleton that holds all the {@link LightningView}

2
app/src/main/java/acr/browser/lightning/browser/TabsView.java → app/src/main/java/org/purplei2p/lightning/browser/TabsView.java

@ -1,4 +1,4 @@
package acr.browser.lightning.browser; package org.purplei2p.lightning.browser;
public interface TabsView { public interface TabsView {

78
app/src/main/java/acr/browser/lightning/browser/activity/BrowserActivity.java → app/src/main/java/org/purplei2p/lightning/browser/activity/BrowserActivity.java

@ -2,7 +2,7 @@
* Copyright 2015 Anthony Restaino * Copyright 2015 Anthony Restaino
*/ */
package acr.browser.lightning.browser.activity; package org.purplei2p.lightning.browser.activity;
import android.app.Activity; import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
@ -89,44 +89,44 @@ import java.io.IOException;
import javax.inject.Inject; import javax.inject.Inject;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.reading.activity.ReadingActivity; import org.purplei2p.lightning.reading.activity.ReadingActivity;
import acr.browser.lightning.browser.BookmarksView; import org.purplei2p.lightning.browser.BookmarksView;
import acr.browser.lightning.browser.BrowserPresenter; import org.purplei2p.lightning.browser.BrowserPresenter;
import acr.browser.lightning.browser.BrowserView; import org.purplei2p.lightning.browser.BrowserView;
import acr.browser.lightning.IncognitoActivity; import org.purplei2p.lightning.IncognitoActivity;
import acr.browser.lightning.browser.SearchBoxModel; import org.purplei2p.lightning.browser.SearchBoxModel;
import acr.browser.lightning.browser.TabsManager; import org.purplei2p.lightning.browser.TabsManager;
import acr.browser.lightning.browser.TabsView; import org.purplei2p.lightning.browser.TabsView;
import acr.browser.lightning.BrowserApp; import org.purplei2p.lightning.BrowserApp;
import acr.browser.lightning.constant.Constants; import org.purplei2p.lightning.constant.Constants;
import acr.browser.lightning.constant.DownloadsPage; import org.purplei2p.lightning.constant.DownloadsPage;
import acr.browser.lightning.constant.HistoryPage; import org.purplei2p.lightning.constant.HistoryPage;
import acr.browser.lightning.controller.UIController; import org.purplei2p.lightning.controller.UIController;
import acr.browser.lightning.database.HistoryItem; import org.purplei2p.lightning.database.HistoryItem;
import acr.browser.lightning.database.bookmark.BookmarkModel; import org.purplei2p.lightning.database.bookmark.BookmarkModel;
import acr.browser.lightning.database.history.HistoryModel; import org.purplei2p.lightning.database.history.HistoryModel;
import acr.browser.lightning.dialog.BrowserDialog; import org.purplei2p.lightning.dialog.BrowserDialog;
import acr.browser.lightning.dialog.LightningDialogBuilder; import org.purplei2p.lightning.dialog.LightningDialogBuilder;
import acr.browser.lightning.browser.fragment.BookmarksFragment; import org.purplei2p.lightning.browser.fragment.BookmarksFragment;
import acr.browser.lightning.browser.fragment.TabsFragment; import org.purplei2p.lightning.browser.fragment.TabsFragment;
import acr.browser.lightning.interpolator.BezierDecelerateInterpolator; import org.purplei2p.lightning.interpolator.BezierDecelerateInterpolator;
import acr.browser.lightning.receiver.NetworkReceiver; import org.purplei2p.lightning.receiver.NetworkReceiver;
import acr.browser.lightning.search.SearchEngineProvider; import org.purplei2p.lightning.search.SearchEngineProvider;
import acr.browser.lightning.search.SuggestionsAdapter; import org.purplei2p.lightning.search.SuggestionsAdapter;
import acr.browser.lightning.search.engine.BaseSearchEngine; import org.purplei2p.lightning.search.engine.BaseSearchEngine;
import acr.browser.lightning.settings.activity.SettingsActivity; import org.purplei2p.lightning.settings.activity.SettingsActivity;
import acr.browser.lightning.utils.DrawableUtils; import org.purplei2p.lightning.utils.DrawableUtils;
import acr.browser.lightning.utils.IntentUtils; import org.purplei2p.lightning.utils.IntentUtils;
import acr.browser.lightning.utils.Preconditions; import org.purplei2p.lightning.utils.Preconditions;
import acr.browser.lightning.utils.ProxyUtils; import org.purplei2p.lightning.utils.ProxyUtils;
import acr.browser.lightning.utils.ThemeUtils; import org.purplei2p.lightning.utils.ThemeUtils;
import acr.browser.lightning.utils.UrlUtils; import org.purplei2p.lightning.utils.UrlUtils;
import acr.browser.lightning.utils.Utils; import org.purplei2p.lightning.utils.Utils;
import acr.browser.lightning.utils.WebUtils; import org.purplei2p.lightning.utils.WebUtils;
import acr.browser.lightning.view.Handlers; import org.purplei2p.lightning.view.Handlers;
import acr.browser.lightning.view.LightningView; import org.purplei2p.lightning.view.LightningView;
import acr.browser.lightning.view.SearchView; import org.purplei2p.lightning.view.SearchView;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;

10
app/src/main/java/acr/browser/lightning/browser/activity/ThemableBrowserActivity.java → app/src/main/java/org/purplei2p/lightning/browser/activity/ThemableBrowserActivity.java

@ -1,4 +1,4 @@
package acr.browser.lightning.browser.activity; package org.purplei2p.lightning.browser.activity;
import android.content.Intent; import android.content.Intent;
import android.content.res.Configuration; import android.content.res.Configuration;
@ -9,10 +9,10 @@ import android.support.v7.app.AppCompatActivity;
import javax.inject.Inject; import javax.inject.Inject;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.BrowserApp; import org.purplei2p.lightning.BrowserApp;
import acr.browser.lightning.preference.PreferenceManager; import org.purplei2p.lightning.preference.PreferenceManager;
import acr.browser.lightning.utils.ThemeUtils; import org.purplei2p.lightning.utils.ThemeUtils;
public abstract class ThemableBrowserActivity extends AppCompatActivity { public abstract class ThemableBrowserActivity extends AppCompatActivity {

4
app/src/main/java/acr/browser/lightning/browser/bookmark/BookmarkUiModel.java → app/src/main/java/org/purplei2p/lightning/browser/bookmark/BookmarkUiModel.java

@ -1,8 +1,8 @@
package acr.browser.lightning.browser.bookmark; package org.purplei2p.lightning.browser.bookmark;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import acr.browser.lightning.browser.BookmarksView; import org.purplei2p.lightning.browser.BookmarksView;
/** /**
* The UI model representing the current folder shown * The UI model representing the current folder shown

38
app/src/main/java/acr/browser/lightning/browser/fragment/BookmarksFragment.java → app/src/main/java/org/purplei2p/lightning/browser/fragment/BookmarksFragment.java

@ -1,4 +1,4 @@
package acr.browser.lightning.browser.fragment; package org.purplei2p.lightning.browser.fragment;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
@ -33,24 +33,24 @@ import java.util.concurrent.ConcurrentHashMap;
import javax.inject.Inject; import javax.inject.Inject;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.browser.bookmark.BookmarkUiModel; import org.purplei2p.lightning.browser.bookmark.BookmarkUiModel;
import acr.browser.lightning.reading.activity.ReadingActivity; import org.purplei2p.lightning.reading.activity.ReadingActivity;
import acr.browser.lightning.browser.TabsManager; import org.purplei2p.lightning.browser.TabsManager;
import acr.browser.lightning.animation.AnimationUtils; import org.purplei2p.lightning.animation.AnimationUtils;
import acr.browser.lightning.BrowserApp; import org.purplei2p.lightning.BrowserApp;
import acr.browser.lightning.browser.BookmarksView; import org.purplei2p.lightning.browser.BookmarksView;
import acr.browser.lightning.constant.Constants; import org.purplei2p.lightning.constant.Constants;
import acr.browser.lightning.controller.UIController; import org.purplei2p.lightning.controller.UIController;
import acr.browser.lightning.database.HistoryItem; import org.purplei2p.lightning.database.HistoryItem;
import acr.browser.lightning.database.bookmark.BookmarkModel; import org.purplei2p.lightning.database.bookmark.BookmarkModel;
import acr.browser.lightning.dialog.LightningDialogBuilder; import org.purplei2p.lightning.dialog.LightningDialogBuilder;
import acr.browser.lightning.favicon.FaviconModel; import org.purplei2p.lightning.favicon.FaviconModel;
import acr.browser.lightning.preference.PreferenceManager; import org.purplei2p.lightning.preference.PreferenceManager;
import acr.browser.lightning.utils.Preconditions; import org.purplei2p.lightning.utils.Preconditions;
import acr.browser.lightning.utils.SubscriptionUtils; import org.purplei2p.lightning.utils.SubscriptionUtils;
import acr.browser.lightning.utils.ThemeUtils; import org.purplei2p.lightning.utils.ThemeUtils;
import acr.browser.lightning.view.LightningView; import org.purplei2p.lightning.view.LightningView;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.Unbinder; import butterknife.Unbinder;

28
app/src/main/java/acr/browser/lightning/browser/fragment/TabsFragment.java → app/src/main/java/org/purplei2p/lightning/browser/fragment/TabsFragment.java

@ -1,4 +1,4 @@
package acr.browser.lightning.browser.fragment; package org.purplei2p.lightning.browser.fragment;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
@ -33,19 +33,19 @@ import android.widget.TextView;
import javax.inject.Inject; import javax.inject.Inject;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.browser.TabsManager; import org.purplei2p.lightning.browser.TabsManager;
import acr.browser.lightning.BrowserApp; import org.purplei2p.lightning.BrowserApp;
import acr.browser.lightning.browser.TabsView; import org.purplei2p.lightning.browser.TabsView;
import acr.browser.lightning.controller.UIController; import org.purplei2p.lightning.controller.UIController;
import acr.browser.lightning.browser.fragment.anim.HorizontalItemAnimator; import org.purplei2p.lightning.browser.fragment.anim.HorizontalItemAnimator;
import acr.browser.lightning.browser.fragment.anim.VerticalItemAnimator; import org.purplei2p.lightning.browser.fragment.anim.VerticalItemAnimator;
import acr.browser.lightning.preference.PreferenceManager; import org.purplei2p.lightning.preference.PreferenceManager;
import acr.browser.lightning.utils.DrawableUtils; import org.purplei2p.lightning.utils.DrawableUtils;
import acr.browser.lightning.utils.ThemeUtils; import org.purplei2p.lightning.utils.ThemeUtils;
import acr.browser.lightning.utils.Utils; import org.purplei2p.lightning.utils.Utils;
import acr.browser.lightning.view.BackgroundDrawable; import org.purplei2p.lightning.view.BackgroundDrawable;
import acr.browser.lightning.view.LightningView; import org.purplei2p.lightning.view.LightningView;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.Unbinder; import butterknife.Unbinder;

4
app/src/main/java/acr/browser/lightning/browser/fragment/anim/HorizontalItemAnimator.java → app/src/main/java/org/purplei2p/lightning/browser/fragment/anim/HorizontalItemAnimator.java

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package acr.browser.lightning.browser.fragment.anim; package org.purplei2p.lightning.browser.fragment.anim;
import android.animation.TimeInterpolator; import android.animation.TimeInterpolator;
import android.animation.ValueAnimator; import android.animation.ValueAnimator;
@ -29,7 +29,7 @@ import android.view.animation.AccelerateInterpolator;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import acr.browser.lightning.interpolator.BezierDecelerateInterpolator; import org.purplei2p.lightning.interpolator.BezierDecelerateInterpolator;
/** /**
* This implementation of {@link RecyclerView.ItemAnimator} provides basic * This implementation of {@link RecyclerView.ItemAnimator} provides basic

4
app/src/main/java/acr/browser/lightning/browser/fragment/anim/VerticalItemAnimator.java → app/src/main/java/org/purplei2p/lightning/browser/fragment/anim/VerticalItemAnimator.java

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package acr.browser.lightning.browser.fragment.anim; package org.purplei2p.lightning.browser.fragment.anim;
import android.animation.TimeInterpolator; import android.animation.TimeInterpolator;
import android.animation.ValueAnimator; import android.animation.ValueAnimator;
@ -29,7 +29,7 @@ import android.view.animation.AccelerateInterpolator;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import acr.browser.lightning.interpolator.BezierDecelerateInterpolator; import org.purplei2p.lightning.interpolator.BezierDecelerateInterpolator;
/** /**
* This implementation of {@link RecyclerView.ItemAnimator} provides basic * This implementation of {@link RecyclerView.ItemAnimator} provides basic

20
app/src/main/java/acr/browser/lightning/constant/BookmarkPage.java → app/src/main/java/org/purplei2p/lightning/constant/BookmarkPage.java

@ -1,7 +1,7 @@
/* /*
* Copyright 2014 A.C.R. Development * Copyright 2014 A.C.R. Development
*/ */
package acr.browser.lightning.constant; package org.purplei2p.lightning.constant;
import android.app.Activity; import android.app.Activity;
import android.app.Application; import android.app.Application;
@ -25,15 +25,15 @@ import java.util.List;
import javax.inject.Inject; import javax.inject.Inject;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.BrowserApp; import org.purplei2p.lightning.BrowserApp;
import acr.browser.lightning.database.HistoryItem; import org.purplei2p.lightning.database.HistoryItem;
import acr.browser.lightning.database.bookmark.BookmarkModel; import org.purplei2p.lightning.database.bookmark.BookmarkModel;
import acr.browser.lightning.favicon.FaviconModel; import org.purplei2p.lightning.favicon.FaviconModel;
import acr.browser.lightning.favicon.FaviconUtils; import org.purplei2p.lightning.favicon.FaviconUtils;
import acr.browser.lightning.utils.Preconditions; import org.purplei2p.lightning.utils.Preconditions;
import acr.browser.lightning.utils.ThemeUtils; import org.purplei2p.lightning.utils.ThemeUtils;
import acr.browser.lightning.utils.Utils; import org.purplei2p.lightning.utils.Utils;
public final class BookmarkPage { public final class BookmarkPage {

11
app/src/main/java/acr/browser/lightning/constant/Constants.java → app/src/main/java/org/purplei2p/lightning/constant/Constants.java

@ -1,7 +1,7 @@
/* /*
* Copyright 2014 A.C.R. Development * Copyright 2014 A.C.R. Development
*/ */
package acr.browser.lightning.constant; package org.purplei2p.lightning.constant;
import android.support.annotation.IntDef; import android.support.annotation.IntDef;
@ -18,16 +18,9 @@ public final class Constants {
public static final String MOBILE_USER_AGENT = "Mozilla/5.0 (Linux; U; Android 4.4; en-us; Nexus 4 Build/JOP24G) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30"; public static final String MOBILE_USER_AGENT = "Mozilla/5.0 (Linux; U; Android 4.4; en-us; Nexus 4 Build/JOP24G) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30";
// Search query URLs // Search query URLs
public static final String YAHOO_SEARCH = "https://search.yahoo.com/search?p="; public static final String LEGWORK_SEARCH = "http://legwork.i2p/yacysearch.html?query=";
public static final String GOOGLE_SEARCH = "https://www.google.com/search?client=lightning&ie=UTF-8&oe=UTF-8&q=";
public static final String BING_SEARCH = "https://www.bing.com/search?q=";
public static final String DUCK_SEARCH = "https://duckduckgo.com/?t=lightning&q="; public static final String DUCK_SEARCH = "https://duckduckgo.com/?t=lightning&q=";
public static final String DUCK_LITE_SEARCH = "https://duckduckgo.com/lite/?t=lightning&q="; public static final String DUCK_LITE_SEARCH = "https://duckduckgo.com/lite/?t=lightning&q=";
public static final String STARTPAGE_MOBILE_SEARCH = "https://startpage.com/do/m/mobilesearch?language=english&query=";
public static final String STARTPAGE_SEARCH = "https://startpage.com/do/search?language=english&query=";
public static final String ASK_SEARCH = "http://www.ask.com/web?qsrc=0&o=0&l=dir&qo=LightningBrowser&q=";
public static final String BAIDU_SEARCH = "https://www.baidu.com/s?wd=";
public static final String YANDEX_SEARCH = "https://yandex.ru/yandsearch?lr=21411&text=";
// Custom local page schemes // Custom local page schemes
public static final String SCHEME_HOMEPAGE = Constants.ABOUT + "home"; public static final String SCHEME_HOMEPAGE = Constants.ABOUT + "home";

16
app/src/main/java/acr/browser/lightning/constant/DownloadsPage.java → app/src/main/java/org/purplei2p/lightning/constant/DownloadsPage.java

@ -1,7 +1,7 @@
/* /*
* Copyright 2014 A.C.R. Development * Copyright 2014 A.C.R. Development
*/ */
package acr.browser.lightning.constant; package org.purplei2p.lightning.constant;
import android.app.Application; import android.app.Application;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
@ -20,13 +20,13 @@ import java.util.List;
import javax.inject.Inject; import javax.inject.Inject;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.BrowserApp; import org.purplei2p.lightning.BrowserApp;
import acr.browser.lightning.database.downloads.DownloadItem; import org.purplei2p.lightning.database.downloads.DownloadItem;
import acr.browser.lightning.database.downloads.DownloadsModel; import org.purplei2p.lightning.database.downloads.DownloadsModel;
import acr.browser.lightning.preference.PreferenceManager; import org.purplei2p.lightning.preference.PreferenceManager;
import acr.browser.lightning.utils.Preconditions; import org.purplei2p.lightning.utils.Preconditions;
import acr.browser.lightning.utils.Utils; import org.purplei2p.lightning.utils.Utils;
public final class DownloadsPage { public final class DownloadsPage {

14
app/src/main/java/acr/browser/lightning/constant/HistoryPage.java → app/src/main/java/org/purplei2p/lightning/constant/HistoryPage.java

@ -1,7 +1,7 @@
/* /*
* Copyright 2014 A.C.R. Development * Copyright 2014 A.C.R. Development
*/ */
package acr.browser.lightning.constant; package org.purplei2p.lightning.constant;
import android.app.Application; import android.app.Application;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
@ -24,12 +24,12 @@ import java.util.List;
import javax.inject.Inject; import javax.inject.Inject;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.BrowserApp; import org.purplei2p.lightning.BrowserApp;
import acr.browser.lightning.database.HistoryItem; import org.purplei2p.lightning.database.HistoryItem;
import acr.browser.lightning.database.history.HistoryModel; import org.purplei2p.lightning.database.history.HistoryModel;
import acr.browser.lightning.utils.Preconditions; import org.purplei2p.lightning.utils.Preconditions;
import acr.browser.lightning.utils.Utils; import org.purplei2p.lightning.utils.Utils;
public class HistoryPage { public class HistoryPage {

12
app/src/main/java/acr/browser/lightning/constant/StartPage.java → app/src/main/java/org/purplei2p/lightning/constant/StartPage.java

@ -1,7 +1,7 @@
/* /*
* Copyright 2014 A.C.R. Development * Copyright 2014 A.C.R. Development
*/ */
package acr.browser.lightning.constant; package org.purplei2p.lightning.constant;
import android.app.Application; import android.app.Application;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
@ -16,11 +16,11 @@ import java.io.IOException;
import javax.inject.Inject; import javax.inject.Inject;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.BrowserApp; import org.purplei2p.lightning.BrowserApp;
import acr.browser.lightning.search.SearchEngineProvider; import org.purplei2p.lightning.search.SearchEngineProvider;
import acr.browser.lightning.search.engine.BaseSearchEngine; import org.purplei2p.lightning.search.engine.BaseSearchEngine;
import acr.browser.lightning.utils.Utils; import org.purplei2p.lightning.utils.Utils;
public class StartPage { public class StartPage {

10
app/src/main/java/acr/browser/lightning/controller/UIController.java → app/src/main/java/org/purplei2p/lightning/controller/UIController.java

@ -1,7 +1,7 @@
/* /*
* Copyright 2014 A.C.R. Development * Copyright 2014 A.C.R. Development
*/ */
package acr.browser.lightning.controller; package org.purplei2p.lightning.controller;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
@ -14,10 +14,10 @@ import android.view.View;
import android.webkit.ValueCallback; import android.webkit.ValueCallback;
import android.webkit.WebChromeClient.CustomViewCallback; import android.webkit.WebChromeClient.CustomViewCallback;
import acr.browser.lightning.browser.TabsManager; import org.purplei2p.lightning.browser.TabsManager;
import acr.browser.lightning.database.HistoryItem; import org.purplei2p.lightning.database.HistoryItem;
import acr.browser.lightning.dialog.LightningDialogBuilder; import org.purplei2p.lightning.dialog.LightningDialogBuilder;
import acr.browser.lightning.view.LightningView; import org.purplei2p.lightning.view.LightningView;
public interface UIController { public interface UIController {

4
app/src/main/java/acr/browser/lightning/database/HistoryItem.java → app/src/main/java/org/purplei2p/lightning/database/HistoryItem.java

@ -1,13 +1,13 @@
/* /*
* Copyright 2014 A.C.R. Development * Copyright 2014 A.C.R. Development
*/ */
package acr.browser.lightning.database; package org.purplei2p.lightning.database;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import acr.browser.lightning.utils.Preconditions; import org.purplei2p.lightning.utils.Preconditions;
public class HistoryItem implements Comparable<HistoryItem> { public class HistoryItem implements Comparable<HistoryItem> {

8
app/src/main/java/acr/browser/lightning/database/bookmark/BookmarkDatabase.java → app/src/main/java/org/purplei2p/lightning/database/bookmark/BookmarkDatabase.java

@ -1,4 +1,4 @@
package acr.browser.lightning.database.bookmark; package org.purplei2p.lightning.database.bookmark;
import android.app.Application; import android.app.Application;
import android.content.ContentValues; import android.content.ContentValues;
@ -25,9 +25,9 @@ import java.util.List;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.constant.Constants; import org.purplei2p.lightning.constant.Constants;
import acr.browser.lightning.database.HistoryItem; import org.purplei2p.lightning.database.HistoryItem;
/** /**
* The disk backed bookmark database. * The disk backed bookmark database.

10
app/src/main/java/acr/browser/lightning/database/bookmark/BookmarkExporter.java → app/src/main/java/org/purplei2p/lightning/database/bookmark/BookmarkExporter.java

@ -1,4 +1,4 @@
package acr.browser.lightning.database.bookmark; package org.purplei2p.lightning.database.bookmark;
import android.content.Context; import android.content.Context;
import android.os.Environment; import android.os.Environment;
@ -27,10 +27,10 @@ import java.io.InputStreamReader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.database.HistoryItem; import org.purplei2p.lightning.database.HistoryItem;
import acr.browser.lightning.utils.Preconditions; import org.purplei2p.lightning.utils.Preconditions;
import acr.browser.lightning.utils.Utils; import org.purplei2p.lightning.utils.Utils;
/** /**
* The class responsible for importing and exporting * The class responsible for importing and exporting

6
app/src/main/java/acr/browser/lightning/database/bookmark/BookmarkLocalSync.java → app/src/main/java/org/purplei2p/lightning/database/bookmark/BookmarkLocalSync.java

@ -1,4 +1,4 @@
package acr.browser.lightning.database.bookmark; package org.purplei2p.lightning.database.bookmark;
import android.content.Context; import android.content.Context;
import android.database.Cursor; import android.database.Cursor;
@ -15,8 +15,8 @@ import com.anthonycr.bonsai.SingleSubscriber;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import acr.browser.lightning.database.HistoryItem; import org.purplei2p.lightning.database.HistoryItem;
import acr.browser.lightning.utils.Utils; import org.purplei2p.lightning.utils.Utils;
public class BookmarkLocalSync { public class BookmarkLocalSync {

4
app/src/main/java/acr/browser/lightning/database/bookmark/BookmarkModel.java → app/src/main/java/org/purplei2p/lightning/database/bookmark/BookmarkModel.java

@ -1,4 +1,4 @@
package acr.browser.lightning.database.bookmark; package org.purplei2p.lightning.database.bookmark;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
@ -9,7 +9,7 @@ import com.anthonycr.bonsai.Single;
import java.util.List; import java.util.List;
import acr.browser.lightning.database.HistoryItem; import org.purplei2p.lightning.database.HistoryItem;
/** /**
* The interface that should be used to * The interface that should be used to

8
app/src/main/java/acr/browser/lightning/database/bookmark/legacy/LegacyBookmarkManager.java → app/src/main/java/org/purplei2p/lightning/database/bookmark/legacy/LegacyBookmarkManager.java

@ -1,4 +1,4 @@
package acr.browser.lightning.database.bookmark.legacy; package org.purplei2p.lightning.database.bookmark.legacy;
import android.app.Application; import android.app.Application;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
@ -20,9 +20,9 @@ import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.database.HistoryItem; import org.purplei2p.lightning.database.HistoryItem;
import acr.browser.lightning.utils.Utils; import org.purplei2p.lightning.utils.Utils;
@Deprecated @Deprecated
public class LegacyBookmarkManager { public class LegacyBookmarkManager {

4
app/src/main/java/acr/browser/lightning/database/downloads/DownloadItem.java → app/src/main/java/org/purplei2p/lightning/database/downloads/DownloadItem.java

@ -1,12 +1,12 @@
/* /*
* Copyright 2014 A.C.R. Development * Copyright 2014 A.C.R. Development
*/ */
package acr.browser.lightning.database.downloads; package org.purplei2p.lightning.database.downloads;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import acr.browser.lightning.utils.Preconditions; import org.purplei2p.lightning.utils.Preconditions;
public class DownloadItem implements Comparable<DownloadItem> { public class DownloadItem implements Comparable<DownloadItem> {

4
app/src/main/java/acr/browser/lightning/database/downloads/DownloadsDatabase.java → app/src/main/java/org/purplei2p/lightning/database/downloads/DownloadsDatabase.java

@ -1,4 +1,4 @@
package acr.browser.lightning.database.downloads; package org.purplei2p.lightning.database.downloads;
import android.app.Application; import android.app.Application;
import android.content.ContentValues; import android.content.ContentValues;
@ -23,7 +23,7 @@ import java.util.List;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
/** /**
* The disk backed download database. * The disk backed download database.

2
app/src/main/java/acr/browser/lightning/database/downloads/DownloadsModel.java → app/src/main/java/org/purplei2p/lightning/database/downloads/DownloadsModel.java

@ -1,4 +1,4 @@
package acr.browser.lightning.database.downloads; package org.purplei2p.lightning.database.downloads;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.WorkerThread; import android.support.annotation.WorkerThread;

6
app/src/main/java/acr/browser/lightning/database/history/HistoryDatabase.java → app/src/main/java/org/purplei2p/lightning/database/history/HistoryDatabase.java

@ -1,7 +1,7 @@
/* /*
* Copyright 2014 A.C.R. Development * Copyright 2014 A.C.R. Development
*/ */
package acr.browser.lightning.database.history; package org.purplei2p.lightning.database.history;
import android.app.Application; import android.app.Application;
import android.content.ContentValues; import android.content.ContentValues;
@ -26,8 +26,8 @@ import java.util.List;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.database.HistoryItem; import org.purplei2p.lightning.database.HistoryItem;
/** /**

4
app/src/main/java/acr/browser/lightning/database/history/HistoryModel.java → app/src/main/java/org/purplei2p/lightning/database/history/HistoryModel.java

@ -1,4 +1,4 @@
package acr.browser.lightning.database.history; package org.purplei2p.lightning.database.history;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
@ -8,7 +8,7 @@ import com.anthonycr.bonsai.Single;
import java.util.List; import java.util.List;
import acr.browser.lightning.database.HistoryItem; import org.purplei2p.lightning.database.HistoryItem;
/** /**
* An interface that should be used to communicate * An interface that should be used to communicate

95
app/src/main/java/org/purplei2p/lightning/di/AppComponent.java

@ -0,0 +1,95 @@
package org.purplei2p.lightning.di;
import javax.inject.Singleton;
import org.purplei2p.lightning.browser.activity.BrowserActivity;
import org.purplei2p.lightning.reading.activity.ReadingActivity;
import org.purplei2p.lightning.browser.TabsManager;
import org.purplei2p.lightning.browser.activity.ThemableBrowserActivity;
import org.purplei2p.lightning.settings.activity.ThemableSettingsActivity;
import org.purplei2p.lightning.BrowserApp;
import org.purplei2p.lightning.browser.BrowserPresenter;
import org.purplei2p.lightning.browser.SearchBoxModel;
import org.purplei2p.lightning.constant.BookmarkPage;
import org.purplei2p.lightning.constant.DownloadsPage;
import org.purplei2p.lightning.constant.HistoryPage;
import org.purplei2p.lightning.constant.StartPage;
import org.purplei2p.lightning.dialog.LightningDialogBuilder;
import org.purplei2p.lightning.download.DownloadHandler;
import org.purplei2p.lightning.download.LightningDownloadListener;
import org.purplei2p.lightning.settings.fragment.BookmarkSettingsFragment;
import org.purplei2p.lightning.browser.fragment.BookmarksFragment;
import org.purplei2p.lightning.settings.fragment.DebugSettingsFragment;
import org.purplei2p.lightning.settings.fragment.GeneralSettingsFragment;
import org.purplei2p.lightning.settings.fragment.LightningPreferenceFragment;
import org.purplei2p.lightning.settings.fragment.PrivacySettingsFragment;
import org.purplei2p.lightning.browser.fragment.TabsFragment;
import org.purplei2p.lightning.search.SearchEngineProvider;
import org.purplei2p.lightning.search.SuggestionsAdapter;
import org.purplei2p.lightning.utils.ProxyUtils;
import org.purplei2p.lightning.view.LightningChromeClient;
import org.purplei2p.lightning.view.LightningView;
import org.purplei2p.lightning.view.LightningWebClient;
import dagger.Component;
@Singleton
@Component(modules = {AppModule.class})
public interface AppComponent {
void inject(BrowserActivity activity);
void inject(BookmarksFragment fragment);
void inject(BookmarkSettingsFragment fragment);
void inject(LightningDialogBuilder builder);
void inject(TabsFragment fragment);
void inject(LightningView lightningView);
void inject(ThemableBrowserActivity activity);
void inject(LightningPreferenceFragment fragment);
void inject(BrowserApp app);
void inject(ProxyUtils proxyUtils);
void inject(ReadingActivity activity);
void inject(LightningWebClient webClient);
void inject(ThemableSettingsActivity activity);
void inject(LightningDownloadListener listener);
void inject(PrivacySettingsFragment fragment);
void inject(StartPage startPage);
void inject(HistoryPage historyPage);
void inject(BookmarkPage bookmarkPage);
void inject(DownloadsPage downloadsPage);
void inject(BrowserPresenter presenter);
void inject(TabsManager manager);
void inject(DebugSettingsFragment fragment);
void inject(SuggestionsAdapter suggestionsAdapter);
void inject(LightningChromeClient chromeClient);
void inject(DownloadHandler downloadHandler);
void inject(SearchBoxModel searchBoxModel);
void inject(SearchEngineProvider searchEngineProvider);
void inject(GeneralSettingsFragment generalSettingsFragment);
}

27
app/src/main/java/acr/browser/lightning/di/AppModule.java → app/src/main/java/org/purplei2p/lightning/di/AppModule.java

@ -1,21 +1,19 @@
package acr.browser.lightning.di; package org.purplei2p.lightning.di;
import android.app.Application; import android.app.Application;
import android.content.Context; import android.content.Context;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import net.i2p.android.ui.I2PAndroidHelper;
import javax.inject.Singleton; import javax.inject.Singleton;
import acr.browser.lightning.BrowserApp; import org.purplei2p.lightning.BrowserApp;
import acr.browser.lightning.database.bookmark.BookmarkDatabase; import org.purplei2p.lightning.database.bookmark.BookmarkDatabase;
import acr.browser.lightning.database.bookmark.BookmarkModel; import org.purplei2p.lightning.database.bookmark.BookmarkModel;
import acr.browser.lightning.database.downloads.DownloadsDatabase; import org.purplei2p.lightning.database.downloads.DownloadsDatabase;
import acr.browser.lightning.database.downloads.DownloadsModel; import org.purplei2p.lightning.database.downloads.DownloadsModel;
import acr.browser.lightning.database.history.HistoryDatabase; import org.purplei2p.lightning.database.history.HistoryDatabase;
import acr.browser.lightning.database.history.HistoryModel; import org.purplei2p.lightning.database.history.HistoryModel;
import acr.browser.lightning.download.DownloadHandler; import org.purplei2p.lightning.download.DownloadHandler;
import dagger.Module; import dagger.Module;
import dagger.Provides; import dagger.Provides;
@ -65,11 +63,4 @@ public class AppModule {
return new DownloadHandler(); return new DownloadHandler();
} }
@NonNull
@Provides
@Singleton
public I2PAndroidHelper provideI2PAndroidHelper() {
return new I2PAndroidHelper(mApp.getApplicationContext());
}
} }

8
app/src/main/java/acr/browser/lightning/dialog/BrowserDialog.java → app/src/main/java/org/purplei2p/lightning/dialog/BrowserDialog.java

@ -1,4 +1,4 @@
package acr.browser.lightning.dialog; package org.purplei2p.lightning.dialog;
import android.app.Activity; import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
@ -22,9 +22,9 @@ import android.widget.TextView;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.utils.DeviceUtils; import org.purplei2p.lightning.utils.DeviceUtils;
import acr.browser.lightning.utils.ResourceUtils; import org.purplei2p.lightning.utils.ResourceUtils;
/** /**
* Copyright 7/31/2016 Anthony Restaino * Copyright 7/31/2016 Anthony Restaino

32
app/src/main/java/acr/browser/lightning/dialog/LightningDialogBuilder.java → app/src/main/java/org/purplei2p/lightning/dialog/LightningDialogBuilder.java

@ -1,4 +1,4 @@
package acr.browser.lightning.dialog; package org.purplei2p.lightning.dialog;
import android.app.Activity; import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
@ -21,21 +21,21 @@ import java.util.List;
import javax.inject.Inject; import javax.inject.Inject;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.MainActivity; import org.purplei2p.lightning.MainActivity;
import acr.browser.lightning.BrowserApp; import org.purplei2p.lightning.BrowserApp;
import acr.browser.lightning.constant.BookmarkPage; import org.purplei2p.lightning.constant.BookmarkPage;
import acr.browser.lightning.constant.Constants; import org.purplei2p.lightning.constant.Constants;
import acr.browser.lightning.controller.UIController; import org.purplei2p.lightning.controller.UIController;
import acr.browser.lightning.database.HistoryItem; import org.purplei2p.lightning.database.HistoryItem;
import acr.browser.lightning.database.bookmark.BookmarkModel; import org.purplei2p.lightning.database.bookmark.BookmarkModel;
import acr.browser.lightning.database.downloads.DownloadsModel; import org.purplei2p.lightning.database.downloads.DownloadsModel;
import acr.browser.lightning.database.history.HistoryModel; import org.purplei2p.lightning.database.history.HistoryModel;
import acr.browser.lightning.download.DownloadHandler; import org.purplei2p.lightning.download.DownloadHandler;
import acr.browser.lightning.preference.PreferenceManager; import org.purplei2p.lightning.preference.PreferenceManager;
import acr.browser.lightning.utils.IntentUtils; import org.purplei2p.lightning.utils.IntentUtils;
import acr.browser.lightning.utils.Preconditions; import org.purplei2p.lightning.utils.Preconditions;
import acr.browser.lightning.utils.UrlUtils; import org.purplei2p.lightning.utils.UrlUtils;
/** /**
* TODO Rename this class it doesn't build dialogs only for bookmarks * TODO Rename this class it doesn't build dialogs only for bookmarks

28
app/src/main/java/acr/browser/lightning/download/DownloadHandler.java → app/src/main/java/org/purplei2p/lightning/download/DownloadHandler.java

@ -1,7 +1,7 @@
/* /*
* Copyright 2014 A.C.R. Development * Copyright 2014 A.C.R. Development
*/ */
package acr.browser.lightning.download; package org.purplei2p.lightning.download;
import android.app.Activity; import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
@ -30,19 +30,19 @@ import java.io.IOException;
import javax.inject.Inject; import javax.inject.Inject;
import acr.browser.lightning.BuildConfig; import org.purplei2p.lightning.BuildConfig;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.MainActivity; import org.purplei2p.lightning.MainActivity;
import acr.browser.lightning.BrowserApp; import org.purplei2p.lightning.BrowserApp;
import acr.browser.lightning.constant.Constants; import org.purplei2p.lightning.constant.Constants;
import acr.browser.lightning.controller.UIController; import org.purplei2p.lightning.controller.UIController;
import acr.browser.lightning.database.downloads.DownloadItem; import org.purplei2p.lightning.database.downloads.DownloadItem;
import acr.browser.lightning.database.downloads.DownloadsModel; import org.purplei2p.lightning.database.downloads.DownloadsModel;
import acr.browser.lightning.dialog.BrowserDialog; import org.purplei2p.lightning.dialog.BrowserDialog;
import acr.browser.lightning.preference.PreferenceManager; import org.purplei2p.lightning.preference.PreferenceManager;
import acr.browser.lightning.utils.FileUtils; import org.purplei2p.lightning.utils.FileUtils;
import acr.browser.lightning.utils.Utils; import org.purplei2p.lightning.utils.Utils;
import acr.browser.lightning.view.LightningView; import org.purplei2p.lightning.view.LightningView;
/** /**
* Handle download requests * Handle download requests

6
app/src/main/java/acr/browser/lightning/download/FetchUrlMimeType.java → app/src/main/java/org/purplei2p/lightning/download/FetchUrlMimeType.java

@ -1,7 +1,7 @@
/* /*
* Copyright 2014 A.C.R. Development * Copyright 2014 A.C.R. Development
*/ */
package acr.browser.lightning.download; package org.purplei2p.lightning.download;
import android.app.Activity; import android.app.Activity;
import android.app.DownloadManager; import android.app.DownloadManager;
@ -18,8 +18,8 @@ import java.io.IOException;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.utils.Utils; import org.purplei2p.lightning.utils.Utils;
/** /**
* This class is used to pull down the http headers of a given URL so that we * This class is used to pull down the http headers of a given URL so that we

12
app/src/main/java/acr/browser/lightning/download/LightningDownloadListener.java → app/src/main/java/org/purplei2p/lightning/download/LightningDownloadListener.java

@ -1,7 +1,7 @@
/* /*
* Copyright 2014 A.C.R. Development * Copyright 2014 A.C.R. Development
*/ */
package acr.browser.lightning.download; package org.purplei2p.lightning.download;
import android.Manifest; import android.Manifest;
import android.app.Activity; import android.app.Activity;
@ -13,11 +13,11 @@ import android.util.Log;
import android.webkit.DownloadListener; import android.webkit.DownloadListener;
import android.webkit.URLUtil; import android.webkit.URLUtil;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.BrowserApp; import org.purplei2p.lightning.BrowserApp;
import acr.browser.lightning.database.downloads.DownloadsModel; import org.purplei2p.lightning.database.downloads.DownloadsModel;
import acr.browser.lightning.dialog.BrowserDialog; import org.purplei2p.lightning.dialog.BrowserDialog;
import acr.browser.lightning.preference.PreferenceManager; import org.purplei2p.lightning.preference.PreferenceManager;
import com.anthonycr.grant.PermissionsManager; import com.anthonycr.grant.PermissionsManager;
import com.anthonycr.grant.PermissionsResultAction; import com.anthonycr.grant.PermissionsResultAction;

2
app/src/main/java/acr/browser/lightning/download/WebAddress.java → app/src/main/java/org/purplei2p/lightning/download/WebAddress.java

@ -1,7 +1,7 @@
/* /*
* Copyright 2014 A.C.R. Development * Copyright 2014 A.C.R. Development
*/ */
package acr.browser.lightning.download; package org.purplei2p.lightning.download;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;

12
app/src/main/java/acr/browser/lightning/favicon/FaviconModel.java → app/src/main/java/org/purplei2p/lightning/favicon/FaviconModel.java

@ -1,4 +1,4 @@
package acr.browser.lightning.favicon; package org.purplei2p.lightning.favicon;
import android.app.Application; import android.app.Application;
import android.graphics.Bitmap; import android.graphics.Bitmap;
@ -26,11 +26,11 @@ import java.io.IOException;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.utils.DrawableUtils; import org.purplei2p.lightning.utils.DrawableUtils;
import acr.browser.lightning.utils.FileUtils; import org.purplei2p.lightning.utils.FileUtils;
import acr.browser.lightning.utils.Preconditions; import org.purplei2p.lightning.utils.Preconditions;
import acr.browser.lightning.utils.Utils; import org.purplei2p.lightning.utils.Utils;
/** /**
* Reactive model that can fetch favicons * Reactive model that can fetch favicons

2
app/src/main/java/acr/browser/lightning/favicon/FaviconUtils.java → app/src/main/java/org/purplei2p/lightning/favicon/FaviconUtils.java

@ -1,4 +1,4 @@
package acr.browser.lightning.favicon; package org.purplei2p.lightning.favicon;
import android.net.Uri; import android.net.Uri;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;

2
app/src/main/java/acr/browser/lightning/interpolator/BezierDecelerateInterpolator.java → app/src/main/java/org/purplei2p/lightning/interpolator/BezierDecelerateInterpolator.java

@ -1,4 +1,4 @@
package acr.browser.lightning.interpolator; package org.purplei2p.lightning.interpolator;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v4.view.animation.PathInterpolatorCompat; import android.support.v4.view.animation.PathInterpolatorCompat;

19
app/src/main/java/acr/browser/lightning/preference/PreferenceManager.java → app/src/main/java/org/purplei2p/lightning/preference/PreferenceManager.java

@ -1,4 +1,4 @@
package acr.browser.lightning.preference; package org.purplei2p.lightning.preference;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
@ -8,8 +8,8 @@ import android.support.annotation.Nullable;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import acr.browser.lightning.constant.Constants; import org.purplei2p.lightning.constant.Constants;
import acr.browser.lightning.utils.FileUtils; import org.purplei2p.lightning.utils.FileUtils;
@Singleton @Singleton
public class PreferenceManager { public class PreferenceManager {
@ -68,9 +68,8 @@ public class PreferenceManager {
} }
public enum Suggestion { public enum Suggestion {
SUGGESTION_GOOGLE, SUGGESTION_LEGWORK,
SUGGESTION_DUCK, SUGGESTION_DUCK,
SUGGESTION_BAIDU,
SUGGESTION_NONE SUGGESTION_NONE
} }
@ -86,7 +85,7 @@ public class PreferenceManager {
@NonNull @NonNull
public Suggestion getSearchSuggestionChoice() { public Suggestion getSearchSuggestionChoice() {
try { try {
return Suggestion.valueOf(mPrefs.getString(Name.SEARCH_SUGGESTIONS, Suggestion.SUGGESTION_GOOGLE.name())); return Suggestion.valueOf(mPrefs.getString(Name.SEARCH_SUGGESTIONS, Suggestion.SUGGESTION_LEGWORK.name()));
} catch (IllegalArgumentException ignored) { } catch (IllegalArgumentException ignored) {
return Suggestion.SUGGESTION_NONE; return Suggestion.SUGGESTION_NONE;
} }
@ -200,7 +199,7 @@ public class PreferenceManager {
} }
public int getProxyPort() { public int getProxyPort() {
return mPrefs.getInt(Name.USE_PROXY_PORT, 8118); return mPrefs.getInt(Name.USE_PROXY_PORT, 4444);
} }
public int getReadingTextSize() { public int getReadingTextSize() {
@ -230,7 +229,7 @@ public class PreferenceManager {
@NonNull @NonNull
public String getSearchUrl() { public String getSearchUrl() {
return mPrefs.getString(Name.SEARCH_URL, Constants.GOOGLE_SEARCH); return mPrefs.getString(Name.SEARCH_URL, Constants.LEGWORK_SEARCH);
} }
public boolean getTextReflowEnabled() { public boolean getTextReflowEnabled() {
@ -250,12 +249,12 @@ public class PreferenceManager {
} }
public boolean getUseProxy() { public boolean getUseProxy() {
return mPrefs.getBoolean(Name.USE_PROXY, false); return mPrefs.getBoolean(Name.USE_PROXY, true);
} }
@Constants.Proxy @Constants.Proxy
public int getProxyChoice() { public int getProxyChoice() {
@Constants.Proxy int proxy = mPrefs.getInt(Name.PROXY_CHOICE, Constants.NO_PROXY); @Constants.Proxy int proxy = mPrefs.getInt(Name.PROXY_CHOICE, Constants.PROXY_I2P);
switch (proxy) { switch (proxy) {
case Constants.NO_PROXY: case Constants.NO_PROXY:
case Constants.PROXY_ORBOT: case Constants.PROXY_ORBOT:

2
app/src/main/java/acr/browser/lightning/reading/ArticleTextExtractor.java → app/src/main/java/org/purplei2p/lightning/reading/ArticleTextExtractor.java

@ -1,4 +1,4 @@
package acr.browser.lightning.reading; package org.purplei2p.lightning.reading;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

2
app/src/main/java/acr/browser/lightning/reading/Converter.java → app/src/main/java/org/purplei2p/lightning/reading/Converter.java

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package acr.browser.lightning.reading; package org.purplei2p.lightning.reading;
import android.util.Log; import android.util.Log;

4
app/src/main/java/acr/browser/lightning/reading/HtmlFetcher.java → app/src/main/java/org/purplei2p/lightning/reading/HtmlFetcher.java

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package acr.browser.lightning.reading; package org.purplei2p.lightning.reading;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;
@ -33,7 +33,7 @@ import java.util.zip.GZIPInputStream;
import java.util.zip.Inflater; import java.util.zip.Inflater;
import java.util.zip.InflaterInputStream; import java.util.zip.InflaterInputStream;
import acr.browser.lightning.utils.Utils; import org.purplei2p.lightning.utils.Utils;
/** /**
* Class to fetch articles. This class is thread safe. * Class to fetch articles. This class is thread safe.

2
app/src/main/java/acr/browser/lightning/reading/ImageResult.java → app/src/main/java/org/purplei2p/lightning/reading/ImageResult.java

@ -1,4 +1,4 @@
package acr.browser.lightning.reading; package org.purplei2p.lightning.reading;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;

2
app/src/main/java/acr/browser/lightning/reading/JResult.java → app/src/main/java/org/purplei2p/lightning/reading/JResult.java

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package acr.browser.lightning.reading; package org.purplei2p.lightning.reading;
import java.io.Serializable; import java.io.Serializable;
import java.util.Collection; import java.util.Collection;

2
app/src/main/java/acr/browser/lightning/reading/OutputFormatter.java → app/src/main/java/org/purplei2p/lightning/reading/OutputFormatter.java

@ -1,4 +1,4 @@
package acr.browser.lightning.reading; package org.purplei2p.lightning.reading;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;

2
app/src/main/java/acr/browser/lightning/reading/SCache.java → app/src/main/java/org/purplei2p/lightning/reading/SCache.java

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package acr.browser.lightning.reading; package org.purplei2p.lightning.reading;
/** /**
* *

2
app/src/main/java/acr/browser/lightning/reading/SHelper.java → app/src/main/java/org/purplei2p/lightning/reading/SHelper.java

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package acr.browser.lightning.reading; package org.purplei2p.lightning.reading;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;

20
app/src/main/java/acr/browser/lightning/reading/activity/ReadingActivity.java → app/src/main/java/org/purplei2p/lightning/reading/activity/ReadingActivity.java

@ -1,4 +1,4 @@
package acr.browser.lightning.reading.activity; package org.purplei2p.lightning.reading.activity;
import android.animation.ObjectAnimator; import android.animation.ObjectAnimator;
import android.app.Dialog; import android.app.Dialog;
@ -25,11 +25,11 @@ import android.widget.TextView;
import javax.inject.Inject; import javax.inject.Inject;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.BrowserApp; import org.purplei2p.lightning.BrowserApp;
import acr.browser.lightning.constant.Constants; import org.purplei2p.lightning.constant.Constants;
import acr.browser.lightning.dialog.BrowserDialog; import org.purplei2p.lightning.dialog.BrowserDialog;
import acr.browser.lightning.preference.PreferenceManager; import org.purplei2p.lightning.preference.PreferenceManager;
import com.anthonycr.bonsai.Schedulers; import com.anthonycr.bonsai.Schedulers;
import com.anthonycr.bonsai.Single; import com.anthonycr.bonsai.Single;
@ -38,10 +38,10 @@ import com.anthonycr.bonsai.SingleOnSubscribe;
import com.anthonycr.bonsai.SingleSubscriber; import com.anthonycr.bonsai.SingleSubscriber;
import com.anthonycr.bonsai.Subscription; import com.anthonycr.bonsai.Subscription;
import acr.browser.lightning.reading.HtmlFetcher; import org.purplei2p.lightning.reading.HtmlFetcher;
import acr.browser.lightning.reading.JResult; import org.purplei2p.lightning.reading.JResult;
import acr.browser.lightning.utils.ThemeUtils; import org.purplei2p.lightning.utils.ThemeUtils;
import acr.browser.lightning.utils.Utils; import org.purplei2p.lightning.utils.Utils;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;

2
app/src/main/java/acr/browser/lightning/receiver/NetworkReceiver.java → app/src/main/java/org/purplei2p/lightning/receiver/NetworkReceiver.java

@ -1,4 +1,4 @@
package acr.browser.lightning.receiver; package org.purplei2p.lightning.receiver;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;

70
app/src/main/java/org/purplei2p/lightning/search/SearchEngineProvider.java

@ -0,0 +1,70 @@
package org.purplei2p.lightning.search;
import android.support.annotation.NonNull;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import org.purplei2p.lightning.BrowserApp;
import org.purplei2p.lightning.preference.PreferenceManager;
import org.purplei2p.lightning.search.engine.BaseSearchEngine;
import org.purplei2p.lightning.search.engine.CustomSearch;
import org.purplei2p.lightning.search.engine.DuckLiteSearch;
import org.purplei2p.lightning.search.engine.DuckSearch;
import org.purplei2p.lightning.search.engine.LegworkSearch;
/**
* 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 LegworkSearch();
case 2:
return new DuckSearch();
case 3:
return new DuckLiteSearch();
}
}
public int mapSearchEngineToPreferenceIndex(@NonNull BaseSearchEngine searchEngine) {
if (searchEngine instanceof CustomSearch) {
return 0;
} else if (searchEngine instanceof LegworkSearch) {
return 1;
} else if (searchEngine instanceof DuckSearch) {
return 2;
} else if (searchEngine instanceof DuckLiteSearch) {
return 3;
} else {
throw new UnsupportedOperationException("Unknown search engine provided: " + searchEngine.getClass());
}
}
@NonNull
public List<BaseSearchEngine> getAllSearchEngines() {
return new ArrayList<BaseSearchEngine>(4) {{
add(new CustomSearch(mPreferenceManager.getSearchUrl()));
add(new LegworkSearch());
add(new DuckSearch());
add(new DuckLiteSearch());
}};
}
}

24
app/src/main/java/acr/browser/lightning/search/SuggestionsAdapter.java → app/src/main/java/org/purplei2p/lightning/search/SuggestionsAdapter.java

@ -1,4 +1,4 @@
package acr.browser.lightning.search; package org.purplei2p.lightning.search;
import android.app.Application; import android.app.Application;
import android.content.Context; import android.content.Context;
@ -36,14 +36,14 @@ import java.util.Locale;
import javax.inject.Inject; import javax.inject.Inject;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.BrowserApp; import org.purplei2p.lightning.BrowserApp;
import acr.browser.lightning.database.HistoryItem; import org.purplei2p.lightning.database.HistoryItem;
import acr.browser.lightning.database.bookmark.BookmarkModel; import org.purplei2p.lightning.database.bookmark.BookmarkModel;
import acr.browser.lightning.database.history.HistoryModel; import org.purplei2p.lightning.database.history.HistoryModel;
import acr.browser.lightning.preference.PreferenceManager; import org.purplei2p.lightning.preference.PreferenceManager;
import acr.browser.lightning.utils.Preconditions; import org.purplei2p.lightning.utils.Preconditions;
import acr.browser.lightning.utils.ThemeUtils; import org.purplei2p.lightning.utils.ThemeUtils;
public class SuggestionsAdapter extends BaseAdapter implements Filterable { public class SuggestionsAdapter extends BaseAdapter implements Filterable {
@ -301,12 +301,10 @@ public class SuggestionsAdapter extends BaseAdapter implements Filterable {
@NonNull @NonNull
private Single<List<HistoryItem>> getSuggestionsForQuery(@NonNull final String query) { private Single<List<HistoryItem>> getSuggestionsForQuery(@NonNull final String query) {
if (mSuggestionChoice == PreferenceManager.Suggestion.SUGGESTION_GOOGLE) { if (mSuggestionChoice == PreferenceManager.Suggestion.SUGGESTION_LEGWORK) {
return SuggestionsManager.createGoogleQueryObservable(query, mApplication); return SuggestionsManager.createLegworkQueryObservable(query, mApplication);
} else if (mSuggestionChoice == PreferenceManager.Suggestion.SUGGESTION_DUCK) { } else if (mSuggestionChoice == PreferenceManager.Suggestion.SUGGESTION_DUCK) {
return SuggestionsManager.createDuckQueryObservable(query, mApplication); return SuggestionsManager.createDuckQueryObservable(query, mApplication);
} else if (mSuggestionChoice == PreferenceManager.Suggestion.SUGGESTION_BAIDU) {
return SuggestionsManager.createBaiduQueryObservable(query, mApplication);
} else { } else {
return Single.empty(); return Single.empty();
} }

23
app/src/main/java/acr/browser/lightning/search/SuggestionsManager.kt → app/src/main/java/org/purplei2p/lightning/search/SuggestionsManager.kt

@ -1,9 +1,8 @@
package acr.browser.lightning.search package org.purplei2p.lightning.search
import acr.browser.lightning.database.HistoryItem import org.purplei2p.lightning.database.HistoryItem
import acr.browser.lightning.search.suggestions.BaiduSuggestionsModel import org.purplei2p.lightning.search.suggestions.DuckSuggestionsModel
import acr.browser.lightning.search.suggestions.DuckSuggestionsModel import org.purplei2p.lightning.search.suggestions.LegworkSuggestionsModel
import acr.browser.lightning.search.suggestions.GoogleSuggestionsModel
import android.app.Application import android.app.Application
import com.anthonycr.bonsai.Single import com.anthonycr.bonsai.Single
import com.anthonycr.bonsai.SingleAction import com.anthonycr.bonsai.SingleAction
@ -14,20 +13,10 @@ internal object SuggestionsManager {
@Volatile var isRequestInProgress: Boolean = false @Volatile var isRequestInProgress: Boolean = false
@JvmStatic @JvmStatic
fun createGoogleQueryObservable(query: String, application: Application) = fun createLegworkQueryObservable(query: String, application: Application) =
Single.create(SingleAction<List<HistoryItem>> { subscriber -> Single.create(SingleAction<List<HistoryItem>> { subscriber ->
isRequestInProgress = true isRequestInProgress = true
val results = GoogleSuggestionsModel(application).fetchResults(query) val results = LegworkSuggestionsModel(application).fetchResults(query)
subscriber.onItem(results)
subscriber.onComplete()
isRequestInProgress = false
})
@JvmStatic
fun createBaiduQueryObservable(query: String, application: Application) =
Single.create(SingleAction<List<HistoryItem>> { subscriber ->
isRequestInProgress = true
val results = BaiduSuggestionsModel(application).fetchResults(query)
subscriber.onItem(results) subscriber.onItem(results)
subscriber.onComplete() subscriber.onComplete()
isRequestInProgress = false isRequestInProgress = false

2
app/src/main/java/acr/browser/lightning/search/engine/BaseSearchEngine.kt → app/src/main/java/org/purplei2p/lightning/search/engine/BaseSearchEngine.kt

@ -1,4 +1,4 @@
package acr.browser.lightning.search.engine package org.purplei2p.lightning.search.engine
import android.support.annotation.StringRes import android.support.annotation.StringRes

4
app/src/main/java/acr/browser/lightning/search/engine/CustomSearch.kt → app/src/main/java/org/purplei2p/lightning/search/engine/CustomSearch.kt

@ -1,6 +1,6 @@
package acr.browser.lightning.search.engine package org.purplei2p.lightning.search.engine
import acr.browser.lightning.R import org.purplei2p.lightning.R
/** /**
* A custom search engine. * A custom search engine.

6
app/src/main/java/acr/browser/lightning/search/engine/DuckLiteSearch.kt → app/src/main/java/org/purplei2p/lightning/search/engine/DuckLiteSearch.kt

@ -1,7 +1,7 @@
package acr.browser.lightning.search.engine package org.purplei2p.lightning.search.engine
import acr.browser.lightning.R import org.purplei2p.lightning.R
import acr.browser.lightning.constant.Constants import org.purplei2p.lightning.constant.Constants
/** /**
* The DuckDuckGo Lite search engine. * The DuckDuckGo Lite search engine.

6
app/src/main/java/acr/browser/lightning/search/engine/DuckSearch.kt → app/src/main/java/org/purplei2p/lightning/search/engine/DuckSearch.kt

@ -1,7 +1,7 @@
package acr.browser.lightning.search.engine package org.purplei2p.lightning.search.engine
import acr.browser.lightning.R import org.purplei2p.lightning.R
import acr.browser.lightning.constant.Constants import org.purplei2p.lightning.constant.Constants
/** /**
* The DuckDuckGo search engine. * The DuckDuckGo search engine.

15
app/src/main/java/org/purplei2p/lightning/search/engine/LegworkSearch.kt

@ -0,0 +1,15 @@
package org.purplei2p.lightning.search.engine
import org.purplei2p.lightning.R
import org.purplei2p.lightning.constant.Constants
/**
* The Legwork.I2P search engine.
*
* See http://legwork.i2p/env/grafics/LegworkLogo_200.png for the icon.
*/
class LegworkSearch : BaseSearchEngine(
"file:///android_asset/legwork.png",
Constants.LEGWORK_SEARCH,
R.string.search_engine_legwork
)

8
app/src/main/java/acr/browser/lightning/search/suggestions/BaseSuggestionsModel.java → app/src/main/java/org/purplei2p/lightning/search/suggestions/BaseSuggestionsModel.java

@ -1,4 +1,4 @@
package acr.browser.lightning.search.suggestions; package org.purplei2p.lightning.search.suggestions;
import android.app.Application; import android.app.Application;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
@ -17,9 +17,9 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import acr.browser.lightning.database.HistoryItem; import org.purplei2p.lightning.database.HistoryItem;
import acr.browser.lightning.utils.FileUtils; import org.purplei2p.lightning.utils.FileUtils;
import acr.browser.lightning.utils.Utils; import org.purplei2p.lightning.utils.Utils;
import okhttp3.Cache; import okhttp3.Cache;
import okhttp3.CacheControl; import okhttp3.CacheControl;
import okhttp3.Interceptor; import okhttp3.Interceptor;

8
app/src/main/java/acr/browser/lightning/search/suggestions/DuckSuggestionsModel.java → app/src/main/java/org/purplei2p/lightning/search/suggestions/DuckSuggestionsModel.java

@ -1,4 +1,4 @@
package acr.browser.lightning.search.suggestions; package org.purplei2p.lightning.search.suggestions;
import android.app.Application; import android.app.Application;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
@ -9,9 +9,9 @@ import org.json.JSONObject;
import java.io.InputStream; import java.io.InputStream;
import java.util.List; import java.util.List;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.database.HistoryItem; import org.purplei2p.lightning.database.HistoryItem;
import acr.browser.lightning.utils.FileUtils; import org.purplei2p.lightning.utils.FileUtils;
/** /**
* The search suggestions provider for the DuckDuckGo search engine. * The search suggestions provider for the DuckDuckGo search engine.

31
app/src/main/java/acr/browser/lightning/search/suggestions/BaiduSuggestionsModel.java → app/src/main/java/org/purplei2p/lightning/search/suggestions/LegworkSuggestionsModel.java

@ -1,53 +1,52 @@
package acr.browser.lightning.search.suggestions; package org.purplei2p.lightning.search.suggestions;
import android.app.Application; import android.app.Application;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject;
import java.io.InputStream; import java.io.InputStream;
import java.util.List; import java.util.List;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.database.HistoryItem; import org.purplei2p.lightning.database.HistoryItem;
import acr.browser.lightning.utils.FileUtils; import org.purplei2p.lightning.utils.FileUtils;
/** /**
* The search suggestions provider for the Baidu search engine. * The search suggestions provider for the DuckDuckGo search engine.
*/ */
public class BaiduSuggestionsModel extends BaseSuggestionsModel { public final class LegworkSuggestionsModel extends BaseSuggestionsModel {
@NonNull private static final String ENCODING = "UTF-8"; @NonNull private static final String ENCODING = "UTF-8";
@NonNull private final String mSearchSubtitle; @NonNull private final String mSearchSubtitle;
public BaiduSuggestionsModel(@NonNull Application application) { public LegworkSuggestionsModel(@NonNull Application application) {
super(application, ENCODING); super(application, ENCODING);
mSearchSubtitle = application.getString(R.string.suggestion); mSearchSubtitle = application.getString(R.string.suggestion);
} }
@NonNull @NonNull
@Override
protected String createQueryUrl(@NonNull String query, @NonNull String language) { protected String createQueryUrl(@NonNull String query, @NonNull String language) {
// see http://unionsug.baidu.com/su?wd=encodeURIComponent(U) return "http://legwork.i2p/suggest.json?query=" + query;
// see http://suggestion.baidu.com/s?wd=encodeURIComponent(U)&action=opensearch
return "http://suggestion.baidu.com/s?wd=" + query + "&action=opensearch";
} }
@Override @Override
protected void parseResults(@NonNull InputStream inputStream, @NonNull List<HistoryItem> results) throws Exception { protected void parseResults(@NonNull InputStream inputStream, @NonNull List<HistoryItem> results) throws Exception {
String content = FileUtils.readStringFromStream(inputStream, "GBK"); String content = FileUtils.readStringFromStream(inputStream, ENCODING);
JSONArray respArray = new JSONArray(content); JSONArray jsonArray = new JSONArray(content);
JSONArray jsonArray = respArray.getJSONArray(1);
int counter = 0; int counter = 0;
for (int n = 0, size = jsonArray.length(); n < size; n++) { for (int n = 0, size = jsonArray.length(); n < size; n++) {
String suggestion = jsonArray.getString(n); JSONObject object = jsonArray.getJSONObject(n);
String suggestion = object.getString("phrase");
results.add(new HistoryItem(mSearchSubtitle + " \"" + suggestion + '"', results.add(new HistoryItem(mSearchSubtitle + " \"" + suggestion + '"',
suggestion, R.drawable.ic_search)); suggestion, R.drawable.ic_search));
counter++; counter++;
if (counter >= MAX_RESULTS) { if (counter >= MAX_RESULTS) {
break; break;
} }
} }
} }
} }

6
app/src/main/java/acr/browser/lightning/settings/activity/SettingsActivity.java → app/src/main/java/org/purplei2p/lightning/settings/activity/SettingsActivity.java

@ -1,7 +1,7 @@
/* /*
* Copyright 2014 A.C.R. Development * Copyright 2014 A.C.R. Development
*/ */
package acr.browser.lightning.settings.activity; package org.purplei2p.lightning.settings.activity;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
@ -18,8 +18,8 @@ import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.BrowserApp; import org.purplei2p.lightning.BrowserApp;
public class SettingsActivity extends ThemableSettingsActivity { public class SettingsActivity extends ThemableSettingsActivity {

12
app/src/main/java/acr/browser/lightning/settings/activity/ThemableSettingsActivity.java → app/src/main/java/org/purplei2p/lightning/settings/activity/ThemableSettingsActivity.java

@ -1,4 +1,4 @@
package acr.browser.lightning.settings.activity; package org.purplei2p.lightning.settings.activity;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
@ -7,11 +7,11 @@ import android.os.Bundle;
import javax.inject.Inject; import javax.inject.Inject;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.activity.AppCompatPreferenceActivity; import org.purplei2p.lightning.activity.AppCompatPreferenceActivity;
import acr.browser.lightning.BrowserApp; import org.purplei2p.lightning.BrowserApp;
import acr.browser.lightning.preference.PreferenceManager; import org.purplei2p.lightning.preference.PreferenceManager;
import acr.browser.lightning.utils.ThemeUtils; import org.purplei2p.lightning.utils.ThemeUtils;
public abstract class ThemableSettingsActivity extends AppCompatPreferenceActivity { public abstract class ThemableSettingsActivity extends AppCompatPreferenceActivity {

4
app/src/main/java/acr/browser/lightning/settings/fragment/AboutSettingsFragment.java → app/src/main/java/org/purplei2p/lightning/settings/fragment/AboutSettingsFragment.java

@ -1,7 +1,7 @@
/* /*
* Copyright 2014 A.C.R. Development * Copyright 2014 A.C.R. Development
*/ */
package acr.browser.lightning.settings.fragment; package org.purplei2p.lightning.settings.fragment;
import android.app.Activity; import android.app.Activity;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
@ -11,7 +11,7 @@ import android.preference.Preference;
import android.preference.PreferenceFragment; import android.preference.PreferenceFragment;
import android.util.Log; import android.util.Log;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
public class AboutSettingsFragment extends PreferenceFragment { public class AboutSettingsFragment extends PreferenceFragment {

8
app/src/main/java/acr/browser/lightning/settings/fragment/AdvancedSettingsFragment.java → app/src/main/java/org/purplei2p/lightning/settings/fragment/AdvancedSettingsFragment.java

@ -1,7 +1,7 @@
/* /*
* Copyright 2014 A.C.R. Development * Copyright 2014 A.C.R. Development
*/ */
package acr.browser.lightning.settings.fragment; package org.purplei2p.lightning.settings.fragment;
import android.app.Activity; import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
@ -15,9 +15,9 @@ import android.support.v7.app.AlertDialog;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.constant.Constants; import org.purplei2p.lightning.constant.Constants;
import acr.browser.lightning.dialog.BrowserDialog; import org.purplei2p.lightning.dialog.BrowserDialog;
public class AdvancedSettingsFragment extends LightningPreferenceFragment implements Preference.OnPreferenceClickListener, Preference.OnPreferenceChangeListener { public class AdvancedSettingsFragment extends LightningPreferenceFragment implements Preference.OnPreferenceClickListener, Preference.OnPreferenceChangeListener {

24
app/src/main/java/acr/browser/lightning/settings/fragment/BookmarkSettingsFragment.java → app/src/main/java/org/purplei2p/lightning/settings/fragment/BookmarkSettingsFragment.java

@ -1,7 +1,7 @@
/* /*
* Copyright 2014 A.C.R. Development * Copyright 2014 A.C.R. Development
*/ */
package acr.browser.lightning.settings.fragment; package org.purplei2p.lightning.settings.fragment;
import android.Manifest; import android.Manifest;
import android.app.Activity; import android.app.Activity;
@ -38,17 +38,17 @@ import java.util.List;
import javax.inject.Inject; import javax.inject.Inject;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.BrowserApp; import org.purplei2p.lightning.BrowserApp;
import acr.browser.lightning.database.HistoryItem; import org.purplei2p.lightning.database.HistoryItem;
import acr.browser.lightning.database.bookmark.BookmarkExporter; import org.purplei2p.lightning.database.bookmark.BookmarkExporter;
import acr.browser.lightning.database.bookmark.BookmarkLocalSync; import org.purplei2p.lightning.database.bookmark.BookmarkLocalSync;
import acr.browser.lightning.database.bookmark.BookmarkLocalSync.Source; import org.purplei2p.lightning.database.bookmark.BookmarkLocalSync.Source;
import acr.browser.lightning.database.bookmark.BookmarkModel; import org.purplei2p.lightning.database.bookmark.BookmarkModel;
import acr.browser.lightning.dialog.BrowserDialog; import org.purplei2p.lightning.dialog.BrowserDialog;
import acr.browser.lightning.utils.Preconditions; import org.purplei2p.lightning.utils.Preconditions;
import acr.browser.lightning.utils.SubscriptionUtils; import org.purplei2p.lightning.utils.SubscriptionUtils;
import acr.browser.lightning.utils.Utils; import org.purplei2p.lightning.utils.Utils;
public class BookmarkSettingsFragment extends PreferenceFragment implements Preference.OnPreferenceClickListener { public class BookmarkSettingsFragment extends PreferenceFragment implements Preference.OnPreferenceClickListener {

10
app/src/main/java/acr/browser/lightning/settings/fragment/DebugSettingsFragment.java → app/src/main/java/org/purplei2p/lightning/settings/fragment/DebugSettingsFragment.java

@ -1,4 +1,4 @@
package acr.browser.lightning.settings.fragment; package org.purplei2p.lightning.settings.fragment;
import android.app.Activity; import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;
@ -9,10 +9,10 @@ import android.support.annotation.NonNull;
import javax.inject.Inject; import javax.inject.Inject;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.BrowserApp; import org.purplei2p.lightning.BrowserApp;
import acr.browser.lightning.preference.PreferenceManager; import org.purplei2p.lightning.preference.PreferenceManager;
import acr.browser.lightning.utils.Utils; import org.purplei2p.lightning.utils.Utils;
public class DebugSettingsFragment extends PreferenceFragment implements Preference.OnPreferenceClickListener, Preference.OnPreferenceChangeListener { public class DebugSettingsFragment extends PreferenceFragment implements Preference.OnPreferenceClickListener, Preference.OnPreferenceChangeListener {

6
app/src/main/java/acr/browser/lightning/settings/fragment/DisplaySettingsFragment.java → app/src/main/java/org/purplei2p/lightning/settings/fragment/DisplaySettingsFragment.java

@ -1,7 +1,7 @@
/* /*
* Copyright 2014 A.C.R. Development * Copyright 2014 A.C.R. Development
*/ */
package acr.browser.lightning.settings.fragment; package org.purplei2p.lightning.settings.fragment;
import android.app.Activity; import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
@ -19,8 +19,8 @@ import android.widget.LinearLayout;
import android.widget.SeekBar; import android.widget.SeekBar;
import android.widget.TextView; import android.widget.TextView;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.dialog.BrowserDialog; import org.purplei2p.lightning.dialog.BrowserDialog;
public class DisplaySettingsFragment extends LightningPreferenceFragment implements Preference.OnPreferenceClickListener, Preference.OnPreferenceChangeListener { public class DisplaySettingsFragment extends LightningPreferenceFragment implements Preference.OnPreferenceClickListener, Preference.OnPreferenceChangeListener {

56
app/src/main/java/acr/browser/lightning/settings/fragment/GeneralSettingsFragment.java → app/src/main/java/org/purplei2p/lightning/settings/fragment/GeneralSettingsFragment.java

@ -1,7 +1,7 @@
/* /*
* Copyright 2014 A.C.R. Development * Copyright 2014 A.C.R. Development
*/ */
package acr.browser.lightning.settings.fragment; package org.purplei2p.lightning.settings.fragment;
import android.app.Activity; import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
@ -26,20 +26,20 @@ import java.util.List;
import javax.inject.Inject; import javax.inject.Inject;
import acr.browser.lightning.BuildConfig; import org.purplei2p.lightning.BuildConfig;
import acr.browser.lightning.R; import org.purplei2p.lightning.R;
import acr.browser.lightning.BrowserApp; import org.purplei2p.lightning.BrowserApp;
import acr.browser.lightning.constant.Constants; import org.purplei2p.lightning.constant.Constants;
import acr.browser.lightning.dialog.BrowserDialog; import org.purplei2p.lightning.dialog.BrowserDialog;
import acr.browser.lightning.search.SearchEngineProvider; import org.purplei2p.lightning.search.SearchEngineProvider;
import acr.browser.lightning.search.engine.BaseSearchEngine; import org.purplei2p.lightning.search.engine.BaseSearchEngine;
import acr.browser.lightning.search.engine.CustomSearch; import org.purplei2p.lightning.search.engine.CustomSearch;
import acr.browser.lightning.utils.FileUtils; import org.purplei2p.lightning.utils.FileUtils;
import acr.browser.lightning.utils.ProxyUtils; import org.purplei2p.lightning.utils.ProxyUtils;
import acr.browser.lightning.utils.ThemeUtils; import org.purplei2p.lightning.utils.ThemeUtils;
import acr.browser.lightning.utils.Utils; import org.purplei2p.lightning.utils.Utils;
import static acr.browser.lightning.preference.PreferenceManager.Suggestion; import static org.purplei2p.lightning.preference.PreferenceManager.Suggestion;
public class GeneralSettingsFragment extends LightningPreferenceFragment implements Preference.OnPreferenceClickListener, Preference.OnPreferenceChangeListener { public class GeneralSettingsFragment extends LightningPreferenceFragment implements Preference.OnPreferenceClickListener, Preference.OnPreferenceChangeListener {
@ -125,15 +125,12 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
downloadloc.setSummary(mDownloadLocation); downloadloc.setSummary(mDownloadLocation);
switch (mPreferenceManager.getSearchSuggestionChoice()) { switch (mPreferenceManager.getSearchSuggestionChoice()) {
case SUGGESTION_GOOGLE: case SUGGESTION_LEGWORK:
searchsSuggestions.setSummary(R.string.powered_by_google); searchsSuggestions.setSummary(R.string.powered_by_legwork);
break; break;
case SUGGESTION_DUCK: case SUGGESTION_DUCK:
searchsSuggestions.setSummary(R.string.powered_by_duck); searchsSuggestions.setSummary(R.string.powered_by_duck);
break; break;
case SUGGESTION_BAIDU:
searchsSuggestions.setSummary(R.string.powered_by_baidu);
break;
case SUGGESTION_NONE: case SUGGESTION_NONE:
searchsSuggestions.setSummary(R.string.search_suggestions_off); searchsSuggestions.setSummary(R.string.search_suggestions_off);
break; break;
@ -409,20 +406,17 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
AlertDialog.Builder picker = new AlertDialog.Builder(mActivity); AlertDialog.Builder picker = new AlertDialog.Builder(mActivity);
picker.setTitle(getResources().getString(R.string.search_suggestions)); picker.setTitle(getResources().getString(R.string.search_suggestions));
int currentChoice = 3; int currentChoice = 2;
switch (mPreferenceManager.getSearchSuggestionChoice()) { switch (mPreferenceManager.getSearchSuggestionChoice()) {
case SUGGESTION_GOOGLE: case SUGGESTION_LEGWORK:
currentChoice = 0; currentChoice = 0;
break; break;
case SUGGESTION_DUCK: case SUGGESTION_DUCK:
currentChoice = 1; currentChoice = 1;
break; break;
case SUGGESTION_BAIDU:
currentChoice = 2;
break;
case SUGGESTION_NONE: case SUGGESTION_NONE:
currentChoice = 3; currentChoice = 2;
break; break;
} }
@ -432,18 +426,14 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
switch (which) { switch (which) {
case 0: case 0:
mPreferenceManager.setSearchSuggestionChoice(Suggestion.SUGGESTION_GOOGLE); mPreferenceManager.setSearchSuggestionChoice(Suggestion.SUGGESTION_LEGWORK);
searchsSuggestions.setSummary(R.string.powered_by_google); searchsSuggestions.setSummary(R.string.powered_by_legwork);
break; break;
case 1: case 1:
mPreferenceManager.setSearchSuggestionChoice(Suggestion.SUGGESTION_DUCK); mPreferenceManager.setSearchSuggestionChoice(Suggestion.SUGGESTION_DUCK);
searchsSuggestions.setSummary(R.string.powered_by_duck); searchsSuggestions.setSummary(R.string.powered_by_duck);
break; break;
case 2: case 2:
mPreferenceManager.setSearchSuggestionChoice(Suggestion.SUGGESTION_BAIDU);
searchsSuggestions.setSummary(R.string.powered_by_baidu);
break;
case 3:
mPreferenceManager.setSearchSuggestionChoice(Suggestion.SUGGESTION_NONE); mPreferenceManager.setSearchSuggestionChoice(Suggestion.SUGGESTION_NONE);
searchsSuggestions.setSummary(R.string.search_suggestions_off); searchsSuggestions.setSummary(R.string.search_suggestions_off);
break; break;
@ -461,7 +451,7 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
if (!URLUtil.isAboutUrl(mHomepage)) { if (!URLUtil.isAboutUrl(mHomepage)) {
currentHomepage = mHomepage; currentHomepage = mHomepage;
} else { } else {
currentHomepage = "https://www.google.com"; currentHomepage = "http://i2pd.i2p";
} }
BrowserDialog.showEditText(mActivity, BrowserDialog.showEditText(mActivity,

6
app/src/main/java/acr/browser/lightning/settings/fragment/LightningPreferenceFragment.java → app/src/main/java/org/purplei2p/lightning/settings/fragment/LightningPreferenceFragment.java

@ -1,12 +1,12 @@
package acr.browser.lightning.settings.fragment; package org.purplei2p.lightning.settings.fragment;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceFragment; import android.preference.PreferenceFragment;
import javax.inject.Inject; import javax.inject.Inject;
import acr.browser.lightning.BrowserApp; import org.purplei2p.lightning.BrowserApp;
import acr.browser.lightning.preference.PreferenceManager; import org.purplei2p.lightning.preference.PreferenceManager;
/** /**
* Simplify {@link PreferenceManager} inject in all the PreferenceFragments * Simplify {@link PreferenceManager} inject in all the PreferenceFragments

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save