Search in sources :

Example 26 with WikiSite

use of org.wikipedia.dataclient.WikiSite 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);
}
Also used : PageTitle(org.wikipedia.page.PageTitle) HistoryEntry(org.wikipedia.history.HistoryEntry) WikiSite(org.wikipedia.dataclient.WikiSite) Test(org.junit.Test)

Example 27 with WikiSite

use of org.wikipedia.dataclient.WikiSite in project apps-android-wikipedia by wikimedia.

the class ParcelableTest method testPageTitleTalk.

@Test
public void testPageTitleTalk() throws Throwable {
    WikiSite wiki = WikiSite.forLanguageCode("en");
    PageTitle origTitle = new PageTitle("Talk", "India", wiki);
    TestParcelUtil.test(origTitle);
}
Also used : PageTitle(org.wikipedia.page.PageTitle) WikiSite(org.wikipedia.dataclient.WikiSite) Test(org.junit.Test)

Example 28 with WikiSite

use of org.wikipedia.dataclient.WikiSite in project apps-android-wikipedia by wikimedia.

the class NewsFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    View view = inflater.inflate(R.layout.fragment_news, container, false);
    unbinder = ButterKnife.bind(this, view);
    gradientView.setBackground(GradientUtil.getPowerGradient(R.color.black54, Gravity.TOP));
    getAppCompatActivity().setSupportActionBar(toolbar);
    getAppCompatActivity().getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getAppCompatActivity().getSupportActionBar().setTitle("");
    NewsItem item = GsonUnmarshaller.unmarshal(NewsItem.class, getActivity().getIntent().getStringExtra(EXTRA_NEWS_ITEM));
    WikiSite wiki = GsonUnmarshaller.unmarshal(WikiSite.class, getActivity().getIntent().getStringExtra(EXTRA_WIKI));
    Uri imageUri = item.featureImage();
    if (imageUri == null) {
        appBarLayout.setExpanded(false, false);
    }
    image.loadImage(imageUri);
    text.setText(stripHtml(item.story()));
    initRecycler();
    links.setAdapter(new RecyclerAdapter(item.linkCards(wiki), new Callback()));
    return view;
}
Also used : DefaultRecyclerAdapter(org.wikipedia.views.DefaultRecyclerAdapter) BindView(butterknife.BindView) View(android.view.View) FaceAndColorDetectImageView(org.wikipedia.views.FaceAndColorDetectImageView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) ListCardItemView(org.wikipedia.feed.view.ListCardItemView) WikiSite(org.wikipedia.dataclient.WikiSite) Uri(android.net.Uri) Nullable(android.support.annotation.Nullable)

Example 29 with WikiSite

use of org.wikipedia.dataclient.WikiSite in project apps-android-wikipedia by wikimedia.

the class OnThisDayFullListClient method request.

public Call<OnThisDay> request(int month, int date) {
    WikiSite wiki = WikipediaApp.getInstance().getWikiSite();
    String endpoint = String.format(Locale.ROOT, Prefs.getRestbaseUriFormat(), wiki.scheme(), wiki.authority());
    Retrofit retrofit = RetrofitFactory.newInstance(endpoint, wiki);
    OnThisDayFullListClient.Service service = retrofit.create(Service.class);
    return service.getAllOtdEvents(month, date);
}
Also used : Retrofit(retrofit2.Retrofit) WikiSite(org.wikipedia.dataclient.WikiSite)

Example 30 with WikiSite

use of org.wikipedia.dataclient.WikiSite in project apps-android-wikipedia by wikimedia.

the class HistoryEntryDatabaseTable method fromCursor.

@Override
public HistoryEntry fromCursor(Cursor cursor) {
    WikiSite wiki = new WikiSite(Col.SITE.val(cursor), Col.LANG.val(cursor));
    PageTitle title = new PageTitle(Col.NAMESPACE.val(cursor), Col.TITLE.val(cursor), wiki);
    Date timestamp = Col.TIMESTAMP.val(cursor);
    int source = Col.SOURCE.val(cursor);
    return new HistoryEntry(title, timestamp, source);
}
Also used : PageTitle(org.wikipedia.page.PageTitle) WikiSite(org.wikipedia.dataclient.WikiSite) Date(java.util.Date)

Aggregations

WikiSite (org.wikipedia.dataclient.WikiSite)35 Test (org.junit.Test)22 PageTitle (org.wikipedia.page.PageTitle)11 HistoryEntry (org.wikipedia.history.HistoryEntry)5 Date (java.util.Date)4 Uri (android.net.Uri)3 Bundle (android.os.Bundle)2 View (android.view.View)2 ArrayList (java.util.ArrayList)2 JSONException (org.json.JSONException)2 JSONObject (org.json.JSONObject)2 Page (org.wikipedia.page.Page)2 PageBackStackItem (org.wikipedia.page.PageBackStackItem)2 PageProperties (org.wikipedia.page.PageProperties)2 Tab (org.wikipedia.page.tabs.Tab)2 MockWebServerTest (org.wikipedia.test.MockWebServerTest)2 ProgressDialog (android.app.ProgressDialog)1 AssetManager (android.content.res.AssetManager)1 Configuration (android.content.res.Configuration)1 Resources (android.content.res.Resources)1