Search in sources :

Example 1 with BoardVO

use of com.chrishoekstra.trello.vo.BoardVO in project Trello-Android by chrisHoekstra.

the class BoardAdapter method getView.

@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    TextView nameText;
    if (convertView == null) {
        convertView = mInflater.inflate(R.layout.board_row, null);
        nameText = (TextView) convertView.findViewById(R.id.name);
        convertView.setTag(R.id.name, nameText);
    } else {
        nameText = (TextView) convertView.getTag(R.id.name);
    }
    BoardVO board = mBoards.get(position);
    if (board != null) {
        nameText.setText(board.name);
    }
    return convertView;
}
Also used : TextView(android.widget.TextView) BoardVO(com.chrishoekstra.trello.vo.BoardVO)

Example 2 with BoardVO

use of com.chrishoekstra.trello.vo.BoardVO in project Trello-Android by chrisHoekstra.

the class TrelloService method getAllBoards.

public ArrayList<BoardVO> getAllBoards() {
    ArrayList<BoardVO> result = null;
    ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
    params.add(new BasicNameValuePair("key", PUBLIC_KEY));
    params.add(new BasicNameValuePair("token", mToken));
    HttpGet httpGet = new HttpGet(TRELLO_API_URL + "members/" + "me/" + "boards/" + "all?" + 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<BoardVO>>() {
            });
        }
    } catch (ClientProtocolException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    return result;
}
Also used : InputStreamReader(java.io.InputStreamReader) BasicNameValuePair(org.apache.http.message.BasicNameValuePair) HttpGet(org.apache.http.client.methods.HttpGet) DefaultHttpClient(org.apache.http.impl.client.DefaultHttpClient) HttpClient(org.apache.http.client.HttpClient) ArrayList(java.util.ArrayList) HttpResponse(org.apache.http.HttpResponse) TypeReference(org.codehaus.jackson.type.TypeReference) IOException(java.io.IOException) BoardVO(com.chrishoekstra.trello.vo.BoardVO) ClientProtocolException(org.apache.http.client.ClientProtocolException)

Aggregations

BoardVO (com.chrishoekstra.trello.vo.BoardVO)2 TextView (android.widget.TextView)1 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 ArrayList (java.util.ArrayList)1 HttpResponse (org.apache.http.HttpResponse)1 ClientProtocolException (org.apache.http.client.ClientProtocolException)1 HttpClient (org.apache.http.client.HttpClient)1 HttpGet (org.apache.http.client.methods.HttpGet)1 DefaultHttpClient (org.apache.http.impl.client.DefaultHttpClient)1 BasicNameValuePair (org.apache.http.message.BasicNameValuePair)1 TypeReference (org.codehaus.jackson.type.TypeReference)1