|
|
@ -29,6 +29,7 @@ import java.util.List; |
|
|
|
import java.util.Locale; |
|
|
|
import java.util.Locale; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Set; |
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
import java.util.concurrent.Executor; |
|
|
|
import java.util.concurrent.ExecutorService; |
|
|
|
import java.util.concurrent.ExecutorService; |
|
|
|
import java.util.concurrent.Executors; |
|
|
|
import java.util.concurrent.Executors; |
|
|
|
|
|
|
|
|
|
|
@ -36,6 +37,7 @@ import javax.inject.Inject; |
|
|
|
import javax.inject.Singleton; |
|
|
|
import javax.inject.Singleton; |
|
|
|
|
|
|
|
|
|
|
|
import acr.browser.lightning.R; |
|
|
|
import acr.browser.lightning.R; |
|
|
|
|
|
|
|
import acr.browser.lightning.app.BrowserApp; |
|
|
|
import acr.browser.lightning.constant.Constants; |
|
|
|
import acr.browser.lightning.constant.Constants; |
|
|
|
import acr.browser.lightning.utils.Utils; |
|
|
|
import acr.browser.lightning.utils.Utils; |
|
|
|
|
|
|
|
|
|
|
@ -54,12 +56,12 @@ public class BookmarkManager { |
|
|
|
|
|
|
|
|
|
|
|
private Map<String, HistoryItem> mBookmarksMap; |
|
|
|
private Map<String, HistoryItem> mBookmarksMap; |
|
|
|
@NonNull private String mCurrentFolder = ""; |
|
|
|
@NonNull private String mCurrentFolder = ""; |
|
|
|
@NonNull private final ExecutorService mExecutor; |
|
|
|
@NonNull private final Executor mExecutor; |
|
|
|
private File mFilesDir; |
|
|
|
private File mFilesDir; |
|
|
|
|
|
|
|
|
|
|
|
@Inject |
|
|
|
@Inject |
|
|
|
public BookmarkManager(@NonNull Context context) { |
|
|
|
public BookmarkManager(@NonNull Context context) { |
|
|
|
mExecutor = Executors.newSingleThreadExecutor(); |
|
|
|
mExecutor = BrowserApp.getIOThread(); |
|
|
|
DEFAULT_BOOKMARK_TITLE = context.getString(R.string.untitled); |
|
|
|
DEFAULT_BOOKMARK_TITLE = context.getString(R.string.untitled); |
|
|
|
mExecutor.execute(new BookmarkInitializer(context)); |
|
|
|
mExecutor.execute(new BookmarkInitializer(context)); |
|
|
|
} |
|
|
|
} |
|
|
@ -177,12 +179,6 @@ public class BookmarkManager { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
protected void finalize() throws Throwable { |
|
|
|
|
|
|
|
mExecutor.shutdownNow(); |
|
|
|
|
|
|
|
super.finalize(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isBookmark(String url) { |
|
|
|
public boolean isBookmark(String url) { |
|
|
|
return mBookmarksMap.containsKey(url); |
|
|
|
return mBookmarksMap.containsKey(url); |
|
|
|
} |
|
|
|
} |
|
|
|