Beispiel #1
0
        public MediaListSort()
        {
            MediaSort currentSort = AppMain.Settings.SortMedia;

            var option = new SingleOptionRadio();

            option.Bounds = new Rectangle(5, 5, 195, 25);
            AddViewControl(option);
            option.TextString = "Track";
            option.Checked    = currentSort == MediaSort.Track;
            option.StartRender();
            option.InputLeave += () => SetFormat(MediaSort.Track);

            option        = new SingleOptionRadio();
            option.Bounds = new Rectangle(5, 40, 195, 25);
            AddViewControl(option);
            option.TextString = "FileName";
            option.StartRender();
            option.Checked     = currentSort == MediaSort.FileName;
            option.InputLeave += () => SetFormat(MediaSort.FileName);

            option        = new SingleOptionRadio();
            option.Bounds = new Rectangle(5, 75, 195, 25);
            AddViewControl(option);
            option.TextString  = "Title";
            option.Checked     = currentSort == MediaSort.Title;
            option.InputLeave += () => SetFormat(MediaSort.Title);
            option.StartRender();
        }
        public CurrentSeasonPresenter(IAniListService service, IAniDroidSettings settings,
                                      IAniDroidLogger logger) : base(service, settings, logger)
        {
            var titleLanguage = settings?.LoggedInUser?.Options?.TitleLanguage ??
                                MediaTitleLanguage.English;

            if (titleLanguage.Equals(MediaTitleLanguage.Native) ||
                titleLanguage.Equals(MediaTitleLanguage.NativeStylised))
            {
                _sortType = MediaSort.TitleEnglish;
            }
            else if (titleLanguage.Equals(MediaTitleLanguage.Romaji) ||
                     titleLanguage.Equals(MediaTitleLanguage.RomajiStylised))
            {
                _sortType = MediaSort.TitleRomaji;
            }
            else
            {
                _sortType = MediaSort.TitleEnglish;
            }
        }
Beispiel #3
0
        public static MediaListFragment CreateMediaListFragment(int userId, MediaType type, MediaSort sort = null)
        {
            var frag   = new MediaListFragment();
            var bundle = new Bundle(6);

            bundle.PutString(MediaTypeKey, type.Value);
            bundle.PutInt(UserIdKey, userId);
            frag.Arguments = bundle;

            return(frag);
        }
Beispiel #4
0
 protected void SetFormat(MediaSort pMediaSort)
 {
     AppMain.Settings.SortMedia = pMediaSort;
     AppMain.Settings.SaveXml();
 }
Beispiel #5
0
        public static void Create(BaseAniDroidActivity context, MediaSort currentSort,
                                  Action <MediaSort> onSelectSortAction)
        {
            var view   = context.LayoutInflater.Inflate(Resource.Layout.Dialog_BrowseSort, null);
            var dialog = new AlertDialog.Builder(context,
                                                 context.GetThemedResourceId(Resource.Attribute.Dialog_Theme));

            dialog.SetView(view);
            dialog.SetTitle("Sort By");

            var selectedSort      = Resource.Id.BrowseSort_Popularity;
            var selectedDirection = Resource.Id.BrowseSort_Descending;

            if (MediaSort.Popularity.Equals(currentSort))
            {
                selectedSort      = Resource.Id.BrowseSort_Popularity;
                selectedDirection = Resource.Id.BrowseSort_Ascending;
            }
            else if (MediaSort.PopularityDesc.Equals(currentSort))
            {
                selectedSort      = Resource.Id.BrowseSort_Popularity;
                selectedDirection = Resource.Id.BrowseSort_Descending;
            }
            else if (MediaSort.Score.Equals(currentSort))
            {
                selectedSort      = Resource.Id.BrowseSort_Score;
                selectedDirection = Resource.Id.BrowseSort_Ascending;
            }
            else if (MediaSort.ScoreDesc.Equals(currentSort))
            {
                selectedSort      = Resource.Id.BrowseSort_Score;
                selectedDirection = Resource.Id.BrowseSort_Descending;
            }
            else if (MediaSort.StartDate.Equals(currentSort))
            {
                selectedSort      = Resource.Id.BrowseSort_StartDate;
                selectedDirection = Resource.Id.BrowseSort_Ascending;
            }
            else if (MediaSort.StartDateDesc.Equals(currentSort))
            {
                selectedSort      = Resource.Id.BrowseSort_StartDate;
                selectedDirection = Resource.Id.BrowseSort_Descending;
            }

            // set current selections
            var sortRadioGroup = view.FindViewById <RadioGroup>(Resource.Id.BrowseSort_SortRadioGroup);

            sortRadioGroup.Check(selectedSort);

            var directionRadioGroup = view.FindViewById <RadioGroup>(Resource.Id.BrowseSort_DirectionRadioGroup);

            directionRadioGroup.Check(selectedDirection);

            dialog.SetPositiveButton("Set", (sender, args) =>
            {
                var ascending  = directionRadioGroup.CheckedRadioButtonId == Resource.Id.BrowseSort_Ascending;
                MediaSort sort = null;

                switch (sortRadioGroup.CheckedRadioButtonId)
                {
                case Resource.Id.BrowseSort_Score:
                    sort = ascending ? MediaSort.Score : MediaSort.ScoreDesc;
                    break;

                case Resource.Id.BrowseSort_Popularity:
                    sort = ascending ? MediaSort.Popularity : MediaSort.PopularityDesc;
                    break;

                case Resource.Id.BrowseSort_StartDate:
                    sort = ascending ? MediaSort.StartDate : MediaSort.StartDateDesc;
                    break;
                }

                onSelectSortAction(sort);
            });

            dialog.Show();
        }
 public MediaSortViewModel(MediaSort sort, string description)
 {
     this.sort = sort;
     this.description = description;
 }
Beispiel #7
0
 public MediaSortViewModel(MediaSort sort, string description)
 {
     this.sort        = sort;
     this.description = description;
 }