Ejemplo n.º 1
0
  @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
  @Override
  public void onViewCreated(final View view, final Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    final ActionBar actionBar = UIUtils.getSupportActionBar(getActivity());
    actionBar.setTitle(R.string.private_messages);

    mViewPager = (ViewPager) view.findViewById(R.id.message_view_pager);
    mViewPager.setAdapter(mAdapter);

    final TabLayout tabLayout = (TabLayout) view.findViewById(R.id.pager_tab_strip);
    tabLayout.setSelectedIndicatorColors(getResources().getColor(android.R.color.white));
    tabLayout.setViewPager(mViewPager);

    final FloatingActionButton button =
        (FloatingActionButton) view.findViewById(R.id.message_fragment_action_create);

    button.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(final View v) {
            final DialogFragment fragment = CreateMessageFragment.createInstance();
            fragment.setTargetFragment(MessagePagerFragment.this, CREATE_MESSAGE_REQUEST_CODE);
            fragment.show(getFragmentManager(), "createMessage");
          }
        });

    if (CompatUtils.hasLollipop()) {
      CompatUtils.setBackground(button, getResources().getDrawable(R.drawable.fab_background));
    } else {
      button.setBackgroundColor(getResources().getColor(R.color.fab_color));
    }
  }
  @Override
  public void onViewCreated(final View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    final ViewPager viewPager = (ViewPager) view.findViewById(R.id.forum_view_pager);
    viewPager.setAdapter(mAdapter);
    viewPager.setOffscreenPageLimit(10);

    final TabLayout slidingTabLayout =
        (TabLayout) view.findViewById(R.id.fragment_sliding_tab_layout);
    slidingTabLayout.setSelectedIndicatorColors(getResources().getColor(android.R.color.white));
    slidingTabLayout.setViewPager(viewPager);

    final ActionBar bar = UIUtils.getSupportActionBar(getActivity());
    bar.show();
    bar.setTitle(R.string.quote_mentions);
    bar.setSubtitle(null);
  }