|
|
@ -47,6 +47,11 @@ import acr.browser.lightning.database.HistoryItem; |
|
|
|
import acr.browser.lightning.dialog.LightningDialogBuilder; |
|
|
|
import acr.browser.lightning.dialog.LightningDialogBuilder; |
|
|
|
import acr.browser.lightning.preference.PreferenceManager; |
|
|
|
import acr.browser.lightning.preference.PreferenceManager; |
|
|
|
import acr.browser.lightning.async.ImageDownloadTask; |
|
|
|
import acr.browser.lightning.async.ImageDownloadTask; |
|
|
|
|
|
|
|
import acr.browser.lightning.react.Action; |
|
|
|
|
|
|
|
import acr.browser.lightning.react.Observable; |
|
|
|
|
|
|
|
import acr.browser.lightning.react.OnSubscribe; |
|
|
|
|
|
|
|
import acr.browser.lightning.react.Schedulers; |
|
|
|
|
|
|
|
import acr.browser.lightning.react.Subscriber; |
|
|
|
import acr.browser.lightning.utils.ThemeUtils; |
|
|
|
import acr.browser.lightning.utils.ThemeUtils; |
|
|
|
import acr.browser.lightning.view.LightningView; |
|
|
|
import acr.browser.lightning.view.LightningView; |
|
|
|
|
|
|
|
|
|
|
@ -85,16 +90,16 @@ public class BookmarksFragment extends Fragment implements View.OnClickListener, |
|
|
|
// Colors
|
|
|
|
// Colors
|
|
|
|
private int mIconColor, mScrollIndex; |
|
|
|
private int mIconColor, mScrollIndex; |
|
|
|
|
|
|
|
|
|
|
|
// Init asynchronously the bookmark manager
|
|
|
|
private Observable<BookmarkViewAdapter> initBookmarkManager() { |
|
|
|
private final Runnable mInitBookmarkManager = new Runnable() { |
|
|
|
return Observable.create(new Action<BookmarkViewAdapter>() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
public void onSubscribe(@NonNull Subscriber<BookmarkViewAdapter> subscriber) { |
|
|
|
final Context context = getContext(); |
|
|
|
mBookmarkAdapter = new BookmarkViewAdapter(getContext(), mBookmarks); |
|
|
|
mBookmarkAdapter = new BookmarkViewAdapter(context, mBookmarks); |
|
|
|
|
|
|
|
setBookmarkDataSet(mBookmarkManager.getBookmarksFromFolder(null, true), false); |
|
|
|
setBookmarkDataSet(mBookmarkManager.getBookmarksFromFolder(null, true), false); |
|
|
|
mBookmarksListView.setAdapter(mBookmarkAdapter); |
|
|
|
subscriber.onNext(mBookmarkAdapter); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onCreate(@Nullable Bundle savedInstanceState) { |
|
|
|
public void onCreate(@Nullable Bundle savedInstanceState) { |
|
|
@ -166,8 +171,14 @@ public class BookmarksFragment extends Fragment implements View.OnClickListener, |
|
|
|
setupNavigationButton(view, R.id.action_reading, R.id.icon_reading); |
|
|
|
setupNavigationButton(view, R.id.action_reading, R.id.icon_reading); |
|
|
|
setupNavigationButton(view, R.id.action_toggle_desktop, R.id.icon_desktop); |
|
|
|
setupNavigationButton(view, R.id.action_toggle_desktop, R.id.icon_desktop); |
|
|
|
|
|
|
|
|
|
|
|
// Must be called here, only here we have a reference to the ListView
|
|
|
|
initBookmarkManager().subscribeOn(Schedulers.worker()) |
|
|
|
BrowserApp.getTaskThread().execute(mInitBookmarkManager); |
|
|
|
.observeOn(Schedulers.main()) |
|
|
|
|
|
|
|
.subscribe(new OnSubscribe<BookmarkViewAdapter>() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void onNext(@Nullable BookmarkViewAdapter item) { |
|
|
|
|
|
|
|
mBookmarksListView.setAdapter(mBookmarkAdapter); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
return view; |
|
|
|
return view; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|