Created
February 28, 2015 08:07
-
-
Save mzgreen/72ef88c35fae6e979f15 to your computer and use it in GitHub Desktop.
ActivityPartTwo class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class PartTwoActivity extends ActionBarActivity { | |
| private Toolbar mToolbar; | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| setTheme(R.style.AppThemeGreen); | |
| super.onCreate(savedInstanceState); | |
| setContentView(R.layout.activity_part_two); | |
| initToolbar(); | |
| initRecyclerView(); | |
| } | |
| private void initToolbar() { | |
| mToolbar = (Toolbar) findViewById(R.id.toolbar); | |
| setSupportActionBar(mToolbar); | |
| setTitle(getString(R.string.app_name)); | |
| mToolbar.setTitleTextColor(getResources().getColor(android.R.color.white)); | |
| } | |
| private void initRecyclerView() { | |
| final RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerView); | |
| recyclerView.setLayoutManager(new LinearLayoutManager(this)); | |
| RecyclerAdapter recyclerAdapter = new RecyclerAdapter(createItemList()); | |
| recyclerView.setAdapter(recyclerAdapter); | |
| recyclerView.setOnScrollListener(new HidingScrollListener(this)); | |
| } | |
| private List<String> createItemList() { | |
| List<String> itemList = new ArrayList<>(); | |
| for(int i=0;i<20;i++) { | |
| itemList.add("Item "+i); | |
| } | |
| return itemList; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment