Esempio n. 1
0
  // Activity Callbacks __________________________________________________________________________
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_activity);
    this.getSupportActionBar().setElevation(0);

    getWindow().setSharedElementExitTransition(new Slide());
    getWindow().setSharedElementEnterTransition(new Slide());

    tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
    viewPager = (ViewPager) findViewById(R.id.pager);
    viewPagerAdapter = new ContactsAdapter(this.getSupportFragmentManager(), this);

    viewPager.setAdapter(viewPagerAdapter);

    tabs.setShouldExpand(true);
    tabs.setTextColor(getResources().getColor(R.color.text_primary));
    tabs.setDividerColor(getResources().getColor(R.color.primary));
    tabs.setIndicatorColorResource(R.color.text_primary);
    tabs.setIndicatorHeight(7);

    // Bind the tabs to the ViewPager
    tabs.setViewPager(viewPager);

    // Start in Contacts Fragment
    viewPager.setCurrentItem(1);

    // Listener for slide animation on searchable selected
    setOnSearchableListener();

    // Configure custom-searchable UI
    // CustomSearchableInfo.setTransparencyColor(Color.parseColor("#0288D1"));
  }
  // region Lifecycle Methods
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_quick_return_twitter);
    ButterKnife.inject(this);

    mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());

    // Set up the ViewPager with the sections adapter.
    mViewPager.setAdapter(mSectionsPagerAdapter);

    mTabs.setAllCaps(false);
    mTabs.setShouldExpand(true);
    mTabs.setTextSize(QuickReturnUtils.dp2px(this, 16));
    mTabs.setTabBackground(R.drawable.selector_bg_tab);
    mTabs.setIndicatorColorResource(R.color.steel_blue);
    mTabs.setIndicatorHeight(QuickReturnUtils.dp2px(this, 5));
    mTabs.setOnPageChangeListener(mTabsOnPageChangeListener);
    mTabs.setViewPager(mViewPager);

    // Set first tab selected
    mTabsLinearLayout = ((LinearLayout) mTabs.getChildAt(0));

    for (int i = 0; i < mTabsLinearLayout.getChildCount(); i++) {
      TextView tv = (TextView) mTabsLinearLayout.getChildAt(i);

      if (i == 0) {
        tv.setTextColor(getResources().getColor(R.color.steel_blue));
        tv.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/Roboto-Medium.ttf"));
      } else {
        tv.setTextColor(getResources().getColor(R.color.steel_blue));
        tv.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/Roboto-Light.ttf"));
      }
    }
  }
  // region Lifecycle Methods
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_quick_return_facebook);
    ButterKnife.inject(this);

    mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());

    // Set up the ViewPager with the sections adapter.
    mViewPager.setAdapter(mSectionsPagerAdapter);

    mTabs.setAllCaps(false);
    mTabs.setShouldExpand(true);
    //        mTabs.setTextSize(QuickReturnUtils.dp2px(this, 16));
    //        mTabs.setTabBackground(R.drawable.selector_bg_tab);
    mTabs.setIndicatorColorResource(R.color.steel_blue);
    mTabs.setIndicatorHeight(QuickReturnUtils.dp2px(this, 5));
    mTabs.setDividerColor(getResources().getColor(android.R.color.transparent));
    //        mTabs.setBackgroundColor(getResources().getColor(R.color.indigo));

    mTabs.setOnPageChangeListener(mTabsOnPageChangeListener);

    mTabs.setViewPager(mViewPager);

    // Set first tab selected
    mTabsLinearLayout = ((LinearLayout) mTabs.getChildAt(0));
    ImageButton ib = (ImageButton) mTabsLinearLayout.getChildAt(0);
    ib.setImageResource(R.drawable.ic_action_event_highlighted);
  }
Esempio n. 4
0
 private void setTabsValue() {
   tabs.setShouldExpand(true);
   tabs.setDividerColor(Color.TRANSPARENT);
   tabs.setUnderlineHeight((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, dm));
   tabs.setIndicatorHeight((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, dm));
   tabs.setTextSize((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, dm));
   tabs.setIndicatorColor(Color.parseColor("#45c01a"));
   tabs.setTabBackground(0);
 }
  private void setTabsValue() {
    dm = getResources().getDisplayMetrics();

    mPagerSlidingTabStrip.setDividerColor(Color.TRANSPARENT);
    mPagerSlidingTabStrip.setUnderlineHeight(
        (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, dm));
    mPagerSlidingTabStrip.setIndicatorHeight(
        (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, dm));
    mPagerSlidingTabStrip.setTextSize(
        (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 12, dm));
    mPagerSlidingTabStrip.setIndicatorColor(Color.parseColor("#45c01a"));
    mPagerSlidingTabStrip.setTabBackground(0);
  }
