Search in sources :

Example 66 with NavigationView

use of android.support.design.widget.NavigationView in project Varis-Android by dkhmelenko.

the class MainActivity method updateMenuState.

@Override
public void updateMenuState(@Nullable String accessToken) {
    NavigationView view = findViewById(R.id.navigation_view);
    Menu menu = view.getMenu();
    if (TextUtils.isEmpty(accessToken)) {
        menu.findItem(R.id.drawer_login).setVisible(true);
        menu.findItem(R.id.drawer_logout).setVisible(false);
    } else {
        menu.findItem(R.id.drawer_login).setVisible(false);
        menu.findItem(R.id.drawer_logout).setVisible(true);
    }
}
Also used : NavigationView(android.support.design.widget.NavigationView) Menu(android.view.Menu)

Example 67 with NavigationView

use of android.support.design.widget.NavigationView in project Varis-Android by dkhmelenko.

the class MainActivity method updateUserData.

@Override
public void updateUserData(User user) {
    final NavigationView view = findViewById(R.id.navigation_view);
    View header = view.getHeaderView(0);
    TextView usernameView = header.findViewById(R.id.drawer_header_username);
    TextView emailView = header.findViewById(R.id.drawer_header_email);
    if (user != null) {
        String username = user.getLogin();
        if (!TextUtils.isEmpty(user.getName())) {
            username = String.format("%1$s (%2$s)", user.getName(), user.getLogin());
        }
        usernameView.setText(username);
        emailView.setText(user.getEmail());
    // TODO Update image, when service will provide it
    } else {
        usernameView.setText(R.string.navigation_drawer_username_placeholder);
        emailView.setText(R.string.navigation_drawer_email_placeholder);
    }
}
Also used : NavigationView(android.support.design.widget.NavigationView) TextView(android.widget.TextView) NavigationView(android.support.design.widget.NavigationView) SearchView(android.support.v7.widget.SearchView) BindView(butterknife.BindView) View(android.view.View) TextView(android.widget.TextView)

Example 68 with NavigationView

use of android.support.design.widget.NavigationView in project todo-mvp-rxjava by albertizzy.

the class StatisticsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.statistics_act);
    // Set up the toolbar.
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar ab = getSupportActionBar();
    ab.setTitle(R.string.statistics_title);
    ab.setHomeAsUpIndicator(R.drawable.ic_menu);
    ab.setDisplayHomeAsUpEnabled(true);
    // Set up the navigation drawer.
    mDrawerLayout = findViewById(R.id.drawer_layout);
    mDrawerLayout.setStatusBarBackground(R.color.colorPrimaryDark);
    NavigationView navigationView = findViewById(R.id.nav_view);
    if (navigationView != null) {
        setupDrawerContent(navigationView);
    }
    StatisticsFragment statisticsFragment = (StatisticsFragment) getSupportFragmentManager().findFragmentById(R.id.contentFrame);
    if (statisticsFragment == null) {
        statisticsFragment = StatisticsFragment.newInstance();
        ActivityUtils.addFragmentToActivity(getSupportFragmentManager(), statisticsFragment, R.id.contentFrame);
    }
    new StatisticsPresenter(Injection.provideTasksRepository(getApplicationContext()), statisticsFragment, Injection.provideSchedulerProvider());
}
Also used : NavigationView(android.support.design.widget.NavigationView) ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar)

Example 69 with NavigationView

use of android.support.design.widget.NavigationView in project todo-mvp-rxjava by albertizzy.

the class TasksActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.tasks_act);
    // Set up the toolbar.
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar ab = getSupportActionBar();
    ab.setHomeAsUpIndicator(R.drawable.ic_menu);
    ab.setDisplayHomeAsUpEnabled(true);
    // Set up the navigation drawer.
    mDrawerLayout = findViewById(R.id.drawer_layout);
    mDrawerLayout.setStatusBarBackground(R.color.colorPrimaryDark);
    NavigationView navigationView = findViewById(R.id.nav_view);
    if (navigationView != null) {
        setupDrawerContent(navigationView);
    }
    TasksFragment tasksFragment = (TasksFragment) getSupportFragmentManager().findFragmentById(R.id.contentFrame);
    if (tasksFragment == null) {
        // Create the fragment
        tasksFragment = TasksFragment.newInstance();
        ActivityUtils.addFragmentToActivity(getSupportFragmentManager(), tasksFragment, R.id.contentFrame);
    }
    // Create the presenter
    mTasksPresenter = new TasksPresenter(Injection.provideTasksRepository(getApplicationContext()), tasksFragment, Injection.provideSchedulerProvider());
    // Load previously saved state, if available.
    if (savedInstanceState != null) {
        TasksFilterType currentFiltering = (TasksFilterType) savedInstanceState.getSerializable(CURRENT_FILTERING_KEY);
        mTasksPresenter.setFiltering(currentFiltering);
    }
}
Also used : NavigationView(android.support.design.widget.NavigationView) ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar)

Example 70 with NavigationView

use of android.support.design.widget.NavigationView in project run-wallet-android by runplay.

the class WalletTransfersFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    recyclerView.setLayoutManager(new RecyclerLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
    recyclerView.setAdapter(new RecyclerView.Adapter() {

        @Override
        public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
            return null;
        }

        @Override
        public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        }

        @Override
        public int getItemCount() {
            return 0;
        }
    });
    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) ViewGroup(android.view.ViewGroup) RecyclerView(android.support.v7.widget.RecyclerView) NavigationView(android.support.design.widget.NavigationView) BindView(butterknife.BindView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView)

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