public class TimePickerDialog extends DialogFragment implements RadialPickerLayout.OnValueSelectedListener
Modifier and Type | Class and Description |
---|---|
static interface |
TimePickerDialog.OnTimeSetListener
The callback interface used to indicate the user is done filling in
the time (they clicked on the 'Set' button).
|
Fragment.InstantiationException, Fragment.SavedState
Modifier and Type | Field and Description |
---|---|
static int |
AM |
static int |
AMPM_INDEX |
static int |
ENABLE_PICKER_INDEX |
static int |
HOUR_INDEX |
static int |
MINUTE_INDEX |
static int |
PM |
STYLE_NO_FRAME, STYLE_NO_INPUT, STYLE_NO_TITLE, STYLE_NORMAL
TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDEN
Constructor and Description |
---|
TimePickerDialog() |
TimePickerDialog(Context context,
int theme,
TimePickerDialog.OnTimeSetListener callback,
int hourOfDay,
int minute,
boolean is24HourMode) |
Modifier and Type | Method and Description |
---|---|
void |
initialize(TimePickerDialog.OnTimeSetListener callback,
int hourOfDay,
int minute,
boolean is24HourMode) |
boolean |
isThemeDark() |
static TimePickerDialog |
newInstance(TimePickerDialog.OnTimeSetListener callback,
int hourOfDay,
int minute,
boolean is24HourMode) |
void |
onCreate(Bundle savedInstanceState)
Called to do initial creation of a fragment.
|
View |
onCreateView(LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState)
Called to have the fragment instantiate its user interface view.
|
void |
onPause()
Called when the Fragment is no longer resumed.
|
void |
onResume()
Called when the fragment is visible to the user and actively running.
|
void |
onSaveInstanceState(Bundle outState)
Called to ask the fragment to save its current dynamic state, so it
can later be reconstructed in a new instance of its process is
restarted.
|
void |
onValueSelected(int pickerIndex,
int newValue,
boolean autoAdvance)
Called by the picker for updating the header display.
|
void |
setOnTimeSetListener(TimePickerDialog.OnTimeSetListener callback) |
void |
setStartTime(int hourOfDay,
int minute) |
void |
setThemeDark(boolean dark)
Set a dark or light theme.
|
void |
tryVibrate() |
dismiss, dismissAllowingStateLoss, dump, getDialog, getLayoutInflater, getShowsDialog, getTheme, isCancelable, onActivityCreated, onAttach, onCancel, onCreateDialog, onDestroyView, onDetach, onDismiss, onStart, onStop, setCancelable, setShowsDialog, setStyle, show, show, showAllowingStateLoss
equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLoaderManager, getParentFragment, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, hashCode, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isRemoving, isResumed, isVisible, onActivityResult, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroy, onDestroyOptionsMenu, onHiddenChanged, onInflate, onInflate, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPictureInPictureModeChanged, onPrepareOptionsMenu, onRequestPermissionsResult, onTrimMemory, onViewCreated, onViewStateRestored, registerForContextMenu, requestPermissions, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setArguments, setEnterSharedElementCallback, setEnterSharedElementTransitionCallback, setEnterTransition, setExitSharedElementCallback, setExitSharedElementTransitionCallback, setExitTransition, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementReturnTransition, setTargetFragment, setUserVisibleHint, shouldShowRequestPermissionRationale, startActivity, startActivity, startActivityForResult, startActivityForResult, startIntentSenderForResult, toString, unregisterForContextMenu
public static final int HOUR_INDEX
public static final int MINUTE_INDEX
public static final int AMPM_INDEX
public static final int ENABLE_PICKER_INDEX
public static final int AM
public static final int PM
public TimePickerDialog()
public TimePickerDialog(Context context, int theme, TimePickerDialog.OnTimeSetListener callback, int hourOfDay, int minute, boolean is24HourMode)
public static TimePickerDialog newInstance(TimePickerDialog.OnTimeSetListener callback, int hourOfDay, int minute, boolean is24HourMode)
public void initialize(TimePickerDialog.OnTimeSetListener callback, int hourOfDay, int minute, boolean is24HourMode)
public void setThemeDark(boolean dark)
public boolean isThemeDark()
public void setOnTimeSetListener(TimePickerDialog.OnTimeSetListener callback)
public void setStartTime(int hourOfDay, int minute)
public void onCreate(Bundle savedInstanceState)
Fragment
Fragment.onAttach(Activity)
and before
Fragment.onCreateView(LayoutInflater, ViewGroup, Bundle)
, but is not called if the fragment
instance is retained across Activity re-creation (see Fragment.setRetainInstance(boolean)
).
Note that this can be called while the fragment's activity is
still in the process of being created. As such, you can not rely
on things like the activity's content view hierarchy being initialized
at this point. If you want to do work once the activity itself is
created, see Fragment.onActivityCreated(Bundle)
.
If your app's targetSdkVersion
is Build.VERSION_CODES.M
or lower, child fragments being restored from the savedInstanceState are restored after
onCreate
returns. When targeting Build.VERSION_CODES.N
or
above and running on an N or newer platform version
they are restored by Fragment.onCreate
.
onCreate
in class DialogFragment
savedInstanceState
- If the fragment is being re-created from
a previous saved state, this is the state.public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
Fragment
Fragment.onCreate(Bundle)
and Fragment.onActivityCreated(Bundle)
.
If you return a View from here, you will later be called in
Fragment.onDestroyView()
when the view is being released.
onCreateView
in class Fragment
inflater
- The LayoutInflater object that can be used to inflate
any views in the fragment,container
- If non-null, this is the parent view that the fragment's
UI should be attached to. The fragment should not add the view itself,
but this can be used to generate the LayoutParams of the view.savedInstanceState
- If non-null, this fragment is being re-constructed
from a previous saved state as given here.public void onResume()
Fragment
Activity.onResume
of the containing
Activity's lifecycle.public void onPause()
Fragment
Activity.onPause
of the containing
Activity's lifecycle.public void tryVibrate()
public void onSaveInstanceState(Bundle outState)
Fragment
Fragment.onCreate(Bundle)
,
Fragment.onCreateView(LayoutInflater, ViewGroup, Bundle)
, and
Fragment.onActivityCreated(Bundle)
.
This corresponds to Activity.onSaveInstanceState(Bundle)
and most of the discussion there
applies here as well. Note however: this method may be called
at any time before Fragment.onDestroy()
. There are many situations
where a fragment may be mostly torn down (such as when placed on the
back stack with no UI showing), but its state will not be saved until
its owning activity actually needs to save its state.
onSaveInstanceState
in class DialogFragment
outState
- Bundle in which to place your saved state.public void onValueSelected(int pickerIndex, int newValue, boolean autoAdvance)
onValueSelected
in interface RadialPickerLayout.OnValueSelectedListener