Search in sources :

Example 1 with ProfileFragment

use of com.astronauts.astronaut.gui.fragment.impl.ProfileFragment in project Astronaut by astro-naut.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);
    //Prevent fragments from accidental overlapping
    if (savedInstanceState != null) {
        return;
    }
    bottomBar.setOnTabSelectListener(new OnTabSelectListener() {

        @Override
        public void onTabSelected(@IdRes int tabId) {
            FragmentTransaction transaction = getFragmentManager().beginTransaction();
            if (tabId == R.id.tab_discoveries) {
                DiscoveriesFragment fragment = new DiscoveriesFragment();
                transaction.replace(R.id.contentContainer, fragment);
            }
            if (tabId == R.id.tab_mikroblog) {
                MikroblogFragment fragment = new MikroblogFragment();
                transaction.replace(R.id.contentContainer, fragment);
            }
            if (tabId == R.id.tab_moj_wykop) {
                MojWykopFragment fragment = new MojWykopFragment();
                transaction.replace(R.id.contentContainer, fragment);
            }
            if (tabId == R.id.tab_profile) {
                ProfileFragment fragment = new ProfileFragment();
                transaction.replace(R.id.contentContainer, fragment);
            }
            if (tabId == R.id.tab_settings) {
                SettingsFragment fragment = new SettingsFragment();
                transaction.replace(R.id.contentContainer, fragment);
            }
            transaction.commit();
        }
    });
}
Also used : SettingsFragment(com.astronauts.astronaut.gui.fragment.impl.SettingsFragment) MikroblogFragment(com.astronauts.astronaut.gui.fragment.impl.MikroblogFragment) MojWykopFragment(com.astronauts.astronaut.gui.fragment.impl.MojWykopFragment) DiscoveriesFragment(com.astronauts.astronaut.gui.fragment.impl.DiscoveriesFragment) FragmentTransaction(android.app.FragmentTransaction) ProfileFragment(com.astronauts.astronaut.gui.fragment.impl.ProfileFragment) OnTabSelectListener(com.roughike.bottombar.OnTabSelectListener)

Aggregations

FragmentTransaction (android.app.FragmentTransaction)1 DiscoveriesFragment (com.astronauts.astronaut.gui.fragment.impl.DiscoveriesFragment)1 MikroblogFragment (com.astronauts.astronaut.gui.fragment.impl.MikroblogFragment)1 MojWykopFragment (com.astronauts.astronaut.gui.fragment.impl.MojWykopFragment)1 ProfileFragment (com.astronauts.astronaut.gui.fragment.impl.ProfileFragment)1 SettingsFragment (com.astronauts.astronaut.gui.fragment.impl.SettingsFragment)1 OnTabSelectListener (com.roughike.bottombar.OnTabSelectListener)1