androidx.viewpager.widget.ViewPager.OnPageChangeListener Java Examples

The following examples show how to use androidx.viewpager.widget.ViewPager.OnPageChangeListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WizardDialogDecorator.java    From AndroidMaterialDialog with Apache License 2.0 5 votes vote down vote up
@Override
public final void removeOnPageChangeListener(@NonNull final OnPageChangeListener listener) {
    Condition.INSTANCE.ensureNotNull(listener, "The listener may not be null");
    onPageChangeListeners.remove(listener);

    if (viewPager != null) {
        viewPager.removeOnPageChangeListener(listener);
    }
}
 
Example #2
Source File: WizardDialogDecorator.java    From AndroidMaterialDialog with Apache License 2.0 5 votes vote down vote up
@Override
public final void addOnPageChangeListener(@NonNull final OnPageChangeListener listener) {
    Condition.INSTANCE.ensureNotNull(listener, "The listener may not be null");
    onPageChangeListeners.add(listener);

    if (viewPager != null) {
        viewPager.addOnPageChangeListener(listener);
    }
}
 
Example #3
Source File: TabPageIndicator.java    From arcusandroid with Apache License 2.0 4 votes vote down vote up
@Override
public void setOnPageChangeListener(OnPageChangeListener listener) {
    mListener = listener;
}
 
Example #4
Source File: PagerSlidingTabStrip.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
public void setOnPageChangeListener(OnPageChangeListener listener) {
    this.delegatePageListener = listener;
}
 
Example #5
Source File: PagerSlidingTabStrip.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
public void setOnPageChangeListener(OnPageChangeListener listener) {
    this.delegatePageListener = listener;
}
 
Example #6
Source File: PagerSlidingTabStrip.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 4 votes vote down vote up
public void setOnPageChangeListener(OnPageChangeListener listener) {
    this.delegatePageListener = listener;
}
 
Example #7
Source File: PagerSlidingTabStrip.java    From prayer-times-android with Apache License 2.0 4 votes vote down vote up
public void setOnPageChangeListener(OnPageChangeListener listener) {
    delegatePageListener = listener;
}
 
Example #8
Source File: WizardDialogDecorator.java    From AndroidMaterialDialog with Apache License 2.0 4 votes vote down vote up
@NonNull
@Override
protected final Map<ViewType, View> onAttach(@NonNull final Window window,
                                             @NonNull final View view,
                                             @NonNull final Map<ViewType, View> areas,
                                             @NonNull final FragmentManager fragmentManager) {
    View headerView = areas.get(new AreaViewType(Area.HEADER));
    View contentView = areas.get(new AreaViewType(Area.CONTENT));

    if (headerView != null && contentView != null) {
        View viewPagerView = contentView.findViewById(R.id.view_pager);

        if (viewPagerView instanceof ViewPager) {
            View inflatedView = inflateButtonBar();

            if (inflatedView != null) {
                viewPager = (ViewPager) viewPagerView;
                viewPager.setDialog(getDialog());
                viewPager.addOnPageChangeListener(this);
                viewPagerAdapter =
                        new ViewPagerAdapter(getContext(), fragmentManager, viewPagerItems);

                for (OnPageChangeListener listener : onPageChangeListeners) {
                    viewPager.addOnPageChangeListener(listener);
                }

                viewPager.setAdapter(viewPagerAdapter);
                inflateTabLayout(headerView, contentView);
                adaptTabLayout();
                adaptViewPager();
                adaptButtonTextColor();
                adaptBackButton();
                adaptNextButton();
                adaptFinishButton();
                adaptButtonBarVisibility();
                adaptButtonBarDividerVisibility();
                adaptButtonBarDividerColor();
                adaptButtonBarDividerMargin();
                adaptButtonVisibility();
                Map<ViewType, View> result = new HashMap<>();
                result.put(new AreaViewType(Area.BUTTON_BAR), inflatedView);
                return result;
            }
        }
    }

    return Collections.emptyMap();
}
 
Example #9
Source File: WizardDialog.java    From AndroidMaterialDialog with Apache License 2.0 4 votes vote down vote up
@Override
public final void removeOnPageChangeListener(@NonNull final OnPageChangeListener listener) {
    decorator.removeOnPageChangeListener(listener);
}
 
Example #10
Source File: WizardDialog.java    From AndroidMaterialDialog with Apache License 2.0 4 votes vote down vote up
@Override
public final void addOnPageChangeListener(@NonNull final OnPageChangeListener listener) {
    decorator.addOnPageChangeListener(listener);
}
 
Example #11
Source File: PagerSlidingTabStrip.java    From BaseProject with Apache License 2.0 4 votes vote down vote up
public void setOnPageChangeListener(OnPageChangeListener listener)
{
    this.delegatePageListener = listener;
}
 
Example #12
Source File: PagerSlidingTabStrip.java    From prayer-times-android with Apache License 2.0 4 votes vote down vote up
public void setOnPageChangeListener(OnPageChangeListener listener) {
    delegatePageListener = listener;
}
 
Example #13
Source File: Banner.java    From Banner with Apache License 2.0 4 votes vote down vote up
public void setOnPageChangeListener(OnPageChangeListener onPageChangeListener) {
    mOnPageChangeListener = onPageChangeListener;
}
 
Example #14
Source File: IconPageIndicator.java    From arcusandroid with Apache License 2.0 4 votes vote down vote up
@Override
public void setOnPageChangeListener(OnPageChangeListener listener) {
    mListener = listener;
}
 
Example #15
Source File: WizardDialogDecorator.java    From AndroidMaterialDialog with Apache License 2.0 2 votes vote down vote up
/**
 * Adds a listener, which should be notified, when the page of the dialog's view pager has been
 * changed.
 *
 * @param listener
 *         The listener, which should be added, as an instance of the type OnPageChangeListener.
 *         The listener may not be null
 */
void addOnPageChangeListener(@NonNull OnPageChangeListener listener);
 
Example #16
Source File: WizardDialogDecorator.java    From AndroidMaterialDialog with Apache License 2.0 2 votes vote down vote up
/**
 * Removes a listener, which should not be notified, when the page of the dialog's view pager
 * has been changed, anymore.
 *
 * @param listener
 *         The listener, which should be removed, as an instance of the type
 *         OnPageChangeListener. The listener may not be null
 */
void removeOnPageChangeListener(@NonNull OnPageChangeListener listener);
 
Example #17
Source File: WizardDialog.java    From AndroidMaterialDialog with Apache License 2.0 2 votes vote down vote up
/**
 * Adds a listener, which should be notified, when the page of the view page of the dialog,
 * which is created by the builder, has been changed.
 *
 * @param listener
 *         The listener, which should be added, as an instance of the type
 *         OnPageChangeListener. The listener may not be null
 * @return The builder, the method has been called upon, as an instance of the class {@link
 * Builder}
 */
public final Builder addOnPageChangeListener(@NonNull final OnPageChangeListener listener) {
    getProduct().addOnPageChangeListener(listener);
    return self();
}