No need to inject BookmarkPage, make it a utility class for right now
This commit is contained in:
parent
68a4475ec7
commit
c95f1f86e9
@ -183,8 +183,6 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
// Event bus
|
||||
@Inject Bus mEventBus;
|
||||
|
||||
@Inject BookmarkPage mBookmarkPage;
|
||||
|
||||
@Inject LightningDialogBuilder bookmarksDialogBuilder;
|
||||
|
||||
@Inject TabsManager mTabsManager;
|
||||
|
@ -31,8 +31,6 @@ public interface AppComponent {
|
||||
|
||||
void inject(LightningDialogBuilder builder);
|
||||
|
||||
void inject(BookmarkPage bookmarkPage);
|
||||
|
||||
void inject(TabsFragment fragment);
|
||||
|
||||
void inject(LightningView lightningView);
|
||||
|
@ -21,7 +21,6 @@ public class BrowserApp extends Application {
|
||||
private static final Executor mIOThread = Executors.newSingleThreadExecutor();
|
||||
|
||||
@Inject static Context context;
|
||||
@Inject static BookmarkPage bookmarkPage;
|
||||
@Inject static HistoryDatabase historyDatabase;
|
||||
@Inject static Bus bus;
|
||||
@Inject static PreferenceManager preferenceManager;
|
||||
@ -58,8 +57,4 @@ public class BrowserApp extends Application {
|
||||
return bus;
|
||||
}
|
||||
|
||||
public static BookmarkPage getBookmarkPage() {
|
||||
return bookmarkPage;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -52,20 +52,12 @@ public final class BookmarkPage {
|
||||
|
||||
private static final String END = "</div></body></html>";
|
||||
|
||||
@Inject
|
||||
BookmarkManager manager;
|
||||
private static final File FILES_DIR = BrowserApp.getContext().getFilesDir();
|
||||
private static final File CACHE_DIR = BrowserApp.getContext().getCacheDir();
|
||||
|
||||
private final File FILES_DIR;
|
||||
private final File CACHE_DIR;
|
||||
private BookmarkPage() {}
|
||||
|
||||
@Inject
|
||||
public BookmarkPage() {
|
||||
BrowserApp.getAppComponent().inject(this);
|
||||
FILES_DIR = BrowserApp.getContext().getFilesDir();
|
||||
CACHE_DIR = BrowserApp.getContext().getCacheDir();
|
||||
}
|
||||
|
||||
public void buildBookmarkPage(final String folder) {
|
||||
public static void buildBookmarkPage(final String folder, final BookmarkManager manager) {
|
||||
final List<HistoryItem> list = manager.getBookmarksFromFolder(folder, true);
|
||||
final File bookmarkWebPage;
|
||||
if (folder == null || folder.isEmpty()) {
|
||||
@ -87,7 +79,7 @@ public final class BookmarkPage {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
buildBookmarkPage(item.getTitle());
|
||||
buildBookmarkPage(item.getTitle(), manager);
|
||||
}
|
||||
}).run();
|
||||
} else {
|
||||
|
@ -50,6 +50,7 @@ import acr.browser.lightning.constant.Constants;
|
||||
import acr.browser.lightning.constant.HistoryPage;
|
||||
import acr.browser.lightning.constant.StartPage;
|
||||
import acr.browser.lightning.controller.UIController;
|
||||
import acr.browser.lightning.database.BookmarkManager;
|
||||
import acr.browser.lightning.dialog.LightningDialogBuilder;
|
||||
import acr.browser.lightning.download.LightningDownloadListener;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
@ -98,6 +99,7 @@ public class LightningView {
|
||||
@Inject PreferenceManager mPreferences;
|
||||
@Inject LightningDialogBuilder mBookmarksDialogBuilder;
|
||||
@Inject ProxyUtils mProxyUtils;
|
||||
@Inject BookmarkManager mBookmarkManager;
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public LightningView(Activity activity, String url, boolean isIncognito) {
|
||||
@ -214,7 +216,7 @@ public class LightningView {
|
||||
}
|
||||
final File bookmarkWebPage = new File(mActivity.getFilesDir(), BookmarkPage.FILENAME);
|
||||
|
||||
BrowserApp.getBookmarkPage().buildBookmarkPage(null);
|
||||
BookmarkPage.buildBookmarkPage(null, mBookmarkManager);
|
||||
mActivity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
Loading…
Reference in New Issue
Block a user