use of com.chrishoekstra.trello.adapter.BoardListAdapter in project Trello-Android by chrisHoekstra.
the class BoardActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.board);
// Instantiate view items
mBoardListsList = (ListView) findViewById(R.id.board_lists_list);
mBoardText = (TextView) findViewById(R.id.board);
// Instantiate models
mModel = TrelloModel.getInstance();
// Instantiate controllers
mController = TrelloController.getInstance();
// Create listeners
mOnBoardListsReceivedListener = new TrelloModel.OnBoardListsReceivedListener() {
@Override
public void onBoardListReceviedEvent(TrelloModel model, String boardId, ArrayList<BoardListVO> result) {
if (boardId.equals(mBoardId)) {
mBoardListAdapter = new BoardListAdapter(BoardActivity.this, R.id.name, result);
mBoardListsList.setAdapter(mBoardListAdapter);
}
}
};
mBoardListsList.setOnItemClickListener(new ListView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> listView, View view, int position, long id) {
Intent intent = new Intent(getParent(), BoardListActivity.class);
intent.putExtra(BundleKeys.BOARD_ID, mBoardId);
intent.putExtra(BundleKeys.BOARD_LIST_ID, mBoardListAdapter.getItem(position).id);
((TabActivityGroup) getParent()).startChildActivity("BoardListActivity", intent);
}
});
// Add listeners
mModel.addListener(mOnBoardListsReceivedListener);
// Get bundle extras
getBundleExtras((savedInstanceState != null) ? savedInstanceState : getIntent().getExtras());
// Instantiate activity variables
mController.getListsByBoard(mBoardId);
populateView();
}
Aggregations