Ejemplo n.º 1
0
        public bool RemoveVideoFromSharedPreferences(string videoKey, SharedPreferenceType type)
        {
            if (videoKey == null) return false;

            var sharedPref = GetSharedPreferernceByType (type);
            var key = sharedPref.GetString (videoKey, string.Empty);

            if (key != string.Empty)
            {
                // Video is in favorites, remove it
                sharedPref.Edit ().Remove (key).Apply ();
                return true;
            }

            return false;
        }
Ejemplo n.º 2
0
        public bool AddVideoToSharedPreferences(string videoKey, SharedPreferenceType type)
        {
            if (videoKey == null) return false;

            var sharedPref = GetSharedPreferernceByType (type);
            var key = sharedPref.GetString (videoKey, string.Empty);

            if (key == string.Empty)
            {
                // Not in favorites, add it
                sharedPref.Edit ().PutString (videoKey, videoKey).Apply ();
                return true;
            }

            return false;
        }
Ejemplo n.º 3
0
        private ISharedPreferences GetSharedPreferernceByType(SharedPreferenceType type)
        {
            switch (type)
            {
                case SharedPreferenceType.Favorites:
                    return _favPrefs;
                case SharedPreferenceType.Liked:
                    return _likedVidsPrefs;
                case SharedPreferenceType.Disliked:
                    return _dislikedVidsPrefs;
                case SharedPreferenceType.Watchlist:
                    return _watchListPrefs;
                case SharedPreferenceType.Watched:
                    return _watchedVidsPrefs;
            }

            return _favPrefs;
        }
Ejemplo n.º 4
0
 public int GetCount(SharedPreferenceType type)
 {
     var sharedPref = GetSharedPreferernceByType (type);
     return sharedPref.All.Keys.Count;
 }
Ejemplo n.º 5
0
 public List<string> GetAllVideos(SharedPreferenceType type)
 {
     var sharedPref = GetSharedPreferernceByType (type);
     return sharedPref.All.Keys.ToList();
 }