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);
}
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);
}
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;
}
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);
}
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);
}
Aggregations