Search in sources :

Example 36 with NavigationView

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);
}
Also used : NavigationView(android.support.design.widget.NavigationView) ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle) DrawerLayout(android.support.v4.widget.DrawerLayout) Toolbar(android.support.v7.widget.Toolbar)

Example 37 with NavigationView

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);
        }
    });
}
Also used : RecyclerLayoutManager(run.wallet.iota.ui.RecyclerLayoutManager) NavigationView(android.support.design.widget.NavigationView) NavigationView(android.support.design.widget.NavigationView) BindView(butterknife.BindView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView)

Example 38 with NavigationView

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);
}
Also used : NavigationView(android.support.design.widget.NavigationView) TabLayout(android.support.design.widget.TabLayout) FloatingActionButton(android.support.design.widget.FloatingActionButton) ViewPager(android.support.v4.view.ViewPager) NavigationView(android.support.design.widget.NavigationView) SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) View(android.view.View) ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar)

Example 39 with NavigationView

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();
        }
    };
}
Also used : NavigationView(android.support.design.widget.NavigationView) ViewAction(android.support.test.espresso.ViewAction) UiController(android.support.test.espresso.UiController) NavigationView(android.support.design.widget.NavigationView) View(android.view.View)

Example 40 with NavigationView

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();
        }
    };
}
Also used : NavigationView(android.support.design.widget.NavigationView) ViewAction(android.support.test.espresso.ViewAction) UiController(android.support.test.espresso.UiController) NavigationView(android.support.design.widget.NavigationView) View(android.view.View)

Aggregations

NavigationView (android.support.design.widget.NavigationView)70 View (android.view.View)42 Toolbar (android.support.v7.widget.Toolbar)25 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)24 TextView (android.widget.TextView)21 DrawerLayout (android.support.v4.widget.DrawerLayout)17 ImageView (android.widget.ImageView)16 UiController (android.support.test.espresso.UiController)13 ViewAction (android.support.test.espresso.ViewAction)13 Menu (android.view.Menu)10 ActionBar (android.support.v7.app.ActionBar)8 Intent (android.content.Intent)7 FloatingActionButton (android.support.design.widget.FloatingActionButton)7 MenuItem (android.view.MenuItem)7 Handler (android.os.Handler)6 SearchView (android.support.v7.widget.SearchView)6 BindView (butterknife.BindView)6 FlexboxLayout (com.google.android.flexbox.FlexboxLayout)6 TabLayout (android.support.design.widget.TabLayout)5 FlakyTest (android.support.test.filters.FlakyTest)5