Example usage for android.support.v4.view ViewPager invalidate

List of usage examples for android.support.v4.view ViewPager invalidate

Introduction

In this page you can find the example usage for android.support.v4.view ViewPager invalidate.

Prototype

public void invalidate() 

Source Link

Document

Invalidate the whole view.

Usage

From source file:com.gh4a.activities.ExploreActivity.java

private void setPageIndicator(int position) {
    ThisPageAdapter adapter = new ThisPageAdapter(getSupportFragmentManager());
    ViewPager pager = (ViewPager) findViewById(R.id.pager);
    pager.setAdapter(adapter);/*from  ww w .j  a  v a  2s  .c om*/
    pager.invalidate();

    TitlePageIndicator indicator = (TitlePageIndicator) findViewById(R.id.indicator);

    if (Gh4Application.THEME != R.style.DefaultTheme) {
        indicator.setTextColor(getResources().getColor(R.color.abs__primary_text_holo_light));
        indicator.setSelectedColor(getResources().getColor(R.color.abs__primary_text_holo_light));
        indicator.setSelectedBold(true);
    }

    boolean trending = position == 1;
    indicator.setVisibility(trending ? View.VISIBLE : View.GONE);
    indicator.setViewPager(pager);

    indicator.notifyDataSetChanged();
    adapter.notifyDataSetChanged();
}

From source file:com.door43.translationstudio.RobotiumTests.java

private void selectTab(int tabIndex) {
    if (tabIndex > 1) {
        solo.scrollToSide(tabIndex);/*from www  . j  a  va  2s  .  c  om*/
    }
    final ViewPager vp = (ViewPager) solo.getView(R.id.leftViewPager);

    final int tab = tabIndex;
    activity.runOnUiThread(new Runnable() {
        public void run() {

            vp.setCurrentItem(tab);
            vp.invalidate();
        }
    });
    int curItem = vp.getCurrentItem();
}