idx
int64 0
41.2k
| question
stringlengths 74
4.21k
| target
stringlengths 5
888
|
---|---|---|
0 | private void obtainPreviewBackground ( final TypedArray typedArray ) { int backgroundColor = typedArray . getColor ( R . styleable . AbstractColorPickerPreference_previewBackground , - 1 ) ; if ( backgroundColor != - 1 ) { setPreviewBackgroundColor ( backgroundColor ) ; } else { int resourceId = typedArray . getResourceId ( R . styleable . AbstractColorPickerPreference_previewBackground , R . drawable . color_picker_default_preview_background ) ; setPreviewBackground ( ContextCompat . getDrawable ( getContext ( ) , resourceId ) ) ; } } | Obtains the background of the preview of the preference s color from a specific typed array . |
1 | private void obtainColorFormat ( final TypedArray typedArray ) { int defaultValue = getContext ( ) . getResources ( ) . getInteger ( R . integer . color_picker_preference_default_color_format ) ; setColorFormat ( ColorFormat . fromValue ( typedArray . getInteger ( R . styleable . AbstractColorPickerPreference_colorFormat , defaultValue ) ) ) ; } | Obtains the format which should be used to print a textual representation of the preference s color from a specific typed array . |
2 | private CharSequence formatColor ( final ColorFormat colorFormat , final int color ) { Condition . INSTANCE . ensureNotNull ( colorFormat , "The color format may not be null" ) ; if ( colorFormat == ColorFormat . RGB ) { return String . format ( Locale . getDefault ( ) , "R = %d, G = %d, B = %d" , Color . red ( color ) , Color . green ( color ) , Color . blue ( color ) ) ; } else if ( colorFormat == ColorFormat . ARGB ) { return String . format ( Locale . getDefault ( ) , "A = %d, R = %d, G = %d, B = %d" , Color . alpha ( color ) , Color . red ( color ) , Color . green ( color ) , Color . blue ( color ) ) ; } else if ( colorFormat == ColorFormat . HEX_3_BYTES ) { return String . format ( "#%06X" , ( 0xFFFFFF & color ) ) ; } else { return String . format ( "#%08X" , ( color ) ) ; } } | Creates and returns a textual representation of a color according to a specific format . |
3 | private void adaptPreviewView ( ) { if ( previewView != null ) { if ( isPreviewShown ( ) ) { previewView . setVisibility ( View . VISIBLE ) ; previewView . setLayoutParams ( createPreviewLayoutParams ( ) ) ; previewLoader . load ( getColor ( ) , previewView ) ; } else { previewView . setVisibility ( View . INVISIBLE ) ; previewView . setImageBitmap ( null ) ; } } } | Adapts the view which is used to show a preview of the preference s color depending on the preference s properties and the currently persisted color . |
4 | private LayoutParams createPreviewLayoutParams ( ) { LayoutParams layoutParams = new LayoutParams ( getPreviewSize ( ) , getPreviewSize ( ) ) ; layoutParams . gravity = Gravity . CENTER_VERTICAL ; return layoutParams ; } | Creates and returns the layout params of the view which is used to show a preview of the preference s color depending on the preference s properties . |
5 | public final void setColor ( final int color ) { if ( this . color != color ) { this . color = color ; persistInt ( color ) ; notifyChanged ( ) ; adaptPreviewView ( ) ; } } | Sets the current color of the preference . By setting a value it will be persisted . |
6 | public final void setPreviewSize ( final int previewSize ) { Condition . INSTANCE . ensureAtLeast ( previewSize , 1 , "The preview size must be at least 1" ) ; this . previewSize = previewSize ; if ( previewLoader != null ) { previewLoader . setSize ( previewSize ) ; } } | Sets the size of the preview of the preference s color . |
7 | public final void setPreviewShape ( final PreviewShape previewShape ) { Condition . INSTANCE . ensureNotNull ( previewShape , "The preview shape may not be null" ) ; this . previewShape = previewShape ; if ( previewLoader != null ) { previewLoader . setShape ( previewShape ) ; } adaptPreviewView ( ) ; } | Sets the shape of the preview of the preference s color . |
8 | public final void setPreviewBorderWidth ( final int borderWidth ) { Condition . INSTANCE . ensureAtLeast ( borderWidth , 0 , "The border width must be at least 0" ) ; this . previewBorderWidth = borderWidth ; if ( previewLoader != null ) { previewLoader . setBorderWidth ( borderWidth ) ; } adaptPreviewView ( ) ; } | Sets the border width of the preview of the preference s color . |
9 | public final void setPreviewBorderColor ( final int borderColor ) { this . previewBorderColor = borderColor ; if ( previewLoader != null ) { previewLoader . setBorderColor ( borderColor ) ; } adaptPreviewView ( ) ; } | Sets the border color of the preview of the preference s color . |
10 | public final void setPreviewBackground ( final Drawable background ) { this . previewBackground = background ; if ( previewLoader != null ) { previewLoader . setBackground ( background ) ; } adaptPreviewView ( ) ; } | Sets the background of the preview of the preference s color . |
11 | public final void setColorFormat ( final ColorFormat colorFormat ) { Condition . INSTANCE . ensureNotNull ( colorFormat , "The color format may not be null" ) ; this . colorFormat = colorFormat ; } | Sets the format which should be used to print a textual representation of the preference s color . |
12 | public static < T > StoppableObservable < T > runAsync ( Scheduler scheduler , final Action2 < ? super Observer < ? super T > , ? super Subscription > action ) { return runAsync ( scheduler , PublishSubject . < T > create ( ) , action ) ; } | Runs the provided action on the given scheduler and allows propagation of multiple events to the observers of the returned StoppableObservable . The action is immediately executed and unobserved values will be lost . |
13 | public static < T , U > StoppableObservable < U > runAsync ( Scheduler scheduler , final Subject < T , U > subject , final Action2 < ? super Observer < ? super T > , ? super Subscription > action ) { final SerialSubscription csub = new SerialSubscription ( ) ; StoppableObservable < U > co = new StoppableObservable < U > ( new Observable . OnSubscribe < U > ( ) { public void call ( Subscriber < ? super U > t1 ) { subject . subscribe ( t1 ) ; } } , csub ) ; final Worker inner = scheduler . createWorker ( ) ; csub . set ( inner ) ; inner . schedule ( new Action0 ( ) { public void call ( ) { if ( ! csub . isUnsubscribed ( ) ) { action . call ( subject , csub ) ; } } } ) ; return co ; } | Runs the provided action on the given scheduler and allows propagation of multiple events to the observers of the returned StoppableObservable . The action is immediately executed and unobserved values might be lost depending on the Subject type used . |
14 | private void initializeToolbarElevation ( final SharedPreferences sharedPreferences ) { String key = getString ( R . string . toolbar_elevation_preference_key ) ; String defaultValue = getString ( R . string . toolbar_elevation_preference_default_value ) ; int elevation = Integer . valueOf ( sharedPreferences . getString ( key , defaultValue ) ) ; setToolbarElevation ( elevation ) ; } | Initializes the elevation of the activity s toolbar . |
15 | private void initializeNavigationWidth ( final SharedPreferences sharedPreferences ) { String key = getString ( R . string . navigation_width_preference_key ) ; String defaultValue = getString ( R . string . navigation_width_preference_default_value ) ; int width = Integer . valueOf ( sharedPreferences . getString ( key , defaultValue ) ) ; setNavigationWidth ( dpToPixels ( this , width ) ) ; } | Initializes the width of the navigation . |
16 | private void initializePreferenceScreenElevation ( final SharedPreferences sharedPreferences ) { String key = getString ( R . string . preference_screen_elevation_preference_key ) ; String defaultValue = getString ( R . string . preference_screen_elevation_preference_default_value ) ; int elevation = Integer . valueOf ( sharedPreferences . getString ( key , defaultValue ) ) ; setCardViewElevation ( elevation ) ; } | Initializes the elevation of the preference screen . |
17 | private void initializeBreadCrumbElevation ( final SharedPreferences sharedPreferences ) { String key = getString ( R . string . bread_crumb_elevation_preference_key ) ; String defaultValue = getString ( R . string . bread_crumb_elevation_preference_default_value ) ; int elevation = Integer . valueOf ( sharedPreferences . getString ( key , defaultValue ) ) ; setBreadCrumbElevation ( elevation ) ; } | Initializes the elevation of the bread crumbs . |
18 | private void initializeWizardButtonBarElevation ( final SharedPreferences sharedPreferences ) { String key = getString ( R . string . wizard_button_bar_elevation_preference_key ) ; String defaultValue = getString ( R . string . wizard_button_bar_elevation_preference_default_value ) ; int elevation = Integer . valueOf ( sharedPreferences . getString ( key , defaultValue ) ) ; setButtonBarElevation ( elevation ) ; } | Initializes the elevation of a wizard s button bar . |
19 | private void initializeOverrideBackButton ( final SharedPreferences sharedPreferences ) { String key = getString ( R . string . override_navigation_icon_preference_key ) ; boolean defaultValue = Boolean . valueOf ( getString ( R . string . override_navigation_icon_preference_default_value ) ) ; boolean overrideNavigationIcon = sharedPreferences . getBoolean ( key , defaultValue ) ; overrideNavigationIcon ( overrideNavigationIcon ) ; } | Initializes whether the action bar s back button should be overridden or not . |
20 | private void initializeHideNavigation ( final SharedPreferences sharedPreferences ) { String key = getString ( R . string . hide_navigation_preference_key ) ; boolean defaultValue = Boolean . valueOf ( getString ( R . string . hide_navigation_preference_default_value ) ) ; boolean hideNavigation = sharedPreferences . getBoolean ( key , defaultValue ) ; hideNavigation ( hideNavigation ) ; } | Initializes whether the navigation should be hidden or not . |
21 | private void obtainBreadCrumbTitle ( final TypedArray typedArray ) { setBreadCrumbTitle ( typedArray . getText ( R . styleable . NavigationPreference_android_breadCrumbTitle ) ) ; } | Obtains the breadcrumb title from a specific typed array . |
22 | private void obtainFragment ( final TypedArray typedArray ) { setFragment ( typedArray . getString ( R . styleable . NavigationPreference_android_fragment ) ) ; } | Obtains the fragment from a specific typed array . |
23 | private void obtainIcon ( final TypedArray typedArray ) { int resourceId = typedArray . getResourceId ( R . styleable . NavigationPreference_android_icon , - 1 ) ; if ( resourceId != - 1 ) { Drawable icon = AppCompatResources . getDrawable ( getContext ( ) , resourceId ) ; setIcon ( icon ) ; } } | Obtains the preference s icon from a specific typed array . |
24 | private void obtainTint ( final TypedArray typedArray ) { setIconTintList ( typedArray . getColorStateList ( R . styleable . NavigationPreference_android_tint ) ) ; } | Obtains the color state list to tint the preference s icon from a specific typed array . |
25 | private OnPreferenceClickListener createOnPreferenceClickListenerWrapper ( final OnPreferenceClickListener listener ) { return new OnPreferenceClickListener ( ) { public boolean onPreferenceClick ( final Preference preference ) { notifyOnShowFragment ( ) ; if ( listener != null ) { listener . onPreferenceClick ( preference ) ; } return true ; } } ; } | Creates a click listener which notifies the callback when the preference s fragment should be shown and forwards the click event to an encapsulated listener . |
26 | @ SuppressLint ( "InflateParams" ) private View inflateLayout ( final Activity activity ) { LayoutInflater inflater = activity . getLayoutInflater ( ) ; View view = inflater . inflate ( R . layout . remove_preference_header_dialog , null ) ; setView ( view ) ; return view ; } | Inflates the layout of the dialog . |
27 | private void initializeSpinner ( final View parentView , final Collection < NavigationPreference > navigationPreferences ) { spinner = parentView . findViewById ( R . id . remove_preference_header_spinner ) ; List < CharSequence > items = getNavigationPreferenceTitles ( navigationPreferences ) ; ArrayAdapter < CharSequence > adapter = new ArrayAdapter < > ( getContext ( ) , android . R . layout . simple_spinner_item , items ) ; adapter . setDropDownViewResource ( android . R . layout . simple_spinner_dropdown_item ) ; spinner . setAdapter ( adapter ) ; } | Initializes the spinner which allows to choose the preference header which should be removed . |
28 | private List < CharSequence > getNavigationPreferenceTitles ( final Collection < NavigationPreference > navigationPreferences ) { List < CharSequence > titles = new LinkedList < > ( ) ; for ( NavigationPreference navigationPreference : navigationPreferences ) { titles . add ( navigationPreference . getTitle ( ) ) ; } return titles ; } | Returns a list which contains the titles of all navigation preferences which are contained by a specific collection . |
29 | private void initializeButtons ( ) { setPositiveButton ( android . R . string . ok , createRemovePreferenceHeaderClickListener ( ) ) ; setNegativeButton ( android . R . string . cancel , null ) ; } | Initializes the dialog s buttons . |
30 | private OnClickListener createRemovePreferenceHeaderClickListener ( ) { return new OnClickListener ( ) { public void onClick ( final DialogInterface dialog , final int which ) { int position = spinner . getSelectedItemPosition ( ) ; listener . onRemovePreferenceHeader ( position ) ; } } ; } | Creates and returns a listener which allows to notify the registered listener when the user closes the dialog confirmatively . |
31 | public static Action0 fromRunnable ( Runnable run , Worker inner ) { if ( run == null ) { throw new NullPointerException ( "run" ) ; } return new ActionWrappingRunnable ( run , inner ) ; } | Converts a runnable instance into an Action0 instance . |
32 | private void obtainStyledAttributes ( ) { obtainUseSplitScreen ( ) ; obtainNavigationWidth ( ) ; obtainNavigationVisibility ( ) ; obtainOverrideNavigationIcon ( ) ; obtainShowButtonBar ( ) ; obtainNextButtonText ( ) ; obtainBackButtonText ( ) ; obtainFinishButtonText ( ) ; obtainShowProgress ( ) ; obtainProgressFormat ( ) ; obtainBreadCrumbVisibility ( ) ; obtainToolbarElevation ( ) ; obtainBreadcrumbElevation ( ) ; obtainCardViewElevation ( ) ; obtainButtonBarElevation ( ) ; obtainCardViewBackgroundColor ( ) ; obtainBreadCrumbBackgroundColor ( ) ; obtainButtonBarBackground ( ) ; obtainNavigationBackground ( ) ; obtainNavigationSelectionColor ( ) ; obtainNavigationDividerColor ( ) ; } | Obtains all relevant attributes from the activity s theme . |
33 | private void obtainUseSplitScreen ( ) { boolean useSplitScreen = ThemeUtil . getBoolean ( this , R . attr . useSplitScreen , true ) ; useSplitScreen ( useSplitScreen ) ; } | Obtains whether the split screen layout should be used on tablets from the activities theme . |
34 | private void obtainNavigationWidth ( ) { int navigationWidth ; try { navigationWidth = ThemeUtil . getDimensionPixelSize ( this , R . attr . navigationWidth ) ; } catch ( NotFoundException e ) { navigationWidth = getResources ( ) . getDimensionPixelSize ( R . dimen . navigation_width ) ; } setNavigationWidth ( navigationWidth ) ; } | Obtains the width of the navigation from the activity s theme . |
35 | private void obtainNavigationVisibility ( ) { boolean hideNavigation = ThemeUtil . getBoolean ( this , R . attr . hideNavigation , false ) ; hideNavigation ( hideNavigation ) ; } | Obtains whether the navigation should be shown from the activity s theme . |
36 | private void obtainOverrideNavigationIcon ( ) { boolean overrideNavigationIcon = ThemeUtil . getBoolean ( this , R . attr . overrideNavigationIcon , true ) ; overrideNavigationIcon ( overrideNavigationIcon ) ; } | Obtains whether the behavior of the navigation icon should be overridden or not from the activity s theme . |
37 | private void obtainShowButtonBar ( ) { boolean showButtonBar = ThemeUtil . getBoolean ( this , R . attr . showButtonBar , false ) ; showButtonBar ( showButtonBar ) ; } | Obtains whether the activity should be used as a wizard or not from the activity s theme . |
38 | private void obtainNextButtonText ( ) { CharSequence text ; try { text = ThemeUtil . getText ( this , R . attr . nextButtonText ) ; } catch ( NotFoundException e ) { text = getText ( R . string . next_button_text ) ; } setNextButtonText ( text ) ; } | Obtains the text of the next button from the activity s theme . |
39 | private void obtainBackButtonText ( ) { CharSequence text ; try { text = ThemeUtil . getText ( this , R . attr . backButtonText ) ; } catch ( NotFoundException e ) { text = getText ( R . string . back_button_text ) ; } setBackButtonText ( text ) ; } | Obtains the text of the back button from the activity s theme . |
40 | private void obtainFinishButtonText ( ) { CharSequence text ; try { text = ThemeUtil . getText ( this , R . attr . finishButtonText ) ; } catch ( NotFoundException e ) { text = getText ( R . string . finish_button_text ) ; } setFinishButtonText ( text ) ; } | Obtains the text of the finish button from the activity s theme . |
41 | private void obtainShowProgress ( ) { boolean showProgress = ThemeUtil . getBoolean ( this , R . attr . showProgress , true ) ; showProgress ( showProgress ) ; } | Obtains whether the progress should be shown when the activity is used as a wizard or not from the activity s theme . |
42 | private void obtainProgressFormat ( ) { String progressFormat ; try { progressFormat = ThemeUtil . getString ( this , R . attr . progressFormat ) ; } catch ( NotFoundException e ) { progressFormat = getString ( R . string . progress_format ) ; } setProgressFormat ( progressFormat ) ; } | Obtains the string which is used to format the progress which is shown when the activity is used as a wizard from the activity s theme . |
43 | private void obtainBreadCrumbVisibility ( ) { boolean hide = ThemeUtil . getBoolean ( this , R . attr . hideBreadCrumb , false ) ; hideBreadCrumb ( hide ) ; } | Obtains the visibility of the toolbar which is used to show the breadcrumb of the currently selected navigation preference from the activity s theme . |
44 | private void obtainToolbarElevation ( ) { int elevation ; try { elevation = ThemeUtil . getDimensionPixelSize ( this , R . attr . toolbarElevation ) ; } catch ( NotFoundException e ) { elevation = getResources ( ) . getDimensionPixelSize ( R . dimen . toolbar_elevation ) ; } setToolbarElevation ( pixelsToDp ( this , elevation ) ) ; } | Obtains the elevation of the activity s toolbar from the activity s theme . |
45 | private void obtainBreadcrumbElevation ( ) { int elevation ; try { elevation = ThemeUtil . getDimensionPixelSize ( this , R . attr . breadCrumbElevation ) ; } catch ( NotFoundException e ) { elevation = getResources ( ) . getDimensionPixelSize ( R . dimen . bread_crumb_toolbar_elevation ) ; } setBreadCrumbElevation ( pixelsToDp ( this , elevation ) ) ; } | Obtains the elevation of the toolbar which is used to show the bread crumb of the currently selected preference fragment when using the split screen layout . |
46 | private void obtainCardViewElevation ( ) { int elevation ; try { elevation = ThemeUtil . getDimensionPixelSize ( this , R . attr . cardViewElevation ) ; } catch ( NotFoundException e ) { elevation = getResources ( ) . getDimensionPixelSize ( R . dimen . card_view_elevation ) ; } setCardViewElevation ( pixelsToDp ( this , elevation ) ) ; } | Obtains the elevation of the card view which contains the currently shown preference fragment when using the split screen layout from the activity s theme . |
47 | private void obtainButtonBarElevation ( ) { int elevation ; try { elevation = ThemeUtil . getDimensionPixelSize ( this , R . attr . buttonBarElevation ) ; } catch ( NotFoundException e ) { elevation = getResources ( ) . getDimensionPixelSize ( R . dimen . button_bar_elevation ) ; } setButtonBarElevation ( pixelsToDp ( this , elevation ) ) ; } | Obtains the elevation of the button bar which is shown when using the activity as a wizard from the activity s theme . |
48 | private void obtainCardViewBackgroundColor ( ) { int color ; try { color = ThemeUtil . getColor ( this , R . attr . cardViewBackgroundColor ) ; } catch ( NotFoundException e ) { color = ContextCompat . getColor ( this , R . color . card_view_background_light ) ; } setCardViewBackgroundColor ( color ) ; } | Obtains the background color of the card view which contains the currently shown preference fragment when using the split screen layout from the activity s theme . |
49 | private void obtainBreadCrumbBackgroundColor ( ) { int color ; try { color = ThemeUtil . getColor ( this , R . attr . breadCrumbBackgroundColor ) ; } catch ( NotFoundException e ) { color = ContextCompat . getColor ( this , R . color . bread_crumb_background_light ) ; } setBreadCrumbBackgroundColor ( color ) ; } | Obtains the background color of the toolbar which is used to show the bread crumb of the currently selected navigation preference when using the split screen layout from the activity s theme . |
50 | private void obtainButtonBarBackground ( ) { try { setButtonBarBackgroundColor ( ThemeUtil . getColor ( this , R . attr . buttonBarBackground ) ) ; } catch ( NotFoundException e ) { int resourceId = ThemeUtil . getResId ( this , R . attr . buttonBarBackground , - 1 ) ; if ( resourceId != - 1 ) { setButtonBarBackground ( resourceId ) ; } else { setButtonBarBackground ( null ) ; } } } | Obtains the background of the button bar from the activity s theme . |
51 | private void obtainNavigationBackground ( ) { try { setNavigationBackgroundColor ( ThemeUtil . getColor ( this , R . attr . navigationBackground ) ) ; } catch ( NotFoundException e ) { int resourceId = ThemeUtil . getResId ( this , R . attr . navigationBackground , - 1 ) ; if ( resourceId != - 1 ) { setNavigationBackground ( resourceId ) ; } else { setNavigationBackground ( null ) ; } } } | Obtains the background of the navigation from the activity s theme . |
52 | private void obtainNavigationSelectionColor ( ) { int color ; try { color = ThemeUtil . getColor ( this , R . attr . navigationSelectionColor ) ; } catch ( NotFoundException e ) { color = ContextCompat . getColor ( this , R . color . preference_selection_color_light ) ; } setNavigationSelectionColor ( color ) ; } | Obtains the background color of the currently selected navigation preference from the activity s theme . |
53 | private void obtainNavigationDividerColor ( ) { int color ; try { color = ThemeUtil . getColor ( this , R . attr . navigationDividerColor ) ; } catch ( NotFoundException e ) { color = ContextCompat . getColor ( this , R . color . preference_divider_color_light ) ; } setNavigationDividerColor ( color ) ; } | Obtains the color of the dividers which are contained by the navigation . |
54 | private boolean showInitialFragment ( final String initialFragment ) { if ( ! TextUtils . isEmpty ( initialFragment ) ) { for ( int i = 0 ; i < navigationFragment . getNavigationPreferenceCount ( ) ; i ++ ) { NavigationPreference navigationPreference = navigationFragment . getNavigationPreference ( i ) ; if ( navigationPreference != null && navigationPreference . getFragment ( ) != null && navigationPreference . getFragment ( ) . equals ( initialFragment ) ) { Bundle arguments = getIntent ( ) . getBundleExtra ( EXTRA_SHOW_FRAGMENT_ARGUMENTS ) ; CharSequence title = getCharSequenceFromIntent ( getIntent ( ) , EXTRA_SHOW_FRAGMENT_TITLE ) ; if ( title != null ) { if ( arguments == null ) { arguments = new Bundle ( ) ; } arguments . putCharSequence ( EXTRA_SHOW_FRAGMENT_TITLE , title ) ; } navigationFragment . selectNavigationPreference ( i , arguments ) ; return true ; } } } return false ; } | Initially displays a specific fragment . |
55 | private CharSequence getCharSequenceFromIntent ( final Intent intent , final String name ) { CharSequence charSequence = intent . getCharSequenceExtra ( name ) ; if ( charSequence == null ) { int resourceId = intent . getIntExtra ( name , 0 ) ; if ( resourceId != 0 ) { charSequence = getText ( resourceId ) ; } } return charSequence ; } | Returns the char sequence which is specified by a specific intent extra . The char sequence can either be specified as a string or as a resource id . |
56 | private void handleIntent ( ) { Bundle extras = getIntent ( ) . getExtras ( ) ; if ( extras != null ) { handleHideNavigationIntent ( extras ) ; handleShowButtonBarIntent ( extras ) ; handleNextButtonTextIntent ( extras ) ; handleBackButtonTextIntent ( extras ) ; handleFinishButtonTextIntent ( extras ) ; handleShowProgressIntent ( extras ) ; handleProgressFormatIntent ( extras ) ; handleNoBreadcrumbsIntent ( extras ) ; } } | Handles extras the intent which has been used to start the activity . |
57 | private void handleHideNavigationIntent ( final Bundle extras ) { if ( extras . containsKey ( EXTRA_HIDE_NAVIGATION ) ) { hideNavigation ( extras . getBoolean ( EXTRA_HIDE_NAVIGATION ) ) ; } } | Handles the intent extra which specifies whether the navigation should be shown or not . |
58 | private void handleShowButtonBarIntent ( final Bundle extras ) { if ( extras . containsKey ( EXTRA_SHOW_BUTTON_BAR ) ) { showButtonBar ( extras . getBoolean ( EXTRA_SHOW_BUTTON_BAR ) ) ; } } | Handles the intent extra which specifies whether the button bar should be shown or not . |
59 | private void handleNextButtonTextIntent ( final Bundle extras ) { CharSequence text = extras . getString ( EXTRA_NEXT_BUTTON_TEXT ) ; if ( ! TextUtils . isEmpty ( text ) ) { setNextButtonText ( text ) ; } } | Handles the intent extra which specifies the text of the next button . |
60 | private void handleBackButtonTextIntent ( final Bundle extras ) { CharSequence text = extras . getString ( EXTRA_BACK_BUTTON_TEXT ) ; if ( ! TextUtils . isEmpty ( text ) ) { setBackButtonText ( text ) ; } } | Handles the intent extra which specifies the text of the back button . |
61 | private void handleFinishButtonTextIntent ( final Bundle extras ) { CharSequence text = extras . getString ( EXTRA_FINISH_BUTTON_TEXT ) ; if ( ! TextUtils . isEmpty ( text ) ) { setFinishButtonText ( text ) ; } } | Handles the intent extra which specifies the text of the finish button . |
62 | private void handleShowProgressIntent ( final Bundle extras ) { if ( extras . containsKey ( EXTRA_SHOW_PROGRESS ) ) { showProgress ( extras . getBoolean ( EXTRA_SHOW_PROGRESS ) ) ; } } | Handles the intent extra which specifies whether the progress should be shown when the activity is used as a wizard or not . |
63 | private void handleProgressFormatIntent ( final Bundle extras ) { String progressFormat = extras . getString ( EXTRA_PROGRESS_FORMAT ) ; if ( ! TextUtils . isEmpty ( progressFormat ) ) { setProgressFormat ( progressFormat ) ; } } | Handles the intent extra which specifies the format of the progress which is shown when the activity is used as a wizard . |
64 | private void handleNoBreadcrumbsIntent ( final Bundle extras ) { if ( extras . containsKey ( EXTRA_NO_BREAD_CRUMBS ) ) { hideBreadCrumb ( extras . getBoolean ( EXTRA_NO_BREAD_CRUMBS ) ) ; } } | Handles the intent extra which specifies whether bread crumbs should be shown not . |
65 | private void inflateLayout ( ) { setContentView ( isSplitScreen ( ) ? R . layout . preference_activity_tablet : R . layout . preference_activity_phone ) ; frameLayout = findViewById ( R . id . frame_layout ) ; navigationFragmentContainer = findViewById ( R . id . navigation_fragment_container ) ; cardView = findViewById ( R . id . card_view ) ; toolbar = findViewById ( R . id . toolbar ) ; toolbarLarge = findViewById ( R . id . large_toolbar ) ; breadCrumbToolbar = findViewById ( R . id . bread_crumb_toolbar ) ; buttonBar = findViewById ( R . id . wizard_button_bar ) ; nextButton = findViewById ( R . id . next_button ) ; nextButton . setOnClickListener ( createNextButtonListener ( ) ) ; backButton = findViewById ( R . id . back_button ) ; backButton . setOnClickListener ( createBackButtonListener ( ) ) ; finishButton = findViewById ( R . id . finish_button ) ; finishButton . setOnClickListener ( createFinishButtonListener ( ) ) ; buttonBarShadowView = findViewById ( R . id . wizard_button_bar_shadow_view ) ; toolbarShadowView = findViewById ( R . id . toolbar_shadow_view ) ; breadCrumbShadowView = findViewById ( R . id . bread_crumb_shadow_view ) ; } | Inflates the activity s layout depending on whether the split screen layout is used or not . |
66 | private void initializeToolbar ( ) { Condition . INSTANCE . ensureTrue ( getSupportActionBar ( ) == null , "An action bar is already attached to the activity. Use the theme " + "\"@style/Theme.MaterialComponents.NoActionBar\" or " + "\"@style/Theme.MaterialComponents.Light.NoActionBar\" as the activity's theme" , IllegalStateException . class ) ; if ( isSplitScreen ( ) ) { toolbarLarge . setVisibility ( View . VISIBLE ) ; } else { toolbar . setVisibility ( View . VISIBLE ) ; } setSupportActionBar ( toolbar ) ; resetTitle ( ) ; } | Initializes the activity s toolbar . |
67 | private void initializeFragments ( ) { navigationFragment = ( NavigationFragment ) getSupportFragmentManager ( ) . findFragmentByTag ( NAVIGATION_FRAGMENT_TAG ) ; if ( navigationFragment == null ) { navigationFragment = ( NavigationFragment ) Fragment . instantiate ( this , NavigationFragment . class . getName ( ) ) ; navigationFragment . setRetainInstance ( true ) ; navigationFragment . setCallback ( this ) ; FragmentTransaction transaction = getSupportFragmentManager ( ) . beginTransaction ( ) ; transaction . add ( R . id . navigation_fragment_container , navigationFragment , NAVIGATION_FRAGMENT_TAG ) ; transaction . commit ( ) ; } else if ( ! navigationFragment . isAdapterCreated ( ) ) { navigationFragment . setCallback ( this ) ; } navigationFragment . setAdapterCallback ( this ) ; preferenceFragment = getSupportFragmentManager ( ) . findFragmentByTag ( PREFERENCE_FRAGMENT_TAG ) ; adaptNavigationSelectionColor ( ) ; adaptNavigationDividerColor ( ) ; adaptNavigationEnabledState ( ) ; } | Initializes the activity s fragments . |
68 | private void showPreferenceFragment ( final NavigationPreference navigationPreference , final Bundle arguments ) { if ( arguments != null && navigationPreference . getExtras ( ) != null ) { arguments . putAll ( navigationPreference . getExtras ( ) ) ; } selectedPreferenceFragment = navigationPreference . getFragment ( ) ; selectedPreferenceFragmentArguments = arguments != null ? arguments : navigationPreference . getExtras ( ) ; if ( ! TextUtils . isEmpty ( selectedPreferenceFragment ) ) { Fragment fragment = Fragment . instantiate ( this , navigationPreference . getFragment ( ) , selectedPreferenceFragmentArguments ) ; showPreferenceFragment ( navigationPreference , fragment ) ; showBreadCrumb ( navigationPreference , selectedPreferenceFragmentArguments ) ; } else { removePreferenceFragmentUnconditionally ( ) ; if ( isSplitScreen ( ) ) { showBreadCrumb ( navigationPreference , selectedPreferenceFragmentArguments ) ; } } adaptWizardButtonVisibilities ( ) ; } | Shows the fragment which is associated with a specific navigation preference . |
69 | private void showPreferenceFragment ( final NavigationPreference navigationPreference , final Fragment fragment ) { fragment . setRetainInstance ( true ) ; FragmentTransaction transaction = getSupportFragmentManager ( ) . beginTransaction ( ) ; if ( ! isSplitScreen ( ) ) { transaction . hide ( navigationFragment ) ; if ( preferenceFragment != null ) { transaction . remove ( preferenceFragment ) ; notifyOnPreferenceFragmentHidden ( preferenceFragment ) ; } transaction . add ( R . id . navigation_fragment_container , fragment , PREFERENCE_FRAGMENT_TAG ) ; } else { if ( preferenceFragment != null ) { notifyOnPreferenceFragmentHidden ( preferenceFragment ) ; } transaction . replace ( R . id . preference_fragment_container , fragment , PREFERENCE_FRAGMENT_TAG ) ; } transaction . setTransition ( FragmentTransaction . TRANSIT_FRAGMENT_OPEN ) ; transaction . commit ( ) ; this . preferenceFragment = fragment ; showToolbarNavigationIcon ( ) ; adaptBreadCrumbVisibility ( selectedPreferenceFragmentArguments ) ; notifyOnPreferenceFragmentShown ( navigationPreference , fragment ) ; } | Shows a specific preference fragment . |
70 | private boolean removePreferenceFragment ( ) { if ( ! isSplitScreen ( ) && isPreferenceFragmentShown ( ) && ! isNavigationHidden ( ) && ! isButtonBarShown ( ) ) { navigationFragment . selectNavigationPreference ( - 1 , null ) ; removePreferenceFragmentUnconditionally ( ) ; selectedPreferenceFragment = null ; selectedPreferenceFragmentArguments = null ; return true ; } return false ; } | Removes the currently shown preference fragment if the split screen layout is not used and the navigation is not hidden . |
71 | private void removePreferenceFragmentUnconditionally ( ) { if ( isPreferenceFragmentShown ( ) ) { resetTitle ( ) ; hideToolbarNavigationIcon ( ) ; adaptBreadCrumbVisibility ( ) ; FragmentTransaction transaction = getSupportFragmentManager ( ) . beginTransaction ( ) ; transaction . remove ( preferenceFragment ) ; if ( ! isSplitScreen ( ) ) { transaction . show ( navigationFragment ) ; } transaction . setTransition ( FragmentTransaction . TRANSIT_FRAGMENT_CLOSE ) ; transaction . commit ( ) ; notifyOnPreferenceFragmentHidden ( preferenceFragment ) ; preferenceFragment = null ; } } | Removes the currently preference fragment regardless of whether the split screen layout is used or not . |
72 | private void showBreadCrumb ( final NavigationPreference navigationPreference , final Bundle arguments ) { CharSequence breadCrumbTitle = null ; if ( arguments != null && arguments . containsKey ( EXTRA_SHOW_FRAGMENT_TITLE ) ) { breadCrumbTitle = arguments . getCharSequence ( EXTRA_SHOW_FRAGMENT_TITLE ) ; } if ( TextUtils . isEmpty ( breadCrumbTitle ) ) { breadCrumbTitle = navigationPreference . getBreadCrumbTitle ( ) ; if ( TextUtils . isEmpty ( breadCrumbTitle ) ) { breadCrumbTitle = navigationPreference . getTitle ( ) ; if ( TextUtils . isEmpty ( breadCrumbTitle ) ) { breadCrumbTitle = getTitle ( ) ; } } } showBreadCrumb ( breadCrumbTitle ) ; } | Shows the bread crumb of a specific navigation preference . When using the split screen layout the bread crumb is shown above the currently shown preference fragment otherwise the bread crumb is shown as the toolbar title . |
73 | private void showBreadCrumb ( final CharSequence breadCrumbTitle ) { CharSequence formattedBreadCrumbTitle = formatBreadCrumbTitle ( breadCrumbTitle ) ; if ( isSplitScreen ( ) ) { breadCrumbToolbar . setTitle ( formattedBreadCrumbTitle ) ; } else if ( ! TextUtils . isEmpty ( formattedBreadCrumbTitle ) ) { showTitle ( formattedBreadCrumbTitle ) ; } } | Shows a specific bread crumb . When using the split screen layout the bread crumb is shown above the currently shown preference fragment otherwise the bread crumb is shown as the toolbar title . |
74 | private CharSequence formatBreadCrumbTitle ( final CharSequence breadCrumbTitle ) { if ( ! TextUtils . isEmpty ( breadCrumbTitle ) && isButtonBarShown ( ) && navigationFragment != null ) { String format = getProgressFormat ( ) ; int selectedNavigationPreferenceIndex = navigationFragment . getSelectedNavigationPreferenceIndex ( ) ; if ( ! TextUtils . isEmpty ( format ) && selectedNavigationPreferenceIndex != - 1 ) { int currentStep = selectedNavigationPreferenceIndex + 1 ; int totalSteps = navigationFragment . getNavigationPreferenceCount ( ) ; return String . format ( format , currentStep , totalSteps , breadCrumbTitle ) ; } } return breadCrumbTitle ; } | Formats a specific bread crumb title depending on whether the activity is used as a wizard and whether the progress should be shown or not . |
75 | private void showTitle ( final CharSequence title ) { ActionBar actionBar = getSupportActionBar ( ) ; if ( actionBar != null ) { if ( isSplitScreen ( ) ) { if ( toolbarLarge != null ) { toolbarLarge . setTitle ( title ) ; } actionBar . setTitle ( null ) ; } else { actionBar . setTitle ( title ) ; } } } | Shows a specific title . |
76 | private void showToolbarNavigationIcon ( ) { if ( isPreferenceFragmentShown ( ) && isNavigationIconOverridden ( ) && ! isNavigationHidden ( ) && ! ( ! isSplitScreen ( ) && isButtonBarShown ( ) ) ) { displayHomeAsUp = isDisplayHomeAsUpEnabled ( ) ; ActionBar actionBar = getSupportActionBar ( ) ; if ( actionBar != null ) { actionBar . setDisplayHomeAsUpEnabled ( true ) ; } } } | Shows the navigation icon of the activity s toolbar . |
77 | private void hideToolbarNavigationIcon ( ) { if ( ! displayHomeAsUp ) { ActionBar actionBar = getSupportActionBar ( ) ; if ( actionBar != null ) { actionBar . setDisplayHomeAsUpEnabled ( false ) ; actionBar . setHomeButtonEnabled ( false ) ; } } } | Hides the navigation icon of the activity s toolbar respectively sets it to the previous icon . |
78 | private void setMarginStart ( final FrameLayout . LayoutParams layoutParams , final int margin ) { if ( isRtlLayoutUsed ( ) ) { layoutParams . rightMargin = margin ; } else { layoutParams . leftMargin = margin ; } } | Sets the start margin of specific layout params . |
79 | private void adaptNavigationWidth ( ) { if ( frameLayout != null && navigationFragmentContainer != null && cardView != null && toolbarLarge != null ) { ViewCompat . setPaddingRelative ( navigationFragmentContainer , 0 , 0 , getDisplayWidth ( this ) - navigationWidth , 0 ) ; if ( ! isNavigationHidden ( ) ) { toolbarLarge . setNavigationWidth ( navigationWidth ) ; FrameLayout . LayoutParams cardViewLayoutParams = ( FrameLayout . LayoutParams ) cardView . getLayoutParams ( ) ; int margin = navigationWidth - getResources ( ) . getDimensionPixelSize ( R . dimen . card_view_intrinsic_margin ) ; setMarginStart ( cardViewLayoutParams , margin ) ; } } } | Adapts the width of the navigation . |
80 | private void adaptNavigationVisibility ( ) { if ( isSplitScreen ( ) ) { if ( navigationFragmentContainer != null && cardView != null && toolbarLarge != null ) { navigationFragmentContainer . setVisibility ( isNavigationHidden ( ) ? View . GONE : View . VISIBLE ) ; toolbarLarge . hideNavigation ( isNavigationHidden ( ) ) ; int preferenceScreenHorizontalMargin = getResources ( ) . getDimensionPixelSize ( R . dimen . card_view_horizontal_margin ) ; int preferenceScreenMarginRight = getResources ( ) . getDimensionPixelSize ( R . dimen . card_view_margin_right ) ; int cardViewIntrinsicMargin = getResources ( ) . getDimensionPixelSize ( R . dimen . card_view_intrinsic_margin ) ; FrameLayout . LayoutParams cardViewLayoutParams = ( FrameLayout . LayoutParams ) cardView . getLayoutParams ( ) ; cardViewLayoutParams . gravity = isNavigationHidden ( ) ? Gravity . CENTER_HORIZONTAL : Gravity . NO_GRAVITY ; int marginStart = ( isNavigationHidden ( ) ? preferenceScreenHorizontalMargin : navigationWidth ) - cardViewIntrinsicMargin ; int marginEnd = ( isNavigationHidden ( ) ? preferenceScreenHorizontalMargin : preferenceScreenMarginRight ) - cardViewIntrinsicMargin ; setMarginStart ( cardViewLayoutParams , marginStart ) ; setMarginEnd ( cardViewLayoutParams , marginEnd ) ; } } else { if ( getSelectedNavigationPreference ( ) != null ) { if ( isNavigationHidden ( ) ) { hideToolbarNavigationIcon ( ) ; } else { showToolbarNavigationIcon ( ) ; } } else if ( isNavigationHidden ( ) && navigationFragment != null && navigationFragment . getCallback ( ) == null ) { if ( navigationFragment . getNavigationPreferenceCount ( ) > 0 ) { navigationFragment . selectNavigationPreference ( 0 , null ) ; } else { finish ( ) ; } } } } | Adapts the visibility of the navigation . |
81 | private void adaptButtonBarVisibility ( ) { if ( buttonBar != null && buttonBarShadowView != null ) { buttonBar . setVisibility ( isButtonBarShown ( ) ? View . VISIBLE : View . GONE ) ; buttonBarShadowView . setVisibility ( isButtonBarShown ( ) ? View . VISIBLE : View . GONE ) ; if ( isButtonBarShown ( ) && ! isSplitScreen ( ) ) { adaptNavigationVisibility ( ) ; } adaptNavigationEnabledState ( ) ; adaptWizardButtonVisibilities ( ) ; } } | Adapts the visibility of the button bar which is shown when the activity is used as a wizard . |
82 | private void adaptWizardButtonVisibilities ( ) { if ( buttonBar != null && backButton != null && nextButton != null && finishButton != null && navigationFragment != null ) { int selectedNavigationPreferenceIndex = navigationFragment . getSelectedNavigationPreferenceIndex ( ) ; if ( selectedNavigationPreferenceIndex != - 1 && isButtonBarShown ( ) ) { int navigationPreferenceCount = navigationFragment . getNavigationPreferenceCount ( ) ; backButton . setVisibility ( ( selectedNavigationPreferenceIndex != 0 ) ? View . VISIBLE : View . GONE ) ; nextButton . setVisibility ( ( selectedNavigationPreferenceIndex != navigationPreferenceCount - 1 ) ? View . VISIBLE : View . GONE ) ; finishButton . setVisibility ( ( selectedNavigationPreferenceIndex == navigationPreferenceCount - 1 ) ? View . VISIBLE : View . GONE ) ; } else if ( isButtonBarShown ( ) ) { backButton . setVisibility ( View . GONE ) ; nextButton . setVisibility ( View . GONE ) ; finishButton . setVisibility ( View . VISIBLE ) ; } } } | Adapts the visibilities of the buttons of the button bar which is shown when the activity is used as a wizard depending on the currently selected navigation preference . |
83 | private void adaptBreadCrumbVisibility ( final Bundle arguments ) { if ( arguments != null && arguments . containsKey ( EXTRA_NO_BREAD_CRUMBS ) ) { boolean hideBreadCrumb = arguments . getBoolean ( EXTRA_NO_BREAD_CRUMBS , false ) ; adaptBreadCrumbVisibility ( hideBreadCrumb ) ; } else { adaptBreadCrumbVisibility ( ) ; } } | Adapts the visibility of the toolbar which is used to show the breadcrumb of the currently selected navigation preference depending on the arguments of the currently selected navigation preference . |
84 | private void adaptBreadCrumbVisibility ( final boolean hideBreadCrumb ) { if ( isSplitScreen ( ) ) { if ( breadCrumbToolbar != null && breadCrumbShadowView != null ) { breadCrumbToolbar . setVisibility ( hideBreadCrumb ? View . GONE : View . VISIBLE ) ; breadCrumbShadowView . setVisibility ( hideBreadCrumb ? View . GONE : View . VISIBLE ) ; } } else { if ( toolbar != null && toolbarShadowView != null ) { toolbar . setVisibility ( hideBreadCrumb ? View . GONE : View . VISIBLE ) ; toolbarShadowView . setVisibility ( hideBreadCrumb ? View . GONE : View . VISIBLE ) ; } } } | Adapts the visibility of the toolbar which is used to show the breadcrumb of the currently selected navigation preference . |
85 | private void adaptBreadCrumbBackgroundColor ( ) { if ( breadCrumbToolbar != null ) { GradientDrawable background = ( GradientDrawable ) ContextCompat . getDrawable ( this , R . drawable . breadcrumb_background ) ; background . setColor ( breadCrumbBackgroundColor ) ; ViewUtil . setBackground ( getBreadCrumbToolbar ( ) , background ) ; } } | Adapts the background color of the toolbar which is used to show the bread crumb of the currently selected navigation preferences when using the split screen layout . |
86 | private View . OnClickListener createNextButtonListener ( ) { return new View . OnClickListener ( ) { public void onClick ( final View v ) { if ( navigationFragment != null ) { int currentIndex = navigationFragment . getSelectedNavigationPreferenceIndex ( ) ; if ( currentIndex < navigationFragment . getNavigationPreferenceCount ( ) - 1 ) { Bundle params = notifyOnNextStep ( ) ; if ( params != null ) { navigationFragment . selectNavigationPreference ( currentIndex + 1 , params ) ; } } } } } ; } | Returns a listener which allows to proceed to the next step when the activity is used as a wizard . |
87 | private View . OnClickListener createBackButtonListener ( ) { return new View . OnClickListener ( ) { public void onClick ( final View v ) { if ( navigationFragment != null ) { int currentIndex = navigationFragment . getSelectedNavigationPreferenceIndex ( ) ; if ( currentIndex > 0 ) { Bundle params = notifyOnPreviousStep ( ) ; if ( params != null ) { navigationFragment . selectNavigationPreference ( currentIndex - 1 , params ) ; } } } } } ; } | Returns a listener which allows to resume to the previous step when the activity is used as a wizard . |
88 | private View . OnClickListener createFinishButtonListener ( ) { return new View . OnClickListener ( ) { public void onClick ( final View v ) { notifyOnFinish ( ) ; } } ; } | Returns a listener which allows to finish the last step when the activity is used as a wizard . |
89 | private void notifyOnPreferenceFragmentShown ( final NavigationPreference navigationPreference , final Fragment fragment ) { for ( PreferenceFragmentListener listener : preferenceFragmentListeners ) { listener . onPreferenceFragmentShown ( navigationPreference , fragment ) ; } } | Notifies all registered listeners that a preference fragment has been shown . |
90 | private void notifyOnPreferenceFragmentHidden ( final Fragment fragment ) { for ( PreferenceFragmentListener listener : preferenceFragmentListeners ) { listener . onPreferenceFragmentHidden ( fragment ) ; } } | Notifies all registered listeners that a preference fragment has been hidden . |
91 | private Bundle notifyOnNextStep ( ) { Bundle result = null ; NavigationPreference selectedNavigationPreference = navigationFragment . getSelectedNavigationPreference ( ) ; if ( selectedNavigationPreference != null && preferenceFragment != null ) { for ( WizardListener listener : wizardListeners ) { Bundle bundle = listener . onNextStep ( selectedNavigationPreference , preferenceFragment , selectedPreferenceFragmentArguments ) ; if ( bundle != null ) { if ( result == null ) { result = new Bundle ( ) ; } result . putAll ( bundle ) ; } } } return result ; } | Notifies all registered listeners that the user wants to navigate to the next step of the wizard . |
92 | private Bundle notifyOnPreviousStep ( ) { Bundle result = null ; NavigationPreference selectedNavigationPreference = navigationFragment . getSelectedNavigationPreference ( ) ; if ( selectedNavigationPreference != null && preferenceFragment != null ) { for ( WizardListener listener : wizardListeners ) { Bundle bundle = listener . onPreviousStep ( selectedNavigationPreference , preferenceFragment , selectedPreferenceFragmentArguments ) ; if ( bundle != null ) { if ( result == null ) { result = new Bundle ( ) ; } result . putAll ( bundle ) ; } } } return result ; } | Notifies all registered listeners that the user wants to navigate to the previous step of the wizard . |
93 | private boolean notifyOnFinish ( ) { boolean result = true ; NavigationPreference selectedNavigationPreference = navigationFragment . getSelectedNavigationPreference ( ) ; if ( selectedNavigationPreference != null && preferenceFragment != null ) { for ( WizardListener listener : wizardListeners ) { result &= listener . onFinish ( selectedNavigationPreference , preferenceFragment , selectedPreferenceFragmentArguments ) ; } } return result ; } | Notifies all registered listeners that the user wants to finish the last step of the wizard . |
94 | private boolean notifyOnSkip ( ) { boolean result = true ; NavigationPreference selectedNavigationPreference = navigationFragment . getSelectedNavigationPreference ( ) ; if ( selectedNavigationPreference != null && preferenceFragment != null ) { for ( WizardListener listener : wizardListeners ) { result &= listener . onSkip ( selectedNavigationPreference , preferenceFragment , selectedPreferenceFragmentArguments ) ; } } return result ; } | Notifies all registered listeners that the user wants to skip the wizard . |
95 | private void notifyOnNavigationPreferenceAdded ( final NavigationPreference navigationPreference ) { for ( NavigationListener listener : navigationListeners ) { listener . onNavigationPreferenceAdded ( navigationPreference ) ; } } | Notifies all registered listeners that a navigation preference has been added to the activity . |
96 | private void notifyOnNavigationPreferenceRemoved ( final NavigationPreference navigationPreference ) { for ( NavigationListener listener : navigationListeners ) { listener . onNavigationPreferenceRemoved ( navigationPreference ) ; } } | Notifies all registered listeners that a navigation preference has been removed from the activity . |
97 | public final void addPreferenceFragmentListener ( final PreferenceFragmentListener listener ) { Condition . INSTANCE . ensureNotNull ( listener , "The listener may not be null" ) ; preferenceFragmentListeners . add ( listener ) ; } | Adds a new listener which should be notified when the currently shown preference fragment has been changed to the activity . |
98 | public final void removePreferenceFragmentListener ( final PreferenceFragmentListener listener ) { Condition . INSTANCE . ensureNotNull ( listener , "The listener may not be null" ) ; preferenceFragmentListeners . remove ( listener ) ; } | Removes a specific listener which should not be notified when the currently shown preference fragment has been changed anymore . |
99 | public final void removeWizardListener ( final WizardListener listener ) { Condition . INSTANCE . ensureNotNull ( listener , "The listener may not be null" ) ; wizardListeners . remove ( listener ) ; } | Removes a specific listener which should not be notified when the user navigates within the activity if it is used as a wizard . |
End of preview. Expand
in Dataset Viewer.
No dataset card yet
New: Create and edit this dataset card directly on the website!
Contribute a Dataset Card- Downloads last month
- 4