idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
1,600
private void adaptWindowBackgroundAndInset ( ) { DialogRootView rootView = getRootView ( ) ; if ( rootView != null ) { rootView . setWindowBackgroundAndInset ( windowBackground , windowInsets ) ; } }
Adapts the background and inset of the dialog s window .
1,601
private void adaptLayoutParams ( ) { DialogRootView rootView = getRootView ( ) ; if ( getWindow ( ) != null && rootView != null ) { rootView . setLayoutParams ( createLayoutParams ( ) ) ; rootView . setFullscreen ( isFullscreen ( ) ) ; rootView . setMaxWidth ( getMaxWidth ( ) ) ; rootView . setMaxHeight ( getMaxHeight ...
Adapts the layout params of the dialog .
1,602
private void adaptPadding ( ) { ViewGroup dialogRootView = getRootView ( ) ; if ( dialogRootView != null ) { dialogRootView . setPadding ( getPaddingLeft ( ) , getPaddingTop ( ) , getPaddingRight ( ) , getPaddingBottom ( ) ) ; } }
Adapts the padding of the dialog .
1,603
private void adaptIcon ( ) { if ( iconImageView != null ) { ImageViewCompat . setImageTintList ( iconImageView , iconTintList ) ; ImageViewCompat . setImageTintMode ( iconImageView , iconTintMode ) ; iconImageView . setImageDrawable ( icon ) ; iconImageView . setVisibility ( icon != null ? View . VISIBLE : View . GONE ...
Adapts the dialog s icon .
1,604
private void adaptTitleContainerVisibility ( ) { if ( titleContainer != null ) { boolean visible = isCustomTitleUsed ( ) || ! TextUtils . isEmpty ( title ) || icon != null ; if ( visible ) { titleContainer . setVisibility ( View . VISIBLE ) ; notifyOnAreaShown ( Area . TITLE ) ; } else { titleContainer . setVisibility ...
Adapts the visibility of the parent view of the text view which is used to show the title of the dialog .
1,605
private void adaptMessage ( ) { if ( messageTextView != null ) { messageTextView . setText ( message ) ; messageTextView . setVisibility ( ! TextUtils . isEmpty ( message ) ? View . VISIBLE : View . GONE ) ; } adaptMessageContainerVisibility ( ) ; }
Adapts the dialog s message .
1,606
private void adaptMessageContainerVisibility ( ) { if ( titleContainer != null ) { boolean visible = isCustomMessageUsed ( ) || ! TextUtils . isEmpty ( message ) ; if ( visible ) { messageContainer . setVisibility ( View . VISIBLE ) ; notifyOnAreaShown ( Area . MESSAGE ) ; } else { messageContainer . setVisibility ( Vi...
Adapts the visibility of the parent view of the text view which is used to show the message of the dialog .
1,607
private void adaptBackground ( final BackgroundAnimation animation ) { if ( getRootView ( ) != null && getWindow ( ) != null ) { Drawable newBackground = background ; if ( animation != null && newBackground != null ) { View animatedView = isFullscreen ( ) ? getWindow ( ) . getDecorView ( ) : getRootView ( ) ; Drawable ...
Adapts the dialog s background .
1,608
private void adaptContentContainerVisibility ( ) { if ( contentContainer != null ) { if ( isCustomViewUsed ( ) ) { contentContainer . setVisibility ( View . VISIBLE ) ; notifyOnAreaShown ( Area . CONTENT ) ; } else { contentContainer . setVisibility ( View . GONE ) ; notifyOnAreaHidden ( Area . CONTENT ) ; } } }
Adapts the visibility of the parent view of the view which is used to show the dialog s content .
1,609
private void obtainItemColor ( final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogItemColor } ) ; int defaultColor = ThemeUtil . getColor ( getContext ( ) , themeResourceId , android . R . attr . textCol...
Obtains the item color from a specific theme .
1,610
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 .
1,611
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 .
1,612
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 .
1,613
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 .
1,614
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 .
1,615
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 .
1,616
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 .
1,617
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 .
1,618
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 .
1,619
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 .
1,620
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 .
1,621
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 .
1,622
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 .
1,623
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 .
1,624
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 .
1,625
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 .
1,626
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 .
1,627
private void adaptDividerColor ( ) { adaptDividerColor ( topDivider ) ; adaptDividerColor ( bottomDivider ) ; if ( dividers != null ) { for ( Divider divider : dividers . values ( ) ) { adaptDividerColor ( divider ) ; } } }
Adapts the color of dividers .
1,628
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 .
1,629
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 .
1,630
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 .
1,631
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 .
1,632
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 .
1,633
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 .
1,634
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 .
1,635
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 .
1,636
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 .
1,637
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 .
1,638
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 .
1,639
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 .
1,640
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 .
1,641
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 .
1,642
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 .
1,643
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 .
1,644
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 .
1,645
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 .
1,646
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 .
1,647
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 .
1,648
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 .
1,649
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 .
1,650
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 .
1,651
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 .
1,652
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 .
1,653
private void adaptButtonBar ( ) { if ( buttonBarContainer != null ) { inflateButtonBar ( ) ; adaptPositiveButton ( ) ; adaptNegativeButton ( ) ; adaptNeutralButton ( ) ; adaptButtonTextColor ( ) ; adaptButtonTypeface ( ) ; adaptButtonBarContainerVisibility ( ) ; adaptButtonBarDividerVisibility ( ) ; } }
Adapts the button bar .
1,654
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 .
1,655
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 .
1,656
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 .
1,657
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 .
1,658
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 .
1,659
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 .
1,660
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 .
1,661
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 .
1,662
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 .
1,663
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 .
1,664
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 .
1,665
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 .
1,666
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 .
1,667
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 .
1,668
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 .
1,669
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 .
1,670
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 .
1,671
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 .
1,672
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 .
1,673
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 .
1,674
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 .
1,675
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 .
1,676
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 .
1,677
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 .
1,678
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 .
1,679
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 .
1,680
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 .
1,681
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 .
1,682
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 .
1,683
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 .
1,684
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 .
1,685
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 .
1,686
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 .
1,687
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 .
1,688
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 .
1,689
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 .
1,690
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 .
1,691
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 .
1,692
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 .
1,693
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 .
1,694
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 .
1,695
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 .
1,696
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 .
1,697
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 .
1,698
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 .
1,699
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 .