idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
1,700
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 .
1,701
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 .
1,702
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 .
1,703
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 .
1,704
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 .
1,705
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 .
1,706
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 .
1,707
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 .
1,708
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 .
1,709
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 .
1,710
protected final void setContext ( final Context context ) { Condition . INSTANCE . ensureNotNull ( context , "The context may not be null" ) ; this . context = context ; }
Sets the context which should be used by the builder .
1,711
private int getCustomMessageId ( ) { switch ( progressBarPosition ) { case LEFT : return R . layout . progress_dialog_left ; case TOP : return R . layout . progress_dialog_top ; case RIGHT : return R . layout . progress_dialog_right ; case BOTTOM : return R . layout . progress_dialog_bottom ; default : return R . layou...
Returns the resource id of the layout which should be used as the dialog s custom message depending on the position of the dialog s progress bar .
1,712
private void adaptProgressBar ( ) { LayoutInflater inflater = LayoutInflater . from ( getContext ( ) ) ; View view = inflater . inflate ( getCustomMessageId ( ) , getRootView ( ) , false ) ; getDialog ( ) . setCustomMessage ( view ) ; View progressView = view . findViewById ( R . id . progress_bar ) ; progressBar = pro...
Adapts the dialog s progress bar .
1,713
private void adaptProgressBarSize ( ) { if ( progressBar != null ) { progressBar . setVisibility ( progressBarSize > 0 ? View . VISIBLE : View . GONE ) ; ViewGroup . LayoutParams layoutParams = progressBar . getLayoutParams ( ) ; layoutParams . width = progressBarSize ; layoutParams . height = progressBarSize ; } }
Adapts the size of the dialog s circular progress bar .
1,714
private void adaptMessageTextSize ( ) { if ( getRootView ( ) != null ) { View messageView = getRootView ( ) . findViewById ( android . R . id . message ) ; if ( messageView instanceof TextView ) { TextView messageTextView = ( TextView ) messageView ; if ( TextUtils . isEmpty ( getDialog ( ) . getTitle ( ) ) ) { message...
Adapts the text size of the dialog s message depending on whether a title is shown .
1,715
public final void addItem ( final CharSequence title , final Class < ? extends Fragment > fragmentClass , final Bundle arguments ) { Condition . INSTANCE . ensureNotNull ( fragmentClass , "The fragment class may not be null" ) ; items . add ( new ViewPagerItem ( title , fragmentClass , arguments ) ) ; notifyDataSetChan...
Adds a new fragment to the adapter .
1,716
private void initializeAlertDialog ( ) { MaterialDialog . Builder builder = new MaterialDialog . Builder ( getActivity ( ) ) ; configureHeaderDialogBuilder ( builder ) ; configureButtonBarDialogBuilder ( builder ) ; alertDialog = builder . create ( ) ; }
Initializes the alert dialog .
1,717
private void initializeListDialog ( ) { MaterialDialog . Builder builder = new MaterialDialog . Builder ( getActivity ( ) ) ; configureHeaderDialogBuilder ( builder ) ; configureButtonBarDialogBuilder ( builder ) ; builder . setItems ( R . array . list_items , createSingleChoiceListener ( ) ) ; listDialog = builder . c...
Initializes the list dialog .
1,718
private void initializeSingleChoiceListDialog ( ) { MaterialDialog . Builder builder = new MaterialDialog . Builder ( getActivity ( ) ) ; configureHeaderDialogBuilder ( builder ) ; configureButtonBarDialogBuilder ( builder ) ; builder . setSingleChoiceItems ( R . array . list_items , 0 , createSingleChoiceListener ( ) ...
Initializes the single choice list dialog .
1,719
private void initializeMultipleChoiceListDialog ( ) { MaterialDialog . Builder builder = new MaterialDialog . Builder ( getActivity ( ) ) ; configureHeaderDialogBuilder ( builder ) ; configureButtonBarDialogBuilder ( builder ) ; builder . setMultiChoiceItems ( R . array . list_items , new boolean [ ] { true , false , f...
Initializes the multiple choice list dialog .
1,720
private void initializeCustomDialog ( ) { MaterialDialog . Builder builder = new MaterialDialog . Builder ( getActivity ( ) ) ; configureHeaderDialogBuilder ( builder ) ; configureButtonBarDialogBuilder ( builder ) ; builder . setView ( R . layout . custom_dialog_content ) ; builder . setCustomTitle ( R . layout . cust...
Initializes the custom dialog .
1,721
private void initializeProgressDialog ( ) { ProgressDialog . Builder builder = new ProgressDialog . Builder ( getActivity ( ) ) ; configureHeaderDialogBuilder ( builder ) ; configureButtonBarDialogBuilder ( builder ) ; progressDialog = builder . create ( ) ; }
Initializes the progress dialog .
1,722
private void initializeEditTextDialog ( ) { EditTextDialog . Builder builder = new EditTextDialog . Builder ( getActivity ( ) ) . setHint ( R . string . edit_text_dialog_hint ) . setText ( getContext ( ) . getString ( R . string . edit_text_dialog_text ) ) . addValidator ( Validators . notEmpty ( getContext ( ) ) ) ; c...
Initializes the edit text dialog .
1,723
private void initializeThemePreference ( ) { Preference themePreference = findPreference ( getString ( R . string . theme_preference_key ) ) ; themePreference . setOnPreferenceChangeListener ( createThemeChangeListener ( ) ) ; }
Initializes the preference which allows to change the app s theme .
1,724
private void initializeFullscreenPreference ( ) { Preference fullscreenPreference = findPreference ( getString ( R . string . fullscreen_preference_key ) ) ; fullscreenPreference . setOnPreferenceChangeListener ( createThemeChangeListener ( ) ) ; }
Initializes the preference which allows to specfify whether dialogs should be shown fullscreen or not .
1,725
private void initializeShowAlertDialogPreference ( ) { Preference preference = findPreference ( getString ( R . string . show_alert_dialog_preference_key ) ) ; preference . setOnPreferenceClickListener ( new OnPreferenceClickListener ( ) { public boolean onPreferenceClick ( final Preference preference ) { initializeAle...
Initializes the preference which allows to show the alert dialog .
1,726
private void initializeShowListDialogPreference ( ) { Preference preference = findPreference ( getString ( R . string . show_list_dialog_preference_key ) ) ; preference . setOnPreferenceClickListener ( new OnPreferenceClickListener ( ) { public boolean onPreferenceClick ( final Preference preference ) { initializeListD...
Initializes the preference which allows to show the list dialog .
1,727
private void initializeShowSingleChoiceListDialogPreference ( ) { Preference preference = findPreference ( getString ( R . string . show_single_choice_dialog_preference_key ) ) ; preference . setOnPreferenceClickListener ( new OnPreferenceClickListener ( ) { public boolean onPreferenceClick ( final Preference preferenc...
Initializes the preference which allows to show the single choice list dialog .
1,728
private void initializeShowMultipleChoiceListDialogPreference ( ) { Preference preference = findPreference ( getString ( R . string . show_multi_choice_dialog_preference_key ) ) ; preference . setOnPreferenceClickListener ( new OnPreferenceClickListener ( ) { public boolean onPreferenceClick ( final Preference preferen...
Initializes the preference which allows to show the multiple choice list dialog .
1,729
private void initializeShowCustomDialogPreference ( ) { Preference preference = findPreference ( getString ( R . string . show_custom_dialog_preference_key ) ) ; preference . setOnPreferenceClickListener ( new OnPreferenceClickListener ( ) { public boolean onPreferenceClick ( final Preference preference ) { initializeC...
Initializes the preference which allows to show the custom dialog .
1,730
private void initializeShowProgressDialogPreference ( ) { Preference preference = findPreference ( getString ( R . string . show_progress_dialog_preference_key ) ) ; preference . setOnPreferenceClickListener ( new OnPreferenceClickListener ( ) { public boolean onPreferenceClick ( final Preference preference ) { initial...
Initializes the preference which allows to show the progress dialog .
1,731
private void initializeShowEditTextDialogPreference ( ) { Preference preference = findPreference ( getString ( R . string . show_edit_text_dialog_preference_key ) ) ; preference . setOnPreferenceClickListener ( new OnPreferenceClickListener ( ) { public boolean onPreferenceClick ( final Preference preference ) { initia...
Initializes the preference which allows to show the edit text dialog .
1,732
private DialogAnimation createRectangularRevealAnimation ( final Preference preference ) { if ( shouldUseAnimations ( ) ) { RecyclerView recyclerView = getListView ( ) ; View view = recyclerView . getChildAt ( preference . getOrder ( ) + 1 ) ; int [ ] viewLocation = new int [ 2 ] ; view . getLocationOnScreen ( viewLoca...
Creates and returns the rectangular reveal animation which should be used to show or hide dialogs .
1,733
private DialogAnimation createCircleRevealAnimation ( final View view ) { int [ ] location = new int [ 2 ] ; view . getLocationOnScreen ( location ) ; int margin = getResources ( ) . getDimensionPixelSize ( R . dimen . floating_action_button_margin ) ; int width = view . getWidth ( ) ; int height = view . getHeight ( )...
Creates and returns the circle reveal animation which should be used to show or hide dialogs .
1,734
private OnClickListener createSingleChoiceListener ( ) { return new OnClickListener ( ) { public void onClick ( final DialogInterface dialog , final int position ) { String text = getString ( R . string . single_choice_listener_text ) ; showToast ( String . format ( text , position ) ) ; } } ; }
Creates and returns a listener which allows to show a toast which indicates when a single choice list item of a dialog has been selected or unselected .
1,735
private OnMultiChoiceClickListener createMultiChoiceListener ( ) { return new OnMultiChoiceClickListener ( ) { public void onClick ( final DialogInterface dialog , final int position , final boolean isChecked ) { String text = getString ( R . string . multi_choice_listener_selected_text ) ; if ( ! isChecked ) { text = ...
Creates and returns a listener which allows to show a toast which indicates when a multi choice list item of a dialog has been selected or unselected .
1,736
private void initializeShowWizardDialogPreference ( ) { Preference preference = findPreference ( getString ( R . string . show_wizard_dialog_preference_key ) ) ; preference . setOnPreferenceClickListener ( new OnPreferenceClickListener ( ) { public boolean onPreferenceClick ( final Preference preference ) { WizardDialo...
Initializes the preference which allows to show a wizard dialog .
1,737
private OnPageChangeListener createWizardDialogPageChangeListener ( final WizardDialog wizardDialog ) { return new OnPageChangeListener ( ) { public void onPageScrolled ( final int position , final float positionOffset , final int positionOffsetPixels ) { } public void onPageSelected ( final int position ) { int [ ] co...
Creates and returns a listener which allows to change the background color of the wizard dialog when its view pager is scrolled .
1,738
private AnimationListener createHeaderAnimationListener ( final WizardDialog wizardDialog ) { return new AnimationListener ( ) { public void onAnimationStart ( ) { } public void onAnimationEnd ( ) { int duration = getResources ( ) . getInteger ( android . R . integer . config_shortAnimTime ) ; BackgroundAnimation anima...
Creates and returns a listener which allows to reset a wizard dialog s header background to default when its animation is finished .
1,739
private void addFragment ( final WizardDialog . Builder builder , final int index ) { Bundle arguments = new Bundle ( ) ; arguments . putInt ( DialogFragment . INDEX_EXTRA , index ) ; CharSequence title = shouldHeaderBeShown ( ) ? null : String . format ( getString ( R . string . dialog_tab_text ) , index ) ; builder ....
Adds a new fragment to a builder which allows to create wizard dialogs .
1,740
private void showToast ( final String text ) { if ( toast != null ) { toast . cancel ( ) ; } toast = Toast . makeText ( getActivity ( ) , text , Toast . LENGTH_SHORT ) ; toast . show ( ) ; }
Shows a specific toast and cancels a previous one if existing .
1,741
private void configureHeaderDialogBuilder ( final AbstractHeaderDialogBuilder builder ) { builder . setFullscreen ( shouldUseFullscreen ( ) ) ; if ( shouldTitleBeShown ( ) ) { builder . setTitle ( getDialogTitle ( ) ) ; } if ( shouldMessageBeShown ( ) ) { builder . setMessage ( getDialogMessage ( ) ) ; } if ( shouldIco...
Configures a builder which allows to create header dialogs depending on the app s settings .
1,742
private void configureButtonBarDialogBuilder ( final AbstractButtonBarDialogBuilder builder ) { if ( shouldNegativeButtonBeShown ( ) ) { builder . setNegativeButton ( getNegativeButtonText ( ) , createNegativeButtonListener ( ) ) ; } if ( shouldNeutralButtonBeShown ( ) ) { builder . setNeutralButton ( getNeutralButtonT...
Configures a builder which allows to create button bar dialogs depending on the app s settings .
1,743
private OnClickListener createNegativeButtonListener ( ) { return new OnClickListener ( ) { public void onClick ( DialogInterface dialog , int which ) { Toast . makeText ( getActivity ( ) , R . string . negative_button_toast , Toast . LENGTH_SHORT ) . show ( ) ; } } ; }
Creates and returns a listener which allows to show a toast when the negative button of a dialog has been clicked .
1,744
private OnClickListener createNeutralButtonListener ( ) { return new OnClickListener ( ) { public void onClick ( DialogInterface dialog , int which ) { Toast . makeText ( getActivity ( ) , R . string . neutral_button_toast , Toast . LENGTH_SHORT ) . show ( ) ; } } ; }
Creates and returns a listener which allows to show a toast when the neutral button of a dialog has been clicked .
1,745
private OnClickListener createPositiveButtonListener ( ) { return new OnClickListener ( ) { public void onClick ( DialogInterface dialog , int which ) { Toast . makeText ( getActivity ( ) , R . string . positive_button_toast , Toast . LENGTH_SHORT ) . show ( ) ; } } ; }
Creates and returns a listener which allows to show a toast when the positive button of a dialog has been clicked .
1,746
private boolean shouldTitleBeShown ( ) { SharedPreferences sharedPreferences = PreferenceManager . getDefaultSharedPreferences ( getActivity ( ) ) ; String key = getString ( R . string . show_dialog_title_preference_key ) ; boolean defaultValue = getResources ( ) . getBoolean ( R . bool . show_dialog_title_preference_d...
Returns whether the title of the example dialog should be shown or not .
1,747
private String getDialogTitle ( ) { SharedPreferences sharedPreferences = PreferenceManager . getDefaultSharedPreferences ( getActivity ( ) ) ; String key = getString ( R . string . dialog_title_preference_key ) ; String defaultValue = getString ( R . string . dialog_title_preference_default_value ) ; return sharedPref...
Returns the title of the example dialog .
1,748
private boolean shouldIconBeShown ( ) { SharedPreferences sharedPreferences = PreferenceManager . getDefaultSharedPreferences ( getActivity ( ) ) ; String key = getString ( R . string . show_dialog_icon_preference_key ) ; boolean defaultValue = getResources ( ) . getBoolean ( R . bool . show_dialog_icon_preference_defa...
Returns whether the icon of the example dialog should be shown or not .
1,749
private boolean shouldMessageBeShown ( ) { SharedPreferences sharedPreferences = PreferenceManager . getDefaultSharedPreferences ( getActivity ( ) ) ; String key = getString ( R . string . show_dialog_message_preference_key ) ; boolean defaultValue = getResources ( ) . getBoolean ( R . bool . show_dialog_message_prefer...
Returns whether the message of the example dialog should be shown or not .
1,750
private String getDialogMessage ( ) { SharedPreferences sharedPreferences = PreferenceManager . getDefaultSharedPreferences ( getActivity ( ) ) ; String key = getString ( R . string . dialog_message_preference_key ) ; String defaultValue = getString ( R . string . dialog_message_preference_default_value ) ; return shar...
Returns the message of the example dialog .
1,751
private boolean shouldNegativeButtonBeShown ( ) { SharedPreferences sharedPreferences = PreferenceManager . getDefaultSharedPreferences ( getActivity ( ) ) ; String key = getString ( R . string . show_negative_button_preference_key ) ; boolean defaultValue = getResources ( ) . getBoolean ( R . bool . show_negative_butt...
Returns whether the negative button of the example dialog should be shown or not .
1,752
private String getNegativeButtonText ( ) { SharedPreferences sharedPreferences = PreferenceManager . getDefaultSharedPreferences ( getActivity ( ) ) ; String key = getString ( R . string . negative_button_text_preference_key ) ; String defaultValue = getString ( R . string . negative_button_text_preference_default_valu...
Returns the text of the example dialog s negative button .
1,753
private boolean shouldNeutralButtonBeShown ( ) { SharedPreferences sharedPreferences = PreferenceManager . getDefaultSharedPreferences ( getActivity ( ) ) ; String key = getString ( R . string . show_neutral_button_preference_key ) ; boolean defaultValue = getResources ( ) . getBoolean ( R . bool . show_neutral_button_...
Returns whether the neutral button of the example dialog should be shown or not .
1,754
private String getNeutralButtonText ( ) { SharedPreferences sharedPreferences = PreferenceManager . getDefaultSharedPreferences ( getActivity ( ) ) ; String key = getString ( R . string . neutral_button_text_preference_key ) ; String defaultValue = getString ( R . string . neutral_button_text_preference_default_value )...
Returns the text of the example dialog s neutral button .
1,755
private boolean shouldPositiveButtonBeShown ( ) { SharedPreferences sharedPreferences = PreferenceManager . getDefaultSharedPreferences ( getActivity ( ) ) ; String key = getString ( R . string . show_positive_button_preference_key ) ; boolean defaultValue = getResources ( ) . getBoolean ( R . bool . show_positive_butt...
Returns whether the positive button of the example dialog should be shown or not .
1,756
private String getPositiveButtonText ( ) { SharedPreferences sharedPreferences = PreferenceManager . getDefaultSharedPreferences ( getActivity ( ) ) ; String key = getString ( R . string . positive_button_text_preference_key ) ; String defaultValue = getString ( R . string . positive_button_text_preference_default_valu...
Returns the text of the example dialog s positive button .
1,757
private boolean shouldStackButtons ( ) { SharedPreferences sharedPreferences = PreferenceManager . getDefaultSharedPreferences ( getActivity ( ) ) ; String key = getString ( R . string . stack_buttons_preference_key ) ; boolean defaultValue = getResources ( ) . getBoolean ( R . bool . stack_buttons_preference_default_v...
Returns whether the buttons of the example dialog should be stacked or not .
1,758
private boolean shouldButtonBarDividerBeShown ( ) { SharedPreferences sharedPreferences = PreferenceManager . getDefaultSharedPreferences ( getActivity ( ) ) ; String key = getString ( R . string . show_button_bar_divider_preference_key ) ; boolean defaultValue = getResources ( ) . getBoolean ( R . bool . show_button_b...
Returns whether the divider which is located above the dialog s buttons should be shown or not .
1,759
private boolean shouldHeaderBeShown ( ) { SharedPreferences sharedPreferences = PreferenceManager . getDefaultSharedPreferences ( getActivity ( ) ) ; String key = getString ( R . string . show_dialog_header_preference_key ) ; boolean defaultValue = getResources ( ) . getBoolean ( R . bool . show_dialog_header_preferenc...
Returns whether the header of the example dialog should be shown or not .
1,760
private boolean shouldUseAnimations ( ) { SharedPreferences sharedPreferences = PreferenceManager . getDefaultSharedPreferences ( getActivity ( ) ) ; String key = getString ( R . string . animation_preference_key ) ; boolean defaultValue = getResources ( ) . getBoolean ( R . bool . animation_preference_default_value ) ...
Returns whether animations should be used to show or hide dialogs or not .
1,761
private boolean shouldUseFullscreen ( ) { SharedPreferences sharedPreferences = PreferenceManager . getDefaultSharedPreferences ( getActivity ( ) ) ; String key = getString ( R . string . fullscreen_preference_key ) ; boolean defaultValue = getResources ( ) . getBoolean ( R . bool . fullscreen_preference_default_value ...
Returns whether dialogs should be shown fullscreen or not .
1,762
public final void showAlertDialog ( final View view ) { initializeAlertDialog ( ) ; alertDialog . setShowAnimation ( createCircleRevealAnimation ( view ) ) ; alertDialog . setDismissAnimation ( createCircleRevealAnimation ( view ) ) ; alertDialog . setCancelAnimation ( createCircleRevealAnimation ( view ) ) ; alertDial...
Shows an alert dialog using a circle reveal animation .
1,763
private AnimatorListener createVisibilityAnimationListener ( final boolean show ) { return new AnimatorListenerAdapter ( ) { public void onAnimationStart ( final Animator animation ) { super . onAnimationStart ( animation ) ; if ( show ) { Divider . super . setVisibility ( View . VISIBLE ) ; } } public void onAnimation...
Creates and returns a listener which allows to observe the progress of an animation which is used to show or hide the divider .
1,764
public final void setVisibility ( final int visibility , final boolean animate ) { boolean visible = visibility == View . VISIBLE ; Boolean tag = ( Boolean ) getTag ( ) ; setTag ( visible ) ; if ( animate ) { if ( tag == null || tag != visible ) { if ( getAnimation ( ) != null ) { getAnimation ( ) . cancel ( ) ; } anim...
Sets the visibility of the divider .
1,765
private Map < ViewType , View > applyDecorators ( final Window window , final DialogRootView rootView , final View view , final FragmentManager fragmentManager ) { Map < ViewType , View > result = new HashMap < > ( ) ; for ( AbstractDecorator < ? , ? > decorator : decorators ) { if ( decorator instanceof AbstractDialog...
Applies all registered decorators to the dialog .
1,766
private void detachDecorators ( final DialogRootView rootView ) { for ( AbstractDecorator < ? , ? > decorator : decorators ) { decorator . detach ( ) ; decorator . removeAreaListener ( rootView ) ; } }
Detaches all registered decorators from the dialog .
1,767
private void obtainShowHeader ( final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogShowHeader } ) ; showHeader ( typedArray . getBoolean ( 0 , false ) ) ; }
Obtains whether the dialog s header should be shown or not from a specific theme .
1,768
private void obtainHeaderHeight ( final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogHeaderHeight } ) ; int defaultHeight = getContext ( ) . getResources ( ) . getDimensionPixelSize ( R . dimen . dialog_...
Obtains the height of the dialog s header from a specific theme .
1,769
private void obtainHeaderBackground ( final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogHeaderBackground } ) ; int resourceId = typedArray . getResourceId ( 0 , 0 ) ; if ( resourceId != 0 ) { setHeaderB...
Obtains the background of the dialog s header from a specific theme .
1,770
private void obtainHeaderIcon ( final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogHeaderIcon } ) ; int resourceId = typedArray . getResourceId ( 0 , 0 ) ; if ( resourceId != 0 ) { setHeaderIcon ( resour...
Obtains the icon of the dialog s header from a specific theme .
1,771
private void obtainHeaderIconTintList ( final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogHeaderIconTint } ) ; setHeaderIconTintList ( typedArray . getColorStateList ( 0 ) ) ; }
Obtains the color state list which is used to tint the header icon of the dialog from a specific theme .
1,772
private void obtainHeaderDividerColor ( final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogHeaderDividerColor } ) ; int defaultColor = ContextCompat . getColor ( getContext ( ) , R . color . header_divid...
Obtains the color of the divider of the dialog s header from a specific theme .
1,773
private void obtainShowHeaderDivider ( final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogShowHeaderDivider } ) ; showHeaderDivider ( typedArray . getBoolean ( 0 , true ) ) ; }
Obtains whether the divider of the dialog s header should be shown or not from a specific theme .
1,774
public static ScrollableArea create ( final Area top , final Area bottom ) { return new ScrollableArea ( top , bottom ) ; }
Creates and returns a new scrollable area .
1,775
public final boolean isScrollable ( final Area area ) { return topScrollableArea != null && topScrollableArea . getIndex ( ) <= area . getIndex ( ) && bottomScrollableArea . getIndex ( ) >= area . getIndex ( ) ; }
Returns whether a specific area is scrollable .
1,776
private void reInflateTabLayout ( ) { View rootView = getRootView ( ) ; if ( rootView != null ) { View headerContentContainer = rootView . findViewById ( R . id . header_content_container ) ; View contentContainer = rootView . findViewById ( R . id . content_container ) ; if ( headerContentContainer != null && contentC...
Re - inflates the tab layout which indicates the currently shown fragment if the dialog has already been created .
1,777
private void inflateTabLayout ( final View headerView , final View contentView ) { LayoutInflater layoutInflater = LayoutInflater . from ( getContext ( ) ) ; ViewGroup headerContentContainer = headerView . findViewById ( R . id . header_content_container ) ; ViewGroup contentContainer = contentView . findViewById ( R ....
Inflates the tab layout which indicates the currently shown fragment .
1,778
private void adaptTabLayoutEnableState ( ) { if ( tabLayout != null ) { LinearLayout tabStrip = ( ( LinearLayout ) tabLayout . getChildAt ( 0 ) ) ; tabStrip . setEnabled ( tabLayoutEnabled ) ; for ( int i = 0 ; i < tabStrip . getChildCount ( ) ; i ++ ) { tabStrip . getChildAt ( i ) . setEnabled ( tabLayoutEnabled ) ; }...
Adapts the enable state of the tab layout which indicates the currently shown fragment .
1,779
private void adaptTabLayoutVisibility ( ) { if ( tabLayout != null ) { tabLayout . setVisibility ( tabLayoutShown ? View . VISIBLE : View . GONE ) ; } }
Adapts the visibility of the tab layout which indicates the currently shown fragment .
1,780
private void adaptBackButton ( ) { if ( backButton != null ) { backButton . setText ( backButtonText . toString ( ) . toUpperCase ( Locale . getDefault ( ) ) ) ; backButton . setOnClickListener ( createBackButtonListener ( ) ) ; } }
Adapts the dialog s back button .
1,781
private OnClickListener createBackButtonListener ( ) { return new OnClickListener ( ) { public void onClick ( final View v ) { int selectedIndex = viewPager . getCurrentItem ( ) ; if ( notifyOnPrevious ( selectedIndex ) ) { viewPager . setCurrentItem ( selectedIndex - 1 ) ; } } } ; }
Creates and returns a listener which allows to show the previous fragment when the corresponding button is clicked .
1,782
private void adaptNextButton ( ) { if ( nextButton != null ) { nextButton . setText ( nextButtonText . toString ( ) . toUpperCase ( Locale . getDefault ( ) ) ) ; nextButton . setOnClickListener ( createNextButtonListener ( ) ) ; } }
Adapts the dialog s next button .
1,783
private OnClickListener createNextButtonListener ( ) { return new OnClickListener ( ) { public void onClick ( final View v ) { int selectedIndex = viewPager . getCurrentItem ( ) ; if ( notifyOnNext ( selectedIndex ) ) { viewPager . setCurrentItem ( selectedIndex + 1 ) ; } } } ; }
Creates and returns a listener which allows to show the next fragment when the corresponding button is clicked .
1,784
private void adaptFinishButton ( ) { if ( finishButton != null ) { finishButton . setText ( finishButtonText . toString ( ) . toUpperCase ( Locale . getDefault ( ) ) ) ; finishButton . setOnClickListener ( createFinishButtonListener ( ) ) ; } }
Adapts the dialog s finish button .
1,785
private OnClickListener createFinishButtonListener ( ) { return new OnClickListener ( ) { public void onClick ( final View v ) { int selectedIndex = viewPager . getCurrentItem ( ) ; if ( notifyOnFinish ( selectedIndex ) ) { getDialog ( ) . dismiss ( ) ; } } } ; }
Creates and returns a listener which allows to close the dialog when the corresponding button is clicked .
1,786
private void adaptButtonBarVisibility ( ) { if ( buttonBarContainer != null ) { buttonBarContainer . setVisibility ( buttonBarShown ? View . VISIBLE : View . GONE ) ; } }
Adapts the visibility of the dialog s buttons .
1,787
private void adaptButtonBarDividerMargin ( ) { if ( buttonBarDivider != null ) { LinearLayout . LayoutParams layoutParams = ( LinearLayout . LayoutParams ) buttonBarDivider . getLayoutParams ( ) ; layoutParams . leftMargin = buttonBarDividerMargin ; layoutParams . rightMargin = buttonBarDividerMargin ; buttonBarDivider...
Adapts the left and right margin of the divider which is shown above the dialog s buttons .
1,788
private void adaptButtonVisibility ( ) { if ( viewPager != null && viewPagerAdapter != null && backButton != null && nextButton != null && finishButton != null ) { int selectedIndex = viewPager . getCurrentItem ( ) ; backButton . setVisibility ( selectedIndex > 0 ? View . VISIBLE : View . GONE ) ; nextButton . setVisib...
Adapts the visibility of the dialog s buttons depending on the currently shown fragment .
1,789
private boolean notifyOnNext ( final int index ) { boolean result = true ; for ( WizardListener listener : wizardListeners ) { result &= listener . onNext ( index , viewPagerAdapter . getItem ( index ) ) ; } return result ; }
Notifies all listeners when the next fragment is about to be shown .
1,790
private boolean notifyOnPrevious ( final int index ) { boolean result = true ; for ( WizardListener listener : wizardListeners ) { result &= listener . onPrevious ( index , viewPagerAdapter . getItem ( index ) ) ; } return result ; }
Notifies all listeners when the previous fragment is about to be shown .
1,791
private boolean notifyOnFinish ( final int index ) { boolean result = true ; for ( WizardListener listener : wizardListeners ) { result &= listener . onFinish ( index , viewPagerAdapter . getItem ( index ) ) ; } return result ; }
Notifies all listeners when the last fragment is about to be finished .
1,792
private void obtainButtonTextColor ( final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogButtonTextColor } ) ; ColorStateList colorStateList = typedArray . getColorStateList ( 0 ) ; if ( colorStateList !=...
Obtains the button text color from a specific theme .
1,793
private void obtainShowButtonBarDivider ( final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogShowButtonBarDivider } ) ; showButtonBarDivider ( typedArray . getBoolean ( 0 , false ) ) ; }
Obtains whether the divider which is located above the dialog s buttons should be shown or not from a specific theme .
1,794
public final BuilderType addDialogValidator ( final DialogValidator validator ) { Condition . INSTANCE . ensureNotNull ( validator , "The validator may not be null" ) ; getProduct ( ) . addDialogValidator ( validator ) ; return self ( ) ; }
Adds a new validator which should be executed when the positive button of the dialog which is created by the builder is clicked .
1,795
public final BuilderType addAllDialogValidators ( final Collection < DialogValidator > validators ) { Condition . INSTANCE . ensureNotNull ( validators , "The collection may not be null" ) ; getProduct ( ) . addAllDialogValidators ( validators ) ; return self ( ) ; }
Adds all validators which are contained by a specific collection and should be executed when the positive button of the dialog which is created by the builder is clicked .
1,796
public static void show ( FragmentManager fragmentManager , Class < ? extends MvcDialog > dialogClass ) { FragmentTransaction ft = fragmentManager . beginTransaction ( ) ; MvcDialog dialogFragment = ( MvcDialog ) fragmentManager . findFragmentByTag ( dialogClass . getName ( ) ) ; if ( dialogFragment == null ) { try { d...
Show dialog .
1,797
public void onCreate ( ) { super . onCreate ( ) ; graphMonitor = new Graph . Monitor ( ) { public void onInject ( Object target ) { if ( controller != null && target == MvcService . this ) { controller . view = MvcService . this ; } } public void onRelease ( Object target ) { } } ; Mvc . graph ( ) . registerMonitor ( g...
Callback of creating a service
1,798
public void onDestroy ( ) { super . onDestroy ( ) ; eventRegister . unregisterEventBuses ( ) ; if ( getControllerClass ( ) != null ) { try { Mvc . graph ( ) . dereference ( controller , getControllerClass ( ) , null ) ; } catch ( ProviderMissingException e ) { Logger logger = LoggerFactory . getLogger ( getClass ( ) ) ...
Callback of destroying a service
1,799
public Component unregister ( Provider provider ) throws ProviderMissingException { return unregister ( provider . type ( ) , provider . getQualifier ( ) ) ; }
Unregister provider . If there is an overridden type registered already only unregister the overridden binding . The original one will be unregistered if the this method is called again against to the type and qualifier associated with the provider .