use of org.wikipedia.readinglist.database.ReadingListPage in project apps-android-wikipedia by wikimedia.
the class PageFragment method onPageLoadComplete.
public void onPageLoadComplete() {
refreshView.setEnabled(true);
if (callback() != null) {
callback().onPageInvalidateOptionsMenu();
}
setupToC(model, pageFragmentLoadState.isFirstPage());
editHandler.setPage(model.getPage());
initPageScrollFunnel();
bottomContentView.setPage(model.getPage());
if (model.getReadingListPage() != null) {
final ReadingListPage page = model.getReadingListPage();
final PageTitle title = model.getTitle();
CallbackTask.execute(() -> {
if (!TextUtils.equals(page.thumbUrl(), title.getThumbUrl()) || !TextUtils.equals(page.description(), title.getDescription())) {
page.thumbUrl(title.getThumbUrl());
page.description(title.getDescription());
ReadingListDbHelper.instance().updatePage(page);
}
});
}
checkAndShowSelectTextOnboarding();
}
use of org.wikipedia.readinglist.database.ReadingListPage in project apps-android-wikipedia by wikimedia.
the class RandomFragment method onSaveShareClick.
@OnClick(R.id.random_save_button)
void onSaveShareClick() {
PageTitle title = getTopTitle();
if (title == null) {
return;
}
if (saveButtonState) {
new ReadingListBookmarkMenu(saveButton, new ReadingListBookmarkMenu.Callback() {
@Override
public void onAddRequest(@Nullable ReadingListPage page) {
onAddPageToList(title);
}
@Override
public void onDeleted(@Nullable ReadingListPage page) {
FeedbackUtil.showMessage(getActivity(), getString(R.string.reading_list_item_deleted, title.getDisplayText()));
updateSaveShareButton(title);
}
}).show(title);
} else {
onAddPageToList(title);
}
}
use of org.wikipedia.readinglist.database.ReadingListPage in project apps-android-wikipedia by wikimedia.
the class ReadingListFragment method getSelectedPages.
@NonNull
private List<ReadingListPage> getSelectedPages() {
List<ReadingListPage> result = new ArrayList<>();
if (readingList == null) {
return result;
}
for (ReadingListPage page : displayedPages) {
if (page.selected()) {
result.add(page);
page.selected(false);
}
}
return result;
}
use of org.wikipedia.readinglist.database.ReadingListPage in project apps-android-wikipedia by wikimedia.
the class ReadingListFragment method onDeleteItem.
@Override
public void onDeleteItem(int pageIndex) {
ReadingListPage page = readingList == null ? null : readingList.pages().get(pageIndex);
deleteSinglePage(page);
}
use of org.wikipedia.readinglist.database.ReadingListPage in project apps-android-wikipedia by wikimedia.
the class ReadingListFragment method addSelectedPagesToList.
private void addSelectedPagesToList() {
List<ReadingListPage> selectedPages = getSelectedPages();
if (!selectedPages.isEmpty()) {
List<PageTitle> titles = new ArrayList<>();
for (ReadingListPage page : selectedPages) {
titles.add(ReadingListPage.toPageTitle(page));
}
bottomSheetPresenter.show(getChildFragmentManager(), AddToReadingListDialog.newInstance(titles, AddToReadingListDialog.InvokeSource.READING_LIST_ACTIVITY));
update();
}
}
Aggregations