Search in sources :

Example 1 with SlidingPagerAdapter

use of com.quran.labs.androidquran.ui.helpers.SlidingPagerAdapter in project quran_android by quran.

the class PagerActivity method initAyahActionPanel.

private void initAyahActionPanel() {
    slidingPanel = (SlidingUpPanelLayout) findViewById(R.id.sliding_panel);
    final ViewGroup slidingLayout = (ViewGroup) slidingPanel.findViewById(R.id.sliding_layout);
    slidingPager = (ViewPager) slidingPanel.findViewById(R.id.sliding_layout_pager);
    final IconPageIndicator slidingPageIndicator = (IconPageIndicator) slidingPanel.findViewById(R.id.sliding_pager_indicator);
    // Find close button and set listener
    final View closeButton = slidingPanel.findViewById(R.id.sliding_menu_close);
    closeButton.setOnClickListener(v -> endAyahMode());
    // Create and set fragment pager adapter
    slidingPagerAdapter = new SlidingPagerAdapter(getSupportFragmentManager(), Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && (quranSettings.isArabicNames() || QuranUtils.isRtl()));
    slidingPager.setAdapter(slidingPagerAdapter);
    // Attach the view pager to the action bar
    slidingPageIndicator.setViewPager(slidingPager);
    // Set sliding layout parameters
    int displayHeight = getResources().getDisplayMetrics().heightPixels;
    slidingLayout.getLayoutParams().height = (int) (displayHeight * PANEL_MAX_HEIGHT);
    slidingPanel.setEnableDragViewTouchEvents(true);
    slidingPanel.setPanelSlideListener(new SlidingPanelListener());
    slidingLayout.setVisibility(View.GONE);
    // When clicking any menu items, expand the panel
    slidingPageIndicator.setOnClickListener(v -> {
        if (!slidingPanel.isExpanded()) {
            slidingPanel.expandPane();
        }
    });
}
Also used : ViewGroup(android.view.ViewGroup) SearchView(android.support.v7.widget.SearchView) View(android.view.View) IconPageIndicator(com.quran.labs.androidquran.widgets.IconPageIndicator) SlidingPagerAdapter(com.quran.labs.androidquran.ui.helpers.SlidingPagerAdapter)

Aggregations

SearchView (android.support.v7.widget.SearchView)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 SlidingPagerAdapter (com.quran.labs.androidquran.ui.helpers.SlidingPagerAdapter)1 IconPageIndicator (com.quran.labs.androidquran.widgets.IconPageIndicator)1