idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
41,200
private void obtainShowDialogDividersOnScroll ( final TypedArray typedArray ) { showDialogDividersOnScroll ( typedArray . getBoolean ( R . styleable . DialogPreference_showDialogDividersOnScroll , true ) ) ; }
Obtains whether the dividers which are shown above and below the list view of the preference s dialog should be shown when the list view is scrolled or not from a specific typed array .
41,201
private void requestInputMode ( ) { if ( needInputMethod ( ) ) { Window window = dialog . getWindow ( ) ; if ( window != null ) { window . setSoftInputMode ( WindowManager . LayoutParams . SOFT_INPUT_STATE_ALWAYS_VISIBLE ) ; } } }
Requests the soft input method to be shown .
41,202
protected AbstractButtonBarDialog createDialog ( final AbstractButtonBarDialogBuilder < ? , ? > dialogBuilder ) { return ( ( MaterialDialog . Builder ) dialogBuilder ) . create ( ) ; }
The method which is invoked on subclasses when the preference s dialog is about to be created . The builder which is passed as a method parameter may be manipulated by subclasses in order to change the appearance of the dialog . When views are inflated inside this method the context of the builder should be used in order to ensure that the dialog s theme is used .
41,203
public final void setDialogMargin ( final int left , final int top , final int right , final int bottom ) { this . dialogMargin = new int [ ] { left , top , right , bottom } ; }
Sets the margin of the preference s dialog .
41,204
public final void setDialogPadding ( final int left , final int top , final int right , final int bottom ) { Condition . INSTANCE . ensureAtLeast ( left , 0 , "The left padding must be at least 0" ) ; Condition . INSTANCE . ensureAtLeast ( top , 0 , "The top padding must be at least 0" ) ; Condition . INSTANCE . ensureAtLeast ( right , 0 , "The right padding must be at least 0" ) ; Condition . INSTANCE . ensureAtLeast ( bottom , 0 , "The bottom padding must be at least 0" ) ; this . dialogPadding = new int [ ] { left , top , right , bottom } ; }
Sets the padding of the preference s dialog .
41,205
public final void setDialogFitsSystemWindows ( final boolean left , final boolean top , final boolean right , final boolean bottom ) { this . dialogFitsSystemWindows = new boolean [ ] { left , top , right , bottom } ; }
Sets whether the preference s dialog should account for system screen decorations such as the status bar and inset its content or not .
41,206
public final void setDialogIconTintMode ( final PorterDuff . Mode mode ) { Condition . INSTANCE . ensureNotNull ( mode , "The dialog icon tint mode may not be null" ) ; this . dialogIconTintMode = mode ; }
Sets the mode which should be used to tint the icon of the preference s dialog .
41,207
public final void setDialogButtonTextColor ( final ColorStateList colorStateList ) { Condition . INSTANCE . ensureNotNull ( colorStateList , "The color state list may not be null" ) ; this . dialogButtonTextColor = colorStateList ; }
Sets the text color of the buttons of the preference s dialog .
41,208
public final void setDialogBackgroundColor ( final int color ) { this . dialogBackground = new ColorDrawable ( color ) ; this . dialogBackgroundBitmap = null ; this . dialogBackgroundId = - 1 ; this . dialogBackgroundColor = color ; }
Sets the background color of the preference s dialog .
41,209
public final void setDialogHeaderBackgroundColor ( final int color ) { this . dialogHeaderBackground = new ColorDrawable ( color ) ; this . dialogHeaderBackgroundBitmap = null ; this . dialogHeaderBackgroundId = - 1 ; this . dialogHeaderBackgroundColor = color ; }
Sets the background color of the header of the preference s dialog .
41,210
public final void setDialogHeaderIconTintMode ( final PorterDuff . Mode mode ) { Condition . INSTANCE . ensureNotNull ( mode , "The dialog icon tint mode may not be null" ) ; this . dialogHeaderIconTintMode = mode ; }
Sets the mode which should be used to tint the icon of the header of the preference s dialog .
41,211
public final void setDialogScrollableArea ( final Area top , final Area bottom ) { this . dialogScrollableArea = ScrollableArea . create ( top , bottom ) ; }
Sets the scrollable area of the preference s dialog .
41,212
private void obtainUseInputMethod ( final TypedArray typedArray ) { boolean defaultValue = getContext ( ) . getResources ( ) . getBoolean ( R . bool . number_picker_preference_default_use_input_method ) ; useInputMethod ( typedArray . getBoolean ( R . styleable . AbstractNumberPickerPreference_useInputMethod , defaultValue ) ) ; }
Obtains whether an input method should be used or not from a specific typed array .
41,213
private void obtainHint ( final TypedArray typedArray ) { setHint ( typedArray . getText ( R . styleable . EditTextPreference_android_hint ) ) ; }
Obtains the hint of the edit text widget which is shown in the preference s dialog from a specific typed array .
41,214
public final void setText ( final String text ) { boolean hasDisabledDependents = shouldDisableDependents ( ) ; this . text = text ; persistString ( text ) ; boolean isDisablingDependents = shouldDisableDependents ( ) ; if ( isDisablingDependents != hasDisabledDependents ) { notifyDependencyChange ( isDisablingDependents ) ; } notifyChanged ( ) ; }
Sets the current text of the preference . By setting a value it will be persisted .
41,215
private Set < String > getPersistedSet ( final Set < String > defaultValue ) { if ( ! shouldPersist ( ) ) { return defaultValue ; } return getPreferenceManager ( ) . getSharedPreferences ( ) . getStringSet ( getKey ( ) , defaultValue ) ; }
Loads and returns the currently persisted set which belongs to the preference s key from the shared preferences .
41,216
private List < Integer > indicesOf ( final Set < String > values ) { List < Integer > indices = new ArrayList < > ( ) ; if ( values != null && getEntryValues ( ) != null ) { for ( String value : values ) { int index = indexOf ( value ) ; if ( index >= 0 ) { indices . add ( index ) ; } } } return indices ; }
Return the indices of the entries which correspond to specific values .
41,217
private boolean persistSet ( final Set < String > set ) { if ( set != null && shouldPersist ( ) ) { if ( set . equals ( getPersistedSet ( null ) ) ) { return true ; } Editor editor = getPreferenceManager ( ) . getSharedPreferences ( ) . edit ( ) ; editor . putStringSet ( getKey ( ) , set ) ; editor . apply ( ) ; return true ; } return false ; }
Persists a specific set in the shared preferences by using the preference s key .
41,218
private OnMultiChoiceClickListener createListItemListener ( ) { return new OnMultiChoiceClickListener ( ) { public void onClick ( final DialogInterface dialog , final int which , final boolean isChecked ) { if ( isChecked ) { selectedIndices . add ( which ) ; } else { selectedIndices . remove ( which ) ; } } } ; }
Creates and returns a listener which allows to observe when list items are selected or unselected by the user .
41,219
public final void setValues ( final Set < String > values ) { if ( values != null && ! values . equals ( this . values ) ) { this . values = values ; persistSet ( this . values ) ; notifyChanged ( ) ; } }
Sets the current values of the preference . By setting values they will be persisted .
41,220
public final void addValue ( final String value ) { Condition . INSTANCE . ensureNotNull ( value , "The value may not be null" ) ; if ( this . values != null ) { if ( this . values . add ( value ) ) { if ( persistSet ( this . values ) ) { notifyChanged ( ) ; } } } else { Set < String > newValues = new HashSet < > ( ) ; newValues . add ( value ) ; setValues ( newValues ) ; } }
Adds a new value to the preference . By adding a value the changes will be persisted .
41,221
public final void removeValue ( final String value ) { Condition . INSTANCE . ensureNotNull ( value , "The value may not be null" ) ; if ( this . values != null ) { if ( this . values . remove ( value ) ) { if ( persistSet ( this . values ) ) { notifyChanged ( ) ; } } } }
Removes a specific value from the preference . By removing a value the changes will be persisted .
41,222
public final void addAllValues ( final Collection < String > values ) { Condition . INSTANCE . ensureNotNull ( values , "The values may not be null" ) ; if ( this . values != null ) { if ( this . values . addAll ( values ) ) { if ( persistSet ( this . values ) ) { notifyChanged ( ) ; } } } else { Set < String > newValues = new HashSet < > ( values ) ; setValues ( newValues ) ; } }
Adds all values which are contained by a specific collection to the preference . By adding values the changes will be persisted .
41,223
public final void removeAllValues ( final Collection < String > values ) { Condition . INSTANCE . ensureNotNull ( values , "The values may not be null" ) ; if ( this . values != null ) { if ( this . values . removeAll ( values ) ) { if ( persistSet ( this . values ) ) { notifyChanged ( ) ; } } } }
Removes all values which are contained by a specific collection from the preference . By removing values the changes will be persisted .
41,224
public final CharSequence [ ] getSelectedEntries ( ) { List < Integer > indices = indicesOf ( values ) ; Collections . sort ( indices ) ; if ( ! indices . isEmpty ( ) ) { CharSequence [ ] selectedEntries = new CharSequence [ indices . size ( ) ] ; int currentIndex = 0 ; for ( int index : indices ) { selectedEntries [ currentIndex ] = getEntries ( ) [ index ] ; currentIndex ++ ; } return selectedEntries ; } return null ; }
Returns the entries the currently persisted values of the preference belong to .
41,225
private void obtainShowPreview ( final TypedArray typedArray ) { boolean defaultValue = getContext ( ) . getResources ( ) . getBoolean ( R . bool . color_picker_preference_default_show_preview ) ; showPreview ( typedArray . getBoolean ( R . styleable . AbstractColorPickerPreference_showPreview , defaultValue ) ) ; }
Obtains the boolean value which specifies whether a preview of the preference s color should be shown or not from a specific typed array .
41,226
private void obtainPreviewSize ( final TypedArray typedArray ) { int defaultValue = getContext ( ) . getResources ( ) . getDimensionPixelSize ( R . dimen . color_picker_preference_default_preview_size ) ; setPreviewSize ( typedArray . getDimensionPixelSize ( R . styleable . AbstractColorPickerPreference_previewSize , defaultValue ) ) ; }
Obtains the size of the preview of the preference s color from a specific typed array .
41,227
private void obtainPreviewShape ( final TypedArray typedArray ) { int defaultValue = getContext ( ) . getResources ( ) . getInteger ( R . integer . color_picker_preference_default_preview_shape ) ; setPreviewShape ( PreviewShape . fromValue ( typedArray . getInteger ( R . styleable . AbstractColorPickerPreference_previewShape , defaultValue ) ) ) ; }
Obtains the shape of the preview of the preference s color from a specific typed array .
41,228
private void obtainPreviewBorderWidth ( final TypedArray typedArray ) { int defaultValue = getContext ( ) . getResources ( ) . getDimensionPixelSize ( R . dimen . color_picker_preference_default_preview_border_width ) ; setPreviewBorderWidth ( typedArray . getDimensionPixelSize ( R . styleable . AbstractColorPickerPreference_previewBorderWidth , defaultValue ) ) ; }
Obtains the border width of the preview of the preference s color from a specific typed array .
41,229
private void obtainPreviewBorderColor ( final TypedArray typedArray ) { int defaultValue = ContextCompat . getColor ( getContext ( ) , R . color . color_picker_preference_default_preview_border_color ) ; setPreviewBorderColor ( typedArray . getColor ( R . styleable . AbstractColorPickerPreference_previewBorderColor , defaultValue ) ) ; }
Obtains the border color of the preview of the preference s color from a specific typed array .