use of android.support.design.widget.NavigationView in project NeuCardReader by liuyanyi.
the class MainActivity method viewInit.
private void viewInit() {
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawer = findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
}
use of android.support.design.widget.NavigationView in project run-wallet-android by runplay.
the class WalletAddressesFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
recyclerView.setLayoutManager(new RecyclerLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
NavigationView navigationView = getActivity().findViewById(R.id.nav_view);
navigationView.getMenu().findItem(R.id.nav_wallet).setChecked(true);
yesButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
GetFirstLoadRequestHandler.setUserConfirm(Store.getCurrentSeed().id, true);
confirmPod.setVisibility(View.GONE);
firstLoadPod.setVisibility(View.VISIBLE);
}
});
noButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
GetFirstLoadRequestHandler.setUserConfirm(Store.getCurrentSeed().id, false);
confirmPod.setVisibility(View.GONE);
firstLoadPod.setVisibility(View.VISIBLE);
}
});
}
use of android.support.design.widget.NavigationView in project BeautifulRefreshLayout by android-cjj.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
final ActionBar ab = getSupportActionBar();
ab.setHomeAsUpIndicator(R.drawable.ic_menu);
ab.setDisplayHomeAsUpEnabled(true);
ab.setTitle(null);
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
if (navigationView != null) {
setupDrawerContent(navigationView);
}
ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
if (viewPager != null) {
setupViewPager(viewPager);
}
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "I'm CJJ", Snackbar.LENGTH_LONG).setAction("Action", null).show();
}
});
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);
}
use of android.support.design.widget.NavigationView in project material-components-android by material-components.
the class NavigationViewActions method setItemBackgroundResource.
/** Sets item background on the content of the navigation view. */
public static ViewAction setItemBackgroundResource(@DrawableRes final int resId) {
return new ViewAction() {
@Override
public Matcher<View> getConstraints() {
return isDisplayed();
}
@Override
public String getDescription() {
return "Set item background";
}
@Override
public void perform(UiController uiController, View view) {
uiController.loopMainThreadUntilIdle();
NavigationView navigationView = (NavigationView) view;
navigationView.setItemBackgroundResource(resId);
uiController.loopMainThreadUntilIdle();
}
};
}
use of android.support.design.widget.NavigationView in project material-components-android by material-components.
the class NavigationViewActions method removeMenuItem.
/**
* Removes the specified menu item from the navigation view.
*
* @param menuItemId The ID of the menu item to be removed.
*/
public static ViewAction removeMenuItem(@IdRes final int menuItemId) {
return new ViewAction() {
@Override
public Matcher<View> getConstraints() {
return isAssignableFrom(NavigationView.class);
}
@Override
public String getDescription() {
return "Remove menu item " + menuItemId;
}
@Override
public void perform(UiController uiController, View view) {
uiController.loopMainThreadUntilIdle();
NavigationView navigationView = (NavigationView) view;
navigationView.getMenu().removeItem(menuItemId);
uiController.loopMainThreadUntilIdle();
}
};
}
Aggregations