Skip to content

Instantly share code, notes, and snippets.

@lmeadors
Created July 2, 2013 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lmeadors/5913811 to your computer and use it in GitHub Desktop.
Save lmeadors/5913811 to your computer and use it in GitHub Desktop.
@Override
public BorrowedListMessage getBorrowed(Context context) {
final BorrowedListMessage message;
final App app = App.getInstance();
if(null == app.getBorrowed()){
message = serializableCache.loadCachedData(BorrowedListMessage.class, context.getCacheDir());
app.setBorrowed(message);
}else {
message = app.getBorrowed();
}
if (message != null) {
final List<Title> borrowedTitles = message.getTitles();
if (borrowedTitles != null) {
final List<Title> toRemove = new ArrayList<Title>();
for (Title borrowedTitle : borrowedTitles) {
if (borrowedTitle.isPastDue()) toRemove.add(borrowedTitle);
}
borrowedTitles.removeAll(toRemove);
message.setTitles(borrowedTitles);
}
}
return message;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment