Beispiel #1
0
  @Override
  public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
    if (positionOffset > 0) {
      GradientIconView iconLeft = mIconIndicator.get(position);
      GradientIconView iconRight = mIconIndicator.get(position + 1);

      GradientTextView textLeft = mTextIndicator.get(position);
      GradientTextView textRight = mTextIndicator.get(position + 1);

      iconLeft.setIconAlpha(1 - positionOffset);
      iconRight.setIconAlpha(positionOffset);
      textLeft.setTextViewAlpha(1 - positionOffset);
      textRight.setTextViewAlpha(positionOffset);
    }
  }
Beispiel #2
0
  private void initViews() {
    mViewPager = (ViewPager) findViewById(R.id.viewPager);

    mIconChats = (GradientIconView) findViewById(R.id.chat_icon);
    mIconIndicator.add(mIconChats);
    mIconChats.setIconAlpha(1f);

    mIconContacts = (GradientIconView) findViewById(R.id.contacts_icon);
    mIconIndicator.add(mIconContacts);

    mIconDiscover = (GradientIconView) findViewById(R.id.discover_icon);
    mIconIndicator.add(mIconDiscover);

    mIconAbout = (GradientIconView) findViewById(R.id.about_icon);
    mIconIndicator.add(mIconAbout);

    mTextChats = (GradientTextView) findViewById(R.id.chat_text);
    mTextIndicator.add(mTextChats);
    mTextChats.setTextViewAlpha(1f);

    mTextContacts = (GradientTextView) findViewById(R.id.contacts_text);
    mTextIndicator.add(mTextContacts);

    mTextDiscover = (GradientTextView) findViewById(R.id.discover_text);
    mTextIndicator.add(mTextDiscover);

    mTextAbout = (GradientTextView) findViewById(R.id.about_text);
    mTextIndicator.add(mTextAbout);

    mContainerChats = (LinearLayout) findViewById(R.id.chat_container);
    mContainerChats.setOnClickListener(this);

    mContainerContacts = (LinearLayout) findViewById(R.id.contacts_container);
    mContainerContacts.setOnClickListener(this);

    mContainerDiscover = (LinearLayout) findViewById(R.id.discover_container);
    mContainerDiscover.setOnClickListener(this);

    mContainerAbout = (LinearLayout) findViewById(R.id.about_container);
    mContainerAbout.setOnClickListener(this);

    initFragments();
  }