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