use of com.chrishoekstra.trello.vo.BoardListVO in project Trello-Android by chrisHoekstra.
the class BoardListAdapter method getView.
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
TextView nameText;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.board_list_row, null);
nameText = (TextView) convertView.findViewById(R.id.name);
convertView.setTag(R.id.name, nameText);
} else {
nameText = (TextView) convertView.getTag(R.id.name);
}
BoardListVO boardList = mBoardLists.get(position);
if (boardList != null) {
nameText.setText(boardList.name);
}
return convertView;
}
use of com.chrishoekstra.trello.vo.BoardListVO in project Trello-Android by chrisHoekstra.
the class BoardListActivity method populateView.
private void populateView() {
BoardListVO list = mModel.getBoardList(mBoardId, mBoardListId);
mBoardListText.setText(list.name);
}
use of com.chrishoekstra.trello.vo.BoardListVO in project Trello-Android by chrisHoekstra.
the class TrelloService method getListsByBoard.
public ArrayList<BoardListVO> getListsByBoard(String boardId) {
ArrayList<BoardListVO> result = null;
ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
params.add(new BasicNameValuePair("key", PUBLIC_KEY));
params.add(new BasicNameValuePair("token", mToken));
params.add(new BasicNameValuePair("cards", "none"));
HttpGet httpGet = new HttpGet(TRELLO_API_URL + "boards/" + boardId + "/lists?" + URLEncodedUtils.format(params, "UTF-8"));
HttpClient httpClient = getHttpClient();
try {
httpGet.setHeader("Accept", "application/json, text/javascript, */*; q=0.01");
httpClient.getParams().setParameter(CoreProtocolPNames.USER_AGENT, USER_AGENT_STRING);
HttpResponse response = httpClient.execute(httpGet, mContext);
if (response != null) {
result = mObjectMapper.readValue(mJsonFactory.createJsonParser(new InputStreamReader(response.getEntity().getContent(), "UTF-8")), new TypeReference<ArrayList<BoardListVO>>() {
});
}
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return result;
}
use of com.chrishoekstra.trello.vo.BoardListVO 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