Esempio n. 6
0
  @TargetApi(Build.VERSION_CODES.M)
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    UmengUpdateAgent.update(this);

    mainViewPager = (ViewPager) findViewById(R.id.main_viewPager);
    // mainViewPager.setOffscreenPageLimit(1);
    mainViewPager.setAdapter(new SampleFragmentPagerAdapter(getSupportFragmentManager()));
    pagerSlidingTabStrip = (PagerSlidingTabStrip) findViewById(R.id.tab_indicator);
    pagerSlidingTabStrip.setViewPager(mainViewPager);

    // 指示条颜色
    pagerSlidingTabStrip.setIndicatorColor(R.color.blue_500);
    // 指示条高度
    pagerSlidingTabStrip.setIndicatorHeight(
        (int)
            TypedValue.applyDimension(
                TypedValue.COMPLEX_UNIT_DIP, 3, getResources().getDisplayMetrics()));
  }
Esempio n. 7
0
 /** mPagerSlidingTabStrip默认值配置 */
 private void initTabsValue() {
   // 底部游标颜色
   mPagerSlidingTabStrip.setIndicatorColor(Color.WHITE);
   // tab的分割线颜色
   mPagerSlidingTabStrip.setDividerColor(Color.TRANSPARENT);
   // tab背景
   mPagerSlidingTabStrip.setBackgroundColor(Color.parseColor("#ff259b2c"));
   // tab底线高度
   mPagerSlidingTabStrip.setUnderlineHeight(
       (int)
           TypedValue.applyDimension(
               TypedValue.COMPLEX_UNIT_DIP, 1, getResources().getDisplayMetrics()));
   // 游标高度
   mPagerSlidingTabStrip.setIndicatorHeight(
       (int)
           TypedValue.applyDimension(
               TypedValue.COMPLEX_UNIT_DIP, 5, getResources().getDisplayMetrics()));
   // 选中的文字颜色
   // mPagerSlidingTabStrip.setSelectedTextColor(Color.WHITE);
   // 正常文字颜色
   mPagerSlidingTabStrip.setTextColor(Color.WHITE);
 }
Esempio n. 8
0
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onViewCreated(view, savedInstanceState);

    aq.id(R.id.header_logo_inivit)
        .clicked(
            new OnClickListener() {

              @Override
              public void onClick(View arg0) {
                // TODO Auto-generated method stub

                getFragmentManager().popBackStack();
              }
            });
    aq.id(R.id.organizer)
        .text(
            Html.fromHtml(
                "<i><small><font color=\"#c5c5c5\">"
                    + "Competitor ID: "
                    + "</font></small></i>"
                    + "<font color=\"#47a842\">"
                    + "compID"
                    + "</font>"));

    pager = (ViewPager) getActivity().findViewById(R.id.pager_invit);

    tabPagerAdapter = new TabPagerAdapter1(getChildFragmentManager());
    tabPagerAdapter.setTabHolderScrollingContent(
        new InvitationScrollHolder() {

          @Override
          public void onScroll(
              AbsListView view,
              int firstVisibleItem,
              int visibleItemCount,
              int totalItemCount,
              int pagePosition) {
            // TODO Auto-generated method stub

          }

          @Override
          public void adjustScroll(int scrollHeight) {
            // TODO Auto-generated method stub

          }
        });

    pager.setAdapter(tabPagerAdapter);

    // Bind the tabs to the ViewPager
    final PagerSlidingTabStrip tabs = (PagerSlidingTabStrip) aq.id(R.id.tabs_invit).getView();

    tabs.setShouldExpand(false);
    tabs.setDividerColorResource(android.R.color.transparent);
    tabs.setUnderlineColorResource(android.R.color.transparent);
    tabs.setTextSize(Utils.getPxFromDp(getActivity(), 14));
    tabs.setIndicatorHeight(Utils.getPxFromDp(getActivity(), 3));

    tabs.setMinimumWidth(Utils.getPxFromDp(getActivity(), 200));

    tabs.setIndicatorColor(Color.parseColor("#ffffff"));
    tabs.setTextColor(Color.parseColor("#ffffff"));
    tabs.setSmoothScrollingEnabled(true);
    tabs.setShouldExpand(false);
    tabs.setAllCaps(false);
    tabs.setTypeface(null, Typeface.NORMAL);

    tabs.setViewPager(pager);
    tabPagerAdapter.notifyDataSetChanged();
  }