use of com.chrishoekstra.trello.vo.NotificationVO in project Trello-Android by chrisHoekstra.
the class TrelloModel method setNotifications.
public void setNotifications(ArrayList<NotificationVO> notifications) {
mNotifications = notifications;
int count;
for (NotificationVO notification : notifications) {
if (notification.data.card != null) {
count = 0;
if (mCardNotifications.containsKey(notification.data.card.id)) {
count = mCardNotifications.get(notification.data.card.id);
}
mCardNotifications.put(notification.data.card.id, count);
}
}
}
use of com.chrishoekstra.trello.vo.NotificationVO in project Trello-Android by chrisHoekstra.
the class TrelloService method getNotifications.
public ArrayList<NotificationVO> getNotifications() {
ArrayList<NotificationVO> 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/" + "notifications?" + 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<NotificationVO>>() {
});
}
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return result;
}
use of com.chrishoekstra.trello.vo.NotificationVO in project Trello-Android by chrisHoekstra.
the class NotificationsAdapter method getView.
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.notification_row, null);
holder = new ViewHolder();
holder.notificationText = (TextView) convertView.findViewById(R.id.notification_text);
holder.dateText = (TextView) convertView.findViewById(R.id.date);
holder.gravatar = (GravatarView) convertView.findViewById(R.id.gravatar);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
NotificationVO notification = mNotifications.get(position);
if (notification != null) {
holder.notificationText.setText(Utils.getHtmlFormattedNotificationText(notification));
holder.dateText.setText(Utils.getFormattedStringFromDate(notification.date));
//MemberVO member = mModel.getAllBoardsResult().members.get(mModel.getAllBoardsResult().members.indexOf(notification.idMemberCreator));
//holder.gravatar.setInitials(member.initials);
holder.gravatar.setDefaultImageType(GravatarAPI.DEFAULT_IMAGE_404);
holder.gravatar.setAvatarURL(GravatarAPI.getAvatarURLById(mModel.getGravatarId(notification.idMemberCreator)));
}
return convertView;
}
Aggregations