Class FavoritesListV1


  • public class FavoritesListV1
    extends java.lang.Object

    Package Starting Point - The Favorites List, a component of the User module, allows passengers to create a list of media content, such as movies, music or audiobooks, on their personal electronic devices (PED).



    The same Favorites List can be used over multiple flights, if persisted, and passengers can add and remove media content at any time.

    When used with the SeatPairing APIs, passengers can create and modify their Favorites List while on the ground. During the flight, passengers can playback their favorite content that is available on the flight. The content displays on the various inflight monitors, such as seatback, IPSC and secondary monitors.
    After the flight, the Favorites List can be synchronized with the Favorites List on their personal device to ensure the passengers capture their latest favorite content.

    • Method Detail

      • initService

        public static void initService​(Context context,
                                       IInFlightCallback inFlightCallback,
                                       InFlight inFlight)
        This api is the starting point for FavoritesListV1. The service object will be provided via IInFlightCallback once it has been initialized.
        Parameters:
        context - - Context
        inFlightCallback - IInFlightCallback - this callback will be invoked once service has been initialized.
        inFlight - - Reference of InFlight
        Example:
         FavoritesListV1.initService(context, inflightCallbackListener);
         

        public void onInitServiceComplete(Object serviceObj,String serviceName) { if(serviceName.equals(InFlightServices.FAVORITES_LIST_V1_SERVICE.getServiceName())) { mFavoritesListV1 = (FavoritesListV1) serviceObj; mFavoritesListV1.add(favoriteItem); } }

      • fromSerializedData

        public void fromSerializedData​(JSONArray jsonArray)
        Serializes the Favorites List prior to being sent to the inflight monitors. This allows the Favorites List to be synchronized between the personal device and the inflight monitors.
        Parameters:
        jsonArray - serializes the data
      • getItems

        public java.util.List<FavoriteItem> getItems()
        Gets a list of all media content, such as movies, music and audio books, in the Favorites List.
        Returns:
      • saveToDisk

        public void saveToDisk​(Context appContext)
        Persists the Favorites List by saving it to disk on the device.
      • restoreFromDisk

        public boolean restoreFromDisk​(Context appContext)
        Gets a Favorites List that was persisted and saved to disk.
        Parameters:
        appContext - The exisitng Favorites List.
        Returns:
        True, if Favorites List retrieved successfully.
        False, if no Favorites List is retrieved.
      • add

        public int add​(java.util.List<FavoriteItem> favoriteItems)
        Adds all new media items to the end of the Favourite List, then returns the number of items on the Favorites List.

        Parameters:
        favoriteItems - A list of items to be added to the Favorites List

        Returns:
        The number of items added
      • add

        public boolean add​(FavoriteItem favoriteItem)
        Adds a single item to the end of the media queue. This call verifies the media content is not currently in the Favorites List. The list cannot contain identical media content.
        Parameters:
        favoriteItem - to be added
        Returns:
        True, if added.
        False, if the content is identical to content currently in the Favorites List.
      • remove

        public boolean remove​(FavoriteItem favoriteItem)
        Removes a media content from the Favorites List.
        Parameters:
        favoriteItem - The favorite item removed. It's removed as an object/
        Returns:
        True, if collection was modified
        False, if not modified.
      • remove

        public boolean remove​(java.lang.String mediaUr)
        Removes the specified media content from the Favorites List.
        Parameters:
        mediaUr - The media content to be removed
        Returns:
        True, if collection was modified
        False, if not modified.
      • remove

        public void remove​(int index)
        Removes the media content from the Favorites List at a specified index.
        Parameters:
        index - of the media content to be removed.
      • clear

        public void clear()
        Clears all media content from the Favorites List.
      • getItemsByContentType

        public java.util.ArrayList<FavoriteItem> getItemsByContentType​(java.lang.String contentType)
        Returns a list of media items by contentType, such as AOD, VOD, TV or radio.

        If there are no matching items, it return an empty list.
        Parameters:
        contentType - The media content type, such as AOD, VOD, TV or radio
        Returns:
        List of FavoriteItem
      • toSerializedData

        public JSONArray toSerializedData()
        Exports the Favorites List for synchronizing on the inflight monitors. This function requires the personal device to be paired with the seatback monitor. For additional information, please refer to the Seat Pairing module.
        Returns:
      • toString

        public java.lang.String toString()
        Exports the favorites list for logging purposes.
        Overrides:
        toString in class java.lang.Object
        Returns:
      • setSeatFavoritesListUpdateListener

        public void setSeatFavoritesListUpdateListener​(FavoritesListV1.SeatFavoritesListUpdateListener listener)
        Sets a listener to listen for the favorites updates on the seat.
        Parameters:
        listener - FavoritesListV1.SeatFavoritesListUpdateListener callback invoked on update of favorites list on the seatback monitor. This listener is invoked only in seatback monitor when updates to FavoritesListV1 is carried out by invocation of "add", or "remove" APIs.
        Since:
        v03.00.0.43