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);
}
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();
}
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;
}
});
}
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);
}
}
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);
}
Aggregations