idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
125,300
public final BuilderType setOnItemSelectedListener ( final ListDialog . OnItemSelectedListener listener ) { getProduct ( ) . setOnItemSelectedListener ( listener ) ; return self ( ) ; }
Sets the listener which should be notified when an item which is shown by the dialog which is created by the builder is selected .
125,301
private void addAreas ( ) { if ( areas != null ) { removeAllViews ( ) ; scrollView = null ; topDivider = null ; bottomDivider = null ; Area previousArea = null ; boolean canAddTopDivider = false ; for ( Map . Entry < Area , View > entry : areas . entrySet ( ) ) { Area area = entry . getKey ( ) ; View view = entry . get...
Adds the areas which are contained by the dialog to the root view .
125,302
private void addDividers ( ) { for ( Map . Entry < DividerLocation , Divider > entry : dividers . entrySet ( ) ) { if ( entry . getKey ( ) == DividerLocation . BOTTOM && bottomDivider == null && ! scrollableArea . isScrollable ( Area . BUTTON_BAR ) ) { bottomDivider = entry . getValue ( ) ; } else if ( entry . getKey (...
Adds the dividers which are contained by the dialog to the root view .
125,303
private Divider addDivider ( ) { Divider divider = new Divider ( getContext ( ) ) ; divider . setVisibility ( View . INVISIBLE ) ; divider . setBackgroundColor ( dividerColor ) ; LayoutParams layoutParams = new LayoutParams ( LayoutParams . MATCH_PARENT , dpToPixels ( getContext ( ) , 1 ) ) ; layoutParams . leftMargin ...
Adds a divider to the view .
125,304
private void adaptAreaPadding ( ) { if ( areas != null ) { boolean paddingTopApplied = false ; Area previousArea = null ; View previousView = null ; int scrollViewPaddingTop = 0 ; int scrollViewMarginBottom = 0 ; Iterator < Map . Entry < Area , View > > iterator = areas . entrySet ( ) . iterator ( ) ; while ( iterator ...
Adapts the padding of the areas which are contained by the dialog .
125,305
private void adaptDividerVisibilities ( ) { if ( scrollView != null ) { adaptDividerVisibilities ( scrollView . isScrolledToTop ( ) , scrollView . isScrolledToBottom ( ) , false ) ; } else if ( listView != null ) { adaptDividerVisibilities ( isListViewScrolledToTop ( listView ) , isListViewScrolledToBottom ( listView )...
Adapts the visibility of the top and bottom divider depending on the state of the dialog s scroll view .
125,306
private boolean isListViewScrolledToBottom ( final AbsListView scrollView ) { if ( scrollView . getCount ( ) > 0 && scrollView . getChildCount ( ) > 0 ) { if ( scrollView . getLastVisiblePosition ( ) == scrollView . getCount ( ) - 1 ) { View child = scrollView . getChildAt ( scrollView . getChildCount ( ) - 1 ) ; retur...
Returns whether a specific list view is scrolled to the bottom or not .
125,307
private boolean isListViewScrolledToTop ( final AbsListView listView ) { if ( listView . getFirstVisiblePosition ( ) == 0 ) { if ( listView . getChildCount ( ) == 0 ) { return true ; } else { View child = listView . getChildAt ( 0 ) ; return child == null || child . getTop ( ) == 0 ; } } return false ; }
Returns whether a specific list view is scrolled to the top or not .
125,308
private void applyDialogPaddingLeft ( final Area area , final View view ) { int padding = area != Area . HEADER && area != Area . BUTTON_BAR && area != Area . CONTENT ? dialogPadding [ 0 ] : 0 ; view . setPadding ( padding , view . getPaddingTop ( ) , view . getPaddingRight ( ) , view . getPaddingBottom ( ) ) ; }
Applies the dialog s left padding to the view of a specific area .
125,309
private boolean applyDialogPaddingTop ( final Area area , final View view ) { if ( area != Area . HEADER && area != Area . CONTENT && area != Area . BUTTON_BAR && view . getVisibility ( ) == View . VISIBLE ) { view . setPadding ( view . getPaddingLeft ( ) , dialogPadding [ 1 ] , view . getPaddingRight ( ) , view . getP...
Applies the dialog s top padding to the view of a specific area .
125,310
private void applyDialogPaddingRight ( final Area area , final View view ) { int padding = area != Area . HEADER && area != Area . BUTTON_BAR && area != Area . CONTENT ? dialogPadding [ 2 ] : 0 ; view . setPadding ( view . getPaddingLeft ( ) , view . getPaddingTop ( ) , padding , view . getPaddingBottom ( ) ) ; }
Applies the dialog s right padding to the view of a specific area .
125,311
private void applyDialogPaddingBottom ( final Area area , final View view ) { if ( area != Area . HEADER && area != Area . BUTTON_BAR ) { view . setPadding ( view . getPaddingLeft ( ) , view . getPaddingTop ( ) , view . getPaddingRight ( ) , dialogPadding [ 3 ] ) ; } }
Applies the dialog s bottom padding to the view of a specific area .
125,312
private Pair < Integer , Integer > addViewSpacing ( final Area previousArea , final View previousView , final Area area ) { int scrollViewPaddingTop = 0 ; int scrollViewMarginBottom = 0 ; int padding = - 1 ; if ( previousArea == Area . TITLE ) { padding = getResources ( ) . getDimensionPixelSize ( R . dimen . dialog_ti...
Adds spacing to the view of a specific area . The spacing is added to the view s current bottom padding .
125,313
private void inflateScrollView ( final ScrollableArea scrollableArea ) { if ( scrollView == null ) { LayoutInflater layoutInflater = LayoutInflater . from ( getContext ( ) ) ; scrollView = ( ScrollView ) layoutInflater . inflate ( R . layout . material_dialog_scroll_view , this , false ) ; scrollView . addScrollListene...
Inflates the scroll view which contains the dialog s scrollable areas if it has not been inflated yet .
125,314
private OnGlobalLayoutListener createScrollViewChildLayoutListener ( ) { return new OnGlobalLayoutListener ( ) { public void onGlobalLayout ( ) { View child = scrollView . getChildAt ( 0 ) ; int childHeight = child . getHeight ( ) ; int containerHeight = scrollView . getHeight ( ) - scrollView . getPaddingTop ( ) - scr...
Creates and returns a listener which allows to observe when the child of the dialog s scroll view has been layouted . If the scroll view s height is greater than necessary its height is reduced to match the height of its child .
125,315
private ScrollListener createScrollViewScrollListener ( ) { return new ScrollListener ( ) { public void onScrolled ( final boolean scrolledToTop , final boolean scrolledToBottom ) { adaptDividerVisibilities ( scrolledToTop , scrolledToBottom , true ) ; } } ; }
Creates and returns a listener which allows to observe when the scroll view which is contained by the dialog is scrolled .
125,316
private AbsListView . OnScrollListener createListViewScrollListener ( ) { return new AbsListView . OnScrollListener ( ) { public void onScrollStateChanged ( final AbsListView view , final int scrollState ) { } public void onScroll ( final AbsListView view , final int firstVisibleItem , final int visibleItemCount , fina...
Creates and returns a listener which allows to observe the list view which is contained by the dialog is scrolled .
125,317
private void adaptDividerColor ( ) { adaptDividerColor ( topDivider ) ; adaptDividerColor ( bottomDivider ) ; if ( dividers != null ) { for ( Divider divider : dividers . values ( ) ) { adaptDividerColor ( divider ) ; } } }
Adapts the color of dividers .
125,318
private void adaptDividerMargin ( ) { adaptDividerMargin ( topDivider ) ; adaptDividerMargin ( bottomDivider ) ; if ( dividers != null ) { for ( Divider divider : dividers . values ( ) ) { adaptDividerMargin ( divider ) ; } } }
Adapts the left and right margin of dividers .
125,319
private void adaptDividerMargin ( final Divider divider ) { if ( divider != null ) { ViewGroup . LayoutParams layoutParams = divider . getLayoutParams ( ) ; if ( layoutParams instanceof LayoutParams ) { ( ( LayoutParams ) layoutParams ) . leftMargin = dividerMargin ; ( ( LayoutParams ) layoutParams ) . rightMargin = di...
Adapts the left and right margin of a specific divider .
125,320
public final void setWindowBackgroundAndInset ( final Drawable windowBackground , final Rect windowInsets ) { this . windowBackground = windowBackground ; this . windowInsets = windowInsets ; adaptWindowBackgroundAndInsets ( ) ; }
Sets the background and inset of the dialog s window .
125,321
public final void setMaxWidth ( final int maxWidth ) { if ( maxWidth != - 1 ) { Condition . INSTANCE . ensureAtLeast ( maxWidth , 1 , "The maximum width must be at least 1" ) ; } this . maxWidth = maxWidth ; requestLayout ( ) ; }
Sets the maximum width of the view .
125,322
public final void setMaxHeight ( final int maxHeight ) { if ( maxHeight != - 1 ) { Condition . INSTANCE . ensureAtLeast ( maxHeight , 1 , "The maximum height must be at least 1" ) ; } this . maxHeight = maxHeight ; requestLayout ( ) ; }
Sets the maximum height of the view .
125,323
public final void setScrollableArea ( final ScrollableArea scrollableArea ) { Condition . INSTANCE . ensureNotNull ( scrollableArea , "The scrollable area may not be null" ) ; this . scrollableArea = scrollableArea ; addAreas ( ) ; }
Sets the scrollable area of the dialog .
125,324
public final void addAreas ( final Map < ViewType , View > areas ) { this . areas = new TreeMap < > ( new AreaComparator ( ) ) ; this . dividers = new HashMap < > ( ) ; for ( Map . Entry < ViewType , View > entry : areas . entrySet ( ) ) { ViewType viewType = entry . getKey ( ) ; View view = entry . getValue ( ) ; if (...
Adds the different areas of a dialog to the root view .
125,325
public final void setDialog ( final MaterialDialog dialog ) { Condition . INSTANCE . ensureNotNull ( dialog , "The dialog may not be null" ) ; this . dialog = dialog ; }
Sets the dialog which contains the view pager .
125,326
private void inflateEditText ( ) { LayoutInflater inflater = LayoutInflater . from ( getContext ( ) ) ; View view = inflater . inflate ( R . layout . edit_text_dialog , getRootView ( ) , false ) ; getDialog ( ) . setView ( view ) ; View textInputLayoutView = view . findViewById ( R . id . text_input_layout ) ; textInpu...
Inflates the dialog s edit text widget .
125,327
private void adaptText ( ) { if ( editText != null ) { editText . setText ( text ) ; if ( text != null ) { editText . setSelection ( text . length ( ) ) ; } } }
Adapts the text of the edit text widget which is contained by the dialog .
125,328
private void adaptHint ( ) { if ( textInputLayout != null ) { textInputLayout . setHint ( hint ) ; } else if ( editText != null ) { editText . setHint ( hint ) ; } }
Adapts the hint of the dialog s edit text widget .
125,329
private void adaptHelperText ( ) { if ( textInputLayout != null && TextUtils . isEmpty ( getText ( ) ) ) { textInputLayout . setHelperText ( helperText ) ; textInputLayout . setHelperTextEnabled ( true ) ; } }
Adapts the helper text of the dialog s edit text widget .
125,330
private void showErrorText ( final CharSequence errorText ) { if ( textInputLayout != null ) { if ( TextUtils . isEmpty ( errorText ) ) { textInputLayout . setError ( null ) ; textInputLayout . setErrorEnabled ( false ) ; adaptHelperTextColor ( ) ; } else { textInputLayout . setHelperText ( null ) ; textInputLayout . s...
Shows an error text .
125,331
private void requestFocus ( ) { Window window = getWindow ( ) ; if ( window != null ) { window . setSoftInputMode ( WindowManager . LayoutParams . SOFT_INPUT_STATE_ALWAYS_VISIBLE ) ; } if ( editText != null ) { editText . requestFocus ( ) ; } }
Requests the focus and displays the keyboard .
125,332
private void adaptPositiveButtonEnableState ( final boolean enabled ) { Button button = getDialog ( ) . getButton ( DialogInterface . BUTTON_POSITIVE ) ; if ( button != null ) { button . setEnabled ( enabled ) ; } }
Adapts the enable state of the dialog s positive button .
125,333
private TextWatcher createTextChangedListener ( ) { return new TextWatcher ( ) { public void beforeTextChanged ( final CharSequence text , final int start , final int count , final int after ) { } public void afterTextChanged ( final Editable text ) { } public void onTextChanged ( final CharSequence text , final int st...
Creates and returns a listener which allows to observe when the text of the dialog s edit text has changed .
125,334
private View . OnFocusChangeListener createFocusChangeListener ( ) { return new View . OnFocusChangeListener ( ) { public void onFocusChange ( final View v , final boolean hasFocus ) { if ( ! hasFocus && validateOnFocusLost ) { validate ( ) ; } } } ; }
Creates and returns a listener which allows to validate the dialog s edit text widget when its focus got lost .
125,335
private void notifyOnValidationFailure ( final Validator < CharSequence > validator ) { for ( ValidationListener < CharSequence > validationListener : validationListeners ) { validationListener . onValidationFailure ( this , validator ) ; } }
Notifies the listeners that the validation of the dialog s edit text widget has failed .
125,336
private void inflateListView ( final ViewGroup contentContainer ) { View listView = contentContainer . findViewById ( android . R . id . list ) ; this . listView = listView instanceof RecyclerView ? ( RecyclerView ) listView : null ; if ( this . listView == null && ! getDialog ( ) . isCustomViewUsed ( ) ) { LayoutInfla...
Inflates the list view which is used to show the dialog s list items .
125,337
private void attachAdapter ( ) { if ( listView != null ) { if ( adapter != null ) { listView . setHasFixedSize ( false ) ; listView . setLayoutManager ( layoutManager ) ; listView . setAdapter ( adapter ) ; listView . setVisibility ( adapter != null ? View . VISIBLE : View . GONE ) ; adapter . setOnItemSelectedListener...
Attaches the adapter to the dialog s list view .
125,338
private void initializeCheckedItems ( ) { if ( checkedItems != null ) { for ( int i = 0 ; i < checkedItems . length ; i ++ ) { adapter . setItemChecked ( i , checkedItems [ i ] ) ; } } }
Initializes the list items which are checked by default .
125,339
private boolean [ ] getCheckedItems ( ) { if ( listView != null && adapter != null ) { boolean [ ] result = new boolean [ adapter . getItemCount ( ) ] ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = adapter . isItemChecked ( i ) ; } return result ; } else { return checkedItems ; } }
Returns an array which identifies the currently checked list items .
125,340
private void initializeSelectionListener ( ) { ChoiceMode choiceMode = adapter . getChoiceMode ( ) ; if ( choiceMode instanceof MultipleChoiceMode ) { adapter . setOnItemClickListener ( new OnMultiChoiceClickListenerWrapper ( multiChoiceListener , getDialog ( ) , 0 ) ) ; } else if ( choiceMode instanceof SingleChoiceMo...
Initializes the listener which should be notified when the selection of a list item of the dialog has been changed .
125,341
private void adaptItemColor ( ) { if ( adapter != null ) { RecyclerView . Adapter < ? > wrappedAdapter = adapter . getWrappedAdapter ( ) ; if ( wrappedAdapter instanceof ArrayRecyclerViewAdapter ) { ( ( ArrayRecyclerViewAdapter ) wrappedAdapter ) . setItemColor ( itemColor ) ; } } }
Adapts the color of the dialog s list items .
125,342
private void adaptItemTypeface ( ) { if ( adapter != null && itemTypeface != null ) { RecyclerView . Adapter < ? > wrappedAdapter = adapter . getWrappedAdapter ( ) ; if ( wrappedAdapter instanceof ArrayRecyclerViewAdapter ) { ( ( ArrayRecyclerViewAdapter ) wrappedAdapter ) . setItemTypeface ( itemTypeface ) ; } } }
Adapts the typeface of the dialog s list items .
125,343
private void adaptButtonBar ( ) { if ( buttonBarContainer != null ) { inflateButtonBar ( ) ; adaptPositiveButton ( ) ; adaptNegativeButton ( ) ; adaptNeutralButton ( ) ; adaptButtonTextColor ( ) ; adaptButtonTypeface ( ) ; adaptButtonBarContainerVisibility ( ) ; adaptButtonBarDividerVisibility ( ) ; } }
Adapts the button bar .
125,344
private void adaptButtonTypeface ( ) { if ( buttonTypeface != null ) { if ( positiveButton != null ) { positiveButton . setTypeface ( buttonTypeface ) ; } if ( neutralButton != null ) { neutralButton . setTypeface ( buttonTypeface ) ; } if ( negativeButton != null ) { negativeButton . setTypeface ( buttonTypeface ) ; }...
Adapts the typeface of the dialog s buttons .
125,345
private void adaptPositiveButton ( ) { if ( positiveButton != null ) { positiveButton . setText ( positiveButtonText != null ? positiveButtonText . toString ( ) . toUpperCase ( Locale . getDefault ( ) ) : null ) ; OnClickListenerWrapper onClickListener = new OnClickListenerWrapper ( positiveButtonListener , true , getD...
Adapts the dialog s positive button .
125,346
private void adaptNeutralButton ( ) { if ( neutralButton != null ) { neutralButton . setText ( neutralButtonText != null ? neutralButtonText . toString ( ) . toUpperCase ( Locale . getDefault ( ) ) : null ) ; OnClickListenerWrapper onClickListener = new OnClickListenerWrapper ( neutralButtonListener , false , getDialog...
Adapts the dialog s neutral button .
125,347
private void adaptNegativeButton ( ) { if ( negativeButton != null ) { negativeButton . setText ( negativeButtonText != null ? negativeButtonText . toString ( ) . toUpperCase ( Locale . getDefault ( ) ) : null ) ; OnClickListenerWrapper onClickListener = new OnClickListenerWrapper ( negativeButtonListener , false , get...
Adapts the dialog s negative button .
125,348
private void adaptButtonBarContainerVisibility ( ) { if ( buttonBarContainer != null ) { if ( TextUtils . isEmpty ( positiveButtonText ) && TextUtils . isEmpty ( neutralButtonText ) && TextUtils . isEmpty ( negativeButtonText ) ) { buttonBarContainer . setVisibility ( View . GONE ) ; } else { buttonBarContainer . setVi...
Adapts the visibility of the parent view which contains the dialog s buttons .
125,349
private void adaptButtonBarDividerVisibility ( ) { if ( buttonBarDivider != null ) { buttonBarDivider . setVisibility ( showButtonBarDivider ? View . VISIBLE : View . GONE ) ; buttonBarDivider . setVisibleByDefault ( showButtonBarDivider ) ; } }
Adapts the visibility of the divider which is shown above the dialog s buttons .
125,350
public void setItemTypeface ( final Typeface typeface ) { Condition . INSTANCE . ensureNotNull ( typeface , "The typeface may not be null" ) ; this . itemTypeface = typeface ; notifyDataSetChanged ( ) ; }
Sets the typeface of the adapter s items .
125,351
private void initialize ( final int themeResourceId ) { int themeId = themeResourceId ; if ( themeId == 0 ) { TypedValue typedValue = new TypedValue ( ) ; getContext ( ) . getTheme ( ) . resolveAttribute ( R . attr . materialDialogTheme , typedValue , true ) ; themeId = typedValue . resourceId ; themeId = themeId != 0 ...
Initializes the builder .
125,352
private void obtainFullscreen ( final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogFullscreen } ) ; setFullscreen ( typedArray . getBoolean ( 0 , false ) ) ; }
Obtains the boolean value which specified whether the dialog should be shown fullscreen or not from a specific theme .
125,353
private void obtainGravity ( final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogGravity } ) ; setGravity ( typedArray . getInteger ( 0 , Dialog . Gravity . CENTER ) ) ; }
Obtains the gravity from a specific theme .
125,354
private void obtainWidth ( final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogWidth } ) ; int defaultValue = getContext ( ) . getResources ( ) . getDimensionPixelSize ( R . dimen . dialog_width ) ; try {...
Obtains the width from a specific theme .
125,355
private void obtainHeight ( final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogHeight } ) ; int defaultValue = Dialog . WRAP_CONTENT ; try { setHeight ( typedArray . getDimensionPixelSize ( 0 , defaultVa...
Obtains the height from a specific theme .
125,356
private void obtainMaxWidth ( final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogMaxWidth } ) ; int defaultValue ; try { defaultValue = getContext ( ) . getResources ( ) . getDimensionPixelSize ( R . dim...
Obtains the maximum width from a specific theme .
125,357
private void obtainMaxHeight ( final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogMaxHeight } ) ; int defaultValue ; try { defaultValue = getContext ( ) . getResources ( ) . getDimensionPixelSize ( R . d...
Obtains the maximum height from a specific theme .
125,358
private void obtainMargin ( final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogMarginLeft , R . attr . materialDialogMarginTop , R . attr . materialDialogMarginRight , R . attr . materialDialogMarginBott...
Obtains the margin from a specific theme .
125,359
private void obtainFitsSystemWindows ( final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogFitsSystemWindowsLeft , R . attr . materialDialogFitsSystemWindowsTop , R . attr . materialDialogFitsSystemWindow...
Obtains whether the dialog s content should be inset from a specific theme .
125,360
private void obtainWindowBackground ( final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogWindowBackground } ) ; int resourceId = typedArray . getResourceId ( 0 , 0 ) ; if ( resourceId != 0 ) { setWindowB...
Obtains the window background from a specific theme .
125,361
private void obtainBackground ( final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogBackground } ) ; int resourceId = typedArray . getResourceId ( 0 , 0 ) ; if ( resourceId != 0 ) { setBackground ( resour...
Obtains the background from a specific theme .
125,362
private void obtainMessageColor ( final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogMessageColor } ) ; int defaultColor = ThemeUtil . getColor ( getContext ( ) , themeResourceId , android . R . attr . t...
Obtains the message color from a specific theme .
125,363
private void obtainTitleColor ( final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogTitleColor } ) ; int defaultColor = ThemeUtil . getColor ( getContext ( ) , themeResourceId , android . R . attr . textC...
Obtains the title color from a specific theme .
125,364
private void obtainIconTintList ( final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogIconTint } ) ; setIconTintList ( typedArray . getColorStateList ( 0 ) ) ; }
Obtains the color state list which is used to tint the icon of the dialog from a specific theme .
125,365
private void obtainScrollableArea ( final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogScrollableAreaTop , R . attr . materialDialogScrollableAreaBottom } ) ; int topIndex = typedArray . getInt ( 0 , - 1...
Obtains the scrollable area from a specific theme .
125,366
private void obtainShowDividersOnScroll ( final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogShowDividersOnScroll } ) ; showDividersOnScroll ( typedArray . getBoolean ( 0 , true ) ) ; }
Obtains whether the dividers which are located above and below the dialog s scrollable areas should be shown when scrolling or not from a specific theme .
125,367
private void obtainDividerColor ( final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogDividerColor } ) ; int defaultColor = ContextCompat . getColor ( getContext ( ) , R . color . divider_color_light ) ; ...
Obtains the color of dividers from a specific theme .
125,368
private void obtainDividerMargin ( final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogDividerMargin } ) ; setDividerMargin ( typedArray . getDimensionPixelSize ( 0 , 0 ) ) ; }
Obtains the left and right margin of dividers from a specific theme .
125,369
protected void obtainStyledAttributes ( final int themeResourceId ) { obtainFullscreen ( themeResourceId ) ; obtainGravity ( themeResourceId ) ; obtainWidth ( themeResourceId ) ; obtainHeight ( themeResourceId ) ; obtainMaxWidth ( themeResourceId ) ; obtainMaxHeight ( themeResourceId ) ; obtainMargin ( themeResourceId ...
Obtains all relevant attributes from the current theme .
125,370
public BuilderType setOnShowListener ( final DialogInterface . OnShowListener listener ) { getProduct ( ) . setOnShowListener ( listener ) ; return self ( ) ; }
Sets the listener which should be notified when the dialog has been shown .
125,371
public final BuilderType setOnDismissListener ( final DialogInterface . OnDismissListener listener ) { getProduct ( ) . setOnDismissListener ( listener ) ; return self ( ) ; }
Sets the listener which should be notified when the dialog which is created by the builder is dismissed for any reason .
125,372
public final BuilderType setMargin ( final int left , final int top , final int right , final int bottom ) { getProduct ( ) . setMargin ( left , top , right , bottom ) ; return self ( ) ; }
Sets the margin of the dialog which is created by the builder .
125,373
public final BuilderType setPadding ( final int left , final int top , final int right , final int bottom ) { getProduct ( ) . setPadding ( left , top , right , bottom ) ; return self ( ) ; }
Sets the padding of the dialog which is created by the builder .
125,374
public final BuilderType setFitsSystemWindows ( final boolean left , final boolean top , final boolean right , final boolean bottom ) { getProduct ( ) . setFitsSystemWindows ( left , top , right , bottom ) ; return self ( ) ; }
Sets whether the dialog which is created by the builder should account for system screen decorations such as the status bar and inset its content or not .
125,375
public final BuilderType setScrollableArea ( final Area top , final Area bottom ) { getProduct ( ) . setScrollableArea ( top , bottom ) ; return self ( ) ; }
Sets the areas of the dialog which is created by the builder which should be scrollable .
125,376
protected final void setInterpolator ( final Interpolator interpolator ) { Condition . INSTANCE . ensureNotNull ( interpolator , "The interpolator may not be null" ) ; this . interpolator = interpolator ; }
Sets the interpolator which should be used by the animation .
125,377
protected final void setAlpha ( final float alpha ) { Condition . INSTANCE . ensureAtLeast ( alpha , 0 , "The alpha must be at least 0" ) ; Condition . INSTANCE . ensureAtMaximum ( alpha , 1 , "The alpha must be at maximum 1" ) ; this . alpha = alpha ; }
Sets the alpha which should be used by the animation .
125,378
private View . OnTouchListener createCanceledOnTouchListener ( ) { return new View . OnTouchListener ( ) { @ SuppressLint ( "ClickableViewAccessibility" ) public boolean onTouch ( final View v , final MotionEvent event ) { return isCanceledOnTouchOutside ( ) && ! isFullscreen ( ) && onCanceledOnTouchOutside ( ) ; } } ;...
Creates and returns a listener which allows to cancel the dialog when touched outside the window .
125,379
private Map < ViewType , View > attachDecorators ( final Window window , final DialogRootView rootView , final View view ) { Map < ViewType , View > result = new HashMap < > ( ) ; for ( AbstractDecorator < ? , ? > decorator : decorators ) { result . putAll ( decorator . attach ( window , view , result , null ) ) ; deco...
Attaches all registered decorators to the dialog .
125,380
private void initializeFloatingActionButton ( ) { floatingActionButton = findViewById ( R . id . floating_action_button ) ; if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . LOLLIPOP ) { floatingActionButton . show ( ) ; floatingActionButton . setOnClickListener ( createFloatingActionButtonListener ( ) ) ; } el...
Initializes the floating action button which allows to show an alert dialog using a circle reveal animation .
125,381
private OnClickListener createFloatingActionButtonListener ( ) { return new OnClickListener ( ) { public void onClick ( final View v ) { fragment . showAlertDialog ( v ) ; } } ; }
Creates and returns a listener which allows to show an alert dialog using a circle reveal animation when the corresponding floating action button is clicked .
125,382
private RecyclerView . OnScrollListener createScrollListener ( ) { return new RecyclerView . OnScrollListener ( ) { private boolean scrollingUp ; public void onScrollStateChanged ( final RecyclerView recyclerView , final int newState ) { } public void onScrolled ( final RecyclerView recyclerView , final int dx , final ...
Creates and returns a listener which allows to hide or show the activity s floating action button when the preferences which are shown by the activity s fragment are scrolled .
125,383
private ViewPropertyAnimator createAnimator ( final View animatedView , final FadeAnimation animation , final AnimatorListener listener , final boolean show ) { if ( animation . getAlpha ( ) != null ) { ViewPropertyAnimator animator = animatedView . animate ( ) . setInterpolator ( animation . getInterpolator ( ) ) . se...
Creates an animator which should be used for a fade animation .
125,384
private ViewPropertyAnimator createAnimator ( final View animatedView , final RectangleRevealAnimation animation , final AnimatorListener listener ) { if ( animation . getX ( ) != null || animation . getY ( ) != null || animation . getWidth ( ) != null || animation . getHeight ( ) != null || animation . getAlpha ( ) !=...
Creates an animator which should be used for a rectangular reveal animation .
125,385
private void configureShowAnimator ( final View animatedView , final RectangleRevealAnimation animation , final ViewPropertyAnimator animator ) { int horizontalWindowInset = getDialog ( ) . getWindowInsetLeft ( ) + getDialog ( ) . getWindowInsetRight ( ) ; int verticalWindowInset = getDialog ( ) . getWindowInsetTop ( )...
Configures an animator which should be used to show the dialog using a rectangular reveal animation .
125,386
private Animator createAnimator ( final View animatedView , final View rootView , final CircleRevealAnimation animation , final AnimatorListener listener , final boolean show ) { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . LOLLIPOP ) { long duration = getDuration ( animatedView , animation ) ; int horizon...
Creates an animator which should be used for a circle reveal animation .
125,387
private long getDuration ( final View animatedView , final DialogAnimation animation ) { double scale = 1 ; if ( animatedView . getAnimation ( ) != null ) { scale = ( double ) ( System . currentTimeMillis ( ) - animatedView . getAnimation ( ) . getStartTime ( ) ) / ( double ) animatedView . getAnimation ( ) . getDurati...
Returns the duration which should be used for an animation depending on whether a previous animation is still running or not .
125,388
private AnimatorListener createHideAnimationListener ( final View animatedView , final AnimatorListener listener ) { return new AnimatorListener ( ) { public void onAnimationStart ( final Animator animation ) { if ( listener != null ) { listener . onAnimationStart ( animation ) ; } } public void onAnimationEnd ( final ...
Creates and returns an animation listener which allows to hide the animated view once the animation is finished .
125,389
public final boolean showAnimated ( final DialogAnimation animation , final AnimatorListener listener ) { hidden = false ; if ( animation != null ) { Window window = getWindow ( ) ; View view = getRootView ( ) ; if ( view != null && window != null ) { View animatedView = getDialog ( ) . isFullscreen ( ) ? window . getD...
Shows the dialog in an animated manner according to a specific animation .
125,390
protected final void attemptCloseDialog ( ) { switch ( buttonType ) { case AlertDialog . BUTTON_NEGATIVE : dialog . cancel ( ) ; break ; case AlertDialog . BUTTON_NEUTRAL : dialog . cancel ( ) ; break ; case AlertDialog . BUTTON_POSITIVE : dialog . dismiss ( ) ; break ; default : break ; } }
Attempts to close the dialog depending on the type of the buttonType or list view the listener belongs to .
125,391
private OnShowListener createOnShowListener ( ) { return new OnShowListener ( ) { public void onShow ( final DialogInterface dialog ) { decorator . showAnimated ( getShowAnimation ( ) , null ) ; if ( onShowListener != null ) { onShowListener . onShow ( dialog ) ; } } } ; }
Creates and returns a listener which allows to observe when the dialog has been shown .
125,392
private AnimatorListener createDismissAnimationListener ( ) { return new AnimatorListenerAdapter ( ) { public void onAnimationEnd ( Animator animation ) { super . onAnimationEnd ( animation ) ; AbstractAnimateableDialog . super . dismiss ( ) ; } } ; }
Creates and returns an animation listener which allows to dismiss the dialog once the animation which is used to hide it has finished .
125,393
private AnimatorListener createCancelAnimationListener ( ) { return new AnimatorListenerAdapter ( ) { public void onAnimationEnd ( final Animator animation ) { super . onAnimationEnd ( animation ) ; AbstractAnimateableDialog . super . cancel ( ) ; } } ; }
Creates and returns an animation listener which allows to cancel the dialog once the animation which is used to hide it has finished .
125,394
private View . OnClickListener createItemClickListener ( final int position ) { return new View . OnClickListener ( ) { public void onClick ( View v ) { setItemChecked ( position , ! isItemChecked ( position ) ) ; if ( itemClickListener != null ) { itemClickListener . onItemClick ( RecyclerViewAdapterWrapper . this , p...
Creates a listener which allows to select a list item when it has been clicked .
125,395
public final void setItemChecked ( final int position , final boolean checked ) { if ( choiceMode . setItemChecked ( position , checked ) ) { notifyDataSetChanged ( ) ; if ( checked && itemSelectedListener != null ) { itemSelectedListener . onItemSelected ( position ) ; } } }
Sets whether the list item at a specific position should be selected or not .
125,396
private void notifyOnScrolled ( final boolean scrolledToTop , final boolean scrolledToBottom ) { for ( ScrollListener listener : scrollListeners ) { listener . onScrolled ( scrolledToTop , scrolledToBottom ) ; } }
Notifies when the scroll view has been scrolled .
125,397
public void addScrollListener ( final ScrollListener listener ) { Condition . INSTANCE . ensureNotNull ( listener , "The listener may not be null" ) ; this . scrollListeners . add ( listener ) ; }
Adds a listener which should be notified when the scroll view is scrolled .
125,398
public void removeScrollListener ( final ScrollListener listener ) { Condition . INSTANCE . ensureNotNull ( listener , "The listener may not be null" ) ; this . scrollListeners . remove ( listener ) ; }
Removes a specific listener which should not be notified when the scroll view is scrolled anymore .
125,399
public final boolean isScrolledToBottom ( ) { int y = getScrollY ( ) ; View view = getChildAt ( 0 ) ; return ( view . getBottom ( ) - y ) == getHeight ( ) ; }
Returns whether the scroll view is scrolled to the bottom or not .