use of org.wikipedia.history.HistoryEntry in project apps-android-wikipedia by wikimedia.
the class ParcelableTest method testHistoryEntry.
@Test
public void testHistoryEntry() throws Throwable {
WikiSite wiki = WikiSite.forLanguageCode("en");
PageTitle title = new PageTitle("Talk", "India", wiki);
HistoryEntry historyEntry = new HistoryEntry(title, HistoryEntry.SOURCE_EXTERNAL_LINK);
TestParcelUtil.test(historyEntry);
}
use of org.wikipedia.history.HistoryEntry in project apps-android-wikipedia by wikimedia.
the class BecauseYouReadClient method request.
@Override
public void request(@NonNull Context context, @NonNull final WikiSite wiki, int age, @NonNull final FeedClient.Callback cb) {
cancel();
readMoreTopicTask = new MainPageReadMoreTopicTask(age) {
@Override
public void onFinish(@Nullable HistoryEntry entry) {
if (entry == null) {
cb.success(Collections.emptyList());
return;
}
getCardForHistoryEntry(entry, cb);
}
@Override
public void onCatch(Throwable caught) {
L.e("Error fetching 'because you read' suggestions", caught);
cb.error(caught);
}
};
readMoreTopicTask.execute();
}
use of org.wikipedia.history.HistoryEntry in project apps-android-wikipedia by wikimedia.
the class FeaturedArticleCard method historyEntry.
@NonNull
public HistoryEntry historyEntry(int source) {
PageTitle title = new PageTitle(articleTitle(), wikiSite());
if (image() != null) {
title.setThumbUrl(image().toString());
}
title.setDescription(articleSubtitle());
return new HistoryEntry(title, source);
}
use of org.wikipedia.history.HistoryEntry in project apps-android-wikipedia by wikimedia.
the class OnThisDayPagesViewHolder method showOverflowMenu.
@OnLongClick(R.id.parent)
boolean showOverflowMenu(View anchorView) {
PageTitle pageTitle = new PageTitle(selectedPage.getTitle(), wiki);
HistoryEntry entry = new HistoryEntry(pageTitle, isSingleCard ? HistoryEntry.SOURCE_ON_THIS_DAY_CARD : HistoryEntry.SOURCE_ON_THIS_DAY_ACTIVITY);
itemCallback.onActionLongClick(entry);
return true;
}
use of org.wikipedia.history.HistoryEntry in project apps-android-wikipedia by wikimedia.
the class PageActivity method handleIntent.
private void handleIntent(@NonNull Intent intent) {
if (Intent.ACTION_VIEW.equals(intent.getAction()) && intent.getData() != null) {
WikiSite wiki = new WikiSite(intent.getData());
PageTitle title = wiki.titleForUri(intent.getData());
HistoryEntry historyEntry = new HistoryEntry(title, HistoryEntry.SOURCE_EXTERNAL_LINK);
loadPageInForegroundTab(title, historyEntry);
} else if (ACTION_LOAD_IN_NEW_TAB.equals(intent.getAction()) || ACTION_LOAD_IN_CURRENT_TAB.equals(intent.getAction())) {
PageTitle title = intent.getParcelableExtra(EXTRA_PAGETITLE);
HistoryEntry historyEntry = intent.getParcelableExtra(EXTRA_HISTORYENTRY);
if (ACTION_LOAD_IN_NEW_TAB.equals(intent.getAction())) {
loadPageInForegroundTab(title, historyEntry);
} else if (ACTION_LOAD_IN_CURRENT_TAB.equals(intent.getAction())) {
loadPage(title, historyEntry, TabPosition.CURRENT_TAB);
}
if (intent.hasExtra(Constants.INTENT_EXTRA_REVERT_QNUMBER)) {
showDescriptionEditRevertDialog(intent.getStringExtra(Constants.INTENT_EXTRA_REVERT_QNUMBER));
}
} else if (ACTION_LOAD_FROM_EXISTING_TAB.equals(intent.getAction())) {
PageTitle title = intent.getParcelableExtra(EXTRA_PAGETITLE);
HistoryEntry historyEntry = intent.getParcelableExtra(EXTRA_HISTORYENTRY);
loadPage(title, historyEntry, TabPosition.EXISTING_TAB);
} else if (ACTION_SHOW_TAB_LIST.equals(intent.getAction()) || ACTION_RESUME_READING.equals(intent.getAction()) || intent.hasExtra(Constants.INTENT_APP_SHORTCUT_CONTINUE_READING)) {
// do nothing, since this will be handled indirectly by PageFragment.
} else if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
String query = intent.getStringExtra(SearchManager.QUERY);
PageTitle title = new PageTitle(query, app.getWikiSite());
HistoryEntry historyEntry = new HistoryEntry(title, HistoryEntry.SOURCE_SEARCH);
loadPageInForegroundTab(title, historyEntry);
} else if (intent.hasExtra(Constants.INTENT_FEATURED_ARTICLE_FROM_WIDGET)) {
new IntentFunnel(app).logFeaturedArticleWidgetTap();
loadMainPageInForegroundTab();
} else {
loadMainPageInCurrentTab();
}
}
Aggregations