Search in sources :

Example 1 with InkPageIndicator

use of com.heinrichreimersoftware.materialintro.view.InkPageIndicator in project Phonograph by kabouzeid.

the class NowPlayingScreenPreferenceDialog method onCreateDialog.

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    @SuppressLint("InflateParams") View view = LayoutInflater.from(getContext()).inflate(R.layout.preference_dialog_now_playing_screen, null);
    ViewPager viewPager = view.findViewById(R.id.now_playing_screen_view_pager);
    viewPager.setAdapter(new NowPlayingScreenAdapter(getContext()));
    viewPager.addOnPageChangeListener(this);
    viewPager.setPageMargin((int) ViewUtil.convertDpToPixel(32, getResources()));
    viewPager.setCurrentItem(PreferenceUtil.getInstance(getContext()).getNowPlayingScreen().ordinal());
    InkPageIndicator pageIndicator = view.findViewById(R.id.page_indicator);
    pageIndicator.setViewPager(viewPager);
    pageIndicator.onPageSelected(viewPager.getCurrentItem());
    return new MaterialDialog.Builder(getContext()).title(R.string.pref_title_now_playing_screen_appearance).positiveText(android.R.string.ok).negativeText(android.R.string.cancel).onAny(this).customView(view, false).build();
}
Also used : SuppressLint(android.annotation.SuppressLint) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) ViewPager(androidx.viewpager.widget.ViewPager) InkPageIndicator(com.heinrichreimersoftware.materialintro.view.InkPageIndicator) NonNull(androidx.annotation.NonNull)

Aggregations

SuppressLint (android.annotation.SuppressLint)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 NonNull (androidx.annotation.NonNull)1 ViewPager (androidx.viewpager.widget.ViewPager)1 InkPageIndicator (com.heinrichreimersoftware.materialintro.view.InkPageIndicator)1