Ejemplo n.º 1
0
        public static void Create(BaseAniDroidActivity context, MediaTitle title, ICollection <string> alternateNames)
        {
            var dialogView = context.LayoutInflater.Inflate(Resource.Layout.Dialog_MediaTitles, null);

            if (!string.IsNullOrWhiteSpace(title.Romaji))
            {
                dialogView.FindViewById(Resource.Id.MediaTitles_RomajiContainer).Visibility = ViewStates.Visible;
                dialogView.FindViewById <TextView>(Resource.Id.MediaTitles_Romaji).Text     = title.Romaji;
            }

            if (!string.IsNullOrWhiteSpace(title.English))
            {
                dialogView.FindViewById(Resource.Id.MediaTitles_EnglishContainer).Visibility = ViewStates.Visible;
                dialogView.FindViewById <TextView>(Resource.Id.MediaTitles_English).Text     = title.English;
            }

            if (!string.IsNullOrWhiteSpace(title.Native))
            {
                dialogView.FindViewById(Resource.Id.MediaTitles_NativeContainer).Visibility = ViewStates.Visible;
                dialogView.FindViewById <TextView>(Resource.Id.MediaTitles_Native).Text     = title.Native;
            }

            if (alternateNames?.Any() == true)
            {
                dialogView.FindViewById(Resource.Id.MediaTitles_AlsoKnownAsContainer).Visibility = ViewStates.Visible;
                dialogView.FindViewById <TextView>(Resource.Id.MediaTitles_AlsoKnownAs).Text     = string.Join("\n", alternateNames);
            }

            var dialog = new AlertDialog.Builder(context, context.GetThemedResourceId(Resource.Attribute.Dialog_Theme));

            dialog.SetView(dialogView);
            dialog.Show();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// All Media objects are searchable on their MediaTitle property.
        ///
        /// For an individual Media object, this means that given a string as a
        /// search key, the Search() method will either locate that string in
        /// the MediaTitle property or it will not.
        ///
        /// If not overridden, this method can be used by all derived classes 'as is'.
        /// </summary>
        /// <param name="key">The string to be searching for</param>
        /// <returns>A flag indicating whether the search string was found (true) or not (false)</returns>

        public bool Search(string key)
        {
            // Make the search case insensitive by treating strings as lowercase
            string temp = MediaTitle.ToLower();

            if (temp.IndexOf(key.ToLower()) >= 0)
            {
                return(true);                        // Found it
            }
            else
            {
                return(false);                       // Didn't find it
            }
        }
Ejemplo n.º 3
0
 protected override object GetTokenValue(MediaTitle item)
 {
     return(item.Publisher);
 }
Ejemplo n.º 4
0
 protected override object GetTokenValue(MediaTitle item)
 {
     return(item.Audience);
 }
Ejemplo n.º 5
0
 protected override object GetTokenValue(MediaTitle item)
 {
     return(item.TitlePublicationDate); // this is the original publication date;
 }
Ejemplo n.º 6
0
 protected override object GetTokenValue(MediaTitle item)
 {
     return(item.EditionPublicationDate > DateTime.MinValue ? item.EditionPublicationDate : item.TitlePublicationDate);
 }
Ejemplo n.º 7
0
        public ContentFilter(int brief, string[] filterString)
        {
            Brief      = brief;
            Language   = string.Empty;
            MediaType  = string.Empty;
            MediaTitle = string.Empty;
            Company    = string.Empty;
            Brand      = string.Empty;
            SubBrand   = string.Empty;

            if (filterString == null || filterString.Length < 1)
            {
                return;
            }

            //if (string.IsNullOrEmpty(filterString)) return;

            //string[] splitString = filterString.Split(new char[] { ',' });
            foreach (string s in filterString)
            {
                switch (s[0])
                {
                case 'l':
                    Language += s.Remove(0, 1) + ",";
                    break;

                case 'm':
                    MediaType += s.Remove(0, 1) + ",";
                    break;

                case 'n':
                    MediaTitle += s.Remove(0, 1) + ",";
                    break;

                case 'c':
                    Company += s.Remove(0, 1) + ",";
                    break;

                case 'b':
                    Brand += s.Remove(0, 1) + ",";
                    break;

                case 's':
                    SubBrand += s.Remove(0, 1) + ",";
                    break;
                }
            }

            if (HasLanguage)
            {
                Language = Language.Remove(Language.Length - 1);
            }
            if (HasMediaType)
            {
                MediaType = MediaType.Remove(MediaType.Length - 1);
            }
            if (HasMediaTitle)
            {
                MediaTitle = MediaTitle.Remove(MediaTitle.Length - 1);
            }
            if (HasCompany)
            {
                Company = Company.Remove(Company.Length - 1);
            }
            if (HasBrand)
            {
                Brand = Brand.Remove(Brand.Length - 1);
            }
            if (HasSubBrand)
            {
                SubBrand = SubBrand.Remove(SubBrand.Length - 1);
            }
        }
        // -------------------------------------------------------------------------------
        // -------------------------------------------------------------------------------
        /// <summary>
        /// Sets the parent XElement with the contents of the RssMediaExtension object
        /// properties
        /// </summary>
        /// <param name="parEl">Parent element</param>
        // -------------------------------------------------------------------------------
        // -------------------------------------------------------------------------------
        public void SetEl(XElement parEl)
        {
            for (int i = 0; i < MediaRatings.Count; i++)
            {
                parEl.Add(MediaRatings[i].GetEl());
            }

            if (MediaTitle != null)
            {
                parEl.Add(MediaTitle.GetEl());
            }

            if (MediaDescription != null)
            {
                parEl.Add(MediaDescription.GetEl());
            }

            if (MediaKeywords != null)
            {
                parEl.Add(MediaKeywords.GetEl());
            }

            if (MediaThumbnails.Count > 0)
            {
                for (int i = 0; i < MediaThumbnails.Count; i++)
                {
                    parEl.Add(MediaThumbnails[i].GetEl());
                }
            }

            if (MediaCategories.Count > 0)
            {
                for (int i = 0; i < MediaCategories.Count; i++)
                {
                    parEl.Add(MediaCategories[i].GetEl());
                }
            }

            if (MediaHashes.Count > 0)
            {
                for (int i = 0; i < MediaHashes.Count; i++)
                {
                    parEl.Add(MediaHashes[i].GetEl());
                }
            }

            if (MediaPlayer != null)
            {
                parEl.Add(MediaPlayer.GetEl());
            }

            if (MediaCredits.Count > 0)
            {
                for (int i = 0; i < MediaCredits.Count; i++)
                {
                    parEl.Add(MediaCredits[i].GetEl());
                }
            }

            if (MediaCopyright != null)
            {
                parEl.Add(MediaCopyright.GetEl());
            }

            if (MediaTexts.Count > 0)
            {
                // sort the list
                MediaTexts.Sort(new SortMediaText());

                // now iterate
                for (int i = 0; i < MediaTexts.Count; i++)
                {
                    parEl.Add(MediaTexts[i].GetEl());
                }
            }


            if (MediaRestrictions.Count > 0)
            {
                for (int i = 0; i < MediaRestrictions.Count; i++)
                {
                    parEl.Add(MediaRestrictions[i].GetEl());
                }
            }


            if (MediaCommunity != null)
            {
                parEl.Add(MediaCommunity.GetEl());
            }

            if (MediaComments != null)
            {
                parEl.Add(MediaComments.GetEl());
            }


            if (MediaEmbed != null)
            {
                parEl.Add(MediaEmbed.GetEl());
            }

            if (MediaResponses != null)
            {
                parEl.Add(MediaResponses.GetEl());
            }

            if (MediaBacklinks != null)
            {
                parEl.Add(MediaBacklinks.GetEl());
            }

            if (MediaStatus != null)
            {
                parEl.Add(MediaStatus.GetEl());
            }

            if (MediaPrices.Count > 0)
            {
                for (int i = 0; i < MediaPrices.Count; i++)
                {
                    parEl.Add(MediaPrices[i].GetEl());
                }
            }

            if (MediaLicense != null)
            {
                parEl.Add(MediaLicense.GetEl());
            }

            if (MediaSubtitles.Count > 0)
            {
                for (int i = 0; i < MediaSubtitles.Count; i++)
                {
                    parEl.Add(MediaSubtitles[i].GetEl());
                }
            }

            if (MediaPeerLink != null)
            {
                parEl.Add(MediaPeerLink.GetEl());
            }

            if (MediaRights != null)
            {
                parEl.Add(MediaRights.GetEl());
            }

            if (MediaScenes != null)
            {
                parEl.Add(MediaScenes.GetEl());
            }

            if (MediaLocations.Count > 0)
            {
                for (int i = 0; i < MediaLocations.Count; i++)
                {
                    parEl.Add(MediaLocations[i].GetEl());
                }
            }

            if (MediaValid != null)
            {
                parEl.Add(MediaValid.GetEl());
            }
        }