com.here.msdkui.routing

## Class TransportModePanelAdapter

- java.lang.Object
- - androidx.viewpager.widget.PagerAdapter
  - - androidx.fragment.app.FragmentStatePagerAdapter
    - - com.here.msdkui.routing.TransportModePanelAdapter

- Direct Known Subclasses:
    SimpleTransportModePanelAdapter

      public abstract class TransportModePanelAdapter
      extends androidx.fragment.app.FragmentStatePagerAdapter

  An adapter class that can be used for a `TransportModePanel`. You can override this class to customize the panel.
  See Also:
    `SimpleTransportModePanelAdapter`

- - ### Field Summary

    - ### Fields inherited from class androidx.fragment.app.FragmentStatePagerAdapter

      `BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT, BEHAVIOR_SET_USER_VISIBLE_HINT`

    - ### Fields inherited from class androidx.viewpager.widget.PagerAdapter

      `POSITION_NONE, POSITION_UNCHANGED`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TransportModePanelAdapter(androidx.fragment.app.FragmentManager manager)` Constructs a new instance using a `FragmentManager`.
    `TransportModePanelAdapter(androidx.fragment.app.FragmentManager manager, java.util.List<com.here.android.mpa.routing.RouteOptions.TransportMode> transportModes)` Constructs a new instance using a `FragmentManager` and a list of `RouteOptions.TransportMode`.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract androidx.fragment.app.Fragment` | `getContent(com.here.android.mpa.routing.RouteOptions.TransportMode mode)` Gets the fragment of `TransportModePanel`.
    `int` | `getCount()`
    `abstract TabView` | `getCustomTabView(com.here.android.mpa.routing.RouteOptions.TransportMode mode)` Gets the `TabView` view for the given `RouteOptions.TransportMode`.
    `androidx.fragment.app.Fragment` | `getItem(int position)`
    `int` | `getItemPosition(java.lang.Object object)`
    `java.lang.CharSequence` | `getPageTitle(int position)`
    `abstract TabView` | `getTabCustomView(com.here.android.mpa.routing.RouteOptions.TransportMode mode)` Deprecated. Please use `getCustomTabView(com.here.android.mpa.routing.RouteOptions.TransportMode)` instead.
    `TabView` | `getTabView(int position)` Gets the custom `TabView` at a given position, which represents a `RouteOptions.TransportMode`.
    `java.util.List<com.here.android.mpa.routing.RouteOptions.TransportMode>` | `getTransportModes()` Gets all elements of `RouteOptions.TransportMode` associated with this adapter.
    `abstract boolean` | `isContentVisible()` Indicates whether the content is visible.
    `void` | `setTransportModes(java.util.List<com.here.android.mpa.routing.RouteOptions.TransportMode> transportModes)` Sets a list containing elements of `RouteOptions.TransportMode` that should be associated with this adapter.

    - ### Methods inherited from class androidx.fragment.app.FragmentStatePagerAdapter

      `destroyItem, finishUpdate, instantiateItem, isViewFromObject, restoreState, saveState, setPrimaryItem, startUpdate`

    - ### Methods inherited from class androidx.viewpager.widget.PagerAdapter

      `destroyItem, finishUpdate, getPageWidth, instantiateItem, notifyDataSetChanged, registerDataSetObserver, setPrimaryItem, startUpdate, unregisterDataSetObserver`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TransportModePanelAdapter

          public TransportModePanelAdapter(androidx.fragment.app.FragmentManager manager)

      Constructs a new instance using a `FragmentManager`.

      Please set the transport modes list by calling `setTransportModes(List)` and update the UI by calling `PagerAdapter.notifyDataSetChanged()`.

      Parameters:
        `manager` - the required `FragmentManager`.

    - #### TransportModePanelAdapter

          public TransportModePanelAdapter(androidx.fragment.app.FragmentManager manager,
                                           java.util.List<com.here.android.mpa.routing.RouteOptions.TransportMode> transportModes)

      Constructs a new instance using a `FragmentManager` and a list of `RouteOptions.TransportMode`.
      Parameters:
        `manager` - the required `FragmentManager`.
        `transportModes` - the list to use for this adapter.

  - ### Method Detail

    - #### getItem

          public androidx.fragment.app.Fragment getItem(int position)

      Specified by:
        `getItem` in class `androidx.fragment.app.FragmentStatePagerAdapter`

    - #### getCount

          public int getCount()

      Specified by:
        `getCount` in class `androidx.viewpager.widget.PagerAdapter`

    - #### getPageTitle

          public java.lang.CharSequence getPageTitle(int position)

      Overrides:
        `getPageTitle` in class `androidx.viewpager.widget.PagerAdapter`

    - #### getTabView

          public TabView getTabView(int position)

      Gets the custom `TabView` at a given position, which represents a `RouteOptions.TransportMode`. This method can be used to update `TabLayout.Tab` with the returned custom `TabView`.
      Parameters:
        `position` - the position to get the `TabView` from.
      Returns:
        the custom `TabView`.

    - #### getItemPosition

          public int getItemPosition(java.lang.Object object)

      Overrides:
        `getItemPosition` in class `androidx.viewpager.widget.PagerAdapter`

    - #### getTransportModes

          public java.util.List<com.here.android.mpa.routing.RouteOptions.TransportMode> getTransportModes()

      Gets all elements of `RouteOptions.TransportMode` associated with this adapter.
      Returns:
        the associated transport modes.

    - #### setTransportModes

          public void setTransportModes(java.util.List<com.here.android.mpa.routing.RouteOptions.TransportMode> transportModes)

      Sets a list containing elements of `RouteOptions.TransportMode` that should be associated with this adapter.
      Parameters:
        `transportModes` - the list of transport modes.

    - #### getContent

          public abstract androidx.fragment.app.Fragment getContent(com.here.android.mpa.routing.RouteOptions.TransportMode mode)

      Gets the fragment of `TransportModePanel`.

      If you don't want to display the content and only want to have a `TabView` in `TransportModePanel`, please return null and return false from `isContentVisible()` method.

      Parameters:
        `mode` - the `RouteOptions.TransportMode`.
      Returns:
        the fragment of the panel hosting the content.

    - #### getTabCustomView

          @Deprecated
          public abstract TabView getTabCustomView(com.here.android.mpa.routing.RouteOptions.TransportMode mode)

      Deprecated. Please use `getCustomTabView(com.here.android.mpa.routing.RouteOptions.TransportMode)` instead.
      Gets the `TabView` view for the given `RouteOptions.TransportMode`.
      Parameters:
        `mode` - the `RouteOptions.TransportMode`.
      Returns:
        the `TabView` that is used to represent the given transport mode.

    - #### getCustomTabView

          public abstract TabView getCustomTabView(com.here.android.mpa.routing.RouteOptions.TransportMode mode)

      Gets the `TabView` view for the given `RouteOptions.TransportMode`.
      Parameters:
        `mode` - the `RouteOptions.TransportMode`.
      Returns:
        the `TabView` that is used to represent the given transport mode.

    - #### isContentVisible

          public abstract boolean isContentVisible()

      Indicates whether the content is visible. This is responsible for showing the fragment hosting the content for a `RouteOptions.TransportMode` in the `TransportModePanel`. If the method returns false, the method `getItem(int)` will be ignored.
      Returns:
        true if content should be visible, false will hide the content.