I have a bundle with a timeline card inside. The main timeline card which I want to be the cover is set to be the cover(isBundleCover=true). However when the cards are inserted and the user taps to see or looks up to activate the display the inner bundle card(not cover) is shown first. Is there a way to show the cover first? Is this acting as intended? I've tried changing the order of cards inserted and did not make a difference.
Credential credential = AuthUtil.getCredential(id);
Mirror service = MirrorClient.getMirror(credential);
boolean newNotification = false;
TimelineItem timelineItem = null;
TimelineItem notesTimelineItem = null;
List<TimelineItem> oldCards = null;
oldCards = service.timeline().list()
.setBundleId(String.valueOf(call.getId()))
.execute().getItems();
if (oldCards != null)
if (oldCards.size() < 1) {
timelineItem = new TimelineItem();
notesTimelineItem = new TimelineItem();
timelineItem.setId(String.valueOf(call.getId()));
timelineItem.setBundleId(String.valueOf(call.getId()));
notesTimelineItem.setBundleId(String.valueOf(call.getId()));
timelineItem.setIsBundleCover(true);
newNotification = true;
timelineItem.setHtml(TimeLineHTMLFactory.getDispatchCard( call.getType(), call.getAddress(), call.getUnits(),String.valueOf(call.getLat() / 1E6), String.valueOf(call.getLongi() / 1E6)));
if (call.getNotes().contentEquals("")) {
notesTimelineItem.setText("Notes not available");
} else {
notesTimelineItem.setText(call.getNotes());
notesTimelineItem.setTitle("Notes");
}
notesTimelineItem.setSourceItemId("notes");
Location incident = new Location();
incident.setLatitude(call.getLat() / 1E6);
incident.setLongitude(call.getLongi() / 1E6);
notesTimelineItem.setLocation(incident);
List<MenuItem> menuItemList = new ArrayList<MenuItem>();
menuItemList.add(new MenuItem().setAction("NAVIGATE"));
menuItemList.add(new MenuItem().setAction("TOGGLE_PINNED"));
notesTimelineItem.setMenuItems(menuItemList);
} else {
for (int i = 0; i < oldCards.size(); ++i) {
log.log(Level.WARNING, "updating oldCard: "
+ oldCards.get(i).getId());
log.log(Level.WARNING,"sourceItemId: "+oldCards.get(i).getSourceItemId());
boolean isCover=false;
try{
isCover=oldCards.get(i).getIsBundleCover();
}catch(Exception e){
log.log(Level.WARNING,"Exception getting isBundleCover: "+e.getMessage());
}
if (isCover) {
// MAIN DISPATCH CARD
oldCards.get(i)
.setHtml(
TimeLineHTMLFactory.getDispatchCard(
call.getType(), call
.getAddress(), call
.getUnits(),
String.valueOf(call
.getLat() / 1E6),
String.valueOf(call
.getLongi() / 1E6)));
} else if (oldCards.get(i).getSourceItemId()
.contains("notes")) {
if (call.getNotes().contentEquals("")) {
oldCards.get(i).setText("Notes not available");
} else {
oldCards.get(i).setText(call.getNotes());
}
oldCards.get(i).setTitle("Notes");
Location incident = new Location();
incident.setLatitude(call.getLat() / 1E6);
incident.setLongitude(call.getLongi() / 1E6);
if(incident!=null){
oldCards.get(i).setLocation(incident);
}
List<MenuItem> menuItemList = new ArrayList<MenuItem>();
menuItemList.add(new MenuItem()
.setAction("NAVIGATE"));
menuItemList.add(new MenuItem()
.setAction("TOGGLE_PINNED"));
oldCards.get(i).setMenuItems(menuItemList);
}
}
}
if (oldCards.size() > 0) {
for (TimelineItem card : oldCards) {
log.log(Level.WARNING,
"oldCard id: " + card.getId()
+ " bundleid: "
+ card.getBundleId());
service.timeline().update(card.getId(), card)
.execute();
}
} else {
log.log(Level.INFO, "New notification here");
timelineItem.setNotification(new NotificationConfig().setLevel("DEFAULT"));
MirrorClient.insertTimelineItem(credential, notesTimelineItem);
MirrorClient.insertTimelineItem(credential, timelineItem);
}
JSON for Cover card:
{ "kind": "mirror#timelineItem", "id": "710a9f44-92e7-463e-801d-940b59aebb8e", "bundleId": "5808701407494144", "isBundleCover": true, "created": "2013-10-28T13:30:19.160Z", "updated": "2013-10-28T13:30:19.160Z", "etag": "1382967019160", "html": "\n \n \n\n \n \n \n E M S\n \n741 PARK AVE\n\n
\n \n\n", "notification": { "level": "DEFAULT" } }
JSON for Notes Card:
{
"kind": "mirror#timelineItem",
"id": "cfd7173f-4757-4e2e-9f2e-fbcbba2c0e99",
"bundleId": "5948571312455680",
"created": "2013-10-28T13:30:09.904Z",
"updated": "2013-10-28T13:30:09.904Z",
"etag": "1382967009904",
"title": "Notes",
"text": "Notes go in here...",
"location": {
"kind": "mirror#location",
"latitude": 37.922223,
"longitude": -87.805731
},
"menuItems": [
{
"action": "NAVIGATE"
},
{
"action": "TOGGLE_PINNED"
}
]
}