use of android.support.design.widget.BottomNavigationView in project material-components-android by material-components.
the class BottomNavigationViewActions method setItemIconTintList.
/** Sets item icon tint list on the content of the bottom navigation view. */
public static ViewAction setItemIconTintList(@Nullable final ColorStateList tint) {
return new ViewAction() {
@Override
public Matcher<View> getConstraints() {
return isDisplayed();
}
@Override
public String getDescription() {
return "Set item icon tint list";
}
@Override
public void perform(UiController uiController, View view) {
uiController.loopMainThreadUntilIdle();
BottomNavigationView navigationView = (BottomNavigationView) view;
navigationView.setItemIconTintList(tint);
uiController.loopMainThreadUntilIdle();
}
};
}
use of android.support.design.widget.BottomNavigationView in project NPSmiles by bmcglynn1.
the class MainActivity method onResume.
@Override
public void onResume() {
super.onResume();
BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
int id = navigation.getSelectedItemId();
if (id == R.id.navigation_news) {
FragmentTransaction transaction = fragmentManager.beginTransaction();
transaction.replace(R.id.main_container, new NewsFragment(), "News").commit();
}
invalidateOptionsMenu();
}
use of android.support.design.widget.BottomNavigationView in project talk-android by nextcloud.
the class CallsListController method initSearchView.
private void initSearchView() {
if (getActivity() != null) {
SearchManager searchManager = (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE);
if (searchItem != null) {
searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
searchView.setMaxWidth(Integer.MAX_VALUE);
searchView.setInputType(InputType.TYPE_TEXT_VARIATION_FILTER);
searchView.setImeOptions(EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_FULLSCREEN);
searchView.setQueryHint(getResources().getString(R.string.nc_search));
if (searchManager != null) {
searchView.setSearchableInfo(searchManager.getSearchableInfo(getActivity().getComponentName()));
}
searchView.setOnQueryTextListener(this);
}
}
final View mSearchEditFrame = searchView.findViewById(android.support.v7.appcompat.R.id.search_edit_frame);
BottomNavigationView bottomNavigationView = getParentController().getView().findViewById(R.id.navigation);
Handler handler = new Handler();
ViewTreeObserver vto = mSearchEditFrame.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
int oldVisibility = -1;
@Override
public void onGlobalLayout() {
int currentVisibility = mSearchEditFrame.getVisibility();
if (currentVisibility != oldVisibility) {
if (currentVisibility == View.VISIBLE) {
handler.postDelayed(() -> bottomNavigationView.setVisibility(View.GONE), 100);
} else {
handler.postDelayed(() -> {
bottomNavigationView.setVisibility(View.VISIBLE);
searchItem.setVisible(callItems.size() > 0);
}, 500);
}
oldVisibility = currentVisibility;
}
}
});
}
use of android.support.design.widget.BottomNavigationView in project Carebase by robertsimoes.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/**
* Set Toolbar
*/
Toolbar myToolbar = (Toolbar) findViewById(R.id.general_fragments_toolbar);
setSupportActionBar(myToolbar);
ILocalCache cache = new LocalCacheDb(this);
String userId = cache.getUserId();
boolean isFirstInstall = cache.isFirstInstall();
if (isFirstInstall) {
cache.setFirstInstall(false);
startActivity(new Intent(this, IntroActivity.class));
}
/* Get Patient Info */
src.getPatient(userId, new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
Toast.makeText(MainActivity.this, "Welcome Back!", Toast.LENGTH_SHORT).show();
Log.d("TAG", "SUCCESS \n\n\n\n ------");
Patient p = dataSnapshot.getValue(Patient.class);
fragmentArgs = new Bundle();
fragmentArgs.putSerializable(Const.BUNDLE_KEY_PATIENT, p);
BottomNavigationView bottomNavigationView = (BottomNavigationView) findViewById(R.id.main_bottom_navigation);
bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch(item.getItemId()) {
case R.id.action_inbox:
invalidateOptionsMenu();
selectedFragment = InboxFragment.newInstance(fragmentArgs);
currentFragment = Frag.INBOX;
break;
case R.id.action_appointments:
invalidateOptionsMenu();
AppointmentsFragment f = AppointmentsFragment.newInstance(fragmentArgs);
f.setCallback(MainActivity.this);
selectedFragment = f;
currentFragment = Frag.APPOINTMENTS;
break;
case R.id.action_rx:
invalidateOptionsMenu();
selectedFragment = RxFragment.newInstance(fragmentArgs);
currentFragment = Frag.RX;
break;
case R.id.action_profile:
invalidateOptionsMenu();
selectedFragment = ProfileFragment.newInstance(fragmentArgs);
currentFragment = Frag.PROFILE_EDIT;
break;
}
refreshFragmentUI(selectedFragment);
return true;
}
});
// Before the application or user has picked anything to display
// Let's just display the inbox fragment by default so that when the app loads up
// we pick that.
}
@Override
public void onCancelled(DatabaseError databaseError) {
Log.e("ERR", "Could not load patient snapshot" + databaseError.getDetails());
}
});
}
use of android.support.design.widget.BottomNavigationView in project Devsfolio by Madonahs.
the class MainActivity method onCreate.
/**
* Theme can only be changed before setContentView is called.
* Therefore, I am changing the theme on here.
* store data
* @param savedInstanceState
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
sharedPref = new SharedPref(this);
if (sharedPref.loadNightModeState()) {
setTheme(R.style.DarkTheme);
} else {
setTheme(R.style.AppTheme);
}
prev_State = sharedPref.loadNightModeState();
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
// This method will save the theme and initiates the preferenceChange listener
setCorrectTheme();
// Get all user information views from the drawer header view
View drawerHeaderView = navView.getHeaderView(0);
profilePicView = drawerHeaderView.findViewById(R.id.drawer_header_user_image);
userName = drawerHeaderView.findViewById(R.id.drawer_header_user_name);
userProfession = drawerHeaderView.findViewById(R.id.drawer_header_user_profession);
// Set action bar, navigation drawer, navigation drawer header
setSupportActionBar(toolbar);
setupNavDrawer();
setDrawerHeader();
fragment = getSupportFragmentManager().findFragmentByTag(TAG);
if (fragment == null) {
fragment = new FeedsFragment();
}
BottomNavigationView navigation = findViewById(R.id.navigation);
BottomNavigationViewHelper.disableShiftMode(navigation);
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.content, fragment, TAG);
transaction.commit();
/*TODO: Get user data from intent or load from DB if intent is null*/
Bundle data = getIntent().getBundleExtra(Constant.USER);
if (data != null)
user = User.build(data);
else
// TODO: load from DB
user = new User("this guy", "thisguy@devs.com", "000000");
}
Aggregations