Search in sources :

Example 1 with OnTabSelectListener

use of com.roughike.bottombar.OnTabSelectListener in project BottomBar by roughike.

the class FiveColorChangingTabsActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_color_changing_tabs);
    messageView = (TextView) findViewById(R.id.messageView);
    BottomBar bottomBar = (BottomBar) findViewById(R.id.bottomBar);
    bottomBar.setOnTabSelectListener(new OnTabSelectListener() {

        @Override
        public void onTabSelected(@IdRes int tabId) {
            messageView.setText(TabMessage.get(tabId, false));
        }
    });
    bottomBar.setOnTabReselectListener(new OnTabReselectListener() {

        @Override
        public void onTabReSelected(@IdRes int tabId) {
            Toast.makeText(getApplicationContext(), TabMessage.get(tabId, true), Toast.LENGTH_LONG).show();
        }
    });
}
Also used : BottomBar(com.roughike.bottombar.BottomBar) OnTabReselectListener(com.roughike.bottombar.OnTabReselectListener) OnTabSelectListener(com.roughike.bottombar.OnTabSelectListener)

Example 2 with OnTabSelectListener

use of com.roughike.bottombar.OnTabSelectListener 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)

Example 3 with OnTabSelectListener

use of com.roughike.bottombar.OnTabSelectListener in project BottomBar by roughike.

the class BadgeActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_three_tabs);
    messageView = (TextView) findViewById(R.id.messageView);
    final BottomBar bottomBar = (BottomBar) findViewById(R.id.bottomBar);
    bottomBar.setOnTabSelectListener(new OnTabSelectListener() {

        @Override
        public void onTabSelected(@IdRes int tabId) {
            messageView.setText(TabMessage.get(tabId, false));
        }
    });
    bottomBar.setOnTabReselectListener(new OnTabReselectListener() {

        @Override
        public void onTabReSelected(@IdRes int tabId) {
            Toast.makeText(getApplicationContext(), TabMessage.get(tabId, true), Toast.LENGTH_LONG).show();
        }
    });
    BottomBarTab nearby = bottomBar.getTabWithId(R.id.tab_nearby);
    nearby.setBadgeCount(5);
}
Also used : BottomBar(com.roughike.bottombar.BottomBar) OnTabReselectListener(com.roughike.bottombar.OnTabReselectListener) BottomBarTab(com.roughike.bottombar.BottomBarTab) OnTabSelectListener(com.roughike.bottombar.OnTabSelectListener)

Example 4 with OnTabSelectListener

use of com.roughike.bottombar.OnTabSelectListener in project BottomBar by roughike.

the class CustomColorAndFontActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_custom_color_and_font);
    messageView = (TextView) findViewById(R.id.messageView);
    BottomBar bottomBar = (BottomBar) findViewById(R.id.bottomBar);
    bottomBar.setOnTabSelectListener(new OnTabSelectListener() {

        @Override
        public void onTabSelected(@IdRes int tabId) {
            messageView.setText(TabMessage.get(tabId, false));
        }
    });
    bottomBar.setOnTabReselectListener(new OnTabReselectListener() {

        @Override
        public void onTabReSelected(@IdRes int tabId) {
            Toast.makeText(getApplicationContext(), TabMessage.get(tabId, true), Toast.LENGTH_LONG).show();
        }
    });
}
Also used : BottomBar(com.roughike.bottombar.BottomBar) OnTabReselectListener(com.roughike.bottombar.OnTabReselectListener) OnTabSelectListener(com.roughike.bottombar.OnTabSelectListener)

Example 5 with OnTabSelectListener

use of com.roughike.bottombar.OnTabSelectListener in project BottomBar by roughike.

the class ThreeTabsActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_three_tabs);
    messageView = (TextView) findViewById(R.id.messageView);
    BottomBar bottomBar = (BottomBar) findViewById(R.id.bottomBar);
    bottomBar.setOnTabSelectListener(new OnTabSelectListener() {

        @Override
        public void onTabSelected(@IdRes int tabId) {
            messageView.setText(TabMessage.get(tabId, false));
        }
    });
    bottomBar.setOnTabReselectListener(new OnTabReselectListener() {

        @Override
        public void onTabReSelected(@IdRes int tabId) {
            Toast.makeText(getApplicationContext(), TabMessage.get(tabId, true), Toast.LENGTH_LONG).show();
        }
    });
}
Also used : BottomBar(com.roughike.bottombar.BottomBar) OnTabReselectListener(com.roughike.bottombar.OnTabReselectListener) OnTabSelectListener(com.roughike.bottombar.OnTabSelectListener)

Aggregations

OnTabSelectListener (com.roughike.bottombar.OnTabSelectListener)6 BottomBar (com.roughike.bottombar.BottomBar)5 OnTabReselectListener (com.roughike.bottombar.OnTabReselectListener)4 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 BottomBarTab (com.roughike.bottombar.BottomBarTab)1