Example #1
0
 private void initTabs() {
   tabLayout = (TabLayout) findViewById(R.id.tab_layout);
   tabLayout.addTab(tabLayout.newTab().setText(titles[0]));
   tabLayout.addTab(tabLayout.newTab().setText(titles[1]));
   tabLayout.addTab(tabLayout.newTab().setText(titles[2]));
   tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.people_org_pager, container, false);

    TabLayout tabLayout = (TabLayout) view.findViewById(R.id.tab_layout_org);
    tabLayout.addTab(tabLayout.newTab().setText("FOLLOWING"));
    tabLayout.addTab(tabLayout.newTab().setText("FOLOWERS"));
    tabLayout.addTab(tabLayout.newTab().setText("ORGANIZATIONS"));

    tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
    final ViewPager viewPager = (ViewPager) view.findViewById(R.id.pager_org);
    final PagerOrgAdapter adapter =
        new PagerOrgAdapter(getActivity().getSupportFragmentManager(), tabLayout.getTabCount());
    viewPager.setAdapter(adapter);
    viewPager.setOffscreenPageLimit(2);

    viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
    tabLayout.setOnTabSelectedListener(
        new TabLayout.OnTabSelectedListener() {
          @Override
          public void onTabSelected(TabLayout.Tab tab) {
            viewPager.setCurrentItem(tab.getPosition());
          }

          @Override
          public void onTabUnselected(TabLayout.Tab tab) {}

          @Override
          public void onTabReselected(TabLayout.Tab tab) {}
        });
    return view;
  }
  private void init() {
    inflate(getContext(), R.layout.view_organization, this);
    mTvTitle = (TextView) findViewById(R.id.tv_title_VO);
    mTvRegion = (TextView) findViewById(R.id.tv_region_VO);
    mTvCity = (TextView) findViewById(R.id.tv_city_VO);
    mTvPhone = (TextView) findViewById(R.id.tv_phone_VO);
    mTvAddress = (TextView) findViewById(R.id.tv_address_VO);

    mTabLayout = (TabLayout) findViewById(R.id.tabLayout);
    mTabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
    for (int i = 0; i < 4; i++) {
      mTabLayout.addTab(mTabLayout.newTab().setIcon(mImageResId[i]));
    }
  }
Example #4
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_exam, container, false);
    ButterKnife.bind(this, v);

    ExamAdapter adapter = new ExamAdapter(getChildFragmentManager());
    examNavigationTab.setTabsFromPagerAdapter(adapter);
    examNavigationView.setAdapter(adapter);
    examNavigationTab.setTabsFromPagerAdapter(adapter);
    examNavigationTab.setupWithViewPager(examNavigationView);
    examNavigationTab.setTabMode(TabLayout.MODE_FIXED);
    examNavigationTab.setTabGravity(TabLayout.GRAVITY_FILL);
    return v;
  }
Example #5
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    String[] titles = getResources().getStringArray(R.array.books_tabs);

    setContentView(R.layout.book_desc_layout);

    ViewPagerAdapter adapter =
        new ViewPagerAdapter(getSupportFragmentManager(), titles, NUMBER_OF_TUBS);
    pager = (ViewPager) findViewById(R.id.pager);
    pager.setAdapter(adapter);

    tabs = (TabLayout) findViewById(R.id.tabs);
    tabs.setTabGravity(TabLayout.GRAVITY_CENTER);
    tabs.setupWithViewPager(pager);
    setupToolbar();
  }
Example #6
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_matchday_detail);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    // Create the adapter that will return a fragment for each of the three
    // primary sections of the activity.
    mSectionsPagerAdapter = new MatchdayPagerAdapter(getSupportFragmentManager());

    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.container);
    mViewPager.setAdapter(mSectionsPagerAdapter);

    TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
    // By using this method the tabs will be populated according to viewPager's count and
    // with the name from the pagerAdapter getPageTitle()
    tabLayout.setTabsFromPagerAdapter(mSectionsPagerAdapter);
    tabLayout.setupWithViewPager(mViewPager);
    realmDBManager = new ZappRealmDBManager();

    tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            createMatchday();
          }
        });

    RealmResults<Matchday> list = realmDBManager.list_all_matchdays();

    setMatchday(new Matchday());
    DateFormat df = new SimpleDateFormat("dd.MM.yyyy");
    String date = df.format(Calendar.getInstance().getTime());
    getMatchday().setDatum(date);

    EventBus.getDefault().register(this);
  }
