@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_interview_question); ButterKnife.bind(this); tid = getIntent().getIntExtra(PARAM_ID, 1); toolbar.setTitleTextColor(getResources().getColor(R.color.white)); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(true); adapter = new InterviewQuestionAdapter(this, this); linearLayoutManager = new LinearLayoutManager(this); recyclerView.setLayoutManager(linearLayoutManager); recyclerView.setAdapter(adapter); recyclerView.addOnScrollListener( new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); int lastPosition = linearLayoutManager.findLastCompletelyVisibleItemPosition(); if ((lastPosition == linearLayoutManager.getItemCount() - 1) && dy > 0) { presenter.loadMoreJobItems(tid); } } }); presenter.firstTimeLoadJobItems(tid); }
@Override protected void onDestroy() { super.onDestroy(); // ButterKnife.unbind(this); }