Example #1
0
        public override async Task OnCreateExtended(Bundle savedInstanceState)
        {
            SetContentView(Resource.Layout.Activity_Browse);
            var browseModel = new BrowseMediaDto();

            try
            {
                browseModel = AniListJsonSerializer.Default.Deserialize <BrowseMediaDto>(Intent.GetStringExtra(BrowseDtoIntentKey)) ?? new BrowseMediaDto();
                browseModel.Sort ??= new List <MediaSort>();

                if (!browseModel.Sort.Any())
                {
                    browseModel.Sort.Add(MediaSort.PopularityDesc);
                }
            }
            catch
            {
                // ignored
            }

            await CreatePresenter(savedInstanceState);

            _cardType = Presenter.AniDroidSettings.CardType;

            Presenter.BrowseAniListMedia(browseModel);

            SetupToolbar();
        }
Example #2
0
        public static void StartActivity(BaseAniDroidActivity context, BrowseMediaDto browseDto, int?requestCode = null)
        {
            var intent    = new Intent(context, typeof(BrowseActivity));
            var dtoString = AniListJsonSerializer.Default.Serialize(browseDto);

            intent.PutExtra(BrowseDtoIntentKey, dtoString);

            if (requestCode.HasValue)
            {
                context.StartActivityForResult(intent, requestCode.Value);
            }
            else
            {
                context.StartActivity(intent);
            }
        }
Example #3
0
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            var browseModel = new BrowseMediaDto()
            {
                Type    = MediaType.Anime,
                Format  = MediaFormat.Tv,
                Status  = MediaStatus.Releasing,
                Season  = MediaSeason.GetFromDate(DateTime.UtcNow),
                Country = MediaCountry.Japan,
                Year    = DateTime.Now.Year,
                Sort    = new List <MediaSort> {
                    MediaSort.PopularityDesc
                }
            };

            Presenter.BrowseAniListMedia(browseModel);
        }
Example #4
0
 public BrowseFilterDialogFragment(BaseAniDroidActivity context, IBrowsePresenter presenter)
 {
     _context     = context;
     _presenter   = presenter;
     _browseModel = presenter.GetBrowseDto();
 }
Example #5
0
 public void BrowseAniListMedia(BrowseMediaDto browseDto)
 {
     _browseDto = browseDto;
     View.ShowMediaSearchResults(AniListService.BrowseMedia(browseDto, 20));
 }
Example #6
0
 public IAsyncEnumerable <OneOf <IPagedData <Media>, IAniListError> > BrowseMedia(BrowseMediaDto browseDto, int perPage)
 {
     return(new PagedAsyncEnumerable <Media>(perPage,
                                             CreateGetPageFunc <Media>(QueryStore.BrowseMedia, browseDto),
                                             HasNextPage));
 }