Search in sources :

Example 1 with RbPageClient

use of org.wikipedia.dataclient.restbase.page.RbPageClient in project apps-android-wikipedia by wikimedia.

the class WiktionaryDialog method loadDefinitions.

private void loadDefinitions() {
    if (selectedText.trim().isEmpty()) {
        displayNoDefinitionsFound();
        return;
    }
    // TODO: centralize the Wiktionary domain better. Maybe a SharedPreference that defaults to
    // https://wiktionary.org.
    PageClient pageClient = PageClientFactory.create(new WikiSite(pageTitle.getWikiSite().subdomain() + WIKTIONARY_DOMAIN), Namespace.MAIN);
    if (pageClient instanceof RbPageClient) {
        ((RbPageClient) pageClient).define(addUnderscores(selectedText), definitionOnLoadCallback);
    } else {
        L.i("Wiktionary definitions require mobile content service loading!");
        displayNoDefinitionsFound();
    }
}
Also used : RbPageClient(org.wikipedia.dataclient.restbase.page.RbPageClient) RbPageClient(org.wikipedia.dataclient.restbase.page.RbPageClient) PageClient(org.wikipedia.dataclient.page.PageClient) WikiSite(org.wikipedia.dataclient.WikiSite)

Aggregations

WikiSite (org.wikipedia.dataclient.WikiSite)1 PageClient (org.wikipedia.dataclient.page.PageClient)1 RbPageClient (org.wikipedia.dataclient.restbase.page.RbPageClient)1