Search in sources :

Example 1 with BoardListVO

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;
}
Also used : BoardListVO(com.chrishoekstra.trello.vo.BoardListVO) TextView(android.widget.TextView)

Example 2 with BoardListVO

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);
}
Also used : BoardListVO(com.chrishoekstra.trello.vo.BoardListVO)

Example 3 with BoardListVO

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;
}
Also used : BoardListVO(com.chrishoekstra.trello.vo.BoardListVO) 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) ClientProtocolException(org.apache.http.client.ClientProtocolException)

Example 4 with BoardListVO

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();
}
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

BoardListVO (com.chrishoekstra.trello.vo.BoardListVO)4 TextView (android.widget.TextView)2 Intent (android.content.Intent)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 ListView (android.widget.ListView)1 BoardListAdapter (com.chrishoekstra.trello.adapter.BoardListAdapter)1 TrelloModel (com.chrishoekstra.trello.model.TrelloModel)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