Advertisement
Guest User

Pppp

a guest
Jan 20th, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1. public void switchIcon(MenuItem item) {
  2.         layoutManager = recyclerView.getLayoutManager();
  3.         if (gitHubListAdapter.isSwitchView) {
  4.             recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
  5.             gitHubListAdapter.isSwitchView = true;
  6.             item.setIcon(ResourcesCompat.getDrawable(getResources(), R.drawable.ic_span_1, null));
  7.  
  8.         } else {
  9.             recyclerView.setLayoutManager(new GridLayoutManager(getContext(), 2));
  10.             gitHubListAdapter.isSwitchView = false;
  11.             item.setIcon(ResourcesCompat.getDrawable(getResources(), R.drawable.ic_span_3, null));
  12.  
  13.         }
  14.         gitHubListAdapter.notifyDataSetChanged();
  15.  
  16.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement