Search in sources :

Example 11 with BottomNavigationView

use of android.support.design.widget.BottomNavigationView in project Team-Plant-Power by Alexander1994.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mTextMessage = (TextView) findViewById(R.id.message);
    BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
    navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
}
Also used : BottomNavigationView(android.support.design.widget.BottomNavigationView)

Example 12 with BottomNavigationView

use of android.support.design.widget.BottomNavigationView in project NPSmiles by bmcglynn1.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
    navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
    setTitle("Contact Info");
    fragmentManager = getSupportFragmentManager();
    fragment = new ItemOneFragment();
    FragmentTransaction transaction = fragmentManager.beginTransaction();
    transaction.replace(R.id.main_container, fragment).commit();
    mAuth = FirebaseAuth.getInstance();
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) BottomNavigationView(android.support.design.widget.BottomNavigationView)

Example 13 with BottomNavigationView

use of android.support.design.widget.BottomNavigationView in project android by nextcloud.

the class DisplayUtils method setupBottomBar.

public static void setupBottomBar(BottomNavigationView view, Resources resources, final Activity activity, int checkedMenuItem) {
    Menu menu = view.getMenu();
    Account account = AccountUtils.getCurrentOwnCloudAccount(MainApp.getAppContext());
    boolean searchSupported = AccountUtils.hasSearchSupport(account);
    if (!searchSupported) {
        menu.removeItem(R.id.nav_bar_favorites);
        menu.removeItem(R.id.nav_bar_photos);
    }
    if (resources.getBoolean(R.bool.use_home)) {
        menu.findItem(R.id.nav_bar_files).setTitle(resources.getString(R.string.drawer_item_home));
        menu.findItem(R.id.nav_bar_files).setIcon(R.drawable.ic_home);
    }
    setBottomBarItem(view, checkedMenuItem);
    view.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {

        @Override
        public boolean onNavigationItemSelected(@NonNull MenuItem item) {
            switch(item.getItemId()) {
                case R.id.nav_bar_files:
                    EventBus.getDefault().post(new MenuItemClickEvent(item));
                    if (activity != null) {
                        activity.invalidateOptionsMenu();
                    }
                    break;
                case R.id.nav_bar_favorites:
                    SearchEvent favoritesEvent = new SearchEvent("", SearchOperation.SearchType.FAVORITE_SEARCH, SearchEvent.UnsetType.UNSET_DRAWER);
                    switchToSearchFragment(activity, favoritesEvent);
                    break;
                case R.id.nav_bar_photos:
                    SearchEvent photosEvent = new SearchEvent("image/%", SearchOperation.SearchType.CONTENT_TYPE_SEARCH, SearchEvent.UnsetType.UNSET_DRAWER);
                    switchToSearchFragment(activity, photosEvent);
                    break;
                case R.id.nav_bar_settings:
                    EventBus.getDefault().post(new MenuItemClickEvent(item));
                    break;
                default:
                    break;
            }
            return true;
        }
    });
}
Also used : MenuItemClickEvent(com.owncloud.android.ui.events.MenuItemClickEvent) Account(android.accounts.Account) OwnCloudAccount(com.owncloud.android.lib.common.OwnCloudAccount) BottomNavigationView(android.support.design.widget.BottomNavigationView) MenuItem(android.view.MenuItem) SearchEvent(com.owncloud.android.ui.events.SearchEvent) Menu(android.view.Menu)

Example 14 with BottomNavigationView

use of android.support.design.widget.BottomNavigationView in project android by nextcloud.

the class UploadListActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    uploadStorageManager = new UploadsStorageManager(getContentResolver(), getApplicationContext());
    setContentView(R.layout.upload_list_layout);
    unbinder = ButterKnife.bind(this);
    swipeListRefreshLayout = findViewById(R.id.swipe_containing_list);
    // this activity has no file really bound, it's for multiple accounts at the same time; should no inherit
    // from FileActivity; moreover, some behaviours inherited from FileActivity should be delegated to Fragments;
    // but that's other story
    setFile(null);
    // setup toolbar
    setupToolbar();
    // setup drawer
    setupDrawer(R.id.nav_uploads);
    setupContent();
    if (getSupportActionBar() != null) {
        getSupportActionBar().setTitle(getString(R.string.uploads_view_title));
    }
    BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_navigation_view);
    if (getResources().getBoolean(R.bool.bottom_toolbar_enabled)) {
        bottomNavigationView.setVisibility(View.VISIBLE);
        DisplayUtils.setupBottomBar(bottomNavigationView, getResources(), this, -1);
    }
}
Also used : BottomNavigationView(android.support.design.widget.BottomNavigationView) UploadsStorageManager(com.owncloud.android.datamodel.UploadsStorageManager)

Example 15 with BottomNavigationView

use of android.support.design.widget.BottomNavigationView in project SmartRefreshLayout by scwang90.

the class IndexMainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_index_main);
    final BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
    navigation.setOnNavigationItemSelectedListener(this);
    ViewPager viewPager = (ViewPager) findViewById(R.id.content);
    viewPager.setAdapter(new FragmentStatePagerAdapter(getSupportFragmentManager()) {

        @Override
        public int getCount() {
            return TabFragment.values().length;
        }

        @Override
        public Fragment getItem(int position) {
            return TabFragment.values()[position].fragment();
        }
    });
    viewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {

        @Override
        public void onPageSelected(int position) {
            navigation.setSelectedItemId(TabFragment.values()[position].menuId);
        }
    });
    // 状态栏透明和间距处理
    StatusBarUtil.immersive(this, 0xff000000, 0.1f);
}
Also used : FragmentStatePagerAdapter(android.support.v4.app.FragmentStatePagerAdapter) BottomNavigationView(android.support.design.widget.BottomNavigationView) ViewPager(android.support.v4.view.ViewPager) RefreshStylesFragment(com.scwang.refreshlayout.fragment.index.RefreshStylesFragment) Fragment(android.support.v4.app.Fragment) RefreshPractiveFragment(com.scwang.refreshlayout.fragment.index.RefreshPractiveFragment) RefreshExampleFragment(com.scwang.refreshlayout.fragment.index.RefreshExampleFragment)

Aggregations

BottomNavigationView (android.support.design.widget.BottomNavigationView)24 View (android.view.View)8 MenuItem (android.view.MenuItem)6 FragmentTransaction (android.support.v4.app.FragmentTransaction)5 Bundle (android.os.Bundle)4 NavigationView (android.support.design.widget.NavigationView)3 UiController (android.support.test.espresso.UiController)3 ViewAction (android.support.test.espresso.ViewAction)3 BindView (butterknife.BindView)3 SearchManager (android.app.SearchManager)2 Intent (android.content.Intent)2 Handler (android.os.Handler)2 Fragment (android.support.v4.app.Fragment)2 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)2 RecyclerView (android.support.v7.widget.RecyclerView)2 SearchView (android.support.v7.widget.SearchView)2 Toolbar (android.support.v7.widget.Toolbar)2 Menu (android.view.Menu)2 ViewTreeObserver (android.view.ViewTreeObserver)2 TextView (android.widget.TextView)2