idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
41,100
private void adaptIconTint ( ) { Drawable icon = getIcon ( ) ; if ( icon != null ) { DrawableCompat . setTintList ( icon , tintList ) ; DrawableCompat . setTintMode ( icon , tintMode ) ; } }
Adapts the tint of the preference s icon .
41,101
private void obtainTextColor ( final TypedArray typedArray ) { ColorStateList colorStateList = typedArray . getColorStateList ( R . styleable . ActionPreference_android_textColor ) ; if ( colorStateList == null ) { colorStateList = ContextCompat . getColorStateList ( getContext ( ) , R . color . action_preference_text_color ) ; } setTextColor ( colorStateList ) ; }
Obtains the text color of the preference s title from a specific typed array .
41,102
private void obtainNumberOfDigits ( final TypedArray typedArray ) { int defaultValue = getContext ( ) . getResources ( ) . getInteger ( R . integer . digit_picker_preference_default_number_of_digits ) ; setNumberOfDigits ( typedArray . getInteger ( R . styleable . DigitPickerPreference_numberOfDigits , defaultValue ) ) ; }
Obtains the number of digits of the numbers the preference allows to choose from a specific typed array .
41,103
private int getDigit ( final int index , final int number ) { String format = "%0" + getNumberOfDigits ( ) + "d" ; String formattedNumber = String . format ( Locale . getDefault ( ) , format , number ) ; String digit = formattedNumber . substring ( index , index + 1 ) ; return Integer . valueOf ( digit ) ; }
Returns the the digit which corresponds to a specific index of a number .
41,104
private int getMaxNumber ( final int numberOfDigits ) { int result = 0 ; for ( int i = 0 ; i < numberOfDigits ; i ++ ) { result += ( NUMERIC_SYTEM - 1 ) * Math . pow ( NUMERIC_SYTEM , i ) ; } return result ; }
Returns the maximum number which can be created with a specific number of digits .
41,105
public final void setNumberOfDigits ( final int numberOfDigits ) { Condition . INSTANCE . ensureAtLeast ( numberOfDigits , 1 , "The number of digits must be at least 1" ) ; this . numberOfDigits = numberOfDigits ; setNumber ( Math . min ( getNumber ( ) , getMaxNumber ( numberOfDigits ) ) ) ; }
Sets the number of digits of the numbers the preference should allow to choose .
41,106
private void obtainDecimals ( final TypedArray typedArray ) { int defaultValue = getContext ( ) . getResources ( ) . getInteger ( R . integer . seek_bar_preference_default_decimals ) ; setDecimals ( typedArray . getInteger ( R . styleable . SeekBarPreference_decimals , defaultValue ) ) ; }
Obtains the number of decimals of the floating point numbers the preference allows to choose from a specific typed array .
41,107
private void obtainMinValue ( final TypedArray typedArray ) { int defaultValue = getContext ( ) . getResources ( ) . getInteger ( R . integer . seek_bar_preference_default_min_value ) ; setMinValue ( typedArray . getInteger ( R . styleable . AbstractNumericPreference_min , defaultValue ) ) ; }
Obtains the minimum value the preference allows to choose from a specific typed array .
41,108
private void obtainMaxValue ( final TypedArray typedArray ) { int defaultValue = getContext ( ) . getResources ( ) . getInteger ( R . integer . seek_bar_preference_default_max_value ) ; setMaxValue ( typedArray . getInteger ( R . styleable . AbstractNumericPreference_android_max , defaultValue ) ) ; }
Obtains the maximum value the preference allows to choose from a specific typed array .
41,109
private void obtainUnit ( final TypedArray typedArray ) { setUnit ( typedArray . getText ( R . styleable . AbstractUnitPreference_unit ) ) ; }
Obtains the unit which is used for textual representation of the preference s value from a specific typed array .
41,110
private void obtainFloatingPointSeparator ( final TypedArray typedArray ) { setFloatingPointSeparator ( typedArray . getText ( R . styleable . SeekBarPreference_floatingPointSeparator ) ) ; }
Obtains the symbol which is used to separate floating point numbers for textual representation from a specific typed array .
41,111
private void obtainShowProgress ( final TypedArray typedArray ) { boolean defaultValue = getContext ( ) . getResources ( ) . getBoolean ( R . bool . seek_bar_preference_default_show_progress ) ; showProgress ( typedArray . getBoolean ( R . styleable . SeekBarPreference_showProgress , defaultValue ) ) ; }
Obtains the boolean value which specifies whether the progress of the seek bar should be shown from a specific typed array .
41,112
private void obtainSummaries ( final TypedArray typedArray ) { try { setSummaries ( typedArray . getTextArray ( R . styleable . SeekBarPreference_android_summary ) ) ; } catch ( Resources . NotFoundException e ) { setSummaries ( null ) ; } }
Obtains the summaries which are shown depending on the currently persisted value from a specific typed array .
41,113
private OnSeekBarChangeListener createSeekBarListener ( final TextView progressTextView ) { return new OnSeekBarChangeListener ( ) { public void onStopTrackingTouch ( final android . widget . SeekBar seekBar ) { } public void onStartTrackingTouch ( final android . widget . SeekBar seekBar ) { } public void onProgressChanged ( final android . widget . SeekBar seekBar , final int progress , final boolean fromUser ) { currentValue = ( float ) getMinValue ( ) + ( float ) progress / ( float ) getMultiplier ( ) ; currentValue = adaptToStepSize ( currentValue ) ; progressTextView . setText ( getProgressText ( currentValue ) ) ; } } ; }
Creates and returns a listener which allows to display the currently chosen value of the pereference s seek bar . The current value is internally stored but it will not become persisted until the user s confirmation .
41,114
private float adaptToStepSize ( final float value ) { if ( getStepSize ( ) > 0 ) { float offset = value - getMinValue ( ) ; float mod = offset % getStepSize ( ) ; float halfStepSize = ( float ) getStepSize ( ) / 2.0f ; float result = ( ( mod > halfStepSize ) ? offset + getStepSize ( ) - mod : offset - mod ) + getMinValue ( ) ; return Math . min ( result , getMaxValue ( ) ) ; } return value ; }
Adapts a specific value to the step size which is currently set . The value will be decreased or increased to the numerically closest value which matches the step size .
41,115
private String getProgressText ( final float value ) { NumberFormat numberFormat = NumberFormat . getInstance ( ) ; if ( getFloatingPointSeparator ( ) != null && numberFormat instanceof DecimalFormat ) { DecimalFormatSymbols decimalFormatSymbols = new DecimalFormatSymbols ( ) ; decimalFormatSymbols . setDecimalSeparator ( getFloatingPointSeparator ( ) . charAt ( 0 ) ) ; ( ( DecimalFormat ) numberFormat ) . setDecimalFormatSymbols ( decimalFormatSymbols ) ; } numberFormat . setMinimumFractionDigits ( getDecimals ( ) ) ; numberFormat . setMaximumFractionDigits ( getDecimals ( ) ) ; String valueString = numberFormat . format ( value ) ; if ( ! TextUtils . isEmpty ( getUnit ( ) ) ) { return valueString + " " + getUnit ( ) ; } return valueString ; }
Returns a textual representation of a specific value . The text is formatted depending on the decimal separator which is currently set and contains the unit if currently set .
41,116
public final void setMinValue ( final int minValue ) { Condition . INSTANCE . ensureSmaller ( minValue , getMaxValue ( ) , "The minimum value must be less than the maximum value" ) ; this . minValue = minValue ; setValue ( Math . max ( getValue ( ) , minValue ) ) ; }
Sets the minimum value the preference should allow to choose .
41,117
public final void setMaxValue ( final int maxValue ) { Condition . INSTANCE . ensureGreater ( maxValue , getMinValue ( ) , "The maximum value must be greater than the minimum value" ) ; this . maxValue = maxValue ; setValue ( Math . min ( getValue ( ) , maxValue ) ) ; }
Sets the maximum value the preference should allow to choose .
41,118
public final void setStepSize ( final int stepSize ) { if ( stepSize != - 1 ) { Condition . INSTANCE . ensureAtLeast ( stepSize , 1 , "The step size must be at least 1" ) ; Condition . INSTANCE . ensureAtMaximum ( stepSize , getRange ( ) , "The step size must be at maximum the range" ) ; } this . stepSize = stepSize ; setValue ( adaptToStepSize ( getValue ( ) ) ) ; }
Sets the step size the value should be increased or decreased by when moving the seek bar .
41,119
public final void setDecimals ( final int decimals ) { Condition . INSTANCE . ensureAtLeast ( decimals , 0 , "The decimals must be at least 0" ) ; this . decimals = decimals ; setValue ( roundToDecimals ( getValue ( ) ) ) ; }
Sets the number of decimals of the floating point numbers the preference should allow to choose . If the number of decimals is set to 0 the preference will only allow to choose integer values .
41,120
public final void setFloatingPointSeparator ( final CharSequence floatingPointSeparator ) { if ( floatingPointSeparator != null ) { Condition . INSTANCE . ensureAtMaximum ( floatingPointSeparator . length ( ) , 1 , "The floating point separator's length must be 1" ) ; } this . floatingPointSeparator = floatingPointSeparator ; }
Sets the symbol which should be used to separate floating point numbers for textual representation .
41,121
private void applyTheme ( ) { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . LOLLIPOP ) { setSeekBarColor ( ThemeUtil . getColor ( getContext ( ) , R . attr . colorAccent ) ) ; } }
Applies the attributes of the context s theme on the seek bar .
41,122
public final void setSeekBarColor ( final int color ) { this . seekBarColor = color ; ColorFilter colorFilter = new PorterDuffColorFilter ( color , Mode . SRC_IN ) ; getProgressDrawable ( ) . setColorFilter ( colorFilter ) ; getThumbDrawable ( ) . setColorFilter ( colorFilter ) ; }
Sets the color of the seek bar .
41,123
public final int indexOf ( final int color ) { for ( int i = 0 ; i < colorPalette . length ; i ++ ) { if ( colorPalette [ i ] == color ) { return i ; } } return - 1 ; }
Returns the index of a specific color .
41,124
private void obtainSwitchTextOn ( final TypedArray typedArray ) { setSwitchTextOn ( typedArray . getText ( R . styleable . SwitchPreference_android_switchTextOn ) ) ; }
Obtains the text which should be displayed on the preference s switch when it is checked from a specific typed array .
41,125
private void obtainSwitchTextOff ( final TypedArray typedArray ) { setSwitchTextOff ( typedArray . getText ( R . styleable . SwitchPreference_android_switchTextOff ) ) ; }
Obtains the text which should be displayed on the preference s switch when it is not checked from a specific typed array .
41,126
private void adaptSwitch ( ) { if ( switchWidget != null ) { switchWidget . setTextOn ( getSwitchTextOn ( ) ) ; switchWidget . setTextOff ( getSwitchTextOff ( ) ) ; switchWidget . setShowText ( ! TextUtils . isEmpty ( getSwitchTextOn ( ) ) || ! TextUtils . isEmpty ( getSwitchTextOff ( ) ) ) ; switchWidget . setChecked ( isChecked ( ) ) ; } }
Adapts the preference s switch depending on the preference s properties and on whether it is currently checked or not .
41,127
private OnCheckedChangeListener createCheckedChangeListener ( ) { return new OnCheckedChangeListener ( ) { public void onCheckedChanged ( final CompoundButton buttonView , final boolean isChecked ) { if ( getOnPreferenceChangeListener ( ) == null || getOnPreferenceChangeListener ( ) . onPreferenceChange ( SwitchPreference . this , isChecked ) ) { setChecked ( isChecked ) ; } else { setChecked ( ! isChecked ) ; } } } ; }
Creates and returns a listener which allows to change the preference s value depending on the preference s switch s state .
41,128
private void obtainColorPalette ( final TypedArray typedArray ) { int resourceId = typedArray . getResourceId ( R . styleable . ColorPalettePreference_colorPalette , - 1 ) ; if ( resourceId != - 1 ) { int [ ] obtainedColorPalette = getContext ( ) . getResources ( ) . getIntArray ( resourceId ) ; setColorPalette ( obtainedColorPalette ) ; } }
Obtains the color palette from a specific typed array .
41,129
private void obtainDialogPreviewSize ( final TypedArray typedArray ) { int defaultValue = getContext ( ) . getResources ( ) . getDimensionPixelSize ( R . dimen . color_palette_preference_default_dialog_preview_size ) ; setDialogPreviewSize ( typedArray . getDimensionPixelSize ( R . styleable . ColorPalettePreference_dialogPreviewSize , defaultValue ) ) ; }
Obtains the size which should be used to preview colors in the preference s dialog from a specific typed array .
41,130
private void obtainDialogPreviewShape ( final TypedArray typedArray ) { int defaultValue = getContext ( ) . getResources ( ) . getInteger ( R . integer . color_palette_preference_default_dialog_preview_shape ) ; setDialogPreviewShape ( PreviewShape . fromValue ( typedArray . getInteger ( R . styleable . ColorPalettePreference_dialogPreviewShape , defaultValue ) ) ) ; }
Obtains the shape which should be used to preview colors in the preference s dialog from a specific typed array .
41,131
private void obtainDialogPreviewBorderWidth ( final TypedArray typedArray ) { int defaultValue = getContext ( ) . getResources ( ) . getDimensionPixelSize ( R . dimen . color_palette_preference_default_dialog_preview_border_width ) ; setDialogPreviewBorderWidth ( typedArray . getDimensionPixelSize ( R . styleable . ColorPalettePreference_dialogPreviewBorderWidth , defaultValue ) ) ; }
Obtains the border width which should be used to preview colors in the preference s dialog from a specific typed array .
41,132
private void obtainDialogPreviewBorderColor ( final TypedArray typedArray ) { int defaultValue = ContextCompat . getColor ( getContext ( ) , R . color . color_palette_preference_default_dialog_preview_border_color ) ; setDialogPreviewBorderColor ( typedArray . getColor ( R . styleable . ColorPalettePreference_dialogPreviewBorderColor , defaultValue ) ) ; }
Obtains the border color which should be used to preview colors in the preference s dialog from a specific typed array .
41,133
private void obtainDialogPreviewBackground ( final TypedArray typedArray ) { int backgroundColor = typedArray . getColor ( R . styleable . ColorPalettePreference_dialogPreviewBackground , - 1 ) ; if ( backgroundColor != - 1 ) { setPreviewBackgroundColor ( backgroundColor ) ; } else { int resourceId = typedArray . getResourceId ( R . styleable . ColorPalettePreference_dialogPreviewBackground , R . drawable . color_picker_default_preview_background ) ; setDialogPreviewBackground ( ContextCompat . getDrawable ( getContext ( ) , resourceId ) ) ; } }
Obtains the background which should be used to preview colors in the preference s dialog from a specific typed array .
41,134
private void obtainNumberOfColumns ( final TypedArray typedArray ) { int defaultValue = getContext ( ) . getResources ( ) . getInteger ( R . integer . color_palette_preference_default_number_of_columns ) ; setNumberOfColumns ( typedArray . getInteger ( R . styleable . ColorPalettePreference_android_numColumns , defaultValue ) ) ; }
Obtains the number of columns which should be used to preview colors in the preference s dialog from a specific typed array .
41,135
private ListDialog . OnItemSelectedListener createItemSelectedListener ( ) { return new ListDialog . OnItemSelectedListener ( ) { public void onItemSelected ( final int position ) { ColorPalettePreference . this . selectedIndex = position ; ColorPalettePreference . this . onClick ( getDialog ( ) , DialogInterface . BUTTON_POSITIVE ) ; if ( getDialog ( ) != null ) { getDialog ( ) . dismiss ( ) ; } } } ; }
Creates and returns a listener which allows to observe when a list item has been selected .
41,136
public final void setDialogPreviewShape ( final PreviewShape previewShape ) { Condition . INSTANCE . ensureNotNull ( previewShape , "The preview shape may not be null" ) ; this . dialogPreviewShape = previewShape ; }
Sets the shape which should be used to preview colors in the preference s dialog .
41,137
private void obtainUnit ( final TypedArray typedArray ) { CharSequence obtainedUnit = typedArray . getText ( R . styleable . AbstractUnitPreference_unit ) ; if ( obtainedUnit == null ) { obtainedUnit = getContext ( ) . getText ( R . string . resolution_preference_unit ) ; } setUnit ( obtainedUnit ) ; }
Obtains the unit of the resolution which is shown in the preference s dialog from a specific typed array .
41,138
private void obtainWidthHint ( final TypedArray typedArray ) { CharSequence obtainedHint = typedArray . getText ( R . styleable . ResolutionPreference_widthHint ) ; if ( obtainedHint == null ) { obtainedHint = getContext ( ) . getText ( R . string . resolution_preference_width_hint ) ; } setWidthHint ( obtainedHint ) ; }
Obtains the hint of the edit text widget which allows to enter the width of the resolution from a specific typed array .
41,139
private void obtainHeightHint ( final TypedArray typedArray ) { CharSequence obtainedHint = typedArray . getText ( R . styleable . ResolutionPreference_heightHint ) ; if ( obtainedHint == null ) { obtainedHint = getContext ( ) . getText ( R . string . resolution_preference_height_hint ) ; } setHeightHint ( obtainedHint ) ; }
Obtains the hint of the edit text widget which allows to enter the height of the resolution from a specific typed array .
41,140
public static Pair < Integer , Integer > parseResolution ( final Context context , final String resolution ) { Condition . INSTANCE . ensureNotNull ( context , "The context may not be null" ) ; Condition . INSTANCE . ensureNotNull ( resolution , "The resolution may not be null" ) ; Condition . INSTANCE . ensureNotEmpty ( resolution , "The resolution may not be empty" ) ; String separator = context . getString ( R . string . resolution_preference_separator ) ; String [ ] dimensions = resolution . split ( separator ) ; if ( dimensions . length != 2 ) { throw new IllegalArgumentException ( "Malformed resolution: " + resolution ) ; } try { int width = Integer . parseInt ( dimensions [ 0 ] ) ; int height = Integer . parseInt ( dimensions [ 1 ] ) ; return Pair . create ( width , height ) ; } catch ( NumberFormatException e ) { throw new IllegalArgumentException ( "Resolution contains invalid dimension: " + resolution , e ) ; } }
Parses a specific textual representation of a resolution and returns its dimensions .
41,141
public static String formatResolution ( final Context context , final int width , final int height ) { Condition . INSTANCE . ensureNotNull ( context , "The context may not be null" ) ; String separator = context . getString ( R . string . resolution_preference_separator ) ; return width + separator + height ; }
Creates and returns the textual representation of a specific resolution .
41,142
public final void setResolution ( final int width , final int height ) { Condition . INSTANCE . ensureAtLeast ( width , 1 , "The width must be at least 1" ) ; Condition . INSTANCE . ensureAtLeast ( height , 1 , "The height must be at least 1" ) ; this . width = width ; this . height = height ; persistString ( formatResolution ( getContext ( ) , width , height ) ) ; notifyChanged ( ) ; }
Sets the current resolution of the preference . By setting a value it will be persisted .
41,143
private OnClickListener createListItemListener ( ) { return new OnClickListener ( ) { public void onClick ( final DialogInterface dialog , final int which ) { selectedIndex = which ; ListPreference . this . onClick ( dialog , DialogInterface . BUTTON_POSITIVE ) ; dialog . dismiss ( ) ; } } ; }
Creates and returns a listener which allows to persist the value a list item which is clicked by the user .
41,144
public final CharSequence getEntry ( ) { int index = indexOf ( value ) ; return index >= 0 && getEntries ( ) != null ? getEntries ( ) [ index ] : null ; }
Returns the entry the currently persisted value of the preference belongs to .
41,145
public final void setDividerColor ( final int color ) { this . seekBarColor = color ; try { Field divider = getClass ( ) . getSuperclass ( ) . getDeclaredField ( "mSelectionDivider" ) ; divider . setAccessible ( true ) ; divider . set ( this , new ColorDrawable ( color ) ) ; } catch ( NoSuchFieldException | IllegalArgumentException | IllegalAccessException e ) { Log . w ( TAG , "Failed to set divider color" , e ) ; } }
Sets the color of the number picker s divider .
41,146
private Preference . OnPreferenceChangeListener createShowValueAsSummaryListener ( ) { return new Preference . OnPreferenceChangeListener ( ) { public boolean onPreferenceChange ( final Preference preference , final Object newValue ) { boolean showValueAsSummary = ( Boolean ) newValue ; editTextPreference . showValueAsSummary ( showValueAsSummary ) ; listPreference . showValueAsSummary ( showValueAsSummary ) ; multiChoiceListPreference . showValueAsSummary ( showValueAsSummary ) ; seekBarPreference . showValueAsSummary ( showValueAsSummary ) ; numberPickerPreference . showValueAsSummary ( showValueAsSummary ) ; digitPickerPreference . showValueAsSummary ( showValueAsSummary ) ; resolutionPreference . showValueAsSummary ( showValueAsSummary ) ; colorPalettePreference . showValueAsSummary ( showValueAsSummary ) ; adaptSwitchPreferenceSummary ( showValueAsSummary ) ; return true ; } } ; }
Creates and returns a listener which allows to adapt whether the preference s values should be shown as summaries or not when the corresponding setting has been changed .
41,147
private Preference . OnPreferenceChangeListener createShowDialogHeaderListener ( ) { return new Preference . OnPreferenceChangeListener ( ) { public boolean onPreferenceChange ( final Preference preference , final Object newValue ) { boolean showDialogHeader = ( Boolean ) newValue ; dialogPreference . showDialogHeader ( showDialogHeader ) ; editTextPreference . showDialogHeader ( showDialogHeader ) ; listPreference . showDialogHeader ( showDialogHeader ) ; multiChoiceListPreference . showDialogHeader ( showDialogHeader ) ; seekBarPreference . showDialogHeader ( showDialogHeader ) ; numberPickerPreference . showDialogHeader ( showDialogHeader ) ; digitPickerPreference . showDialogHeader ( showDialogHeader ) ; resolutionPreference . showDialogHeader ( showDialogHeader ) ; colorPalettePreference . showDialogHeader ( showDialogHeader ) ; return true ; } } ; }
Creates and returns a listener which allows to adapt whether the headers of the preference s dialogs should be shown or not when the corresponding setting has been changed .
41,148
private Preference . OnPreferenceChangeListener createShowDialogButtonBarDividerListener ( ) { return new Preference . OnPreferenceChangeListener ( ) { public boolean onPreferenceChange ( final Preference preference , final Object newValue ) { boolean showDialogButtonBarDivider = ( Boolean ) newValue ; dialogPreference . showDialogButtonBarDivider ( showDialogButtonBarDivider ) ; editTextPreference . showDialogButtonBarDivider ( showDialogButtonBarDivider ) ; listPreference . showDialogButtonBarDivider ( showDialogButtonBarDivider ) ; multiChoiceListPreference . showDialogButtonBarDivider ( showDialogButtonBarDivider ) ; seekBarPreference . showDialogButtonBarDivider ( showDialogButtonBarDivider ) ; numberPickerPreference . showDialogButtonBarDivider ( showDialogButtonBarDivider ) ; digitPickerPreference . showDialogButtonBarDivider ( showDialogButtonBarDivider ) ; resolutionPreference . showDialogButtonBarDivider ( showDialogButtonBarDivider ) ; colorPalettePreference . showDialogButtonBarDivider ( showDialogButtonBarDivider ) ; return true ; } } ; }
Creates and returns a listener which allows to adapt whether the button bar dividers of the preference s dialogs should be shown or not when the corresponding setting has been changed .
41,149
private void initialize ( final AttributeSet attributeSet , final int defaultStyle , final int defaultStyleResource ) { entries = new CharSequence [ 0 ] ; entryValues = new CharSequence [ 0 ] ; obtainStyledAttributes ( attributeSet , defaultStyle , defaultStyleResource ) ; }
Initializes the list preference .
41,150
private void obtainDialogItemColor ( final TypedArray typedArray ) { setDialogItemColor ( typedArray . getColor ( R . styleable . AbstractListPreference_dialogItemColor , - 1 ) ) ; }
Obtains the item color of the preference s dialog from a specific typed array .
41,151
private void obtainEntries ( final TypedArray typedArray ) { CharSequence [ ] obtainedEntries = typedArray . getTextArray ( R . styleable . AbstractListPreference_android_entries ) ; if ( obtainedEntries != null ) { setEntries ( obtainedEntries ) ; } }
Obtains the the entries of the list preference from a specific typed array .
41,152
private void obtainEntryValues ( final TypedArray typedArray ) { CharSequence [ ] obtainedEntryValues = typedArray . getTextArray ( R . styleable . AbstractListPreference_android_entryValues ) ; if ( obtainedEntryValues != null ) { setEntryValues ( obtainedEntryValues ) ; } }
Obtains the the values which correspond to the entries of the list preference from a specific typed array .
41,153
private void obtainDialogScrollableArea ( final TypedArray typedArray ) { int topIndex = typedArray . getInt ( R . styleable . DialogPreference_dialogScrollableAreaTop , - 1 ) ; ScrollableArea . Area top = null ; ScrollableArea . Area bottom = null ; if ( topIndex != - 1 ) { top = ScrollableArea . Area . fromIndex ( topIndex ) ; int bottomIndex = typedArray . getInt ( R . styleable . DialogPreference_dialogScrollableAreaBottom , - 1 ) ; if ( bottomIndex != - 1 ) { bottom = ScrollableArea . Area . fromIndex ( bottomIndex ) ; } } setDialogScrollableArea ( top , bottom != null ? bottom : top ) ; }
Obtains the scrollable area of the preference s dialog from a specific typed array .
41,154
protected final int indexOf ( final CharSequence value ) { if ( value != null && getEntryValues ( ) != null ) { for ( int i = getEntryValues ( ) . length - 1 ; i >= 0 ; i -- ) { if ( getEntryValues ( ) [ i ] . equals ( value ) ) { return i ; } } } return - 1 ; }
Return the index of the entry a specific value corresponds to .
41,155
public final void setEntries ( final CharSequence [ ] entries ) { Condition . INSTANCE . ensureNotNull ( entries , "The entries may not be null" ) ; this . entries = entries ; }
Sets the entries of the list which is shown by the preference .
41,156
public final void setEntryValues ( final CharSequence [ ] entryValues ) { Condition . INSTANCE . ensureNotNull ( entryValues , "The entry values may not be null" ) ; this . entryValues = entryValues ; }
Sets the values which correspond to the entries of the list which is shown by the preference .
41,157
public final void setShape ( final PreviewShape shape ) { Condition . INSTANCE . ensureNotNull ( shape , "The shape may not be null" ) ; this . shape = shape ; }
Sets the shape of the preview .
41,158
private void obtainMaxNumber ( final TypedArray typedArray ) { int defaultValue = getContext ( ) . getResources ( ) . getInteger ( R . integer . number_picker_preference_default_max_number ) ; setMaxNumber ( typedArray . getInteger ( R . styleable . AbstractNumericPreference_android_max , defaultValue ) ) ; }
Obtains the maximum number the preference allows to choose from a specific typed array .
41,159
private void obtainMinNumber ( final TypedArray typedArray ) { int defaultValue = getContext ( ) . getResources ( ) . getInteger ( R . integer . number_picker_preference_default_min_number ) ; setMinNumber ( typedArray . getInteger ( R . styleable . AbstractNumericPreference_min , defaultValue ) ) ; }
Obtains the minimum number the preference allows to choose from a specific typed array .
41,160
private void obtainStepSize ( final TypedArray typedArray ) { int defaultValue = getContext ( ) . getResources ( ) . getInteger ( R . integer . number_picker_preference_default_step_size ) ; setStepSize ( typedArray . getInteger ( R . styleable . AbstractNumericPreference_stepSize , defaultValue ) ) ; }
Obtains the step size the number should be increased or decreased by when moving the selector wheel form a specific typed array .
41,161
private int adaptToStepSize ( final int number ) { if ( getStepSize ( ) > 0 ) { int offset = number - getMinNumber ( ) ; int mod = offset % getStepSize ( ) ; float halfStepSize = ( float ) getStepSize ( ) / 2.0f ; int result = ( ( mod > halfStepSize ) ? offset + getStepSize ( ) - mod : offset - mod ) + getMinNumber ( ) ; return Math . min ( result , getMaxNumber ( ) ) ; } return number ; }
Adapts a specific number to the step size which is currently set . The number will be decreased or increased to the numerically closest value which matches the step size .
41,162
public final void setMinNumber ( final int minNumber ) { Condition . INSTANCE . ensureSmaller ( minNumber , getMaxNumber ( ) , "The minimum number must be less than the maximum number" ) ; this . minNumber = minNumber ; setNumber ( Math . max ( getNumber ( ) , minNumber ) ) ; }
Sets the minimum number the preference allows to choose .
41,163
public final void setMaxNumber ( final int maxNumber ) { Condition . INSTANCE . ensureGreater ( maxNumber , getMinNumber ( ) , "The maximum number must be greater than the minimum number" ) ; this . maxNumber = maxNumber ; setNumber ( Math . min ( getNumber ( ) , maxNumber ) ) ; }
Sets the maximum number the preference allows to choose .
41,164
public final void setStepSize ( final int stepSize ) { Condition . INSTANCE . ensureAtLeast ( stepSize , 1 , "The step size must be at least 1" ) ; Condition . INSTANCE . ensureAtMaximum ( stepSize , getRange ( ) , "The step size must be at maximum the range" ) ; this . stepSize = stepSize ; setNumber ( adaptToStepSize ( getNumber ( ) ) ) ; }
Sets the step size the number should be increased or decreased by when moving the selector wheel .
41,165
private void obtainSummaryOn ( final TypedArray typedArray ) { setSummaryOn ( typedArray . getText ( R . styleable . AbstractTwoStatePreference_android_summaryOn ) ) ; }
Obtains the summary which should be shown when the preference is checked from a specific typed array .
41,166
private void obtainSummaryOff ( final TypedArray typedArray ) { setSummaryOff ( typedArray . getText ( R . styleable . AbstractTwoStatePreference_android_summaryOff ) ) ; }
Obtains the summary which should be shown when the preference is not checked from a specific typed array .
41,167
private void obtainDisableDependantsState ( final TypedArray typedArray ) { boolean defaultValue = getContext ( ) . getResources ( ) . getBoolean ( R . bool . two_state_preference_default_disable_dependents_state ) ; setDisableDependentsState ( typedArray . getBoolean ( R . styleable . AbstractTwoStatePreference_android_disableDependentsState , defaultValue ) ) ; }
Obtains the state when dependent preferences should be disabled from a specific typed array .
41,168
private void obtainHelperText ( final TypedArray typedArray ) { setHelperText ( typedArray . getString ( R . styleable . AbstractValidateableView_helperText ) ) ; }
Obtains the helper text from a specific typed array .
41,169
private void obtainHelperTextColor ( final TypedArray typedArray ) { setHelperTextColor ( typedArray . getColor ( R . styleable . AbstractValidateableView_helperTextColor , ContextCompat . getColor ( getContext ( ) , R . color . default_helper_text_color ) ) ) ; }
Obtains the color of the helper text from a specific typed array .
41,170
private void obtainErrorColor ( final TypedArray typedArray ) { setErrorColor ( typedArray . getColor ( R . styleable . AbstractValidateableView_errorColor , ContextCompat . getColor ( getContext ( ) , R . color . default_error_color ) ) ) ; }
Obtains the color which is used to indicate validation errors from a specific typed array .
41,171
private void obtainDialogTheme ( final TypedArray typedArray ) { int themeId = typedArray . getResourceId ( R . styleable . DialogPreference_dialogThemeResource , 0 ) ; if ( themeId == 0 ) { TypedValue typedValue = new TypedValue ( ) ; getContext ( ) . getTheme ( ) . resolveAttribute ( R . attr . preferenceDialogTheme , typedValue , true ) ; themeId = typedValue . resourceId ; } dialogTheme = themeId != 0 ? themeId : R . style . MaterialDialog_Light ; }
Obtains the theme which should be used by the preference s dialog from a specific typed array .
41,172
private void obtainDialogFullscreen ( final TypedArray typedArray ) { setDialogFullscreen ( typedArray . getBoolean ( R . styleable . DialogPreference_dialogFullscreen , false ) ) ; }
Obtains whether the preference s dialog should be shown fullscreen or not from a specific typed array .
41,173
private void obtainDialogGravity ( final TypedArray typedArray ) { int gravity = typedArray . getInteger ( R . styleable . DialogPreference_dialogGravity , - 1 ) ; setDialogGravity ( gravity ) ; }
Obtains the gravity of the preference s dialog from a specific typed array .
41,174
private void obtainDialogWidth ( final TypedArray typedArray ) { int width = 0 ; try { width = typedArray . getDimensionPixelSize ( R . styleable . DialogPreference_dialogWidth , width ) ; } catch ( Resources . NotFoundException | UnsupportedOperationException e ) { width = typedArray . getInteger ( 0 , width ) ; } if ( width != 0 ) { setDialogWidth ( width ) ; } }
Obtains the width of the preference s dialog from a specific typed array .
41,175
private void obtainDialogHeight ( final TypedArray typedArray ) { int height = 0 ; try { height = typedArray . getDimensionPixelSize ( R . styleable . DialogPreference_dialogHeight , height ) ; } catch ( Resources . NotFoundException | UnsupportedOperationException e ) { height = typedArray . getInteger ( 0 , height ) ; } if ( height != 0 ) { setDialogHeight ( height ) ; } }
Obtains the height of the preference s dialog from a specific typed array .
41,176
private void obtainDialogMaxWidth ( final TypedArray typedArray ) { try { int maxWidth = typedArray . getDimensionPixelSize ( R . styleable . DialogPreference_dialogMaxWidth , - 1 ) ; if ( maxWidth != - 1 ) { setDialogMaxWidth ( maxWidth ) ; } } catch ( Resources . NotFoundException | UnsupportedOperationException e ) { } }
Obtains the maximum width of the preference s dialog from a specific typed array .
41,177
private void obtainDialogMaxHeight ( final TypedArray typedArray ) { try { int maxHeight = typedArray . getDimensionPixelSize ( R . styleable . DialogPreference_dialogMaxHeight , - 1 ) ; if ( maxHeight != - 1 ) { setDialogMaxHeight ( maxHeight ) ; } } catch ( Resources . NotFoundException | UnsupportedOperationException e ) { } }
Obtains the maximum height of the preference s dialog from a specific typed array .
41,178
private void obtainDialogMargin ( final TypedArray typedArray ) { int defaultHorizontalMargin = getContext ( ) . getResources ( ) . getDimensionPixelSize ( R . dimen . dialog_horizontal_margin ) ; int defaultVerticalMargin = getContext ( ) . getResources ( ) . getDimensionPixelSize ( R . dimen . dialog_vertical_margin ) ; int left = typedArray . getDimensionPixelSize ( R . styleable . DialogPreference_dialogMarginLeft , defaultHorizontalMargin ) ; int top = typedArray . getDimensionPixelSize ( R . styleable . DialogPreference_dialogMarginTop , defaultVerticalMargin ) ; int right = typedArray . getDimensionPixelSize ( R . styleable . DialogPreference_dialogMarginRight , defaultHorizontalMargin ) ; int bottom = typedArray . getDimensionPixelSize ( R . styleable . DialogPreference_dialogMarginBottom , defaultVerticalMargin ) ; setDialogMargin ( left , top , right , bottom ) ; }
Obtains the margin of the preference s dialog from a specific typed array .
41,179
private void obtainDialogPadding ( final TypedArray typedArray ) { int defaultLeftPadding = getContext ( ) . getResources ( ) . getDimensionPixelSize ( R . dimen . dialog_left_padding ) ; int defaultTopPadding = getContext ( ) . getResources ( ) . getDimensionPixelSize ( R . dimen . dialog_top_padding ) ; int defaultRightPadding = getContext ( ) . getResources ( ) . getDimensionPixelSize ( R . dimen . dialog_right_padding ) ; int defaultBottomPadding = getContext ( ) . getResources ( ) . getDimensionPixelSize ( R . dimen . dialog_bottom_padding ) ; int left = typedArray . getDimensionPixelSize ( R . styleable . DialogPreference_dialogPaddingLeft , defaultLeftPadding ) ; int top = typedArray . getDimensionPixelSize ( R . styleable . DialogPreference_dialogPaddingTop , defaultTopPadding ) ; int right = typedArray . getDimensionPixelSize ( R . styleable . DialogPreference_dialogPaddingRight , defaultRightPadding ) ; int bottom = typedArray . getDimensionPixelSize ( R . styleable . DialogPreference_dialogPaddingBottom , defaultBottomPadding ) ; setDialogPadding ( left , top , right , bottom ) ; }
Obtains the padding of the preference s dialog from a specific typed array .
41,180
private void obtainDialogFitsSystemWindows ( final TypedArray typedArray ) { boolean left = typedArray . getBoolean ( R . styleable . DialogPreference_dialogFitsSystemWindowsLeft , true ) ; boolean top = typedArray . getBoolean ( R . styleable . DialogPreference_dialogFitsSystemWindowsTop , true ) ; boolean right = typedArray . getBoolean ( R . styleable . DialogPreference_dialogFitsSystemWindowsRight , true ) ; boolean bottom = typedArray . getBoolean ( R . styleable . DialogPreference_dialogFitsSystemWindowsBottom , true ) ; setDialogFitsSystemWindows ( left , top , right , bottom ) ; }
Obtains whether the preference s dialog should account for system screen decorations such as the status bar and inset its content or not .
41,181
private void obtainDialogTitle ( final TypedArray typedArray ) { CharSequence title = typedArray . getText ( R . styleable . DialogPreference_android_dialogTitle ) ; setDialogTitle ( title != null ? title : getTitle ( ) ) ; }
Obtains the title of the dialog which is shown by the preference from a specific typed array .
41,182
private void obtainDialogMessage ( final TypedArray typedArray ) { setDialogMessage ( typedArray . getText ( R . styleable . DialogPreference_android_dialogMessage ) ) ; }
Obtains the message of the dialog which is shown by the preference from a specific typed array .
41,183
private void obtainDialogIcon ( final TypedArray typedArray ) { int resourceId = typedArray . getResourceId ( R . styleable . DialogPreference_android_dialogIcon , - 1 ) ; if ( resourceId != - 1 ) { setDialogIcon ( resourceId ) ; } }
Obtains the icon of the dialog which is shown by the preference from a specific typed array .
41,184
private void obtainDialogIconTintList ( final TypedArray typedArray ) { setDialogIconTintList ( typedArray . getColorStateList ( R . styleable . DialogPreference_dialogIconTint ) ) ; }
Obtains the color state list which is used to tint the icon of the preference s dialog from a specific typed array .
41,185
private void obtainPositiveButtonText ( final TypedArray typedArray ) { setPositiveButtonText ( typedArray . getText ( R . styleable . DialogPreference_android_positiveButtonText ) ) ; }
Obtains the positive button text of the dialog which is shown by the preference from a specific typed array .
41,186
private void obtainNegativeButtonText ( final TypedArray typedArray ) { setNegativeButtonText ( typedArray . getText ( R . styleable . DialogPreference_android_negativeButtonText ) ) ; }
Obtains the negative button text of the dialog which is shown by the preference from a specific typed array .
41,187
private void obtainDialogTitleColor ( final TypedArray typedArray ) { setDialogTitleColor ( typedArray . getColor ( R . styleable . DialogPreference_dialogTitleColor , - 1 ) ) ; }
Obtains the title color of the dialog which is shown by the preference from a specific typed array .
41,188
private void obtainDialogMessageColor ( final TypedArray typedArray ) { setDialogMessageColor ( typedArray . getColor ( R . styleable . DialogPreference_dialogMessageColor , - 1 ) ) ; }
Obtains the message color of the dialog which is shown by the preference from a specific typed array .
41,189
private void obtainDialogButtonTextColor ( final TypedArray typedArray ) { ColorStateList colorStateList = typedArray . getColorStateList ( R . styleable . DialogPreference_dialogButtonTextColor ) ; if ( colorStateList != null ) { setDialogButtonTextColor ( colorStateList ) ; } }
Obtains the button text color of the dialog which is shown by the preference from a specific typed array .
41,190
private void obtainDialogBackground ( final TypedArray typedArray ) { int resourceId = typedArray . getResourceId ( R . styleable . DialogPreference_dialogBackground , - 1 ) ; if ( resourceId != - 1 ) { setDialogBackground ( resourceId ) ; } else { int color = typedArray . getColor ( R . styleable . DialogPreference_dialogBackground , - 1 ) ; if ( color != - 1 ) { setDialogBackgroundColor ( color ) ; } } }
Obtains the background of the dialog which is shown by the preference from a specific typed array .
41,191
private void obtainDialogWindowBackground ( final TypedArray typedArray ) { int resourceId = typedArray . getResourceId ( R . styleable . DialogPreference_dialogWindowBackground , - 1 ) ; if ( resourceId != - 1 ) { setDialogWindowBackground ( resourceId ) ; } }
Obtains the window background of the dialog which is shown by the preference from a specific typed array .
41,192
private void obtainShowValueAsSummary ( final TypedArray typedArray ) { boolean defaultValue = getContext ( ) . getResources ( ) . getBoolean ( R . bool . dialog_preference_default_show_value_as_summary ) ; showValueAsSummary ( typedArray . getBoolean ( R . styleable . DialogPreference_showValueAsSummary , defaultValue ) ) ; }
Obtains the boolean value which specifies whether the currently persisted value should be shown as the summary instead of the given summaries from a specific typed array .
41,193
private void obtainShowDialogHeader ( final TypedArray typedArray ) { boolean defaultValue = getContext ( ) . getResources ( ) . getBoolean ( R . bool . dialog_preference_default_show_dialog_header ) ; showDialogHeader ( typedArray . getBoolean ( R . styleable . DialogPreference_showDialogHeader , defaultValue ) ) ; }
Obtains the boolean value which specifies whether the header of the dialog which is shown by the preference should be shown from a specific typed array .
41,194
private void obtainDialogHeaderBackground ( final TypedArray typedArray ) { int resourceId = typedArray . getResourceId ( R . styleable . DialogPreference_dialogHeaderBackground , - 1 ) ; if ( resourceId != - 1 ) { setDialogHeaderBackground ( resourceId ) ; } else { int color = typedArray . getColor ( R . styleable . DialogPreference_dialogHeaderBackground , - 1 ) ; if ( color != - 1 ) { setDialogHeaderBackgroundColor ( color ) ; } } }
Obtains the background of the header of the dialog which is shown by the preference from a specific typed array .
41,195
private void obtainDialogHeaderIcon ( final TypedArray typedArray ) { int resourceId = typedArray . getResourceId ( R . styleable . DialogPreference_dialogHeaderIcon , - 1 ) ; if ( resourceId != - 1 ) { setDialogHeaderIcon ( resourceId ) ; } }
Obtains the icon of the header of the dialog which is shown by the preference from a specific typed array .
41,196
private void obtainDialogHeaderIconTintList ( final TypedArray typedArray ) { setDialogHeaderIconTintList ( typedArray . getColorStateList ( R . styleable . DialogPreference_dialogHeaderIconTint ) ) ; }
Obtains the color state list which is used to tint the icon of the header of the preference s dialog from a specific typed array .
41,197
private void obtainShowDialogButtonBarDivider ( final TypedArray typedArray ) { boolean defaultValue = getContext ( ) . getResources ( ) . getBoolean ( R . bool . dialog_preference_default_show_dialog_button_bar_divider ) ; showDialogButtonBarDivider ( typedArray . getBoolean ( R . styleable . DialogPreference_showDialogButtonBarDivider , defaultValue ) ) ; }
Obtains the boolean value which specifies whether the divider which is located above the buttons of the dialog which is shown by the preference should be shown from a specific typed array .
41,198
private void obtainDialogButtonBarDividerColor ( final TypedArray typedArray ) { int defaultValue = ContextCompat . getColor ( getContext ( ) , R . color . divider_color_light ) ; setDialogDividerColor ( typedArray . getColor ( R . styleable . DialogPreference_dialogDividerColor , defaultValue ) ) ; }
Obtains the color of the divider which is located above the buttons of the dialog which is shown by the preference from a specific typed array .
41,199
private void obtainDialogButtonBarDividerMargin ( final TypedArray typedArray ) { setDialogDividerMargin ( typedArray . getDimensionPixelSize ( R . styleable . DialogPreference_dialogDividerMargin , 0 ) ) ; }
Obtains the left and right margin of the divider which is located above the buttons of the dialog which shown by the preference from a specific typed array .