use of org.wikipedia.page.PageTitle in project apps-android-wikipedia by wikimedia.
the class BottomContentView method onTalkClick.
@OnClick(R.id.page_talk_container)
void onTalkClick(View v) {
PageTitle title = page.getTitle();
PageTitle talkPageTitle = new PageTitle("Talk", title.getPrefixedText(), title.getWikiSite());
visitInExternalBrowser(parentFragment.getContext(), Uri.parse(talkPageTitle.getMobileUri()));
}
use of org.wikipedia.page.PageTitle in project apps-android-wikipedia by wikimedia.
the class BottomContentView method setup.
public void setup(PageFragment parentFragment, CommunicationBridge bridge, ObservableWebView webview) {
this.parentFragment = parentFragment;
this.webView = webview;
this.bridge = bridge;
setWebView(webview);
webview.addOnScrollChangeListener(this);
webview.addOnContentHeightChangedListener(this);
pageExternalLink.setPaintFlags(pageExternalLink.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
if (parentFragment.callback() != null) {
ListViewContextMenuListener contextMenuListener = new LongPressHandler(parentFragment);
new org.wikipedia.LongPressHandler(readMoreList, HistoryEntry.SOURCE_INTERNAL_LINK, contextMenuListener);
}
addOnLayoutChangeListener((View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) -> {
if (prevLayoutHeight == getHeight()) {
return;
}
prevLayoutHeight = getHeight();
padWebView();
});
readMoreList.setAdapter(readMoreAdapter);
readMoreList.setOnItemClickListener((AdapterView<?> parent, View view, int position, long id) -> {
PageTitle title = readMoreAdapter.getItem(position).getPageTitle();
HistoryEntry historyEntry = new HistoryEntry(title, HistoryEntry.SOURCE_INTERNAL_LINK);
parentFragment.loadPage(title, historyEntry);
funnel.logSuggestionClicked(page.getTitle(), readMoreItems.getResults(), position);
});
// hide ourselves by default
hide();
}
use of org.wikipedia.page.PageTitle in project apps-android-wikipedia by wikimedia.
the class ShareHandler method showWiktionaryDefinition.
public void showWiktionaryDefinition(String text) {
PageTitle title = fragment.getTitle();
fragment.showBottomSheet(WiktionaryDialog.newInstance(title, text));
}
use of org.wikipedia.page.PageTitle in project apps-android-wikipedia by wikimedia.
the class ShareHandler method shareSnippet.
private void shareSnippet(@NonNull CharSequence input) {
final String selectedText = StringUtil.sanitizeText(input.toString());
final PageTitle title = fragment.getTitle();
final String leadImageNameText = fragment.getPage().getPageProperties().getLeadImageName() != null ? fragment.getPage().getPageProperties().getLeadImageName() : "";
new ImageLicenseFetchClient().request(title.getWikiSite(), new PageTitle(Namespace.FILE.toLegacyString(), leadImageNameText, title.getWikiSite()), new ImageLicenseFetchClient.Callback() {
@Override
public void success(@NonNull Call<MwQueryResponse> call, @NonNull ImageLicense result) {
final Bitmap snippetBitmap = SnippetImage.getSnippetImage(fragment.getContext(), fragment.getLeadImageBitmap(), title.getDisplayText(), fragment.getPage().isMainPage() ? "" : StringUtils.capitalize(title.getDescription()), selectedText, result);
fragment.showBottomSheet(new PreviewDialog(fragment.getContext(), snippetBitmap, title, selectedText, funnel));
}
@Override
public void failure(@NonNull Call<MwQueryResponse> call, @NonNull Throwable caught) {
// If we failed to get license info for the lead image, just share the text
PreviewDialog.shareAsText(fragment.getContext(), title, selectedText, funnel);
L.e("Error fetching image license info for " + title.getDisplayText(), caught);
}
});
}
use of org.wikipedia.page.PageTitle 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);
}
}
Aggregations