Esempio n. 1
0
 protected void populateView(View tabView, TextView textView, int position) {
   ImageView imageView = (ImageView) tabView;
   imageView.setImageDrawable(
       ContextCompat.getDrawable(getContext(), mAdapter.getPageIcon(position)));
   if (position != this.mViewPager.getCurrentItem()) {
     imageView.setAlpha(TAB_DIM_ALPHA);
   }
   imageView.setContentDescription(this.mAdapter.getPageTitle(position));
   this.mTabLookup[position] = tabView;
 }
Esempio n. 2
0
  public void setViewPager(ViewPager navigationPager) {
    mViewPager = navigationPager;
    mAdapter = (EzzePagerAdapter) navigationPager.getAdapter();
    mTabLookup = new View[mAdapter.getCount()];
    super.setViewPager(
        navigationPager,
        new ViewPager.OnPageChangeListener() {

          public void onPageScrolled(
              int position, float positionOffset, int positionOffsetPixels) {}

          public void onPageSelected(int pageIndex) {
            for (int i = 0; i < mTabLookup.length; i++) {
              if (i != pageIndex) {
                mTabLookup[i].animate().alpha(TAB_DIM_ALPHA).start();
              } else {
                mTabLookup[i].animate().alpha(1.0f).start();
              }
            }
          }

          public void onPageScrollStateChanged(int state) {}
        });
  }