com.here.msdkui.routing

## Class TravelTimePicker

- java.lang.Object
- - androidx.fragment.app.Fragment
  - - androidx.fragment.app.DialogFragment
    - - com.here.msdkui.routing.TravelTimePicker

- All Implemented Interfaces:
    android.content.ComponentCallbacks, android.content.DialogInterface.OnCancelListener, android.content.DialogInterface.OnDismissListener, android.view.View.OnCreateContextMenuListener, androidx.lifecycle.LifecycleOwner, androidx.lifecycle.ViewModelStoreOwner, androidx.savedstate.SavedStateRegistryOwner

      public class TravelTimePicker
      extends androidx.fragment.app.DialogFragment

  A dialog that shows a `DatePicker` and a `TimePicker` and allows to set a date, time and a `RouteOptions.TimeType` that could be used for route calculation. By default the selected time is of type `RouteOptions.TimeType.DEPARTURE`.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `TravelTimePicker.OnTimePickedListener` An interface definition for a callback to be invoked when a time was selected.
    `static class` | `TravelTimePicker.Variety` An enum that defines the `RouteOptions.TimeType` that can be set using this picker.

    - ### Nested classes/interfaces inherited from class androidx.fragment.app.Fragment

      `androidx.fragment.app.Fragment.InstantiationException, androidx.fragment.app.Fragment.SavedState`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `DAY`
    `static java.lang.String` | `HOUR`
    `static java.lang.String` | `MAX_DAY`
    `static java.lang.String` | `MIN_DAY`
    `static java.lang.String` | `MINUTE`
    `static java.lang.String` | `MONTH`
    `static java.lang.String` | `TAB_SELECTED`
    `static java.lang.String` | `TIME_DIALOG_OPEN`
    `static java.lang.String` | `TYPE`
    `static java.lang.String` | `YEAR`

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

      `STYLE_NO_FRAME, STYLE_NO_INPUT, STYLE_NO_TITLE, STYLE_NORMAL`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TravelTimePicker()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `android.widget.DatePicker` | `getDatePicker()` Gets the `DatePicker` associated with this instance.
    `long` | `getMaxDate()` Gets the maximal date supported by this instance in milliseconds since January 1, 1970 00:00:00 in `TimeZone.getDefault()` time zone.
    `long` | `getMinDate()` Gets the minimal date supported by this instance in milliseconds since January 1, 1970 00:00:00 in `TimeZone.getDefault()` time zone.
    `java.util.Date` | `getTime()` Gets the current date shown by this picker.
    `android.widget.TimePicker` | `getTimePicker()` Gets the `TimePicker` associated with this instance.
    `com.here.android.mpa.routing.RouteOptions.TimeType` | `getTimeType()` Gets the current set `RouteOptions.TimeType`.
    `TravelTimePicker.Variety` | `getVariety()` Gets the `TravelTimePicker.Variety`.
    `static TravelTimePicker` | `newInstance()` Constructs a new instance using the `TravelTimePicker.Variety.DEPARTURE` type by default.
    `static TravelTimePicker` | `newInstance(TravelTimePicker.Variety type)` Constructs a new instance using the given `TravelTimePicker.Variety`.
    `android.app.Dialog` | `onCreateDialog(android.os.Bundle savedInstanceState)`
    `void` | `onSaveInstanceState(android.os.Bundle outState)`
    `void` | `open(android.app.FragmentManager manager)` Deprecated. this method will not work from release 2.0. Please use `open(FragmentManager)` instead.
    `void` | `open(androidx.fragment.app.FragmentManager manager)` Shows this picker fragment using the current date.
    `void` | `open(android.app.FragmentManager manager, java.util.Date date)` Deprecated. this method will not work from release 2.0. Please use `open(FragmentManager, Date)` instead.
    `void` | `open(androidx.fragment.app.FragmentManager manager, java.util.Date date)` Shows this picker fragment using the given date.
    `TravelTimePicker` | `setMaxDate(long maxDate)` Sets the maximal date in milliseconds since January 1, 1970 00:00:00 in `TimeZone.getDefault()` time zone.
    `TravelTimePicker` | `setMinDate(long minDate)` Sets the minimal date in milliseconds since January 1, 1970 00:00:00 in `TimeZone.getDefault()` time zone.
    `void` | `setOnTimePickedListener(TravelTimePicker.OnTimePickedListener listener)` Sets the `TravelTimePanel.OnTimeChangedListener` to get notified when a time was selected.
    `void` | `setTime(java.util.Date time)` Sets a new date to be shown by this picker.
    `void` | `setTimeType(com.here.android.mpa.routing.RouteOptions.TimeType type)` Sets a new `RouteOptions.TimeType`.

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

      `dismiss, dismissAllowingStateLoss, getDialog, getShowsDialog, getTheme, isCancelable, onActivityCreated, onAttach, onCancel, onCreate, onDestroyView, onDetach, onDismiss, onGetLayoutInflater, onStart, onStop, requireDialog, setCancelable, setShowsDialog, setStyle, setupDialog, show, show, showNow`

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

      `dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLayoutInflater, getLifecycle, getLoaderManager, getParentFragment, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSavedStateRegistry, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, getViewLifecycleOwner, getViewLifecycleOwnerLiveData, getViewModelStore, hashCode, hasOptionsMenu, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isMenuVisible, isRemoving, isResumed, isStateSaved, isVisible, onActivityResult, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreateAnimation, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onCreateView, onDestroy, onDestroyOptionsMenu, onHiddenChanged, onInflate, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPause, onPictureInPictureModeChanged, onPrepareOptionsMenu, onPrimaryNavigationFragmentChanged, onRequestPermissionsResult, onResume, onViewCreated, onViewStateRestored, postponeEnterTransition, postponeEnterTransition, registerForContextMenu, requestPermissions, requireActivity, requireArguments, requireContext, requireFragmentManager, requireHost, requireParentFragment, requireView, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementReturnTransition, setTargetFragment, setUserVisibleHint, shouldShowRequestPermissionRationale, startActivity, startActivity, startActivityForResult, startActivityForResult, startIntentSenderForResult, startPostponedEnterTransition, toString, unregisterForContextMenu`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### HOUR

          public static final java.lang.String HOUR

      See Also:
        Constant Field Values

    - #### MINUTE

          public static final java.lang.String MINUTE

      See Also:
        Constant Field Values

    - #### YEAR

          public static final java.lang.String YEAR

      See Also:
        Constant Field Values

    - #### MONTH

          public static final java.lang.String MONTH

      See Also:
        Constant Field Values

    - #### DAY

          public static final java.lang.String DAY

      See Also:
        Constant Field Values

    - #### TYPE

          public static final java.lang.String TYPE

      See Also:
        Constant Field Values

    - #### TAB_SELECTED

          public static final java.lang.String TAB_SELECTED

      See Also:
        Constant Field Values

    - #### MIN_DAY

          public static final java.lang.String MIN_DAY

      See Also:
        Constant Field Values

    - #### MAX_DAY

          public static final java.lang.String MAX_DAY

      See Also:
        Constant Field Values

    - #### TIME_DIALOG_OPEN

          public static final java.lang.String TIME_DIALOG_OPEN

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### TravelTimePicker

          public TravelTimePicker()

  - ### Method Detail

    - #### newInstance

          public static TravelTimePicker newInstance()

      Constructs a new instance using the `TravelTimePicker.Variety.DEPARTURE` type by default.
      Returns:
        an instance of this class.

    - #### newInstance

          public static TravelTimePicker newInstance(TravelTimePicker.Variety type)

      Constructs a new instance using the given `TravelTimePicker.Variety`.
      Parameters:
        `type` - defines the `TravelTimePicker.Variety` time type.
      Returns:
        an instance of this class.

    - #### onCreateDialog

          public android.app.Dialog onCreateDialog(android.os.Bundle savedInstanceState)

      Overrides:
        `onCreateDialog` in class `androidx.fragment.app.DialogFragment`

    - #### open

          public void open(android.app.FragmentManager manager,
                           java.util.Date date)

      Deprecated. this method will not work from release 2.0. Please use `open(FragmentManager, Date)` instead.
      Shows this picker fragment using the given date.
      Parameters:
        `manager` - the `FragmentManager` where this fragment will be added to.
        `date` - the `Date` to set by default.

    - #### open

          public void open(android.app.FragmentManager manager)

      Deprecated. this method will not work from release 2.0. Please use `open(FragmentManager)` instead.
      Shows this picker fragment using the current date.
      Parameters:
        `manager` - the `FragmentManager` where this fragment will be added to.

    - #### open

          public void open(androidx.fragment.app.FragmentManager manager,
                           java.util.Date date)

      Shows this picker fragment using the given date.
      Parameters:
        `manager` - the `FragmentManager` where this fragment will be added to.
        `date` - the `Date` to set by default.

    - #### open

          public void open(androidx.fragment.app.FragmentManager manager)

      Shows this picker fragment using the current date.
      Parameters:
        `manager` - the `FragmentManager` where this fragment will be added to.

    - #### getTime

          public java.util.Date getTime()

      Gets the current date shown by this picker.
      Returns:
        the current set `Date`.

    - #### setTime

          public void setTime(java.util.Date time)

      Sets a new date to be shown by this picker.
      Parameters:
        `time` - the new `Date` to set.

    - #### getTimeType

          public com.here.android.mpa.routing.RouteOptions.TimeType getTimeType()

      Gets the current set `RouteOptions.TimeType`.

      Default is `RouteOptions.TimeType.DEPARTURE`.

      Returns:
        the current `RouteOptions.TimeType`.

    - #### setTimeType

          public void setTimeType(com.here.android.mpa.routing.RouteOptions.TimeType type)

      Sets a new `RouteOptions.TimeType`.

      Please note: Setting time type will not change `TravelTimePicker.Variety`.

      Parameters:
        `type` - the new `RouteOptions.TimeType` to set.

    - #### getDatePicker

          public android.widget.DatePicker getDatePicker()

      Gets the `DatePicker` associated with this instance.
      Returns:
        the `DatePicker`.

    - #### getTimePicker

          public android.widget.TimePicker getTimePicker()

      Gets the `TimePicker` associated with this instance.
      Returns:
        the `TimePicker`.

    - #### setMinDate

          public TravelTimePicker setMinDate(long minDate)

      Sets the minimal date in milliseconds since January 1, 1970 00:00:00 in `TimeZone.getDefault()` time zone.
      Parameters:
        `minDate` - the minimal supported date.
      Returns:
        an instance of this class.

    - #### setMaxDate

          public TravelTimePicker setMaxDate(long maxDate)

      Sets the maximal date in milliseconds since January 1, 1970 00:00:00 in `TimeZone.getDefault()` time zone.
      Parameters:
        `maxDate` - the maximal supported date.
      Returns:
        an instance of this class.

    - #### getMaxDate

          public long getMaxDate()

      Gets the maximal date supported by this instance in milliseconds since January 1, 1970 00:00:00 in `TimeZone.getDefault()` time zone.
      Returns:
        the maximal supported date if time was set, otherwise -1.

    - #### getMinDate

          public long getMinDate()

      Gets the minimal date supported by this instance in milliseconds since January 1, 1970 00:00:00 in `TimeZone.getDefault()` time zone.
      Returns:
        the minimal supported date if time was set, otherwise -1.

    - #### getVariety

          public TravelTimePicker.Variety getVariety()

      Gets the `TravelTimePicker.Variety`.
      Returns:
        the `TravelTimePicker.Variety` that is currently set.

    - #### onSaveInstanceState

          public void onSaveInstanceState(android.os.Bundle outState)

      Overrides:
        `onSaveInstanceState` in class `androidx.fragment.app.DialogFragment`

    - #### setOnTimePickedListener

          public void setOnTimePickedListener(TravelTimePicker.OnTimePickedListener listener)

      Sets the `TravelTimePanel.OnTimeChangedListener` to get notified when a time was selected.
      Parameters:
        `listener` - the `TravelTimePicker.OnTimePickedListener` to set.