Package eltos.simpledialogfragment.list
Klasse CustomListDialog<This extends CustomListDialog<This>>
java.lang.Object
androidx.fragment.app.Fragment
androidx.fragment.app.DialogFragment
eltos.simpledialogfragment.SimpleDialog<This>
eltos.simpledialogfragment.CustomViewDialog<This>
eltos.simpledialogfragment.list.CustomListDialog<This>
- Alle implementierten Schnittstellen:
android.content.ComponentCallbacks
,android.content.DialogInterface.OnCancelListener
,android.content.DialogInterface.OnDismissListener
,android.view.View.OnCreateContextMenuListener
,android.widget.AdapterView.OnItemClickListener
,android.widget.AdapterView.OnItemLongClickListener
,androidx.activity.result.ActivityResultCaller
,androidx.lifecycle.HasDefaultViewModelProviderFactory
,androidx.lifecycle.LifecycleOwner
,androidx.lifecycle.ViewModelStoreOwner
,androidx.savedstate.SavedStateRegistryOwner
- Bekannte direkte Unterklassen:
SimpleColorDialog
,SimpleListDialog
public abstract class CustomListDialog<This extends CustomListDialog<This>>
extends CustomViewDialog<This>
implements android.widget.AdapterView.OnItemClickListener, android.widget.AdapterView.OnItemLongClickListener
A dialog that displays a list of items.
MULTI_CHOICE and SINGLE_CHOICE modes are supported.
Specify your custom adapter
Result: SELECTED_POSITIONS Integer ArrayList selected item positions SELECTED_IDS Long[] selected item ids In SINGLE_CHOICE and SINGLE_CHOICE_DIRECT mode also: SELECTED_SINGLE_POSITION int selected item position SELECTED_SINGLE_ID long selected item id
Created by eltos on 02.01.2017.
-
Verschachtelte Klassen - Übersicht
Von Klasse geerbte verschachtelte Klassen/Schnittstellen eltos.simpledialogfragment.SimpleDialog
SimpleDialog.OnDialogResultListener
Von Klasse geerbte verschachtelte Klassen/Schnittstellen androidx.fragment.app.Fragment
androidx.fragment.app.Fragment.InstantiationException, androidx.fragment.app.Fragment.SavedState
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungprotected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected AdvancedAdapter
<?> protected android.widget.EditText
protected android.widget.AbsListView
static final int
static final int
static final String
Key for a long[] returned byonResult(int)
static final String
Key for an ArrayList<Integer> returned byonResult(int)
static final String
Key for a long returned byonResult(int)
in single choice modestatic final String
Key for an int returned byonResult(int)
in single choice modestatic final int
static final int
protected static final String
Von Klasse geerbte Felder eltos.simpledialogfragment.SimpleDialog
BUNDLE, CANCELABLE, FULLSCREEN, HTML, ICON_RESOURCE, MESSAGE, NEGATIVE_BUTTON_TEXT, NEUTRAL_BUTTON_TEXT, POSITIVE_BUTTON_TEXT, THEME, TITLE
Von Klasse geerbte Felder androidx.fragment.app.DialogFragment
STYLE_NO_FRAME, STYLE_NO_INPUT, STYLE_NO_TITLE, STYLE_NORMAL
Von Klasse geerbte Felder androidx.fragment.app.Fragment
mPreviousWho
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungchoiceIdPreset
(long id) Sets the initially checked item by its idchoiceIdPreset
(long[] ids) Sets the initially checked items by their idschoiceIdPreset
(List<Long> ids) Sets the initially checked items by their idschoiceMax
(int count) Sets the maximum allowed choices for the positive button to become enabledchoiceMin
(int count) Sets the minimum required choices for the positive button to become enabledchoiceMode
(int mode) Sets the list choice modechoicePreset
(int position) Sets the initially checked item positionchoicePreset
(int[] positions) Sets the initially checked item positionschoicePreset
(List<Integer> positions) Sets the initially checked item positionsdivider
(boolean show) Sets the visibility of the divideremptyText
(int titleResourceId) Sets a string to be displayed if no items are currently visibleemptyText
(CharSequence title) Sets a string to be displayed if no items are currently visiblefilterable
(boolean enabled) If set to true, show an input field at the to of the list and allow the user to filter the listprotected android.widget.AbsListView
grid()
Change the list into a grid list view (grid mode)gridColumnWidth
(int columnWidthDimenResId) Specifies the column with of this grid view (only if in grid mode)gridNumColumn
(int numColumns) Specifies the number of columns of this grid view (only if in grid mode)protected void
protected abstract AdvancedAdapter
Overwrite this method to provide a custom adapterprotected android.view.View
onCreateContentView
(android.os.Bundle savedInstanceState) Inflate your custom view here.protected void
Overwrite this method to take action once the dialog is shown such as settings an input focus, showing the keyboard or setting the initial positiveButtonStatevoid
onItemClick
(android.widget.AdapterView<?> parent, android.view.View view, int position, long id) Callback method to be invoked when an item in this AdapterView has been clicked.boolean
onItemLongClick
(android.widget.AdapterView<?> parent, android.view.View view, int position, long id) Callback method to be invoked when an item in this view has been clicked and held.protected android.os.Bundle
onResult
(int which) Overwrite this method to provide additional results from your custom view to be passed to theSimpleDialog.OnDialogResultListener.onResult(java.lang.String, int, android.os.Bundle)
void
onSaveInstanceState
(android.os.Bundle outState) pos
(int positiveButtonResourceId) Sets this dialogs positive button textpos
(CharSequence positiveButton) Sets this dialogs positive button textprotected void
Von Klasse geerbte Methoden eltos.simpledialogfragment.CustomViewDialog
acceptsPositiveButtonPress, build, callResultListener, extractContentView, inflate, inflate, onCreate, onCreateDialog, onNegativeButtonClick, onNeutralButtonClick, onPositiveButtonClick, pressPositiveButton, setNegativeButtonEnabled, setNeutralButtonEnabled, setPositiveButtonEnabled
Von Klasse geerbte Methoden eltos.simpledialogfragment.SimpleDialog
cancelable, extra, fullscreen, fullscreen, getArgs, getArgString, getContext, getExtras, getMessage, getTitle, icon, isCancelable, msg, msg, msgHtml, msgHtml, neg, neg, neg, neut, neut, neut, onCancel, onDestroyView, setArg, setArg, setArg, setArg, setButtonClickListener, setButtonEnabled, show, show, show, show, show, show, show, show, showKeyboard, theme, title, title
Von Klasse geerbte Methoden androidx.fragment.app.DialogFragment
dismiss, dismissAllowingStateLoss, dismissNow, getDialog, getShowsDialog, getTheme, onActivityCreated, onAttach, onDetach, onDismiss, onGetLayoutInflater, onStart, onStop, onViewStateRestored, requireDialog, setCancelable, setShowsDialog, setStyle, setupDialog, showNow
Von Klasse geerbte Methoden androidx.fragment.app.Fragment
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getDefaultViewModelCreationExtras, getDefaultViewModelProviderFactory, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLayoutInflater, getLifecycle, getLoaderManager, getParentFragment, getParentFragmentManager, 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, postponeEnterTransition, postponeEnterTransition, registerForActivityResult, registerForActivityResult, 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
-
Felddetails
-
TAG
- Siehe auch:
-
NO_CHOICE
public static final int NO_CHOICE- Siehe auch:
-
SINGLE_CHOICE
public static final int SINGLE_CHOICE- Siehe auch:
-
SINGLE_CHOICE_DIRECT
public static final int SINGLE_CHOICE_DIRECT- Siehe auch:
-
MULTI_CHOICE
public static final int MULTI_CHOICE- Siehe auch:
-
SELECTED_IDS
Key for a long[] returned byonResult(int)
- Siehe auch:
-
SELECTED_POSITIONS
Key for an ArrayList<Integer> returned byonResult(int)
- Siehe auch:
-
SELECTED_SINGLE_ID
Key for a long returned byonResult(int)
in single choice mode- Siehe auch:
-
SELECTED_SINGLE_POSITION
Key for an int returned byonResult(int)
in single choice mode- Siehe auch:
-
CHOICE_MODE
- Siehe auch:
-
CHOICE_MIN_COUNT
- Siehe auch:
-
CHOICE_MAX_COUNT
- Siehe auch:
-
INITIALLY_CHECKED_POSITIONS
- Siehe auch:
-
INITIALLY_CHECKED_IDS
- Siehe auch:
-
mListView
protected android.widget.AbsListView mListView -
mAdapter
-
mFilterEditText
protected android.widget.EditText mFilterEditText
-
-
Konstruktordetails
-
CustomListDialog
public CustomListDialog()
-
-
Methodendetails
-
onCreateAdapter
Overwrite this method to provide a custom adapter- Gibt zurück:
- the ListAdapter to use
-
choiceMode
Sets the list choice mode- Parameter:
mode
- one ofNO_CHOICE
,SINGLE_CHOICE
,SINGLE_CHOICE_DIRECT
orMULTI_CHOICE
- Gibt zurück:
- this instance
-
choiceMin
Sets the minimum required choices for the positive button to become enabled- Parameter:
count
- the minimum required choices- Gibt zurück:
- this instance
-
choiceMax
Sets the maximum allowed choices for the positive button to become enabled- Parameter:
count
- the maximum allowed choices- Gibt zurück:
- this instance
-
choicePreset
Sets the initially checked item positions- Parameter:
positions
- the initially checked positions- Gibt zurück:
- this instance
-
choicePreset
Sets the initially checked item positions- Parameter:
positions
- the initially checked positions- Gibt zurück:
- this instance
-
choicePreset
Sets the initially checked item position- Parameter:
position
- the initially checked position- Gibt zurück:
- this instance
-
choiceIdPreset
Sets the initially checked items by their ids- Parameter:
ids
- the initially checked item ids- Gibt zurück:
- this instance
-
choiceIdPreset
Sets the initially checked items by their ids- Parameter:
ids
- the initially checked item ids- Gibt zurück:
- this instance
-
choiceIdPreset
Sets the initially checked item by its id- Parameter:
id
- the initially checked item id- Gibt zurück:
- this instance
-
grid
Change the list into a grid list view (grid mode)- Gibt zurück:
- this instance
-
gridNumColumn
Specifies the number of columns of this grid view (only if in grid mode)- Parameter:
numColumns
- the number of columns- Gibt zurück:
- this instance
-
gridColumnWidth
Specifies the column with of this grid view (only if in grid mode)- Parameter:
columnWidthDimenResId
- the with as an android dimension resource identifier- Gibt zurück:
- this instance
-
divider
Sets the visibility of the divider- Parameter:
show
- whether to display a divider or not- Gibt zurück:
- this instance
-
filterable
If set to true, show an input field at the to of the list and allow the user to filter the list- Parameter:
enabled
- whether to allow filtering or not- Gibt zurück:
- this instance
-
emptyText
Sets a string to be displayed if no items are currently visible- Parameter:
title
- the string to be displayed- Gibt zurück:
- this instance
-
emptyText
Sets a string to be displayed if no items are currently visible- Parameter:
titleResourceId
- the android string resource to be displayed- Gibt zurück:
- this instance
-
pos
Beschreibung aus Klasse kopiert:SimpleDialog
Sets this dialogs positive button text- Setzt außer Kraft:
pos
in KlasseSimpleDialog<This extends CustomListDialog<This>>
- Parameter:
positiveButton
- the text as string- Gibt zurück:
- this instance
-
pos
Beschreibung aus Klasse kopiert:SimpleDialog
Sets this dialogs positive button text- Setzt außer Kraft:
pos
in KlasseSimpleDialog<This extends CustomListDialog<This>>
- Parameter:
positiveButtonResourceId
- the text as android string resource- Gibt zurück:
- this instance
-
onItemClick
public void onItemClick(android.widget.AdapterView<?> parent, android.view.View view, int position, long id) Callback method to be invoked when an item in this AdapterView has been clicked. Implementers can call Adapter#getItem(position) if they need to access the data associated with the selected item.- Angegeben von:
onItemClick
in Schnittstelleandroid.widget.AdapterView.OnItemClickListener
- Parameter:
parent
- The AdapterView where the click happened.view
- The view within the AdapterView that was clicked (this will be a view provided by the adapter)position
- The position of the view in the adapter.id
- The row id of the item that was clicked.
-
onItemLongClick
public boolean onItemLongClick(android.widget.AdapterView<?> parent, android.view.View view, int position, long id) Callback method to be invoked when an item in this view has been clicked and held.Implementers can call Adapter#getItem(position) if they need to access the data associated with the selected item.
- Angegeben von:
onItemLongClick
in Schnittstelleandroid.widget.AdapterView.OnItemLongClickListener
- Parameter:
parent
- The AbsListView where the click happenedview
- The view within the AbsListView that was clickedposition
- The position of the view in the listid
- The row id of the item that was clicked- Gibt zurück:
- true if the callback consumed the long click, false otherwise
-
onCreateContentView
protected android.view.View onCreateContentView(android.os.Bundle savedInstanceState) Beschreibung aus Klasse kopiert:CustomViewDialog
Inflate your custom view here.- Angegeben von:
onCreateContentView
in KlasseCustomViewDialog<This extends CustomListDialog<This>>
- Parameter:
savedInstanceState
- The last saved instance state of the Fragment, or null if this fragment is created for the first time.- Gibt zurück:
- Return a new View to be displayed by the Fragment.
-
getListView
protected android.widget.AbsListView getListView() -
notifyDataSetChanged
protected void notifyDataSetChanged() -
onDialogShown
protected void onDialogShown()Beschreibung aus Klasse kopiert:CustomViewDialog
Overwrite this method to take action once the dialog is shown such as settings an input focus, showing the keyboard or setting the initial positiveButtonState- Setzt außer Kraft:
onDialogShown
in KlasseCustomViewDialog<This extends CustomListDialog<This>>
-
updatePosButton
protected void updatePosButton() -
onResult
protected android.os.Bundle onResult(int which) Beschreibung aus Klasse kopiert:CustomViewDialog
Overwrite this method to provide additional results from your custom view to be passed to theSimpleDialog.OnDialogResultListener.onResult(java.lang.String, int, android.os.Bundle)
- Setzt außer Kraft:
onResult
in KlasseCustomViewDialog<This extends CustomListDialog<This>>
- Parameter:
which
- seeSimpleDialog.OnDialogResultListener
- Gibt zurück:
- the bundle to merge with the results or null
-
onSaveInstanceState
public void onSaveInstanceState(android.os.Bundle outState) - Setzt außer Kraft:
onSaveInstanceState
in Klasseandroidx.fragment.app.DialogFragment
-