Example #7
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.my_test);
    Intent i = getIntent();

    doctor = (Doctor) i.getSerializableExtra("doc_details");

    TextView name = (TextView) findViewById(R.id.detail_name);
    name.setText(doctor.getDoctor_name());
    TextView category = (TextView) findViewById(R.id.detail_field);
    category.setText(doctor.getCaregory());

    TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout);
    tabLayout.addTab(tabLayout.newTab().setText("Details"));
    tabLayout.addTab(tabLayout.newTab().setText("Chambers"));
    tabLayout.addTab(tabLayout.newTab().setText("Comment"));

    tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);

    final ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
    final ViewPagerTabFragmentAdapter adapter =
        new ViewPagerTabFragmentAdapter(
            doctor, getSupportFragmentManager(), tabLayout.getTabCount());
    viewPager.setAdapter(adapter);

    viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));

    tabLayout.setOnTabSelectedListener(
        new TabLayout.OnTabSelectedListener() {
          @Override
          public void onTabSelected(TabLayout.Tab tab) {
            viewPager.setCurrentItem(tab.getPosition());
          }

          @Override
          public void onTabUnselected(TabLayout.Tab tab) {}

          @Override
          public void onTabReselected(TabLayout.Tab tab) {}
        });
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main_tabbed);

    currentUsername = getIntent().getStringExtra("username");
    db = new DatabaseHandler(this);
    user = db.getUser(currentUsername);

    mainToolbar = (Toolbar) findViewById(R.id.mainToolbar);
    mainTabBar = (TabLayout) findViewById(R.id.mainTabBar);
    mainViewPager = (ViewPager) findViewById(R.id.mainViewPager);
    fragmentManager = getSupportFragmentManager();

    mainToolbar.setTitle(R.string.app_name);
    setSupportActionBar(mainToolbar);

    initTabBar();
    initViewPager();

    mainTabBar.setTabGravity(TabLayout.GRAVITY_FILL);
    mainTabBar.setupWithViewPager(mainViewPager);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_post__new__demand);
    this.toolbaractionbar = (Toolbar) findViewById(R.id.toolbar_actionbar);
    this.tablayout = (TabLayout) findViewById(R.id.tab_layout);
    tablayout.addTab(tablayout.newTab().setText("Diamond"));
    tablayout.addTab(tablayout.newTab().setText("Gems Stone"));
    tablayout.addTab(tablayout.newTab().setText("Jewellery"));
    tablayout.setTabGravity(TabLayout.GRAVITY_FILL);

    setSupportActionBar(toolbaractionbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);

    fragmentManager = getFragmentManager();

    fragment = new DiamondFragment();

    if (fragment != null) {
      fragmentManager.beginTransaction().add(R.id.container_tab, fragment).commit();
    }
    tablayout.setOnTabSelectedListener(
        new TabLayout.OnTabSelectedListener() {
          @Override
          public void onTabSelected(TabLayout.Tab tab) {
            Log.d("tab position", String.valueOf(tab.getPosition()));

            switch (tab.getPosition()) {
              case 0:
                fragment = new DiamondFragment();

                if (fragment != null) {
                  fragmentManager
                      .beginTransaction()
                      .replace(R.id.container_tab, fragment)
                      .addToBackStack("Diamond")
                      .commit();
                }
                break;
              case 1:
                fragment = new GemsStoneFragment();

                if (fragment != null) {
                  fragmentManager
                      .beginTransaction()
                      .replace(R.id.container_tab, fragment)
                      .addToBackStack("GemsStones")
                      .commit();
                }
                break;
              case 2:
                fragment = new JewelleryFragment();

                if (fragment != null) {
                  fragmentManager
                      .beginTransaction()
                      .replace(R.id.container_tab, fragment)
                      .addToBackStack("Jewellery")
                      .commit();
                }
                Log.d("tab 2", "tab 2 selected");
                break;
            }
          }

          @Override
          public void onTabUnselected(TabLayout.Tab tab) {}

          @Override
          public void onTabReselected(TabLayout.Tab tab) {}
        });
  }