Example #1
0
        public void SetMediaListFilter(MediaListFilterModel filterModel)
        {
            foreach (var adapter in _recyclerAdapters)
            {
                adapter.SetFilter(filterModel);
            }

            if (!string.Equals(_filterModel.Title, _toolbarSearch.Text))
            {
                _toolbarSearch.Text = _filterModel.Title;
            }

            if (_filterModel.IsFilteringActive)
            {
                if (!_filterModel.FilteringPreviouslyActive)
                {
                    DisplaySnackbarMessage("List filtering is active", Snackbar.LengthLong);
                }

                _filterModel.FilteringPreviouslyActive = true;
                _menu?.FindItem(Resource.Id.Menu_MediaLists_Filter)?.Icon
                ?.SetTintList(ColorStateList.ValueOf(Color.LightGreen));
            }
            else
            {
                if (_filterModel.FilteringPreviouslyActive)
                {
                    DisplaySnackbarMessage("List filtering is not active", Snackbar.LengthShort);
                }

                _filterModel.FilteringPreviouslyActive = false;
                _menu?.FindItem(Resource.Id.Menu_MediaLists_Filter)?.Icon?.SetTintList(null);
            }
        }
Example #2
0
        public override async Task OnCreateExtended(Bundle savedInstanceState)
        {
            SetLoadingShown();

            _userId    = Intent.GetIntExtra(UserIdIntentKey, 0);
            _mediaType = AniListEnum.GetEnum <MediaType>(Intent.GetStringExtra(MediaTypeIntentKey));

            _filterModel = new MediaListFilterModel();

            await CreatePresenter(savedInstanceState);

            await Presenter.GetMediaLists(_userId);


            _filterTextHandler = new Handler(UpdateFilterText);

            _toolbarSearch.AfterTextChanged -= ToolbarSearchTextChanged;
            _toolbarSearch.AfterTextChanged += ToolbarSearchTextChanged;
        }
Example #3
0
        public void SetMediaListFilter(MediaListFilterModel filterModel)
        {
            try
            {
                foreach (var adapter in _recyclerAdapters)
                {
                    adapter.SetFilter(filterModel);
                }

                if (Activity?.ToolbarSearch != null && !string.Equals(_filterModel.Title, Activity.ToolbarSearch.Text))
                {
                    Activity.ToolbarSearch.Text = _filterModel.Title;
                }

                if (_filterModel.IsFilteringActive)
                {
                    if (!_filterModel.FilteringPreviouslyActive)
                    {
                        DisplaySnackbarMessage("List filtering is active", Snackbar.LengthLong);
                    }

                    _filterModel.FilteringPreviouslyActive = true;
                    _menu?.FindItem(Resource.Id.Menu_MediaLists_Filter)?.Icon
                    ?.SetTintList(ColorStateList.ValueOf(Color.LightGreen));
                }
                else
                {
                    if (_filterModel.FilteringPreviouslyActive)
                    {
                        DisplaySnackbarMessage("List filtering is not active", Snackbar.LengthShort);
                    }

                    _filterModel.FilteringPreviouslyActive = false;
                    _menu?.FindItem(Resource.Id.Menu_MediaLists_Filter)?.Icon?.SetTintList(null);
                }
            }
            catch (Exception e)
            {
                Activity?.Logger?.Error("SetMediaListFilter", "Error occurred while setting media list filter", e);
            }
        }
Example #4
0
        public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            var typeString = Arguments.GetString(MediaTypeKey);

            _type   = AniListEnum.GetEnum <MediaType>(typeString);
            _userId = Arguments.GetInt(UserIdKey);

            if (_type == MediaType.Anime)
            {
                _animeListFragmentInstance = this;
            }
            else if (_type == MediaType.Manga)
            {
                _mangaListFragmentInstance = this;
            }

            _filterTextHandler ??= new Handler(UpdateFilterText);
            _filterModel = new MediaListFilterModel();
        }