Search in sources :

Example 1 with BoardListAdapter

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();
}
Also used : BoardListVO(com.chrishoekstra.trello.vo.BoardListVO) Intent(android.content.Intent) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) ListView(android.widget.ListView) TrelloModel(com.chrishoekstra.trello.model.TrelloModel) BoardListAdapter(com.chrishoekstra.trello.adapter.BoardListAdapter)

Aggregations

Intent (android.content.Intent)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 ListView (android.widget.ListView)1 TextView (android.widget.TextView)1 BoardListAdapter (com.chrishoekstra.trello.adapter.BoardListAdapter)1 TrelloModel (com.chrishoekstra.trello.model.TrelloModel)1 BoardListVO (com.chrishoekstra.trello.vo.BoardListVO)1