Search in sources :

Example 6 with ExternalLink

use of com.mxt.anitrend.model.entity.anilist.ExternalLink in project anitrend-app by AniTrend.

the class EpisodeUtilTests method episodeSupport_givenCrunchyrollAndFeedUrl_shouldReturnEither.

@Test
public void episodeSupport_givenCrunchyrollAndFeedUrl_shouldReturnEither() {
    String show = "my-hero-academia";
    String crunchyUrl = BuildConfig.CRUNCHY_LINK + show;
    String feedUrl = BuildConfig.FEEDS_LINK + show + ".rss";
    ExternalLink link1 = mock(ExternalLink.class);
    ExternalLink link2 = mock(ExternalLink.class);
    when(link1.getUrl()).thenReturn(crunchyUrl);
    when(link2.getUrl()).thenReturn(feedUrl);
    List<ExternalLink> links = Arrays.asList(link1, link2);
    assertThat(EpisodeUtil.INSTANCE.episodeSupport(links), is(anyOf(equalTo(show + ".rss"), equalTo(feedUrl))));
}
Also used : ExternalLink(com.mxt.anitrend.model.entity.anilist.ExternalLink) Test(org.junit.Test)

Example 7 with ExternalLink

use of com.mxt.anitrend.model.entity.anilist.ExternalLink in project anitrend-app by AniTrend.

the class AiringPageAdapter method getItem.

/**
 * Return the Fragment associated with a specified position.
 *
 * @param position
 */
@Override
public Fragment getItem(int position) {
    switch(position) {
        case 0:
            return AiringListFragment.newInstance();
        case 1:
            List<ExternalLink> externalLinks = new ArrayList<>(1);
            externalLinks.add(new ExternalLink(BuildConfig.FEEDS_LINK, null));
            return WatchListFragment.newInstance(externalLinks, false);
    }
    return null;
}
Also used : ArrayList(java.util.ArrayList) ExternalLink(com.mxt.anitrend.model.entity.anilist.ExternalLink)

Aggregations

ExternalLink (com.mxt.anitrend.model.entity.anilist.ExternalLink)7 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)2 Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 View (android.view.View)1 LinkAdapter (com.mxt.anitrend.adapter.recycler.detail.LinkAdapter)1 RankAdapter (com.mxt.anitrend.adapter.recycler.detail.RankAdapter)1 MediaRank (com.mxt.anitrend.model.entity.anilist.MediaRank)1 MediaBrowseUtil (com.mxt.anitrend.util.media.MediaBrowseUtil)1 MediaBrowseActivity (com.mxt.anitrend.view.activity.detail.MediaBrowseActivity)1 QueryContainerBuilder (io.github.wax911.library.model.request.QueryContainerBuilder)1